about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-09-07 11:30:47 -0700
committerMichael Howell <michael@notriddle.com>2023-09-07 11:36:23 -0700
commit31e5dd3a7942b35004f3a154c55728702f3dcb3e (patch)
tree85850ddbc44569dfb6025948c967d711171715e4
parent70c7e4d21c7249af4222a10d09dc03286aa1e787 (diff)
downloadrust-31e5dd3a7942b35004f3a154c55728702f3dcb3e.tar.gz
rust-31e5dd3a7942b35004f3a154c55728702f3dcb3e.zip
diagnostics: add test case for trait bounds diagnostic
Closes #82038

It was fixed by b8e5ab20ed7a7677a998a163ccf7853764b195e6, a wide-reaching
obligation tracking improvement. This commit adds a test case.
-rw-r--r--tests/ui/trait-bounds/issue-82038.rs9
-rw-r--r--tests/ui/trait-bounds/issue-82038.stderr9
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/trait-bounds/issue-82038.rs b/tests/ui/trait-bounds/issue-82038.rs
new file mode 100644
index 00000000000..11de714faf0
--- /dev/null
+++ b/tests/ui/trait-bounds/issue-82038.rs
@@ -0,0 +1,9 @@
+// Failed bound `bool: Foo` must not point at the `Self: Clone` line
+
+trait Foo {
+    fn my_method() where Self: Clone;
+}
+
+fn main() {
+    <bool as Foo>::my_method(); //~ERROR [E0277]
+}
diff --git a/tests/ui/trait-bounds/issue-82038.stderr b/tests/ui/trait-bounds/issue-82038.stderr
new file mode 100644
index 00000000000..f37e3286f4b
--- /dev/null
+++ b/tests/ui/trait-bounds/issue-82038.stderr
@@ -0,0 +1,9 @@
+error[E0277]: the trait bound `bool: Foo` is not satisfied
+  --> $DIR/issue-82038.rs:8:6
+   |
+LL |     <bool as Foo>::my_method();
+   |      ^^^^ the trait `Foo` is not implemented for `bool`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.