Skip to content

Commit

Permalink
Bump elided_lifetimes_in_associated_constant
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Apr 20, 2024
1 parent 54692c3 commit 24c9e66
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4615,7 +4615,7 @@ declare_lint! {
/// [against]: https://github.com/rust-lang/rust/issues/38831
/// [future-incompatible]: ../index.md#future-incompatible-lints
pub ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT,
Warn,
Deny,
"elided lifetimes cannot be used in associated constants in impls",
@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/associated-consts/double-elided.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ struct S;

impl S {
const C: &&str = &"";
//~^ WARN `&` without an explicit lifetime name cannot be used here
//~^ ERROR `&` without an explicit lifetime name cannot be used here
//~| ERROR `&` without an explicit lifetime name cannot be used here
//~| ERROR in type `&&str`, reference has a longer lifetime than the data it references
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| WARN `&` without an explicit lifetime name cannot be used here
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| ERROR in type `&&str`, reference has a longer lifetime than the data it references
}

fn main() {}
8 changes: 4 additions & 4 deletions tests/ui/associated-consts/double-elided.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
warning: `&` without an explicit lifetime name cannot be used here
error: `&` without an explicit lifetime name cannot be used here
--> $DIR/double-elided.rs:4:14
|
LL | const C: &&str = &"";
| ^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
= note: `#[warn(elided_lifetimes_in_associated_constant)]` on by default
= note: `#[deny(elided_lifetimes_in_associated_constant)]` on by default
help: use the `'static` lifetime
|
LL | const C: &'static &str = &"";
| +++++++

warning: `&` without an explicit lifetime name cannot be used here
error: `&` without an explicit lifetime name cannot be used here
--> $DIR/double-elided.rs:4:15
|
LL | const C: &&str = &"";
Expand Down Expand Up @@ -42,6 +42,6 @@ note: but the referenced data is only valid for the anonymous lifetime as define
LL | const C: &&str = &"";
| ^

error: aborting due to 1 previous error; 2 warnings emitted
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0491`.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ trait Trait {
impl Trait for () {
const ASSOC: &dyn Fn(_) = 1i32;
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated constants
//~| WARN `&` without an explicit lifetime name cannot be used here
//~| ERROR `&` without an explicit lifetime name cannot be used here
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
warning: `&` without an explicit lifetime name cannot be used here
error: `&` without an explicit lifetime name cannot be used here
--> $DIR/infer-placeholder-in-non-suggestable-pos.rs:6:18
|
LL | const ASSOC: &dyn Fn(_) = 1i32;
| ^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
= note: `#[warn(elided_lifetimes_in_associated_constant)]` on by default
= note: `#[deny(elided_lifetimes_in_associated_constant)]` on by default
help: use the `'static` lifetime
|
LL | const ASSOC: &'static dyn Fn(_) = 1i32;
Expand All @@ -18,6 +18,6 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
LL | const ASSOC: &dyn Fn(_) = 1i32;
| ^ not allowed in type signatures

error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0121`.

0 comments on commit 24c9e66

Please sign in to comment.