blob: a1fdca1f284ebe4a3f8323cda10999652184dc9f [file] [edit]
error[E0015]: cannot perform non-const deref coercion on `A` in statics
--> $DIR/static-ref-deref-non-const-trait.rs:6:24
|
LL | static S: &'static B = &A;
| ^^
|
= note: attempting to deref into `B`
note: deref defined here
--> $DIR/static-ref-deref-non-const-trait.rs:12:5
|
LL | type Target = B;
| ^^^^^^^^^^^
note: impl defined here, but it is not `const`
--> $DIR/static-ref-deref-non-const-trait.rs:11:1
|
LL | impl Deref for A {
| ^^^^^^^^^^^^^^^^
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0015`.