about summary refs log tree commit diff
path: root/tests/rustdoc/inline_cross
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2024-05-21 21:21:26 -0700
committerMichael Howell <michael@notriddle.com>2024-05-21 21:21:26 -0700
commitb5923a95a886588fd40fccd69f1ccca504234194 (patch)
tree1b30d1a5cb1f5f81b0ba117d37ae1750d638e80f /tests/rustdoc/inline_cross
parent55bd054a21533cbaa02836b0ca125c2eaaa4b8f4 (diff)
downloadrust-b5923a95a886588fd40fccd69f1ccca504234194.tar.gz
rust-b5923a95a886588fd40fccd69f1ccca504234194.zip
Move tests into appropriate subdirectories
Diffstat (limited to 'tests/rustdoc/inline_cross')
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/issue-85454.rs17
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/reexport-with-anonymous-lifetime-98697.rs17
-rw-r--r--tests/rustdoc/inline_cross/qpath-self-85454.rs30
-rw-r--r--tests/rustdoc/inline_cross/reexport-with-anonymous-lifetime-98697.rs18
4 files changed, 82 insertions, 0 deletions
diff --git a/tests/rustdoc/inline_cross/auxiliary/issue-85454.rs b/tests/rustdoc/inline_cross/auxiliary/issue-85454.rs
new file mode 100644
index 00000000000..5db4fe053af
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/issue-85454.rs
@@ -0,0 +1,17 @@
+// @has issue_85454/trait.FromResidual.html
+// @has - '//pre[@class="rust item-decl"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }'
+pub trait FromResidual<R = <Self as Try>::Residual> {
+    fn from_residual(residual: R) -> Self;
+}
+
+pub trait Try: FromResidual {
+    type Output;
+    type Residual;
+    fn from_output(output: Self::Output) -> Self;
+    fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
+}
+
+pub enum ControlFlow<B, C = ()> {
+    Continue(C),
+    Break(B),
+}
diff --git a/tests/rustdoc/inline_cross/auxiliary/reexport-with-anonymous-lifetime-98697.rs b/tests/rustdoc/inline_cross/auxiliary/reexport-with-anonymous-lifetime-98697.rs
new file mode 100644
index 00000000000..4e55e7ed576
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/reexport-with-anonymous-lifetime-98697.rs
@@ -0,0 +1,17 @@
+/// When reexporting this function, make sure the anonymous lifetimes are not rendered.
+///
+/// https://github.com/rust-lang/rust/issues/98697
+pub fn repro<F>()
+where
+    F: Fn(&str),
+{
+    unimplemented!()
+}
+
+pub struct Extra;
+
+pub trait MyTrait<T> {
+    fn run() {}
+}
+
+impl MyTrait<&Extra> for Extra {}
diff --git a/tests/rustdoc/inline_cross/qpath-self-85454.rs b/tests/rustdoc/inline_cross/qpath-self-85454.rs
new file mode 100644
index 00000000000..de806db7709
--- /dev/null
+++ b/tests/rustdoc/inline_cross/qpath-self-85454.rs
@@ -0,0 +1,30 @@
+//@ aux-build:issue-85454.rs
+//@ build-aux-docs
+#![crate_name = "foo"]
+// https://github.com/rust-lang/rust/issues/85454
+
+extern crate issue_85454;
+
+// @has foo/trait.FromResidual.html
+// @has - '//pre[@class="rust item-decl"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { // Required method fn from_residual(residual: R) -> Self; }'
+pub trait FromResidual<R = <Self as Try>::Residual> {
+    fn from_residual(residual: R) -> Self;
+}
+
+pub trait Try: FromResidual {
+    type Output;
+    type Residual;
+    fn from_output(output: Self::Output) -> Self;
+    fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
+}
+
+pub enum ControlFlow<B, C = ()> {
+    Continue(C),
+    Break(B),
+}
+
+pub mod reexport {
+    // @has foo/reexport/trait.FromResidual.html
+    // @has - '//pre[@class="rust item-decl"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { // Required method fn from_residual(residual: R) -> Self; }'
+    pub use issue_85454::*;
+}
diff --git a/tests/rustdoc/inline_cross/reexport-with-anonymous-lifetime-98697.rs b/tests/rustdoc/inline_cross/reexport-with-anonymous-lifetime-98697.rs
new file mode 100644
index 00000000000..fe6e5a39c81
--- /dev/null
+++ b/tests/rustdoc/inline_cross/reexport-with-anonymous-lifetime-98697.rs
@@ -0,0 +1,18 @@
+//@ aux-build:reexport-with-anonymous-lifetime-98697.rs
+//@ ignore-cross-compile
+#![crate_name = "foo"]
+
+// When reexporting a function with a HRTB with anonymous lifetimes,
+// make sure the anonymous lifetimes are not rendered.
+//
+// https://github.com/rust-lang/rust/issues/98697
+
+extern crate reexport_with_anonymous_lifetime_98697;
+
+// @has foo/fn.repro.html '//pre[@class="rust item-decl"]/code' 'fn repro<F>()where F: Fn(&str)'
+// @!has foo/fn.repro.html '//pre[@class="rust item-decl"]/code' 'for<'
+pub use reexport_with_anonymous_lifetime_98697::repro;
+
+// @has foo/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl MyTrait<&Extra> for Extra'
+// @!has foo/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl<'
+pub use reexport_with_anonymous_lifetime_98697::Extra;