diff options
| author | bors <bors@rust-lang.org> | 2023-03-10 08:09:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-10 08:09:25 +0000 |
| commit | 104f4300cfddbd956e32820ef202a732f06ec848 (patch) | |
| tree | 556e5ecc43e89550c7d8b8f3d82454197f391d79 /compiler/rustc_parse/src/errors.rs | |
| parent | f37f8549940386a9d066ba199983affff47afbb4 (diff) | |
| parent | 5b3f84d8af3668944f25b542d2f71f88f253ecc0 (diff) | |
| download | rust-104f4300cfddbd956e32820ef202a732f06ec848.tar.gz rust-104f4300cfddbd956e32820ef202a732f06ec848.zip | |
Auto merge of #108934 - matthiaskrgr:rollup-vm414p5, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #106915 (Only load one CSS theme by default) - #108294 (Place binder correctly for arbitrary trait bound suggestion) - #108778 (x fmt: Don't print all modified files if there's more than 10) - #108854 (feat/refactor: improve errors in case of ident with number at start) - #108870 (Fix invalid inlining of reexport of reexport of private item) - #108917 (Consider target_family as pal) - #108922 (Add auto notification for changes to stable mir) - #108929 (Fix typo in span_map.rs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 1662db36d10..63e5bc50513 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -939,6 +939,7 @@ pub(crate) struct ExpectedIdentifier { pub token: Token, pub suggest_raw: Option<SuggEscapeToUseAsIdentifier>, pub suggest_remove_comma: Option<SuggRemoveComma>, + pub help_cannot_start_number: Option<HelpIdentifierStartsWithNumber>, } impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedIdentifier { @@ -975,10 +976,18 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedIdentifier { sugg.add_to_diagnostic(&mut diag); } + if let Some(help) = self.help_cannot_start_number { + help.add_to_diagnostic(&mut diag); + } + diag } } +#[derive(Subdiagnostic)] +#[help(parse_invalid_identifier_with_leading_number)] +pub(crate) struct HelpIdentifierStartsWithNumber; + pub(crate) struct ExpectedSemi { pub span: Span, pub token: Token, @@ -1208,14 +1217,6 @@ pub(crate) struct SelfParamNotFirst { } #[derive(Diagnostic)] -#[diag(parse_invalid_identifier_with_leading_number)] -pub(crate) struct InvalidIdentiferStartsWithNumber { - #[primary_span] - #[label] - pub span: Span, -} - -#[derive(Diagnostic)] #[diag(parse_const_generic_without_braces)] pub(crate) struct ConstGenericWithoutBraces { #[primary_span] |
