File tree Expand file tree Collapse file tree 5 files changed +12
-12
lines changed
compiler/rustc_lint_defs/src
tests/ui/associated-consts Expand file tree Collapse file tree 5 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -4615,7 +4615,7 @@ declare_lint! {
46154615 /// [against]: https://github.com/rust-lang/rust/issues/38831
46164616 /// [future-incompatible]: ../index.md#future-incompatible-lints
46174617 pub ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT ,
4618- Warn ,
4618+ Deny ,
46194619 "elided lifetimes cannot be used in associated constants in impls" ,
46204620 @future_incompatible = FutureIncompatibleInfo {
46214621 reason: FutureIncompatibilityReason :: FutureReleaseErrorDontReportInDeps ,
Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ struct S;
22
33impl S {
44 const C : & & str = & "" ;
5- //~^ WARN `&` without an explicit lifetime name cannot be used here
5+ //~^ ERROR `&` without an explicit lifetime name cannot be used here
6+ //~| ERROR `&` without an explicit lifetime name cannot be used here
7+ //~| ERROR in type `&&str`, reference has a longer lifetime than the data it references
68 //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7- //~| WARN `&` without an explicit lifetime name cannot be used here
89 //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
9- //~| ERROR in type `&&str`, reference has a longer lifetime than the data it references
1010}
1111
1212fn main ( ) { }
Original file line number Diff line number Diff line change 1- warning : `&` without an explicit lifetime name cannot be used here
1+ error : `&` without an explicit lifetime name cannot be used here
22 --> $DIR/double-elided.rs:4:14
33 |
44LL | const C: &&str = &"";
55 | ^
66 |
77 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
88 = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
9- = note: `#[warn (elided_lifetimes_in_associated_constant)]` on by default
9+ = note: `#[deny (elided_lifetimes_in_associated_constant)]` on by default
1010help: use the `'static` lifetime
1111 |
1212LL | const C: &'static &str = &"";
1313 | +++++++
1414
15- warning : `&` without an explicit lifetime name cannot be used here
15+ error : `&` without an explicit lifetime name cannot be used here
1616 --> $DIR/double-elided.rs:4:15
1717 |
1818LL | const C: &&str = &"";
@@ -42,6 +42,6 @@ note: but the referenced data is only valid for the anonymous lifetime as define
4242LL | const C: &&str = &"";
4343 | ^
4444
45- error: aborting due to 1 previous error; 2 warnings emitted
45+ error: aborting due to 3 previous errors
4646
4747For more information about this error, try `rustc --explain E0491`.
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ trait Trait {
55impl Trait for ( ) {
66 const ASSOC : & dyn Fn ( _) = 1i32 ;
77 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated constants
8- //~| WARN `&` without an explicit lifetime name cannot be used here
8+ //~| ERROR `&` without an explicit lifetime name cannot be used here
99 //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1010}
1111
Original file line number Diff line number Diff line change 1- warning : `&` without an explicit lifetime name cannot be used here
1+ error : `&` without an explicit lifetime name cannot be used here
22 --> $DIR/infer-placeholder-in-non-suggestable-pos.rs:6:18
33 |
44LL | const ASSOC: &dyn Fn(_) = 1i32;
55 | ^
66 |
77 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
88 = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
9- = note: `#[warn (elided_lifetimes_in_associated_constant)]` on by default
9+ = note: `#[deny (elided_lifetimes_in_associated_constant)]` on by default
1010help: use the `'static` lifetime
1111 |
1212LL | const ASSOC: &'static dyn Fn(_) = 1i32;
@@ -18,6 +18,6 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
1818LL | const ASSOC: &dyn Fn(_) = 1i32;
1919 | ^ not allowed in type signatures
2020
21- error: aborting due to 1 previous error; 1 warning emitted
21+ error: aborting due to 2 previous errors
2222
2323For more information about this error, try `rustc --explain E0121`.
You can’t perform that action at this time.
0 commit comments