Skip to content

Commit b67d769

Browse files
committed
---
yaml --- r: 219390 b: refs/heads/snap-stage3 c: da55e24 h: refs/heads/master v: v3
1 parent 7112926 commit b67d769

File tree

213 files changed

+1689
-1192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+1689
-1192
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: d234b0bb5f3210ca255d1ad71eb13add272fd078
3+
refs/heads/snap-stage3: da55e244a6829e94ef94c4e43243a3436b6a2dd4
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/src/compiletest/compiletest.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
#![crate_type = "bin"]
1212

1313
#![feature(box_syntax)]
14-
#![feature(collections)]
15-
#![feature(rustc_private)]
16-
#![feature(std_misc)]
17-
#![feature(test)]
14+
#![feature(dynamic_lib)]
15+
#![feature(libc)]
1816
#![feature(path_ext)]
17+
#![feature(rustc_private)]
18+
#![feature(slice_extras)]
1919
#![feature(str_char)]
20-
#![feature(libc)]
20+
#![feature(test)]
21+
#![feature(vec_push_all)]
2122

2223
#![deny(warnings)]
2324

branches/snap-stage3/src/liballoc/arc.rs

Lines changed: 37 additions & 19 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
@@ -191,23 +191,35 @@ impl<T: ?Sized> Arc<T> {
191191
/// # Examples
192192
///
193193
/// ```
194-
/// # #![feature(alloc)]
194+
/// # #![feature(arc_weak)]
195195
/// use std::sync::Arc;
196196
///
197197
/// let five = Arc::new(5);
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
205205
self.inner().weak.fetch_add(1, Relaxed);
206206
Weak { _ptr: self._ptr }
207207
}
208-
}
209208

210-
impl<T: ?Sized> Arc<T> {
209+
/// Get the number of weak references to this value.
210+
#[inline]
211+
#[unstable(feature = "arc_counts")]
212+
pub fn weak_count(this: &Arc<T>) -> usize {
213+
this.inner().weak.load(SeqCst) - 1
214+
}
215+
216+
/// Get the number of strong references to this value.
217+
#[inline]
218+
#[unstable(feature = "arc_counts")]
219+
pub fn strong_count(this: &Arc<T>) -> usize {
220+
this.inner().strong.load(SeqCst)
221+
}
222+
211223
#[inline]
212224
fn inner(&self) -> &ArcInner<T> {
213225
// This unsafety is ok because while this arc is alive we're guaranteed
@@ -236,13 +248,15 @@ impl<T: ?Sized> Arc<T> {
236248

237249
/// Get the number of weak references to this value.
238250
#[inline]
239-
#[unstable(feature = "alloc")]
240-
pub fn weak_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().weak.load(SeqCst) - 1 }
251+
#[unstable(feature = "arc_counts")]
252+
#[deprecated(since = "1.2.0", reason = "renamed to Arc::weak_count")]
253+
pub fn weak_count<T: ?Sized>(this: &Arc<T>) -> usize { Arc::weak_count(this) }
241254

242255
/// Get the number of strong references to this value.
243256
#[inline]
244-
#[unstable(feature = "alloc")]
245-
pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.load(SeqCst) }
257+
#[unstable(feature = "arc_counts")]
258+
#[deprecated(since = "1.2.0", reason = "renamed to Arc::strong_count")]
259+
pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { Arc::strong_count(this) }
246260

247261

248262
/// Returns a mutable reference to the contained value if the `Arc<T>` is unique.
@@ -255,7 +269,7 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.loa
255269
/// # Examples
256270
///
257271
/// ```
258-
/// # #![feature(alloc)]
272+
/// # #![feature(arc_unique, alloc)]
259273
/// extern crate alloc;
260274
/// # fn main() {
261275
/// use alloc::arc::{Arc, get_mut};
@@ -271,10 +285,12 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.loa
271285
/// # }
272286
/// ```
273287
#[inline]
274-
#[unstable(feature = "alloc")]
288+
#[unstable(feature = "arc_unique")]
289+
#[deprecated(since = "1.2.0",
290+
reason = "this function is unsafe with weak pointers")]
275291
pub unsafe fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
276292
// FIXME(#24880) potential race with upgraded weak pointers here
277-
if strong_count(this) == 1 && weak_count(this) == 0 {
293+
if Arc::strong_count(this) == 1 && Arc::weak_count(this) == 0 {
278294
// This unsafety is ok because we're guaranteed that the pointer
279295
// returned is the *only* pointer that will ever be returned to T. Our
280296
// reference count is guaranteed to be 1 at this point, and we required
@@ -342,7 +358,7 @@ impl<T: Clone> Arc<T> {
342358
/// # Examples
343359
///
344360
/// ```
345-
/// # #![feature(alloc)]
361+
/// # #![feature(arc_unique)]
346362
/// use std::sync::Arc;
347363
///
348364
/// # unsafe {
@@ -352,7 +368,9 @@ impl<T: Clone> Arc<T> {
352368
/// # }
353369
/// ```
354370
#[inline]
355-
#[unstable(feature = "alloc")]
371+
#[unstable(feature = "arc_unique")]
372+
#[deprecated(since = "1.2.0",
373+
reason = "this function is unsafe with weak pointers")]
356374
pub unsafe fn make_unique(&mut self) -> &mut T {
357375
// FIXME(#24880) potential race with upgraded weak pointers here
358376
//
@@ -438,7 +456,7 @@ impl<T: ?Sized> Drop for Arc<T> {
438456
}
439457
}
440458

441-
#[unstable(feature = "alloc",
459+
#[unstable(feature = "arc_weak",
442460
reason = "Weak pointers may not belong in this module.")]
443461
impl<T: ?Sized> Weak<T> {
444462
/// Upgrades a weak reference to a strong reference.
@@ -451,7 +469,7 @@ impl<T: ?Sized> Weak<T> {
451469
/// # Examples
452470
///
453471
/// ```
454-
/// # #![feature(alloc)]
472+
/// # #![feature(arc_weak)]
455473
/// use std::sync::Arc;
456474
///
457475
/// let five = Arc::new(5);
@@ -479,7 +497,7 @@ impl<T: ?Sized> Weak<T> {
479497
}
480498
}
481499

482-
#[unstable(feature = "alloc",
500+
#[unstable(feature = "arc_weak",
483501
reason = "Weak pointers may not belong in this module.")]
484502
impl<T: ?Sized> Clone for Weak<T> {
485503
/// Makes a clone of the `Weak<T>`.
@@ -489,7 +507,7 @@ impl<T: ?Sized> Clone for Weak<T> {
489507
/// # Examples
490508
///
491509
/// ```
492-
/// # #![feature(alloc)]
510+
/// # #![feature(arc_weak)]
493511
/// use std::sync::Arc;
494512
///
495513
/// let weak_five = Arc::new(5).downgrade();
@@ -513,7 +531,7 @@ impl<T: ?Sized> Drop for Weak<T> {
513531
/// # Examples
514532
///
515533
/// ```
516-
/// # #![feature(alloc)]
534+
/// # #![feature(arc_weak)]
517535
/// use std::sync::Arc;
518536
///
519537
/// {

branches/snap-stage3/src/liballoc/boxed.rs

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
//! A pointer type for heap allocation.
1212
//!
13-
//! `Box<T>`, casually referred to as a 'box', provides the simplest form of heap allocation in
14-
//! Rust. Boxes provide ownership for this allocation, and drop their contents when they go out of
15-
//! scope.
13+
//! `Box<T>`, casually referred to as a 'box', provides the simplest form of
14+
//! heap allocation in Rust. Boxes provide ownership for this allocation, and
15+
//! drop their contents when they go out of scope.
1616
//!
1717
//! # Examples
1818
//!
@@ -39,15 +39,17 @@
3939
//!
4040
//! This will print `Cons(1, Cons(2, Nil))`.
4141
//!
42-
//! Recursive structures must be boxed, because if the definition of `Cons` looked like this:
42+
//! Recursive structures must be boxed, because if the definition of `Cons`
43+
//! looked like this:
4344
//!
4445
//! ```rust,ignore
4546
//! Cons(T, List<T>),
4647
//! ```
4748
//!
48-
//! It wouldn't work. This is because the size of a `List` depends on how many elements are in the
49-
//! list, and so we don't know how much memory to allocate for a `Cons`. By introducing a `Box`,
50-
//! which has a defined size, we know how big `Cons` needs to be.
49+
//! It wouldn't work. This is because the size of a `List` depends on how many
50+
//! elements are in the list, and so we don't know how much memory to allocate
51+
//! for a `Cons`. By introducing a `Box`, which has a defined size, we know how
52+
//! big `Cons` needs to be.
5153
5254
#![stable(feature = "rust1", since = "1.0.0")]
5355

@@ -69,7 +71,7 @@ use core::raw::{TraitObject};
6971
/// The following two examples are equivalent:
7072
///
7173
/// ```
72-
/// # #![feature(alloc)]
74+
/// # #![feature(box_heap)]
7375
/// #![feature(box_syntax)]
7476
/// use std::boxed::HEAP;
7577
///
@@ -79,7 +81,7 @@ use core::raw::{TraitObject};
7981
/// }
8082
/// ```
8183
#[lang = "exchange_heap"]
82-
#[unstable(feature = "alloc",
84+
#[unstable(feature = "box_heap",
8385
reason = "may be renamed; uncertain about custom allocator design")]
8486
pub const HEAP: () = ();
8587

@@ -119,12 +121,37 @@ impl<T : ?Sized> Box<T> {
119121
/// Function is unsafe, because improper use of this function may
120122
/// lead to memory problems like double-free, for example if the
121123
/// function is called twice on the same raw pointer.
122-
#[unstable(feature = "alloc",
124+
#[unstable(feature = "box_raw",
123125
reason = "may be renamed or moved out of Box scope")]
124126
#[inline]
127+
// NB: may want to be called from_ptr, see comments on CStr::from_ptr
125128
pub unsafe fn from_raw(raw: *mut T) -> Self {
126129
mem::transmute(raw)
127130
}
131+
132+
/// Consumes the `Box`, returning the wrapped raw pointer.
133+
///
134+
/// After call to this function, caller is responsible for the memory
135+
/// previously managed by `Box`, in particular caller should properly
136+
/// destroy `T` and release memory. The proper way to do it is to
137+
/// convert pointer back to `Box` with `Box::from_raw` function, because
138+
/// `Box` does not specify, how memory is allocated.
139+
///
140+
/// # Examples
141+
/// ```
142+
/// # #![feature(box_raw)]
143+
/// use std::boxed;
144+
///
145+
/// let seventeen = Box::new(17u32);
146+
/// let raw = boxed::into_raw(seventeen);
147+
/// let boxed_again = unsafe { Box::from_raw(raw) };
148+
/// ```
149+
#[unstable(feature = "box_raw", reason = "may be renamed")]
150+
#[inline]
151+
// NB: may want to be called into_ptr, see comments on CStr::from_ptr
152+
pub fn into_raw(b: Box<T>) -> *mut T {
153+
unsafe { mem::transmute(b) }
154+
}
128155
}
129156

130157
/// Consumes the `Box`, returning the wrapped raw pointer.
@@ -137,18 +164,18 @@ impl<T : ?Sized> Box<T> {
137164
///
138165
/// # Examples
139166
/// ```
140-
/// # #![feature(alloc)]
167+
/// # #![feature(box_raw)]
141168
/// use std::boxed;
142169
///
143170
/// let seventeen = Box::new(17u32);
144171
/// let raw = boxed::into_raw(seventeen);
145172
/// let boxed_again = unsafe { Box::from_raw(raw) };
146173
/// ```
147-
#[unstable(feature = "alloc",
148-
reason = "may be renamed")]
174+
#[unstable(feature = "box_raw", reason = "may be renamed")]
175+
#[deprecated(since = "1.2.0", reason = "renamed to Box::into_raw")]
149176
#[inline]
150177
pub fn into_raw<T : ?Sized>(b: Box<T>) -> *mut T {
151-
unsafe { mem::transmute(b) }
178+
Box::into_raw(b)
152179
}
153180

154181
#[stable(feature = "rust1", since = "1.0.0")]
@@ -181,7 +208,7 @@ impl<T: Clone> Clone for Box<T> {
181208
/// # Examples
182209
///
183210
/// ```
184-
/// # #![feature(alloc, core)]
211+
/// # #![feature(box_raw)]
185212
/// let x = Box::new(5);
186213
/// let mut y = Box::new(10);
187214
///
@@ -242,7 +269,7 @@ impl Box<Any> {
242269
if self.is::<T>() {
243270
unsafe {
244271
// Get the raw representation of the trait object
245-
let raw = into_raw(self);
272+
let raw = Box::into_raw(self);
246273
let to: TraitObject =
247274
mem::transmute::<*mut Any, TraitObject>(raw);
248275

@@ -334,7 +361,7 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {}
334361
/// -> i32>`.
335362
///
336363
/// ```
337-
/// #![feature(core)]
364+
/// #![feature(fnbox)]
338365
///
339366
/// use std::boxed::FnBox;
340367
/// use std::collections::HashMap;
@@ -355,7 +382,7 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {}
355382
/// }
356383
/// ```
357384
#[rustc_paren_sugar]
358-
#[unstable(feature = "core", reason = "Newly introduced")]
385+
#[unstable(feature = "fnbox", reason = "Newly introduced")]
359386
pub trait FnBox<A> {
360387
type Output;
361388

branches/snap-stage3/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
}

0 commit comments

Comments
 (0)