From 29e3f8b793ec3b76fdba8075adfada21ce2a220a Mon Sep 17 00:00:00 2001 From: joboet Date: Wed, 26 Jul 2023 12:30:52 +0200 Subject: [PATCH] std: add auto traits to TAIT bound --- library/std/src/backtrace.rs | 7 ++++++- library/std/tests/backtrace.rs | 10 ---------- 2 files changed, 6 insertions(+), 11 deletions(-) delete mode 100644 library/std/tests/backtrace.rs diff --git a/library/std/src/backtrace.rs b/library/std/src/backtrace.rs index 18d5f3e9108..f0e199fac73 100644 --- a/library/std/src/backtrace.rs +++ b/library/std/src/backtrace.rs @@ -140,6 +140,11 @@ struct Capture { frames: Vec, } +fn _assert_send_sync() { + fn _assert() {} + _assert::(); +} + /// A single frame of a backtrace. #[unstable(feature = "backtrace_frames", issue = "79676")] pub struct BacktraceFrame { @@ -422,7 +427,7 @@ impl fmt::Display for Backtrace { } } -type LazyResolve = impl FnOnce() -> Capture; +type LazyResolve = impl (FnOnce() -> Capture) + Send + Sync; fn lazy_resolve(mut capture: Capture) -> LazyResolve { move || { diff --git a/library/std/tests/backtrace.rs b/library/std/tests/backtrace.rs deleted file mode 100644 index 531c5f89cf6..00000000000 --- a/library/std/tests/backtrace.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::backtrace::Backtrace; - -// Unfortunately, this cannot be a unit test because that causes problems -// with type-alias-impl-trait (the assert counts as a defining use). -#[test] -fn assert_send_sync() { - fn assert() {} - - assert::(); -}