Skip to content

Commit 345077a

Browse files
author
Lukas Markeffsky
committed
don't clone clean::Item in TypeImplCollector
1 parent 4facc1c commit 345077a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: src/librustdoc/html/render/write_shared.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -824,9 +824,9 @@ impl Serialize for Implementor {
824824
/// this visitor works to reverse that: `aliased_types` is a map
825825
/// from target to the aliases that reference it, and each one
826826
/// will generate one file.
827-
struct TypeImplCollector<'cx, 'cache> {
827+
struct TypeImplCollector<'cx, 'cache, 'item> {
828828
/// Map from DefId-of-aliased-type to its data.
829-
aliased_types: IndexMap<DefId, AliasedType<'cache>>,
829+
aliased_types: IndexMap<DefId, AliasedType<'cache, 'item>>,
830830
visited_aliases: FxHashSet<DefId>,
831831
cache: &'cache Cache,
832832
cx: &'cache mut Context<'cx>,
@@ -847,26 +847,26 @@ struct TypeImplCollector<'cx, 'cache> {
847847
/// ]
848848
/// )
849849
/// ```
850-
struct AliasedType<'cache> {
850+
struct AliasedType<'cache, 'item> {
851851
/// This is used to generate the actual filename of this aliased type.
852852
target_fqp: &'cache [Symbol],
853853
target_type: ItemType,
854854
/// This is the data stored inside the file.
855855
/// ItemId is used to deduplicate impls.
856-
impl_: IndexMap<ItemId, AliasedTypeImpl<'cache>>,
856+
impl_: IndexMap<ItemId, AliasedTypeImpl<'cache, 'item>>,
857857
}
858858

859859
/// The `impl_` contains data that's used to figure out if an alias will work,
860860
/// and to generate the HTML at the end.
861861
///
862862
/// The `type_aliases` list is built up with each type alias that matches.
863-
struct AliasedTypeImpl<'cache> {
863+
struct AliasedTypeImpl<'cache, 'item> {
864864
impl_: &'cache Impl,
865-
type_aliases: Vec<(&'cache [Symbol], Item)>,
865+
type_aliases: Vec<(&'cache [Symbol], &'item Item)>,
866866
}
867867

868-
impl<'cx, 'cache> DocVisitor<'_> for TypeImplCollector<'cx, 'cache> {
869-
fn visit_item(&mut self, it: &Item) {
868+
impl<'cx, 'cache, 'item> DocVisitor<'item> for TypeImplCollector<'cx, 'cache, 'item> {
869+
fn visit_item(&mut self, it: &'item Item) {
870870
self.visit_item_recur(it);
871871
let cache = self.cache;
872872
let ItemKind::TypeAliasItem(ref t) = it.kind else { return };
@@ -927,7 +927,7 @@ impl<'cx, 'cache> DocVisitor<'_> for TypeImplCollector<'cx, 'cache> {
927927
continue;
928928
}
929929
// This impl was not found in the set of rejected impls
930-
aliased_type_impl.type_aliases.push((&self_fqp[..], it.clone()));
930+
aliased_type_impl.type_aliases.push((&self_fqp[..], it));
931931
}
932932
}
933933
}

0 commit comments

Comments
 (0)