-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: Fail to evaluate static slice with reference to internally-mutable data #120968
Comments
Like #120949, this issue is not contrived since I also use this technique in Divan in code generation for benchmarks of generic functions, specifically for caching |
Yea, this is a duplicate of #120949 |
@oli-obk this seems similar but the error messages suggest to me that it's not a duplicate. This is about referencing mutable data while the other is a cycle caused by self-referencing. |
Let's keep it open an check |
Yeah it's the same root cause; #120970 adds a test. |
…li-obk add another test for promoteds-in-static rust-lang#119614 led to validation of promoteds recursing into statics. These statics can point to `static mut` and interior mutable `static` and do other things we don't allow in `const`, but promoteds are validated as `const`, so we get strange errors (saying "in `const`" when there is no const) and surprising validation failures. rust-lang#120960 fixes that; this here adds another test. r? `@oli-obk` Fixes rust-lang#120968
Rollup merge of rust-lang#120970 - RalfJung:static-promoted-test, r=oli-obk add another test for promoteds-in-static rust-lang#119614 led to validation of promoteds recursing into statics. These statics can point to `static mut` and interior mutable `static` and do other things we don't allow in `const`, but promoteds are validated as `const`, so we get strange errors (saying "in `const`" when there is no const) and surprising validation failures. rust-lang#120960 fixes that; this here adds another test. r? ``@oli-obk`` Fixes rust-lang#120968
add another test for promoteds-in-static rust-lang/rust#119614 led to validation of promoteds recursing into statics. These statics can point to `static mut` and interior mutable `static` and do other things we don't allow in `const`, but promoteds are validated as `const`, so we get strange errors (saying "in `const`" when there is no const) and surprising validation failures. rust-lang/rust#120960 fixes that; this here adds another test. r? ``@oli-obk`` Fixes rust-lang/rust#120968
Code
I tried this code:
I expected to see this happen: it compiles with
LAZY_INIT
being reachable throughLAZY_INIT_REF
.Instead, this happened:
Version it worked on
It most recently worked on:
nightly-2024-02-10
Version with regression
nightly-2024-02-11
rustc --version --verbose
:@rustbot modify labels: +regression-from-stable-to-nightly +A-const-eval +T-compiler -regression-untriaged
The text was updated successfully, but these errors were encountered: