summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc')
-rw-r--r--tests/rustdoc/alias-reexport.rs1
-rw-r--r--tests/rustdoc/alias-reexport2.rs1
-rw-r--r--tests/rustdoc/anchors.no_const_anchor.html2
-rw-r--r--tests/rustdoc/anchors.no_const_anchor2.html2
-rw-r--r--tests/rustdoc/anchors.no_method_anchor.html2
-rw-r--r--tests/rustdoc/anchors.no_trait_method_anchor.html2
-rw-r--r--tests/rustdoc/anchors.no_tymethod_anchor.html2
-rw-r--r--tests/rustdoc/anchors.no_type_anchor.html2
-rw-r--r--tests/rustdoc/auxiliary/issue-113982-doc_auto_cfg-reexport-foreign.rs3
-rw-r--r--tests/rustdoc/auxiliary/jump-to-def-res-err-handling-aux.rs1
-rw-r--r--tests/rustdoc/check-source-code-urls-to-def.rs19
-rw-r--r--tests/rustdoc/default-trait-method.rs43
-rw-r--r--tests/rustdoc/description.rs1
-rw-r--r--tests/rustdoc/display-hidden-items.rs71
-rw-r--r--tests/rustdoc/ensure-src-link.rs2
-rw-r--r--tests/rustdoc/extern-impl-trait.rs2
-rw-r--r--tests/rustdoc/generic-const-items.rs38
-rw-r--r--tests/rustdoc/impl-everywhere.rs2
-rw-r--r--tests/rustdoc/inherent-projections.rs10
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs22
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/impl-sized.rs21
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs35
-rw-r--r--tests/rustdoc/inline_cross/generic-const-items.rs26
-rw-r--r--tests/rustdoc/inline_cross/impl-sized.rs27
-rw-r--r--tests/rustdoc/inline_cross/ret-pos-impl-trait-in-trait.rs35
-rw-r--r--tests/rustdoc/intra-doc/basic.rs2
-rw-r--r--tests/rustdoc/intra-doc/generic-params.rs1
-rw-r--r--tests/rustdoc/intra-doc/issue-108459.rs1
-rw-r--r--tests/rustdoc/intra-doc/nested-use.rs16
-rw-r--r--tests/rustdoc/issue-105735-overlapping-reexport-2.rs25
-rw-r--r--tests/rustdoc/issue-105735-overlapping-reexport.rs21
-rw-r--r--tests/rustdoc/issue-113982-doc_auto_cfg-reexport-foreign.rs19
-rw-r--r--tests/rustdoc/issue-18199.rs1
-rw-r--r--tests/rustdoc/issue-33178.rs9
-rw-r--r--tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs13
-rw-r--r--tests/rustdoc/issue-81141-private-reexport-in-public-api-generics.rs13
-rw-r--r--tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs16
-rw-r--r--tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs32
-rw-r--r--tests/rustdoc/issue-81141-private-reexport-in-public-api.rs124
-rw-r--r--tests/rustdoc/jump-to-def-doc-links.rs51
-rw-r--r--tests/rustdoc/private-use.rs13
-rw-r--r--tests/rustdoc/source-file.rs2
-rw-r--r--tests/rustdoc/src-links-auto-impls.rs6
-rw-r--r--tests/rustdoc/static-root-path.rs8
44 files changed, 698 insertions, 47 deletions
diff --git a/tests/rustdoc/alias-reexport.rs b/tests/rustdoc/alias-reexport.rs
index a2a8e651c..4003ecec2 100644
--- a/tests/rustdoc/alias-reexport.rs
+++ b/tests/rustdoc/alias-reexport.rs
@@ -3,6 +3,7 @@
#![crate_name = "foo"]
#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
extern crate alias_reexport2;
diff --git a/tests/rustdoc/alias-reexport2.rs b/tests/rustdoc/alias-reexport2.rs
index 85d3cdad9..5f6357ad1 100644
--- a/tests/rustdoc/alias-reexport2.rs
+++ b/tests/rustdoc/alias-reexport2.rs
@@ -3,6 +3,7 @@
#![crate_name = "foo"]
#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
extern crate alias_reexport;
diff --git a/tests/rustdoc/anchors.no_const_anchor.html b/tests/rustdoc/anchors.no_const_anchor.html
index a8587829d..06673d874 100644
--- a/tests/rustdoc/anchors.no_const_anchor.html
+++ b/tests/rustdoc/anchors.no_const_anchor.html
@@ -1 +1 @@
-<section id="associatedconstant.YOLO" class="method"><a class="srclink rightside" href="../src/foo/anchors.rs.html#16">source</a><h4 class="code-header">const <a href="#associatedconstant.YOLO" class="constant">YOLO</a>: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></section> \ No newline at end of file
+<section id="associatedconstant.YOLO" class="method"><a class="src rightside" href="../src/foo/anchors.rs.html#16">source</a><h4 class="code-header">const <a href="#associatedconstant.YOLO" class="constant">YOLO</a>: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></section> \ No newline at end of file
diff --git a/tests/rustdoc/anchors.no_const_anchor2.html b/tests/rustdoc/anchors.no_const_anchor2.html
index 4c5e45fea..73c3d0a80 100644
--- a/tests/rustdoc/anchors.no_const_anchor2.html
+++ b/tests/rustdoc/anchors.no_const_anchor2.html
@@ -1 +1 @@
-<section id="associatedconstant.X" class="associatedconstant"><a class="srclink rightside" href="../src/foo/anchors.rs.html#42">source</a><h4 class="code-header">pub const <a href="#associatedconstant.X" class="constant">X</a>: <a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a> = 0i32</h4></section> \ No newline at end of file
+<section id="associatedconstant.X" class="associatedconstant"><a class="src rightside" href="../src/foo/anchors.rs.html#42">source</a><h4 class="code-header">pub const <a href="#associatedconstant.X" class="constant">X</a>: <a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a> = 0i32</h4></section> \ No newline at end of file
diff --git a/tests/rustdoc/anchors.no_method_anchor.html b/tests/rustdoc/anchors.no_method_anchor.html
index 44957a5b7..e8b61caa1 100644
--- a/tests/rustdoc/anchors.no_method_anchor.html
+++ b/tests/rustdoc/anchors.no_method_anchor.html
@@ -1 +1 @@
-<section id="method.new" class="method"><a class="srclink rightside" href="../src/foo/anchors.rs.html#48">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -&gt; Self</h4></section> \ No newline at end of file
+<section id="method.new" class="method"><a class="src rightside" href="../src/foo/anchors.rs.html#48">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -&gt; Self</h4></section> \ No newline at end of file
diff --git a/tests/rustdoc/anchors.no_trait_method_anchor.html b/tests/rustdoc/anchors.no_trait_method_anchor.html
index 75c2caf87..abdb17c27 100644
--- a/tests/rustdoc/anchors.no_trait_method_anchor.html
+++ b/tests/rustdoc/anchors.no_trait_method_anchor.html
@@ -1 +1 @@
-<section id="method.bar" class="method"><a class="srclink rightside" href="../src/foo/anchors.rs.html#23">source</a><h4 class="code-header">fn <a href="#method.bar" class="fn">bar</a>()</h4></section> \ No newline at end of file
+<section id="method.bar" class="method"><a class="src rightside" href="../src/foo/anchors.rs.html#23">source</a><h4 class="code-header">fn <a href="#method.bar" class="fn">bar</a>()</h4></section> \ No newline at end of file
diff --git a/tests/rustdoc/anchors.no_tymethod_anchor.html b/tests/rustdoc/anchors.no_tymethod_anchor.html
index 38575eadf..23f4277c5 100644
--- a/tests/rustdoc/anchors.no_tymethod_anchor.html
+++ b/tests/rustdoc/anchors.no_tymethod_anchor.html
@@ -1 +1 @@
-<section id="tymethod.foo" class="method"><a class="srclink rightside" href="../src/foo/anchors.rs.html#20">source</a><h4 class="code-header">fn <a href="#tymethod.foo" class="fn">foo</a>()</h4></section> \ No newline at end of file
+<section id="tymethod.foo" class="method"><a class="src rightside" href="../src/foo/anchors.rs.html#20">source</a><h4 class="code-header">fn <a href="#tymethod.foo" class="fn">foo</a>()</h4></section> \ No newline at end of file
diff --git a/tests/rustdoc/anchors.no_type_anchor.html b/tests/rustdoc/anchors.no_type_anchor.html
index dd65d98fe..62b929550 100644
--- a/tests/rustdoc/anchors.no_type_anchor.html
+++ b/tests/rustdoc/anchors.no_type_anchor.html
@@ -1 +1 @@
-<section id="associatedtype.T" class="method"><a class="srclink rightside" href="../src/foo/anchors.rs.html#13">source</a><h4 class="code-header">type <a href="#associatedtype.T" class="associatedtype">T</a></h4></section> \ No newline at end of file
+<section id="associatedtype.T" class="method"><a class="src rightside" href="../src/foo/anchors.rs.html#13">source</a><h4 class="code-header">type <a href="#associatedtype.T" class="associatedtype">T</a></h4></section> \ No newline at end of file
diff --git a/tests/rustdoc/auxiliary/issue-113982-doc_auto_cfg-reexport-foreign.rs b/tests/rustdoc/auxiliary/issue-113982-doc_auto_cfg-reexport-foreign.rs
new file mode 100644
index 000000000..a1a716f5a
--- /dev/null
+++ b/tests/rustdoc/auxiliary/issue-113982-doc_auto_cfg-reexport-foreign.rs
@@ -0,0 +1,3 @@
+#![crate_name = "colors"]
+
+pub struct Color;
diff --git a/tests/rustdoc/auxiliary/jump-to-def-res-err-handling-aux.rs b/tests/rustdoc/auxiliary/jump-to-def-res-err-handling-aux.rs
new file mode 100644
index 000000000..eacec957a
--- /dev/null
+++ b/tests/rustdoc/auxiliary/jump-to-def-res-err-handling-aux.rs
@@ -0,0 +1 @@
+pub struct Ident;
diff --git a/tests/rustdoc/check-source-code-urls-to-def.rs b/tests/rustdoc/check-source-code-urls-to-def.rs
index 41b9d41fa..b803c7e9e 100644
--- a/tests/rustdoc/check-source-code-urls-to-def.rs
+++ b/tests/rustdoc/check-source-code-urls-to-def.rs
@@ -14,10 +14,10 @@ extern crate source_code;
#[path = "auxiliary/source-code-bar.rs"]
pub mod bar;
-// @count - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#5"]' 4
+// @count - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#5-7"]' 4
use bar::Bar;
-// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#13"]' 'self'
-// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'Trait'
+// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#13-17"]' 'self'
+// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
use bar::sub::{self, Trait};
pub struct Foo;
@@ -32,7 +32,8 @@ fn babar() {}
// @has - '//pre[@class="rust"]//a/@href' '/primitive.u32.html'
// @has - '//pre[@class="rust"]//a/@href' '/primitive.str.html'
// @count - '//pre[@class="rust"]//a[@href="#23"]' 5
-// @has - '//pre[@class="rust"]//a[@href="../../source_code/struct.SourceCode.html"]' 'source_code::SourceCode'
+// @has - '//pre[@class="rust"]//a[@href="../../source_code/struct.SourceCode.html"]' \
+// 'source_code::SourceCode'
pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::SourceCode) {
let x = 12;
let y: Foo = Foo;
@@ -42,15 +43,15 @@ pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::Sour
y.hello();
}
-// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'bar::sub::Trait'
-// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'Trait'
+// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'bar::sub::Trait'
+// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {}
pub trait AnotherTrait {}
pub trait WhyNot {}
-// @has - '//pre[@class="rust"]//a[@href="#49"]' 'AnotherTrait'
-// @has - '//pre[@class="rust"]//a[@href="#50"]' 'WhyNot'
+// @has - '//pre[@class="rust"]//a[@href="#50"]' 'AnotherTrait'
+// @has - '//pre[@class="rust"]//a[@href="#51"]' 'WhyNot'
pub fn foo3<T, V>(t: &T, v: &V)
where
T: AnotherTrait,
@@ -59,7 +60,7 @@ where
pub trait AnotherTrait2 {}
-// @has - '//pre[@class="rust"]//a[@href="#60"]' 'AnotherTrait2'
+// @has - '//pre[@class="rust"]//a[@href="#61"]' 'AnotherTrait2'
pub fn foo4() {
let x: Vec<AnotherTrait2> = Vec::new();
}
diff --git a/tests/rustdoc/default-trait-method.rs b/tests/rustdoc/default-trait-method.rs
index 6d0e339c4..c89506781 100644
--- a/tests/rustdoc/default-trait-method.rs
+++ b/tests/rustdoc/default-trait-method.rs
@@ -1,26 +1,45 @@
#![feature(min_specialization)]
// @has default_trait_method/trait.Item.html
-// @has - '//*[@id="tymethod.foo"]' 'fn foo()'
-// @!has - '//*[@id="tymethod.foo"]' 'default fn foo()'
-// @has - '//*[@id="tymethod.bar"]' 'fn bar()'
-// @!has - '//*[@id="tymethod.bar"]' 'default fn bar()'
-// @has - '//*[@id="method.baz"]' 'fn baz()'
-// @!has - '//*[@id="method.baz"]' 'default fn baz()'
pub trait Item {
+ // @has - '//*[@id="tymethod.foo"]' 'fn foo()'
+ // @!has - '//*[@id="tymethod.foo"]' 'default fn foo()'
fn foo();
+
+ // @has - '//*[@id="tymethod.bar"]' 'fn bar()'
+ // @!has - '//*[@id="tymethod.bar"]' 'default fn bar()'
fn bar();
- fn baz() {}
+
+ // @has - '//*[@id="tymethod.baz"]' 'unsafe fn baz()'
+ // @!has - '//*[@id="tymethod.baz"]' 'default unsafe fn baz()'
+ unsafe fn baz();
+
+ // @has - '//*[@id="tymethod.quux"]' 'unsafe fn quux()'
+ // @!has - '//*[@id="tymethod.quux"]' 'default unsafe fn quux()'
+ unsafe fn quux();
+
+ // @has - '//*[@id="method.xyzzy"]' 'fn xyzzy()'
+ // @!has - '//*[@id="method.xyzzy"]' 'default fn xyzzy()'
+ fn xyzzy() {}
}
// @has default_trait_method/struct.Foo.html
-// @has - '//*[@id="method.foo"]' 'default fn foo()'
-// @has - '//*[@id="method.bar"]' 'fn bar()'
-// @!has - '//*[@id="method.bar"]' 'default fn bar()'
-// @has - '//*[@id="method.baz"]' 'fn baz()'
-// @!has - '//*[@id="method.baz"]' 'default fn baz()'
pub struct Foo;
impl Item for Foo {
+ // @has - '//*[@id="method.foo"]' 'default fn foo()'
default fn foo() {}
+
+ // @has - '//*[@id="method.bar"]' 'fn bar()'
+ // @!has - '//*[@id="method.bar"]' 'default fn bar()'
fn bar() {}
+
+ // @has - '//*[@id="method.baz"]' 'default unsafe fn baz()'
+ default unsafe fn baz() {}
+
+ // @has - '//*[@id="method.quux"]' 'unsafe fn quux()'
+ // @!has - '//*[@id="method.quux"]' 'default unsafe fn quux()'
+ unsafe fn quux() {}
+
+ // @has - '//*[@id="method.xyzzy"]' 'fn xyzzy()'
+ // @!has - '//*[@id="method.xyzzy"]' 'default fn xyzzy()'
}
diff --git a/tests/rustdoc/description.rs b/tests/rustdoc/description.rs
index 43cd59ebd..aabbb4c4c 100644
--- a/tests/rustdoc/description.rs
+++ b/tests/rustdoc/description.rs
@@ -1,4 +1,5 @@
#![crate_name = "foo"]
+#![allow(rustdoc::redundant_explicit_links)]
//! # Description test crate
//!
//! This is the contents of the test crate docstring.
diff --git a/tests/rustdoc/display-hidden-items.rs b/tests/rustdoc/display-hidden-items.rs
new file mode 100644
index 000000000..d97d5b4a9
--- /dev/null
+++ b/tests/rustdoc/display-hidden-items.rs
@@ -0,0 +1,71 @@
+// Test to ensure that the `--document-hidden-items` option is working as expected.
+// compile-flags: -Z unstable-options --document-hidden-items
+// ignore-tidy-linelength
+
+#![crate_name = "foo"]
+
+// @has 'foo/index.html'
+// @has - '//*[@id="reexport.hidden_reexport"]/code' 'pub use hidden::inside_hidden as hidden_reexport;'
+#[doc(hidden)]
+pub use hidden::inside_hidden as hidden_reexport;
+
+// @has - '//*[@class="item-name"]/a[@class="trait"]' 'TraitHidden'
+// @has 'foo/trait.TraitHidden.html'
+#[doc(hidden)]
+pub trait TraitHidden {}
+
+// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="trait"]' 'Trait'
+pub trait Trait {
+ // @has 'foo/trait.Trait.html'
+ // @has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' 'const BAR: u32 = 0u32'
+ #[doc(hidden)]
+ const BAR: u32 = 0;
+
+ // @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'fn foo()'
+ #[doc(hidden)]
+ fn foo() {}
+}
+
+// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="struct"]' 'Struct'
+// @has 'foo/struct.Struct.html'
+pub struct Struct {
+ // @has - '//*[@id="structfield.a"]/code' 'a: u32'
+ #[doc(hidden)]
+ pub a: u32,
+}
+
+impl Struct {
+ // @has - '//*[@id="method.new"]/*[@class="code-header"]' 'pub fn new() -> Self'
+ #[doc(hidden)]
+ pub fn new() -> Self { Self { a: 0 } }
+}
+
+impl Trait for Struct {
+ // @has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' 'const BAR: u32 = 0u32'
+ // @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'fn foo()'
+}
+// @has - '//*[@id="impl-TraitHidden-for-Struct"]/*[@class="code-header"]' 'impl TraitHidden for Struct'
+impl TraitHidden for Struct {}
+
+// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="enum"]' 'HiddenEnum'
+// @has 'foo/enum.HiddenEnum.html'
+#[doc(hidden)]
+pub enum HiddenEnum {
+ A,
+}
+
+// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="enum"]' 'Enum'
+pub enum Enum {
+ // @has 'foo/enum.Enum.html' '//*[@id="variant.A"]/*[@class="code-header"]' 'A'
+ #[doc(hidden)]
+ A,
+}
+
+// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="mod"]' 'hidden'
+#[doc(hidden)]
+pub mod hidden {
+ // @has 'foo/hidden/index.html'
+ // @has - '//*[@class="item-name"]/a[@class="fn"]' 'inside_hidden'
+ // @has 'foo/hidden/fn.inside_hidden.html'
+ pub fn inside_hidden() {}
+}
diff --git a/tests/rustdoc/ensure-src-link.rs b/tests/rustdoc/ensure-src-link.rs
index c65387080..f99c4c4d9 100644
--- a/tests/rustdoc/ensure-src-link.rs
+++ b/tests/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 '//*[@id="method.zip"]//a[@class="srclink rightside"]' "source"
+// @has foo/trait.Iterator.html '//*[@id="method.zip"]//a[@class="src rightside"]' "source"
pub use std::iter::Iterator;
diff --git a/tests/rustdoc/extern-impl-trait.rs b/tests/rustdoc/extern-impl-trait.rs
index 8ab026afd..4d8672305 100644
--- a/tests/rustdoc/extern-impl-trait.rs
+++ b/tests/rustdoc/extern-impl-trait.rs
@@ -7,5 +7,5 @@ extern crate extern_impl_trait;
// @has 'foo/struct.X.html' '//h4[@class="code-header"]' "impl Foo<Associated = ()> + 'a"
pub use extern_impl_trait::X;
-// @has 'foo/struct.Y.html' '//h4[@class="code-header"]' "impl ?Sized + Foo<Associated = ()> + 'a"
+// @has 'foo/struct.Y.html' '//h4[@class="code-header"]' "impl Foo<Associated = ()> + ?Sized + 'a"
pub use extern_impl_trait::Y;
diff --git a/tests/rustdoc/generic-const-items.rs b/tests/rustdoc/generic-const-items.rs
new file mode 100644
index 000000000..e2c6a027a
--- /dev/null
+++ b/tests/rustdoc/generic-const-items.rs
@@ -0,0 +1,38 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+// @has 'generic_const_items/constant.K.html'
+// @has - '//*[@class="rust item-decl"]//code' \
+// "pub const K<'a, T: 'a + Copy, const N: usize>: Option<[T; N]> \
+// where \
+// String: From<T>;"
+pub const K<'a, T: 'a + Copy, const N: usize>: Option<[T; N]> = None
+where
+ String: From<T>;
+
+// @has generic_const_items/trait.Trait.html
+pub trait Trait<T: ?Sized> {
+ // @has - '//*[@id="associatedconstant.C"]' \
+ // "const C<'a>: &'a T \
+ // where \
+ // T: 'a + Eq"
+ const C<'a>: &'a T
+ where
+ T: 'a + Eq;
+}
+
+pub struct Implementor;
+
+// @has generic_const_items/struct.Implementor.html
+// @has - '//h3[@class="code-header"]' 'impl Trait<str> for Implementor'
+impl Trait<str> for Implementor {
+ // @has - '//*[@id="associatedconstant.C"]' \
+ // "const C<'a>: &'a str = \"C\" \
+ // where \
+ // str: 'a"
+ const C<'a>: &'a str = "C"
+ // In real code we could've left off this bound but adding it explicitly allows us to test if
+ // we render where-clauses on associated consts inside impl blocks correctly.
+ where
+ str: 'a;
+}
diff --git a/tests/rustdoc/impl-everywhere.rs b/tests/rustdoc/impl-everywhere.rs
index 44885d430..2311c806c 100644
--- a/tests/rustdoc/impl-everywhere.rs
+++ b/tests/rustdoc/impl-everywhere.rs
@@ -25,6 +25,6 @@ pub fn foo_foo() -> impl Foo + Foo2 {
Bar
}
-// @has foo/fn.foo_foo_foo.html '//section[@id="main-content"]//pre' "x: &'x impl Foo + Foo2"
+// @has foo/fn.foo_foo_foo.html '//section[@id="main-content"]//pre' "x: &'x (impl Foo + Foo2)"
pub fn foo_foo_foo<'x>(_x: &'x (impl Foo + Foo2)) {
}
diff --git a/tests/rustdoc/inherent-projections.rs b/tests/rustdoc/inherent-projections.rs
index 9bda0acaf..25f512826 100644
--- a/tests/rustdoc/inherent-projections.rs
+++ b/tests/rustdoc/inherent-projections.rs
@@ -13,8 +13,8 @@ impl Owner {
}
// Make sure we handle bound vars correctly.
-// @has 'inherent_projections/type.User.html' '//pre[@class="rust item-decl"]' "for<'a> fn(_: Carrier<'a>::Focus)"
-pub type User = for<'a> fn(Carrier<'a>::Focus);
+// @has 'inherent_projections/fn.user.html' '//pre[@class="rust item-decl"]' "user(_: for<'a> fn(_: Carrier<'a>::Focus))"
+pub fn user(_: for<'a> fn(Carrier<'a>::Focus)) {}
pub struct Carrier<'a>(&'a ());
@@ -27,11 +27,11 @@ impl<'a> Carrier<'a> {
// FIXME(inherent_associated_types): Below we link to `Proj` but we should link to `Proj-1`.
// The current test checks for the buggy behavior for demonstration purposes.
-// @has 'inherent_projections/type.Test.html'
-// @has - '//pre[@class="rust item-decl"]' "Parametrized<i32>"
+// @has 'inherent_projections/fn.test.html'
+// @has - '//pre[@class="rust item-decl"]' "test(_: Parametrized<i32>::Proj)"
// @has - '//pre[@class="rust item-decl"]//a[@class="associatedtype"]/@href' 'struct.Parametrized.html#associatedtype.Proj'
// @!has - '//pre[@class="rust item-decl"]//a[@class="associatedtype"]/@href' 'struct.Parametrized.html#associatedtype.Proj-1'
-pub type Test = Parametrized<i32>::Proj;
+pub fn test(_: Parametrized<i32>::Proj) {}
pub struct Parametrized<T>(T);
diff --git a/tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs b/tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs
new file mode 100644
index 000000000..0fc7a7aae
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs
@@ -0,0 +1,22 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+pub const K<'a, T: 'a + Copy, const N: usize>: Option<[T; N]> = None
+where
+ String: From<T>;
+
+pub trait Trait<T: ?Sized> {
+ const C<'a>: &'a T
+ where
+ T: 'a + Eq;
+}
+
+pub struct Implementor;
+
+impl Trait<str> for Implementor {
+ const C<'a>: &'a str = "C"
+ // In real code we could've left off this bound but adding it explicitly allows us to test if
+ // we render where-clauses on associated consts inside impl blocks correctly.
+ where
+ str: 'a;
+}
diff --git a/tests/rustdoc/inline_cross/auxiliary/impl-sized.rs b/tests/rustdoc/inline_cross/auxiliary/impl-sized.rs
new file mode 100644
index 000000000..65f72a3b9
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/impl-sized.rs
@@ -0,0 +1,21 @@
+use std::fmt::Debug;
+
+pub fn sized(x: impl Sized) -> impl Sized {
+ x
+}
+
+pub fn sized_outlives<'a>(x: impl Sized + 'a) -> impl Sized + 'a {
+ x
+}
+
+pub fn maybe_sized(x: &impl ?Sized) -> &impl ?Sized {
+ x
+}
+
+pub fn debug_maybe_sized(x: &(impl Debug + ?Sized)) -> &(impl Debug + ?Sized) {
+ x
+}
+
+pub fn maybe_sized_outlives<'t>(x: &(impl ?Sized + 't)) -> &(impl ?Sized + 't) {
+ x
+}
diff --git a/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs
new file mode 100644
index 000000000..c72f01115
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs
@@ -0,0 +1,35 @@
+#![feature(return_position_impl_trait_in_trait)]
+
+pub trait Trait {
+ fn create() -> impl Iterator<Item = u64> {
+ std::iter::empty()
+ }
+}
+
+pub struct Basic;
+pub struct Intermediate;
+pub struct Advanced;
+
+impl Trait for Basic {
+ // method provided by the trait
+}
+
+impl Trait for Intermediate {
+ fn create() -> std::ops::Range<u64> { // concrete return type
+ 0..1
+ }
+}
+
+impl Trait for Advanced {
+ fn create() -> impl Iterator<Item = u64> { // opaque return type
+ std::iter::repeat(0)
+ }
+}
+
+// Regression test for issue #113929:
+
+pub trait Def {
+ fn def<T>() -> impl Default {}
+}
+
+impl Def for () {}
diff --git a/tests/rustdoc/inline_cross/generic-const-items.rs b/tests/rustdoc/inline_cross/generic-const-items.rs
new file mode 100644
index 000000000..70cf7af88
--- /dev/null
+++ b/tests/rustdoc/inline_cross/generic-const-items.rs
@@ -0,0 +1,26 @@
+#![crate_name = "user"]
+
+// aux-crate:generic_const_items=generic-const-items.rs
+// edition:2021
+
+// @has 'user/constant.K.html'
+// @has - '//*[@class="rust item-decl"]//code' \
+// "pub const K<'a, T: 'a + Copy, const N: usize>: Option<[T; N]> \
+// where \
+// String: From<T>;"
+pub use generic_const_items::K;
+
+// @has user/trait.Trait.html
+// @has - '//*[@id="associatedconstant.C"]' \
+// "const C<'a>: &'a T \
+// where \
+// T: 'a + Eq"
+pub use generic_const_items::Trait;
+
+// @has user/struct.Implementor.html
+// @has - '//h3[@class="code-header"]' 'impl Trait<str> for Implementor'
+// @has - '//*[@id="associatedconstant.C"]' \
+// "const C<'a>: &'a str = \"C\" \
+// where \
+// str: 'a"
+pub use generic_const_items::Implementor;
diff --git a/tests/rustdoc/inline_cross/impl-sized.rs b/tests/rustdoc/inline_cross/impl-sized.rs
new file mode 100644
index 000000000..82bdce474
--- /dev/null
+++ b/tests/rustdoc/inline_cross/impl-sized.rs
@@ -0,0 +1,27 @@
+#![crate_name = "user"]
+
+// aux-crate:impl_sized=impl-sized.rs
+// edition:2021
+
+// @has user/fn.sized.html
+// @has - '//pre[@class="rust item-decl"]' "sized(x: impl Sized) -> impl Sized"
+pub use impl_sized::sized;
+
+// @has user/fn.sized_outlives.html
+// @has - '//pre[@class="rust item-decl"]' \
+// "sized_outlives<'a>(x: impl Sized + 'a) -> impl Sized + 'a"
+pub use impl_sized::sized_outlives;
+
+// @has user/fn.maybe_sized.html
+// @has - '//pre[@class="rust item-decl"]' "maybe_sized(x: &impl ?Sized) -> &impl ?Sized"
+pub use impl_sized::maybe_sized;
+
+// @has user/fn.debug_maybe_sized.html
+// @has - '//pre[@class="rust item-decl"]' \
+// "debug_maybe_sized(x: &(impl Debug + ?Sized)) -> &(impl Debug + ?Sized)"
+pub use impl_sized::debug_maybe_sized;
+
+// @has user/fn.maybe_sized_outlives.html
+// @has - '//pre[@class="rust item-decl"]' \
+// "maybe_sized_outlives<'t>(x: &(impl ?Sized + 't)) -> &(impl ?Sized + 't)"
+pub use impl_sized::maybe_sized_outlives;
diff --git a/tests/rustdoc/inline_cross/ret-pos-impl-trait-in-trait.rs b/tests/rustdoc/inline_cross/ret-pos-impl-trait-in-trait.rs
new file mode 100644
index 000000000..8e9ef9020
--- /dev/null
+++ b/tests/rustdoc/inline_cross/ret-pos-impl-trait-in-trait.rs
@@ -0,0 +1,35 @@
+#![crate_name = "user"]
+// aux-crate:rpitit=ret-pos-impl-trait-in-trait.rs
+// edition:2021
+
+// Test that we can correctly render cross-crate RPITITs.
+// In particular, check that we don't render the internal associated type generated by
+// their desugaring. We count the number of associated items and ensure that it is exactly one.
+// This is more robust than checking for the absence of the associated type.
+
+// @has user/trait.Trait.html
+// @has - '//*[@id="method.create"]' 'fn create() -> impl Iterator<Item = u64>'
+// The class "method" is used for all three kinds of associated items at the time of writing.
+// @count - '//*[@id="main-content"]//section[@class="method"]' 1
+pub use rpitit::Trait;
+
+// @has user/struct.Basic.html
+// @has - '//*[@id="method.create"]' 'fn create() -> impl Iterator<Item = u64>'
+// @count - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]' 1
+pub use rpitit::Basic;
+
+// @has user/struct.Intermediate.html
+// @has - '//*[@id="method.create"]' 'fn create() -> Range<u64>'
+// @count - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]' 1
+pub use rpitit::Intermediate;
+
+// @has user/struct.Advanced.html
+// @has - '//*[@id="method.create"]' 'fn create() -> impl Iterator<Item = u64>'
+// @count - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]' 1
+pub use rpitit::Advanced;
+
+// Regression test for issue #113929:
+
+// @has user/trait.Def.html
+// @has - '//*[@id="method.def"]' 'fn def<T>() -> impl Default'
+pub use rpitit::Def;
diff --git a/tests/rustdoc/intra-doc/basic.rs b/tests/rustdoc/intra-doc/basic.rs
index 96e21137b..c88a7887f 100644
--- a/tests/rustdoc/intra-doc/basic.rs
+++ b/tests/rustdoc/intra-doc/basic.rs
@@ -1,3 +1,5 @@
+#![allow(rustdoc::redundant_explicit_links)]
+
// @has basic/index.html
// @has - '//a/@href' 'struct.ThisType.html'
// @has - '//a/@title' 'struct basic::ThisType'
diff --git a/tests/rustdoc/intra-doc/generic-params.rs b/tests/rustdoc/intra-doc/generic-params.rs
index fbc9fc6a9..359f775f9 100644
--- a/tests/rustdoc/intra-doc/generic-params.rs
+++ b/tests/rustdoc/intra-doc/generic-params.rs
@@ -1,6 +1,7 @@
// ignore-tidy-linelength
#![crate_name = "foo"]
+#![allow(rustdoc::redundant_explicit_links)]
//! Here's a link to [`Vec<T>`] and one to [`Box<Vec<Option<T>>>`].
//! Here's a link to [`Iterator<Box<T>>::Item`].
diff --git a/tests/rustdoc/intra-doc/issue-108459.rs b/tests/rustdoc/intra-doc/issue-108459.rs
index eb1c7a05e..b8cd478b4 100644
--- a/tests/rustdoc/intra-doc/issue-108459.rs
+++ b/tests/rustdoc/intra-doc/issue-108459.rs
@@ -1,4 +1,5 @@
#![deny(rustdoc::broken_intra_doc_links)]
+#![allow(rustdoc::redundant_explicit_links)]
pub struct S;
pub mod char {}
diff --git a/tests/rustdoc/intra-doc/nested-use.rs b/tests/rustdoc/intra-doc/nested-use.rs
new file mode 100644
index 000000000..19ebfff1b
--- /dev/null
+++ b/tests/rustdoc/intra-doc/nested-use.rs
@@ -0,0 +1,16 @@
+// Regression test for issue #113896: Intra-doc links on nested use items.
+
+#![crate_name = "foo"]
+
+// @has foo/struct.Foo.html
+// @has - '//a[@href="struct.Foo.html"]' 'Foo'
+// @has - '//a[@href="struct.Bar.html"]' 'Bar'
+
+/// [`Foo`]
+pub use m::{Foo, Bar};
+
+mod m {
+ /// [`Bar`]
+ pub struct Foo;
+ pub struct Bar;
+}
diff --git a/tests/rustdoc/issue-105735-overlapping-reexport-2.rs b/tests/rustdoc/issue-105735-overlapping-reexport-2.rs
new file mode 100644
index 000000000..910824839
--- /dev/null
+++ b/tests/rustdoc/issue-105735-overlapping-reexport-2.rs
@@ -0,0 +1,25 @@
+// Regression test to ensure that both `AtomicU8` items are displayed but not the re-export.
+
+#![crate_name = "foo"]
+#![no_std]
+
+// @has 'foo/index.html'
+// @has - '//*[@class="item-name"]/a[@class="type"]' 'AtomicU8'
+// @has - '//*[@class="item-name"]/a[@class="constant"]' 'AtomicU8'
+// We also ensure we don't have another item displayed.
+// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 2
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Definitions'
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Constants'
+
+mod other {
+ pub type AtomicU8 = ();
+}
+
+mod thing {
+ pub use crate::other::AtomicU8;
+
+ #[allow(non_upper_case_globals)]
+ pub const AtomicU8: () = ();
+}
+
+pub use crate::thing::AtomicU8;
diff --git a/tests/rustdoc/issue-105735-overlapping-reexport.rs b/tests/rustdoc/issue-105735-overlapping-reexport.rs
new file mode 100644
index 000000000..50f2450b9
--- /dev/null
+++ b/tests/rustdoc/issue-105735-overlapping-reexport.rs
@@ -0,0 +1,21 @@
+// Regression test to ensure that both `AtomicU8` items are displayed but not the re-export.
+
+#![crate_name = "foo"]
+#![no_std]
+
+// @has 'foo/index.html'
+// @has - '//*[@class="item-name"]/a[@class="struct"]' 'AtomicU8'
+// @has - '//*[@class="item-name"]/a[@class="constant"]' 'AtomicU8'
+// We also ensure we don't have another item displayed.
+// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 2
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs'
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Constants'
+
+mod thing {
+ pub use core::sync::atomic::AtomicU8;
+
+ #[allow(non_upper_case_globals)]
+ pub const AtomicU8: () = ();
+}
+
+pub use crate::thing::AtomicU8;
diff --git a/tests/rustdoc/issue-113982-doc_auto_cfg-reexport-foreign.rs b/tests/rustdoc/issue-113982-doc_auto_cfg-reexport-foreign.rs
new file mode 100644
index 000000000..88b86d15c
--- /dev/null
+++ b/tests/rustdoc/issue-113982-doc_auto_cfg-reexport-foreign.rs
@@ -0,0 +1,19 @@
+// aux-build: issue-113982-doc_auto_cfg-reexport-foreign.rs
+
+#![feature(no_core, doc_auto_cfg)]
+#![no_core]
+#![crate_name = "foo"]
+
+extern crate colors;
+
+// @has 'foo/index.html' '//*[@class="stab portability"]' 'Non-colors'
+// @has 'foo/struct.Color.html' '//*[@class="stab portability"]' \
+// 'Available on non-crate feature colors only.'
+#[cfg(not(feature = "colors"))]
+pub use colors::*;
+
+// @has 'foo/index.html' '//*[@class="stab portability"]' 'Non-fruits'
+// @has 'foo/struct.Red.html' '//*[@class="stab portability"]' \
+// 'Available on non-crate feature fruits only.'
+#[cfg(not(feature = "fruits"))]
+pub use colors::Color as Red;
diff --git a/tests/rustdoc/issue-18199.rs b/tests/rustdoc/issue-18199.rs
index bc0c4a565..9cc58b162 100644
--- a/tests/rustdoc/issue-18199.rs
+++ b/tests/rustdoc/issue-18199.rs
@@ -3,6 +3,7 @@
#![doc(test(attr(feature(staged_api))))]
/// ```
+/// #![allow(internal_features)]
/// #![unstable(feature="test", issue="18199")]
/// fn main() {}
/// ```
diff --git a/tests/rustdoc/issue-33178.rs b/tests/rustdoc/issue-33178.rs
index 1f45fe723..ed643f5ae 100644
--- a/tests/rustdoc/issue-33178.rs
+++ b/tests/rustdoc/issue-33178.rs
@@ -4,10 +4,11 @@
// ignore-cross-compile
// @has issue_33178/index.html
-// @has - //a/@title empty
-// @has - //a/@href ../empty/index.html
+// @has - '//a[@title="mod empty"][@href="../empty/index.html"]' empty
pub extern crate empty;
-// @has - //a/@title variant_struct
-// @has - //a/@href ../variant_struct/index.html
+// @has - '//a[@title="mod variant_struct"][@href="../variant_struct/index.html"]' variant_struct
pub extern crate variant_struct as foo;
+
+// @has - '//a[@title="mod issue_33178"][@href="index.html"]' self
+pub extern crate self as bar;
diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs b/tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs
new file mode 100644
index 000000000..4e9d188bb
--- /dev/null
+++ b/tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs
@@ -0,0 +1,13 @@
+// edition:2015
+
+#![crate_name = "foo"]
+
+use external::Public as Private;
+
+pub mod external {
+ pub struct Public;
+
+ // @has 'foo/external/fn.make.html'
+ // @has - '//*[@class="rust item-decl"]/code' 'pub fn make() -> Public'
+ pub fn make() -> ::Private { super::Private }
+}
diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-generics.rs b/tests/rustdoc/issue-81141-private-reexport-in-public-api-generics.rs
new file mode 100644
index 000000000..7e2895086
--- /dev/null
+++ b/tests/rustdoc/issue-81141-private-reexport-in-public-api-generics.rs
@@ -0,0 +1,13 @@
+#![crate_name = "foo"]
+
+use crate::bar::Foo as Alias;
+
+pub mod bar {
+ pub struct Foo<'a, T>(&'a T);
+}
+
+// @has "foo/fn.foo.html"
+// @has - '//*[@class="rust item-decl"]/code' "pub fn foo<'a, T>(f: Foo<'a, T>) -> Foo<'a, usize>"
+pub fn foo<'a, T>(f: Alias<'a, T>) -> Alias<'a, usize> {
+ Alias(&0)
+}
diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs b/tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs
new file mode 100644
index 000000000..5053a328b
--- /dev/null
+++ b/tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs
@@ -0,0 +1,16 @@
+// compile-flags: -Z unstable-options --document-hidden-items
+
+#![crate_name = "foo"]
+
+#[doc(hidden)]
+pub use crate::bar::Bar as Alias;
+
+mod bar {
+ pub struct Bar;
+}
+
+// @has 'foo/fn.bar.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar() -> Alias'
+pub fn bar() -> Alias {
+ Alias
+}
diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs b/tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs
new file mode 100644
index 000000000..15749674a
--- /dev/null
+++ b/tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs
@@ -0,0 +1,32 @@
+// compile-flags: --document-private-items
+
+#![crate_name = "foo"]
+
+use crate::bar::Bar as Alias;
+pub(crate) use crate::bar::Bar as CrateAlias;
+
+mod bar {
+ pub struct Bar;
+ pub use self::Bar as Inner;
+}
+
+// It's a fully private re-export so it should not be displayed.
+// @has 'foo/fn.bar.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar() -> Bar'
+pub fn bar() -> Alias {
+ Alias
+}
+
+// It's public re-export inside a private module so it should be visible.
+// @has 'foo/fn.bar2.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar2() -> Inner'
+pub fn bar2() -> crate::bar::Inner {
+ Alias
+}
+
+// It's a non-public, so it doesn't appear in documentation so it should not be visible.
+// @has 'foo/fn.bar3.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar3() -> Bar'
+pub fn bar3() -> CrateAlias {
+ Alias
+}
diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api.rs b/tests/rustdoc/issue-81141-private-reexport-in-public-api.rs
new file mode 100644
index 000000000..bd54d02c6
--- /dev/null
+++ b/tests/rustdoc/issue-81141-private-reexport-in-public-api.rs
@@ -0,0 +1,124 @@
+// This test ensures that if a private re-export is present in a public API, it'll be
+// replaced by the first public item in the re-export chain or by the private item.
+
+#![crate_name = "foo"]
+
+use crate::bar::Bar as Alias;
+
+pub use crate::bar::Bar as Whatever;
+use crate::Whatever as Whatever2;
+use crate::Whatever2 as Whatever3;
+pub use crate::bar::Inner as Whatever4;
+
+mod bar {
+ pub struct Bar;
+ pub use self::Bar as Inner;
+}
+
+// @has 'foo/fn.bar.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar() -> Bar'
+pub fn bar() -> Alias {
+ Alias
+}
+
+// @has 'foo/fn.bar2.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar2() -> Whatever'
+pub fn bar2() -> Whatever3 {
+ Whatever
+}
+
+// @has 'foo/fn.bar3.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar3() -> Whatever4'
+pub fn bar3() -> Whatever4 {
+ Whatever
+}
+
+// @has 'foo/fn.bar4.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar4() -> Bar'
+pub fn bar4() -> crate::Alias {
+ Alias
+}
+
+// @has 'foo/fn.bar5.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar5() -> Whatever'
+pub fn bar5() -> crate::Whatever3 {
+ Whatever
+}
+
+// @has 'foo/fn.bar6.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar6() -> Whatever4'
+pub fn bar6() -> crate::Whatever4 {
+ Whatever
+}
+
+
+// @has 'foo/fn.bar7.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar7() -> Bar'
+pub fn bar7() -> self::Alias {
+ Alias
+}
+
+// @has 'foo/fn.bar8.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar8() -> Whatever'
+pub fn bar8() -> self::Whatever3 {
+ Whatever
+}
+
+// @has 'foo/fn.bar9.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar9() -> Whatever4'
+pub fn bar9() -> self::Whatever4 {
+ Whatever
+}
+
+mod nested {
+ pub(crate) use crate::Alias;
+ pub(crate) use crate::Whatever3;
+ pub(crate) use crate::Whatever4;
+ pub(crate) use crate::nested as nested2;
+}
+
+// @has 'foo/fn.bar10.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar10() -> Bar'
+pub fn bar10() -> nested::Alias {
+ Alias
+}
+
+// @has 'foo/fn.bar11.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar11() -> Whatever'
+pub fn bar11() -> nested::Whatever3 {
+ Whatever
+}
+
+// @has 'foo/fn.bar12.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar12() -> Whatever4'
+pub fn bar12() -> nested::Whatever4 {
+ Whatever
+}
+
+// @has 'foo/fn.bar13.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar13() -> Bar'
+pub fn bar13() -> nested::nested2::Alias {
+ Alias
+}
+
+// @has 'foo/fn.bar14.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar14() -> Whatever'
+pub fn bar14() -> nested::nested2::Whatever3 {
+ Whatever
+}
+
+// @has 'foo/fn.bar15.html'
+// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar15() -> Whatever4'
+pub fn bar15() -> nested::nested2::Whatever4 {
+ Whatever
+}
+
+use external::Public as Private;
+
+pub mod external {
+ pub struct Public;
+
+ // @has 'foo/external/fn.make.html'
+ // @has - '//*[@class="rust item-decl"]/code' 'pub fn make() -> Public'
+ pub fn make() -> super::Private { super::Private }
+}
diff --git a/tests/rustdoc/jump-to-def-doc-links.rs b/tests/rustdoc/jump-to-def-doc-links.rs
new file mode 100644
index 000000000..014d58032
--- /dev/null
+++ b/tests/rustdoc/jump-to-def-doc-links.rs
@@ -0,0 +1,51 @@
+// compile-flags: -Zunstable-options --generate-link-to-definition
+
+#![crate_name = "foo"]
+
+// @has 'src/foo/jump-to-def-doc-links.rs.html'
+
+// @has - '//a[@href="../../foo/struct.Bar.html"]' 'Bar'
+// @has - '//a[@href="../../foo/struct.Foo.html"]' 'Foo'
+pub struct Bar; pub struct Foo;
+
+// @has - '//a[@href="../../foo/enum.Enum.html"]' 'Enum'
+pub enum Enum {
+ Variant1(String),
+ Variant2(u8),
+}
+
+// @has - '//a[@href="../../foo/struct.Struct.html"]' 'Struct'
+pub struct Struct {
+ pub a: u8,
+ b: Foo,
+}
+
+impl Struct {
+ pub fn foo() {}
+ pub fn foo2(&self) {}
+ fn bar() {}
+ fn bar(&self) {}
+}
+
+// @has - '//a[@href="../../foo/trait.Trait.html"]' 'Trait'
+pub trait Trait {
+ fn foo();
+}
+
+impl Trait for Struct {
+ fn foo() {}
+}
+
+// @has - '//a[@href="../../foo/union.Union.html"]' 'Union'
+pub union Union {
+ pub a: u16,
+ pub f: u32,
+}
+
+// @has - '//a[@href="../../foo/fn.bar.html"]' 'bar'
+pub fn bar(b: Bar) {
+ let x = Foo;
+}
+
+// @has - '//a[@href="../../foo/bar/index.html"]' 'bar'
+pub mod bar {}
diff --git a/tests/rustdoc/private-use.rs b/tests/rustdoc/private-use.rs
new file mode 100644
index 000000000..689ed7314
--- /dev/null
+++ b/tests/rustdoc/private-use.rs
@@ -0,0 +1,13 @@
+// Regression test for <https://github.com/rust-lang/rust/pull/113374> to
+// ensure it doesn't panic.
+
+mod generics {
+ pub enum WherePredicate {
+ EqPredicate,
+ }
+}
+pub mod visit {
+ use *;
+ pub fn visit_where_predicate<V>(_visitor: &mut V, _i: &WherePredicate) {}
+}
+pub use generics::*;
diff --git a/tests/rustdoc/source-file.rs b/tests/rustdoc/source-file.rs
index 4e1664790..16d4cbe3a 100644
--- a/tests/rustdoc/source-file.rs
+++ b/tests/rustdoc/source-file.rs
@@ -1,5 +1,5 @@
#![crate_name = "foo"]
-// @hasraw source-files.js source-file.rs
+// @hasraw src-files.js source-file.rs
pub struct Foo;
diff --git a/tests/rustdoc/src-links-auto-impls.rs b/tests/rustdoc/src-links-auto-impls.rs
index 953563833..1c8d15731 100644
--- a/tests/rustdoc/src-links-auto-impls.rs
+++ b/tests/rustdoc/src-links-auto-impls.rs
@@ -2,11 +2,11 @@
// @has foo/struct.Unsized.html
// @has - '//*[@id="impl-Sized-for-Unsized"]/h3[@class="code-header"]' 'impl !Sized for Unsized'
-// @!has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="srclink"]' 'source'
+// @!has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="src"]' 'source'
// @has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header"]' 'impl Sync for Unsized'
-// @!has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="srclink"]' 'source'
+// @!has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="src"]' 'source'
// @has - '//*[@id="impl-Any-for-Unsized"]/h3[@class="code-header"]' 'impl<T> Any for T'
-// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="srclink rightside"]' 'source'
+// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="src rightside"]' 'source'
pub struct Unsized {
data: [u8],
}
diff --git a/tests/rustdoc/static-root-path.rs b/tests/rustdoc/static-root-path.rs
index 86928b0fb..3148ea047 100644
--- a/tests/rustdoc/static-root-path.rs
+++ b/tests/rustdoc/static-root-path.rs
@@ -8,10 +8,10 @@
pub struct SomeStruct;
// @has src/static_root_path/static-root-path.rs.html
-// @matchesraw - '"/cache/source-script-'
-// @!matchesraw - '"\.\./\.\./source-script'
-// @matchesraw - '"\.\./\.\./source-files.js"'
-// @!matchesraw - '"/cache/source-files\.js"'
+// @matchesraw - '"/cache/src-script-'
+// @!matchesraw - '"\.\./\.\./src-script'
+// @matchesraw - '"\.\./\.\./src-files.js"'
+// @!matchesraw - '"/cache/src-files\.js"'
// @has settings.html
// @matchesraw - '/cache/settings-'