1
Fork 0

Fix bad replacement for unsafe extern block suggestion

This commit is contained in:
yukang 2024-06-26 08:44:59 +08:00
parent c3d7fb3985
commit 0addda6578
10 changed files with 75 additions and 26 deletions

View file

@ -464,7 +464,7 @@ impl<'a> AstValidator<'a> {
{
self.dcx().emit_err(errors::InvalidSafetyOnExtern {
item_span: span,
block: self.current_extern_span(),
block: self.current_extern_span().shrink_to_lo(),
});
}
}

View file

@ -221,7 +221,7 @@ pub enum ExternBlockSuggestion {
pub struct InvalidSafetyOnExtern {
#[primary_span]
pub item_span: Span,
#[suggestion(code = "", applicability = "maybe-incorrect")]
#[suggestion(code = "unsafe ", applicability = "machine-applicable", style = "verbose")]
pub block: Span,
}