Skip to content

i3165 - #3180

Merged
ehartford merged 1 commit into
mainfrom
i3165
Nov 9, 2026
Merged

i3165#3180
ehartford merged 1 commit into
mainfrom
i3165

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Stack created with GitHub Stacks CLI • Give Feedback 💬

…emporary drops; a join of a view into a temporary is one too

A `let` of an `if` or `match` whose arm views its own statement temporary
(`why.slice(2, n).trim()`) takes the str (D179), but MirLower copied the
pointee once at the join, after the arm's temporary frame had dropped the
slice: the binding read freed memory (the right length, blank bytes;
WITH_ALLOC_NO_REUSE=1 showed the text). lower_contextual_copy_adjustment
now hands an if/match to its arms (copy_out_join_node), which copy out
inside their frames; the result local is the owned type; nested joins
propagate.

Sema's §21.1 checker never marked the join itself, so a `-> &str` function
returning such a join was accepted: resolve_contextual_join and
record_transparent_view_origins_from_nodes carry expr_view_into_temporary
from any arm or source, and the return is refused with the existing words.

Fixtures: behav_3165 (every row of the matrix in #3165, incl. a block arm,
a nested join and a match), err_3165 (the returned join).
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