Add safe/unsafe to static inside extern blocks

This commit is contained in:
Santiago Pastorino 2024-05-07 14:43:23 +02:00
parent b4cbdb7246
commit bac72cf7cf
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
27 changed files with 152 additions and 57 deletions

View file

@ -41,7 +41,8 @@ fn path_if_static_mut(tcx: TyCtxt<'_>, expr: &hir::Expr<'_>) -> Option<String> {
if let hir::ExprKind::Path(qpath) = expr.kind
&& let hir::QPath::Resolved(_, path) = qpath
&& let hir::def::Res::Def(def_kind, _) = path.res
&& let hir::def::DefKind::Static { mutability: Mutability::Mut, nested: false } = def_kind
&& let hir::def::DefKind::Static { safety: _, mutability: Mutability::Mut, nested: false } =
def_kind
{
return Some(qpath_to_string(&tcx, &qpath));
}