Error on unsafe on non-unsafe attribute

This commit is contained in:
carbotaniuman
2024-05-15 18:52:08 -05:00
parent 48851d9adb
commit 230b58febf
9 changed files with 75 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ use std::{
};
use crate::fluent_generated as fluent;
use rustc_ast::Label;
use rustc_ast::{ast, Label};
use rustc_errors::{
codes::*, Applicability, Diag, DiagCtxt, DiagSymbolList, Diagnostic, EmissionGuarantee, Level,
MultiSpan, SubdiagMessageOp, Subdiagnostic,
@@ -863,6 +863,15 @@ pub struct InvalidAttrAtCrateLevel {
pub item: Option<ItemFollowingInnerAttr>,
}
#[derive(Diagnostic)]
#[diag(passes_invalid_attr_unsafe)]
#[note]
pub struct InvalidAttrUnsafe {
#[primary_span]
pub span: Span,
pub name: ast::Path,
}
#[derive(Clone, Copy)]
pub struct ItemFollowingInnerAttr {
pub span: Span,