fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.5 KiB39 linesraw
1error[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   |
4LL | struct Foo<T> {
5   | ------------- doesn't satisfy `Foo<T>: Bar`
6...
7LL |         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`
15help: consider restricting the type parameters to satisfy the trait bounds
16   |
17LL | struct Foo<T> where T: Bar, T: std::default::Default {
18   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
20error[E0599]: no method named `foo` found for reference `&Fin<T>` in the current scope
21  --> $DIR/missing-trait-bounds-for-method-call.rs:27:14
22   |
23LL | struct Fin<T> where T: Bar {
24   | -------------------------- doesn't satisfy `Fin<T>: Bar`
25...
26LL |         self.foo();
27   |              ^^^ method not found in `&Fin<T>`
28   |
29   = note: the method `foo` exists but the following trait bounds were not satisfied:
30           `T: std::default::Default`
31           which is required by `Fin<T>: Bar`
32help: consider restricting the type parameter to satisfy the trait bound
33   |
34LL | struct Fin<T> where T: Bar, T: std::default::Default {
35   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
36
37error: aborting due to 2 previous errors
38
39For more information about this error, try `rustc --explain E0599`.