perf: avoid blocking on proof elaboration in Environment.hasUnsafe (#11606)

This commit is contained in:
Sebastian Ullrich 2025-12-11 18:24:01 +01:00 committed by GitHub
parent cec9758c2d
commit 2d3dec41ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2503,6 +2503,10 @@ unsafe def evalConstCheck (α) (env : Environment) (opts : Options) (typeName :
| _ => throwUnexpectedType typeName constName
def hasUnsafe (env : Environment) (e : Expr) : Bool :=
-- This line should not affect the result value but it avoids potential blocking in `isUnsafe` as
-- there is a fast path for theorems, so we want to make sure we do not perceive them merely as
-- axioms (for imported theorems this does not matter as there is nothing to block on).
let env := env.setExporting false
let c? := e.find? fun e => match e with
| Expr.const c _ =>
match env.findAsync? c with