diff options
| author | bors <bors@rust-lang.org> | 2023-08-01 16:09:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-01 16:09:13 +0000 |
| commit | 4896daa3985010e7d136fe0c5bf4c4e8bfc911ae (patch) | |
| tree | 4daf7dcc56c274b7786e104e1ecd0504b3152a6e /library/std/src | |
| parent | 828bdc2c26f5c95773c4ecf72870919f16417b66 (diff) | |
| parent | 41364c7c1d7142532b747100177c8b889475dde3 (diff) | |
| download | rust-4896daa3985010e7d136fe0c5bf4c4e8bfc911ae.tar.gz rust-4896daa3985010e7d136fe0c5bf4c4e8bfc911ae.zip | |
Auto merge of #114331 - matthiaskrgr:rollup-rnrmwcx, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #100455 (Implement RefUnwindSafe for Backtrace) - #113428 (coverage: Replace `ExpressionOperandId` with enum `Operand`) - #114283 (Use parking lot's rwlock even without parallel-rustc) - #114288 (Improve diagnostic for wrong borrow on binary operations) - #114296 (interpret: fix alignment handling for Repeat expressions) - #114306 ([rustc_data_structures][perf] Simplify base_n::push_str.) - #114320 (Cover statements for stable_mir) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/backtrace.rs | 3 | ||||
| -rw-r--r-- | library/std/src/backtrace/tests.rs | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/library/std/src/backtrace.rs b/library/std/src/backtrace.rs index f0e199fac73..e7110aebdea 100644 --- a/library/std/src/backtrace.rs +++ b/library/std/src/backtrace.rs @@ -92,6 +92,7 @@ use crate::backtrace_rs::{self, BytesOrWideString}; use crate::env; use crate::ffi::c_void; use crate::fmt; +use crate::panic::UnwindSafe; use crate::sync::atomic::{AtomicUsize, Ordering::Relaxed}; use crate::sync::LazyLock; use crate::sys_common::backtrace::{lock, output_filename}; @@ -427,7 +428,7 @@ impl fmt::Display for Backtrace { } } -type LazyResolve = impl (FnOnce() -> Capture) + Send + Sync; +type LazyResolve = impl (FnOnce() -> Capture) + Send + Sync + UnwindSafe; fn lazy_resolve(mut capture: Capture) -> LazyResolve { move || { diff --git a/library/std/src/backtrace/tests.rs b/library/std/src/backtrace/tests.rs index ef419806dcc..73543a3af54 100644 --- a/library/std/src/backtrace/tests.rs +++ b/library/std/src/backtrace/tests.rs @@ -1,4 +1,5 @@ use super::*; +use crate::panic::{RefUnwindSafe, UnwindSafe}; fn generate_fake_frames() -> Vec<BacktraceFrame> { vec![ @@ -91,3 +92,9 @@ fn test_frames() { assert!(iter.all(|(f, e)| format!("{f:#?}") == *e)); } + +#[test] +fn backtrace_unwind_safe() { + fn assert_unwind_safe<T: UnwindSafe + RefUnwindSafe>() {} + assert_unwind_safe::<Backtrace>(); +} |
