Skip to content

Commit 419e200

Browse files
bryangarzaRalfJung
andauthored
Update tests/pass/move-data-across-await-point.rs
Co-authored-by: Ralf Jung <[email protected]>
1 parent c9b4846 commit 419e200

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/pass/move-data-across-await-point.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ use std::future::Future;
1111
async fn data_moved_async() {
1212
async fn helper(mut data: Vec<u8>, raw_pointer: *mut Vec<u8>) {
1313
let raw_pointer2 = &mut data as *mut Vec<u8>;
14-
// When the Vec is moved into the generator upvar, that copies the Vec's
15-
// ptr+capacity+len that is on the stack. Because of that, the value of
16-
// `raw_pointer2` is different than that of `raw_pointer`.
14+
// `raw_pointer` points to the original location where the Vec was stored in the caller.
15+
// `data` is where that Vec (to be precise, its ptr+capacity+len on-stack data)
16+
// got moved to. Those will usually not be the same since the Vec got moved twice
17+
// (into the function call, and then into the generator upvar).
1718
//
1819
// When copy propagation is enabled for generator upvars, the pointer
1920
// addresses should be equal, becouse there will no longer be a

0 commit comments

Comments
 (0)