Do not point at macro invocation when providing inference context
This commit is contained in:
@@ -459,7 +459,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
span,
|
||||
format!("this is an iterator with items of type `{}`", args.type_at(0)),
|
||||
);
|
||||
} else {
|
||||
} else if !span.overlaps(cause.span) {
|
||||
let expected_ty = self.tcx.short_string(expected_ty, err.long_ty_path());
|
||||
err.span_label(span, format!("this expression has type `{expected_ty}`"));
|
||||
}
|
||||
|
||||
@@ -8,6 +8,5 @@ fn main() {
|
||||
match_expander::matcher!();
|
||||
//~^ ERROR: mismatched types
|
||||
//~| NOTE: expected `S`, found `bool`
|
||||
//~| NOTE: this expression has type `S`
|
||||
//~| NOTE: in this expansion of match_expander::matcher!
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/match-expander.rs:8:5
|
||||
|
|
||||
LL | match_expander::matcher!();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| expected `S`, found `bool`
|
||||
| this expression has type `S`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `S`, found `bool`
|
||||
|
|
||||
= note: this error originates in the macro `match_expander::matcher` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user