From decc04dbfbfe240e649cd4f891ca14d2f501c0ff Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 27 Mar 2022 20:45:08 +0200 Subject: show suggestion to replace generic bounds with associated types in more cases --- src/test/ui/error-codes/E0107.rs | 10 ++++++++++ src/test/ui/error-codes/E0107.stderr | 18 +++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src/test/ui/error-codes') diff --git a/src/test/ui/error-codes/E0107.rs b/src/test/ui/error-codes/E0107.rs index 840700c9cc6..d369fc2a565 100644 --- a/src/test/ui/error-codes/E0107.rs +++ b/src/test/ui/error-codes/E0107.rs @@ -47,4 +47,14 @@ struct Baz<'a, 'b, 'c> { //~| HELP remove this lifetime argument } +pub trait T { + type A; + type B; +} + +fn trait_bound_generic>(_i: I) { + //~^ ERROR this trait takes 0 generic arguments + //~| HELP replace the generic bounds with the associated types +} + fn main() {} diff --git a/src/test/ui/error-codes/E0107.stderr b/src/test/ui/error-codes/E0107.stderr index c90f85df967..5ca03b45d82 100644 --- a/src/test/ui/error-codes/E0107.stderr +++ b/src/test/ui/error-codes/E0107.stderr @@ -128,6 +128,22 @@ note: struct defined here, with 0 lifetime parameters LL | struct Quux(T); | ^^^^ -error: aborting due to 9 previous errors +error[E0107]: this trait takes 0 generic arguments but 2 generic arguments were supplied + --> $DIR/E0107.rs:55:27 + | +LL | fn trait_bound_generic>(_i: I) { + | ^ expected 0 generic arguments + | +note: trait defined here, with 0 generic parameters + --> $DIR/E0107.rs:50:11 + | +LL | pub trait T { + | ^ +help: replace the generic bounds with the associated types + | +LL | fn trait_bound_generic>(_i: I) { + | ~~~~~~ ~~~~~~~ + +error: aborting due to 10 previous errors For more information about this error, try `rustc --explain E0107`. -- cgit 1.4.1-3-g733a5