Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #147083 - dianne:non-extended-indices, r=matthewjasper
Do not lifetime-extend array/slice indices When lowering non-overloaded indexing operations to MIR, this uses the temporary lifetime of the index expression for the index temporary, rather than applying the temporary lifetime of the indexing operation as a whole to the index. For example, in ```rust let x = &xs[i]; ``` previously, the temporary containing the result of evaluating `i` would live until the end of the block due to the indexing operation being [lifetime-extended](https://doc.rust-lang.org/nightly/reference/destructors.html#temporary-lifetime-extension). Under this PR, the index temporary only lives to the end of the `let` statement because it uses the more precise temporary lifetime of the index expression. I don't think this will affect semantics in an observable way, but the more precise `StorageDead` placement may slightly improve analysis/codegen performance. r? mir
bors 6 months ago
parent 826077c · parent f21aef7 · commit 2867baa
0 files changed, 0 insertions, 0 deletions