Repository: rust-lang/rust
File: compiler/rustc_expand/src/mbe/diagnostics.rs (Rust)

Code before:
                    e.span_suggestion_verbose(
                        site_span.shrink_to_hi(),
                        "add `;` to interpret the expansion as a statement",
                        ";",
                        Applicability::MaybeIncorrect,
                    );
                }
            }
        },
        _ => annotate_err_with_kind(&mut e, kind, site_span),
    };

    let matched_rule_bindings_names: Vec<_> =
        matched_rule_bindings.iter().map(|bind| bind.name).collect();
    let bindings_name: Vec<_> = bindings.iter().map(|bind| bind.name).collect();
    if parser.token.kind == token::Dollar {
        parser.bump();
        if let token::Ident(name, _) = parser.token.kind {
            if let Some(matched_name) = rustc_span::edit_distance::find_best_match_for_name(
                &matched_rule_bindings_names[..],
                name,
                None,
            ) {
                e.span_suggestion_verbose(
                    parser.token.span,
                    "this could be a typo, there is a macro argument with similar name",
                    format!("{matched_name}"),
                    Applicability::MaybeIncorrect,
                );
            } else if bindings_name.contains(&name) {
                e.span_label(
                    parser.token.span,
                    format!("there is an exact macro argument in the other matcher"),
                );
            } else if let Some(matched_name) =
                rustc_span::edit_distance::find_best_match_for_name(&bindings_name[..], name, None)
            {
                e.span_suggestion_verbose(
                    parser.token.span,
                    "this could be a typo, there is a macro argument with similar name in the other matcher",
                    format!("{matched_name}"),
                    Applicability::MaybeIncorrect,
                );
            } else {
                let msg = matched_rule_bindings_names
                    .iter()
                    .map(|sym| format!("${}", sym))
                    .collect::<Vec<_>>()
                    .join(", ");

                e.span_label(

Review comment (suggestion):
```suggestion
                    "there is a macro metavariable with similar name",
```

Code after:
                    e.span_suggestion_verbose(
                        site_span.shrink_to_hi(),
                        "add `;` to interpret the expansion as a statement",
                        ";",
                        Applicability::MaybeIncorrect,
                    );
                }
            }
        },
        _ => annotate_err_with_kind(&mut e, kind, site_span),
    };

    let matched_rule_bindings_names: Vec<_> =
        matched_rule_bindings.iter().map(|bind| bind.name).collect();
    let bindings_name: Vec<_> = bindings.iter().map(|bind| bind.name).collect();
    if parser.token.kind == token::Dollar {
        parser.bump();
        if let token::Ident(name, _) = parser.token.kind {
            if let Some(matched_name) = rustc_span::edit_distance::find_best_match_for_name(
                &matched_rule_bindings_names[..],
                name,
                None,
            ) {
                e.span_suggestion_verbose(
                    parser.token.span,
                    "there is a macro metavariable with similar name",
                    format!("{matched_name}"),
                    Applicability::MaybeIncorrect,
                );
            } else if bindings_name.contains(&name) {
                e.span_label(
                    parser.token.span,
                    format!(
                        "there is an macro metavariable with this name in another macro matcher"
                    ),
                );
            } else if let Some(matched_name) =
                rustc_span::edit_distance::find_best_match_for_name(&bindings_name[..], name, None)
            {
                e.span_suggestion_verbose(
                    parser.token.span,
                    "there is a macro metavariable with a similar name in another macro matcher",
                    format!("{matched_name}"),
                    Applicability::MaybeIncorrect,
                );
            } else {
                let msg = matched_rule_bindings_names
                    .iter()
                    .map(|sym| format!("${}", sym))
                    .collect::<Vec<_>>()
                    .join(", ");