]> git.proxmox.com Git - rustc.git/blobdiff - src/librustdoc/clean/blanket_impl.rs
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / librustdoc / clean / blanket_impl.rs
index f1c26feea46ec4376675ea9036e9dc4733fcdafe..4e4e1e5cbce2f3111e3e1c3c9061ecfb2d353be5 100644 (file)
@@ -10,24 +10,19 @@ use rustc_span::DUMMY_SP;
 use super::*;
 
 crate struct BlanketImplFinder<'a, 'tcx> {
-    crate cx: &'a core::DocContext<'tcx>,
+    crate cx: &'a mut core::DocContext<'tcx>,
 }
 
 impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
-    crate fn new(cx: &'a core::DocContext<'tcx>) -> Self {
-        BlanketImplFinder { cx }
-    }
-
-    // FIXME(eddyb) figure out a better way to pass information about
-    // parametrization of `ty` than `param_env_def_id`.
-    crate fn get_blanket_impls(&self, ty: Ty<'tcx>, param_env_def_id: DefId) -> Vec<Item> {
-        let param_env = self.cx.tcx.param_env(param_env_def_id);
+    crate fn get_blanket_impls(&mut self, item_def_id: DefId) -> Vec<Item> {
+        let param_env = self.cx.tcx.param_env(item_def_id);
+        let ty = self.cx.tcx.type_of(item_def_id);
 
         debug!("get_blanket_impls({:?})", ty);
         let mut impls = Vec::new();
         for &trait_def_id in self.cx.tcx.all_traits(LOCAL_CRATE).iter() {
-            if !self.cx.renderinfo.borrow().access_levels.is_public(trait_def_id)
-                || self.cx.generated_synthetics.borrow_mut().get(&(ty, trait_def_id)).is_some()
+            if !self.cx.cache.access_levels.is_public(trait_def_id)
+                || self.cx.generated_synthetics.get(&(ty, trait_def_id)).is_some()
             {
                 continue;
             }
@@ -43,7 +38,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
                         _ => return false,
                     }
 
-                    let substs = infcx.fresh_substs_for_item(DUMMY_SP, param_env_def_id);
+                    let substs = infcx.fresh_substs_for_item(DUMMY_SP, item_def_id);
                     let ty = ty.subst(infcx.tcx, substs);
                     let param_env = param_env.subst(infcx.tcx, substs);
 
@@ -98,7 +93,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
                     return;
                 }
 
-                self.cx.generated_synthetics.borrow_mut().insert((ty, trait_def_id));
+                self.cx.generated_synthetics.insert((ty, trait_def_id));
                 let provided_trait_methods = self
                     .cx
                     .tcx