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
Bare '(mut self)' receiver param passes check but collapses in lowering (codegen failure / bogus generic-contract BUG) #897
use std.builtins.print_i32
type P { v: Vec[i32], n: i32 }
impl P:
mut fn take_it(mut self): // ← bare form, no `: Self`
var x: Vec[i32] = move self.v
print_i32(x.len() as i32)
fn main:
var xs: Vec[i32] = Vec.new()
xs.push(7)
var p = P { v: xs, n: 1 }
p.take_it()
with run → error: code generation failed (no diagnostic naming a site).
Variants of the same body produce BUG: user generic call lacks a concrete contract: ... sig=-1 mono=0 from MirModule.validate_generic_call_contracts
instead — including a move-free body (let x = self.v.clone(); x.len()), so
the collapse is the receiver form itself, not the field move.
Expected
Either the bare (mut self) spelling is legal and behaves exactly like the
two working forms, or it is a parse/sema error. Both canonical spellings work
today with the identical body:
mut fn take_it(): (implicit receiver) → OK
mut fn take_it(mut self: Self): (documented in InitTemplates) → OK
Evidence
analyze ... select: shows the bare form's receiver fact as declared=mut required=read even when the body vacates a field
(write); the threading then lowers against the wrong mode.
Pre-existing: reproduces identically on the last-green seed; found while
implementing D32 (the receiver-vacate fixtures), not introduced by it.
Also reproduces with (self) bare read receivers: sema errors
"method receiver mode is missing; compiler effects require fn" — so the
read-side bare form is at least loud; the mut-side bare form is silent
until codegen.
Workaround used
D32 fixtures/migration use the implicit-receiver spelling. Fix should remove
the need to know this.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): still reproduces, now as an internal compiler error with the body named:
impl P:
mut fn take_it(mut self):
var x: List[i32] = move self.v
error: internal compiler error: invalid MIR before codegen (a bug in the With compiler, not in this program): use rvalue type is incompatible with assign destination (dest ty=196 kind=19, src ty=14 kind=4) in `take_it`
pre-release: an ICE on a spelling the compiler accepts. Either the explicit receiver is refused beside mut fn (D7; eliminate-self.md phase 4), or it lowers like the synthesized one.
Fixed on main by d8cd406 (#2718), merged through stack 8 whose seed-driven battery was green on its top (gate, uat and survey all green). Regression test: test/behavior/behav_897_written_receiver_is_the_keywords.w.
Activity
D32: implement STRICT field moves — site-local check, tree migration,…
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): still reproduces, now as an internal compiler error with the body named:pre-release: an ICE on a spelling the compiler accepts. Either the explicit receiver is refused beside
mut fn(D7;eliminate-self.mdphase 4), or it lowers like the synthesized one.Parser: a receiver written untyped beside the method keyword is the k…
Parser: a receiver written untyped beside the method keyword is the k…
Parser: a receiver written untyped beside the method keyword is the k…
ehartford commentedon Oct 26, 2026
Fixed on main by d8cd406 (#2718), merged through stack 8 whose seed-driven battery was green on its top (gate, uat and survey all green). Regression test:
test/behavior/behav_897_written_receiver_is_the_keywords.w.#3112: a written `self` with no type on a function outside a type is …
#3112: a written `self` with no type on a function outside a type is …