-
Notifications
You must be signed in to change notification settings - Fork 13.4k
New safe associated functions for PinMut #51730
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
befe49d
to
537514a
Compare
I'm pretty sure the I suggest to only change EDIT: Oh, there is a |
src/libstd/panic.rs
Outdated
@@ -330,7 +330,7 @@ impl<'a, F: Future> Future for AssertUnwindSafe<F> { | |||
fn poll(mut self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> { | |||
unsafe { | |||
let pinned_field = PinMut::new_unchecked( | |||
&mut PinMut::get_mut(self.reborrow()).0 | |||
&mut PinMut::get_mut_unchecked(self.reborrow()).0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this use PinMut::map_unchecked
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jep. Good point. I changed it
537514a
to
35178a8
Compare
I've now removed safe |
35178a8
to
75509b8
Compare
src/libstd/panic.rs
Outdated
pinned_field.poll(cx) | ||
} | ||
let pinned_field = unsafe { PinMut::map_unchecked(self, |x| x.0) }; | ||
pinned_field.poll() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the cx
argument missing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^' yes. Added it
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@TimNN ^ empty log |
75509b8
to
e352d6c
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
…ked` and `map_unchecked`
e352d6c
to
3bcb85e
Compare
You're closer to the Pin stuff than me 😄 |
The unsafe map function is pretty valuable, but I don't see much utility in a safe version with unpin bounds since you could write it using |
I'm for calling it |
I like |
That makes sense. I was worried about the ergonomic cost of @bors r+ |
📌 Commit 3bcb85e has been approved by |
@bors r- I don't think this is beneficial; we already have |
Sorry, I'm on inflight wifi, loaded the tracking issue and see the lifetime difference now. @bors r+ |
📌 Commit 3bcb85e has been approved by |
…d, r=withoutboats New safe associated functions for PinMut - Add safe `get_mut` and `map` - Rename unsafe equivalents to `get_mut_unchecked` and `map_unchecked` The discussion about this starts [in this comment](rust-lang#49150 (comment)) on the tracking issue.
Rollup of 11 pull requests Successful merges: - #51104 (add `dyn ` to display of dynamic (trait) types) - #51153 (Link panic and compile_error docs) - #51642 (Fix unknown windows build) - #51730 (New safe associated functions for PinMut) - #51731 (Fix ICEs when using continue as an array length inside closures (inside loop conditions)) - #51747 (Add error for using null characters in #[export_name]) - #51769 (Update broken rustc-guide links) - #51786 (Remove unnecessary stat64 pointer casts) - #51788 (Fix typo) - #51789 (Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`) - #51791 (Minify css) Failed merges: r? @ghost
get_mut
andmap
get_mut_unchecked
andmap_unchecked
The discussion about this starts in this comment on the tracking issue.