Skip to content

Commit 7e826fb

Browse files
committed
Make is_typeck_child match exhaustive
1 parent 78718d5 commit 7e826fb

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

compiler/rustc_hir/src/def.rs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,37 @@ impl DefKind {
445445
/// type-checking context, i.e. closure, coroutine or inline const.
446446
#[inline]
447447
pub fn is_typeck_child(self) -> bool {
448-
matches!(self, DefKind::Closure | DefKind::InlineConst | DefKind::SyntheticCoroutineBody)
448+
match self {
449+
DefKind::Closure | DefKind::InlineConst | DefKind::SyntheticCoroutineBody => true,
450+
DefKind::Mod
451+
| DefKind::Struct
452+
| DefKind::Union
453+
| DefKind::Enum
454+
| DefKind::Variant
455+
| DefKind::Trait
456+
| DefKind::TyAlias
457+
| DefKind::ForeignTy
458+
| DefKind::TraitAlias
459+
| DefKind::AssocTy
460+
| DefKind::TyParam
461+
| DefKind::Fn
462+
| DefKind::Const
463+
| DefKind::ConstParam
464+
| DefKind::Static { .. }
465+
| DefKind::Ctor(_, _)
466+
| DefKind::AssocFn
467+
| DefKind::AssocConst
468+
| DefKind::Macro(_)
469+
| DefKind::ExternCrate
470+
| DefKind::Use
471+
| DefKind::ForeignMod
472+
| DefKind::AnonConst
473+
| DefKind::OpaqueTy
474+
| DefKind::Field
475+
| DefKind::LifetimeParam
476+
| DefKind::GlobalAsm
477+
| DefKind::Impl { .. } => false,
478+
}
449479
}
450480
}
451481

0 commit comments

Comments
 (0)