Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#26351 (Use TLS to store a type context for pretty-printing types) + #26147. #26412

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
c14d86f
core: Split apart the global `core` feature
alexcrichton Jun 9, 2015
c44f539
alloc: Split apart the global `alloc` feature
alexcrichton Jun 9, 2015
d444d0c
collections: Split the `collections` feature
alexcrichton Jun 9, 2015
6895311
std: Split the `std_misc` feature
alexcrichton Jun 10, 2015
ce1a965
Fallout in tests and docs from feature renamings
alexcrichton Jun 10, 2015
02a8d5b
std: Deprecate the RandomAccessIterator trait
alexcrichton Jun 11, 2015
669d1cd
std: Deprecate iter::{Unfold, Iterate}
alexcrichton Jun 11, 2015
153de4c
std: Deprecate the copy_{,mut_}lifetime functions
alexcrichton Jun 11, 2015
c72e01e
std: Deprecate result::fold
alexcrichton Jun 11, 2015
f55c366
std: Deprecate the IntSliceExt trait
alexcrichton Jun 11, 2015
a05ed99
std: Remove two internal `str_internals` functions
alexcrichton Jun 11, 2015
8797c9e
std: Deprecate f{32,64}::consts::PI_2
alexcrichton Jun 11, 2015
cdb69e2
std: Stabilize the remaining wrapping_* functions
alexcrichton Jun 11, 2015
f85c4f6
std: Deprecate all permutation-related slice methods
alexcrichton Jun 11, 2015
68b628b
std: Deprecate Vec::from_raw_buf
alexcrichton Jun 11, 2015
c032d6f
std: Stabilize the sync_poison feature
alexcrichton Jun 11, 2015
f358087
std: Stabilize the `once_new` feature
alexcrichton Jun 11, 2015
17a1059
std: Stabilize the `iter_{once,empty}` features
alexcrichton Jun 11, 2015
2d389c1
std: Stabilize the `str_matches` feature
alexcrichton Jun 11, 2015
0d818b4
std: Deprecate the io::BufStream type
alexcrichton Jun 11, 2015
96cce02
std: Deprecate the `exit_status` feature
alexcrichton Jun 11, 2015
04f7eba
std: Deprecate the `future` feature
alexcrichton Jun 11, 2015
d645f8f
std: Deprecate the `scoped` feature
alexcrichton Jun 11, 2015
3346fb0
std: Deprecate the `thunk` module
alexcrichton Jun 11, 2015
aa931e9
std: Move free-functions to associated functions
alexcrichton Jun 11, 2015
b4a2823
More test fixes and fallout of stability changes
alexcrichton Jun 11, 2015
252ef28
std: Update stable since for `core::char`
alexcrichton Jun 11, 2015
edf9335
std: Hide some internal functions more aggressively
alexcrichton Jun 11, 2015
c9b40a3
std: Stabilize vec_map::Entry::or_insert{,_with}
alexcrichton Jun 11, 2015
913c227
Add comment about stabilizing CString::from_ptr
alexcrichton Jun 11, 2015
b637f6b
Fix the E0252 error message to use better names for things.
Jun 18, 2015
f451812
Auto merge of #26385 - nham:fix_25396, r=alexcrichton
bors Jun 18, 2015
ec33338
Fix libstd tests
alexcrichton Jun 12, 2015
9cc0b22
Auto merge of #26192 - alexcrichton:features-clean, r=aturon
bors Jun 18, 2015
ff8fee1
Auto merge of #26147 - arielb1:assoc-trans, r=nikomatsakis
bors Jun 18, 2015
2e997ef
rustc: remove ownership of tcx from trans' context.
eddyb Jun 13, 2015
84b49b2
rustc_resolve: don't require redundant arguments to resolve_crate.
eddyb Jun 13, 2015
bc383f6
rustc: enforce stack discipline on ty::ctxt.
eddyb Jun 14, 2015
4e0cb86
rustc: reduce ppaux's public footprint to 5 functions.
eddyb Jun 14, 2015
96ad4a4
rustc: use Repr and UserString instead of ppaux::ty_to_string.
eddyb Jun 15, 2015
6061707
rustc: leave only one free top-level function in ppaux, and private.
eddyb Jun 15, 2015
d8952e7
rustc: store the type context in TLS and allow safe access to it.
eddyb Jun 16, 2015
1f70a2e
rustc: allow "lifting" T<'a> to T<'tcx> if the value is part of ty::c…
eddyb Jun 16, 2015
a372755
rustc: use the TLS type context in Repr and UserString.
eddyb Jun 16, 2015
b510ea1
Clean up unused argument/variable warnings.
eddyb Jun 16, 2015
af7daa0
rustc: remove some unused UserString and Repr impls.
eddyb Jun 17, 2015
17e333d
Move AST Repr impls to Debug impls in libsyntax.
eddyb Jun 17, 2015
dfbc960
rustc: replace Repr/UserString impls with Debug/Display ones.
eddyb Jun 18, 2015
0b58fdf
rustc: remove Repr and UserString.
eddyb Jun 18, 2015
d914831
rustc: add more doc comments to ty::Lift and ty::with_ctxt.
eddyb Jun 18, 2015
6eed166
Remove extra fmt::Debug impl for VtableClosureData from #26147.
eddyb Jun 18, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 6 additions & 5 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
#![crate_type = "bin"]

#![feature(box_syntax)]
#![feature(collections)]
#![feature(rustc_private)]
#![feature(std_misc)]
#![feature(test)]
#![feature(dynamic_lib)]
#![feature(libc)]
#![feature(path_ext)]
#![feature(rustc_private)]
#![feature(slice_extras)]
#![feature(str_char)]
#![feature(libc)]
#![feature(test)]
#![feature(vec_push_all)]

#![deny(warnings)]

Expand Down
56 changes: 37 additions & 19 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
/// Weak pointers will not keep the data inside of the `Arc` alive, and can be
/// used to break cycles between `Arc` pointers.
#[unsafe_no_drop_flag]
#[unstable(feature = "alloc",
#[unstable(feature = "arc_weak",
reason = "Weak pointers may not belong in this module.")]
pub struct Weak<T: ?Sized> {
// FIXME #12808: strange name to try to avoid interfering with
Expand Down Expand Up @@ -191,23 +191,35 @@ impl<T: ?Sized> Arc<T> {
/// # Examples
///
/// ```
/// # #![feature(alloc)]
/// # #![feature(arc_weak)]
/// use std::sync::Arc;
///
/// let five = Arc::new(5);
///
/// let weak_five = five.downgrade();
/// ```
#[unstable(feature = "alloc",
#[unstable(feature = "arc_weak",
reason = "Weak pointers may not belong in this module.")]
pub fn downgrade(&self) -> Weak<T> {
// See the clone() impl for why this is relaxed
self.inner().weak.fetch_add(1, Relaxed);
Weak { _ptr: self._ptr }
}
}

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

/// Get the number of strong references to this value.
#[inline]
#[unstable(feature = "arc_counts")]
pub fn strong_count(this: &Arc<T>) -> usize {
this.inner().strong.load(SeqCst)
}

#[inline]
fn inner(&self) -> &ArcInner<T> {
// This unsafety is ok because while this arc is alive we're guaranteed
Expand Down Expand Up @@ -236,13 +248,15 @@ impl<T: ?Sized> Arc<T> {

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

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


/// Returns a mutable reference to the contained value if the `Arc<T>` is unique.
Expand All @@ -255,7 +269,7 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.loa
/// # Examples
///
/// ```
/// # #![feature(alloc)]
/// # #![feature(arc_unique, alloc)]
/// extern crate alloc;
/// # fn main() {
/// use alloc::arc::{Arc, get_mut};
Expand All @@ -271,10 +285,12 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.loa
/// # }
/// ```
#[inline]
#[unstable(feature = "alloc")]
#[unstable(feature = "arc_unique")]
#[deprecated(since = "1.2.0",
reason = "this function is unsafe with weak pointers")]
pub unsafe fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
// FIXME(#24880) potential race with upgraded weak pointers here
if strong_count(this) == 1 && weak_count(this) == 0 {
if Arc::strong_count(this) == 1 && Arc::weak_count(this) == 0 {
// This unsafety is ok because we're guaranteed that the pointer
// returned is the *only* pointer that will ever be returned to T. Our
// reference count is guaranteed to be 1 at this point, and we required
Expand Down Expand Up @@ -342,7 +358,7 @@ impl<T: Clone> Arc<T> {
/// # Examples
///
/// ```
/// # #![feature(alloc)]
/// # #![feature(arc_unique)]
/// use std::sync::Arc;
///
/// # unsafe {
Expand All @@ -352,7 +368,9 @@ impl<T: Clone> Arc<T> {
/// # }
/// ```
#[inline]
#[unstable(feature = "alloc")]
#[unstable(feature = "arc_unique")]
#[deprecated(since = "1.2.0",
reason = "this function is unsafe with weak pointers")]
pub unsafe fn make_unique(&mut self) -> &mut T {
// FIXME(#24880) potential race with upgraded weak pointers here
//
Expand Down Expand Up @@ -438,7 +456,7 @@ impl<T: ?Sized> Drop for Arc<T> {
}
}

#[unstable(feature = "alloc",
#[unstable(feature = "arc_weak",
reason = "Weak pointers may not belong in this module.")]
impl<T: ?Sized> Weak<T> {
/// Upgrades a weak reference to a strong reference.
Expand All @@ -451,7 +469,7 @@ impl<T: ?Sized> Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(alloc)]
/// # #![feature(arc_weak)]
/// use std::sync::Arc;
///
/// let five = Arc::new(5);
Expand Down Expand Up @@ -479,7 +497,7 @@ impl<T: ?Sized> Weak<T> {
}
}

#[unstable(feature = "alloc",
#[unstable(feature = "arc_weak",
reason = "Weak pointers may not belong in this module.")]
impl<T: ?Sized> Clone for Weak<T> {
/// Makes a clone of the `Weak<T>`.
Expand All @@ -489,7 +507,7 @@ impl<T: ?Sized> Clone for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(alloc)]
/// # #![feature(arc_weak)]
/// use std::sync::Arc;
///
/// let weak_five = Arc::new(5).downgrade();
Expand All @@ -513,7 +531,7 @@ impl<T: ?Sized> Drop for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(alloc)]
/// # #![feature(arc_weak)]
/// use std::sync::Arc;
///
/// {
Expand Down
63 changes: 45 additions & 18 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

//! A pointer type for heap allocation.
//!
//! `Box<T>`, casually referred to as a 'box', provides the simplest form of heap allocation in
//! Rust. Boxes provide ownership for this allocation, and drop their contents when they go out of
//! scope.
//! `Box<T>`, casually referred to as a 'box', provides the simplest form of
//! heap allocation in Rust. Boxes provide ownership for this allocation, and
//! drop their contents when they go out of scope.
//!
//! # Examples
//!
Expand All @@ -39,15 +39,17 @@
//!
//! This will print `Cons(1, Cons(2, Nil))`.
//!
//! Recursive structures must be boxed, because if the definition of `Cons` looked like this:
//! Recursive structures must be boxed, because if the definition of `Cons`
//! looked like this:
//!
//! ```rust,ignore
//! Cons(T, List<T>),
//! ```
//!
//! It wouldn't work. This is because the size of a `List` depends on how many elements are in the
//! list, and so we don't know how much memory to allocate for a `Cons`. By introducing a `Box`,
//! which has a defined size, we know how big `Cons` needs to be.
//! It wouldn't work. This is because the size of a `List` depends on how many
//! elements are in the list, and so we don't know how much memory to allocate
//! for a `Cons`. By introducing a `Box`, which has a defined size, we know how
//! big `Cons` needs to be.

#![stable(feature = "rust1", since = "1.0.0")]

Expand All @@ -69,7 +71,7 @@ use core::raw::{TraitObject};
/// The following two examples are equivalent:
///
/// ```
/// # #![feature(alloc)]
/// # #![feature(box_heap)]
/// #![feature(box_syntax)]
/// use std::boxed::HEAP;
///
Expand All @@ -79,7 +81,7 @@ use core::raw::{TraitObject};
/// }
/// ```
#[lang = "exchange_heap"]
#[unstable(feature = "alloc",
#[unstable(feature = "box_heap",
reason = "may be renamed; uncertain about custom allocator design")]
pub const HEAP: () = ();

Expand Down Expand Up @@ -119,12 +121,37 @@ impl<T : ?Sized> Box<T> {
/// Function is unsafe, because improper use of this function may
/// lead to memory problems like double-free, for example if the
/// function is called twice on the same raw pointer.
#[unstable(feature = "alloc",
#[unstable(feature = "box_raw",
reason = "may be renamed or moved out of Box scope")]
#[inline]
// NB: may want to be called from_ptr, see comments on CStr::from_ptr
pub unsafe fn from_raw(raw: *mut T) -> Self {
mem::transmute(raw)
}

/// Consumes the `Box`, returning the wrapped raw pointer.
///
/// After call to this function, caller is responsible for the memory
/// previously managed by `Box`, in particular caller should properly
/// destroy `T` and release memory. The proper way to do it is to
/// convert pointer back to `Box` with `Box::from_raw` function, because
/// `Box` does not specify, how memory is allocated.
///
/// # Examples
/// ```
/// # #![feature(box_raw)]
/// use std::boxed;
///
/// let seventeen = Box::new(17u32);
/// let raw = boxed::into_raw(seventeen);
/// let boxed_again = unsafe { Box::from_raw(raw) };
/// ```
#[unstable(feature = "box_raw", reason = "may be renamed")]
#[inline]
// NB: may want to be called into_ptr, see comments on CStr::from_ptr
pub fn into_raw(b: Box<T>) -> *mut T {
unsafe { mem::transmute(b) }
}
}

/// Consumes the `Box`, returning the wrapped raw pointer.
Expand All @@ -137,18 +164,18 @@ impl<T : ?Sized> Box<T> {
///
/// # Examples
/// ```
/// # #![feature(alloc)]
/// # #![feature(box_raw)]
/// use std::boxed;
///
/// let seventeen = Box::new(17u32);
/// let raw = boxed::into_raw(seventeen);
/// let boxed_again = unsafe { Box::from_raw(raw) };
/// ```
#[unstable(feature = "alloc",
reason = "may be renamed")]
#[unstable(feature = "box_raw", reason = "may be renamed")]
#[deprecated(since = "1.2.0", reason = "renamed to Box::into_raw")]
#[inline]
pub fn into_raw<T : ?Sized>(b: Box<T>) -> *mut T {
unsafe { mem::transmute(b) }
Box::into_raw(b)
}

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -181,7 +208,7 @@ impl<T: Clone> Clone for Box<T> {
/// # Examples
///
/// ```
/// # #![feature(alloc, core)]
/// # #![feature(box_raw)]
/// let x = Box::new(5);
/// let mut y = Box::new(10);
///
Expand Down Expand Up @@ -242,7 +269,7 @@ impl Box<Any> {
if self.is::<T>() {
unsafe {
// Get the raw representation of the trait object
let raw = into_raw(self);
let raw = Box::into_raw(self);
let to: TraitObject =
mem::transmute::<*mut Any, TraitObject>(raw);

Expand Down Expand Up @@ -334,7 +361,7 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {}
/// -> i32>`.
///
/// ```
/// #![feature(core)]
/// #![feature(fnbox)]
///
/// use std::boxed::FnBox;
/// use std::collections::HashMap;
Expand All @@ -355,7 +382,7 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {}
/// }
/// ```
#[rustc_paren_sugar]
#[unstable(feature = "core", reason = "Newly introduced")]
#[unstable(feature = "fnbox", reason = "Newly introduced")]
pub trait FnBox<A> {
type Output;

Expand Down
7 changes: 6 additions & 1 deletion src/liballoc/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![unstable(feature = "heap_api",
reason = "the precise API and guarantees it provides may be tweaked \
slightly, especially to possibly take into account the \
types being stored to make room for a future \
tracing garbage collector")]

use core::{isize, usize};

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