about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2021-04-23 17:01:27 +0100
committermarmeladema <xademax@gmail.com>2021-04-23 17:54:48 +0100
commit8f41de595d2969e383cb681bd65b36c061fc346a (patch)
treedde8359ff23077c151c1b8e391f7d5f55d6f1248 /src/test
parent9a352326112e4fd993e339cbd4eabae06d4979b9 (diff)
downloadrust-8f41de595d2969e383cb681bd65b36c061fc346a.tar.gz
rust-8f41de595d2969e383cb681bd65b36c061fc346a.zip
Add test for issue #83017
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/associated-type-bounds/issue-83017.rs39
-rw-r--r--src/test/ui/associated-type-bounds/issue-83017.stderr27
2 files changed, 66 insertions, 0 deletions
diff --git a/src/test/ui/associated-type-bounds/issue-83017.rs b/src/test/ui/associated-type-bounds/issue-83017.rs
new file mode 100644
index 00000000000..8f0a9ea3566
--- /dev/null
+++ b/src/test/ui/associated-type-bounds/issue-83017.rs
@@ -0,0 +1,39 @@
+#![feature(associated_type_bounds)]
+
+trait TraitA<'a> {
+    type AsA;
+}
+
+trait TraitB<'a, 'b> {
+    type AsB;
+}
+
+trait TraitC<'a, 'b, 'c> {}
+
+struct X;
+
+impl<'a, 'b, 'c> TraitC<'a, 'b, 'c> for X {}
+
+struct Y;
+
+impl<'a, 'b> TraitB<'a, 'b> for Y {
+    type AsB = X;
+}
+
+struct Z;
+
+impl<'a> TraitA<'a> for Z {
+    type AsA = Y;
+}
+
+fn foo<T>()
+where
+    for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>,
+{
+}
+
+fn main() {
+    foo::<Z>();
+    //~^ ERROR: the trait bound `for<'a, 'b> <Z as TraitA<'a>>::AsA: TraitB<'a, 'b>` is not satisfied
+    //~| ERROR: the trait bound `for<'a, 'b, 'c> <<Z as TraitA<'a>>::AsA as TraitB<'a, 'b>>::AsB: TraitC<'a, 'b, 'c>` is not satisfied
+}
diff --git a/src/test/ui/associated-type-bounds/issue-83017.stderr b/src/test/ui/associated-type-bounds/issue-83017.stderr
new file mode 100644
index 00000000000..4eb71fd0287
--- /dev/null
+++ b/src/test/ui/associated-type-bounds/issue-83017.stderr
@@ -0,0 +1,27 @@
+error[E0277]: the trait bound `for<'a, 'b> <Z as TraitA<'a>>::AsA: TraitB<'a, 'b>` is not satisfied
+  --> $DIR/issue-83017.rs:36:5
+   |
+LL | fn foo<T>()
+   |    --- required by a bound in this
+LL | where
+LL |     for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>,
+   |                                ------------------------------------------------------- required by this bound in `foo`
+...
+LL |     foo::<Z>();
+   |     ^^^^^^^^ the trait `for<'a, 'b> TraitB<'a, 'b>` is not implemented for `<Z as TraitA<'a>>::AsA`
+
+error[E0277]: the trait bound `for<'a, 'b, 'c> <<Z as TraitA<'a>>::AsA as TraitB<'a, 'b>>::AsB: TraitC<'a, 'b, 'c>` is not satisfied
+  --> $DIR/issue-83017.rs:36:5
+   |
+LL | fn foo<T>()
+   |    --- required by a bound in this
+LL | where
+LL |     for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>,
+   |                                                            -------------------------- required by this bound in `foo`
+...
+LL |     foo::<Z>();
+   |     ^^^^^^^^ the trait `for<'a, 'b, 'c> TraitC<'a, 'b, 'c>` is not implemented for `<<Z as TraitA<'a>>::AsA as TraitB<'a, 'b>>::AsB`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.