]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / suggestions / move-generic-to-trait-in-method-with-params.rs
1 // Generalizes the suggestion introduced in #100838
2
3 trait Foo<T> {
4     fn bar(&self, _: T);
5 }
6
7 impl Foo<i32> for i32 {
8     fn bar(&self, x: i32) {
9         println!("{}", self + x);
10     }
11 }
12
13 fn main() {
14     1.bar::<i32>(0);
15     //~^ ERROR this associated function takes 0 generic arguments but 1 generic argument was supplied
16     //~| HELP consider moving this generic argument to the `Foo` trait, which takes up to 1 argument
17     //~| HELP remove these generics
18 }