Skip to content

#3044, #3046, #3047 (Gap 1), #3048, #3049: five spec-gap fixes from the #2982 audit - #3054

Merged
ehartford merged 1 commit into
mainfrom
spec-gaps-4
Nov 6, 2026
Merged

ehartford merged 1 commit into
mainfrom
spec-gaps-4

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Five spec-gap fixes from the #2982 audit (docs/proposals/bridge-the-impl-gap.md), each with a failing-first fixture.

Two defects only the seed-built stage1 exposed while the D140 switch was wired, both located in lldb on out/bootstrap/bin/with-stage1:

  1. An untyped const read inside the initializer pass. Sema.check_ident excluded a const from check_top_level_let_before_use, so a body typed inside check_top_level_let_values (→ ensure_body_typed → check_callee_bodies_first through rt_core bodies → InternStringArena.store) read the const's 0 slot with no diagnostic, and MIR refused the body (use rvalue type is incompatible with assign destination, dest TY_NEVER). Proof: a conditional breakpoint on update_module_context (di == 7231) with a 30-frame backtrace naming the chain. Fixture: behav_const_read_in_body_typed_during_global_pass.w (ICEd on the installed compiler before the fix).

  2. A str field saved by plain copy is a view under the pinned seed. let saved: str = self.current_module_path followed the field, so the restore after the D140 module switch assigned the trait's module back to itself, and every later field read in that body was cross-package (field ... is private to its package; selfcheck 24 errors; err_deref_cycle.w lost its diagnostic). Proof: package_of's argument read at entry (-K false, memory read -fs -c1 $x1) was <embedded-std>/std/traits.w at the refusal with no switch in between; a six-line probe prints the switched value under src/main run and the saved one under the installed compiler. The three plain-copy saves (resolve_trait_default_method_type, the check_bodies preparation, check_top_level_let_before_use) now save through with_str_clone_ref, marked seed-bound for the next seed pin.

Iterate tier on the seed-built stage1 (WITH=$PWD/src/main src/main build :dev): check src/main.w clean; test/hello.w, the fixtures above, the four behav_compiler_hook_* fixtures, err_deref_cycle.w and err_tailrec_drop_local_live.w pass. src/main build :gate green; :deep-debug-tool-tests --no-deps and :drop-audit green; ceremony census diff ok.

#2982 audit

#3044: an async block's consumed captures are recorded (record_async_block_captures),
so the debug allocator sees one owner. #3046: `xs[i]` is user-indexable through
Index/IndexMut for a non-int index, and `get` is not a place. #3047 Gap 1: a trait
default method's parameter types resolve in the trait's own module (D140), so an
impl that leaves the types to the trait never imports them; Gap 2 stays open.
#3048: a blanket impl's methods dispatch by bound, and an unmet bound is refused.
#3049: a slice of a raw pointer requires unsafe.

Two defects the seed-built stage1 exposed while the D140 switch was wired, both
proven in lldb on out/bootstrap/bin/with-stage1:

- Sema.check_ident excluded a `const` from check_top_level_let_before_use, so a
  body typed inside the initializer pass (check_top_level_let_values →
  ensure_body_typed → check_callee_bodies_first through rt_core bodies →
  InternStringArena.store) read an untyped const's slot and got 0 with no
  diagnostic; MIR then refused the body ("use rvalue type is incompatible with
  assign destination", TY_NEVER). Fixture:
  behav_const_read_in_body_typed_during_global_pass.w.

- A `str` field saved by plain copy (`let saved: str = self.current_module_path`)
  is a view of the field under the pinned seed, not a copy (D111): the restore
  after the D140 module switch assigned the trait's module back to itself, and
  every later field read in that body was cross-package ("field ... is private to
  its package"), selfcheck red at 24 errors. package_of's argument read at entry
  under lldb showed <embedded-std>/std/traits.w at the refusal with no switch in
  between; a probe prints the switched value under `src/main run` and the saved
  one under the installed compiler. The three plain-copy saves
  (resolve_trait_default_method_type, the check_bodies preparation,
  check_top_level_let_before_use) now clone, marked seed-bound.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery green on ffb3e828b (seed-driven, with run tools/battery.w): gate, with uat 13 scenarios (11 pass, 2 skip: the Windows raylib leg and nothing else; raylib_spiral and sdl pass), battery-checks all green. A first run went red only on raylib_spiral's with run step because the console screen locked mid-run (the documented blameless case); the re-run with the display held passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant