From aa72bce0ec79a436f28f71ece2256be2596ec568 Mon Sep 17 00:00:00 2001 From: "Tim (Theemathas Chirananthavat)" Date: Sun, 5 Jul 2026 22:55:53 +0700 Subject: [PATCH] Disable `RangeInclusive`'s `From` test when unwinding isn't available. --- library/core/src/range.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/core/src/range.rs b/library/core/src/range.rs index 0eef97bdcb4d..557587b4e9a8 100644 --- a/library/core/src/range.rs +++ b/library/core/src/range.rs @@ -421,6 +421,10 @@ const impl From> for RangeInclusive { /// ``` /// /// ``` + /// # // This test requires unwinding to work. + /// # // Disable it when unwinding isn't available. + /// # #[cfg(panic = "unwind")] + /// # fn main() { /// use core::range::legacy; /// use core::range::RangeInclusive; /// use std::panic::catch_unwind; @@ -430,6 +434,9 @@ const impl From> for RangeInclusive { /// let result = catch_unwind(|| RangeInclusive::from(exhausted)); /// // The `from` call either panicked or returned an empty range. /// assert!(result.is_err() || result.is_ok_and(|range| range.is_empty())); + /// # } + /// # #[cfg(not(panic = "unwind"))] + /// # fn main() {} /// ``` #[inline] fn from(value: legacy::RangeInclusive) -> Self {