diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2023-04-10 16:04:14 +0100 | 
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2023-04-25 18:59:55 +0100 | 
| commit | 01385136353ac35f16d10bf5890bf0efc80df761 (patch) | |
| tree | 5832418294e182550a3f42b6ca462515ca0872da /compiler/rustc_expand/src | |
| parent | eeb527602a0293337752f9dc0c63eca3990d8e4e (diff) | |
| download | rust-01385136353ac35f16d10bf5890bf0efc80df761.tar.gz rust-01385136353ac35f16d10bf5890bf0efc80df761.zip | |
Fix static string lints
Diffstat (limited to 'compiler/rustc_expand/src')
| -rw-r--r-- | compiler/rustc_expand/src/errors.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_expand/src/mbe/macro_check.rs | 6 | 
2 files changed, 12 insertions, 4 deletions
| diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs index e5102a952e7..e3a0ae3570e 100644 --- a/compiler/rustc_expand/src/errors.rs +++ b/compiler/rustc_expand/src/errors.rs @@ -397,3 +397,13 @@ pub struct ProcMacroDeriveTokens { #[primary_span] pub span: Span, } + +#[derive(Diagnostic)] +#[diag(expand_duplicate_matcher_binding)] +pub struct DuplicateMatcherBinding { + #[primary_span] + #[label] + pub span: Span, + #[label(expand_label2)] + pub prev: Span, +} diff --git a/compiler/rustc_expand/src/mbe/macro_check.rs b/compiler/rustc_expand/src/mbe/macro_check.rs index 5be134f4e66..75b6396f0be 100644 --- a/compiler/rustc_expand/src/mbe/macro_check.rs +++ b/compiler/rustc_expand/src/mbe/macro_check.rs @@ -104,6 +104,7 @@ //! Kleene operators under which a meta-variable is repeating is the concatenation of the stacks //! stored when entering a macro definition starting from the state in which the meta-variable is //! bound. +use crate::errors; use crate::mbe::{KleeneToken, TokenTree}; use rustc_ast::token::{Delimiter, Token, TokenKind}; @@ -281,10 +282,7 @@ fn check_binders( // Duplicate binders at the top-level macro definition are errors. The lint is only // for nested macro definitions. sess.span_diagnostic - .struct_span_err(span, "duplicate matcher binding") - .span_label(span, "duplicate binding") - .span_label(prev_info.span, "previous binding") - .emit(); + .emit_err(errors::DuplicateMatcherBinding { span, prev: prev_info.span }); *valid = false; } else { binders.insert(name, BinderInfo { span, ops: ops.into() }); | 
