const-eval.const-expr.borrows: mention indirect places by RalfJung · Pull Request #1865 · rust-lang/reference

@RalfJung

RalfJung

@RalfJung @traviscross

RalfJung

RalfJung

RalfJung

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Jun 27, 2025
… r=oli-obk

const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology

This error recently got changed in rust-lang#140942 to use the terminology of "top-level scope", but after further discussion in rust-lang/reference#1865 it seems the reference will not be using that terminology after all. So let's also remove it from the compiler again, and let's focus on what actually happens with these temporaries: their lifetime is extended until the end of the program.

r? ``@oli-obk`` ``@traviscross``

rust-timer added a commit to rust-lang/rust that referenced this pull request

Jun 28, 2025
Rollup merge of #143092 - RalfJung:const-check-lifetime-ext, r=oli-obk

const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology

This error recently got changed in #140942 to use the terminology of "top-level scope", but after further discussion in rust-lang/reference#1865 it seems the reference will not be using that terminology after all. So let's also remove it from the compiler again, and let's focus on what actually happens with these temporaries: their lifetime is extended until the end of the program.

r? ``@oli-obk`` ``@traviscross``

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request

Jun 28, 2025
const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology

This error recently got changed in rust-lang/rust#140942 to use the terminology of "top-level scope", but after further discussion in rust-lang/reference#1865 it seems the reference will not be using that terminology after all. So let's also remove it from the compiler again, and let's focus on what actually happens with these temporaries: their lifetime is extended until the end of the program.

r? ``@oli-obk`` ``@traviscross``

traviscross

RalfJung

@traviscross

Rather than talking about lifetime-extended temporaries in the
top-level scope of an initializer, which is maybe a bit ambiguous,
let's speak directly to the result of the lifetime extension, which is
that these temporaries disallowed for borrows would have their
lifetimes extended to the end of the program.

Let's also speak about place expressions, rather than places, as
that's more precise here.

We'll add examples throughout.  Thanks to RalfJ for the substance of
many of these.

traviscross

Kobzol added a commit to Kobzol/rust that referenced this pull request

Jul 14, 2025

Kobzol added a commit to Kobzol/rust that referenced this pull request

Jul 14, 2025

jhpratt added a commit to jhpratt/rust that referenced this pull request

Jul 15, 2025

samueltardieu added a commit to samueltardieu/rust that referenced this pull request

Jul 15, 2025

rust-timer added a commit to rust-lang/rust that referenced this pull request

Jul 15, 2025

github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request

Jul 17, 2025

@RalfJung RalfJung deleted the const-expr-borrows-indirect branch

July 17, 2025 12:05

Muscraft pushed a commit to Muscraft/rust that referenced this pull request

Jul 21, 2025

RalfJung