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#57817 - davidtwco:issue-54521, r=estebank
Add error for trailing angle brackets. Fixes rust-lang#54521. This PR adds a error (and accompanying machine applicable suggestion) for trailing angle brackets on function calls with a turbofish. r? @estebank
- Loading branch information
Showing
9 changed files
with
303 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// compile-pass | ||
|
||
// This test checks that the `remove extra angle brackets` error doesn't happen for some | ||
// potential edge-cases.. | ||
|
||
struct X { | ||
len: u32, | ||
} | ||
|
||
fn main() { | ||
let x = X { len: 3 }; | ||
|
||
let _ = x.len > (3); | ||
|
||
let _ = x.len >> (3); | ||
} |
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,22 @@ | ||
// run-rustfix | ||
|
||
// This test checks that the following error is emitted and the suggestion works: | ||
// | ||
// ``` | ||
// let _ = Vec::<usize>>>::new(); | ||
// ^^ help: remove extra angle brackets | ||
// ``` | ||
|
||
fn main() { | ||
let _ = Vec::<usize>::new(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = Vec::<usize>::new(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = Vec::<usize>::new(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = Vec::<usize>::new(); | ||
//~^ ERROR unmatched angle bracket | ||
} |
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,22 @@ | ||
// run-rustfix | ||
|
||
// This test checks that the following error is emitted and the suggestion works: | ||
// | ||
// ``` | ||
// let _ = Vec::<usize>>>::new(); | ||
// ^^ help: remove extra angle brackets | ||
// ``` | ||
|
||
fn main() { | ||
let _ = Vec::<usize>>>>>::new(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = Vec::<usize>>>>::new(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = Vec::<usize>>>::new(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = Vec::<usize>>::new(); | ||
//~^ ERROR unmatched angle bracket | ||
} |
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,26 @@ | ||
error: unmatched angle brackets | ||
--> $DIR/issue-54521-2.rs:11:25 | ||
| | ||
LL | let _ = Vec::<usize>>>>>::new(); | ||
| ^^^^ help: remove extra angle brackets | ||
|
||
error: unmatched angle brackets | ||
--> $DIR/issue-54521-2.rs:14:25 | ||
| | ||
LL | let _ = Vec::<usize>>>>::new(); | ||
| ^^^ help: remove extra angle brackets | ||
|
||
error: unmatched angle brackets | ||
--> $DIR/issue-54521-2.rs:17:25 | ||
| | ||
LL | let _ = Vec::<usize>>>::new(); | ||
| ^^ help: remove extra angle brackets | ||
|
||
error: unmatched angle bracket | ||
--> $DIR/issue-54521-2.rs:20:25 | ||
| | ||
LL | let _ = Vec::<usize>>::new(); | ||
| ^ help: remove extra angle bracket | ||
|
||
error: aborting due to 4 previous errors | ||
|
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,22 @@ | ||
// run-rustfix | ||
|
||
// This test checks that the following error is emitted and the suggestion works: | ||
// | ||
// ``` | ||
// let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>(); | ||
// ^^ help: remove extra angle brackets | ||
// ``` | ||
|
||
fn main() { | ||
let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>(); | ||
//~^ ERROR unmatched angle bracket | ||
} |
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,22 @@ | ||
// run-rustfix | ||
|
||
// This test checks that the following error is emitted and the suggestion works: | ||
// | ||
// ``` | ||
// let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>(); | ||
// ^^ help: remove extra angle brackets | ||
// ``` | ||
|
||
fn main() { | ||
let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>>(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>(); | ||
//~^ ERROR unmatched angle bracket | ||
|
||
let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>(); | ||
//~^ ERROR unmatched angle bracket | ||
} |
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,26 @@ | ||
error: unmatched angle brackets | ||
--> $DIR/issue-54521.rs:11:60 | ||
| | ||
LL | let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>>(); | ||
| ^^^^ help: remove extra angle brackets | ||
|
||
error: unmatched angle brackets | ||
--> $DIR/issue-54521.rs:14:60 | ||
| | ||
LL | let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>(); | ||
| ^^^ help: remove extra angle brackets | ||
|
||
error: unmatched angle brackets | ||
--> $DIR/issue-54521.rs:17:60 | ||
| | ||
LL | let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>(); | ||
| ^^ help: remove extra angle brackets | ||
|
||
error: unmatched angle bracket | ||
--> $DIR/issue-54521.rs:20:60 | ||
| | ||
LL | let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>(); | ||
| ^ help: remove extra angle bracket | ||
|
||
error: aborting due to 4 previous errors | ||
|