Print the precondition we violated, and visible through output capture
Co-authored-by: Ralf Jung <post@ralfj.de>
This commit is contained in:
@@ -19,7 +19,12 @@ impl IndexRange {
|
||||
#[inline]
|
||||
pub const unsafe fn new_unchecked(start: usize, end: usize) -> Self {
|
||||
// SAFETY: comparisons on usize are pure
|
||||
unsafe { assert_unsafe_precondition!((start: usize, end: usize) => start <= end) };
|
||||
unsafe {
|
||||
assert_unsafe_precondition!(
|
||||
"IndexRange::new_unchecked requires `start <= end`",
|
||||
(start: usize, end: usize) => start <= end
|
||||
)
|
||||
};
|
||||
IndexRange { start, end }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user