diff options
| author | Daria Sukhonina <dariasukhonina@gmail.com> | 2025-09-08 15:27:29 +0300 |
|---|---|---|
| committer | Daria Sukhonina <dariasukhonina@gmail.com> | 2025-09-08 15:27:29 +0300 |
| commit | 7e826fb14be36b4faf879c3aa1fe1a50b5750a5b (patch) | |
| tree | 18bcd0a2e56b78776b6e468f25ef76f340520788 /compiler | |
| parent | 78718d55700865328d1abf584956125bec7f5d9d (diff) | |
| download | rust-7e826fb14be36b4faf879c3aa1fe1a50b5750a5b.tar.gz rust-7e826fb14be36b4faf879c3aa1fe1a50b5750a5b.zip | |
Make `is_typeck_child` match exhaustive
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir/src/def.rs | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs index d563fd0a547..95abe5c40dd 100644 --- a/compiler/rustc_hir/src/def.rs +++ b/compiler/rustc_hir/src/def.rs @@ -445,7 +445,37 @@ impl DefKind { /// type-checking context, i.e. closure, coroutine or inline const. #[inline] pub fn is_typeck_child(self) -> bool { - matches!(self, DefKind::Closure | DefKind::InlineConst | DefKind::SyntheticCoroutineBody) + match self { + DefKind::Closure | DefKind::InlineConst | DefKind::SyntheticCoroutineBody => true, + DefKind::Mod + | DefKind::Struct + | DefKind::Union + | DefKind::Enum + | DefKind::Variant + | DefKind::Trait + | DefKind::TyAlias + | DefKind::ForeignTy + | DefKind::TraitAlias + | DefKind::AssocTy + | DefKind::TyParam + | DefKind::Fn + | DefKind::Const + | DefKind::ConstParam + | DefKind::Static { .. } + | DefKind::Ctor(_, _) + | DefKind::AssocFn + | DefKind::AssocConst + | DefKind::Macro(_) + | DefKind::ExternCrate + | DefKind::Use + | DefKind::ForeignMod + | DefKind::AnonConst + | DefKind::OpaqueTy + | DefKind::Field + | DefKind::LifetimeParam + | DefKind::GlobalAsm + | DefKind::Impl { .. } => false, + } } } |
