1
Fork 0

More test fixes and fallout of stability changes

This commit is contained in:
Alex Crichton 2015-06-10 19:33:04 -07:00
parent aa931e9c6f
commit b4a2823cd6
40 changed files with 111 additions and 122 deletions

View file

@ -290,7 +290,7 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { Arc::strong_count(this)
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

View file

@ -267,7 +267,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);

View file

@ -148,26 +148,24 @@
//! ```
#![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*;
#[cfg(not(test))]
use boxed;
use boxed::Box;
#[cfg(test)]
use std::boxed;
use std::boxed::Box;
use core::cell::Cell;
use core::clone::Clone;
use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
use core::default::Default;
use core::cmp::Ordering;
use core::fmt;
use core::hash::{Hasher, Hash};
use core::intrinsics::{assume, drop_in_place};
use core::marker::{self, Sized, Unsize};
use core::marker::{self, Unsize};
use core::mem::{self, min_align_of, size_of, min_align_of_val, size_of_val, forget};
use core::nonzero::NonZero;
use core::ops::{CoerceUnsized, Deref, Drop};
use core::option::Option;
use core::option::Option::{Some, None};
use core::ops::{CoerceUnsized, Deref};
use core::ptr;
use core::result::Result;
use core::result::Result::{Ok, Err};
use heap::deallocate;
@ -212,7 +210,7 @@ impl<T> Rc<T> {
// pointers, which ensures that the weak destructor never frees
// the allocation while the strong destructor is running, even
// if the weak pointer is stored inside the strong one.
_ptr: NonZero::new(boxed::into_raw(box RcBox {
_ptr: NonZero::new(Box::into_raw(box RcBox {
strong: Cell::new(1),
weak: Cell::new(1),
value: value
@ -230,14 +228,14 @@ impl<T> Rc<T> {
///
/// ```
/// # #![feature(rc_unique)]
/// use std::rc::{self, Rc};
/// use std::rc::Rc;
///
/// let x = Rc::new(3);
/// assert_eq!(rc::try_unwrap(x), Ok(3));
/// assert_eq!(Rc::try_unwrap(x), Ok(3));
///
/// let x = Rc::new(4);
/// let _y = x.clone();
/// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4)));
/// assert_eq!(Rc::try_unwrap(x), Err(Rc::new(4)));
/// ```
#[inline]
#[unstable(feature = "rc_unique")]
@ -295,17 +293,16 @@ impl<T: ?Sized> Rc<T> {
///
/// ```
/// # #![feature(rc_unique)]
/// use std::rc;
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
///
/// rc::is_unique(&five);
/// assert!(Rc::is_unique(&five));
/// ```
#[inline]
#[unstable(feature = "rc_unique")]
pub fn is_unique(rc: &Rc<T>) -> bool {
weak_count(rc) == 0 && strong_count(rc) == 1
Rc::weak_count(rc) == 0 && Rc::strong_count(rc) == 1
}
/// Returns a mutable reference to the contained value if the `Rc<T>` is
@ -317,14 +314,14 @@ impl<T: ?Sized> Rc<T> {
///
/// ```
/// # #![feature(rc_unique)]
/// use std::rc::{self, Rc};
/// use std::rc::Rc;
///
/// let mut x = Rc::new(3);
/// *rc::get_mut(&mut x).unwrap() = 4;
/// *Rc::get_mut(&mut x).unwrap() = 4;
/// assert_eq!(*x, 4);
///
/// let _y = x.clone();
/// assert!(rc::get_mut(&mut x).is_none());
/// assert!(Rc::get_mut(&mut x).is_none());
/// ```
#[inline]
#[unstable(feature = "rc_unique")]
@ -432,7 +429,7 @@ impl<T: Clone> Rc<T> {
#[inline]
#[unstable(feature = "rc_unique")]
pub fn make_unique(&mut self) -> &mut T {
if !is_unique(self) {
if !Rc::is_unique(self) {
*self = Rc::new((**self).clone())
}
// This unsafety is ok because we're guaranteed that the pointer

View file

@ -86,6 +86,7 @@ use core::cmp::Ordering;
use core::cmp;
use core::fmt;
use core::hash;
#[allow(deprecated)]
use core::iter::RandomAccessIterator;
use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
use core::iter::{self, FromIterator};
@ -1188,6 +1189,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
impl<'a> ExactSizeIterator for Iter<'a> {}
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
impl<'a> RandomAccessIterator for Iter<'a> {
#[inline]
fn indexable(&self) -> usize {

View file

@ -685,10 +685,7 @@ mod stack {
/// tied to the original tree.
pub fn into_top(mut self) -> &'a mut V {
unsafe {
mem::copy_mut_lifetime(
self.map,
self.top.from_raw_mut().val_mut()
)
&mut *(self.top.from_raw_mut().val_mut() as *mut V)
}
}
}

View file

@ -34,7 +34,6 @@
#![feature(box_patterns)]
#![feature(box_raw)]
#![feature(box_syntax)]
#![feature(copy_lifetime)]
#![feature(core)]
#![feature(core_intrinsics)]
#![feature(core_prelude)]
@ -56,7 +55,7 @@
#![feature(staged_api)]
#![feature(step_by)]
#![feature(str_char)]
#![feature(str_internals)]
#![feature(str_match_indices)]
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(unique)]

View file

@ -151,6 +151,7 @@ mod hack {
}
}
#[allow(deprecated)]
pub fn permutations<T>(s: &[T]) -> Permutations<T> where T: Clone {
Permutations{
swaps: ElementSwaps::new(s.len()),
@ -871,6 +872,7 @@ impl<T> [T] {
/// assert_eq!(Some(vec![1, 3, 2]), perms.next());
/// assert_eq!(Some(vec![3, 1, 2]), perms.next());
/// ```
#[allow(deprecated)]
#[unstable(feature = "permutations")]
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
#[inline]
@ -896,6 +898,7 @@ impl<T> [T] {
/// let b: &mut [_] = &mut [1, 0, 2];
/// assert!(v == b);
/// ```
#[allow(deprecated)]
#[unstable(feature = "permutations",
reason = "uncertain if this merits inclusion in std")]
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
@ -920,6 +923,7 @@ impl<T> [T] {
/// let b: &mut [_] = &mut [0, 1, 2];
/// assert!(v == b);
/// ```
#[allow(deprecated)]
#[unstable(feature = "permutations",
reason = "uncertain if this merits inclusion in std")]
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
@ -1067,6 +1071,7 @@ impl<T: Clone, V: Borrow<[T]>> SliceConcatExt<T> for [V] {
///
/// The last generated swap is always (0, 1), and it returns the
/// sequence to its initial order.
#[allow(deprecated)]
#[unstable(feature = "permutations")]
#[derive(Clone)]
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
@ -1078,6 +1083,7 @@ pub struct ElementSwaps {
swaps_made : usize,
}
#[allow(deprecated)]
impl ElementSwaps {
/// Creates an `ElementSwaps` iterator for a sequence of `length` elements.
#[unstable(feature = "permutations")]
@ -1137,6 +1143,7 @@ struct SizeDirection {
}
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
impl Iterator for ElementSwaps {
type Item = (usize, usize);
@ -1205,12 +1212,14 @@ impl Iterator for ElementSwaps {
/// Generates even and odd permutations alternately.
#[unstable(feature = "permutations")]
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
#[allow(deprecated)]
pub struct Permutations<T> {
swaps: ElementSwaps,
v: Vec<T>,
}
#[unstable(feature = "permutations", reason = "trait is unstable")]
#[allow(deprecated)]
impl<T: Clone> Iterator for Permutations<T> {
type Item = Vec<T>;

View file

@ -1520,7 +1520,6 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_matches)]
/// let v: Vec<&str> = "abcXXXabcYYYabc".matches("abc").collect();
/// assert_eq!(v, ["abc", "abc", "abc"]);
///
@ -1552,7 +1551,6 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_matches)]
/// let v: Vec<&str> = "abcXXXabcYYYabc".rmatches("abc").collect();
/// assert_eq!(v, ["abc", "abc", "abc"]);
///
@ -1593,7 +1591,7 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_matches)]
/// # #![feature(str_match_indices)]
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect();
/// assert_eq!(v, [(0, 3), (6, 9), (12, 15)]);
///
@ -1637,7 +1635,7 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_matches)]
/// # #![feature(str_match_indices)]
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".rmatch_indices("abc").collect();
/// assert_eq!(v, [(12, 15), (6, 9), (0, 3)]);
///

View file

@ -1709,12 +1709,14 @@ impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
}
}
#[allow(deprecated)]
impl<'a, T: 'a> IntoCow<'a, [T]> for Vec<T> where T: Clone {
fn into_cow(self) -> Cow<'a, [T]> {
Cow::Owned(self)
}
}
#[allow(deprecated)]
impl<'a, T> IntoCow<'a, [T]> for &'a [T] where T: Clone {
fn into_cow(self) -> Cow<'a, [T]> {
Cow::Borrowed(self)

View file

@ -1530,6 +1530,7 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
impl<'a, T> RandomAccessIterator for Iter<'a, T> {
#[inline]
fn indexable(&self) -> usize {

View file

@ -43,7 +43,7 @@
#![feature(step_by)]
#![feature(str_char)]
#![feature(str_escape)]
#![feature(str_matches)]
#![feature(str_match_indices)]
#![feature(str_utf16)]
#![feature(subslice_offset)]
#![feature(test)]

View file

@ -1234,6 +1234,7 @@ impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I {
reason = "trait has not proven itself as a widely useful \
abstraction for iterators, and more time may be needed \
for iteration on the design")]
#[allow(deprecated)]
pub trait RandomAccessIterator: Iterator {
/// Returns the number of indexable elements. At most `std::usize::MAX`
/// elements are indexable, even if the iterator represents a longer range.
@ -1313,6 +1314,7 @@ impl<I> DoubleEndedIterator for Rev<I> where I: DoubleEndedIterator {
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<I> RandomAccessIterator for Rev<I>
where I: DoubleEndedIterator + RandomAccessIterator
{
@ -1416,6 +1418,7 @@ impl<'a, I, T: 'a> ExactSizeIterator for Cloned<I>
{}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<'a, I, T: 'a> RandomAccessIterator for Cloned<I>
where I: RandomAccessIterator<Item=&'a T>, T: Clone
{
@ -1463,6 +1466,7 @@ impl<I> Iterator for Cycle<I> where I: Clone + Iterator {
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<I> RandomAccessIterator for Cycle<I> where
I: Clone + RandomAccessIterator,
{
@ -1577,6 +1581,7 @@ impl<A, B> DoubleEndedIterator for Chain<A, B> where
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<A, B> RandomAccessIterator for Chain<A, B> where
A: RandomAccessIterator,
B: RandomAccessIterator<Item = A::Item>,
@ -1665,6 +1670,7 @@ impl<A, B> DoubleEndedIterator for Zip<A, B> where
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<A, B> RandomAccessIterator for Zip<A, B> where
A: RandomAccessIterator,
B: RandomAccessIterator
@ -1719,6 +1725,7 @@ impl<B, I: DoubleEndedIterator, F> DoubleEndedIterator for Map<I, F> where
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<B, I: RandomAccessIterator, F> RandomAccessIterator for Map<I, F> where
F: FnMut(I::Item) -> B,
{
@ -1893,6 +1900,7 @@ impl<I> DoubleEndedIterator for Enumerate<I> where
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<I> RandomAccessIterator for Enumerate<I> where I: RandomAccessIterator {
#[inline]
fn indexable(&self) -> usize {
@ -2143,6 +2151,7 @@ impl<I> Iterator for Skip<I> where I: Iterator {
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{
#[inline]
fn indexable(&self) -> usize {
@ -2215,6 +2224,7 @@ impl<I> Iterator for Take<I> where I: Iterator{
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{
#[inline]
fn indexable(&self) -> usize {
@ -2416,6 +2426,7 @@ impl<I> DoubleEndedIterator for Fuse<I> where I: DoubleEndedIterator {
// Allow RandomAccessIterators to be fused without affecting random-access behavior
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<I> RandomAccessIterator for Fuse<I> where I: RandomAccessIterator {
#[inline]
fn indexable(&self) -> usize {
@ -2491,6 +2502,7 @@ impl<I: DoubleEndedIterator, F> DoubleEndedIterator for Inspect<I, F>
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
where F: FnMut(&I::Item),
{
@ -2545,6 +2557,7 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
#[deprecated(since = "1.2.0",
reason = "has gained enough traction to retain its position \
in the standard library")]
#[allow(deprecated)]
pub struct Unfold<St, F> {
f: F,
/// Internal state that will be passed to the closure on the next iteration
@ -2556,6 +2569,7 @@ pub struct Unfold<St, F> {
#[deprecated(since = "1.2.0",
reason = "has gained enough traction to retain its position \
in the standard library")]
#[allow(deprecated)]
impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
/// Creates a new iterator with the specified closure as the "iterator
/// function" and an initial state to eventually pass to the closure
@ -2569,6 +2583,7 @@ impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
}
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
impl<A, St, F> Iterator for Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
type Item = A;
@ -2977,7 +2992,7 @@ impl<A: Clone> Iterator for Repeat<A> {
type Item = A;
#[inline]
fn next(&mut self) -> Option<A> { self.idx(0) }
fn next(&mut self) -> Option<A> { Some(self.element.clone()) }
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) { (usize::MAX, None) }
}
@ -2985,10 +3000,11 @@ impl<A: Clone> Iterator for Repeat<A> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<A: Clone> DoubleEndedIterator for Repeat<A> {
#[inline]
fn next_back(&mut self) -> Option<A> { self.idx(0) }
fn next_back(&mut self) -> Option<A> { Some(self.element.clone()) }
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<A: Clone> RandomAccessIterator for Repeat<A> {
#[inline]
fn indexable(&self) -> usize { usize::MAX }
@ -3004,6 +3020,7 @@ type IterateState<T, F> = (F, Option<T>, bool);
#[deprecated(since = "1.2.0",
reason = "has gained enough traction to retain its position \
in the standard library")]
#[allow(deprecated)]
pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>;
/// Creates a new iterator that produces an infinite sequence of
@ -3012,6 +3029,7 @@ pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>)
#[deprecated(since = "1.2.0",
reason = "has gained enough traction to retain its position \
in the standard library")]
#[allow(deprecated)]
pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
T: Clone,
F: FnMut(T) -> T,

View file

@ -802,6 +802,7 @@ impl<'a, T> Clone for Iter<'a, T> {
}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<'a, T> RandomAccessIterator for Iter<'a, T> {
#[inline]
fn indexable(&self) -> usize {
@ -1174,6 +1175,7 @@ impl<'a, T> DoubleEndedIterator for Windows<'a, T> {
impl<'a, T> ExactSizeIterator for Windows<'a, T> {}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<'a, T> RandomAccessIterator for Windows<'a, T> {
#[inline]
fn indexable(&self) -> usize {
@ -1261,6 +1263,7 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> {
impl<'a, T> ExactSizeIterator for Chunks<'a, T> {}
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
#[allow(deprecated)]
impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
#[inline]
fn indexable(&self) -> usize {
@ -1520,6 +1523,7 @@ pub trait IntSliceExt<U, S> {
macro_rules! impl_int_slice {
($u:ty, $s:ty, $t:ty) => {
#[unstable(feature = "int_slice")]
#[allow(deprecated)]
impl IntSliceExt<$u, $s> for [$t] {
#[inline]
fn as_unsigned(&self) -> &[$u] { unsafe { transmute(self) } }

View file

@ -173,12 +173,10 @@
#![feature(box_syntax)]
#![feature(const_fn)]
#![feature(iter_cmp)]
#![feature(once_new)]
#![feature(rt)]
#![feature(staged_api)]
#![feature(static_mutex)]
use std::boxed;
use std::cell::RefCell;
use std::fmt;
use std::io::{self, Stderr};
@ -437,12 +435,12 @@ fn init() {
assert!(FILTER.is_null());
match filter {
Some(f) => FILTER = boxed::into_raw(box f),
Some(f) => FILTER = Box::into_raw(box f),
None => {}
}
assert!(DIRECTIVES.is_null());
DIRECTIVES = boxed::into_raw(box directives);
DIRECTIVES = Box::into_raw(box directives);
// Schedule the cleanup for the globals for when the runtime exits.
let _ = rt::at_exit(move || {

View file

@ -57,7 +57,7 @@
#![feature(slice_position_elem)]
#![feature(staged_api)]
#![feature(str_char)]
#![feature(str_matches)]
#![feature(str_match_indices)]
#![feature(vec_push_all)]
#![feature(wrapping)]
#![cfg_attr(test, feature(test))]

View file

@ -26,7 +26,6 @@
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(box_syntax)]
#![feature(exit_status)]
#![feature(libc)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
@ -73,6 +72,7 @@ use std::env;
use std::io::{self, Read, Write};
use std::iter::repeat;
use std::path::PathBuf;
use std::process;
use std::str;
use std::sync::{Arc, Mutex};
use std::thread;
@ -861,5 +861,5 @@ pub fn diagnostics_registry() -> diagnostics::registry::Registry {
pub fn main() {
let result = run(env::args().collect());
std::env::set_exit_status(result as i32);
process::exit(result as i32);
}

View file

@ -25,7 +25,6 @@ use syntax::diagnostic::{Emitter, Handler, Level};
use std::ffi::{CStr, CString};
use std::fs;
use std::iter::Unfold;
use std::mem;
use std::path::Path;
use std::process::{Command, Stdio};
@ -913,11 +912,10 @@ fn run_work_singlethreaded(sess: &Session,
reachable: &[String],
work_items: Vec<WorkItem>) {
let cgcx = CodegenContext::new_with_session(sess, reachable);
let mut work_items = work_items;
// Since we're running single-threaded, we can pass the session to
// the proc, allowing `optimize_and_codegen` to perform LTO.
for work in Unfold::new((), |_| work_items.pop()) {
for work in work_items.into_iter().rev() {
execute_work_item(&cgcx, work);
}
}

View file

@ -31,9 +31,7 @@
#![feature(fs)]
#![feature(iter_cmp)]
#![feature(iter_arith)]
#![feature(iter_unfold)]
#![feature(libc)]
#![feature(once_new)]
#![feature(path_ext)]
#![feature(path_ext)]
#![feature(path_relative_from)]

View file

@ -23,7 +23,6 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(dynamic_lib)]
#![feature(exit_status)]
#![feature(libc)]
#![feature(owned_ascii_ext)]
#![feature(path_ext)]
@ -61,6 +60,7 @@ use std::env;
use std::fs::File;
use std::io::{self, Read, Write};
use std::path::PathBuf;
use std::process;
use std::rc::Rc;
use std::sync::mpsc::channel;
@ -134,7 +134,7 @@ pub fn main() {
let s = env::args().collect::<Vec<_>>();
main_args(&s)
}).unwrap().join().unwrap();
env::set_exit_status(res as i32);
process::exit(res as i32);
}
pub fn opts() -> Vec<getopts::OptGroup> {

View file

@ -32,7 +32,6 @@ Core encoding and decoding interfaces.
#![feature(enumset)]
#![feature(hashmap_hasher)]
#![feature(num_bits_bytes)]
#![feature(num_wrapping)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(str_char)]

View file

@ -48,7 +48,7 @@
// reconsider what crate these items belong in.
use any::TypeId;
use boxed::{self, Box};
use boxed::Box;
use convert::From;
use fmt::{self, Debug, Display};
use marker::{Send, Sync, Reflect};
@ -249,7 +249,7 @@ impl Error {
if self.is::<T>() {
unsafe {
// Get the raw representation of the trait object
let raw = boxed::into_raw(self);
let raw = Box::into_raw(self);
let to: TraitObject =
transmute::<*mut Error, TraitObject>(raw);

View file

@ -8,9 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use borrow::{Cow, ToOwned};
use boxed::{self, Box};
use boxed::Box;
use clone::Clone;
use convert::{Into, From};
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
@ -226,7 +225,7 @@ impl CString {
// It is important that the bytes be sized to fit - we need
// the capacity to be determinable from the string length, and
// shrinking to fit is the only way to be sure.
boxed::into_raw(self.inner) as *const libc::c_char
Box::into_raw(self.inner) as *const libc::c_char
}
/// Returns the contents of this `CString` as a slice of bytes.

View file

@ -465,6 +465,7 @@ pub struct BufStream<S: Write> {
leading to issues like #17136")]
#[deprecated(since = "1.2.0",
reason = "use the crates.io `bufstream` crate instead")]
#[allow(deprecated)]
impl<S: Read + Write> BufStream<S> {
/// Creates a new buffered stream with explicitly listed capacities for the
/// reader/writer buffer.
@ -516,6 +517,7 @@ impl<S: Read + Write> BufStream<S> {
#[unstable(feature = "buf_stream",
reason = "unsure about semantics of buffering two directions, \
leading to issues like #17136")]
#[allow(deprecated)]
impl<S: Read + Write> BufRead for BufStream<S> {
fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() }
fn consume(&mut self, amt: usize) { self.inner.consume(amt) }
@ -524,6 +526,7 @@ impl<S: Read + Write> BufRead for BufStream<S> {
#[unstable(feature = "buf_stream",
reason = "unsure about semantics of buffering two directions, \
leading to issues like #17136")]
#[allow(deprecated)]
impl<S: Read + Write> Read for BufStream<S> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.inner.read(buf)
@ -533,6 +536,7 @@ impl<S: Read + Write> Read for BufStream<S> {
#[unstable(feature = "buf_stream",
reason = "unsure about semantics of buffering two directions, \
leading to issues like #17136")]
#[allow(deprecated)]
impl<S: Read + Write> Write for BufStream<S> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.inner.inner.get_mut().write(buf)
@ -545,6 +549,7 @@ impl<S: Read + Write> Write for BufStream<S> {
#[unstable(feature = "buf_stream",
reason = "unsure about semantics of buffering two directions, \
leading to issues like #17136")]
#[allow(deprecated)]
impl<S: Write> fmt::Debug for BufStream<S> where S: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let reader = &self.inner;

View file

@ -10,7 +10,6 @@
use prelude::v1::*;
use boxed;
use cell::Cell;
use rt;
use sync::{StaticMutex, Arc};
@ -60,7 +59,7 @@ impl<T: Send + Sync + 'static> Lazy<T> {
});
let ret = (self.init)();
if registered.is_ok() {
self.ptr.set(boxed::into_raw(Box::new(ret.clone())));
self.ptr.set(Box::into_raw(Box::new(ret.clone())));
}
return ret
}

View file

@ -106,7 +106,6 @@
#![feature(alloc)]
#![feature(allow_internal_unstable)]
#![feature(associated_consts)]
#![feature(borrow_state)]
#![feature(box_raw)]
#![feature(box_syntax)]
#![feature(char_internals)]

View file

@ -16,13 +16,12 @@
// segfaults (the queue's memory is mysteriously gone), so
// instead the cleanup is tied to the `std::rt` entry point.
use boxed;
use alloc::boxed::FnBox;
use boxed::Box;
use vec::Vec;
use thunk::Thunk;
use sys_common::mutex::Mutex;
use vec::Vec;
type Queue = Vec<Thunk<'static>>;
type Queue = Vec<Box<FnBox()>>;
// NB these are specifically not types from `std::sync` as they currently rely
// on poisoning and this module needs to operate at a lower level than requiring
@ -40,7 +39,7 @@ const ITERS: usize = 10;
unsafe fn init() -> bool {
if QUEUE.is_null() {
let state: Box<Queue> = box Vec::new();
QUEUE = boxed::into_raw(state);
QUEUE = Box::into_raw(state);
} else if QUEUE as usize == 1 {
// can't re-init after a cleanup
return false
@ -71,7 +70,7 @@ pub fn cleanup() {
}
}
pub fn push(f: Thunk<'static>) -> bool {
pub fn push(f: Box<FnBox()>) -> bool {
let mut ret = true;
unsafe {
LOCK.lock();

View file

@ -139,7 +139,9 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
if failed {
rt::DEFAULT_ERROR_CODE
} else {
env::get_exit_status() as isize
#[allow(deprecated)]
fn exit_status() -> isize { env::get_exit_status() as isize }
exit_status()
}
}

View file

@ -11,7 +11,6 @@
use prelude::v1::*;
use any::Any;
use boxed;
use libc::c_void;
use rt::libunwind as uw;
@ -29,7 +28,7 @@ pub unsafe fn panic(data: Box<Any + Send + 'static>) -> ! {
},
cause: Some(data),
};
let exception_param = boxed::into_raw(exception) as *mut uw::_Unwind_Exception;
let exception_param = Box::into_raw(exception) as *mut uw::_Unwind_Exception;
let error = uw::_Unwind_RaiseException(exception_param);
rtabort!("Could not unwind stack, error = {}", error as isize);

View file

@ -32,10 +32,11 @@
reason = "futures as-is have yet to be deeply reevaluated with recent \
core changes to Rust's synchronization story, and will likely \
become stable in the future but are unstable until that time")]
#[deprecated(since = "1.2.0",
#![deprecated(since = "1.2.0",
reason = "implementation does not match the quality of the \
standard library and this will likely be prototyped \
outside in crates.io first")]
#![allow(deprecated)]
use core::prelude::*;
use core::mem::replace;

View file

@ -30,6 +30,7 @@ pub use self::rwlock::{RwLockReadGuard, RwLockWriteGuard};
pub use self::rwlock::{RwLock, StaticRwLock, RW_LOCK_INIT};
pub use self::semaphore::{Semaphore, SemaphoreGuard};
#[allow(deprecated)]
pub use self::future::Future;
pub mod mpsc;

View file

@ -42,7 +42,6 @@ pub use self::PopResult::*;
use core::prelude::*;
use alloc::boxed;
use alloc::boxed::Box;
use core::ptr;
use core::cell::UnsafeCell;
@ -80,7 +79,7 @@ unsafe impl<T: Send> Sync for Queue<T> { }
impl<T> Node<T> {
unsafe fn new(v: Option<T>) -> *mut Node<T> {
boxed::into_raw(box Node {
Box::into_raw(box Node {
next: AtomicPtr::new(ptr::null_mut()),
value: v,
})

View file

@ -35,7 +35,6 @@
use core::prelude::*;
use alloc::boxed;
use alloc::boxed::Box;
use core::ptr;
use core::cell::UnsafeCell;
@ -78,7 +77,7 @@ unsafe impl<T: Send> Sync for Queue<T> { }
impl<T> Node<T> {
fn new() -> *mut Node<T> {
boxed::into_raw(box Node {
Box::into_raw(box Node {
value: None,
next: AtomicPtr::new(ptr::null_mut::<Node<T>>()),
})

View file

@ -85,8 +85,6 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
/// To recover from a poisoned mutex:
///
/// ```
/// #![feature(sync_poison)]
///
/// use std::sync::{Arc, Mutex};
/// use std::thread;
///

View file

@ -28,7 +28,7 @@
use core::prelude::*;
use core::char::{encode_utf8_raw, encode_utf16_raw};
use core::str::{char_range_at_raw, next_code_point};
use core::str::next_code_point;
use ascii::*;
use borrow::Cow;
@ -1148,30 +1148,6 @@ mod tests {
assert_eq!(slice.ascii_byte_at(4), b'\xFF');
}
#[test]
fn wtf8_code_point_at() {
let mut string = Wtf8Buf::from_str("");
string.push(CodePoint::from_u32(0xD83D).unwrap());
string.push_char('💩');
assert_eq!(string.code_point_at(0), CodePoint::from_char('a'));
assert_eq!(string.code_point_at(1), CodePoint::from_char('é'));
assert_eq!(string.code_point_at(3), CodePoint::from_char(' '));
assert_eq!(string.code_point_at(4), CodePoint::from_u32(0xD83D).unwrap());
assert_eq!(string.code_point_at(7), CodePoint::from_char('💩'));
}
#[test]
fn wtf8_code_point_range_at() {
let mut string = Wtf8Buf::from_str("");
string.push(CodePoint::from_u32(0xD83D).unwrap());
string.push_char('💩');
assert_eq!(string.code_point_range_at(0), (CodePoint::from_char('a'), 1));
assert_eq!(string.code_point_range_at(1), (CodePoint::from_char('é'), 3));
assert_eq!(string.code_point_range_at(3), (CodePoint::from_char(' '), 4));
assert_eq!(string.code_point_range_at(4), (CodePoint::from_u32(0xD83D).unwrap(), 7));
assert_eq!(string.code_point_range_at(7), (CodePoint::from_char('💩'), 11));
}
#[test]
fn wtf8_code_points() {
fn c(value: u32) -> CodePoint { CodePoint::from_u32(value).unwrap() }

View file

@ -326,7 +326,6 @@ mod imp {
// Due to rust-lang/rust#18804, make sure this is not generic!
#[cfg(target_os = "linux")]
unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) {
use boxed;
use mem;
use ptr;
use libc;
@ -360,7 +359,7 @@ mod imp {
type List = Vec<(*mut u8, unsafe extern fn(*mut u8))>;
if DTORS.get().is_null() {
let v: Box<List> = box Vec::new();
DTORS.set(boxed::into_raw(v) as *mut u8);
DTORS.set(Box::into_raw(v) as *mut u8);
}
let list: &mut List = &mut *(DTORS.get() as *mut List);
list.push((t, dtor));

View file

@ -404,6 +404,7 @@ pub fn spawn<F, T>(f: F) -> JoinHandle<T> where
#[deprecated(since = "1.2.0",
reason = "this unsafe API is unlikely to ever be stabilized \
in this form")]
#[allow(deprecated)]
pub fn scoped<'a, T, F>(f: F) -> JoinGuard<'a, T> where
T: Send + 'a, F: FnOnce() -> T, F: Send + 'a
{

View file

@ -46,7 +46,6 @@
#![feature(set_stdio)]
#![feature(slice_extras)]
#![feature(staged_api)]
#![feature(thunk)]
extern crate getopts;
extern crate serialize;
@ -82,7 +81,6 @@ use std::path::PathBuf;
use std::sync::mpsc::{channel, Sender};
use std::sync::{Arc, Mutex};
use std::thread;
use std::thunk::Thunk;
use std::time::Duration;
// to be used by rustc to compile tests in libtest
@ -155,7 +153,7 @@ pub enum TestFn {
StaticTestFn(fn()),
StaticBenchFn(fn(&mut Bencher)),
StaticMetricFn(fn(&mut MetricMap)),
DynTestFn(Thunk<'static>),
DynTestFn(Box<FnBox() + Send>),
DynMetricFn(Box<FnBox(&mut MetricMap)+Send>),
DynBenchFn(Box<TDynBenchFn+'static>)
}
@ -961,7 +959,7 @@ pub fn run_test(opts: &TestOpts,
fn run_test_inner(desc: TestDesc,
monitor_ch: Sender<MonitorMsg>,
nocapture: bool,
testfn: Thunk<'static>) {
testfn: Box<FnBox() + Send>) {
struct Sink(Arc<Mutex<Vec<u8>>>);
impl Write for Sink {
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
@ -1229,7 +1227,6 @@ mod tests {
TestDesc, TestDescAndFn, TestOpts, run_test,
MetricMap,
StaticTestName, DynTestName, DynTestFn, ShouldPanic};
use std::thunk::Thunk;
use std::sync::mpsc::channel;
#[test]

View file

@ -10,7 +10,6 @@
#![deny(warnings)]
#![feature(exit_status)]
#![feature(iter_arith)]
#![feature(path_relative_from)]
#![feature(rustc_private)]
@ -21,6 +20,8 @@ extern crate rustc_back;
use std::env;
use std::error::Error;
use std::process;
use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT, Ordering};
use subcommand::Subcommand;
use term::Term;
@ -37,6 +38,8 @@ mod test;
mod css;
mod javascript;
static EXIT_STATUS: AtomicIsize = ATOMIC_ISIZE_INIT;
#[cfg(not(test))] // thanks #12327
fn main() {
let mut term = Term::new();
@ -70,4 +73,5 @@ fn main() {
}
}
}
process::exit(EXIT_STATUS.load(Ordering::SeqCst) as i32);
}

View file

@ -11,9 +11,9 @@
//! An abstraction of the terminal. Eventually, provide color and
//! verbosity support. For now, just a wrapper around stdout/stderr.
use std::env;
use std::io;
use std::io::prelude::*;
use std::sync::atomic::Ordering;
pub struct Term {
err: Box<Write + 'static>
@ -29,6 +29,6 @@ impl Term {
pub fn err(&mut self, msg: &str) {
// swallow any errors
let _ = writeln!(&mut self.err, "{}", msg);
env::set_exit_status(101);
::EXIT_STATUS.store(101, Ordering::SeqCst);
}
}

View file

@ -8,19 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// pretty-expanded FIXME #23616
#![forbid(warnings)]
#![feature(thunk)]
// Pretty printing tests complain about `use std::predule::*`
#![allow(unused_imports)]
// We shouldn't need to rebind a moved upvar as mut if it's already
// marked as mut
use std::thunk::Thunk;
pub fn main() {
let mut x = 1;
let _thunk = Box::new(move|| { x = 2; });