We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f7d7a35 commit 6dbea1fCopy full SHA for 6dbea1f
library/core/src/cmp.rs
@@ -1855,6 +1855,7 @@ mod impls {
1855
use crate::hint::unreachable_unchecked;
1856
use crate::marker::PointeeSized;
1857
use crate::ops::ControlFlow::{self, Break, Continue};
1858
+ use crate::panic::const_assert;
1859
1860
macro_rules! partial_eq_impl {
1861
($($t:ty)*) => ($(
@@ -2002,7 +2003,13 @@ mod impls {
2002
2003
#[track_caller]
2004
fn clamp(self, min: Self, max: Self) -> Self
2005
{
- assert!(min <= max, "min > max. min = {min}, max = {max}");
2006
+ const_assert!(
2007
+ min <= max,
2008
+ "min > max",
2009
+ "min > max. min = {min:?}, max = {max:?}",
2010
+ min: $t,
2011
+ max: $t,
2012
+ );
2013
if self < min {
2014
min
2015
} else if self > max {
0 commit comments