|
| 1 | +error: `&` without an explicit lifetime name cannot be used here |
| 2 | + --> $DIR/elided-lifetime.rs:6:19 |
| 3 | + | |
| 4 | +LL | const STATIC: &str = ""; |
| 5 | + | ^ |
| 6 | + | |
| 7 | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 8 | + = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010> |
| 9 | +note: cannot automatically infer `'static` because of other lifetimes in scope |
| 10 | + --> $DIR/elided-lifetime.rs:5:10 |
| 11 | + | |
| 12 | +LL | impl Foo<'_> { |
| 13 | + | ^^ |
| 14 | +note: the lint level is defined here |
| 15 | + --> $DIR/elided-lifetime.rs:1:9 |
| 16 | + | |
| 17 | +LL | #![deny(elided_lifetimes_in_associated_constant)] |
| 18 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 19 | +help: use the `'static` lifetime |
| 20 | + | |
| 21 | +LL | const STATIC: &'static str = ""; |
| 22 | + | +++++++ |
| 23 | + |
| 24 | +error: `&` without an explicit lifetime name cannot be used here |
| 25 | + --> $DIR/elided-lifetime.rs:17:19 |
| 26 | + | |
| 27 | +LL | const STATIC: &str = ""; |
| 28 | + | ^ |
| 29 | + | |
| 30 | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 31 | + = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010> |
| 32 | +note: cannot automatically infer `'static` because of other lifetimes in scope |
| 33 | + --> $DIR/elided-lifetime.rs:16:18 |
| 34 | + | |
| 35 | +LL | impl Bar for Foo<'_> { |
| 36 | + | ^^ |
| 37 | +help: use the `'static` lifetime |
| 38 | + | |
| 39 | +LL | const STATIC: &'static str = ""; |
| 40 | + | +++++++ |
| 41 | + |
| 42 | +error[E0308]: const not compatible with trait |
| 43 | + --> $DIR/elided-lifetime.rs:17:5 |
| 44 | + | |
| 45 | +LL | const STATIC: &str = ""; |
| 46 | + | ^^^^^^^^^^^^^^^^^^ lifetime mismatch |
| 47 | + | |
| 48 | + = note: expected reference `&'static _` |
| 49 | + found reference `&_` |
| 50 | +note: the anonymous lifetime as defined here... |
| 51 | + --> $DIR/elided-lifetime.rs:16:18 |
| 52 | + | |
| 53 | +LL | impl Bar for Foo<'_> { |
| 54 | + | ^^ |
| 55 | + = note: ...does not necessarily outlive the static lifetime |
| 56 | + |
| 57 | +error: aborting due to 3 previous errors |
| 58 | + |
| 59 | +For more information about this error, try `rustc --explain E0308`. |
0 commit comments