From a7d33684481ac114802bc57c44a2acb10c361ccb Mon Sep 17 00:00:00 2001 From: Jacob Kiesel Date: Mon, 12 Oct 2020 15:09:45 -0600 Subject: [PATCH 1/2] Stabilize clamp --- library/core/src/cmp.rs | 4 +--- library/std/src/f32.rs | 3 +-- library/std/src/f64.rs | 3 +-- library/std/src/lib.rs | 1 - 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index ee79a94cc66ab..f2ebe0c41c338 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -631,14 +631,12 @@ pub trait Ord: Eq + PartialOrd { /// # Examples /// /// ``` - /// #![feature(clamp)] - /// /// assert!((-3).clamp(-2, 1) == -2); /// assert!(0.clamp(-2, 1) == 0); /// assert!(2.clamp(-2, 1) == 1); /// ``` #[must_use] - #[unstable(feature = "clamp", issue = "44095")] + #[stable(feature = "clamp", since = "1.49.0")] fn clamp(self, min: Self, max: Self) -> Self where Self: Sized, diff --git a/library/std/src/f32.rs b/library/std/src/f32.rs index 59c2da5273bde..63afc7ad08907 100644 --- a/library/std/src/f32.rs +++ b/library/std/src/f32.rs @@ -891,14 +891,13 @@ impl f32 { /// # Examples /// /// ``` - /// #![feature(clamp)] /// assert!((-3.0f32).clamp(-2.0, 1.0) == -2.0); /// assert!((0.0f32).clamp(-2.0, 1.0) == 0.0); /// assert!((2.0f32).clamp(-2.0, 1.0) == 1.0); /// assert!((f32::NAN).clamp(-2.0, 1.0).is_nan()); /// ``` #[must_use = "method returns a new number and does not mutate the original value"] - #[unstable(feature = "clamp", issue = "44095")] + #[stable(feature = "clamp", since = "1.49.0")] #[inline] pub fn clamp(self, min: f32, max: f32) -> f32 { assert!(min <= max); diff --git a/library/std/src/f64.rs b/library/std/src/f64.rs index bd094bdb55dc3..bb2a6c87f5075 100644 --- a/library/std/src/f64.rs +++ b/library/std/src/f64.rs @@ -893,14 +893,13 @@ impl f64 { /// # Examples /// /// ``` - /// #![feature(clamp)] /// assert!((-3.0f64).clamp(-2.0, 1.0) == -2.0); /// assert!((0.0f64).clamp(-2.0, 1.0) == 0.0); /// assert!((2.0f64).clamp(-2.0, 1.0) == 1.0); /// assert!((f64::NAN).clamp(-2.0, 1.0).is_nan()); /// ``` #[must_use = "method returns a new number and does not mutate the original value"] - #[unstable(feature = "clamp", issue = "44095")] + #[stable(feature = "clamp", since = "1.49.0")] #[inline] pub fn clamp(self, min: f64, max: f64) -> f64 { assert!(min <= max); diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 5224672adb28b..49e1f34e3b8f2 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -234,7 +234,6 @@ #![feature(cfg_target_thread_local)] #![feature(char_error_internals)] #![feature(char_internals)] -#![feature(clamp)] #![feature(concat_idents)] #![feature(const_cstr_unchecked)] #![feature(const_fn_floating_point_arithmetic)] From fb6ceac46b0b3ecd8220dee17a257e2655f6a66a Mon Sep 17 00:00:00 2001 From: Jacob Kiesel Date: Fri, 20 Nov 2020 10:37:22 -0700 Subject: [PATCH 2/2] We missed 1.49.0, so bump version to 1.50.0 --- library/core/src/cmp.rs | 2 +- library/std/src/f32.rs | 2 +- library/std/src/f64.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index f2ebe0c41c338..c181de44eca91 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -636,7 +636,7 @@ pub trait Ord: Eq + PartialOrd { /// assert!(2.clamp(-2, 1) == 1); /// ``` #[must_use] - #[stable(feature = "clamp", since = "1.49.0")] + #[stable(feature = "clamp", since = "1.50.0")] fn clamp(self, min: Self, max: Self) -> Self where Self: Sized, diff --git a/library/std/src/f32.rs b/library/std/src/f32.rs index 63afc7ad08907..0d4ea527a7b2e 100644 --- a/library/std/src/f32.rs +++ b/library/std/src/f32.rs @@ -897,7 +897,7 @@ impl f32 { /// assert!((f32::NAN).clamp(-2.0, 1.0).is_nan()); /// ``` #[must_use = "method returns a new number and does not mutate the original value"] - #[stable(feature = "clamp", since = "1.49.0")] + #[stable(feature = "clamp", since = "1.50.0")] #[inline] pub fn clamp(self, min: f32, max: f32) -> f32 { assert!(min <= max); diff --git a/library/std/src/f64.rs b/library/std/src/f64.rs index bb2a6c87f5075..aa143dd4a9be4 100644 --- a/library/std/src/f64.rs +++ b/library/std/src/f64.rs @@ -899,7 +899,7 @@ impl f64 { /// assert!((f64::NAN).clamp(-2.0, 1.0).is_nan()); /// ``` #[must_use = "method returns a new number and does not mutate the original value"] - #[stable(feature = "clamp", since = "1.49.0")] + #[stable(feature = "clamp", since = "1.50.0")] #[inline] pub fn clamp(self, min: f64, max: f64) -> f64 { assert!(min <= max);