about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/coherence/mod.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-02-09 09:38:22 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-02-09 20:12:02 +0000
commit4661c83530237349621793346ca5d4d8654d0cd1 (patch)
treec8e64207df35cf9c1e9a4e557a7bae287595a8fe /compiler/rustc_hir_analysis/src/coherence/mod.rs
parentf4cfd872028398da2b2d85c368c51f4d007dc6af (diff)
downloadrust-4661c83530237349621793346ca5d4d8654d0cd1.tar.gz
rust-4661c83530237349621793346ca5d4d8654d0cd1.zip
Avoid accessing the HIR in the happy path of `coherent_trait`
Diffstat (limited to 'compiler/rustc_hir_analysis/src/coherence/mod.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/coherence/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/coherence/mod.rs b/compiler/rustc_hir_analysis/src/coherence/mod.rs
index 8cf1f2c9407..a71ea00a044 100644
--- a/compiler/rustc_hir_analysis/src/coherence/mod.rs
+++ b/compiler/rustc_hir_analysis/src/coherence/mod.rs
@@ -133,9 +133,10 @@ fn coherent_trait(tcx: TyCtxt<'_>, def_id: DefId) -> Result<(), ErrorGuaranteed>
 
         res = res.and(unsafety::check_item(tcx, impl_def_id));
         res = res.and(tcx.ensure().orphan_check_impl(impl_def_id));
+        res = res.and(builtin::check_trait(tcx, def_id, impl_def_id));
     }
 
-    res.and(builtin::check_trait(tcx, def_id))
+    res
 }
 
 /// Checks whether an impl overlaps with the automatic `impl Trait for dyn Trait`.