diff options
| author | bors <bors@rust-lang.org> | 2021-05-03 20:56:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-05-03 20:56:34 +0000 |
| commit | 88f19c6dab716c6281af7602e30f413e809c5974 (patch) | |
| tree | f7af4b32537043e9dfbdd884f811ee8fe0122d90 /src/librustdoc/html/render/mod.rs | |
| parent | 9a1dfd2dc5c42a2ee84b4606aa08cdadf8c0ee87 (diff) | |
| parent | 47c7b9c5788055ddbbb59d0d1fc909af7b48668d (diff) | |
| download | rust-1.52.0.tar.gz rust-1.52.0.zip | |
Auto merge of #84864 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.52.0
[stable] 1.52.0 release This includes the release notes (#84183) as well as cherry-picked commits from: * [beta] revert PR #77885 #84710 * [beta] remove assert_matches #84759 * Revert PR 81473 to resolve (on beta) issues 81626 and 81658. #83171 * [beta] rustdoc revert deref recur #84868 * Fix ICE of for-loop mut borrowck where no suggestions are available #83401 Additionally in "fresh work" we're also: * reverting: directly expose copy and copy_nonoverlapping intrinsics #81238 to avoid https://github.com/rust-lang/rust/issues/84297 on 1.52
Diffstat (limited to 'src/librustdoc/html/render/mod.rs')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 66c47f14655..820a5098bb4 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1159,21 +1159,12 @@ fn render_assoc_items( RenderMode::Normal } AssocItemRender::DerefFor { trait_, type_, deref_mut_ } => { - let id = cx.derive_id(small_url_encode(format!( - "deref-methods-{:#}", - type_.print(cx.cache()) - ))); - debug!("Adding {} to deref id map", type_.print(cx.cache())); - cx.deref_id_map - .borrow_mut() - .insert(type_.def_id_full(cx.cache()).unwrap(), id.clone()); write!( w, - "<h2 id=\"{id}\" class=\"small-section-header\">\ + "<h2 id=\"deref-methods\" class=\"small-section-header\">\ Methods from {trait_}<Target = {type_}>\ - <a href=\"#{id}\" class=\"anchor\"></a>\ + <a href=\"#deref-methods\" class=\"anchor\"></a>\ </h2>", - id = id, trait_ = trait_.print(cx.cache()), type_ = type_.print(cx.cache()), ); @@ -1198,6 +1189,9 @@ fn render_assoc_items( ); } } + if let AssocItemRender::DerefFor { .. } = what { + return; + } if !traits.is_empty() { let deref_impl = traits .iter() @@ -1208,13 +1202,6 @@ fn render_assoc_items( }); render_deref_methods(w, cx, impl_, containing_item, has_deref_mut); } - - // If we were already one level into rendering deref methods, we don't want to render - // anything after recursing into any further deref methods above. - if let AssocItemRender::DerefFor { .. } = what { - return; - } - let (synthetic, concrete): (Vec<&&Impl>, Vec<&&Impl>) = traits.iter().partition(|t| t.inner_impl().synthetic); let (blanket_impl, concrete): (Vec<&&Impl>, _) = @@ -2020,14 +2007,9 @@ fn sidebar_deref_methods(cx: &Context<'_>, out: &mut Buffer, impl_: &Impl, v: &V .flat_map(|i| get_methods(i.inner_impl(), true, &mut used_links, deref_mut, c)) .collect::<Vec<_>>(); if !ret.is_empty() { - let deref_id_map = cx.deref_id_map.borrow(); - let id = deref_id_map - .get(&real_target.def_id_full(cx.cache()).unwrap()) - .expect("Deref section without derived id"); write!( out, - "<a class=\"sidebar-title\" href=\"#{}\">Methods from {}<Target={}></a>", - id, + "<a class=\"sidebar-title\" href=\"#deref-methods\">Methods from {}<Target={}></a>", Escape(&format!("{:#}", impl_.inner_impl().trait_.as_ref().unwrap().print(c))), Escape(&format!("{:#}", real_target.print(c))), ); |
