diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-08-01 18:43:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-01 18:43:41 +0200 |
| commit | 29cd3103a162c1bf80a6123aaa77fc2d3e392150 (patch) | |
| tree | 90cb44fdcd80612350ee6a299ccf0a303c8c15cb /compiler/rustc_parse/src/errors.rs | |
| parent | 8671b0bfbd905c69773657d8f87eb08ccf01056d (diff) | |
| parent | e157954cce4497738a728f8c295c71b229d35a66 (diff) | |
| download | rust-29cd3103a162c1bf80a6123aaa77fc2d3e392150.tar.gz rust-29cd3103a162c1bf80a6123aaa77fc2d3e392150.zip | |
Rollup merge of #128496 - clubby789:box-syntax-multipart, r=compiler-errors
Fix removed `box_syntax` diagnostic if source isn't available Fix #128442
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 99f2f26b8cb..0d4512be480 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -2725,15 +2725,24 @@ impl HelpUseLatestEdition { #[derive(Diagnostic)] #[diag(parse_box_syntax_removed)] -pub struct BoxSyntaxRemoved<'a> { +pub struct BoxSyntaxRemoved { #[primary_span] - #[suggestion( - code = "Box::new({code})", - applicability = "machine-applicable", - style = "verbose" - )] pub span: Span, - pub code: &'a str, + #[subdiagnostic] + pub sugg: AddBoxNew, +} + +#[derive(Subdiagnostic)] +#[multipart_suggestion( + parse_box_syntax_removed_suggestion, + applicability = "machine-applicable", + style = "verbose" +)] +pub struct AddBoxNew { + #[suggestion_part(code = "Box::new(")] + pub box_kw_and_lo: Span, + #[suggestion_part(code = ")")] + pub hi: Span, } #[derive(Diagnostic)] |
