diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-11-29 13:10:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-29 13:10:50 +0100 |
| commit | 79f02e4b332cdca24de1d065cf0b0c326e021711 (patch) | |
| tree | 997a46d1b3dbedfe23ba9a9c4a841563dc6bf175 /src/libstd | |
| parent | 9a5725c77a1df3bd5dfa88cb57ef0f7d284057a1 (diff) | |
| parent | 46a683111d4827800aae5eab4875c23089dce17e (diff) | |
| download | rust-79f02e4b332cdca24de1d065cf0b0c326e021711.tar.gz rust-79f02e4b332cdca24de1d065cf0b0c326e021711.zip | |
Rollup merge of #56319 - RalfJung:async-mutable-ref, r=cramertj
fix futures creating aliasing mutable and shared ref Fixes the problem described in https://github.com/solson/miri/issues/532#issuecomment-442552764: `set_task_waker` takes a shared reference and puts a copy into the TLS (in a `NonNull`), but `get_task_waker` gets it back out as a mutable reference. That violates "mutable references must not alias anything"!
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/future.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/future.rs b/src/libstd/future.rs index 1cadbdc66c3..d5e6cab948b 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -95,10 +95,10 @@ where }); let _reset_waker = SetOnDrop(waker_ptr); - let mut waker_ptr = waker_ptr.expect( + let waker_ptr = waker_ptr.expect( "TLS LocalWaker not set. This is a rustc bug. \ Please file an issue on https://github.com/rust-lang/rust."); - unsafe { f(waker_ptr.as_mut()) } + unsafe { f(waker_ptr.as_ref()) } } #[unstable(feature = "gen_future", issue = "50547")] |
