5

Tracking issue for Box::into_pin (feature `box_into_pin`) · Issue #62370 · rust-...

 2 years ago
source link: https://github.com/rust-lang/rust/issues/62370
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Member

Author

Nemo157 commented on Jul 4, 2019

I don't think this is really a useful feature to specialize in this way. Can't you just use the hyper fish operator to disambiguate?
@czipperz (#57313 (comment))

There are currently 2 unambiguous stable ways to convert a Box<T> into a Pin<Box<T>> without additional inference constraints

let foo: Box<T> = ...;
let bar = <Pin<Box<_>>>::from(foo);
let bar: Pin<Box<_>> = foo.into();

Also, at the moment let bar = Pin::from(foo); works because there is only one trait implementation that can satisfy that call, but because Pin and Box are #[fundamental] it's possible for an external library to add an additional From implementation that makes that ambiguous (playground).

In a lot of cases where you need to convert into a Pin<Box<_>> you're likely to have inference available to guide the .into() call as well, but not always.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK