Skip to content

D95 + D96: let _ drops; pub const takes its value's type; ?? below |>; every key hashed by the compiler, seeded, insertion-ordered maps - #2193

Merged
ehartford merged 5 commits into
d90-bfrom
d95-impl
Oct 5, 2026
Merged

ehartford merged 5 commits into
d90-bfrom
d95-impl

Conversation

@ehartford

@ehartford ehartford commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Layer 3 of stack #2196. Spec v7.24 (D95) and v7.25 (D96).

D95: let _ = x drops x, and a later use says so; pub const takes its value's type and a use it does not fit is an error at that use; ?? sits at its own level, right-associative, between the comparisons and |>; | < ^ < & in the C and spec order; a pipeline stage that is an operator expression is an error that suggests parentheses.

D96: a map key is any type whose == is structural and holds no float. A custom equality is a key projection (impl Key for T: fn key()). The runtime map is an insertion-ordered dense table, hashed with SipHash-1-3 keyed once per process. std.hash.hash_of is the same hash, for library containers; HashIndex uses it. Hash is no longer derived or written. Derived Eq/Ord take views. MAP_REMOVE drops the key it consumed.

Closes #2074, #2101, #2142, #2161, #2180.

D96's tombstone removal allocates nothing, so the #939 complexity pin is now a pass guarding that. Closes #939.

@ehartford
ehartford added this pull request to stack #2196 October 5, 2026 19:30
@ehartford ehartford changed the title d95 impl D95 + D96: let _ drops; pub const takes its value's type; ?? below |>; every key hashed by the compiler, seeded, insertion-ordered maps Oct 5, 2026
Eric Hartford added 5 commits October 5, 2026 13:23
…nds below |>; | < ^ < & (#2074, #2101, #2142)

§29.6: Sema treated a wildcard let as moving nothing while MIR dropped the
value, so a later use read freed memory. It now moves, and a later use says
"let _ = h dropped h at line N; remove it to keep h".

§9.1b: the parser refused a pub const without a type; the rule is gone,
and the guide no longer teaches it. A use an untyped constant does not fit
is refused at that use.

§9.9: ?? has its own level between the comparisons and |>, right-
associative. The parser also bound | tighter than & and ^ (1 | 2 & 4 was
0): the levels are now C's, as the spec's table always said. A token-level
sweep of the tree found no expression whose grouping either change moves
other than the spec test's (0xF0 & 0x0F) | (1 << 3) ^ 0b10, whose value is
the same both ways. A pipeline stage that is an operator expression
(xs |> sum() * 2) is refused with where the parentheses go.
… ==; maps iterate in insertion order (#2161, #2180)

A map key is any type whose == is structural and holds no float; a custom
equality is a key projection (impl Key for T: fn key()). The runtime map is
an insertion-ordered dense table with an i32 index, hashed by SipHash-1-3
keyed once per process; codegen emits a per-key-type hash and equality over
the key's parts or its projection. std.hash.hash_of is the same hash for a
library container (HashIndex now uses it). Hash is no longer derived or
written; derived Eq/Ord take views. MAP_REMOVE drops the probe key it
consumed (a leak da_d96_map_remove_drops_its_key pins).
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on the stack top a21e326 (stack #2196): gate rc=0 (102s), uat rc=0 (73s), battery-checks rc=0 (245s); green evidence published.

@ehartford
ehartford marked this pull request as ready for review October 5, 2026 20:31
@ehartford
ehartford merged commit 0ca8c22 into main Oct 5, 2026
@ehartford
ehartford deleted the d95-impl branch October 5, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant