Improve Box<T> -> Pin<Box<T>> conversion#57313
Conversation
|
r? @KodrAus (rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @cramertj |
|
I feel sort of odd about having |
|
Since this is unstable it doesn't need an FCP, but should this also be added to |
|
@alexcrichton No, this method wouldn't be safe on |
|
Sure thing @bors: r=cramertj |
|
📌 Commit d1a42ea has been approved by |
Improve Box<T> -> Pin<Box<T>> conversion I found the `From` trait conversion for this very hard to find, having a named function for it is much more discoverable. Also fixes rust-lang#56256 as I need that in the place I'm using this. Has a placeholder tracking issue, will file an issue once I get feedback.
Rollup of 17 pull requests Successful merges: - #57219 (Remove some unused code) - #57229 (Fix #56806 by using `delay_span_bug` in object safety layout sanity checks) - #57233 (Rename and fix nolink-with-link-args test) - #57238 (Fix backtraces for inlined functions on Windows) - #57249 (Fix broken links to second edition TRPL.) - #57267 (src/jemalloc is gone, remove its mention from COPYRIGHT) - #57273 (Update the stdsimd submodule) - #57278 (Add Clippy to config.toml.example) - #57295 (Fix 'be be' constructs) - #57311 (VaList::copy should not require a mutable ref) - #57312 (`const fn` is no longer coming soon (const keyword docs)) - #57313 (Improve Box<T> -> Pin<Box<T>> conversion) - #57314 (Fix repeated word typos) - #57326 (Doc rewording, use the same name `writer`) - #57338 (rustdoc: force binary filename for compiled doctests) - #57342 (librustc_mir: Make qualify_min_const_fn module public) - #57343 (Calculate privacy access only via query) Failed merges: - #57340 (Use correct tracking issue for c_variadic) r? @ghost
|
Funny enough, today I found this function and asked myself why the heck does it exist? It clearly states, that |
|
I see, but |
|
Yep, but when implementing that originally I didn’t even think of |
|
If you want to be explicit, you could just use |
|
@czipperz it's interesting that that works, but it's relying on the currently unique implementation of |
|
I misread the code as a method rather than a function. IE |
|
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? |
|
Like do people really implement this sort of functionality? It seems like there isn't really a reason for this feature to exist imo. |
I found the
Fromtrait conversion for this very hard to find, having a named function for it is much more discoverable. Also fixes #56256 as I need that in the place I'm using this.Has a placeholder tracking issue, will file an issue once I get feedback.