You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
with analyze audit:resolution says ok over a call whose MIR argument count differs from Sema's resolution (the #3335 program) #3343
trait P:
fn a(x: &str) -> Option[Self]
fn must(x: &str) -> Self:
let got = Self.a(x)
got.unwrap()
impl P for i32:
fn a(x: &str) -> Option[i32]: if x == "1": Some(1) else: None
fn main:
print(i32.must("1"))
with build emits call @i32.P.a(%str zeroinitializer, %str …), two arguments to a one-parameter function, and LLVM refuses it. with analyze dl.w audit:resolution on the same program ends resolution-audit: facts=… violations=0 ok.
Sema's fact is right (select:kind=call,name~P.a shows resolved-call sig=… args=1). The default method's body does not appear in --dump-mir or in the MIR facts (select:stage=mir,name~must lists only the call of must from main), so the audit never compares that body's calls with Sema's.
Expected: the audit covers the bodies of default trait methods instantiated for an impl (they are lowered and emitted, so they have MIR), and --dump-mir prints them; an uninstrumented body is an audit failure, not a blind spot.
To reproduce today: check out cc82e4d, or revert the three static_receiver_calls reads in MirLower.lower_method_call.
Exact place: Codegen.generate_default_trait_method_for_impl (src/CodegenTraits.w, "MIR-based default trait method body compilation") creates a MirBuilder and lowers the default body itself, during code generation. That body is never a member of the MIR module, so --dump-mir, --validate-all, the drop and ownership validators and every with analyze audit never see it: the resolution audit could not have compared the call in #3335's program, and nothing validates a default method's drops either.
Fix: default method bodies instantiated for an impl are lowered in the MIR phase with every other body (the impl's own copy of the body, AstPool.impl_default_body, under the impl method's signature) and codegen emits them from the module like any function. Then the audit's "an uninstrumented body is a failure" covers them with no special case. D65: codegen decides how; it does not lower.
Activity
ehartford commentedon Nov 15, 2026
Exact place:
Codegen.generate_default_trait_method_for_impl(src/CodegenTraits.w, "MIR-based default trait method body compilation") creates aMirBuilderand lowers the default body itself, during code generation. That body is never a member of the MIR module, so--dump-mir,--validate-all, the drop and ownership validators and everywith analyzeaudit never see it: the resolution audit could not have compared the call in #3335's program, and nothing validates a default method's drops either.Fix: default method bodies instantiated for an impl are lowered in the MIR phase with every other body (the impl's own copy of the body,
AstPool.impl_default_body, under the impl method's signature) and codegen emits them from the module like any function. Then the audit's "an uninstrumented body is a failure" covers them with no special case. D65: codegen decides how; it does not lower.A default trait method an impl inherits is lowered with the module (#…