Add hard error and migration lint for unsafe attrs
This commit is contained in:
parent
33422e72c8
commit
a23917cfd0
24 changed files with 473 additions and 53 deletions
|
@ -2890,3 +2890,24 @@ pub struct RedundantImportVisibility {
|
|||
pub import_vis: String,
|
||||
pub max_vis: String,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_unsafe_attr_outside_unsafe)]
|
||||
pub struct UnsafeAttrOutsideUnsafe {
|
||||
#[label]
|
||||
pub span: Span,
|
||||
#[subdiagnostic]
|
||||
pub suggestion: UnsafeAttrOutsideUnsafeSuggestion,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(
|
||||
lint_unsafe_attr_outside_unsafe_suggestion,
|
||||
applicability = "machine-applicable"
|
||||
)]
|
||||
pub struct UnsafeAttrOutsideUnsafeSuggestion {
|
||||
#[suggestion_part(code = "unsafe(")]
|
||||
pub left: Span,
|
||||
#[suggestion_part(code = ")")]
|
||||
pub right: Span,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue