Fix suggestion when shorthand self has erroneous type
This commit is contained in:
parent
96e51d9482
commit
05c34cc5ed
6 changed files with 127 additions and 1 deletions
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue