-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #102394 - dingxiangfei2009:issue-102317, r=oli-obk
Fix unwind drop glue for if-then scopes cc `@est31` Fix #102317 Fix #99852 This PR fixes the drop glue for unwinding from a panic originated in a drop while breaking out for the else block in an `if-then` scope. MIR validation does not fail for the synchronous versions of the test program, because `StorageDead` statements are skipped over in the unwinding process. It is only becoming a problem when it is inside a generator where `StorageDead` must be kept around.
- Loading branch information
Showing
6 changed files
with
76 additions
and
19 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
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,20 @@ | ||
// issue #102317 | ||
// build-pass | ||
// compile-flags: --edition 2021 -C opt-level=3 -Zvalidate-mir | ||
|
||
struct SegmentJob; | ||
|
||
impl Drop for SegmentJob { | ||
fn drop(&mut self) {} | ||
} | ||
|
||
pub async fn run() -> Result<(), ()> { | ||
let jobs = Vec::<SegmentJob>::new(); | ||
let Some(_job) = jobs.into_iter().next() else { | ||
return Ok(()) | ||
}; | ||
|
||
Ok(()) | ||
} | ||
|
||
fn main() {} |
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,24 @@ | ||
// check-pass | ||
// compile-flags: -Z validate-mir | ||
#![feature(let_chains)] | ||
|
||
fn lambda<T, U>() -> U | ||
where | ||
T: Default, | ||
U: Default, | ||
{ | ||
let foo: Result<T, ()> = Ok(T::default()); | ||
let baz: U = U::default(); | ||
|
||
if let Ok(foo) = foo && let Ok(bar) = transform(foo) { | ||
bar | ||
} else { | ||
baz | ||
} | ||
} | ||
|
||
fn transform<T, U>(input: T) -> Result<U, ()> { | ||
todo!() | ||
} | ||
|
||
fn main() {} |