From 57266f1df6e9168f262b208f4a2ee62ebdaf9ad2 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 18 Dec 2020 12:05:51 +0100 Subject: [PATCH] Continue String to Symbol conversion in rustdoc --- src/librustdoc/clean/blanket_impl.rs | 2 +- src/librustdoc/clean/inline.rs | 2 +- src/librustdoc/clean/mod.rs | 4 ++-- src/librustdoc/clean/types.rs | 2 +- src/librustdoc/html/render/mod.rs | 4 ++-- src/librustdoc/json/conversions.rs | 5 ++++- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 33b5e84c5e0..22496065afd 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -103,7 +103,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { .cx .tcx .provided_trait_methods(trait_def_id) - .map(|meth| meth.ident.to_string()) + .map(|meth| meth.ident.name) .collect(); impls.push(Item { diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 3cff5fa07b1..783be6c8243 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -427,7 +427,7 @@ crate fn build_impl( let provided = trait_ .def_id() - .map(|did| tcx.provided_trait_methods(did).map(|meth| meth.ident.to_string()).collect()) + .map(|did| tcx.provided_trait_methods(did).map(|meth| meth.ident.name).collect()) .unwrap_or_default(); debug!("build_impl: impl {:?} for {:?}", trait_.def_id(), for_.def_id()); diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 2809e85761d..07255168d06 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2065,9 +2065,9 @@ fn clean_impl(impl_: &hir::Item<'_>, cx: &DocContext<'_>) -> Vec { build_deref_target_impls(cx, &items, &mut ret); } - let provided: FxHashSet = trait_ + let provided: FxHashSet = trait_ .def_id() - .map(|did| cx.tcx.provided_trait_methods(did).map(|meth| meth.ident.to_string()).collect()) + .map(|did| cx.tcx.provided_trait_methods(did).map(|meth| meth.ident.name).collect()) .unwrap_or_default(); let for_ = for_.clean(cx); diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 52d023c83cb..cd6eccea532 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1762,7 +1762,7 @@ crate enum ImplPolarity { crate struct Impl { crate unsafety: hir::Unsafety, crate generics: Generics, - crate provided_trait_methods: FxHashSet, + crate provided_trait_methods: FxHashSet, crate trait_: Option, crate for_: Type, crate items: Vec, diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 62dac717968..d55c8f38912 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -2966,7 +2966,7 @@ fn render_assoc_item( AssocItemLink::GotoSource(did, provided_methods) => { // We're creating a link from an impl-item to the corresponding // trait-item and need to map the anchored type accordingly. - let ty = if provided_methods.contains(&*name.as_str()) { + let ty = if provided_methods.contains(&name) { ItemType::Method } else { ItemType::TyMethod @@ -3429,7 +3429,7 @@ fn render_union( #[derive(Copy, Clone)] enum AssocItemLink<'a> { Anchor(Option<&'a str>), - GotoSource(DefId, &'a FxHashSet), + GotoSource(DefId, &'a FxHashSet), } impl<'a> AssocItemLink<'a> { diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 9dc27e3411d..020b7787174 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -440,7 +440,10 @@ impl From for Impl { Impl { is_unsafe: unsafety == rustc_hir::Unsafety::Unsafe, generics: generics.into(), - provided_trait_methods: provided_trait_methods.into_iter().collect(), + provided_trait_methods: provided_trait_methods + .into_iter() + .map(|x| x.to_string()) + .collect(), trait_: trait_.map(Into::into), for_: for_.into(), items: ids(items),