From 31e5dd3a7942b35004f3a154c55728702f3dcb3e Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 7 Sep 2023 11:30:47 -0700 Subject: [PATCH] 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. --- tests/ui/trait-bounds/issue-82038.rs | 9 +++++++++ tests/ui/trait-bounds/issue-82038.stderr | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/ui/trait-bounds/issue-82038.rs create mode 100644 tests/ui/trait-bounds/issue-82038.stderr diff --git a/tests/ui/trait-bounds/issue-82038.rs b/tests/ui/trait-bounds/issue-82038.rs new file mode 100644 index 0000000000000..11de714faf014 --- /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() { + ::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 0000000000000..f37e3286f4bf8 --- /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 | ::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`.