about summary refs log tree commit diff
path: root/src/liballoc
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/liballoc
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/liballoc')
-rw-r--r--src/liballoc/collections/linked_list.rs4
-rw-r--r--src/liballoc/lib.rs2
-rw-r--r--src/liballoc/string.rs4
-rw-r--r--src/liballoc/vec.rs4
4 files changed, 13 insertions, 1 deletions
diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs
index 6ee22834a46..4a74a479e71 100644
--- a/src/liballoc/collections/linked_list.rs
+++ b/src/liballoc/collections/linked_list.rs
@@ -275,6 +275,10 @@ impl<T> LinkedList<T> {
     /// let list: LinkedList<u32> = LinkedList::new();
     /// ```
     #[inline]
+    #[cfg_attr(
+        not(bootstrap),
+        rustc_const_stable(feature = "const_linked_list_new", since = "1.32.0"),
+    )]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub const fn new() -> Self {
         LinkedList {
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index ddfa6797a57..d828e374a7b 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -117,7 +117,7 @@
 #![feature(unsized_locals)]
 #![feature(allocator_internals)]
 #![cfg_attr(bootstrap, feature(on_unimplemented))]
-#![feature(rustc_const_unstable)]
+#![cfg_attr(bootstrap, feature(rustc_const_unstable))]
 #![feature(slice_partition_dedup)]
 #![feature(maybe_uninit_extra, maybe_uninit_slice)]
 #![feature(alloc_layout_extra)]
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index f7dff4c21f7..bf9bbba4753 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -367,6 +367,10 @@ impl String {
     /// let s = String::new();
     /// ```
     #[inline]
+    #[cfg_attr(
+        not(bootstrap),
+        rustc_const_stable(feature = "const_string_new", since = "1.32.0"),
+    )]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub const fn new() -> String {
         String { vec: Vec::new() }
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 6e165ccb919..52b45b0b8fe 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -315,6 +315,10 @@ impl<T> Vec<T> {
     /// let mut vec: Vec<i32> = Vec::new();
     /// ```
     #[inline]
+    #[cfg_attr(
+        not(bootstrap),
+        rustc_const_stable(feature = "const_vec_new", since = "1.32.0"),
+    )]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub const fn new() -> Vec<T> {
         Vec {