rust/tests/ui/traits/trait-object-lifetime-default-note.stderr
Lukas Markeffsky 5e60d1f87e replace "cast" with "coercion" where applicable
This changes the remaining span for the cast, because the new `Cast`
category has a higher priority (lower `Ord`) than the old `Coercion`
category, so we no longer report the region error for the "unsizing"
coercion from `*const Trait` to itself.
2024-09-24 22:20:46 +02:00

20 lines
671 B
Plaintext

error[E0597]: `local` does not live long enough
--> $DIR/trait-object-lifetime-default-note.rs:7:13
|
LL | let local = 0;
| ----- binding `local` declared here
LL | let r = &local;
| ^^^^^^ borrowed value does not live long enough
...
LL | require_box(Box::new(r));
| ----------- coercion requires that `local` is borrowed for `'static`
...
LL | }
| - `local` dropped here while still borrowed
|
= note: due to object lifetime defaults, `Box<dyn A>` actually means `Box<(dyn A + 'static)>`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0597`.