diff --git a/library/alloc/src/collections/vec_deque/into_iter.rs b/library/alloc/src/collections/vec_deque/into_iter.rs index 1c635dd4f27fa..46a769a722a8b 100644 --- a/library/alloc/src/collections/vec_deque/into_iter.rs +++ b/library/alloc/src/collections/vec_deque/into_iter.rs @@ -38,6 +38,7 @@ impl Iterator for IntoIter { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/alloc/src/collections/vec_deque/iter.rs b/library/alloc/src/collections/vec_deque/iter.rs index f3eb228c9e380..ae1b03c9a4d22 100644 --- a/library/alloc/src/collections/vec_deque/iter.rs +++ b/library/alloc/src/collections/vec_deque/iter.rs @@ -103,6 +103,7 @@ impl<'a, T> Iterator for Iter<'a, T> { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/alloc/src/collections/vec_deque/iter_mut.rs b/library/alloc/src/collections/vec_deque/iter_mut.rs index 9493676e66bc8..df30c38652f72 100644 --- a/library/alloc/src/collections/vec_deque/iter_mut.rs +++ b/library/alloc/src/collections/vec_deque/iter_mut.rs @@ -89,6 +89,7 @@ impl<'a, T> Iterator for IterMut<'a, T> { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index 8da4d995ba5c6..7a08f4c6cbaac 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -163,6 +163,7 @@ impl Iterator for IntoIter { self.len() } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/array/iter.rs b/library/core/src/array/iter.rs index aedbeab661058..931ea77eca4dc 100644 --- a/library/core/src/array/iter.rs +++ b/library/core/src/array/iter.rs @@ -132,6 +132,7 @@ impl Iterator for IntoIter { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/cloned.rs b/library/core/src/iter/adapters/cloned.rs index 7efc155175c34..5cd65a9415fd7 100644 --- a/library/core/src/iter/adapters/cloned.rs +++ b/library/core/src/iter/adapters/cloned.rs @@ -58,6 +58,7 @@ where self.it.map(T::clone).fold(init, f) } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> T where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/copied.rs b/library/core/src/iter/adapters/copied.rs index def2408927589..07a3b5d245659 100644 --- a/library/core/src/iter/adapters/copied.rs +++ b/library/core/src/iter/adapters/copied.rs @@ -74,6 +74,7 @@ where self.it.count() } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> T where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/enumerate.rs b/library/core/src/iter/adapters/enumerate.rs index 91722a4b62a2e..8b27bdc60a705 100644 --- a/library/core/src/iter/adapters/enumerate.rs +++ b/library/core/src/iter/adapters/enumerate.rs @@ -111,6 +111,7 @@ where } #[rustc_inherit_overflow_checks] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> ::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/fuse.rs b/library/core/src/iter/adapters/fuse.rs index aff48b1b220c4..0c21df4f12c60 100644 --- a/library/core/src/iter/adapters/fuse.rs +++ b/library/core/src/iter/adapters/fuse.rs @@ -114,6 +114,7 @@ where } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/map.rs b/library/core/src/iter/adapters/map.rs index 0bf9f4b0327e9..dc86eccfcb82f 100644 --- a/library/core/src/iter/adapters/map.rs +++ b/library/core/src/iter/adapters/map.rs @@ -122,6 +122,7 @@ where self.iter.fold(init, map_fold(self.f, g)) } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> B where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/zip.rs b/library/core/src/iter/adapters/zip.rs index c95324c80ba61..8a6955060e82f 100644 --- a/library/core/src/iter/adapters/zip.rs +++ b/library/core/src/iter/adapters/zip.rs @@ -88,6 +88,7 @@ where } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/range.rs b/library/core/src/iter/range.rs index de5d77e96ee56..4a86d6a100abe 100644 --- a/library/core/src/iter/range.rs +++ b/library/core/src/iter/range.rs @@ -667,6 +667,7 @@ impl Iterator for ops::Range { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs index 1ee662c6c8e3c..b2cb2f12bbfeb 100644 --- a/library/core/src/slice/iter.rs +++ b/library/core/src/slice/iter.rs @@ -2148,6 +2148,7 @@ impl<'a, T, const N: usize> Iterator for ArrayChunks<'a, T, N> { self.iter.last() } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> &'a [T; N] { // SAFETY: The safety guarantees of `__iterator_get_unchecked` are // transferred to the caller. @@ -2260,6 +2261,7 @@ impl<'a, T, const N: usize> Iterator for ArrayChunksMut<'a, T, N> { self.iter.last() } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> &'a mut [T; N] { // SAFETY: The safety guarantees of `__iterator_get_unchecked` are transferred to // the caller. diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs index 6ec6b70b57119..a5774764573be 100644 --- a/library/core/src/str/iter.rs +++ b/library/core/src/str/iter.rs @@ -295,6 +295,7 @@ impl Iterator for Bytes<'_> { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> u8 { // SAFETY: the caller must uphold the safety contract // for `Iterator::__iterator_get_unchecked`. diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 0efa014b12748..499f33f14f562 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -490,7 +490,6 @@ fn settings(root_path: &str, suffix: &str, themes: &[StylePath]) -> Result, w: &mut Buffer, @@ -746,8 +747,6 @@ fn render_impls( containing_item, assoc_link, RenderMode::Normal, - containing_item.stable_since(tcx).as_deref(), - containing_item.const_stable_since(tcx).as_deref(), true, None, false, @@ -1025,7 +1024,6 @@ fn render_assoc_items( Some(v) => v, None => return, }; - let tcx = cx.tcx(); let cache = cx.cache(); let (non_trait, traits): (Vec<_>, _) = v.iter().partition(|i| i.inner_impl().trait_.is_none()); if !non_trait.is_empty() { @@ -1059,8 +1057,6 @@ fn render_assoc_items( containing_item, AssocItemLink::Anchor(None), render_mode, - containing_item.stable_since(tcx).as_deref(), - containing_item.const_stable_since(tcx).as_deref(), true, None, false, @@ -1261,8 +1257,6 @@ fn render_impl( parent: &clean::Item, link: AssocItemLink<'_>, render_mode: RenderMode, - outer_version: Option<&str>, - outer_const_version: Option<&str>, show_def_docs: bool, use_absolute: Option, is_on_foreign_type: bool, @@ -1279,23 +1273,23 @@ fn render_impl( // For trait implementations, the `interesting` output contains all methods that have doc // comments, and the `boring` output contains all methods that do not. The distinction is // used to allow hiding the boring methods. + // `containing_item` is used for rendering stability info. If the parent is a trait impl, + // `containing_item` will the grandparent, since trait impls can't have stability attached. fn doc_impl_item( boring: &mut Buffer, interesting: &mut Buffer, cx: &Context<'_>, item: &clean::Item, parent: &clean::Item, + containing_item: &clean::Item, link: AssocItemLink<'_>, render_mode: RenderMode, is_default_item: bool, - outer_version: Option<&str>, - outer_const_version: Option<&str>, trait_: Option<&clean::Trait>, show_def_docs: bool, ) { let item_type = item.type_(); let name = item.name.as_ref().unwrap(); - let tcx = cx.tcx(); let render_method_item = match render_mode { RenderMode::Normal => true, @@ -1364,6 +1358,8 @@ fn render_impl( "
", id, item_type, in_trait_class, ); + render_rightside(w, cx, item, containing_item); + write!(w, "", id); w.write_str(""); render_assoc_item( w, @@ -1373,15 +1369,6 @@ fn render_impl( cx, ); w.write_str(""); - render_stability_since_raw( - w, - item.stable_since(tcx).as_deref(), - item.const_stable_since(tcx).as_deref(), - outer_version, - outer_const_version, - ); - write!(w, "", id); - write_srclink(cx, item, w); w.write_str("
"); } } @@ -1390,9 +1377,11 @@ fn render_impl( let id = cx.derive_id(source_id.clone()); write!( w, - "
", + "
", id, item_type, in_trait_class ); + write!(w, "", id); + w.write_str(""); assoc_type( w, item, @@ -1403,7 +1392,6 @@ fn render_impl( cx, ); w.write_str(""); - write!(w, "", id); w.write_str("
"); } clean::AssocConstItem(ref ty, ref default) => { @@ -1411,9 +1399,12 @@ fn render_impl( let id = cx.derive_id(source_id.clone()); write!( w, - "
", + "
", id, item_type, in_trait_class ); + render_rightside(w, cx, item, containing_item); + write!(w, "", id); + w.write_str(""); assoc_const( w, item, @@ -1424,21 +1415,14 @@ fn render_impl( cx, ); w.write_str(""); - render_stability_since_raw( - w, - item.stable_since(tcx).as_deref(), - item.const_stable_since(tcx).as_deref(), - outer_version, - outer_const_version, - ); - write!(w, "", id); - write_srclink(cx, item, w); w.write_str("
"); } clean::AssocTypeItem(ref bounds, ref default) => { let source_id = format!("{}.{}", item_type, name); let id = cx.derive_id(source_id.clone()); - write!(w, "
", id, item_type, in_trait_class,); + write!(w, "
", id, item_type, in_trait_class,); + write!(w, "", id); + w.write_str(""); assoc_type( w, item, @@ -1449,7 +1433,6 @@ fn render_impl( cx, ); w.write_str(""); - write!(w, "", id); w.write_str("
"); } clean::StrippedItem(..) => return, @@ -1474,11 +1457,10 @@ fn render_impl( cx, trait_item, if trait_.is_some() { &i.impl_item } else { parent }, + parent, link, render_mode, false, - outer_version, - outer_const_version, trait_.map(|t| &t.trait_), show_def_docs, ); @@ -1491,9 +1473,8 @@ fn render_impl( t: &clean::Trait, i: &clean::Impl, parent: &clean::Item, + containing_item: &clean::Item, render_mode: RenderMode, - outer_version: Option<&str>, - outer_const_version: Option<&str>, show_def_docs: bool, ) { for trait_item in &t.items { @@ -1511,11 +1492,10 @@ fn render_impl( cx, trait_item, parent, + containing_item, assoc_link, render_mode, true, - outer_version, - outer_const_version, Some(t), show_def_docs, ); @@ -1535,28 +1515,25 @@ fn render_impl( &t.trait_, &i.inner_impl(), &i.impl_item, + parent, render_mode, - outer_version, - outer_const_version, show_def_docs, ); } } if render_mode == RenderMode::Normal { - let toggled = !impl_items.is_empty() || !default_impl_items.is_empty(); + let toggled = !(impl_items.is_empty() && default_impl_items.is_empty()); if toggled { close_tags.insert_str(0, ""); write!(w, "
"); - } - if toggled { write!(w, "") } render_impl_summary( w, cx, i, - outer_version, - outer_const_version, + parent, + parent, show_def_docs, use_absolute, is_on_foreign_type, @@ -1565,11 +1542,6 @@ fn render_impl( if toggled { write!(w, "") } - if trait_.is_some() { - if let Some(portability) = portability(&i.impl_item, Some(parent)) { - write!(w, "
{}
", portability); - } - } if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) { let mut ids = cx.id_map.borrow_mut(); @@ -1597,12 +1569,35 @@ fn render_impl( w.write_str(&close_tags); } -fn render_impl_summary( +// Render the items that appear on the right side of methods, impls, and +// associated types. For example "1.0.0 (const: 1.39.0) [src]". +fn render_rightside( + w: &mut Buffer, + cx: &Context<'_>, + item: &clean::Item, + containing_item: &clean::Item, +) { + let tcx = cx.tcx(); + + write!(w, "
"); + render_stability_since_raw( + w, + item.stable_since(tcx).as_deref(), + item.const_stable_since(tcx).as_deref(), + containing_item.stable_since(tcx).as_deref(), + containing_item.const_stable_since(tcx).as_deref(), + ); + + write_srclink(cx, item, w); + w.write_str("
"); +} + +pub(crate) fn render_impl_summary( w: &mut Buffer, cx: &Context<'_>, i: &Impl, - outer_version: Option<&str>, - outer_const_version: Option<&str>, + parent: &clean::Item, + containing_item: &clean::Item, show_def_docs: bool, use_absolute: Option, is_on_foreign_type: bool, @@ -1610,7 +1605,6 @@ fn render_impl_summary( // in documentation pages for trait with automatic implementations like "Send" and "Sync". aliases: &[String], ) { - let tcx = cx.tcx(); let id = cx.derive_id(match i.inner_impl().trait_ { Some(ref t) => { if is_on_foreign_type { @@ -1626,13 +1620,12 @@ fn render_impl_summary( } else { format!(" data-aliases=\"{}\"", aliases.join(",")) }; + write!(w, "
", id, aliases); + render_rightside(w, cx, &i.impl_item, containing_item); + write!(w, "", id); + write!(w, ""); + if let Some(use_absolute) = use_absolute { - write!( - w, - "
\ - ", - id, aliases - ); write!(w, "{}", i.inner_impl().print(use_absolute, cx)); if show_def_docs { for it in &i.inner_impl().items { @@ -1643,26 +1636,18 @@ fn render_impl_summary( } } } - w.write_str(""); } else { - write!( - w, - "
\ - {}", - id, - aliases, - i.inner_impl().print(false, cx) - ); + write!(w, "{}", i.inner_impl().print(false, cx)); } - write!(w, "", id); - render_stability_since_raw( - w, - i.impl_item.stable_since(tcx).as_deref(), - i.impl_item.const_stable_since(tcx).as_deref(), - outer_version, - outer_const_version, - ); - write_srclink(cx, &i.impl_item, w); + write!(w, ""); + + let is_trait = i.inner_impl().trait_.is_some(); + if is_trait { + if let Some(portability) = portability(&i.impl_item, Some(parent)) { + write!(w, "
{}
", portability); + } + } + w.write_str("
"); } diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 88ec172a18bca..8fd5353891221 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -15,7 +15,8 @@ use rustc_span::symbol::{kw, sym, Symbol}; use super::{ collect_paths_for_type, document, ensure_trailing_slash, item_ty_to_strs, notable_traits_decl, render_assoc_item, render_assoc_items, render_attributes_in_code, render_attributes_in_pre, - render_impl, render_stability_since_raw, write_srclink, AssocItemLink, Context, + render_impl, render_impl_summary, render_stability_since_raw, write_srclink, AssocItemLink, + Context, }; use crate::clean::{self, GetDefId}; use crate::formats::item_type::ItemType; @@ -585,11 +586,14 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra if toggled { write!(w, "
"); } - write!(w, "
", id); - render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx); - w.write_str(""); + write!(w, "
", id); + write!(w, "
"); render_stability_since(w, m, t, cx.tcx()); write_srclink(cx, m, w); + write!(w, "
"); + write!(w, ""); + render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx); + w.write_str(""); w.write_str("
"); if toggled { write!(w, "
"); @@ -701,8 +705,6 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra it, assoc_link, RenderMode::Normal, - implementor.impl_item.stable_since(cx.tcx()).as_deref(), - implementor.impl_item.const_stable_since(cx.tcx()).as_deref(), false, None, true, @@ -1310,7 +1312,7 @@ fn render_implementor( implementor_dups: &FxHashMap, aliases: &[String], ) { - // If there's already another implementor that has the same abbridged name, use the + // If there's already another implementor that has the same abridged name, use the // full path, for example in `std::iter::ExactSizeIterator` let use_absolute = match implementor.inner_impl().for_ { clean::ResolvedPath { ref path, is_generic: false, .. } @@ -1320,19 +1322,15 @@ fn render_implementor( } => implementor_dups[&path.last()].1, _ => false, }; - render_impl( + render_impl_summary( w, cx, implementor, trait_, - AssocItemLink::Anchor(None), - RenderMode::Normal, - trait_.stable_since(cx.tcx()).as_deref(), - trait_.const_stable_since(cx.tcx()).as_deref(), + trait_, false, Some(use_absolute), false, - false, aliases, ); } diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index e43a231d7570b..98128878999e4 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -778,7 +778,6 @@ function hideThemeButtonState() { } var hideMethodDocs = getSettingValue("auto-hide-method-docs") === "true"; - var hideImplementors = getSettingValue("auto-collapse-implementors") !== "false"; var hideImplementations = getSettingValue("auto-hide-trait-implementations") === "true"; var hideLargeItemContents = getSettingValue("auto-hide-large-items") !== "false"; @@ -796,10 +795,6 @@ function hideThemeButtonState() { setImplementorsTogglesOpen("blanket-implementations-list", false); } - if (!hideImplementors) { - setImplementorsTogglesOpen("implementors-list", true); - } - onEachLazy(document.getElementsByClassName("rustdoc-toggle"), function (e) { if (!hideLargeItemContents && hasClass(e, "type-contents-toggle")) { e.open = true; diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 7535145caa5c8..9a59ee528a0c9 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -581,7 +581,6 @@ nav.sub { .content .item-info { position: relative; margin-left: 33px; - margin-top: -13px; } .sub-variant > div > .item-info { @@ -852,12 +851,12 @@ body.blur > :not(#help) { } .stab { - display: table; border-width: 1px; border-style: solid; padding: 3px; margin-bottom: 5px; font-size: 90%; + font-weight: normal; } .stab p { display: inline; @@ -900,32 +899,25 @@ body.blur > :not(#help) { .since { font-weight: normal; font-size: initial; - position: absolute; - right: 0; - top: 0; } .impl-items .since, .impl .since, .methods .since { - flex-grow: 0; padding-left: 12px; padding-right: 2px; position: initial; } .impl-items .srclink, .impl .srclink, .methods .srclink { - flex-grow: 0; /* Override header settings otherwise it's too bold */ font-size: 17px; font-weight: normal; } -.impl-items code, .impl code, .methods code { - flex-grow: 1; +.rightside { + float: right; } .has-srclink { - display: flex; - flex-basis: 100%; font-size: 16px; margin-bottom: 12px; /* Push the src link out to the right edge consistently */ @@ -986,7 +978,6 @@ a.test-arrow:hover{ } .since + .srclink { - display: table-cell; padding-left: 10px; } @@ -1046,6 +1037,10 @@ a.test-arrow:hover{ opacity: 1; } +:target { + padding-right: 3px; +} + .information { position: absolute; left: -25px; @@ -1612,11 +1607,6 @@ details.undocumented[open] > summary::before { margin-left: 0; } - .content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant, - .impl-items > .associatedtype { - display: flex; - } - .anchor { display: none !important; } diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css index d220d8708a123..171d06c0a3667 100644 --- a/src/librustdoc/html/static/themes/ayu.css +++ b/src/librustdoc/html/static/themes/ayu.css @@ -334,8 +334,11 @@ a.test-arrow:hover { color: #999; } -:target > code, :target > .in-band { +:target, :target * { background: rgba(255, 236, 164, 0.06); +} + +:target { border-right: 3px solid rgba(255, 180, 76, 0.85); } diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css index 6385a763f2ef7..d9ea28058ad99 100644 --- a/src/librustdoc/html/static/themes/dark.css +++ b/src/librustdoc/html/static/themes/dark.css @@ -282,8 +282,11 @@ a.test-arrow:hover{ color: #999; } -:target > code, :target > .in-band { +:target, :target * { background-color: #494a3d; +} + +:target { border-right: 3px solid #bb7410; } diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css index c19d5bfc317f7..a2dfb89820b01 100644 --- a/src/librustdoc/html/static/themes/light.css +++ b/src/librustdoc/html/static/themes/light.css @@ -275,8 +275,11 @@ a.test-arrow:hover{ color: #999; } -:target > code, :target > .in-band { +:target, :target * { background: #FDFFD3; +} + +:target { border-right: 3px solid #ffb44c; } diff --git a/src/test/rustdoc-gui/hash-item-expansion.goml b/src/test/rustdoc-gui/hash-item-expansion.goml index 1248d11200e6c..d5f9d4fc58b8c 100644 --- a/src/test/rustdoc-gui/hash-item-expansion.goml +++ b/src/test/rustdoc-gui/hash-item-expansion.goml @@ -2,9 +2,6 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.borrow // In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)". assert: ("#blanket-implementations-list > details:nth-child(2)", "open", "") -// Please note the "\" below is needed because otherwise ".borrow" would be interpreted as -// a class selector. -assert: ("#method\.borrow", {"display": "flex"}) // We first check that the impl block is open by default. assert: ("#implementations + details", "open", "") // We collapse it. diff --git a/src/test/rustdoc/ensure-src-link.rs b/src/test/rustdoc/ensure-src-link.rs index 4b6270b26da27..6189acb72542a 100644 --- a/src/test/rustdoc/ensure-src-link.rs +++ b/src/test/rustdoc/ensure-src-link.rs @@ -2,5 +2,5 @@ // This test ensures that the [src] link is present on traits items. -// @has foo/trait.Iterator.html '//div[@id="method.zip"]/a[@class="srclink"]' "[src]" +// @has foo/trait.Iterator.html '//div[@id="method.zip"]//a[@class="srclink"]' "[src]" pub use std::iter::Iterator; diff --git a/src/test/rustdoc/issue-19055.rs b/src/test/rustdoc/issue-19055.rs deleted file mode 100644 index dbaf744dc4712..0000000000000 --- a/src/test/rustdoc/issue-19055.rs +++ /dev/null @@ -1,20 +0,0 @@ -// @has issue_19055/trait.Any.html -pub trait Any {} - -impl<'any> Any + 'any { - // @has - '//*[@id="method.is"]' 'fn is' - pub fn is(&self) -> bool { loop {} } - - // @has - '//*[@id="method.downcast_ref"]' 'fn downcast_ref' - pub fn downcast_ref(&self) -> Option<&T> { loop {} } - - // @has - '//*[@id="method.downcast_mut"]' 'fn downcast_mut' - pub fn downcast_mut(&mut self) -> Option<&mut T> { loop {} } -} - -pub trait Foo { - fn foo(&self) {} -} - -// @has - '//*[@id="method.foo"]' 'fn foo' -impl Foo for Any {} diff --git a/src/test/rustdoc/src-links-auto-impls.rs b/src/test/rustdoc/src-links-auto-impls.rs index 6f609e080d3dd..1952f723465d6 100644 --- a/src/test/rustdoc/src-links-auto-impls.rs +++ b/src/test/rustdoc/src-links-auto-impls.rs @@ -2,11 +2,11 @@ // @has foo/struct.Unsized.html // @has - '//div[@id="impl-Sized"]/code' 'impl !Sized for Unsized' -// @!has - '//div[@id="impl-Sized"]/a[@class="srclink"]' '[src]' +// @!has - '//div[@id="impl-Sized"]//a[@class="srclink"]' '[src]' // @has - '//div[@id="impl-Sync"]/code' 'impl Sync for Unsized' -// @!has - '//div[@id="impl-Sync"]/a[@class="srclink"]' '[src]' +// @!has - '//div[@id="impl-Sync"]//a[@class="srclink"]' '[src]' // @has - '//div[@id="impl-Any"]/code' 'impl Any for T' -// @has - '//div[@id="impl-Any"]/a[@class="srclink"]' '[src]' +// @has - '//div[@id="impl-Any"]//a[@class="srclink"]' '[src]' pub struct Unsized { data: [u8], } diff --git a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs index 5b7c04c0d4445..ddbe93febdc25 100644 --- a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs +++ b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs @@ -38,23 +38,15 @@ impl MyTrait for Vec { } impl MyTrait for MyStruct { - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="type"]/@href' #associatedtype.Assoc - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc type Assoc = bool; - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="constant"]/@href' #associatedconstant.VALUE - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="constant"]/@href' trait.MyTrait.html#associatedconstant.VALUE // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="anchor"]/@href' #associatedconstant.VALUE const VALUE: u32 = 20; - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.trait_function-2"]//a[@class="fnname"]/@href' #tymethod.trait_function - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.trait_function-2"]//a[@class="anchor"]/@href' #method.trait_function-2 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.trait_function"]//a[@class="fnname"]/@href' trait.MyTrait.html#tymethod.trait_function // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.trait_function"]//a[@class="anchor"]/@href' #method.trait_function fn trait_function(&self) {} - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.defaulted_override-3"]//a[@class="fnname"]/@href' #method.defaulted_override - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.defaulted_override-3"]//a[@class="anchor"]/@href' #method.defaulted_override-3 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.defaulted_override"]//a[@class="fnname"]/@href' trait.MyTrait.html#method.defaulted_override // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.defaulted_override"]//a[@class="anchor"]/@href' #method.defaulted_override fn defaulted_override(&self) {}