forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#106699 - eholk:await-chains-drop-tracking, …
…r=wesleywiser [drop tracking] Visit break expressions This fixes rust-lang#102383 by remembering to visit the expression in `break expr` when building the drop tracking CFG. Missing this step was causing an off-by-one error which meant after a number of awaits we'd be looking for dropped values at the wrong point in the code. Additionally, this changes the order of traversal for assignment expressions to visit the rhs and then the lhs. This matches what is done elsewhere. Finally, this improves some of the debugging output (for example, the CFG visualizer) to make it easier to figure out these sorts of issues.
- Loading branch information
Showing
4 changed files
with
61 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// edition:2021 | ||
// compile-flags: -Z drop-tracking | ||
// build-pass | ||
|
||
use std::collections::HashMap; | ||
|
||
fn main() { | ||
let _ = real_main(); | ||
} | ||
|
||
async fn nop() {} | ||
|
||
async fn real_main() { | ||
nop().await; | ||
nop().await; | ||
nop().await; | ||
nop().await; | ||
|
||
let mut map: HashMap<(), ()> = HashMap::new(); | ||
map.insert((), nop().await); | ||
} |