about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-03-22 13:13:04 -0400
committerMichael Goulet <michael@errs.io>2024-03-22 13:20:54 -0400
commitc855bf62d7adf3f016637d57423d7f84ef15c334 (patch)
tree9824cdcbae404a2a732c1b17faf00e23a97e54e2
parent1447f9d38ca388ca178a544534b3cff72945fa1e (diff)
downloadrust-c855bf62d7adf3f016637d57423d7f84ef15c334.tar.gz
rust-c855bf62d7adf3f016637d57423d7f84ef15c334.zip
Add a test
-rw-r--r--tests/ui/associated-type-bounds/auxiliary/implied-predicates.rs7
-rw-r--r--tests/ui/associated-type-bounds/implied-predicates.rs8
-rw-r--r--tests/ui/associated-type-bounds/implied-predicates.stderr19
3 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/associated-type-bounds/auxiliary/implied-predicates.rs b/tests/ui/associated-type-bounds/auxiliary/implied-predicates.rs
new file mode 100644
index 00000000000..fe74c64fbe2
--- /dev/null
+++ b/tests/ui/associated-type-bounds/auxiliary/implied-predicates.rs
@@ -0,0 +1,7 @@
+pub trait Bar: Super<SuperAssoc: Bound> {}
+
+pub trait Super {
+    type SuperAssoc;
+}
+
+pub trait Bound {}
diff --git a/tests/ui/associated-type-bounds/implied-predicates.rs b/tests/ui/associated-type-bounds/implied-predicates.rs
new file mode 100644
index 00000000000..91b8a94c64f
--- /dev/null
+++ b/tests/ui/associated-type-bounds/implied-predicates.rs
@@ -0,0 +1,8 @@
+//@ aux-build:implied-predicates.rs
+
+extern crate implied_predicates;
+use implied_predicates::Bar;
+
+fn bar<B: Bar>() {}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/implied-predicates.stderr b/tests/ui/associated-type-bounds/implied-predicates.stderr
new file mode 100644
index 00000000000..6527f9f3641
--- /dev/null
+++ b/tests/ui/associated-type-bounds/implied-predicates.stderr
@@ -0,0 +1,19 @@
+error[E0277]: the trait bound `<B as Super>::SuperAssoc: implied_predicates::Bound` is not satisfied
+  --> $DIR/implied-predicates.rs:6:11
+   |
+LL | fn bar<B: Bar>() {}
+   |           ^^^ the trait `implied_predicates::Bound` is not implemented for `<B as Super>::SuperAssoc`
+   |
+note: required by a bound in `Bar`
+  --> $DIR/auxiliary/implied-predicates.rs:1:34
+   |
+LL | pub trait Bar: Super<SuperAssoc: Bound> {}
+   |                                  ^^^^^ required by this bound in `Bar`
+help: consider further restricting the associated type
+   |
+LL | fn bar<B: Bar>() where <B as Super>::SuperAssoc: implied_predicates::Bound {}
+   |                  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.