forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#65307 - Phosphorus15:master, r=varkor
Try fix incorrect "explicit lifetime name needed" This pr is trying to fixes rust-lang#65285 .
- Loading branch information
Showing
3 changed files
with
43 additions
and
4 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
14 changes: 14 additions & 0 deletions
14
src/test/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.rs
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#![crate_type="lib"] | ||
|
||
struct Nested<K>(K); | ||
|
||
fn should_error<T>() where T : Into<&u32> {} | ||
//~^ ERROR `&` without an explicit lifetime name cannot be used here [E0637] | ||
|
||
trait X<'a, K: 'a> { | ||
fn foo<'b, L: X<&'b Nested<K>>>(); | ||
//~^ ERROR missing lifetime specifier [E0106] | ||
} | ||
|
||
fn bar<'b, L: X<&'b Nested<i32>>>(){} | ||
//~^ ERROR missing lifetime specifier [E0106] |
21 changes: 21 additions & 0 deletions
21
src/test/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0637]: `&` without an explicit lifetime name cannot be used here | ||
--> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:5:37 | ||
| | ||
LL | fn should_error<T>() where T : Into<&u32> {} | ||
| ^ explicit lifetime name needed here | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:9:19 | ||
| | ||
LL | fn foo<'b, L: X<&'b Nested<K>>>(); | ||
| ^^^^^^^^^^^^^^^^ expected lifetime parameter | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:13:15 | ||
| | ||
LL | fn bar<'b, L: X<&'b Nested<i32>>>(){} | ||
| ^^^^^^^^^^^^^^^^^^ expected lifetime parameter | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0106`. |