]> git.proxmox.com Git - rustc.git/blame - src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr
New upstream version 1.61.0+dfsg1
[rustc.git] / src / test / ui / missing-trait-bounds / missing-trait-bounds-for-method-call.stderr
CommitLineData
5869c6ff 1error[E0599]: the method `foo` exists for reference `&Foo<T>`, but its trait bounds were not satisfied
74b04a01
XL
2 --> $DIR/missing-trait-bounds-for-method-call.rs:14:14
3 |
4LL | struct Foo<T> {
5 | ------------- doesn't satisfy `Foo<T>: Bar`
6...
7LL | self.foo();
5869c6ff 8 | ^^^ method cannot be called on `&Foo<T>` due to unsatisfied trait bounds
74b04a01 9 |
ee023bcb
FG
10note: trait bound `T: Default` was not satisfied
11 --> $DIR/missing-trait-bounds-for-method-call.rs:10:9
12 |
13LL | impl<T: Default + Bar> Bar for Foo<T> {}
14 | ^^^^^^^ --- ------
15 | |
16 | unsatisfied trait bound introduced here
17note: trait bound `T: Bar` was not satisfied
18 --> $DIR/missing-trait-bounds-for-method-call.rs:10:19
19 |
20LL | impl<T: Default + Bar> Bar for Foo<T> {}
21 | ^^^ --- ------
22 | |
23 | unsatisfied trait bound introduced here
74b04a01
XL
24help: consider restricting the type parameters to satisfy the trait bounds
25 |
1b1a35ee 26LL | struct Foo<T> where T: Bar, T: Default {
94222f64 27 | ++++++++++++++++++++++++
74b04a01 28
5869c6ff 29error[E0599]: the method `foo` exists for reference `&Fin<T>`, but its trait bounds were not satisfied
74b04a01
XL
30 --> $DIR/missing-trait-bounds-for-method-call.rs:27:14
31 |
32LL | struct Fin<T> where T: Bar {
33 | -------------------------- doesn't satisfy `Fin<T>: Bar`
34...
35LL | self.foo();
5869c6ff 36 | ^^^ method cannot be called on `&Fin<T>` due to unsatisfied trait bounds
74b04a01 37 |
ee023bcb
FG
38note: trait bound `T: Default` was not satisfied
39 --> $DIR/missing-trait-bounds-for-method-call.rs:23:9
40 |
41LL | impl<T: Default + Bar> Bar for Fin<T> {}
42 | ^^^^^^^ --- ------
43 | |
44 | unsatisfied trait bound introduced here
74b04a01
XL
45help: consider restricting the type parameter to satisfy the trait bound
46 |
1b1a35ee 47LL | struct Fin<T> where T: Bar, T: Default {
94222f64 48 | ++++++++++++
74b04a01
XL
49
50error: aborting due to 2 previous errors
51
52For more information about this error, try `rustc --explain E0599`.