about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2019-04-03 19:50:28 +0200
committerSimon Sapin <simon.sapin@exyr.org>2019-04-12 20:07:30 +0200
commitfc928a18bad0b6aa275a6908351b164f6f4abcd6 (patch)
tree989221d015abb9a7b379a70465737ebe9badb0cf
parentf8673e0ad85e98997faa76fa7edc99c5825f46ee (diff)
downloadrust-fc928a18bad0b6aa275a6908351b164f6f4abcd6.tar.gz
rust-fc928a18bad0b6aa275a6908351b164f6f4abcd6.zip
Stabilize the `alloc` crate.
This implements RFC 2480:

* https://github.com/rust-lang/rfcs/pull/2480
* https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md

Closes https://github.com/rust-lang/rust/issues/27783
-rw-r--r--src/liballoc/lib.rs5
-rw-r--r--src/liballoc/prelude/mod.rs1
-rw-r--r--src/liballoc/raw_vec.rs4
-rw-r--r--src/libarena/lib.rs1
-rw-r--r--src/libpanic_unwind/lib.rs2
-rw-r--r--src/libstd/lib.rs1
-rw-r--r--src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py4
-rw-r--r--src/test/run-pass/array-slice-vec/vec-macro-no-std.rs2
-rw-r--r--src/test/run-pass/extern/extern-prelude-core.rs2
-rw-r--r--src/test/run-pass/extern/extern-prelude-core.stderr2
-rw-r--r--src/test/run-pass/for-loop-while/for-loop-no-std.rs2
-rw-r--r--src/test/run-pass/format-no-std.rs2
-rw-r--r--src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs3
-rw-r--r--src/test/ui/allocator-submodule.rs2
-rw-r--r--src/test/ui/allocator-submodule.stderr2
-rw-r--r--src/test/ui/error-codes/E0254.rs1
-rw-r--r--src/test/ui/error-codes/E0254.stderr2
-rw-r--r--src/test/ui/error-codes/E0259.rs2
-rw-r--r--src/test/ui/error-codes/E0260.rs1
-rw-r--r--src/test/ui/error-codes/E0260.stderr2
-rw-r--r--src/test/ui/missing/missing-alloc_error_handler.rs2
-rw-r--r--src/test/ui/missing/missing-allocator.rs2
-rw-r--r--src/test/ui/resolve_self_super_hint.rs1
-rw-r--r--src/test/ui/resolve_self_super_hint.stderr8
-rw-r--r--src/test/ui/rust-2018/remove-extern-crate.fixed1
-rw-r--r--src/test/ui/rust-2018/remove-extern-crate.rs1
-rw-r--r--src/test/ui/rust-2018/remove-extern-crate.stderr8
-rw-r--r--src/test/ui/unnecessary-extern-crate.rs2
28 files changed, 25 insertions, 43 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index 90ff56814fb..9129ce61d8c 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -51,10 +51,7 @@
 //! default global allocator. It is not compatible with the libc allocator API.
 
 #![allow(unused_attributes)]
-#![unstable(feature = "alloc",
-            reason = "this library is unlikely to be stabilized in its current \
-                      form or name",
-            issue = "27783")]
+#![stable(feature = "alloc", since = "1.36.0")]
 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
        issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
        test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
diff --git a/src/liballoc/prelude/mod.rs b/src/liballoc/prelude/mod.rs
index 33cc51d1732..0534ad3edc7 100644
--- a/src/liballoc/prelude/mod.rs
+++ b/src/liballoc/prelude/mod.rs
@@ -5,7 +5,6 @@
 //!
 //! ```
 //! # #![allow(unused_imports)]
-//! # #![feature(alloc)]
 //! #![feature(alloc_prelude)]
 //! extern crate alloc;
 //! use alloc::prelude::v1::*;
diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs
index fe28fe5095c..d1fc5ac3b30 100644
--- a/src/liballoc/raw_vec.rs
+++ b/src/liballoc/raw_vec.rs
@@ -256,7 +256,7 @@ impl<T, A: Alloc> RawVec<T, A> {
     /// # Examples
     ///
     /// ```
-    /// # #![feature(alloc, raw_vec_internals)]
+    /// # #![feature(raw_vec_internals)]
     /// # extern crate alloc;
     /// # use std::ptr;
     /// # use alloc::raw_vec::RawVec;
@@ -460,7 +460,7 @@ impl<T, A: Alloc> RawVec<T, A> {
     /// # Examples
     ///
     /// ```
-    /// # #![feature(alloc, raw_vec_internals)]
+    /// # #![feature(raw_vec_internals)]
     /// # extern crate alloc;
     /// # use std::ptr;
     /// # use alloc::raw_vec::RawVec;
diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs
index 0a5b79c36aa..f2913295bdc 100644
--- a/src/libarena/lib.rs
+++ b/src/libarena/lib.rs
@@ -13,7 +13,6 @@
 
 #![deny(rust_2018_idioms)]
 
-#![feature(alloc)]
 #![feature(core_intrinsics)]
 #![feature(dropck_eyepatch)]
 #![feature(raw_vec_internals)]
diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs
index 9d3d8f6185b..72ddafb420c 100644
--- a/src/libpanic_unwind/lib.rs
+++ b/src/libpanic_unwind/lib.rs
@@ -19,8 +19,6 @@
 
 #![deny(rust_2018_idioms)]
 
-#![feature(allocator_api)]
-#![feature(alloc)]
 #![feature(core_intrinsics)]
 #![feature(lang_items)]
 #![feature(libc)]
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index d11dee8fc97..ee6ba3f438f 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -229,7 +229,6 @@
 #![feature(align_offset)]
 #![feature(alloc_error_handler)]
 #![feature(alloc_layout_extra)]
-#![feature(alloc)]
 #![feature(allocator_api)]
 #![feature(allocator_internals)]
 #![feature(allow_internal_unsafe)]
diff --git a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py
index e0fa4e8f5de..855b6421cf8 100644
--- a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py
+++ b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py
@@ -7,8 +7,8 @@ from subprocess import PIPE, Popen
 
 # This is a whitelist of files which are stable crates or simply are not crates,
 # we don't check for the instability of these crates as they're all stable!
-STABLE_CRATES = ['std', 'core', 'proc_macro', 'rsbegin.o', 'rsend.o', 'dllcrt2.o', 'crt2.o',
-                 'clang_rt']
+STABLE_CRATES = ['std', 'alloc', 'core', 'proc_macro',
+                 'rsbegin.o', 'rsend.o', 'dllcrt2.o', 'crt2.o', 'clang_rt']
 
 
 def convert_to_string(s):
diff --git a/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs b/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs
index 7f7f1e43315..443895f7c48 100644
--- a/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs
+++ b/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs
@@ -2,7 +2,7 @@
 
 // ignore-emscripten no no_std executables
 
-#![feature(lang_items, start, rustc_private, alloc)]
+#![feature(lang_items, start, rustc_private)]
 #![no_std]
 
 extern crate std as other;
diff --git a/src/test/run-pass/extern/extern-prelude-core.rs b/src/test/run-pass/extern/extern-prelude-core.rs
index a5d31009f9c..f0d43404b00 100644
--- a/src/test/run-pass/extern/extern-prelude-core.rs
+++ b/src/test/run-pass/extern/extern-prelude-core.rs
@@ -1,5 +1,5 @@
 // run-pass
-#![feature(extern_prelude, lang_items, start, alloc)]
+#![feature(extern_prelude, lang_items, start)]
 #![no_std]
 
 extern crate std as other;
diff --git a/src/test/run-pass/extern/extern-prelude-core.stderr b/src/test/run-pass/extern/extern-prelude-core.stderr
index 417483af707..8d2a0b7425f 100644
--- a/src/test/run-pass/extern/extern-prelude-core.stderr
+++ b/src/test/run-pass/extern/extern-prelude-core.stderr
@@ -1,7 +1,7 @@
 warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable
   --> $DIR/extern-prelude-core.rs:2:12
    |
-LL | #![feature(extern_prelude, lang_items, start, alloc)]
+LL | #![feature(extern_prelude, lang_items, start)]
    |            ^^^^^^^^^^^^^^
    |
    = note: #[warn(stable_features)] on by default
diff --git a/src/test/run-pass/for-loop-while/for-loop-no-std.rs b/src/test/run-pass/for-loop-while/for-loop-no-std.rs
index 877429f5d39..65a33c5f16f 100644
--- a/src/test/run-pass/for-loop-while/for-loop-no-std.rs
+++ b/src/test/run-pass/for-loop-while/for-loop-no-std.rs
@@ -1,6 +1,6 @@
 // run-pass
 #![allow(unused_imports)]
-#![feature(lang_items, start, alloc)]
+#![feature(lang_items, start)]
 #![no_std]
 
 extern crate std as other;
diff --git a/src/test/run-pass/format-no-std.rs b/src/test/run-pass/format-no-std.rs
index 0f3a5c277b4..32f7a4a07c4 100644
--- a/src/test/run-pass/format-no-std.rs
+++ b/src/test/run-pass/format-no-std.rs
@@ -1,6 +1,6 @@
 // ignore-emscripten no no_std executables
 
-#![feature(lang_items, start, alloc)]
+#![feature(lang_items, start)]
 #![no_std]
 
 extern crate std as other;
diff --git a/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs b/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs
index dfe73875215..980fd97e2c6 100644
--- a/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs
+++ b/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs
@@ -3,9 +3,6 @@
 
 // Make sure the destructor is run for unit-like structs.
 
-
-#![feature(alloc)]
-
 use std::thread;
 
 struct Foo;
diff --git a/src/test/ui/allocator-submodule.rs b/src/test/ui/allocator-submodule.rs
index a1cca50ba98..7a8d86b8da1 100644
--- a/src/test/ui/allocator-submodule.rs
+++ b/src/test/ui/allocator-submodule.rs
@@ -1,8 +1,6 @@
 // Tests that it is possible to create a global allocator in a submodule, rather than in the crate
 // root.
 
-#![feature(alloc, allocator_api, global_allocator)]
-
 extern crate alloc;
 
 use std::{
diff --git a/src/test/ui/allocator-submodule.stderr b/src/test/ui/allocator-submodule.stderr
index 26d7aa80eee..91c7c0f6b8e 100644
--- a/src/test/ui/allocator-submodule.stderr
+++ b/src/test/ui/allocator-submodule.stderr
@@ -1,5 +1,5 @@
 error: `global_allocator` cannot be used in submodules
-  --> $DIR/allocator-submodule.rs:27:5
+  --> $DIR/allocator-submodule.rs:25:5
    |
 LL |     static MY_HEAP: MyAlloc = MyAlloc;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/error-codes/E0254.rs b/src/test/ui/error-codes/E0254.rs
index 706cd347e13..d166aff5657 100644
--- a/src/test/ui/error-codes/E0254.rs
+++ b/src/test/ui/error-codes/E0254.rs
@@ -1,4 +1,3 @@
-#![feature(alloc)]
 #![allow(unused_extern_crates, non_camel_case_types)]
 
 extern crate alloc;
diff --git a/src/test/ui/error-codes/E0254.stderr b/src/test/ui/error-codes/E0254.stderr
index c2d013da417..10456fd5a5d 100644
--- a/src/test/ui/error-codes/E0254.stderr
+++ b/src/test/ui/error-codes/E0254.stderr
@@ -1,5 +1,5 @@
 error[E0254]: the name `alloc` is defined multiple times
-  --> $DIR/E0254.rs:12:5
+  --> $DIR/E0254.rs:11:5
    |
 LL | extern crate alloc;
    | ------------------- previous import of the extern crate `alloc` here
diff --git a/src/test/ui/error-codes/E0259.rs b/src/test/ui/error-codes/E0259.rs
index cda3db34dfc..c83561be9c6 100644
--- a/src/test/ui/error-codes/E0259.rs
+++ b/src/test/ui/error-codes/E0259.rs
@@ -1,4 +1,4 @@
-#![feature(alloc, rustc_private)]
+#![feature(rustc_private)]
 #![allow(unused_extern_crates)]
 
 extern crate alloc;
diff --git a/src/test/ui/error-codes/E0260.rs b/src/test/ui/error-codes/E0260.rs
index 80382c0d2fc..73b8934159f 100644
--- a/src/test/ui/error-codes/E0260.rs
+++ b/src/test/ui/error-codes/E0260.rs
@@ -1,4 +1,3 @@
-#![feature(alloc)]
 #![allow(unused_extern_crates)]
 
 extern crate alloc;
diff --git a/src/test/ui/error-codes/E0260.stderr b/src/test/ui/error-codes/E0260.stderr
index bfe2ed0cfc7..7d0b3022914 100644
--- a/src/test/ui/error-codes/E0260.stderr
+++ b/src/test/ui/error-codes/E0260.stderr
@@ -1,5 +1,5 @@
 error[E0260]: the name `alloc` is defined multiple times
-  --> $DIR/E0260.rs:6:1
+  --> $DIR/E0260.rs:5:1
    |
 LL | extern crate alloc;
    | ------------------- previous import of the extern crate `alloc` here
diff --git a/src/test/ui/missing/missing-alloc_error_handler.rs b/src/test/ui/missing/missing-alloc_error_handler.rs
index 1a9e8688e8a..ae0c067bb5f 100644
--- a/src/test/ui/missing/missing-alloc_error_handler.rs
+++ b/src/test/ui/missing/missing-alloc_error_handler.rs
@@ -3,7 +3,7 @@
 
 #![no_std]
 #![crate_type = "staticlib"]
-#![feature(panic_handler, alloc_error_handler, alloc)]
+#![feature(panic_handler, alloc_error_handler)]
 
 #[panic_handler]
 fn panic(_: &core::panic::PanicInfo) -> ! {
diff --git a/src/test/ui/missing/missing-allocator.rs b/src/test/ui/missing/missing-allocator.rs
index dbb10d1e7b9..6d867e2e8b4 100644
--- a/src/test/ui/missing/missing-allocator.rs
+++ b/src/test/ui/missing/missing-allocator.rs
@@ -3,7 +3,7 @@
 
 #![no_std]
 #![crate_type = "staticlib"]
-#![feature(panic_handler, alloc_error_handler, alloc)]
+#![feature(panic_handler, alloc_error_handler)]
 
 #[panic_handler]
 fn panic(_: &core::panic::PanicInfo) -> ! {
diff --git a/src/test/ui/resolve_self_super_hint.rs b/src/test/ui/resolve_self_super_hint.rs
index 91a01cc0fa2..a9423830d90 100644
--- a/src/test/ui/resolve_self_super_hint.rs
+++ b/src/test/ui/resolve_self_super_hint.rs
@@ -1,4 +1,3 @@
-#![feature(alloc)]
 #![allow(unused_extern_crates)]
 
 mod a {
diff --git a/src/test/ui/resolve_self_super_hint.stderr b/src/test/ui/resolve_self_super_hint.stderr
index 03214cad8e4..14cdae97d14 100644
--- a/src/test/ui/resolve_self_super_hint.stderr
+++ b/src/test/ui/resolve_self_super_hint.stderr
@@ -1,17 +1,17 @@
 error[E0432]: unresolved import `alloc`
-  --> $DIR/resolve_self_super_hint.rs:6:9
+  --> $DIR/resolve_self_super_hint.rs:5:9
    |
 LL |     use alloc::HashMap;
    |         ^^^^^ help: a similar path exists: `self::alloc`
 
 error[E0432]: unresolved import `alloc`
-  --> $DIR/resolve_self_super_hint.rs:11:13
+  --> $DIR/resolve_self_super_hint.rs:10:13
    |
 LL |         use alloc::HashMap;
    |             ^^^^^ help: a similar path exists: `super::alloc`
 
 error[E0432]: unresolved import `alloc`
-  --> $DIR/resolve_self_super_hint.rs:16:17
+  --> $DIR/resolve_self_super_hint.rs:15:17
    |
 LL |             use alloc::HashMap;
    |                 ^^^^^
@@ -20,7 +20,7 @@ LL |             use alloc::HashMap;
    |                 help: a similar path exists: `a::alloc`
 
 error[E0432]: unresolved import `alloc`
-  --> $DIR/resolve_self_super_hint.rs:21:21
+  --> $DIR/resolve_self_super_hint.rs:20:21
    |
 LL |                 use alloc::HashMap;
    |                     ^^^^^
diff --git a/src/test/ui/rust-2018/remove-extern-crate.fixed b/src/test/ui/rust-2018/remove-extern-crate.fixed
index a977e00c013..17449caf84f 100644
--- a/src/test/ui/rust-2018/remove-extern-crate.fixed
+++ b/src/test/ui/rust-2018/remove-extern-crate.fixed
@@ -4,7 +4,6 @@
 // aux-build:remove-extern-crate.rs
 // compile-flags:--extern remove_extern_crate
 
-#![feature(alloc)]
 #![warn(rust_2018_idioms)]
 
 
diff --git a/src/test/ui/rust-2018/remove-extern-crate.rs b/src/test/ui/rust-2018/remove-extern-crate.rs
index cafe82d846e..fb2217df000 100644
--- a/src/test/ui/rust-2018/remove-extern-crate.rs
+++ b/src/test/ui/rust-2018/remove-extern-crate.rs
@@ -4,7 +4,6 @@
 // aux-build:remove-extern-crate.rs
 // compile-flags:--extern remove_extern_crate
 
-#![feature(alloc)]
 #![warn(rust_2018_idioms)]
 
 extern crate core;
diff --git a/src/test/ui/rust-2018/remove-extern-crate.stderr b/src/test/ui/rust-2018/remove-extern-crate.stderr
index 4e08b7aa6a0..549693201b7 100644
--- a/src/test/ui/rust-2018/remove-extern-crate.stderr
+++ b/src/test/ui/rust-2018/remove-extern-crate.stderr
@@ -1,24 +1,24 @@
 warning: unused extern crate
-  --> $DIR/remove-extern-crate.rs:10:1
+  --> $DIR/remove-extern-crate.rs:9:1
    |
 LL | extern crate core;
    | ^^^^^^^^^^^^^^^^^^ help: remove it
    |
 note: lint level defined here
-  --> $DIR/remove-extern-crate.rs:8:9
+  --> $DIR/remove-extern-crate.rs:7:9
    |
 LL | #![warn(rust_2018_idioms)]
    |         ^^^^^^^^^^^^^^^^
    = note: #[warn(unused_extern_crates)] implied by #[warn(rust_2018_idioms)]
 
 warning: `extern crate` is not idiomatic in the new edition
-  --> $DIR/remove-extern-crate.rs:11:1
+  --> $DIR/remove-extern-crate.rs:10:1
    |
 LL | extern crate core as another_name;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
 
 warning: `extern crate` is not idiomatic in the new edition
-  --> $DIR/remove-extern-crate.rs:29:5
+  --> $DIR/remove-extern-crate.rs:28:5
    |
 LL |     extern crate core;
    |     ^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
diff --git a/src/test/ui/unnecessary-extern-crate.rs b/src/test/ui/unnecessary-extern-crate.rs
index e25b99bcb61..67eaaf4b6c2 100644
--- a/src/test/ui/unnecessary-extern-crate.rs
+++ b/src/test/ui/unnecessary-extern-crate.rs
@@ -1,7 +1,7 @@
 // edition:2018
 
 #![deny(unused_extern_crates)]
-#![feature(alloc, test, rustc_private, crate_visibility_modifier)]
+#![feature(test, rustc_private, crate_visibility_modifier)]
 
 extern crate libc;
 //~^ ERROR unused extern crate