Skip to content

LLBC backend: translate promoted MIR, so Lean models have no drop flags #5048

Description

@feliperodri

#5045 makes LLBC runs compile at -Zmir-opt-level=0, so moves stay moves and Aeneas accepts generic code. The backend still reads the MIR after drop elaboration, though, and the drop flags rustc inserts end up in the Lean model. For push in the experiment from #5045, upstream Charon reading promoted MIR (its default) gives:

match s.a with
| none =>
  let i ← s.len + 1#u8
  ok ({ s with a := (some x), len := i }, none)
...

while Kani's output gives a model with the drop flag threaded through:

let (t, o, i, o1, b) ← match s.a with ...
if b
then ok ({ a := (some t), b := o, len := i }, o1)
else ok ({ a := (some t), b := o, len := i }, o1)

Both are correct (the same Lean proof goes through on both), but the second is harder to read and to prove things about as code grows.

The obstacle is timing: rustc has already discarded (stolen) the promoted MIR by the end of analysis, and the drop-elaborated MIR by the time a codegen backend runs. Getting promoted MIR needs a query override that keeps a copy of each local body, which Charon's own driver sketches as a TODO (charon-driver/driver.rs), or translating before analysis finishes. Only LLBC runs would install it.

Activity

  1. added
    [C] Feature / EnhancementA new feature request or enhancement to an existing feature.
    Z-Kani CompilerIssues that require some changes to the compiler
    on Nov 6, 2026
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

    Z-Kani CompilerIssues that require some changes to the compiler[C] Feature / EnhancementA new feature request or enhancement to an existing feature.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions