[Pitch] Non-Escapable Types and Lifetime Dependency

This was a source of confusion for me as well.

For example, this code snippet:

struct Large {
    let a1: Int
    // a2, a3, ...
    let a10000: Int
}

func first(large: borrowing Large) -> Int {
    large.a1
}

My understanding is that this is semantically the same as:

func first(large: Large) -> Int {
    large.a1
}

Is that correct? If so, isn't this a trap for programmer who is reading this code?

1 Like