forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#97557 - compiler-errors:arg-mismatch-mini, …
…r=jackh726 Fix indices and remove some unwraps in arg mismatch algorithm This is a more conservative fix than rust-lang#97542, addressing some indices which were used incorectly and unwraps which are bound to panic (e.g. when the provided and expected arg counts differ). Beta nominating this as it's quite easy to cause ICEs -- I wrote a fuzzer and found hundreds of examples of ICEs. cc `@jackh726` as author of rust-lang#92364, and `@estebank` as reviewer of that PR. fixes rust-lang#97484 r? `@jackh726` this should be _much_ easier to review than the other PR 😅
- Loading branch information
Showing
7 changed files
with
95 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
struct A; | ||
struct B; | ||
struct C; | ||
struct D; | ||
struct E; | ||
struct F; | ||
struct G; | ||
|
||
fn foo(a: &A, d: D, e: &E, g: G) {} | ||
|
||
fn main() { | ||
foo(&&A, B, C, D, E, F, G); | ||
//~^ ERROR this function takes 4 arguments but 7 arguments were supplied | ||
} |
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 function takes 4 arguments but 7 arguments were supplied | ||
--> $DIR/issue-97484.rs:12:5 | ||
| | ||
LL | foo(&&A, B, C, D, E, F, G); | ||
| ^^^ - - - argument unexpected | ||
| | | | ||
| | argument of type `&E` unexpected | ||
| argument of type `D` unexpected | ||
| | ||
note: function defined here | ||
--> $DIR/issue-97484.rs:9:4 | ||
| | ||
LL | fn foo(a: &A, d: D, e: &E, g: G) {} | ||
| ^^^ ----- ---- ----- ---- | ||
help: consider removing the `` | ||
| | ||
LL - foo(&&A, B, C, D, E, F, G); | ||
LL + foo(&&A, B, C, D, E, F, G); | ||
| | ||
help: remove the extra arguments | ||
| | ||
LL | foo(&&A, D, {&E}, G); | ||
| ~~~~~~~~~~~~~~~~~~~~ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0061`. |
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