Open and answer this issue on GitHub.
ready, bugs, yaml, queued · opened 2026-11-28 · updated 2026-11-29 · 0 comments
Part of #1548 Found while #2836
“A function with two ref parameters returning a struct that may hold views” (#2836) was built in 7e55fa06 and reverted in 3d5ad47c, because it broke tests/language. The driver treats #2836 as fixed (its Fixes line is in the history), so the rerun is filed here.
Today, a function with several ref parameters that hands back a struct able to hold views, holding none, fails in rustc. The result is written E<'_, '_>: E0106 “missing lifetime specifiers … borrowed from n or ds” (NK1343). The issue’s probe is in #2836.
7e55fa06 made emit_function.nika emit_function write such a result 'static when the result-source inference (rsrc_seed/buffered) found no parameter as its source. That inference misses a view reaching the struct through an enum variant’s constructor, here one declared in another file of the package:
// tests/language/src/views_across_files.nika
fn views_across_first(text: ref String) -> ViewsAcrossLine {
return ViewsAcrossLine { first: ViewsAcrossToken::Word(text), count: 1 }
}
So that result was written 'static, and rustc refused it with “lifetime may not live long enough”.
borrows may mean 'static.holds_view(ty) || self.carries_a_view(world, ty) in nothing_borrowed) and its test a_struct_of_views_viewing_none_of_two_ref_parameters_is_static.abc -. tests/language passes 404/404, which covers views_across_files.The probe prints abc -, tests/language passes, and --filter static, --filter borrow and --filter struct_of_views stay green.