Skip to content

Commit c44f539

Browse files
committed
alloc: Split apart the global alloc feature
1 parent c14d86f commit c44f539

File tree

12 files changed

+53
-35
lines changed

12 files changed

+53
-35
lines changed

src/liballoc/arc.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
134134
/// Weak pointers will not keep the data inside of the `Arc` alive, and can be
135135
/// used to break cycles between `Arc` pointers.
136136
#[unsafe_no_drop_flag]
137-
#[unstable(feature = "alloc",
137+
#[unstable(feature = "arc_weak",
138138
reason = "Weak pointers may not belong in this module.")]
139139
pub struct Weak<T: ?Sized> {
140140
// FIXME #12808: strange name to try to avoid interfering with
@@ -198,7 +198,7 @@ impl<T: ?Sized> Arc<T> {
198198
///
199199
/// let weak_five = five.downgrade();
200200
/// ```
201-
#[unstable(feature = "alloc",
201+
#[unstable(feature = "arc_weak",
202202
reason = "Weak pointers may not belong in this module.")]
203203
pub fn downgrade(&self) -> Weak<T> {
204204
// See the clone() impl for why this is relaxed
@@ -236,12 +236,12 @@ impl<T: ?Sized> Arc<T> {
236236

237237
/// Get the number of weak references to this value.
238238
#[inline]
239-
#[unstable(feature = "alloc")]
239+
#[unstable(feature = "arc_extras")]
240240
pub fn weak_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().weak.load(SeqCst) - 1 }
241241

242242
/// Get the number of strong references to this value.
243243
#[inline]
244-
#[unstable(feature = "alloc")]
244+
#[unstable(feature = "arc_extras")]
245245
pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.load(SeqCst) }
246246

247247

@@ -271,7 +271,7 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.loa
271271
/// # }
272272
/// ```
273273
#[inline]
274-
#[unstable(feature = "alloc")]
274+
#[unstable(feature = "arc_extras")]
275275
pub unsafe fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
276276
// FIXME(#24880) potential race with upgraded weak pointers here
277277
if strong_count(this) == 1 && weak_count(this) == 0 {
@@ -352,7 +352,7 @@ impl<T: Clone> Arc<T> {
352352
/// # }
353353
/// ```
354354
#[inline]
355-
#[unstable(feature = "alloc")]
355+
#[unstable(feature = "arc_extras")]
356356
pub unsafe fn make_unique(&mut self) -> &mut T {
357357
// FIXME(#24880) potential race with upgraded weak pointers here
358358
//
@@ -438,7 +438,7 @@ impl<T: ?Sized> Drop for Arc<T> {
438438
}
439439
}
440440

441-
#[unstable(feature = "alloc",
441+
#[unstable(feature = "arc_weak",
442442
reason = "Weak pointers may not belong in this module.")]
443443
impl<T: ?Sized> Weak<T> {
444444
/// Upgrades a weak reference to a strong reference.
@@ -479,7 +479,7 @@ impl<T: ?Sized> Weak<T> {
479479
}
480480
}
481481

482-
#[unstable(feature = "alloc",
482+
#[unstable(feature = "arc_weak",
483483
reason = "Weak pointers may not belong in this module.")]
484484
impl<T: ?Sized> Clone for Weak<T> {
485485
/// Makes a clone of the `Weak<T>`.

src/liballoc/boxed.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ use core::raw::{TraitObject};
8181
/// }
8282
/// ```
8383
#[lang = "exchange_heap"]
84-
#[unstable(feature = "alloc",
84+
#[unstable(feature = "box_heap",
8585
reason = "may be renamed; uncertain about custom allocator design")]
8686
pub const HEAP: () = ();
8787

@@ -121,7 +121,7 @@ impl<T : ?Sized> Box<T> {
121121
/// Function is unsafe, because improper use of this function may
122122
/// lead to memory problems like double-free, for example if the
123123
/// function is called twice on the same raw pointer.
124-
#[unstable(feature = "alloc",
124+
#[unstable(feature = "box_raw",
125125
reason = "may be renamed or moved out of Box scope")]
126126
#[inline]
127127
pub unsafe fn from_raw(raw: *mut T) -> Self {
@@ -146,7 +146,7 @@ impl<T : ?Sized> Box<T> {
146146
/// let raw = boxed::into_raw(seventeen);
147147
/// let boxed_again = unsafe { Box::from_raw(raw) };
148148
/// ```
149-
#[unstable(feature = "alloc",
149+
#[unstable(feature = "box_raw",
150150
reason = "may be renamed")]
151151
#[inline]
152152
pub fn into_raw<T : ?Sized>(b: Box<T>) -> *mut T {

src/liballoc/heap.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![unstable(feature = "heap_api",
12+
reason = "the precise API and guarantees it provides may be tweaked \
13+
slightly, especially to possibly take into account the \
14+
types being stored to make room for a future \
15+
tracing garbage collector")]
16+
1117
use core::{isize, usize};
1218

1319
#[inline(always)]
@@ -94,7 +100,6 @@ pub fn usable_size(size: usize, align: usize) -> usize {
94100
///
95101
/// These statistics may be inconsistent if other threads use the allocator
96102
/// during the call.
97-
#[unstable(feature = "alloc")]
98103
pub fn stats_print() {
99104
imp::stats_print();
100105
}

src/liballoc/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@
5959
// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
6060
#![cfg_attr(stage0, feature(custom_attribute))]
6161
#![crate_name = "alloc"]
62-
#![unstable(feature = "alloc")]
63-
#![staged_api]
6462
#![crate_type = "rlib"]
63+
#![staged_api]
64+
#![unstable(feature = "alloc",
65+
reason = "this library is unlikely to be stabilized in its current \
66+
form or name")]
6567
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
6668
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
6769
html_root_url = "http://doc.rust-lang.org/nightly/",
@@ -86,11 +88,11 @@
8688
#![feature(unique)]
8789
#![feature(unsafe_no_drop_flag, filling_drop)]
8890
#![feature(unsize)]
91+
8992
#![cfg_attr(test, feature(test, alloc, rustc_private))]
9093
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
9194
feature(libc))]
9295

93-
9496
#[macro_use]
9597
extern crate core;
9698

@@ -124,6 +126,7 @@ pub mod rc;
124126
/// Common out-of-memory routine
125127
#[cold]
126128
#[inline(never)]
129+
#[unstable(feature = "oom", reason = "not a scrutinized interface")]
127130
pub fn oom() -> ! {
128131
// FIXME(#14674): This really needs to do something other than just abort
129132
// here, but any printing done must be *guaranteed* to not
@@ -144,4 +147,5 @@ pub fn oom() -> ! {
144147
// to get linked in to libstd successfully (the linker won't
145148
// optimize it out).
146149
#[doc(hidden)]
150+
#[unstable(feature = "issue_14344_fixme")]
147151
pub fn fixme_14344_be_sure_to_link_to_collections() {}

src/liballoc/rc.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl<T: ?Sized> Rc<T> {
236236
///
237237
/// let weak_five = five.downgrade();
238238
/// ```
239-
#[unstable(feature = "alloc",
239+
#[unstable(feature = "rc_weak",
240240
reason = "Weak pointers may not belong in this module")]
241241
pub fn downgrade(&self) -> Weak<T> {
242242
self.inc_weak();
@@ -246,12 +246,12 @@ impl<T: ?Sized> Rc<T> {
246246

247247
/// Get the number of weak references to this value.
248248
#[inline]
249-
#[unstable(feature = "alloc")]
249+
#[unstable(feature = "rc_extras")]
250250
pub fn weak_count<T: ?Sized>(this: &Rc<T>) -> usize { this.weak() - 1 }
251251

252252
/// Get the number of strong references to this value.
253253
#[inline]
254-
#[unstable(feature = "alloc")]
254+
#[unstable(feature = "rc_extras")]
255255
pub fn strong_count<T: ?Sized>(this: &Rc<T>) -> usize { this.strong() }
256256

257257
/// Returns true if there are no other `Rc` or `Weak<T>` values that share the
@@ -269,7 +269,7 @@ pub fn strong_count<T: ?Sized>(this: &Rc<T>) -> usize { this.strong() }
269269
/// rc::is_unique(&five);
270270
/// ```
271271
#[inline]
272-
#[unstable(feature = "alloc")]
272+
#[unstable(feature = "rc_extras")]
273273
pub fn is_unique<T>(rc: &Rc<T>) -> bool {
274274
weak_count(rc) == 0 && strong_count(rc) == 1
275275
}
@@ -292,7 +292,7 @@ pub fn is_unique<T>(rc: &Rc<T>) -> bool {
292292
/// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4)));
293293
/// ```
294294
#[inline]
295-
#[unstable(feature = "alloc")]
295+
#[unstable(feature = "rc_extras")]
296296
pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> {
297297
if is_unique(&rc) {
298298
unsafe {
@@ -327,7 +327,7 @@ pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> {
327327
/// assert!(rc::get_mut(&mut x).is_none());
328328
/// ```
329329
#[inline]
330-
#[unstable(feature = "alloc")]
330+
#[unstable(feature = "rc_extras")]
331331
pub fn get_mut<T>(rc: &mut Rc<T>) -> Option<&mut T> {
332332
if is_unique(rc) {
333333
let inner = unsafe { &mut **rc._ptr };
@@ -354,7 +354,7 @@ impl<T: Clone> Rc<T> {
354354
/// let mut_five = five.make_unique();
355355
/// ```
356356
#[inline]
357-
#[unstable(feature = "alloc")]
357+
#[unstable(feature = "rc_extras")]
358358
pub fn make_unique(&mut self) -> &mut T {
359359
if !is_unique(self) {
360360
*self = Rc::new((**self).clone())
@@ -652,7 +652,7 @@ impl<T> fmt::Pointer for Rc<T> {
652652
///
653653
/// See the [module level documentation](./index.html) for more.
654654
#[unsafe_no_drop_flag]
655-
#[unstable(feature = "alloc",
655+
#[unstable(feature = "rc_weak",
656656
reason = "Weak pointers may not belong in this module.")]
657657
pub struct Weak<T: ?Sized> {
658658
// FIXME #12808: strange names to try to avoid interfering with
@@ -663,7 +663,7 @@ pub struct Weak<T: ?Sized> {
663663
impl<T: ?Sized> !marker::Send for Weak<T> {}
664664
impl<T: ?Sized> !marker::Sync for Weak<T> {}
665665

666-
#[unstable(feature = "alloc",
666+
#[unstable(feature = "rc_weak",
667667
reason = "Weak pointers may not belong in this module.")]
668668
impl<T: ?Sized> Weak<T> {
669669

@@ -741,7 +741,7 @@ impl<T: ?Sized> Drop for Weak<T> {
741741
}
742742
}
743743

744-
#[unstable(feature = "alloc",
744+
#[unstable(feature = "rc_weak",
745745
reason = "Weak pointers may not belong in this module.")]
746746
impl<T: ?Sized> Clone for Weak<T> {
747747

src/libarena/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@
3333
#![feature(alloc)]
3434
#![feature(box_syntax)]
3535
#![feature(core_intrinsics)]
36+
#![feature(heap_api)]
37+
#![feature(oom)]
3638
#![feature(ptr_as_ref)]
3739
#![feature(raw)]
3840
#![feature(staged_api)]
39-
#![feature(unboxed_closures)]
4041
#![cfg_attr(test, feature(test))]
4142

4243
extern crate alloc;

src/libcollections/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,23 @@
2929

3030
#![feature(alloc)]
3131
#![feature(box_patterns)]
32+
#![feature(box_raw)]
3233
#![feature(box_syntax)]
3334
#![feature(copy_lifetime)]
3435
#![feature(core)]
3536
#![feature(core_intrinsics)]
3637
#![feature(core_prelude)]
3738
#![feature(core_slice_ext)]
3839
#![feature(core_str_ext)]
40+
#![feature(heap_api)]
3941
#![feature(iter_cmp)]
4042
#![feature(iter_idx)]
4143
#![feature(iter_order)]
4244
#![feature(iter_product)]
4345
#![feature(iter_sum)]
4446
#![feature(lang_items)]
4547
#![feature(num_bits_bytes)]
48+
#![feature(oom)]
4649
#![feature(pattern)]
4750
#![feature(ptr_as_ref)]
4851
#![feature(raw)]

src/liblog/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,11 @@
169169
html_playground_url = "http://play.rust-lang.org/")]
170170
#![deny(missing_docs)]
171171

172-
#![feature(alloc)]
173-
#![feature(staged_api)]
172+
#![feature(box_raw)]
174173
#![feature(box_syntax)]
174+
#![feature(const_fn)]
175175
#![feature(iter_cmp)]
176+
#![feature(staged_api)]
176177
#![feature(std_misc)]
177178

178179
use std::boxed;

src/librustc_resolve/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2020
html_root_url = "http://doc.rust-lang.org/nightly/")]
2121

22-
#![feature(alloc)]
2322
#![feature(associated_consts)]
2423
#![feature(collections)]
24+
#![feature(rc_weak)]
2525
#![feature(rustc_diagnostic_macros)]
2626
#![feature(rustc_private)]
2727
#![feature(staged_api)]

src/librustc_trans/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2626
html_root_url = "http://doc.rust-lang.org/nightly/")]
2727

28-
#![feature(alloc)]
2928
#![feature(box_patterns)]
3029
#![feature(box_syntax)]
3130
#![feature(collections)]
@@ -40,6 +39,7 @@
4039
#![feature(path_relative_from)]
4140
#![feature(path_relative_from)]
4241
#![feature(quote)]
42+
#![feature(rc_weak)]
4343
#![feature(rustc_diagnostic_macros)]
4444
#![feature(rustc_private)]
4545
#![feature(staged_api)]

src/libstd/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
#![feature(allow_internal_unstable)]
108108
#![feature(associated_consts)]
109109
#![feature(borrow_state)]
110+
#![feature(box_raw)]
110111
#![feature(box_syntax)]
111112
#![feature(char_internals)]
112113
#![feature(collections)]
@@ -117,6 +118,7 @@
117118
#![feature(core_prelude)]
118119
#![feature(core_simd)]
119120
#![feature(fnbox)]
121+
#![feature(heap_api)]
120122
#![feature(int_error_internals)]
121123
#![feature(into_cow)]
122124
#![feature(iter_order)]
@@ -126,6 +128,7 @@
126128
#![feature(macro_reexport)]
127129
#![feature(no_std)]
128130
#![feature(num_bits_bytes)]
131+
#![feature(oom)]
129132
#![feature(optin_builtin_traits)]
130133
#![feature(rand)]
131134
#![feature(raw)]

src/libtest/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@
3737
#![feature(asm)]
3838
#![feature(box_syntax)]
3939
#![feature(collections)]
40-
#![feature(core)]
40+
#![feature(duration)]
41+
#![feature(duration_span)]
42+
#![feature(fnbox)]
43+
#![feature(iter_cmp)]
44+
#![feature(libc)]
4145
#![feature(rustc_private)]
46+
#![feature(set_stdio)]
4247
#![feature(staged_api)]
4348
#![feature(std_misc)]
44-
#![feature(libc)]
45-
#![feature(set_stdio)]
46-
#![feature(duration)]
47-
#![feature(duration_span)]
4849

4950
extern crate getopts;
5051
extern crate serialize;

0 commit comments

Comments
 (0)