rust/tests/ui/self/arbitrary_self_types_needin...

44 lines
1.8 KiB
Plaintext

error[E0599]: no method named `m` found for type parameter `T` in the current scope
--> $DIR/arbitrary_self_types_needing_box_or_arc_wrapping.rs:6:11
|
LL | trait Foo { fn m(self: Box<Self>); }
| - --------- the method might not be found because of this arbitrary self type
| |
| the method is available for `Box<T>` here
LL | fn foo<T: Foo>(a: T) {
| - method `m` not found for this type parameter
LL | a.m();
| ^ method not found in `T`
...
LL | trait Bar { fn m(self: Arc<Self>); }
| --------- the method might not be found because of this arbitrary self type
|
help: consider wrapping the receiver expression with the appropriate type
|
LL | Box::new(a).m();
| +++++++++ +
error[E0599]: no method named `m` found for type parameter `impl Bar` in the current scope
--> $DIR/arbitrary_self_types_needing_box_or_arc_wrapping.rs:13:11
|
LL | trait Foo { fn m(self: Box<Self>); }
| --------- the method might not be found because of this arbitrary self type
...
LL | trait Bar { fn m(self: Arc<Self>); }
| - --------- the method might not be found because of this arbitrary self type
| |
| the method is available for `Arc<impl Bar>` here
LL | fn bar(b: impl Bar) {
| -------- method `m` not found for this type parameter
LL | b.m();
| ^ method not found in `impl Bar`
|
help: consider wrapping the receiver expression with the appropriate type
|
LL | Arc::new(b).m();
| +++++++++ +
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0599`.