rust/tests/ui/issues/issue-25901.stderr

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

25 lines
858 B
Plaintext
Raw Normal View History

2023-04-16 06:12:37 -05:00
error[E0015]: cannot perform deref coercion on `A` in statics
2018-12-25 09:56:47 -06:00
--> $DIR/issue-25901.rs:4:24
2018-07-15 16:11:54 -05:00
|
LL | static S: &'static B = &A;
2023-04-16 06:12:37 -05:00
| ^^
2021-12-09 11:10:05 -06:00
|
2023-04-16 06:12:37 -05:00
= note: attempting to deref into `B`
note: deref defined here
--> $DIR/issue-25901.rs:10:5
2021-12-09 11:10:05 -06:00
|
2023-04-16 06:12:37 -05:00
LL | type Target = B;
| ^^^^^^^^^^^
note: impl defined here, but it is not `const`
--> $DIR/issue-25901.rs:9:1
|
LL | impl Deref for A {
| ^^^^^^^^^^^^^^^^
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
2018-07-15 16:11:54 -05:00
error: aborting due to previous error
2023-04-16 06:12:37 -05:00
For more information about this error, try `rustc --explain E0015`.