Skip to content

Commit

Permalink
Explicitly test unwind safety as trait bounds too
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 30, 2024
1 parent 5f08017 commit 82888f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use cxx_test_suite::module::ffi2;
use cxx_test_suite::{cast, ffi, R};
use std::cell::Cell;
use std::ffi::CStr;
use std::panic;
use std::panic::{self, RefUnwindSafe, UnwindSafe};

thread_local! {
static CORRECT: Cell<bool> = const { Cell::new(false) };
Expand Down Expand Up @@ -387,4 +387,10 @@ fn test_unwind_safe() {
fn inspect(_c: &ffi::C) {}
let _unwind_safe = |c: UniquePtr<ffi::C>| panic::catch_unwind(|| drop(c));
let _ref_unwind_safe = |c: &ffi::C| panic::catch_unwind(|| inspect(c));

fn require_unwind_safe<T: UnwindSafe>() {}
require_unwind_safe::<ffi::C>();

fn require_ref_unwind_safe<T: RefUnwindSafe>() {}
require_ref_unwind_safe::<ffi::C>();
}

0 comments on commit 82888f1

Please sign in to comment.