Skip to content

Conversation

@andrewrk
Copy link
Member

@andrewrk andrewrk commented Sep 22, 2025

progress towards #25312 (I amended the proposal to include more cases)

Upgrade Guide

fn foo() *i32 {
    var x: i32 = 1234;
    return &x;
}
test.zig:3:13: error: returning address of expired local variable 'x'
    return &x;
            ^
test.zig:2:9: note: declared runtime-known here
    var x: i32 = 1234;
        ^

⬇️

fn foo() *i32 {
    return undefined;
}

@andrewrk andrewrk added breaking Implementing this issue could cause existing code to no longer compile or have different behavior. release notes This PR should be mentioned in the release notes. labels Sep 22, 2025
@andrewrk andrewrk enabled auto-merge (squash) September 23, 2025 19:51
@andrewrk andrewrk merged commit ba13778 into master Sep 23, 2025
17 of 18 checks passed
@andrewrk andrewrk deleted the forbid-trivial-expired-local-addrof branch September 23, 2025 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Implementing this issue could cause existing code to no longer compile or have different behavior. release notes This PR should be mentioned in the release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant