You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Various types can be used as method receivers, such as Rc<>, Box<> and
Arc<>. The arbitrary self types v2 work allows further types to be made
method receivers by implementing the Receiver trait.
With that in mind, it may come as a surprise to people when certain
common types do not implement Receiver and thus cannot be used as a
method receiver.
The RFC for arbitrary self types v2 therefore proposes emitting specific
lint hints for these cases:
* NonNull
* Weak
* Raw pointers
The code already emits a hint for this third case, in that it advises
folks that the `arbitrary_self_types_pointers` feature may meet their
need. This PR adds diagnostic hints for the Weak and NonNull cases.
consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
= note: type of `self` must be `Self` or some type implementing `Receiver`
8
+
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
9
+
= note: `NonNull` does not implement `Receiver`; consider wrapping your `NonNull` in a newtype wrapper for which you implement `Receiver`
= note: type of `self` must be `Self` or some type implementing `Receiver`
18
+
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
19
+
= note: `NonNull` does not implement `Receiver`; consider wrapping your `NonNull` in a newtype wrapper for which you implement `Receiver`
20
+
21
+
error: aborting due to 2 previous errors
22
+
23
+
For more information about this error, try `rustc --explain E0307`.
= note: type of `self` must be `Self` or some type implementing `Receiver`
8
+
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
9
+
= note: `Weak` does not implement `Receiver`; consider wrapping your `Weak` in a newtype wrapper for which you implement `Receiver`
= note: type of `self` must be `Self` or some type implementing `Receiver`
18
+
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
19
+
= note: `Weak` does not implement `Receiver`; consider wrapping your `Weak` in a newtype wrapper for which you implement `Receiver`
20
+
21
+
error: aborting due to 2 previous errors
22
+
23
+
For more information about this error, try `rustc --explain E0307`.
0 commit comments