-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 #112762 - chenyukang:yukang-fix-112507-argument-check…
…ing, r=compiler-errors Sort the errors from arguments checking so that suggestions are handled properly Fixes #112507 The algorithm of `find_issue` does not make sure the index comes out in order, which will make suggesting `remove` or `add` arguments broken in some cases. Modifying the algorithm to obey order involves much more trivial change, so it's better to order the `errors` after iterations.
- Loading branch information
Showing
3 changed files
with
75 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
pub enum Value { | ||
Float(Option<f64>), | ||
} | ||
|
||
fn main() { | ||
let _a = Value::Float( //~ ERROR this enum variant takes 1 argument but 4 arguments were supplied | ||
0, | ||
None, | ||
None, | ||
0, | ||
); | ||
} |
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,27 @@ | ||
error[E0061]: this enum variant takes 1 argument but 4 arguments were supplied | ||
--> $DIR/issue-112507.rs:6:14 | ||
| | ||
LL | let _a = Value::Float( | ||
| ^^^^^^^^^^^^ | ||
LL | 0, | ||
| - unexpected argument of type `{integer}` | ||
LL | None, | ||
LL | None, | ||
| ---- unexpected argument of type `Option<_>` | ||
LL | 0, | ||
| - unexpected argument of type `{integer}` | ||
| | ||
note: tuple variant defined here | ||
--> $DIR/issue-112507.rs:2:5 | ||
| | ||
LL | Float(Option<f64>), | ||
| ^^^^^ | ||
help: remove the extra arguments | ||
| | ||
LL ~ , | ||
LL ~ None); | ||
| | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0061`. |