Skip to content

Commit dffaa93

Browse files
committed
perf: avoid blocking on proof elaboration in Environment.hasUnsafe
1 parent 19e1fe5 commit dffaa93

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Lean/Environment.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,6 +2503,10 @@ unsafe def evalConstCheck (α) (env : Environment) (opts : Options) (typeName :
25032503
| _ => throwUnexpectedType typeName constName
25042504

25052505
def hasUnsafe (env : Environment) (e : Expr) : Bool :=
2506+
-- This line should not affect the result value but it avoids potential blocking in `isUnsafe` as
2507+
-- there is a fast path for theorems, so we want to make sure we do not perceive them merely as
2508+
-- axioms (for imported theorems this does not matter as there is nothing to block on).
2509+
let env := env.setExporting false
25062510
let c? := e.find? fun e => match e with
25072511
| Expr.const c _ =>
25082512
match env.findAsync? c with

0 commit comments

Comments
 (0)