diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2022-05-03 14:58:58 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-03 14:58:58 +0900 |
| commit | a58703677b2d79c015260ef4432fa6ee7d0227e6 (patch) | |
| tree | ad403d5ffd9839ac0663eb3636e6dfdc6c67dac2 /src | |
| parent | 329a73dbd69367abc73698d9d6154bb5b5f6c749 (diff) | |
| parent | 685f66b6b1be089e3a365a43e5a4b4ac8dd78ec7 (diff) | |
| download | rust-a58703677b2d79c015260ef4432fa6ee7d0227e6.tar.gz rust-a58703677b2d79c015260ef4432fa6ee7d0227e6.zip | |
Rollup merge of #96589 - Badel2:source-callsite, r=michaelwoerister
Use source callsite in check_argument_types suggestion This makes the "remove extra arguement" suggestion valid when the function argument is a macro. Additionally, this may fix #96225, but the only way I can reproduce that issue is using the playground, so we will need to wait until after this is merged to ensure it's fixed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/typeck/remove-extra-argument.fixed | 9 | ||||
| -rw-r--r-- | src/test/ui/typeck/remove-extra-argument.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/typeck/remove-extra-argument.stderr | 19 |
3 files changed, 37 insertions, 0 deletions
diff --git a/src/test/ui/typeck/remove-extra-argument.fixed b/src/test/ui/typeck/remove-extra-argument.fixed new file mode 100644 index 00000000000..a9338c76cdc --- /dev/null +++ b/src/test/ui/typeck/remove-extra-argument.fixed @@ -0,0 +1,9 @@ +// run-rustfix +// Check that the HELP suggestion is `l(vec![])` instead of `l($crate::vec::Vec::new())` +fn l(_a: Vec<u8>) {} + +fn main() { + l(vec![]) + //~^ ERROR this function takes 1 argument but 2 arguments were supplied + //~| HELP remove the extra argument +} diff --git a/src/test/ui/typeck/remove-extra-argument.rs b/src/test/ui/typeck/remove-extra-argument.rs new file mode 100644 index 00000000000..659cb8b267f --- /dev/null +++ b/src/test/ui/typeck/remove-extra-argument.rs @@ -0,0 +1,9 @@ +// run-rustfix +// Check that the HELP suggestion is `l(vec![])` instead of `l($crate::vec::Vec::new())` +fn l(_a: Vec<u8>) {} + +fn main() { + l(vec![], vec![]) + //~^ ERROR this function takes 1 argument but 2 arguments were supplied + //~| HELP remove the extra argument +} diff --git a/src/test/ui/typeck/remove-extra-argument.stderr b/src/test/ui/typeck/remove-extra-argument.stderr new file mode 100644 index 00000000000..815297765c1 --- /dev/null +++ b/src/test/ui/typeck/remove-extra-argument.stderr @@ -0,0 +1,19 @@ +error[E0061]: this function takes 1 argument but 2 arguments were supplied + --> $DIR/remove-extra-argument.rs:6:5 + | +LL | l(vec![], vec![]) + | ^ ------ argument unexpected + | +note: function defined here + --> $DIR/remove-extra-argument.rs:3:4 + | +LL | fn l(_a: Vec<u8>) {} + | ^ ----------- +help: remove the extra argument + | +LL | l(vec![]) + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0061`. |
