Change DefKind::Static to a struct variant

This commit is contained in:
Oli Scherer 2024-02-23 23:12:20 +00:00
parent 6c863bc64c
commit b205192f65
4 changed files with 5 additions and 5 deletions

View File

@ -273,7 +273,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
}
return false; // no need to walk further *on the variable*
},
Res::Def(DefKind::Static(_) | DefKind::Const, ..) => {
Res::Def(DefKind::Static{..} | DefKind::Const, ..) => {
if index_used_directly {
self.indexed_directly.insert(
seqvar.segments[0].ident.name,

View File

@ -101,7 +101,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
Res::Local(hir_id) => {
self.ids.insert(hir_id);
},
Res::Def(DefKind::Static(_), def_id) => {
Res::Def(DefKind::Static{..}, def_id) => {
let mutable = self.cx.tcx.is_mutable_static(def_id);
self.def_ids.insert(def_id, mutable);
},

View File

@ -91,7 +91,7 @@ pub(super) fn check<'tcx>(
},
hir::ExprKind::Path(ref p) => matches!(
cx.qpath_res(p, arg.hir_id),
hir::def::Res::Def(hir::def::DefKind::Const | hir::def::DefKind::Static(_), _)
hir::def::Res::Def(hir::def::DefKind::Const | hir::def::DefKind::Static{..}, _)
),
_ => false,
}

View File

@ -109,7 +109,7 @@ fn collect_unsafe_exprs<'tcx>(
ExprKind::Path(QPath::Resolved(
_,
hir::Path {
res: Res::Def(DefKind::Static(Mutability::Mut), _),
res: Res::Def(DefKind::Static{mt:Mutability::Mut}, _),
..
},
)) => {
@ -149,7 +149,7 @@ fn collect_unsafe_exprs<'tcx>(
ExprKind::Path(QPath::Resolved(
_,
hir::Path {
res: Res::Def(DefKind::Static(Mutability::Mut), _),
res: Res::Def(DefKind::Static{mt:Mutability::Mut}, _),
..
}
))