Skip to content

with analyze audit:resolution — every MIR callee/place/binding/effect and every codegen passing mode must agree with its one authoritative producer (D65) #1647

Closed

Description

@ehartford

D65 (decisions.md) makes it a rule: each semantic fact has one authoritative producer (Sema: resolved declaration, type, place/value/view category, origin, operation effect, capture semantics, call target; MIR: CFG, storage, path-sensitive move/init state, drop points, cleanup edges; ABI/codegen: layout, PassMode, calling convention, LLVM representation). Downstream stages may propagate, materialize and verify a fact; they may not reconstruct it from syntax or representation. This issue is the executable half: a with analyze lane, audit:resolution, included in audit:all, red on:

  1. a MIR call whose callee does not correspond to Sema's resolved callee for the same AST node (A call through a let-alias of a non-Copy fn field (let r = c.run; r(21)) lowers as a call to a function NAMED r with the argument dropped — FATAL unhandled GENERIC_CALL; broke the build runner (build/corpora.w:74) #1635: MirLower read a view-bound ident as a function NAME after lookup_local failed — Sema had resolved it);
  2. a MIR place lowered from a source expression that does not correspond to Sema's resolved place/origin for that node (field index, autoderef, alias/view origin);
  3. a MIR move/borrow/capture classification that disagrees with Sema's effect summary for that operation (D62/D63 closure captures; consuming calls);
  4. a codegen marshalling decision taken from an LLVM type inspection rather than an explicit PassMode (the &fn marshalling crash: marshal_ref_addr passed a bare function item's code pointer because "the value is already a pointer").

The facts already exist on both sides (resolved_call_sigs, typed_expr_types, expr_view_param_origins, effect summaries, MIR call/place/argument facts, codegen marshalling facts with analysis_last_marshal_strategy); the lane joins them per node, like audit:calls/audit:mir do today. Violations are compiler failures (with build :dev and the battery run audit:all over the fixture corpus). Build it incrementally: (1) callee agreement first (would have caught #1635), (2) codegen mode provenance (would have caught the &fn crash), (3) places, (4) effects. Deferred large cleanup of MirLower's AST-first lookups until after STC (docs/stdlib_sourcing_plan.md); every bug fixed from now on moves its answer to the owner instead of adding a second derivation.

Activity

  1. added
    bug
    on Sep 24, 2026
  2. ehartford commented on Oct 2, 2026

    @ehartford
    ContributorAuthor

    Status on main (30f89aa), per docs/spec/implementation/mir-sema-hardening.md §4:

    Acceptance §6 is therefore 1 of 4 categories. Leaving open.

  3. ehartford commented on Oct 3, 2026

    @ehartford
    ContributorAuthor

    Phases 2–4 landed in 0f0d76b (#2012): codegen passing modes from FnAbi (8 sites, audit:codegen red→0); MIR field places / let bindings / call-argument transfers judged against Sema (0 violations over src/main.w, planted cases prove each lane fires). Remaining unconverted sites (mir_try_place_ptr_for_ref, mir_operand_local_holds_pointer, view origins and index/field projections by name, closure capture modes, LLVM-path sizeof from the AST, non-generic struct field types) are in progress on wave-d65b.

  4. 19 remaining items

  5. ehartford commented on Oct 3, 2026

    @ehartford
    ContributorAuthor

    Phases 1–4 complete on main 74e3001 (stack #2032, battery GREEN): codegen reads FnAbi/TypeLayout/Sema for pointer-holding, sizeof/alignof, field types and indexes, closure captures; Sema records per-instance index/field facts; MIR projections carry Sema's declaration index; monomorphize_struct_nodes' LLVM-layout path deleted; audit:all on src/main.w = 0 violations. Phase 5 continues as #2043.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions