-
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.
Auto merge of #94495 - estebank:missing-closing-gt, r=jackh726
Provide suggestion for missing `>` in a type parameter list When encountering an inproperly terminated type parameter list, provide a suggestion to close it after the last non-constraint type parameter that was successfully parsed. Fix #94058.
- Loading branch information
Showing
20 changed files
with
208 additions
and
14 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
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// run-rustfix | ||
#![allow(unused)] | ||
struct Foo<'a, 'b> { | ||
a: &'a &'b i32 | ||
} | ||
|
||
fn foo<'a, 'b>(_x: &mut Foo<'a, 'b>) {} | ||
//~^ ERROR expected one of `,`, `:`, `=`, or `>`, found `;` | ||
|
||
fn main() {} |
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,8 +1,10 @@ | ||
// run-rustfix | ||
#![allow(unused)] | ||
struct Foo<'a, 'b> { | ||
a: &'a &'b i32 | ||
} | ||
|
||
fn foo<'a, 'b>(x: &mut Foo<'a; 'b>) {} | ||
fn foo<'a, 'b>(_x: &mut Foo<'a; 'b>) {} | ||
//~^ ERROR expected one of `,`, `:`, `=`, or `>`, found `;` | ||
|
||
fn main() {} |
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,8 +1,13 @@ | ||
error: expected one of `,`, `:`, `=`, or `>`, found `;` | ||
--> $DIR/lifetime-semicolon.rs:5:30 | ||
--> $DIR/lifetime-semicolon.rs:7:31 | ||
| | ||
LL | fn foo<'a, 'b>(x: &mut Foo<'a; 'b>) {} | ||
| ^ expected one of `,`, `:`, `=`, or `>` | ||
LL | fn foo<'a, 'b>(_x: &mut Foo<'a; 'b>) {} | ||
| ^ expected one of `,`, `:`, `=`, or `>` | ||
| | ||
help: use a comma to separate type parameters | ||
| | ||
LL | fn foo<'a, 'b>(_x: &mut Foo<'a, 'b>) {} | ||
| ~ | ||
|
||
error: aborting due to previous error | ||
|
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
11 changes: 11 additions & 0 deletions
11
src/test/ui/parser/missing-closing-angle-bracket-struct-field-ty.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,11 @@ | ||
// run-rustifx | ||
#![allow(unused)] | ||
use std::sync::{Arc, Mutex}; | ||
|
||
pub struct Foo { | ||
a: Mutex<usize>, | ||
b: Arc<Mutex<usize>, //~ HELP you might have meant to end the type parameters here | ||
c: Arc<Mutex<usize>>, | ||
} //~ ERROR expected one of | ||
|
||
fn main() {} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/parser/missing-closing-angle-bracket-struct-field-ty.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,15 @@ | ||
error: expected one of `>`, a const expression, lifetime, or type, found `}` | ||
--> $DIR/missing-closing-angle-bracket-struct-field-ty.rs:9:1 | ||
| | ||
LL | c: Arc<Mutex<usize>>, | ||
| - expected one of `>`, a const expression, lifetime, or type | ||
LL | } | ||
| ^ unexpected token | ||
| | ||
help: you might have meant to end the type parameters here | ||
| | ||
LL | b: Arc<Mutex<usize>>, | ||
| + | ||
|
||
error: aborting due to previous error | ||
|
Oops, something went wrong.