diff options
| author | sjwang05 <63834813+sjwang05@users.noreply.github.com> | 2023-12-26 18:34:44 -0800 |
|---|---|---|
| committer | sjwang05 <63834813+sjwang05@users.noreply.github.com> | 2024-01-12 13:59:47 -0800 |
| commit | aa8ecd0652afbecd6549d2f6e53c0a5f6aa76d8f (patch) | |
| tree | 33eac55b0dacdca88146661ac85fe53b386362d7 /compiler/rustc_parse/src/errors.rs | |
| parent | 6029085a6f7b2a15a43f83bcea730d9786d7d5a1 (diff) | |
| download | rust-aa8ecd0652afbecd6549d2f6e53c0a5f6aa76d8f.tar.gz rust-aa8ecd0652afbecd6549d2f6e53c0a5f6aa76d8f.zip | |
Suggest quoting unquoted idents in attrs
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, |
