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
A call through a &fn(A) -> R parameter runs nothing: read(s) where read: &fn(&str) -> str prints no output and no diagnostic (seed and origin/main) #1603
Found while making src/compiler/ConanPatch.w conform to D63 (fn(A) -> R is not Copy).
fn apply(s: &str, read: &fn(&str) -> str) -> str: read(s)
fn shout(s: &str) -> str: s.clone() ++ "!"
fn main:
var i = 0
while i < 2:
print(apply("a", &shout))
i = i + 1
Expected a! twice. Actual: no output at all, exit 0, no diagnostic — on the pinned seed (nightly-20260922) and on a stage1 of origin/main 02301f8. The by-value form (read: fn(&str) -> str, apply("a", read)) prints correctly.
Either a call through a reference to a callable must auto-deref like every other &T use (§3.7), or the parameter type must be rejected; silently running nothing is neither. Not fixed in stack #1585 (ConanPatch uses a struct of callables passed by reference instead).
Fixed on main by #1701 (3d5dc47): capture-set completeness, stored-view refusal, calls through &fn; battery green and pinned by the tests named in the PR.
Activity
Closures: a move closure owns its environment (inline when every capt…
Closures: a move closure owns its environment; fn(A) -> R is not Copy…
MirLower: `&f` handed to a `*const fn(...)` stays the code address; o…
Closures: every capture is found, a stored view is refused, a call th…
ehartford commentedon Sep 26, 2026
Fixed on main by #1701 (3d5dc47): capture-set completeness, stored-view refusal, calls through
&fn; battery green and pinned by the tests named in the PR.