about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-06 17:45:15 -0700
committerGitHub <noreply@github.com>2020-07-06 17:45:15 -0700
commit218d96ed6b7d57bd5d8c38f649a22b8d4ac31c25 (patch)
tree6d2d88a0dba50110857a25a35ae95e57a5c73b08
parent0c03aee8b81185d65b5821518661c30ecdb42de5 (diff)
parente955bebcda257d290278b53c1677e7c54e65f134 (diff)
downloadrust-218d96ed6b7d57bd5d8c38f649a22b8d4ac31c25.tar.gz
rust-218d96ed6b7d57bd5d8c38f649a22b8d4ac31c25.zip
Rollup merge of #70563 - GuillaumeGomez:page-hash-handling, r=ollie27,kinnison
[rustdoc] Page hash handling

Fixes https://github.com/rust-lang/rust/issues/70476

A good example to see the change is to use this URL: https://doc.rust-lang.org/nightly/std/string/struct.String.html#from_iter.v-3

After the change, it actually goes to the target element (and change the page hash to something more clear for the users).

r? @kinnison

cc @ollie27
-rw-r--r--src/bootstrap/bin/rustdoc.rs15
-rw-r--r--src/bootstrap/doc.rs1
-rw-r--r--src/librustdoc/config.rs4
-rw-r--r--src/librustdoc/html/item_type.rs37
-rw-r--r--src/librustdoc/html/render.rs59
-rw-r--r--src/librustdoc/html/static/main.js21
-rw-r--r--src/librustdoc/lib.rs7
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs2
-rw-r--r--src/libstd/sys/unix/ext/fs.rs2
-rw-r--r--src/libstd/sys/vxworks/ext/fs.rs2
-rw-r--r--src/test/rustdoc/assoc-types.rs2
-rw-r--r--src/test/rustdoc/const.rs2
-rw-r--r--src/test/rustdoc/inline_cross/impl_trait.rs4
-rw-r--r--src/test/rustdoc/intra-link-self.rs2
-rw-r--r--src/test/rustdoc/intra-links.rs4
-rw-r--r--src/test/rustdoc/issue-19190.rs7
-rw-r--r--src/test/rustdoc/issue-25001.rs3
-rw-r--r--src/test/rustdoc/issue-35169-2.rs14
-rw-r--r--src/test/rustdoc/issue-35169.rs14
-rw-r--r--src/test/rustdoc/struct-field.rs2
-rw-r--r--src/test/rustdoc/structfields.rs8
21 files changed, 48 insertions, 164 deletions
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
index ba644e61118..8c56cf1cb34 100644
--- a/src/bootstrap/bin/rustdoc.rs
+++ b/src/bootstrap/bin/rustdoc.rs
@@ -13,7 +13,6 @@ fn main() {
     let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
     let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
     let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
-    let mut has_unstable = false;
 
     use std::str::FromStr;
 
@@ -56,21 +55,9 @@ fn main() {
     }
 
     // Needed to be able to run all rustdoc tests.
-    if env::var_os("RUSTDOC_GENERATE_REDIRECT_PAGES").is_some() {
-        // This "unstable-options" can be removed when `--generate-redirect-pages` is stabilized
-        if !has_unstable {
-            cmd.arg("-Z").arg("unstable-options");
-        }
-        cmd.arg("--generate-redirect-pages");
-        has_unstable = true;
-    }
-
-    // Needed to be able to run all rustdoc tests.
     if let Some(ref x) = env::var_os("RUSTDOC_RESOURCE_SUFFIX") {
         // This "unstable-options" can be removed when `--resource-suffix` is stabilized
-        if !has_unstable {
-            cmd.arg("-Z").arg("unstable-options");
-        }
+        cmd.arg("-Z").arg("unstable-options");
         cmd.arg("--resource-suffix").arg(x);
     }
 
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index d02c19467ee..ed351354c44 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -451,7 +451,6 @@ impl Step for Std {
                 .arg("--markdown-css")
                 .arg("rust.css")
                 .arg("--markdown-no-toc")
-                .arg("--generate-redirect-pages")
                 .arg("-Z")
                 .arg("unstable-options")
                 .arg("--resource-suffix")
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 35b15cf717c..14a6f3c89a3 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -242,8 +242,6 @@ pub struct RenderOptions {
     /// If false, the `select` element to have search filtering by crates on rendered docs
     /// won't be generated.
     pub generate_search_filter: bool,
-    /// Option (disabled by default) to generate files used by RLS and some other tools.
-    pub generate_redirect_pages: bool,
     /// Document items that have lower than `pub` visibility.
     pub document_private: bool,
     /// Document items that have `doc(hidden)`.
@@ -528,7 +526,6 @@ impl Options {
         let static_root_path = matches.opt_str("static-root-path");
         let generate_search_filter = !matches.opt_present("disable-per-crate-search");
         let persist_doctests = matches.opt_str("persist-doctests").map(PathBuf::from);
-        let generate_redirect_pages = matches.opt_present("generate-redirect-pages");
         let test_builder = matches.opt_str("test-builder").map(PathBuf::from);
         let codegen_options_strs = matches.opt_strs("C");
         let debugging_options_strs = matches.opt_strs("Z");
@@ -592,7 +589,6 @@ impl Options {
                 markdown_css,
                 markdown_playground_url,
                 generate_search_filter,
-                generate_redirect_pages,
                 document_private,
                 document_hidden,
             },
diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs
index 0b2b0cdc18b..cc78b4682d2 100644
--- a/src/librustdoc/html/item_type.rs
+++ b/src/librustdoc/html/item_type.rs
@@ -154,38 +154,6 @@ impl ItemType {
             ItemType::TraitAlias => "traitalias",
         }
     }
-
-    pub fn name_space(&self) -> &'static str {
-        match *self {
-            ItemType::Struct
-            | ItemType::Union
-            | ItemType::Enum
-            | ItemType::Module
-            | ItemType::Typedef
-            | ItemType::Trait
-            | ItemType::Primitive
-            | ItemType::AssocType
-            | ItemType::OpaqueTy
-            | ItemType::TraitAlias
-            | ItemType::ForeignType => NAMESPACE_TYPE,
-
-            ItemType::ExternCrate
-            | ItemType::Import
-            | ItemType::Function
-            | ItemType::Static
-            | ItemType::Impl
-            | ItemType::TyMethod
-            | ItemType::Method
-            | ItemType::StructField
-            | ItemType::Variant
-            | ItemType::Constant
-            | ItemType::AssocConst => NAMESPACE_VALUE,
-
-            ItemType::Macro | ItemType::ProcAttribute | ItemType::ProcDerive => NAMESPACE_MACRO,
-
-            ItemType::Keyword => NAMESPACE_KEYWORD,
-        }
-    }
 }
 
 impl fmt::Display for ItemType {
@@ -193,8 +161,3 @@ impl fmt::Display for ItemType {
         write!(f, "{}", self.as_str())
     }
 }
-
-pub const NAMESPACE_TYPE: &str = "t";
-pub const NAMESPACE_VALUE: &str = "v";
-pub const NAMESPACE_MACRO: &str = "m";
-pub const NAMESPACE_KEYWORD: &str = "k";
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 04c4685213b..69e3540ed62 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -195,8 +195,6 @@ crate struct SharedContext {
     /// Optional path string to be used to load static files on output pages. If not set, uses
     /// combinations of `../` to reach the documentation root.
     pub static_root_path: Option<String>,
-    /// Option disabled by default to generate files used by RLS and some other tools.
-    pub generate_redirect_pages: bool,
     /// The fs handle we are working with.
     pub fs: DocFS,
     /// The default edition used to parse doctests.
@@ -468,7 +466,6 @@ pub fn run(
         resource_suffix,
         static_root_path,
         generate_search_filter,
-        generate_redirect_pages,
         document_private,
         ..
     } = options;
@@ -536,7 +533,6 @@ pub fn run(
         themes,
         resource_suffix,
         static_root_path,
-        generate_redirect_pages,
         fs: DocFS::new(&errors),
         edition,
         codes: ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build()),
@@ -1556,14 +1552,6 @@ impl Context {
                 if !self.render_redirect_pages {
                     all.append(full_path(self, &item), &item_type);
                 }
-                if self.shared.generate_redirect_pages {
-                    // Redirect from a sane URL using the namespace to Rustdoc's
-                    // URL for the page.
-                    let redir_name = format!("{}.{}.html", name, item_type.name_space());
-                    let redir_dst = self.dst.join(redir_name);
-                    let v = layout::redirect(file_name);
-                    self.shared.fs.write(&redir_dst, v.as_bytes())?;
-                }
                 // If the item is a macro, redirect from the old macro URL (with !)
                 // to the new one (without).
                 if item_type == ItemType::Macro {
@@ -2586,8 +2574,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
         let name = m.name.as_ref().unwrap();
         let item_type = m.type_();
         let id = cx.derive_id(format!("{}.{}", item_type, name));
-        let ns_id = cx.derive_id(format!("{}.{}", name, item_type.name_space()));
-        write!(w, "<h3 id='{id}' class='method'><code id='{ns_id}'>", id = id, ns_id = ns_id);
+        write!(w, "<h3 id='{id}' class='method'><code>", id = id);
         render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl);
         write!(w, "</code>");
         render_stability_since(w, m, t);
@@ -2972,20 +2959,14 @@ fn item_struct(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Struct
                     ItemType::StructField,
                     field.name.as_ref().unwrap()
                 ));
-                let ns_id = cx.derive_id(format!(
-                    "{}.{}",
-                    field.name.as_ref().unwrap(),
-                    ItemType::StructField.name_space()
-                ));
                 write!(
                     w,
                     "<span id=\"{id}\" class=\"{item_type} small-section-header\">\
                            <a href=\"#{id}\" class=\"anchor field\"></a>\
-                           <code id=\"{ns_id}\">{name}: {ty}</code>\
+                           <code>{name}: {ty}</code>\
                            </span>",
                     item_type = ItemType::StructField,
                     id = id,
-                    ns_id = ns_id,
                     name = field.name.as_ref().unwrap(),
                     ty = ty.print()
                 );
@@ -3103,18 +3084,12 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum) {
         for variant in &e.variants {
             let id =
                 cx.derive_id(format!("{}.{}", ItemType::Variant, variant.name.as_ref().unwrap()));
-            let ns_id = cx.derive_id(format!(
-                "{}.{}",
-                variant.name.as_ref().unwrap(),
-                ItemType::Variant.name_space()
-            ));
             write!(
                 w,
                 "<div id=\"{id}\" class=\"variant small-section-header\">\
-                       <a href=\"#{id}\" class=\"anchor field\"></a>\
-                       <code id='{ns_id}'>{name}",
+                    <a href=\"#{id}\" class=\"anchor field\"></a>\
+                    <code>{name}",
                 id = id,
-                ns_id = ns_id,
                 name = variant.name.as_ref().unwrap()
             );
             if let clean::VariantItem(ref var) = variant.inner {
@@ -3155,21 +3130,13 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum) {
                             variant.name.as_ref().unwrap(),
                             field.name.as_ref().unwrap()
                         ));
-                        let ns_id = cx.derive_id(format!(
-                            "{}.{}.{}.{}",
-                            variant.name.as_ref().unwrap(),
-                            ItemType::Variant.name_space(),
-                            field.name.as_ref().unwrap(),
-                            ItemType::StructField.name_space()
-                        ));
                         write!(
                             w,
                             "<span id=\"{id}\" class=\"variant small-section-header\">\
                                    <a href=\"#{id}\" class=\"anchor field\"></a>\
-                                   <code id='{ns_id}'>{f}:&nbsp;{t}\
+                                   <code>{f}:&nbsp;{t}\
                                    </code></span>",
                             id = id,
-                            ns_id = ns_id,
                             f = field.name.as_ref().unwrap(),
                             t = ty.print()
                         );
@@ -3661,9 +3628,7 @@ fn render_impl(
                 // Only render when the method is not static or we allow static methods
                 if render_method_item {
                     let id = cx.derive_id(format!("{}.{}", item_type, name));
-                    let ns_id = cx.derive_id(format!("{}.{}", name, item_type.name_space()));
-                    write!(w, "<h4 id='{}' class=\"{}{}\">", id, item_type, extra_class);
-                    write!(w, "<code id='{}'>", ns_id);
+                    write!(w, "<h4 id='{}' class=\"{}{}\"><code>", id, item_type, extra_class);
                     render_assoc_item(w, item, link.anchor(&id), ItemType::Impl);
                     write!(w, "</code>");
                     render_stability_since_raw(w, item.stable_since(), outer_version);
@@ -3679,17 +3644,13 @@ fn render_impl(
             }
             clean::TypedefItem(ref tydef, _) => {
                 let id = cx.derive_id(format!("{}.{}", ItemType::AssocType, name));
-                let ns_id = cx.derive_id(format!("{}.{}", name, item_type.name_space()));
-                write!(w, "<h4 id='{}' class=\"{}{}\">", id, item_type, extra_class);
-                write!(w, "<code id='{}'>", ns_id);
+                write!(w, "<h4 id='{}' class=\"{}{}\"><code>", id, item_type, extra_class);
                 assoc_type(w, item, &Vec::new(), Some(&tydef.type_), link.anchor(&id), "");
                 write!(w, "</code></h4>");
             }
             clean::AssocConstItem(ref ty, ref default) => {
                 let id = cx.derive_id(format!("{}.{}", item_type, name));
-                let ns_id = cx.derive_id(format!("{}.{}", name, item_type.name_space()));
-                write!(w, "<h4 id='{}' class=\"{}{}\">", id, item_type, extra_class);
-                write!(w, "<code id='{}'>", ns_id);
+                write!(w, "<h4 id='{}' class=\"{}{}\"><code>", id, item_type, extra_class);
                 assoc_const(w, item, ty, default.as_ref(), link.anchor(&id), "");
                 write!(w, "</code>");
                 render_stability_since_raw(w, item.stable_since(), outer_version);
@@ -3704,9 +3665,7 @@ fn render_impl(
             }
             clean::AssocTypeItem(ref bounds, ref default) => {
                 let id = cx.derive_id(format!("{}.{}", item_type, name));
-                let ns_id = cx.derive_id(format!("{}.{}", name, item_type.name_space()));
-                write!(w, "<h4 id='{}' class=\"{}{}\">", id, item_type, extra_class);
-                write!(w, "<code id='{}'>", ns_id);
+                write!(w, "<h4 id='{}' class=\"{}{}\"><code>", id, item_type, extra_class);
                 assoc_type(w, item, bounds, default.as_ref(), link.anchor(&id), "");
                 write!(w, "</code></h4>");
             }
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 62a23298c1b..69e2bacc218 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -112,9 +112,11 @@ function defocusSearchBar() {
     }
 
     function getPageId() {
-        var id = document.location.href.split("#")[1];
-        if (id) {
-            return id.split("?")[0].split("&")[0];
+        if (window.location.hash) {
+            var tmp = window.location.hash.replace(/^#/, "");
+            if (tmp.length > 0) {
+                return tmp;
+            }
         }
         return null;
     }
@@ -2551,6 +2553,13 @@ function defocusSearchBar() {
 
         onEachLazy(document.getElementsByClassName("docblock"), buildToggleWrapper);
         onEachLazy(document.getElementsByClassName("sub-variant"), buildToggleWrapper);
+        var pageId = getPageId();
+
+        autoCollapse(pageId, getCurrentValue("rustdoc-collapse") === "true");
+
+        if (pageId !== null) {
+            expandSection(pageId);
+        }
     }());
 
     function createToggleWrapper(tog) {
@@ -2686,12 +2695,6 @@ function defocusSearchBar() {
         hideSidebar();
     };
 
-    autoCollapse(getPageId(), getCurrentValue("rustdoc-collapse") === "true");
-
-    if (window.location.hash && window.location.hash.length > 0) {
-        expandSection(window.location.hash.replace(/^#/, ""));
-    }
-
     if (main) {
         onEachLazy(main.getElementsByClassName("loading-content"), function(e) {
             e.remove();
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index de6fa3dbd4a..8e2dd77cc11 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -374,13 +374,6 @@ fn opts() -> Vec<RustcOptGroup> {
                 "PATH",
             )
         }),
-        unstable("generate-redirect-pages", |o| {
-            o.optflag(
-                "",
-                "generate-redirect-pages",
-                "Generate extra pages to support legacy URLs and tool links",
-            )
-        }),
         unstable("show-coverage", |o| {
             o.optflag(
                 "",
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 8da74f375d9..0e6a6c8a5e6 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -1069,7 +1069,7 @@ fn handle_variant(
     };
     let parent_def = Res::Def(DefKind::Enum, parent);
     let variant = cx.tcx.expect_variant_res(res);
-    Ok((parent_def, Some(format!("{}.v", variant.ident.name))))
+    Ok((parent_def, Some(format!("variant.{}", variant.ident.name))))
 }
 
 const PRIMITIVES: &[(&str, Res)] = &[
diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs
index e4d71493604..2b2bbc6e9d6 100644
--- a/src/libstd/sys/unix/ext/fs.rs
+++ b/src/libstd/sys/unix/ext/fs.rs
@@ -133,7 +133,7 @@ pub trait FileExt {
     /// Note that similar to [`File::write`], it is not an error to return a
     /// short write.
     ///
-    /// [`File::write`]: ../../../../std/fs/struct.File.html#write.v
+    /// [`File::write`]: ../../../../std/fs/struct.File.html#method.write
     ///
     /// # Examples
     ///
diff --git a/src/libstd/sys/vxworks/ext/fs.rs b/src/libstd/sys/vxworks/ext/fs.rs
index 7cc64658ee1..b479fbaf346 100644
--- a/src/libstd/sys/vxworks/ext/fs.rs
+++ b/src/libstd/sys/vxworks/ext/fs.rs
@@ -132,7 +132,7 @@ pub trait FileExt {
     /// Note that similar to [`File::write`], it is not an error to return a
     /// short write.
     ///
-    /// [`File::write`]: ../../../../std/fs/struct.File.html#write.v
+    /// [`File::write`]: ../../../../std/fs/struct.File.html#method.write
     ///
     /// # Examples
     ///
diff --git a/src/test/rustdoc/assoc-types.rs b/src/test/rustdoc/assoc-types.rs
index b708dc0c717..5f0fdbb322c 100644
--- a/src/test/rustdoc/assoc-types.rs
+++ b/src/test/rustdoc/assoc-types.rs
@@ -5,9 +5,7 @@
 // @has assoc_types/trait.Index.html
 pub trait Index<I: ?Sized> {
     // @has - '//*[@id="associatedtype.Output"]//code' 'type Output: ?Sized'
-    // @has - '//code[@id="Output.t"]' 'type Output: ?Sized'
     type Output: ?Sized;
-    // @has - '//code[@id="index.v"]' 'fn index'
     // @has - '//*[@id="tymethod.index"]//code' \
     //      "fn index<'a>(&'a self, index: I) -> &'a Self::Output"
     // @has - '//*[@id="tymethod.index"]//code//a[@href="../assoc_types/trait.Index.html#associatedtype.Output"]' \
diff --git a/src/test/rustdoc/const.rs b/src/test/rustdoc/const.rs
index c33db5809cc..638de3292be 100644
--- a/src/test/rustdoc/const.rs
+++ b/src/test/rustdoc/const.rs
@@ -3,7 +3,7 @@
 pub struct Foo;
 
 impl Foo {
-    // @has const/struct.Foo.html '//code[@id="new.v"]' 'const unsafe fn new'
+    // @has const/struct.Foo.html '//*[@id="method.new"]//code' 'const unsafe fn new'
     pub const unsafe fn new() -> Foo {
         Foo
     }
diff --git a/src/test/rustdoc/inline_cross/impl_trait.rs b/src/test/rustdoc/inline_cross/impl_trait.rs
index 6f4a48c83c0..e3a166b3d0e 100644
--- a/src/test/rustdoc/inline_cross/impl_trait.rs
+++ b/src/test/rustdoc/inline_cross/impl_trait.rs
@@ -31,8 +31,8 @@ pub use impl_trait_aux::func4;
 pub use impl_trait_aux::async_fn;
 
 // @has impl_trait/struct.Foo.html
-// @has - '//code[@id="method.v"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8>> + 'a)"
-// @!has - '//code[@id="method.v"]' 'where'
+// @has - '//*[@id="method.method"]//code' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8>> + 'a)"
+// @!has - '//*[@id="method.method"]//code' 'where'
 pub use impl_trait_aux::Foo;
 
 // @has impl_trait/struct.Bar.html
diff --git a/src/test/rustdoc/intra-link-self.rs b/src/test/rustdoc/intra-link-self.rs
index 97752d5cfcb..81545fec741 100644
--- a/src/test/rustdoc/intra-link-self.rs
+++ b/src/test/rustdoc/intra-link-self.rs
@@ -40,7 +40,7 @@ pub struct MyStruct {
 }
 
 pub enum MyEnum {
-    // @has foo/enum.MyEnum.html '//a/@href' '../foo/enum.MyEnum.html#EnumVariant.v'
+    // @has foo/enum.MyEnum.html '//a/@href' '../foo/enum.MyEnum.html#variant.EnumVariant'
 
     /// [`EnumVariant`]
     ///
diff --git a/src/test/rustdoc/intra-links.rs b/src/test/rustdoc/intra-links.rs
index c356ab3a8ac..c6725f526aa 100644
--- a/src/test/rustdoc/intra-links.rs
+++ b/src/test/rustdoc/intra-links.rs
@@ -2,7 +2,7 @@
 // @has - '//a/@href' '../intra_links/struct.ThisType.html'
 // @has - '//a/@href' '../intra_links/struct.ThisType.html#method.this_method'
 // @has - '//a/@href' '../intra_links/enum.ThisEnum.html'
-// @has - '//a/@href' '../intra_links/enum.ThisEnum.html#ThisVariant.v'
+// @has - '//a/@href' '../intra_links/enum.ThisEnum.html#variant.ThisVariant'
 // @has - '//a/@href' '../intra_links/trait.ThisTrait.html'
 // @has - '//a/@href' '../intra_links/trait.ThisTrait.html#tymethod.this_associated_method'
 // @has - '//a/@href' '../intra_links/trait.ThisTrait.html#associatedtype.ThisAssociatedType'
@@ -73,7 +73,7 @@ pub fn SoAmbiguous() {}
 // @has - '//a/@href' '../intra_links/struct.ThisType.html'
 // @has - '//a/@href' '../intra_links/struct.ThisType.html#method.this_method'
 // @has - '//a/@href' '../intra_links/enum.ThisEnum.html'
-// @has - '//a/@href' '../intra_links/enum.ThisEnum.html#ThisVariant.v'
+// @has - '//a/@href' '../intra_links/enum.ThisEnum.html#variant.ThisVariant'
 /// Shortcut links for:
 /// * [`ThisType`]
 /// * [`ThisType::this_method`]
diff --git a/src/test/rustdoc/issue-19190.rs b/src/test/rustdoc/issue-19190.rs
index c6bac51c574..9dac49c6413 100644
--- a/src/test/rustdoc/issue-19190.rs
+++ b/src/test/rustdoc/issue-19190.rs
@@ -1,5 +1,3 @@
-// compile-flags:-Z unstable-options --generate-redirect-pages
-
 use std::ops::Deref;
 
 pub struct Foo;
@@ -15,9 +13,8 @@ impl Deref for Bar {
     fn deref(&self) -> &Foo { loop {} }
 }
 
-// @has issue_19190/Bar.t.html
 // @has issue_19190/struct.Bar.html
-// @has - '//*[@id="foo.v"]' 'fn foo(&self)'
+// @has - '//*[@id="method.foo"]//code' 'fn foo(&self)'
 // @has - '//*[@id="method.foo"]' 'fn foo(&self)'
-// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
+// @!has - '//*[@id="method.static_foo"]//code' 'fn static_foo()'
 // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
diff --git a/src/test/rustdoc/issue-25001.rs b/src/test/rustdoc/issue-25001.rs
index 55d8ee39438..e53cf645135 100644
--- a/src/test/rustdoc/issue-25001.rs
+++ b/src/test/rustdoc/issue-25001.rs
@@ -9,17 +9,14 @@ pub trait Bar {
 
 impl Foo<u8> {
     // @has - '//*[@id="method.pass"]//code' 'fn pass()'
-    // @has - '//code[@id="pass.v"]' 'fn pass()'
     pub fn pass() {}
 }
 impl Foo<u16> {
     // @has - '//*[@id="method.pass-1"]//code' 'fn pass() -> usize'
-    // @has - '//code[@id="pass.v-1"]' 'fn pass() -> usize'
     pub fn pass() -> usize { 42 }
 }
 impl Foo<u32> {
     // @has - '//*[@id="method.pass-2"]//code' 'fn pass() -> isize'
-    // @has - '//code[@id="pass.v-2"]' 'fn pass() -> isize'
     pub fn pass() -> isize { 42 }
 }
 
diff --git a/src/test/rustdoc/issue-35169-2.rs b/src/test/rustdoc/issue-35169-2.rs
index 33f7646ced6..a688ae48d00 100644
--- a/src/test/rustdoc/issue-35169-2.rs
+++ b/src/test/rustdoc/issue-35169-2.rs
@@ -24,17 +24,17 @@ impl DerefMut for Bar {
 }
 
 // @has issue_35169_2/struct.Bar.html
-// @has - '//*[@id="by_ref.v"]' 'fn by_ref(&self)'
+// @has - '//*[@id="method.by_ref"]//code' 'fn by_ref(&self)'
 // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
-// @has - '//*[@id="by_explicit_ref.v"]' 'fn by_explicit_ref(self: &Foo)'
+// @has - '//*[@id="method.by_explicit_ref"]//code' 'fn by_explicit_ref(self: &Foo)'
 // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)'
-// @has - '//*[@id="by_mut_ref.v"]' 'fn by_mut_ref(&mut self)'
+// @has - '//*[@id="method.by_mut_ref"]//code' 'fn by_mut_ref(&mut self)'
 // @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
-// @has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
+// @has - '//*[@id="method.by_explicit_mut_ref"]//code' 'fn by_explicit_mut_ref(self: &mut Foo)'
 // @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
-// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)'
+// @!has - '//*[@id="method.by_explicit_box"]//code' 'fn by_explicit_box(self: Box<Foo>)'
 // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
-// @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box<Self>)'
+// @!has - '//*[@id="method.by_explicit_self_box"]//code' 'fn by_explicit_self_box(self: Box<Self>)'
 // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
-// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
+// @!has - '//*[@id="method.static_foo"]//code' 'fn static_foo()'
 // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
diff --git a/src/test/rustdoc/issue-35169.rs b/src/test/rustdoc/issue-35169.rs
index 04fffc40572..4f10c04a616 100644
--- a/src/test/rustdoc/issue-35169.rs
+++ b/src/test/rustdoc/issue-35169.rs
@@ -19,17 +19,17 @@ impl Deref for Bar {
 }
 
 // @has issue_35169/struct.Bar.html
-// @has - '//*[@id="by_ref.v"]' 'fn by_ref(&self)'
+// @has - '//*[@id="method.by_ref"]//code' 'fn by_ref(&self)'
 // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
-// @has - '//*[@id="by_explicit_ref.v"]' 'fn by_explicit_ref(self: &Foo)'
+// @has - '//*[@id="method.by_explicit_ref"]//code' 'fn by_explicit_ref(self: &Foo)'
 // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)'
-// @!has - '//*[@id="by_mut_ref.v"]' 'fn by_mut_ref(&mut self)'
+// @!has - '//*[@id="method.by_mut_ref"]//code' 'fn by_mut_ref(&mut self)'
 // @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
-// @!has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
+// @!has - '//*[@id="method.by_explicit_mut_ref"]//code' 'fn by_explicit_mut_ref(self: &mut Foo)'
 // @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
-// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)'
+// @!has - '//*[@id="method.by_explicit_box"]//code' 'fn by_explicit_box(self: Box<Foo>)'
 // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
-// @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box<Self>)'
+// @!has - '//*[@id="method.by_explicit_self_box"]//code' 'fn by_explicit_self_box(self: Box<Self>)'
 // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
-// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
+// @!has - '//*[@id="method.static_foo"]//code' 'fn static_foo()'
 // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
diff --git a/src/test/rustdoc/struct-field.rs b/src/test/rustdoc/struct-field.rs
index c99169fbca5..532e29bc691 100644
--- a/src/test/rustdoc/struct-field.rs
+++ b/src/test/rustdoc/struct-field.rs
@@ -4,7 +4,7 @@
 
 // @has foo/index.html '//*[@class="docblock"]/p/a[@href="../foo/struct.Foo.html#structfield.bar"]' 'Foo::bar'
 // @has foo/index.html '//*[@class="docblock"]/p/a[@href="../foo/union.Bar.html#structfield.foo"]' 'Bar::foo'
-// @has foo/index.html '//*[@class="docblock"]/p/a[@href="../foo/enum.Uniooon.html#X.v"]' 'Uniooon::X'
+// @has foo/index.html '//*[@class="docblock"]/p/a[@href="../foo/enum.Uniooon.html#variant.X"]' 'Uniooon::X'
 
 //! Test with [Foo::bar], [Bar::foo], [Uniooon::X]
 
diff --git a/src/test/rustdoc/structfields.rs b/src/test/rustdoc/structfields.rs
index 235f0e852da..6de198453cd 100644
--- a/src/test/rustdoc/structfields.rs
+++ b/src/test/rustdoc/structfields.rs
@@ -1,7 +1,3 @@
-// compile-flags:-Z unstable-options --generate-redirect-pages
-
-// @has structfields/Foo.t.html
-// @has - struct.Foo.html
 // @has structfields/struct.Foo.html
 pub struct Foo {
     // @has - //pre "pub a: ()"
@@ -16,8 +12,6 @@ pub struct Foo {
     pub d: usize,
 }
 
-// @has structfields/Bar.t.html
-// @has - struct.Bar.html
 // @has structfields/struct.Bar.html
 pub struct Bar {
     // @has - //pre "pub a: ()"
@@ -25,8 +19,6 @@ pub struct Bar {
     // @!has - //pre "// some fields omitted"
 }
 
-// @has structfields/Qux.t.html
-// @has - enum.Qux.html
 // @has structfields/enum.Qux.html
 pub enum Qux {
     Quz {