Skip to content

Commit daecb58

Browse files
committed
Add comments to interpret_cs_action
1 parent ecbfb04 commit daecb58

File tree

1 file changed

+5
-0
lines changed
  • src/libpanic_unwind/dwarf

1 file changed

+5
-0
lines changed

src/libpanic_unwind/dwarf/eh.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,15 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>, foreign_e
129129

130130
fn interpret_cs_action(cs_action: u64, lpad: usize, foreign_exception: bool) -> EHAction {
131131
if cs_action == 0 {
132+
// If cs_action is 0 then this is a cleanup (Drop::drop). We run these
133+
// for both Rust panics and foriegn exceptions.
132134
EHAction::Cleanup(lpad)
133135
} else if foreign_exception {
136+
// catch_unwind should not catch foreign exceptions, only Rust panics.
137+
// Instead just continue unwinding.
134138
EHAction::None
135139
} else {
140+
// Stop unwinding Rust panics at catch_unwind.
136141
EHAction::Catch(lpad)
137142
}
138143
}

0 commit comments

Comments
 (0)