2025-01-13 02:03:41 +00:00
|
|
|
error[E0015]: cannot perform non-const deref coercion on `A` in statics
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-25901.rs:4:24
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
|
LL | static S: &'static B = &A;
|
2023-04-16 11:12:37 +00:00
|
|
|
| ^^
|
2021-12-09 17:10:05 +00:00
|
|
|
|
|
2024-12-23 21:53:07 +00:00
|
|
|
= note: attempting to deref into `B`
|
|
|
|
note: deref defined here
|
|
|
|
--> $DIR/issue-25901.rs:10:5
|
|
|
|
|
|
|
|
|
LL | type Target = B;
|
|
|
|
| ^^^^^^^^^^^
|
2025-01-13 02:03:41 +00:00
|
|
|
note: impl defined here, but it is not `const`
|
|
|
|
--> $DIR/issue-25901.rs:9:1
|
|
|
|
|
|
|
|
|
LL | impl Deref for A {
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
2024-12-23 21:53:07 +00:00
|
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
2025-01-13 02:03:41 +00:00
|
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
2018-07-15 21:11:54 +00:00
|
|
|
|
2023-11-21 15:44:16 +00:00
|
|
|
error: aborting due to 1 previous error
|
2018-07-15 21:11:54 +00:00
|
|
|
|
2025-01-13 02:03:41 +00:00
|
|
|
For more information about this error, try `rustc --explain E0015`.
|