]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr
keep predicate order and tweak output
[rust.git] / src / test / ui / suggestions / missing-trait-bounds-for-method-call.stderr
1 error[E0599]: no method named `foo` found for reference `&Foo<T>` in the current scope
2   --> $DIR/missing-trait-bounds-for-method-call.rs:14:14
3    |
4 LL | struct Foo<T> {
5    | ------------- doesn't satisfy `Foo<T>: Bar`
6 ...
7 LL |         self.foo();
8    |              ^^^ method not found in `&Foo<T>`
9    |
10    = note: the method `foo` exists but the following trait bounds were not satisfied:
11            `T: Bar`
12            which is required by `Foo<T>: Bar`
13            `T: std::default::Default`
14            which is required by `Foo<T>: Bar`
15    = help: items from traits can only be used if the trait is implemented and in scope
16 note: `Bar` defines an item `foo`, perhaps you need to implement it
17   --> $DIR/missing-trait-bounds-for-method-call.rs:6:1
18    |
19 LL | trait Bar {
20    | ^^^^^^^^^
21 help: consider restricting the type parameters to satisfy the obligations
22    |
23 LL | struct Foo<T> where T: Bar, T: std::default::Default {
24    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25
26 error[E0599]: no method named `foo` found for reference `&Fin<T>` in the current scope
27   --> $DIR/missing-trait-bounds-for-method-call.rs:27:14
28    |
29 LL | struct Fin<T> where T: Bar {
30    | -------------------------- doesn't satisfy `Fin<T>: Bar`
31 ...
32 LL |         self.foo();
33    |              ^^^ method not found in `&Fin<T>`
34    |
35    = note: the method `foo` exists but the following trait bounds were not satisfied:
36            `T: std::default::Default`
37            which is required by `Fin<T>: Bar`
38    = help: items from traits can only be used if the trait is implemented and in scope
39 note: `Bar` defines an item `foo`, perhaps you need to implement it
40   --> $DIR/missing-trait-bounds-for-method-call.rs:6:1
41    |
42 LL | trait Bar {
43    | ^^^^^^^^^
44 help: consider restricting the type parameter to satisfy the obligation
45    |
46 LL | struct Fin<T> where T: Bar, T: std::default::Default {
47    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
48
49 error: aborting due to 2 previous errors
50
51 For more information about this error, try `rustc --explain E0599`.