Motivation
PR #948 removed the mutabilityOf(...) ==K mutabilityMut guard from #setLocalValue, because MIR's LocalDecl::mutability is a source-level annotation (let x vs let mut x), not an assignment constraint. The Rust compiler's borrow checker validates assignment legality before emitting MIR, so all assignments in well-formed MIR are valid regardless of the mutability field.
After #948, #forceSetLocal is functionally identical to #setLocalValue — both write without checking mutability.
Proposal
Remove mutability tracking from the MIR semantics definition entirely:
- Remove
mutabilityMut / mutabilityNot from typedValue and related data structures
- Unify
#forceSetLocal into #setLocalValue (or remove #forceSetLocal)
- Clean up any remaining mutability checks or propagation throughout the codebase
References
Motivation
PR #948 removed the
mutabilityOf(...) ==K mutabilityMutguard from#setLocalValue, because MIR'sLocalDecl::mutabilityis a source-level annotation (let xvslet mut x), not an assignment constraint. The Rust compiler's borrow checker validates assignment legality before emitting MIR, so all assignments in well-formed MIR are valid regardless of the mutability field.After #948,
#forceSetLocalis functionally identical to#setLocalValue— both write without checking mutability.Proposal
Remove mutability tracking from the MIR semantics definition entirely:
mutabilityMut/mutabilityNotfromtypedValueand related data structures#forceSetLocalinto#setLocalValue(or remove#forceSetLocal)References
fix(rt): remove mutability guard on local variable assignmentLocalDecl::mutabilitydocs: "Whether this is a mutable binding (i.e.,let xorlet mut x). Temporaries and the return place are always mutable."