Skip to content

Commit 20a16bb

Browse files
Add test
Co-authored-by: Georg Semmler <[email protected]>
1 parent ed7bdbb commit 20a16bb

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#![allow(unknown_or_malformed_diagnostic_attributes)]
2+
3+
trait Foo {}
4+
5+
#[diagnostic::do_not_recommend]
6+
impl<A> Foo for (A,) {}
7+
8+
#[diagnostic::do_not_recommend]
9+
impl<A, B> Foo for (A, B) {}
10+
11+
#[diagnostic::do_not_recommend]
12+
impl<A, B, C> Foo for (A, B, C) {}
13+
14+
impl Foo for i32 {}
15+
16+
fn check(a: impl Foo) {}
17+
18+
fn main() {
19+
check(());
20+
//~^ ERROR the trait bound `(): Foo` is not satisfied
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0277]: the trait bound `(): Foo` is not satisfied
2+
--> $DIR/do_not_apply_attribute_without_feature_flag.rs:19:11
3+
|
4+
LL | check(());
5+
| ----- ^^ the trait `Foo` is not implemented for `()`
6+
| |
7+
| required by a bound introduced by this call
8+
|
9+
= help: the following other types implement trait `Foo`:
10+
(A, B)
11+
(A, B, C)
12+
(A,)
13+
note: required by a bound in `check`
14+
--> $DIR/do_not_apply_attribute_without_feature_flag.rs:16:18
15+
|
16+
LL | fn check(a: impl Foo) {}
17+
| ^^^ required by this bound in `check`
18+
19+
error: aborting due to 1 previous error
20+
21+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)