Skip macros to avoid talking about bindings the user can't see

This commit is contained in:
Esteban Küber 2023-01-02 21:56:19 -08:00
parent ea43eb3721
commit 05c30b0ca5
4 changed files with 4 additions and 13 deletions

View File

@ -260,7 +260,7 @@ fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
})) = map.find(parent) else { return false; };
let ty = self.node_ty(init.hir_id);
if ty.is_closure() || init.span.overlaps(expr.span) {
if ty.is_closure() || init.span.overlaps(expr.span) || pat.span.from_expansion() {
return false;
}
let mut span_labels = vec![(

View File

@ -63,10 +63,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-suggestions.rs:21:9
|
LL | s = format!("foo");
| ^^^^^^^^^^^^^^
| |
| expected `&mut String`, found struct `String`
| here the type of `res` is inferred to be `String`
| ^^^^^^^^^^^^^^ expected `&mut String`, found struct `String`
|
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@ -2,10 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-33884.rs:6:22
|
LL | stream.write_fmt(format!("message received"))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| expected struct `Arguments`, found struct `String`
| here the type of `res` is inferred to be `String`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Arguments`, found struct `String`
|
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@ -4,10 +4,7 @@ error[E0308]: mismatched types
LL | / intrinsic_match! {
LL | | "abc"
LL | | };
| | ^
| | |
| |_____expected `&str`, found struct `String`
| here the type of `res` is inferred to be `String`
| |_____^ expected `&str`, found struct `String`
|
= note: this error originates in the macro `format` which comes from the expansion of the macro `intrinsic_match` (in Nightly builds, run with -Z macro-backtrace for more info)