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
Sema: a consuming str parameter of an associated call (T.make(p)) escapes the use-after-move check; a free call is diagnosed #1588
type T { n: i64 }
fn T.make(s: str) -> T: T { n: s.len() }
fn free_make(s: str) -> T: T { n: s.len() }
fn main:
let p = "abc"
let t = T.make(p)
print(f"assoc: [{p}] {t.n}")
let q = "abc"
let u = free_make(q)
print(f"free: [{q}] {u.n}")
Expected
Both prints are "use of moved value" errors (§3.8: a plain T parameter consumes; p and q are moved into the call).
Actual
Only the free call is diagnosed ({q} at line 10). The associated call T.make(p) moves p and the later {p} compiles; at run time it prints an empty string (the moved-from str). Same program with the facade-rendered CFile.fopen(path, "r") and print(path) afterwards: compiles, prints path empty.
Found while implementing modeled C stage 7 (the rendered constructors' str parameters are becoming &str, which sidesteps this for facades; the checker hole is independent).
Route
Move-checker drift (:move-audit class): the associated-function call path does not run the consuming-parameter transfer at the call site the way the free-call path does.
Activity
Parser/Sema: DeclBody and SemaExhClass are Copy — tag enums passed by…
Spell the transfers the field-view borrow and the method-path move ch…
Sema: consuming a `const` never marks it moved — it is a value, not a…
std.compiler: SourceLocation is Clone; the project-info test clones t…
Sema: a method-path call marks a plain owned argument moved as the fr…
build: spell the clones the method-path move check now sees (#1588 fa…
Parser/Sema: DeclBody and SemaExhClass are Copy — tag enums passed by…
Spell the transfers the field-view borrow and the method-path move ch…
Sema: consuming a `const` never marks it moved — it is a value, not a…
std.compiler: SourceLocation is Clone; the project-info test clones t…