Skip to content

An interface's own mention demands its declaration; an impl's name record is per tier (#2575) - #2577

Merged
ehartford merged 2 commits into
mainfrom
fix-2575
Oct 23, 2026
Merged

ehartford merged 2 commits into
mainfrom
fix-2575

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Fixes #2575, both halves, so a whole-program migration of M*LIB's upstream B+tree test (the Phase 4 test lane) checks clean beside the std engine.

  • An interface's own type mention demands the interface's declaration. std.engines.mlib.defs's multimap_ct = [multimap_s; 1] is over a record of the corpus's harness unit; a program declaring multimap_s and multimap_ct demanded the interface alias by name, and the program's real type displaced the interface's record (source_type_names), which was then never demanded, so the std alias reported "unknown type 'multimap_s'" at its own line. Displacement is for the program's mentions; a type name an interface declaration's run mentions is demanded whatever the program declares. Fixture behav_2575_program_type_beside_std_corpus_alias.w.
  • An impl's name record is per tier. With the interface's record demanded, its impl Copy for m_serial_ll_u is collected first and Same-named types in two modules: Self in a struct literal resolves to the other module's type; same-named methods collide (Item.total) #1457's name-keyed record held the trait "once for the name": the program's impl Copy was never recorded, and is_copy on the program's union (read by tier, D29) found no user-tier record. Each tier records its own impl. Fixture behav_2575b_program_impl_beside_std_corpus_impl.w.

The stage divergence the issue noted is not a miscompile: a seed-built stage1's runtime root carries no corpus bundles, so it loads the engines as source and nothing is lazily demanded there.

Eric Hartford added 2 commits October 23, 2026 03:36
…whatever the program declares under that name

#2575: the prelude reaches std.engines.mlib.defs, whose alias
`multimap_ct = [multimap_s; 1]` is over a record of the corpus's harness
unit. A program declaring `multimap_s` (a record) and `multimap_ct`
demanded the interface alias by name (a source declaration's name is a
mention), and the alias's body then mentioned `multimap_s`, whose
interface record the program's real type displaces
(`source_type_names`): never demanded, the alias resolved in its own
module and reported "unknown type 'multimap_s'" at the std's line. Every
alias a whole-program migration of M*LIB's test unit redeclares did the
same (31 errors), which blocked the Phase 4 test lane.

The displacement rule is for the program's mentions. A type name an
interface declaration's own run mentions is recorded apart, and an
interface type the program displaces is still demanded when the
interface itself asks for it: from std, `multimap_s` is std's; from the
program, the program's. Fixture
behav_2575_program_type_beside_std_corpus_alias.w.

The stage divergence the issue notes is not a miscompile: a seed-built
stage1 carries no corpus bundle slots, so the engine loads as source and
nothing is lazily demanded there.
…n for the program's

#2575, second half. With the interface's record demanded, its `impl Copy
for m_serial_ll_u` is collected first; #1457's rule then kept the
name-keyed impl record "once for the name", so the program's `impl Copy
for m_serial_ll_u` was never added, and `is_copy` on the program's union
(a shadowed name, read by tier) found no user-tier Copy record: "type
'm_serial_read_s' cannot implement Copy: field 'tmp' is not Copy".

The name record is what select_trait_impl_tiered reads, by tier
(impl_extra_is_std, D29): a record of another tier holds the trait for
its own tier only, so each tier records its own impl. Fixture
behav_2575b_program_impl_beside_std_corpus_impl.w.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on 018e4b9 (seed nightly-20261020-local-3, 387 s wall; logs out/battery/ in the worktree). Gate green.

@ehartford
ehartford marked this pull request as ready for review October 23, 2026 07:52
@ehartford
ehartford merged commit 285c495 into main Oct 23, 2026
@ehartford
ehartford deleted the fix-2575 branch October 23, 2026 07:52
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