From 144707a4b180f9cad63baee9c89ebe1c6afa47de Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 20 Aug 2025 18:49:40 +0300 Subject: [PATCH] Don't require `T: RefUnwindSafe` for `vec::IntoIter: UnwindSafe` --- library/alloc/src/vec/into_iter.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index 37df928228d9c..358bdeacae790 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -7,6 +7,7 @@ use core::mem::{ManuallyDrop, MaybeUninit, SizedTypeProperties}; use core::num::NonZero; #[cfg(not(no_global_oom_handling))] use core::ops::Deref; +use core::panic::UnwindSafe; use core::ptr::{self, NonNull}; use core::slice::{self}; use core::{array, fmt}; @@ -60,6 +61,11 @@ pub struct IntoIter< pub(super) end: *const T, } +// Manually mirroring what `Vec` has, +// because otherwise we get `T: RefUnwindSafe` from `NonNull`. +#[stable(feature = "catch_unwind", since = "1.9.0")] +impl UnwindSafe for IntoIter {} + #[stable(feature = "vec_intoiter_debug", since = "1.13.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {