diff options
| author | Josef Reinhard Brandl <mail@josefbrandl.de> | 2018-06-23 13:32:53 +0200 |
|---|---|---|
| committer | Josef Reinhard Brandl <mail@josefbrandl.de> | 2018-06-23 18:29:56 +0200 |
| commit | 3bcb85ee658e7a5362f5e381c337f07381f916dc (patch) | |
| tree | 2b081a664a10700167ee929b579ec2fa6700ef6e /src/libstd/panic.rs | |
| parent | 56e8f29dbe89f2109cacc8eb5e92ea3de32eefb9 (diff) | |
| download | rust-3bcb85ee658e7a5362f5e381c337f07381f916dc.tar.gz rust-3bcb85ee658e7a5362f5e381c337f07381f916dc.zip | |
`PinMut`: Add safe `get_mut` and rename unsafe fns to `get_mut_unchecked` and `map_unchecked`
Diffstat (limited to 'src/libstd/panic.rs')
| -rw-r--r-- | src/libstd/panic.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index 2c11c262488..451420ae88a 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -327,14 +327,9 @@ impl<T: fmt::Debug> fmt::Debug for AssertUnwindSafe<T> { impl<'a, F: Future> Future for AssertUnwindSafe<F> { type Output = F::Output; - 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 - ); - - pinned_field.poll(cx) - } + fn poll(self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> { + let pinned_field = unsafe { PinMut::map_unchecked(self, |x| &mut x.0) }; + pinned_field.poll(cx) } } |
