#![feature(generic_const_exprs)]
does not compile stable code related to lifetimes
#124531
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-bug
Category: This is a bug.
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Concretely, consider the following code which compiles perfectly fine under both stable and nightly rust
Playground
This makes complete sense, since the lifetime parameters on the function
create_foo()
clearly specify thatF
must be valid in the body of the function, but not necessarily for the whole lifetime'a
. Note also that the code uses const generics, but only the subset that has been stabilized.However, just adding
#![feature(generic_const_exprs)]
without changing anything else gives a compiler errorwithin
create_foobar()
. This should not be the case, as the closure stored in the variablecreate
does not have to outlive the current function, or even live for'static
.Playground
I am using rustc 1.77.0-nightly.
Edit Significantly simplified example code.
The text was updated successfully, but these errors were encountered: