]> git.lizzy.rs Git - rust.git/commitdiff
fix #90187
authorzredb <zredb@163.com>
Sat, 15 Jan 2022 09:00:59 +0000 (17:00 +0800)
committerGuillaume Gomez <guillaume.gomez@huawei.com>
Mon, 17 Jan 2022 12:41:59 +0000 (13:41 +0100)
remove the definition of def_id_no_primitives and change;
 a missing use was modified;
 narrow the Cache accessibility of BadImplStripper;

src/librustdoc/clean/types.rs
src/librustdoc/passes/collect_trait_impls.rs
src/librustdoc/passes/stripper.rs

index 125afb2192c44bf95806985500e5b2ae4c8017c7..bb8dc7827d62f82e27e8f7b5ce1fb60fde9ffea8 100644 (file)
@@ -1566,23 +1566,11 @@ fn inner_def_id(&self, cache: Option<&Cache>) -> Option<DefId> {
 
     /// Use this method to get the [DefId] of a [clean] AST node, including [PrimitiveType]s.
     ///
-    /// See [`Self::def_id_no_primitives`] for more.
-    ///
     /// [clean]: crate::clean
+    ///
     crate fn def_id(&self, cache: &Cache) -> Option<DefId> {
         self.inner_def_id(Some(cache))
     }
-
-    /// Use this method to get the [`DefId`] of a [`clean`] AST node.
-    /// This will return [`None`] when called on a primitive [`clean::Type`].
-    /// Use [`Self::def_id`] if you want to include primitives.
-    ///
-    /// [`clean`]: crate::clean
-    /// [`clean::Type`]: crate::clean::Type
-    // FIXME: get rid of this function and always use `def_id`
-    crate fn def_id_no_primitives(&self) -> Option<DefId> {
-        self.inner_def_id(None)
-    }
 }
 
 /// A primitive (aka, builtin) type.
index 7c6559bf01d7049fcebf049443e65edd436b1149..53280b3df138b39a03724cd22fd00fe63938d411 100644 (file)
@@ -208,7 +208,7 @@ fn visit_item(&mut self, i: &Item) {
 struct BadImplStripper<'a> {
     prims: FxHashSet<PrimitiveType>,
     items: FxHashSet<ItemId>,
-    crate cache: &'a Cache,
+    cache: &'a Cache,
 }
 
 impl<'a> BadImplStripper<'a> {
index 4701d7f3e143a84fc2c3707c61189851d6d76bd2..717dc078b343cf3fd46176df79c8b54d74de2c74 100644 (file)
@@ -144,7 +144,7 @@ fn fold_item(&mut self, i: Item) -> Option<Item> {
             }
             if let Some(generics) = imp.trait_.as_ref().and_then(|t| t.generics()) {
                 for typaram in generics {
-                    if let Some(did) = typaram.def_id_no_primitives() {
+                    if let Some(did) = typaram.def_id(self.cache) {
                         if did.is_local() && !self.retained.contains(&did.into()) {
                             debug!(
                                 "ImplStripper: stripped item in trait's generics; removing impl"