diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index ce4c1a76b5b8..6f2085e0d43d 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -483,10 +483,11 @@ fn build_module( } if let Res::PrimTy(p) = item.res { // Primitive types can't be inlined so generate an import instead. + let prim_ty = clean::PrimitiveType::from(p); items.push(clean::Item { name: None, attrs: box clean::Attributes::default(), - def_id: ItemId::Primitive(did.krate), + def_id: ItemId::Primitive(prim_ty, did.krate), visibility: clean::Public, kind: box clean::ImportItem(clean::Import::new_simple( item.ident.name, @@ -495,7 +496,7 @@ fn build_module( global: false, res: item.res, segments: vec![clean::PathSegment { - name: clean::PrimitiveType::from(p).as_sym(), + name: prim_ty.as_sym(), args: clean::GenericArgs::AngleBracketed { args: Vec::new(), bindings: Vec::new(), diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 67f7a10e2d07..4ffce6c7656f 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -50,7 +50,7 @@ use self::Type::*; crate type ItemIdSet = FxHashSet; -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)] +#[derive(Debug, Clone, PartialEq, Eq, Hash, Copy)] crate enum ItemId { /// A "normal" item that uses a [`DefId`] for identification. DefId(DefId), @@ -59,7 +59,7 @@ crate enum ItemId { /// Identifier that is used for blanket implementations. Blanket { trait_: DefId, for_: DefId }, /// Identifier for primitive types. - Primitive(CrateNum), + Primitive(PrimitiveType, CrateNum), } impl ItemId { @@ -69,7 +69,7 @@ impl ItemId { ItemId::Auto { for_: id, .. } | ItemId::Blanket { for_: id, .. } | ItemId::DefId(id) => id.is_local(), - ItemId::Primitive(krate) => krate == LOCAL_CRATE, + ItemId::Primitive(_, krate) => krate == LOCAL_CRATE, } } @@ -94,7 +94,7 @@ impl ItemId { ItemId::Auto { for_: id, .. } | ItemId::Blanket { for_: id, .. } | ItemId::DefId(id) => id.krate, - ItemId::Primitive(krate) => krate, + ItemId::Primitive(_, krate) => krate, } } diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index 671e9e5c382b..e7d6e5ac2c24 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -122,7 +122,7 @@ crate struct Cache { /// All intra-doc links resolved so far. /// /// Links are indexed by the DefId of the item they document. - crate intra_doc_links: BTreeMap>, + crate intra_doc_links: FxHashMap>, } /// This struct is used to wrap the `cache` and `tcx` in order to run `DocFolder`. diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index bf4c7e7ff376..bd9f54d2e80d 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -188,7 +188,7 @@ crate fn from_item_id(did: ItemId) -> Id { ItemId::Auto { for_, trait_ } => { Id(format!("a:{}-{}", DisplayDefId(trait_), DisplayDefId(for_))) } - ItemId::Primitive(krate) => Id(format!("p:{}", krate.as_u32())), + ItemId::Primitive(ty, krate) => Id(format!("p:{}:{}", krate.as_u32(), ty.as_sym())), } }