about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-31 05:47:22 +0000
committerbors <bors@rust-lang.org>2021-03-31 05:47:22 +0000
commit2a32abbcdea97c6bf1d0445bc657f16c50ca103b (patch)
treea0f99946f0ff9e927dcedb078aafd484929aa0ad /src
parent6ff482bde5d22a3a0171edb3245327f43cf9b593 (diff)
parent6f06b761b991f5c4b714c6935781114dce44637a (diff)
downloadrust-2a32abbcdea97c6bf1d0445bc657f16c50ca103b.tar.gz
rust-2a32abbcdea97c6bf1d0445bc657f16c50ca103b.zip
Auto merge of #83681 - jyn514:blanket-impls-tweaks, r=Aaron1011
rustdoc: Only look at blanket impls in `get_blanket_impls`

The idea here is that all the work in https://github.com/rust-lang/rust/blob/16156fb2787f745e57504197bd7fe38b69c6cbea/compiler/rustc_middle/src/ty/trait_def.rs#L172-L186 doesn't matter for `get_blanket_impls` - Rustdoc will already pick up on those blocks when it documents the item.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/clean/blanket_impl.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs
index 1bbaa60fe96..f7e08d10401 100644
--- a/src/librustdoc/clean/blanket_impl.rs
+++ b/src/librustdoc/clean/blanket_impl.rs
@@ -26,7 +26,9 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
             {
                 continue;
             }
-            self.cx.tcx.for_each_relevant_impl(trait_def_id, ty, |impl_def_id| {
+            // NOTE: doesn't use `for_each_relevant_impl` to avoid looking at anything besides blanket impls
+            let trait_impls = self.cx.tcx.trait_impls_of(trait_def_id);
+            for &impl_def_id in trait_impls.blanket_impls() {
                 debug!(
                     "get_blanket_impls: Considering impl for trait '{:?}' {:?}",
                     trait_def_id, impl_def_id
@@ -86,7 +88,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
                     may_apply, trait_ref, ty
                 );
                 if !may_apply {
-                    return;
+                    continue;
                 }
 
                 self.cx.generated_synthetics.insert((ty, trait_def_id));
@@ -127,7 +129,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
                         blanket_impl: Some(trait_ref.self_ty().clean(self.cx)),
                     }),
                 });
-            });
+            }
         }
         impls
     }