|
1 |
| -error[E0391]: cycle detected when computing type of `Foo::{opaque#0}` |
2 |
| - --> $DIR/const-promoted-opaque.rs:13:12 |
| 1 | +error[E0493]: destructor of `Foo` cannot be evaluated at compile-time |
| 2 | + --> $DIR/const-promoted-opaque.rs:25:26 |
3 | 3 | |
|
4 |
| -LL | type Foo = impl Sized; |
5 |
| - | ^^^^^^^^^^ |
6 |
| - | |
7 |
| -note: ...which requires borrow-checking `FOO`... |
8 |
| - --> $DIR/const-promoted-opaque.rs:20:1 |
9 |
| - | |
10 |
| -LL | const FOO: Foo = std::sync::atomic::AtomicU8::new(42); |
11 |
| - | ^^^^^^^^^^^^^^ |
12 |
| -note: ...which requires promoting constants in MIR for `FOO`... |
13 |
| - --> $DIR/const-promoted-opaque.rs:20:1 |
| 4 | +LL | let _: &'static _ = &FOO; |
| 5 | + | ^^^ the destructor for this type cannot be evaluated in constants |
| 6 | +... |
| 7 | +LL | }; |
| 8 | + | - value is dropped here |
| 9 | + |
| 10 | +error[E0716]: temporary value dropped while borrowed |
| 11 | + --> $DIR/const-promoted-opaque.rs:25:26 |
14 | 12 | |
|
15 |
| -LL | const FOO: Foo = std::sync::atomic::AtomicU8::new(42); |
16 |
| - | ^^^^^^^^^^^^^^ |
17 |
| -note: ...which requires const checking `FOO`... |
18 |
| - --> $DIR/const-promoted-opaque.rs:20:1 |
| 13 | +LL | let _: &'static _ = &FOO; |
| 14 | + | ---------- ^^^ creates a temporary value which is freed while still in use |
| 15 | + | | |
| 16 | + | type annotation requires that borrow lasts for `'static` |
| 17 | +... |
| 18 | +LL | }; |
| 19 | + | - temporary value is freed at the end of this statement |
| 20 | + |
| 21 | +error[E0492]: constants cannot refer to interior mutable data |
| 22 | + --> $DIR/const-promoted-opaque.rs:30:19 |
19 | 23 | |
|
20 |
| -LL | const FOO: Foo = std::sync::atomic::AtomicU8::new(42); |
21 |
| - | ^^^^^^^^^^^^^^ |
22 |
| - = note: ...which requires computing whether `Foo` is freeze... |
23 |
| - = note: ...which requires evaluating trait selection obligation `Foo: core::marker::Freeze`... |
24 |
| - = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle |
25 |
| -note: cycle used when checking item types in top-level module |
26 |
| - --> $DIR/const-promoted-opaque.rs:2:1 |
| 24 | +LL | const BAZ: &Foo = &FOO; |
| 25 | + | ^^^^ this borrow of an interior mutable value may end up in the final value |
| 26 | + |
| 27 | +error[E0716]: temporary value dropped while borrowed |
| 28 | + --> $DIR/const-promoted-opaque.rs:34:26 |
27 | 29 | |
|
28 |
| -LL | / #![feature(type_alias_impl_trait)] |
29 |
| -LL | | |
30 |
| -LL | | //! Check that we do not cause cycle errors when trying to |
31 |
| -LL | | //! obtain information about interior mutability of an opaque type. |
32 |
| -... | |
33 |
| -LL | | let _: &'static _ = &FOO; |
34 |
| -LL | | } |
35 |
| - | |_^ |
| 30 | +LL | let _: &'static _ = &FOO; |
| 31 | + | ---------- ^^^ creates a temporary value which is freed while still in use |
| 32 | + | | |
| 33 | + | type annotation requires that borrow lasts for `'static` |
| 34 | +LL | |
| 35 | +LL | } |
| 36 | + | - temporary value is freed at the end of this statement |
36 | 37 |
|
37 |
| -error: aborting due to previous error |
| 38 | +error: aborting due to 4 previous errors |
38 | 39 |
|
39 |
| -For more information about this error, try `rustc --explain E0391`. |
| 40 | +Some errors have detailed explanations: E0492, E0493, E0716. |
| 41 | +For more information about an error, try `rustc --explain E0492`. |
0 commit comments