]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #79469 - rust-lang:revert-77467-query-docs, r=jyn514
authorbors <bors@rust-lang.org>
Sat, 28 Nov 2020 00:53:02 +0000 (00:53 +0000)
committerbors <bors@rust-lang.org>
Sat, 28 Nov 2020 00:53:02 +0000 (00:53 +0000)
Revert "Normalize `<X as Y>::T` for rustdoc"

Reverts rust-lang/rust#77467 by disabling normalization. See https://github.com/rust-lang/rust/issues/79459; I intend to reland normalization once that's fixed.

r? `@Aaron1011`
cc `@oli-obk` `@GuillaumeGomez`

1  2 
src/librustdoc/clean/mod.rs

index 03fda94a6dfc539ef395295a6fed80cb81382d34,5c9ac3c4f6f177cf05a6089379cecabc92708bc9..13643fbf3d3fbd7f0655edd501270de48918f6d4
@@@ -122,7 -122,7 +122,7 @@@ impl Clean<ExternalCrate> for CrateNum 
                          }
                      }
                  }
 -                return prim.map(|p| (def_id, p, attrs));
 +                return prim.map(|p| (def_id, p));
              }
              None
          };
                          hir::ItemKind::Use(ref path, hir::UseKind::Single)
                              if item.vis.node.is_pub() =>
                          {
 -                            as_primitive(path.res).map(|(_, prim, attrs)| {
 +                            as_primitive(path.res).map(|(_, prim)| {
                                  // Pretend the primitive is local.
 -                                (cx.tcx.hir().local_def_id(id.id).to_def_id(), prim, attrs)
 +                                (cx.tcx.hir().local_def_id(id.id).to_def_id(), prim)
                              })
                          }
                          _ => None,
                          }
                      }
                  }
 -                return keyword.map(|p| (def_id, p, attrs));
 +                return keyword.map(|p| (def_id, p));
              }
              None
          };
                          hir::ItemKind::Use(ref path, hir::UseKind::Single)
                              if item.vis.node.is_pub() =>
                          {
 -                            as_keyword(path.res).map(|(_, prim, attrs)| {
 -                                (cx.tcx.hir().local_def_id(id.id).to_def_id(), prim, attrs)
 +                            as_keyword(path.res).map(|(_, prim)| {
 +                                (cx.tcx.hir().local_def_id(id.id).to_def_id(), prim)
                              })
                          }
                          _ => None,
@@@ -1099,7 -1099,7 +1099,7 @@@ impl Clean<Item> for hir::TraitItem<'_
                      AssocTypeItem(bounds.clean(cx), default.clean(cx))
                  }
              };
 -            Item::from_def_id_and_parts(local_did, Some(self.ident.name), inner, cx)
 +            Item::from_def_id_and_parts(local_did, Some(self.ident.name.clean(cx)), inner, cx)
          })
      }
  }
@@@ -1127,7 -1127,7 +1127,7 @@@ impl Clean<Item> for hir::ImplItem<'_> 
                      TypedefItem(Typedef { type_, generics: Generics::default(), item_type }, true)
                  }
              };
 -            Item::from_def_id_and_parts(local_did, Some(self.ident.name), inner, cx)
 +            Item::from_def_id_and_parts(local_did, Some(self.ident.name.clean(cx)), inner, cx)
          })
      }
  }
@@@ -1284,7 -1284,7 +1284,7 @@@ impl Clean<Item> for ty::AssocItem 
              }
          };
  
 -        Item::from_def_id_and_parts(self.def_id, Some(self.ident.name), kind, cx)
 +        Item::from_def_id_and_parts(self.def_id, Some(self.ident.name.clean(cx)), kind, cx)
      }
  }
  
@@@ -1503,7 -1503,9 +1503,9 @@@ impl Clean<Type> for hir::Ty<'_> 
  }
  
  /// Returns `None` if the type could not be normalized
+ #[allow(unreachable_code, unused_variables)]
  fn normalize(cx: &DocContext<'tcx>, ty: Ty<'_>) -> Option<Ty<'tcx>> {
+     return None; // HACK: low-churn fix for #79459 while we wait for a trait normalization fix
      use crate::rustc_trait_selection::infer::TyCtxtInferExt;
      use crate::rustc_trait_selection::traits::query::normalize::AtExt;
      use rustc_middle::traits::ObligationCause;
@@@ -1769,7 -1771,7 +1771,7 @@@ impl Clean<Item> for ty::FieldDef 
      fn clean(&self, cx: &DocContext<'_>) -> Item {
          let what_rustc_thinks = Item::from_def_id_and_parts(
              self.did,
 -            Some(self.ident.name),
 +            Some(self.ident.name.clean(cx)),
              StructFieldItem(cx.tcx.type_of(self.did).clean(cx)),
              cx,
          );
@@@ -1844,20 -1846,22 +1846,20 @@@ impl Clean<Item> for ty::VariantDef 
                  fields: self
                      .fields
                      .iter()
 -                    .map(|field| Item {
 -                        source: cx.tcx.def_span(field.did).clean(cx),
 -                        name: Some(field.ident.name.clean(cx)),
 -                        attrs: cx.tcx.get_attrs(field.did).clean(cx),
 -                        visibility: Visibility::Inherited,
 -                        def_id: field.did,
 -                        stability: get_stability(cx, field.did),
 -                        deprecation: get_deprecation(cx, field.did),
 -                        kind: StructFieldItem(cx.tcx.type_of(field.did).clean(cx)),
 +                    .map(|field| {
 +                        let name = Some(field.ident.name.clean(cx));
 +                        let kind = StructFieldItem(cx.tcx.type_of(field.did).clean(cx));
 +                        let what_rustc_thinks =
 +                            Item::from_def_id_and_parts(field.did, name, kind, cx);
 +                        // don't show `pub` for fields, which are always public
 +                        Item { visibility: Visibility::Inherited, ..what_rustc_thinks }
                      })
                      .collect(),
              }),
          };
          let what_rustc_thinks = Item::from_def_id_and_parts(
              self.def_id,
 -            Some(self.ident.name),
 +            Some(self.ident.name.clean(cx)),
              VariantItem(Variant { kind }),
              cx,
          );
@@@ -2055,7 -2059,7 +2057,7 @@@ impl Clean<Vec<Item>> for (&hir::Item<'
                  _ => unreachable!("not yet converted"),
              };
  
 -            vec![Item::from_def_id_and_parts(def_id, Some(name), kind, cx)]
 +            vec![Item::from_def_id_and_parts(def_id, Some(name.clean(cx)), kind, cx)]
          })
      }
  }
@@@ -2317,7 -2321,7 +2319,7 @@@ impl Clean<Item> for doctree::Macro 
      fn clean(&self, cx: &DocContext<'_>) -> Item {
          Item::from_def_id_and_parts(
              self.def_id,
 -            Some(self.name),
 +            Some(self.name.clean(cx)),
              MacroItem(Macro {
                  source: format!(
                      "macro_rules! {} {{\n{}}}",