about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-05-04 12:57:01 -0400
committerMichael Goulet <michael@errs.io>2024-05-04 12:57:01 -0400
commit50338aa59a2fe945f3f89cd72e0377f5b6a03d25 (patch)
treeffe93a24aad8c153b929e72fd0f7bba869894dda /tests
parentd7ea27808deb5e10a0f7384e339e4e6165e33398 (diff)
downloadrust-50338aa59a2fe945f3f89cd72e0377f5b6a03d25.tar.gz
rust-50338aa59a2fe945f3f89cd72e0377f5b6a03d25.zip
Record impl args in the proof tree
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs24
-rw-r--r--tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr23
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs
new file mode 100644
index 00000000000..840a4eb648c
--- /dev/null
+++ b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs
@@ -0,0 +1,24 @@
+//@ compile-flags: -Znext-solver
+
+trait Foo {}
+trait Bar {}
+trait Constrain {
+    type Output;
+}
+
+impl<T, U> Foo for T
+where
+    T: Constrain<Output = U>,
+    U: Bar,
+{
+}
+
+impl Constrain for () {
+    type Output = ();
+}
+
+fn needs_foo<T: Foo>() {}
+fn main() {
+    needs_foo::<()>();
+    //~^ the trait bound `(): Foo` is not satisfied
+}
diff --git a/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr
new file mode 100644
index 00000000000..6bf4e3cb534
--- /dev/null
+++ b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr
@@ -0,0 +1,23 @@
+error[E0277]: the trait bound `(): Foo` is not satisfied
+  --> $DIR/point-at-failing-nested.rs:22:17
+   |
+LL |     needs_foo::<()>();
+   |                 ^^ the trait `Bar` is not implemented for `()`, which is required by `(): Foo`
+   |
+note: required for `()` to implement `Foo`
+  --> $DIR/point-at-failing-nested.rs:9:12
+   |
+LL | impl<T, U> Foo for T
+   |            ^^^     ^
+...
+LL |     U: Bar,
+   |        --- unsatisfied trait bound introduced here
+note: required by a bound in `needs_foo`
+  --> $DIR/point-at-failing-nested.rs:20:17
+   |
+LL | fn needs_foo<T: Foo>() {}
+   |                 ^^^ required by this bound in `needs_foo`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.