1
Fork 0

Change DefKind::Static to a struct variant

This commit is contained in:
Oli Scherer 2024-02-23 23:12:20 +00:00
parent 12e2846514
commit 9816915954
47 changed files with 90 additions and 86 deletions

View file

@ -801,7 +801,7 @@ fn check_foreign_item(
worklist: &mut Vec<(LocalDefId, ComesFromAllowExpect)>,
id: hir::ForeignItemId,
) {
if matches!(tcx.def_kind(id.owner_id), DefKind::Static(_) | DefKind::Fn)
if matches!(tcx.def_kind(id.owner_id), DefKind::Static { .. } | DefKind::Fn)
&& let Some(comes_from_allow) = has_allow_dead_code_or_lang_attr(tcx, id.owner_id.def_id)
{
worklist.push((id.owner_id.def_id, comes_from_allow));
@ -1058,7 +1058,7 @@ impl<'tcx> DeadVisitor<'tcx> {
DefKind::AssocConst
| DefKind::AssocFn
| DefKind::Fn
| DefKind::Static(_)
| DefKind::Static { .. }
| DefKind::Const
| DefKind::TyAlias
| DefKind::Enum

View file

@ -73,7 +73,7 @@ impl<'tcx> Visitor<'tcx> for ReachableContext<'tcx> {
match res {
// Reachable constants and reachable statics can have their contents inlined
// into other crates. Mark them as reachable and recurse into their body.
Res::Def(DefKind::Const | DefKind::AssocConst | DefKind::Static(_), _) => {
Res::Def(DefKind::Const | DefKind::AssocConst | DefKind::Static { .. }, _) => {
self.worklist.push(def_id);
}
_ => {