Skip to content

Commit 79f02e4

Browse files
Rollup merge of rust-lang#56319 - RalfJung:async-mutable-ref, r=cramertj
fix futures creating aliasing mutable and shared ref Fixes the problem described in rust-lang/miri#532 (comment): `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"!
2 parents 9a5725c + 46a6831 commit 79f02e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libstd/future.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ where
9595
});
9696
let _reset_waker = SetOnDrop(waker_ptr);
9797

98-
let mut waker_ptr = waker_ptr.expect(
98+
let waker_ptr = waker_ptr.expect(
9999
"TLS LocalWaker not set. This is a rustc bug. \
100100
Please file an issue on https://github.com/rust-lang/rust.");
101-
unsafe { f(waker_ptr.as_mut()) }
101+
unsafe { f(waker_ptr.as_ref()) }
102102
}
103103

104104
#[unstable(feature = "gen_future", issue = "50547")]

0 commit comments

Comments
 (0)