Skip to content

D144: a binding from a place of plain bits takes the value, any other observes it (#2541); #2532 D93 rounds; #2531 fixture - #2543

Merged
ehartford merged 8 commits into
mainfrom
bug-2541
Oct 22, 2026
Merged

ehartford merged 8 commits into
mainfrom
bug-2541

Conversation

@ehartford

@ehartford ehartford commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

#2531, #2532 and D144 (#2541), as ruled 2026-10-21

Two follow-up commits after the first push: a by-value parameter is an owned pattern subject (§9.7), taken apart by value; and a bare local holding a non-Copy payload keeps D115's implicit take (let (tx, rx) = pair in the channel fixtures), recorded in D144 as open for Eric's ruling. The #1531 compile-error fixture that pinned the view of a plain-bits field let gives way to behav_d144_plain_bits_let_snapshots.w.

Eric Hartford added 8 commits October 21, 2026 21:51
The ICE no longer reproduces after the D103 tail conversion and D140/D141
landed; the fixture pins the instance (`impl[T] Iter[&T] for Count[T]`,
`mut fn next():`) and closes the issue.
The by-use check ran exactly twice, and a demand that exists only once
another binding is decided (`files.push(p)` with `p` an element of a
decided `site_paths`) was never heard. The program is now checked until
no demand changes a binding's type, and the decisions accumulate across
rounds: a round hears demands only of the bindings still undecided (the
demand is recorded on the unknown-method path), so a decided binding
keeps its decision when a later round does not mention it; eight rounds
oscillated without that. tools/sweep_some_at_option_demand.w drops the
hand-typed `List.new()` it wrote around the gap.
… binding from a place observes it (#2541)

Eric ruled #2541 observe and the `let i = self.idx` ceremony report fixed
by D44's rule, as one rule: a binding from a place of a plain-bits type
(integers, floats, bool, pointers, plain structs of those) takes the
value; any other binding from a place observes it. `match self.current:
Some(c) => c.push(9)` now observes the List in place (MIR aliases the
binding to the payload's place; Sema marks it view-bound with the
subject's borrow), a mutating call through it writes the field when the
subject's root is mutable and stays refused when it is not, and
assigning the field while the binding is live is refused like any other
conflict with a live view. `let i = self.idx` snapshots the isize, so
`self.idx += 1` after it is fine; the annotation #1531 made people write
is now a census pattern (plain-bits-field-copy-annotation) and
tools/sweep_plain_bits_field_copies.w removes it. The sweep over src/,
build/ and tools/ waits for a seed with D144 (the pinned seed refuses
`self.idx += 1` after the unannotated let), as D103's seed-blocked
sites did; 436 such annotations stand there today.

Spec words in §3.8; decision record D144.
…ved redundant are removed (D144 sweep)

tools/sweep_plain_bits_field_copies.w over the std modules and the example
roots the release compiler builds: 8 annotations. src/, build/ and tools/
wait for a seed with D144 (436 sites), as D103's seed-blocked sites did.
The census pattern plain-bits-field-copy-annotation counts the `let i: T =
self.f` annotations D144 makes redundant; src/, build/ and tools/ keep
theirs until a seed with D144 is pinned (the pinned seed refuses the
unannotated let before a mutation), so the counts are granted at their
current ceilings and fall to zero at that seed's sweep.
…y value

§9.7 lists a parameter with the temporaries and `move` places as owned: a
`match g` on `g: G[str]` moves its payload out (da_generic_enum_nested_
generic_payload). The observe rule applies to places: a local, a field,
a global, a `self` that borrows the caller's place.
err_1531_copy_field_let_is_view.w pinned the view a plain-bits field let
bound; under D144 that let takes the value, so the fixture becomes the
positive behav_d144_plain_bits_let_snapshots.w (a test encoding behavior
a later ruling changed gives way, D139). behav_1531_copy_field_view_and_
copy.w still passes: its annotated copy and its joins read the same.
`let pair = channel(); let (tx, rx) = pair; producer(move tx)` (three
fixtures) destructures a local holding resources and moves a binding on;
observing the local would refuse that until `move pair` is written. The
pattern-observe rule applies to projections and to value payloads; a bare
local with a non-Copy payload is taken apart as before. Recorded in D144
as open for Eric's ruling.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on 8417012: gate, uat and battery-checks under the pinned seed, logs in out/battery/.

@ehartford
ehartford marked this pull request as ready for review October 22, 2026 04:29
@ehartford
ehartford merged commit 5e0bd90 into main Oct 22, 2026
@ehartford
ehartford deleted the bug-2541 branch October 22, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment