use more specific wording for subpatterns from macro expansions
(cherry picked from commit bbe40acb9a)
This commit is contained in:
parent
1a18daac77
commit
a9465deb4b
2 changed files with 5 additions and 2 deletions
|
|
@ -2652,7 +2652,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
// Only provide a detailed label if the problematic subpattern isn't from an expansion.
|
||||
// In the case that it's from a macro, we'll add a more detailed note in the emitter.
|
||||
let desc = if subpat.span.from_expansion() {
|
||||
"occurs within expansion"
|
||||
// NB: This wording assumes the only expansions that can produce problematic reference
|
||||
// patterns and bindings are macros. If a desugaring or AST pass is added that can do
|
||||
// so, we may want to inspect the span's source callee or macro backtrace.
|
||||
"occurs within macro expansion"
|
||||
} else {
|
||||
match def_br_mutbl {
|
||||
Mutability::Not => "default binding mode is `ref`",
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ error: binding modifiers may only be written when the default binding mode is `m
|
|||
--> $DIR/migration_lint.rs:137:15
|
||||
|
|
||||
LL | (Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => {
|
||||
| ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ occurs within expansion
|
||||
| ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ occurs within macro expansion
|
||||
| |
|
||||
| default binding mode is `ref`
|
||||
|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue