lean4-htt/tests/elab/instances.lean
Sebastian Ullrich b1a991eee0
perf: separate meta and non-meta initializers (#12016)
This PR enables the module system, in cooperation with the linker, to
separate meta and non-meta code in native binaries. In particular, this
ensures tactics merely used in proofs do not make it into the final
binary. A simple example using `meta import Lean` has its binary size
reduced from 130MB to 1.7MB.

# Breaking change

`importModules (loadExts := true)` must now be preceded by
`enableInitializersExecution`. This was always the case for correct
importing but is now enforced and checked eagerly.
2026-02-26 08:05:19 +00:00

18 lines
463 B
Text

import Lean
open Lean
open Lean.Meta
instance : ToFormat InstanceEntry where
format e := format e.val
unsafe def tst1 : IO Unit := do
enableInitializersExecution
let env ← importModules (loadExts := true) #[{module := `Lean}] {}
let aux : MetaM Unit := do
let insts ← getGlobalInstancesIndex
assert! insts.size > 0
IO.println (format insts)
discard <| aux.run |>.toIO { fileName := "", fileMap := default } { env := env }
#eval tst1