about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/const_eval
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-15 16:14:10 +0000
committerbors <bors@rust-lang.org>2023-02-15 16:14:10 +0000
commit2d14db321b043ffc579a7461464c88d7e3f54f83 (patch)
tree90bf861bcf5e24d0de4c73b3a05791e41e25e658 /compiler/rustc_const_eval/src/const_eval
parent999ac5f7770bff68bd65f490990d32c3ec1faaa6 (diff)
parent065f0b222d4e23ae3d4215061c5df7d248855717 (diff)
Auto merge of #108006 - cjgillot:def-impl, r=oli-obk
Avoid accessing HIR when it can be avoided

Experiment to see if it helps some incremental cases.

Will be rebased once https://github.com/rust-lang/rust/pull/107942 gets merged.

r? `@ghost`
Diffstat (limited to 'compiler/rustc_const_eval/src/const_eval')
-rw-r--r--compiler/rustc_const_eval/src/const_eval/fn_queries.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/fn_queries.rs b/compiler/rustc_const_eval/src/const_eval/fn_queries.rs
index f92277b1113..9eaab1f47a7 100644
--- a/compiler/rustc_const_eval/src/const_eval/fn_queries.rs
+++ b/compiler/rustc_const_eval/src/const_eval/fn_queries.rs
@@ -17,7 +17,8 @@ pub fn is_unstable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Symbol> {
 
 pub fn is_parent_const_impl_raw(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
     let parent_id = tcx.local_parent(def_id);
-    tcx.def_kind(parent_id) == DefKind::Impl && tcx.constness(parent_id) == hir::Constness::Const
+    matches!(tcx.def_kind(parent_id), DefKind::Impl { .. })
+        && tcx.constness(parent_id) == hir::Constness::Const
 }
 
 /// Checks whether an item is considered to be `const`. If it is a constructor, it is const. If