rust/tests/ui/feature-gates/feature-gate-const-refs-to-static.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
1.5 KiB
Plaintext
Raw Normal View History

error[E0658]: referencing statics in constants is unstable
--> $DIR/feature-gate-const-refs-to-static.rs:4:19
|
LL | const C1: &i32 = &S;
| ^
|
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
2024-02-05 14:24:32 -06:00
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
= help: to fix this, the value can be extracted to a `const` and then used.
error[E0658]: referencing statics in constants is unstable
--> $DIR/feature-gate-const-refs-to-static.rs:8:52
|
LL | const C2: *const i32 = unsafe { std::ptr::addr_of!(S_MUT) };
| ^^^^^
|
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
2024-02-05 14:24:32 -06:00
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
= help: to fix this, the value can be extracted to a `const` and then used.
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.