about summary refs log tree commit diff
path: root/src/libcore/ops
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-14 10:21:32 +0000
committerbors <bors@rust-lang.org>2019-12-14 10:21:32 +0000
commitc8ea4ace9213ae045123fdfeb59d1ac887656d31 (patch)
tree2a7d207294b6f2c99d1ddbe193b1d5af8ee46a09 /src/libcore/ops
parent12307b3b08edee543a78fb9d4a837fbd6d6ac0fa (diff)
parent0b47ba7019adf06f6687a8c94040e63ae1ea4fba (diff)
downloadrust-c8ea4ace9213ae045123fdfeb59d1ac887656d31.tar.gz
rust-c8ea4ace9213ae045123fdfeb59d1ac887656d31.zip
Auto merge of #67136 - oli-obk:const_stability, r=Centril
Require stable/unstable annotations for the constness of all stable fns with a const modifier

r? @RalfJung @Centril

Every `#[stable]` const fn now needs either a `#[rustc_const_unstable]` attribute or a `#[rustc_const_stable]` attribute. You can't silently stabilize the constness of a function anymore.
Diffstat (limited to 'src/libcore/ops')
-rw-r--r--src/libcore/ops/range.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs
index a2250337a4d..54ce2917a36 100644
--- a/src/libcore/ops/range.rs
+++ b/src/libcore/ops/range.rs
@@ -398,6 +398,7 @@ impl<Idx> RangeInclusive<Idx> {
     #[stable(feature = "inclusive_range_methods", since = "1.27.0")]
     #[inline]
     #[rustc_promotable]
+    #[cfg_attr(not(bootstrap), rustc_const_stable(feature = "const_range_new", since = "1.32.0"))]
     pub const fn new(start: Idx, end: Idx) -> Self {
         Self { start, end, is_empty: None }
     }
@@ -421,6 +422,10 @@ impl<Idx> RangeInclusive<Idx> {
     /// assert_eq!((3..=5).start(), &3);
     /// ```
     #[stable(feature = "inclusive_range_methods", since = "1.27.0")]
+    #[cfg_attr(
+        not(bootstrap),
+        rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0"),
+    )]
     #[inline]
     pub const fn start(&self) -> &Idx {
         &self.start
@@ -445,6 +450,10 @@ impl<Idx> RangeInclusive<Idx> {
     /// assert_eq!((3..=5).end(), &5);
     /// ```
     #[stable(feature = "inclusive_range_methods", since = "1.27.0")]
+    #[cfg_attr(
+        not(bootstrap),
+        rustc_const_stable(feature = "const_inclusive_range_methods", since = "1.32.0"),
+    )]
     #[inline]
     pub const fn end(&self) -> &Idx {
         &self.end