diff options
| author | bors <bors@rust-lang.org> | 2024-01-14 04:37:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-14 04:37:45 +0000 |
| commit | aa5f781bd42340fe4f2eb4d68d2984454f600b78 (patch) | |
| tree | 6166eaf013996c8d153a24edb0e347de16e7d26a /compiler/rustc_parse/src/errors.rs | |
| parent | 3deb9bbf84f6431ebcbb7cbdbe3d89bc2636bc1b (diff) | |
| parent | aa8ecd0652afbecd6549d2f6e53c0a5f6aa76d8f (diff) | |
| download | rust-aa5f781bd42340fe4f2eb4d68d2984454f600b78.tar.gz rust-aa5f781bd42340fe4f2eb4d68d2984454f600b78.zip | |
Auto merge of #119341 - sjwang05:issue-58462, r=WaffleLapkin
Suggest quoting unquoted idents in attrs Closes #58462
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 0de252707bd..34b34a1bad6 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -973,6 +973,25 @@ pub(crate) struct InvalidMetaItem { pub token: Token, } +#[derive(Diagnostic)] +#[diag(parse_invalid_meta_item_unquoted_ident)] +pub(crate) struct InvalidMetaItemUnquotedIdent { + #[primary_span] + pub span: Span, + pub token: Token, + #[subdiagnostic] + pub sugg: InvalidMetaItemSuggQuoteIdent, +} + +#[derive(Subdiagnostic)] +#[multipart_suggestion(parse_suggestion, applicability = "machine-applicable")] +pub(crate) struct InvalidMetaItemSuggQuoteIdent { + #[suggestion_part(code = "\"")] + pub before: Span, + #[suggestion_part(code = "\"")] + pub after: Span, +} + #[derive(Subdiagnostic)] #[suggestion( parse_sugg_escape_identifier, |
