Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't incorrectly mark blocks in generator drop shims as cleanup
This also ensure that dropping a generator won't leak upvars if dropping one of them panics
- Loading branch information
1 parent
2131b15
commit 8a78019
Showing
2 changed files
with
65 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#![feature(generators, generator_trait)] | ||
|
||
// Regression test for #58892, generator drop shims should not have blocks | ||
// spuriously marked as cleanup | ||
|
||
fn main() { | ||
let gen = || { | ||
yield; | ||
}; | ||
} | ||
|
||
// END RUST SOURCE | ||
|
||
// START rustc.main-{{closure}}.generator_drop.0.mir | ||
// bb0: { | ||
// switchInt(((*_1).0: u32)) -> [0u32: bb4, 3u32: bb7, otherwise: bb8]; | ||
// } | ||
// bb1: { | ||
// goto -> bb5; | ||
// } | ||
// bb2: { | ||
// return; | ||
// } | ||
// bb3: { | ||
// return; | ||
// } | ||
// bb4: { | ||
// goto -> bb6; | ||
// } | ||
// bb5: { | ||
// goto -> bb2; | ||
// } | ||
// bb6: { | ||
// goto -> bb3; | ||
// } | ||
// bb7: { | ||
// StorageLive(_3); | ||
// goto -> bb1; | ||
// } | ||
// bb8: { | ||
// return; | ||
// } | ||
// END rustc.main-{{closure}}.generator_drop.0.mir |