diff options
| author | Michael Goulet <michael@errs.io> | 2024-03-08 00:02:11 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-12-04 19:52:53 +0000 |
| commit | 05c34cc5ed35dbf32f83e2eaa0ebbda4c4953294 (patch) | |
| tree | c90ab2db52cef4b472db5291b58ed28038700053 /compiler/rustc_parse/src/errors.rs | |
| parent | 96e51d9482405e400dec53750f3b263d45784ada (diff) | |
| download | rust-05c34cc5ed35dbf32f83e2eaa0ebbda4c4953294.tar.gz rust-05c34cc5ed35dbf32f83e2eaa0ebbda4c4953294.zip | |
Fix suggestion when shorthand self has erroneous type
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 2579e4c1f25..14f2dd32e92 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -3409,3 +3409,22 @@ pub(crate) struct PolarityAndModifiers { pub polarity: &'static str, pub modifiers_concatenated: String, } + +#[derive(Diagnostic)] +#[diag(parse_incorrect_type_on_self)] +pub(crate) struct IncorrectTypeOnSelf { + #[primary_span] + pub span: Span, + #[subdiagnostic] + pub move_self_modifier: MoveSelfModifier, +} + +#[derive(Subdiagnostic)] +#[multipart_suggestion(parse_suggestion, applicability = "machine-applicable")] +pub(crate) struct MoveSelfModifier { + #[suggestion_part(code = "")] + pub removal_span: Span, + #[suggestion_part(code = "{modifier}")] + pub insertion_span: Span, + pub modifier: String, +} |
