about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-06-26 16:13:52 +0000
committerbors <bors@rust-lang.org>2021-06-26 16:13:52 +0000
commit3ddb78a34608848a60f6ca5b6ccfde8340302372 (patch)
tree0a83949d4e595cd47c6e09c51f5ce8e13af51dda /src/test/rustdoc
parentf2571a2dd68ff1d84b5df07cb38831627df6aaff (diff)
parentf14bdb506a89afaf634b68a4292ad9cf6014f60c (diff)
downloadrust-3ddb78a34608848a60f6ca5b6ccfde8340302372.tar.gz
rust-3ddb78a34608848a60f6ca5b6ccfde8340302372.zip
Auto merge of #86449 - Stupremee:render-self-cast-in-type-bound, r=GuillaumeGomez
rustdoc: Render `<Self as X>::Y` type casts properly across crate bounds

My last PR that introduced the type casting did not work for cross-crate re-exported traits, which is fixed in this PR.

Fully resolves #85454
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/auxiliary/issue-85454.rs17
-rw-r--r--src/test/rustdoc/issue-85454.rs14
2 files changed, 30 insertions, 1 deletions
diff --git a/src/test/rustdoc/auxiliary/issue-85454.rs b/src/test/rustdoc/auxiliary/issue-85454.rs
new file mode 100644
index 00000000000..45664dfc382
--- /dev/null
+++ b/src/test/rustdoc/auxiliary/issue-85454.rs
@@ -0,0 +1,17 @@
+// @has issue_85454/trait.FromResidual.html
+// @has - '//pre[@class="rust trait"]' '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/src/test/rustdoc/issue-85454.rs b/src/test/rustdoc/issue-85454.rs
index 45664dfc382..3351b5c8350 100644
--- a/src/test/rustdoc/issue-85454.rs
+++ b/src/test/rustdoc/issue-85454.rs
@@ -1,4 +1,10 @@
-// @has issue_85454/trait.FromResidual.html
+// aux-build:issue-85454.rs
+// build-aux-docs
+#![crate_name = "foo"]
+
+extern crate issue_85454;
+
+// @has foo/trait.FromResidual.html
 // @has - '//pre[@class="rust trait"]' '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;
@@ -15,3 +21,9 @@ pub enum ControlFlow<B, C = ()> {
     Continue(C),
     Break(B),
 }
+
+pub mod reexport {
+    // @has foo/reexport/trait.FromResidual.html
+    // @has - '//pre[@class="rust trait"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }'
+    pub use issue_85454::*;
+}