rust/tests/ui/consts/const-fn-not-safe-for-const...

37 lines
1.7 KiB
Plaintext

error[E0015]: cannot call non-const fn `random` in constant functions
--> $DIR/const-fn-not-safe-for-const.rs:14:5
|
LL | random()
| ^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error[E0658]: referencing statics in constant functions is unstable
--> $DIR/const-fn-not-safe-for-const.rs:20:5
|
LL | Y
| ^
|
= 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
= 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 constant functions is unstable
--> $DIR/const-fn-not-safe-for-const.rs:25:6
|
LL | &Y
| ^
|
= 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
= 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 3 previous errors
Some errors have detailed explanations: E0015, E0658.
For more information about an error, try `rustc --explain E0015`.