diff options
| author | Oli Scherer <github333195615777966@oli-obk.de> | 2025-03-27 11:48:06 +0000 |
|---|---|---|
| committer | Oli Scherer <github333195615777966@oli-obk.de> | 2025-04-01 09:25:12 +0000 |
| commit | a7b687c26ef55bfc3481761fef6e46154e5f95ea (patch) | |
| tree | 909e74d3fee658f7390f81a8aa16dcd6ccc8f64b /compiler/rustc_hir_analysis/src/coherence/mod.rs | |
| parent | 97ea17b71aba0badfe9c8295f57a434bf79bdb72 (diff) | |
| download | rust-a7b687c26ef55bfc3481761fef6e46154e5f95ea.tar.gz rust-a7b687c26ef55bfc3481761fef6e46154e5f95ea.zip | |
Decouple trait impls of different traits wrt incremental
Diffstat (limited to 'compiler/rustc_hir_analysis/src/coherence/mod.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/coherence/mod.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/coherence/mod.rs b/compiler/rustc_hir_analysis/src/coherence/mod.rs index 15e0a72fdcb..16bac430491 100644 --- a/compiler/rustc_hir_analysis/src/coherence/mod.rs +++ b/compiler/rustc_hir_analysis/src/coherence/mod.rs @@ -153,9 +153,12 @@ pub(crate) fn provide(providers: &mut Providers) { } fn coherent_trait(tcx: TyCtxt<'_>, def_id: DefId) -> Result<(), ErrorGuaranteed> { + let impls = tcx.local_trait_impls(def_id); // If there are no impls for the trait, then "all impls" are trivially coherent and we won't check anything // anyway. Thus we bail out even before the specialization graph, avoiding the dep_graph edge. - let Some(impls) = tcx.all_local_trait_impls(()).get(&def_id) else { return Ok(()) }; + if impls.is_empty() { + return Ok(()); + } // Trigger building the specialization graph for the trait. This will detect and report any // overlap errors. let mut res = tcx.ensure_ok().specialization_graph_of(def_id); |
