|
| 1 | +error[E0599]: no method named `m` found for type parameter `T` in the current scope |
| 2 | + --> $DIR/arbitrary_self_types_needing_box_or_arc_wrapping.rs:6:11 |
| 3 | + | |
| 4 | +LL | trait Foo { fn m(self: Box<Self>); } |
| 5 | + | - --------- the method might not be found because of this arbitrary self type |
| 6 | + | | |
| 7 | + | the method is available for `Box<T>` here |
| 8 | +LL | fn foo<T: Foo>(a: T) { |
| 9 | + | - method `m` not found for this type parameter |
| 10 | +LL | a.m(); |
| 11 | + | ^ method not found in `T` |
| 12 | +... |
| 13 | +LL | trait Bar { fn m(self: Arc<Self>); } |
| 14 | + | --------- the method might not be found because of this arbitrary self type |
| 15 | + | |
| 16 | +help: consider wrapping the receiver expression with the appropriate type |
| 17 | + | |
| 18 | +LL | Box::new(a).m(); |
| 19 | + | +++++++++ + |
| 20 | + |
| 21 | +error[E0599]: no method named `m` found for type parameter `impl Bar` in the current scope |
| 22 | + --> $DIR/arbitrary_self_types_needing_box_or_arc_wrapping.rs:13:11 |
| 23 | + | |
| 24 | +LL | trait Foo { fn m(self: Box<Self>); } |
| 25 | + | --------- the method might not be found because of this arbitrary self type |
| 26 | +... |
| 27 | +LL | trait Bar { fn m(self: Arc<Self>); } |
| 28 | + | - --------- the method might not be found because of this arbitrary self type |
| 29 | + | | |
| 30 | + | the method is available for `Arc<impl Bar>` here |
| 31 | +LL | fn bar(b: impl Bar) { |
| 32 | + | -------- method `m` not found for this type parameter |
| 33 | +LL | b.m(); |
| 34 | + | ^ method not found in `impl Bar` |
| 35 | + | |
| 36 | +help: consider wrapping the receiver expression with the appropriate type |
| 37 | + | |
| 38 | +LL | Arc::new(b).m(); |
| 39 | + | +++++++++ + |
| 40 | + |
| 41 | +error: aborting due to 2 previous errors |
| 42 | + |
| 43 | +For more information about this error, try `rustc --explain E0599`. |
0 commit comments