]> git.lizzy.rs Git - rust.git/blob - tests/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr
Rollup merge of #106820 - m-ou-se:macro-type-error-thing, r=estebank
[rust.git] / tests / ui / missing-trait-bounds / missing-trait-bounds-for-method-call.stderr
1 error[E0599]: the method `foo` exists for reference `&Foo<T>`, but its trait bounds were not satisfied
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 cannot be called on `&Foo<T>` due to unsatisfied trait bounds
9    |
10 note: the following trait bounds were not satisfied:
11       `T: Bar`
12       `T: Default`
13   --> $DIR/missing-trait-bounds-for-method-call.rs:10:9
14    |
15 LL | impl<T: Default + Bar> Bar for Foo<T> {}
16    |         ^^^^^^^   ^^^  ---     ------
17    |         |         |
18    |         |         unsatisfied trait bound introduced here
19    |         unsatisfied trait bound introduced here
20 help: consider restricting the type parameters to satisfy the trait bounds
21    |
22 LL | struct Foo<T> where T: Bar, T: Default {
23    |               ++++++++++++++++++++++++
24
25 error[E0599]: the method `foo` exists for reference `&Fin<T>`, but its trait bounds were not satisfied
26   --> $DIR/missing-trait-bounds-for-method-call.rs:27:14
27    |
28 LL | struct Fin<T> where T: Bar {
29    | ------------- doesn't satisfy `Fin<T>: Bar`
30 ...
31 LL |         self.foo();
32    |              ^^^ method cannot be called on `&Fin<T>` due to unsatisfied trait bounds
33    |
34 note: trait bound `T: Default` was not satisfied
35   --> $DIR/missing-trait-bounds-for-method-call.rs:23:9
36    |
37 LL | impl<T: Default + Bar> Bar for Fin<T> {}
38    |         ^^^^^^^        ---     ------
39    |         |
40    |         unsatisfied trait bound introduced here
41 help: consider restricting the type parameter to satisfy the trait bound
42    |
43 LL | struct Fin<T> where T: Bar, T: Default {
44    |                           ++++++++++++
45
46 error: aborting due to 2 previous errors
47
48 For more information about this error, try `rustc --explain E0599`.