about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-09-08 08:23:04 +0200
committerGitHub <noreply@github.com>2023-09-08 08:23:04 +0200
commit7ec813643a8a3fee0c5d2e1b62aec76cb212ab8b (patch)
tree7dbe743d9458963a960df5376ec9f0cd405d0f64 /tests
parent1979772772ff2df5fecb2b9e9e4bf08e4763a29b (diff)
parent31e5dd3a7942b35004f3a154c55728702f3dcb3e (diff)
downloadrust-7ec813643a8a3fee0c5d2e1b62aec76cb212ab8b.tar.gz
rust-7ec813643a8a3fee0c5d2e1b62aec76cb212ab8b.zip
Rollup merge of #115649 - notriddle:notriddle/82038, r=compiler-errors
diagnostics: add test case for trait bounds diagnostic

Closes #82038

It was fixed by https://github.com/rust-lang/rust/pull/89580, a wide-reaching obligation tracking improvement. This commit adds a test case.
Diffstat (limited to 'tests')
-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`.