-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve elided lifetimes in assoc const to static if no other lifetim…
…es are in scope
- Loading branch information
1 parent
c00957a
commit 2c09825
Showing
9 changed files
with
96 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
//@ check-pass | ||
|
||
struct S; | ||
|
||
impl S { | ||
const C: &&str = &""; | ||
//~^ 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! | ||
//~| 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 | ||
// Now resolves to `&'static &'static str`. | ||
} | ||
|
||
fn main() {} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 1 addition & 15 deletions
16
tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,9 @@ | ||
warning: `&` 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 | ||
help: use the `'static` lifetime | ||
| | ||
LL | const ASSOC: &'static dyn Fn(_) = 1i32; | ||
| +++++++ | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants | ||
--> $DIR/infer-placeholder-in-non-suggestable-pos.rs:6:26 | ||
| | ||
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 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0121`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters