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
MIR: borrowed receivers (ch in s, IndexPlace get/set, generator next) are lowered as moves, so the drop-state sees a moved value that is still owned #1505
Found while landing #1414's validate-ownership rule ("a move of an already-moved place"). The rule judges statement moves only, because three lowerings pass a receiver the callee borrows as an OK_MOVE operand. The drop-state dataflow then marks the receiver Moved after the first call, and the second call "moves a moved place" although nothing was ever moved. Stage2 of main f1e3bd2, --dump-mir:
ch in s (MirLower.lower_str_contains_char, lower_receiver_with_method_autoderef): the STR_CONTAINS_CHAR receiver.
let email = f"user{n}@example.com"
assert('@' in email)
assert('!' not in email)
Codegen reads the receiver as a value and calls with_str_contains_char_ref (a borrow); run --debug-alloc is clean (leak 0), so the MIR's move is not what runs. (test/spec/spec_ss09_9_the_in_operator.w)
g[i] += 100 over a user IndexPlace (fn get(self: &Self, ...), fn set(mut self: Self, ...)):
In each case the call's ABI (FnAbi: IndirectPlace for the in-place receiver, the &Self reference, the _ref runtime helper) borrows; only the MIR operand says move. Anything that reads MIR ownership believes the value left: the drop plan says skip for a drop that codegen still runs, and #1414's rule, applied to call arguments, rejected these three legal programs (validate-all).
Expected: a borrowed receiver is lowered as the borrow it is (a ref / place operand, or OK_COPY of a place the callee reads in place), so --dump-drop-plan says drop for the final drop of email, iter and g, and #1414's rule can judge call arguments too (MirCore.validate_ownership_body, the terminator arm left out for this).
Activity
validate-ownership: a statement move of an already-moved place is rej…
validate-ownership: a statement move of an already-moved place is rej…
MIR: a borrowed receiver is lowered as a read; validate-ownership jud…
Ownership: D72 liveness byte, D73 assignment-as-read, validator leak/…