mirror of
https://github.com/rust-lang/rust.git
synced 2026-07-26 17:42:22 -04:00
Disable RangeInclusive's From test when unwinding isn't available.
This commit is contained in:
committed by
Mark Rousskov
parent
399e756599
commit
aa72bce0ec
@@ -421,6 +421,10 @@ const impl<T> From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
|
||||
/// ```
|
||||
///
|
||||
/// ```
|
||||
/// # // 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<T> From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
|
||||
/// 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<T>) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user