don't remove args for function calls coming from macro expansions
This commit is contained in:
parent
3694fd08e6
commit
37d62fbf9e
@ -929,7 +929,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
};
|
||||
labels.push((provided_span, format!("unexpected argument{provided_ty_name}")));
|
||||
let mut span = provided_span;
|
||||
if span.can_be_used_for_suggestions() {
|
||||
if span.can_be_used_for_suggestions()
|
||||
&& error_span.can_be_used_for_suggestions()
|
||||
{
|
||||
if arg_idx.index() > 0
|
||||
&& let Some((_, prev)) = provided_arg_tys
|
||||
.get(ProvidedIdx::from_usize(arg_idx.index() - 1)
|
||||
|
@ -258,7 +258,6 @@ LL | foo!(1, ~);
|
||||
| ----------
|
||||
| | |
|
||||
| | unexpected argument of type `{integer}`
|
||||
| | help: remove the extra argument
|
||||
| in this macro invocation
|
||||
|
|
||||
note: function defined here
|
||||
@ -272,9 +271,7 @@ error[E0061]: this function takes 0 arguments but 2 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:14:9
|
||||
|
|
||||
LL | empty(1, $y);
|
||||
| ^^^^^ ----- help: remove the extra argument
|
||||
| |
|
||||
| unexpected argument of type `{integer}`
|
||||
| ^^^^^ - unexpected argument of type `{integer}`
|
||||
...
|
||||
LL | foo!(~, 1);
|
||||
| ----------
|
||||
@ -308,14 +305,6 @@ note: function defined here
|
||||
LL | fn empty() {}
|
||||
| ^^^^^
|
||||
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: remove the extra arguments
|
||||
|
|
||||
LL ~ empty($x, $y;
|
||||
LL | };
|
||||
...
|
||||
LL | foo!(~, 1);
|
||||
LL ~ foo!(, 1);
|
||||
|
|
||||
|
||||
error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:53:3
|
||||
|
Loading…
x
Reference in New Issue
Block a user