about summary refs log tree commit diff
path: root/tests/rustdoc-ui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-ui')
-rw-r--r--tests/rustdoc-ui/auxiliary/issue-73061.rs17
-rw-r--r--tests/rustdoc-ui/ice-blanket-impl-56701.rs35
-rw-r--r--tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs15
3 files changed, 67 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/auxiliary/issue-73061.rs b/tests/rustdoc-ui/auxiliary/issue-73061.rs
new file mode 100644
index 00000000000..9a2e4aaf75e
--- /dev/null
+++ b/tests/rustdoc-ui/auxiliary/issue-73061.rs
@@ -0,0 +1,17 @@
+//@edition:2018
+
+#![feature(impl_trait_in_assoc_type)]
+
+pub trait Foo {
+    type X: std::future::Future<Output = ()>;
+    fn x(&self) -> Self::X;
+}
+
+pub struct F;
+
+impl Foo for F {
+    type X = impl std::future::Future<Output = ()>;
+    fn x(&self) -> Self::X {
+        async {}
+    }
+}
diff --git a/tests/rustdoc-ui/ice-blanket-impl-56701.rs b/tests/rustdoc-ui/ice-blanket-impl-56701.rs
new file mode 100644
index 00000000000..13b0fc9032a
--- /dev/null
+++ b/tests/rustdoc-ui/ice-blanket-impl-56701.rs
@@ -0,0 +1,35 @@
+//@ check-pass
+// This shouldn't cause a stack overflow when rustdoc is run
+// https://github.com/rust-lang/rust/issues/56701
+
+use std::ops::Deref;
+use std::ops::DerefMut;
+
+pub trait SimpleTrait {
+    type SimpleT;
+}
+
+impl<Inner: SimpleTrait, Outer: Deref<Target = Inner>> SimpleTrait for Outer {
+    type SimpleT = Inner::SimpleT;
+}
+
+pub trait AnotherTrait {
+    type AnotherT;
+}
+
+impl<T, Simple: SimpleTrait<SimpleT = Vec<T>>> AnotherTrait for Simple {
+    type AnotherT = T;
+}
+
+pub struct Unrelated<Inner, UnrelatedT: DerefMut<Target = Vec<Inner>>>(UnrelatedT);
+
+impl<Inner, UnrelatedT: DerefMut<Target = Vec<Inner>>> Deref for Unrelated<Inner, UnrelatedT> {
+    type Target = Vec<Inner>;
+
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+
+
+pub fn main() { }
diff --git a/tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs b/tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs
new file mode 100644
index 00000000000..1434bef49e0
--- /dev/null
+++ b/tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs
@@ -0,0 +1,15 @@
+// Regression test for ICE https://github.com/rust-lang/rust/issues/73061
+
+//@ check-pass
+//@ aux-build:issue-73061.rs
+
+extern crate issue_73061;
+
+pub struct Z;
+
+impl issue_73061::Foo for Z {
+    type X = <issue_73061::F as issue_73061::Foo>::X;
+    fn x(&self) -> Self::X {
+        issue_73061::F.x()
+    }
+}