Co-authored-by: Georg Semmler <github@weiznich.de>
This commit is contained in:
Michael Goulet 2024-08-09 21:14:07 -04:00
parent ed7bdbb17b
commit 20a16bb3c5
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#![allow(unknown_or_malformed_diagnostic_attributes)]
trait Foo {}
#[diagnostic::do_not_recommend]
impl<A> Foo for (A,) {}
#[diagnostic::do_not_recommend]
impl<A, B> Foo for (A, B) {}
#[diagnostic::do_not_recommend]
impl<A, B, C> Foo for (A, B, C) {}
impl Foo for i32 {}
fn check(a: impl Foo) {}
fn main() {
check(());
//~^ ERROR the trait bound `(): Foo` is not satisfied
}

View File

@ -0,0 +1,21 @@
error[E0277]: the trait bound `(): Foo` is not satisfied
--> $DIR/do_not_apply_attribute_without_feature_flag.rs:19:11
|
LL | check(());
| ----- ^^ the trait `Foo` is not implemented for `()`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `Foo`:
(A, B)
(A, B, C)
(A,)
note: required by a bound in `check`
--> $DIR/do_not_apply_attribute_without_feature_flag.rs:16:18
|
LL | fn check(a: impl Foo) {}
| ^^^ required by this bound in `check`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.