forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 3
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 rust-lang#129582 - nbdd0121:unwind, r=nnethercote
Make destructors on `extern "C"` frames to be executed This would make the example in rust-lang#123231 print "Noisy Drop". I didn't mark this as fixing the issue because the behaviour is yet to be spec'ed. Tracking: - rust-lang#74990
- Loading branch information
Showing
8 changed files
with
99 additions
and
17 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,25 @@ | ||
//@ needs-unwind | ||
|
||
struct Noise; | ||
impl Drop for Noise { | ||
fn drop(&mut self) { | ||
eprintln!("Noisy Drop"); | ||
} | ||
} | ||
|
||
fn panic() { | ||
panic!(); | ||
} | ||
|
||
// EMIT_MIR c_unwind_terminate.test.AbortUnwindingCalls.after.mir | ||
extern "C" fn test() { | ||
// CHECK-LABEL: fn test( | ||
// CHECK: drop | ||
// CHECK-SAME: unwind: [[unwind:bb.*]]] | ||
// CHECK: [[unwind]] (cleanup) | ||
// CHECK-NEXT: terminate(abi) | ||
let _val = Noise; | ||
panic(); | ||
} | ||
|
||
fn main() {} |
36 changes: 36 additions & 0 deletions
36
tests/mir-opt/c_unwind_terminate.test.AbortUnwindingCalls.after.mir
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,36 @@ | ||
// MIR for `test` after AbortUnwindingCalls | ||
|
||
fn test() -> () { | ||
let mut _0: (); | ||
let _1: Noise; | ||
let _2: (); | ||
scope 1 { | ||
debug _val => _1; | ||
} | ||
|
||
bb0: { | ||
StorageLive(_1); | ||
_1 = Noise; | ||
StorageLive(_2); | ||
_2 = panic() -> [return: bb1, unwind: bb3]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_2); | ||
_0 = const (); | ||
drop(_1) -> [return: bb2, unwind: bb4]; | ||
} | ||
|
||
bb2: { | ||
StorageDead(_1); | ||
return; | ||
} | ||
|
||
bb3 (cleanup): { | ||
drop(_1) -> [return: bb4, unwind terminate(cleanup)]; | ||
} | ||
|
||
bb4 (cleanup): { | ||
terminate(abi); | ||
} | ||
} |
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