More test fixes and fallout of stability changes
This commit is contained in:
parent
aa931e9c6f
commit
b4a2823cd6
40 changed files with 111 additions and 122 deletions
|
@ -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")]
|
reason = "this function is unsafe with weak pointers")]
|
||||||
pub unsafe fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
|
pub unsafe fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
|
||||||
// FIXME(#24880) potential race with upgraded weak pointers here
|
// 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
|
// This unsafety is ok because we're guaranteed that the pointer
|
||||||
// returned is the *only* pointer that will ever be returned to T. Our
|
// 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
|
// reference count is guaranteed to be 1 at this point, and we required
|
||||||
|
|
|
@ -267,7 +267,7 @@ impl Box<Any> {
|
||||||
if self.is::<T>() {
|
if self.is::<T>() {
|
||||||
unsafe {
|
unsafe {
|
||||||
// Get the raw representation of the trait object
|
// Get the raw representation of the trait object
|
||||||
let raw = into_raw(self);
|
let raw = Box::into_raw(self);
|
||||||
let to: TraitObject =
|
let to: TraitObject =
|
||||||
mem::transmute::<*mut Any, TraitObject>(raw);
|
mem::transmute::<*mut Any, TraitObject>(raw);
|
||||||
|
|
||||||
|
|
|
@ -148,26 +148,24 @@
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![stable(feature = "rust1", since = "1.0.0")]
|
#![stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
||||||
|
use core::prelude::*;
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use boxed;
|
use boxed::Box;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use std::boxed;
|
use std::boxed::Box;
|
||||||
|
|
||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
use core::clone::Clone;
|
use core::cmp::Ordering;
|
||||||
use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
|
|
||||||
use core::default::Default;
|
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::hash::{Hasher, Hash};
|
use core::hash::{Hasher, Hash};
|
||||||
use core::intrinsics::{assume, drop_in_place};
|
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::mem::{self, min_align_of, size_of, min_align_of_val, size_of_val, forget};
|
||||||
use core::nonzero::NonZero;
|
use core::nonzero::NonZero;
|
||||||
use core::ops::{CoerceUnsized, Deref, Drop};
|
use core::ops::{CoerceUnsized, Deref};
|
||||||
use core::option::Option;
|
|
||||||
use core::option::Option::{Some, None};
|
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::result::Result;
|
|
||||||
use core::result::Result::{Ok, Err};
|
|
||||||
|
|
||||||
use heap::deallocate;
|
use heap::deallocate;
|
||||||
|
|
||||||
|
@ -212,7 +210,7 @@ impl<T> Rc<T> {
|
||||||
// pointers, which ensures that the weak destructor never frees
|
// pointers, which ensures that the weak destructor never frees
|
||||||
// the allocation while the strong destructor is running, even
|
// the allocation while the strong destructor is running, even
|
||||||
// if the weak pointer is stored inside the strong one.
|
// 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),
|
strong: Cell::new(1),
|
||||||
weak: Cell::new(1),
|
weak: Cell::new(1),
|
||||||
value: value
|
value: value
|
||||||
|
@ -230,14 +228,14 @@ impl<T> Rc<T> {
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # #![feature(rc_unique)]
|
/// # #![feature(rc_unique)]
|
||||||
/// use std::rc::{self, Rc};
|
/// use std::rc::Rc;
|
||||||
///
|
///
|
||||||
/// let x = Rc::new(3);
|
/// 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 x = Rc::new(4);
|
||||||
/// let _y = x.clone();
|
/// 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]
|
#[inline]
|
||||||
#[unstable(feature = "rc_unique")]
|
#[unstable(feature = "rc_unique")]
|
||||||
|
@ -295,17 +293,16 @@ impl<T: ?Sized> Rc<T> {
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # #![feature(rc_unique)]
|
/// # #![feature(rc_unique)]
|
||||||
/// use std::rc;
|
|
||||||
/// use std::rc::Rc;
|
/// use std::rc::Rc;
|
||||||
///
|
///
|
||||||
/// let five = Rc::new(5);
|
/// let five = Rc::new(5);
|
||||||
///
|
///
|
||||||
/// rc::is_unique(&five);
|
/// assert!(Rc::is_unique(&five));
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "rc_unique")]
|
#[unstable(feature = "rc_unique")]
|
||||||
pub fn is_unique(rc: &Rc<T>) -> bool {
|
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
|
/// 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)]
|
/// # #![feature(rc_unique)]
|
||||||
/// use std::rc::{self, Rc};
|
/// use std::rc::Rc;
|
||||||
///
|
///
|
||||||
/// let mut x = Rc::new(3);
|
/// let mut x = Rc::new(3);
|
||||||
/// *rc::get_mut(&mut x).unwrap() = 4;
|
/// *Rc::get_mut(&mut x).unwrap() = 4;
|
||||||
/// assert_eq!(*x, 4);
|
/// assert_eq!(*x, 4);
|
||||||
///
|
///
|
||||||
/// let _y = x.clone();
|
/// let _y = x.clone();
|
||||||
/// assert!(rc::get_mut(&mut x).is_none());
|
/// assert!(Rc::get_mut(&mut x).is_none());
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "rc_unique")]
|
#[unstable(feature = "rc_unique")]
|
||||||
|
@ -432,7 +429,7 @@ impl<T: Clone> Rc<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "rc_unique")]
|
#[unstable(feature = "rc_unique")]
|
||||||
pub fn make_unique(&mut self) -> &mut T {
|
pub fn make_unique(&mut self) -> &mut T {
|
||||||
if !is_unique(self) {
|
if !Rc::is_unique(self) {
|
||||||
*self = Rc::new((**self).clone())
|
*self = Rc::new((**self).clone())
|
||||||
}
|
}
|
||||||
// This unsafety is ok because we're guaranteed that the pointer
|
// This unsafety is ok because we're guaranteed that the pointer
|
||||||
|
|
|
@ -86,6 +86,7 @@ use core::cmp::Ordering;
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::hash;
|
use core::hash;
|
||||||
|
#[allow(deprecated)]
|
||||||
use core::iter::RandomAccessIterator;
|
use core::iter::RandomAccessIterator;
|
||||||
use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
|
use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
|
||||||
use core::iter::{self, FromIterator};
|
use core::iter::{self, FromIterator};
|
||||||
|
@ -1188,6 +1189,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
|
||||||
impl<'a> ExactSizeIterator for Iter<'a> {}
|
impl<'a> ExactSizeIterator for Iter<'a> {}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<'a> RandomAccessIterator for Iter<'a> {
|
impl<'a> RandomAccessIterator for Iter<'a> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn indexable(&self) -> usize {
|
fn indexable(&self) -> usize {
|
||||||
|
|
|
@ -685,10 +685,7 @@ mod stack {
|
||||||
/// tied to the original tree.
|
/// tied to the original tree.
|
||||||
pub fn into_top(mut self) -> &'a mut V {
|
pub fn into_top(mut self) -> &'a mut V {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::copy_mut_lifetime(
|
&mut *(self.top.from_raw_mut().val_mut() as *mut V)
|
||||||
self.map,
|
|
||||||
self.top.from_raw_mut().val_mut()
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(box_raw)]
|
#![feature(box_raw)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(copy_lifetime)]
|
|
||||||
#![feature(core)]
|
#![feature(core)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(core_prelude)]
|
#![feature(core_prelude)]
|
||||||
|
@ -56,7 +55,7 @@
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(step_by)]
|
#![feature(step_by)]
|
||||||
#![feature(str_char)]
|
#![feature(str_char)]
|
||||||
#![feature(str_internals)]
|
#![feature(str_match_indices)]
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
#![feature(unicode)]
|
#![feature(unicode)]
|
||||||
#![feature(unique)]
|
#![feature(unique)]
|
||||||
|
|
|
@ -151,6 +151,7 @@ mod hack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
pub fn permutations<T>(s: &[T]) -> Permutations<T> where T: Clone {
|
pub fn permutations<T>(s: &[T]) -> Permutations<T> where T: Clone {
|
||||||
Permutations{
|
Permutations{
|
||||||
swaps: ElementSwaps::new(s.len()),
|
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![1, 3, 2]), perms.next());
|
||||||
/// assert_eq!(Some(vec![3, 1, 2]), perms.next());
|
/// assert_eq!(Some(vec![3, 1, 2]), perms.next());
|
||||||
/// ```
|
/// ```
|
||||||
|
#[allow(deprecated)]
|
||||||
#[unstable(feature = "permutations")]
|
#[unstable(feature = "permutations")]
|
||||||
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
|
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -896,6 +898,7 @@ impl<T> [T] {
|
||||||
/// let b: &mut [_] = &mut [1, 0, 2];
|
/// let b: &mut [_] = &mut [1, 0, 2];
|
||||||
/// assert!(v == b);
|
/// assert!(v == b);
|
||||||
/// ```
|
/// ```
|
||||||
|
#[allow(deprecated)]
|
||||||
#[unstable(feature = "permutations",
|
#[unstable(feature = "permutations",
|
||||||
reason = "uncertain if this merits inclusion in std")]
|
reason = "uncertain if this merits inclusion in std")]
|
||||||
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
|
#[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];
|
/// let b: &mut [_] = &mut [0, 1, 2];
|
||||||
/// assert!(v == b);
|
/// assert!(v == b);
|
||||||
/// ```
|
/// ```
|
||||||
|
#[allow(deprecated)]
|
||||||
#[unstable(feature = "permutations",
|
#[unstable(feature = "permutations",
|
||||||
reason = "uncertain if this merits inclusion in std")]
|
reason = "uncertain if this merits inclusion in std")]
|
||||||
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
|
#[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
|
/// The last generated swap is always (0, 1), and it returns the
|
||||||
/// sequence to its initial order.
|
/// sequence to its initial order.
|
||||||
|
#[allow(deprecated)]
|
||||||
#[unstable(feature = "permutations")]
|
#[unstable(feature = "permutations")]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
|
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
|
||||||
|
@ -1078,6 +1083,7 @@ pub struct ElementSwaps {
|
||||||
swaps_made : usize,
|
swaps_made : usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
impl ElementSwaps {
|
impl ElementSwaps {
|
||||||
/// Creates an `ElementSwaps` iterator for a sequence of `length` elements.
|
/// Creates an `ElementSwaps` iterator for a sequence of `length` elements.
|
||||||
#[unstable(feature = "permutations")]
|
#[unstable(feature = "permutations")]
|
||||||
|
@ -1137,6 +1143,7 @@ struct SizeDirection {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl Iterator for ElementSwaps {
|
impl Iterator for ElementSwaps {
|
||||||
type Item = (usize, usize);
|
type Item = (usize, usize);
|
||||||
|
|
||||||
|
@ -1205,12 +1212,14 @@ impl Iterator for ElementSwaps {
|
||||||
/// Generates even and odd permutations alternately.
|
/// Generates even and odd permutations alternately.
|
||||||
#[unstable(feature = "permutations")]
|
#[unstable(feature = "permutations")]
|
||||||
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
|
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub struct Permutations<T> {
|
pub struct Permutations<T> {
|
||||||
swaps: ElementSwaps,
|
swaps: ElementSwaps,
|
||||||
v: Vec<T>,
|
v: Vec<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "permutations", reason = "trait is unstable")]
|
#[unstable(feature = "permutations", reason = "trait is unstable")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<T: Clone> Iterator for Permutations<T> {
|
impl<T: Clone> Iterator for Permutations<T> {
|
||||||
type Item = Vec<T>;
|
type Item = Vec<T>;
|
||||||
|
|
||||||
|
|
|
@ -1520,7 +1520,6 @@ impl str {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # #![feature(str_matches)]
|
|
||||||
/// let v: Vec<&str> = "abcXXXabcYYYabc".matches("abc").collect();
|
/// let v: Vec<&str> = "abcXXXabcYYYabc".matches("abc").collect();
|
||||||
/// assert_eq!(v, ["abc", "abc", "abc"]);
|
/// assert_eq!(v, ["abc", "abc", "abc"]);
|
||||||
///
|
///
|
||||||
|
@ -1552,7 +1551,6 @@ impl str {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # #![feature(str_matches)]
|
|
||||||
/// let v: Vec<&str> = "abcXXXabcYYYabc".rmatches("abc").collect();
|
/// let v: Vec<&str> = "abcXXXabcYYYabc".rmatches("abc").collect();
|
||||||
/// assert_eq!(v, ["abc", "abc", "abc"]);
|
/// assert_eq!(v, ["abc", "abc", "abc"]);
|
||||||
///
|
///
|
||||||
|
@ -1593,7 +1591,7 @@ impl str {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # #![feature(str_matches)]
|
/// # #![feature(str_match_indices)]
|
||||||
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect();
|
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect();
|
||||||
/// assert_eq!(v, [(0, 3), (6, 9), (12, 15)]);
|
/// assert_eq!(v, [(0, 3), (6, 9), (12, 15)]);
|
||||||
///
|
///
|
||||||
|
@ -1637,7 +1635,7 @@ impl str {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # #![feature(str_matches)]
|
/// # #![feature(str_match_indices)]
|
||||||
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".rmatch_indices("abc").collect();
|
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".rmatch_indices("abc").collect();
|
||||||
/// assert_eq!(v, [(12, 15), (6, 9), (0, 3)]);
|
/// assert_eq!(v, [(12, 15), (6, 9), (0, 3)]);
|
||||||
///
|
///
|
||||||
|
|
|
@ -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 {
|
impl<'a, T: 'a> IntoCow<'a, [T]> for Vec<T> where T: Clone {
|
||||||
fn into_cow(self) -> Cow<'a, [T]> {
|
fn into_cow(self) -> Cow<'a, [T]> {
|
||||||
Cow::Owned(self)
|
Cow::Owned(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<'a, T> IntoCow<'a, [T]> for &'a [T] where T: Clone {
|
impl<'a, T> IntoCow<'a, [T]> for &'a [T] where T: Clone {
|
||||||
fn into_cow(self) -> Cow<'a, [T]> {
|
fn into_cow(self) -> Cow<'a, [T]> {
|
||||||
Cow::Borrowed(self)
|
Cow::Borrowed(self)
|
||||||
|
|
|
@ -1530,6 +1530,7 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
|
||||||
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
|
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<'a, T> RandomAccessIterator for Iter<'a, T> {
|
impl<'a, T> RandomAccessIterator for Iter<'a, T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn indexable(&self) -> usize {
|
fn indexable(&self) -> usize {
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#![feature(step_by)]
|
#![feature(step_by)]
|
||||||
#![feature(str_char)]
|
#![feature(str_char)]
|
||||||
#![feature(str_escape)]
|
#![feature(str_escape)]
|
||||||
#![feature(str_matches)]
|
#![feature(str_match_indices)]
|
||||||
#![feature(str_utf16)]
|
#![feature(str_utf16)]
|
||||||
#![feature(subslice_offset)]
|
#![feature(subslice_offset)]
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
|
|
|
@ -1234,6 +1234,7 @@ impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I {
|
||||||
reason = "trait has not proven itself as a widely useful \
|
reason = "trait has not proven itself as a widely useful \
|
||||||
abstraction for iterators, and more time may be needed \
|
abstraction for iterators, and more time may be needed \
|
||||||
for iteration on the design")]
|
for iteration on the design")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub trait RandomAccessIterator: Iterator {
|
pub trait RandomAccessIterator: Iterator {
|
||||||
/// Returns the number of indexable elements. At most `std::usize::MAX`
|
/// Returns the number of indexable elements. At most `std::usize::MAX`
|
||||||
/// elements are indexable, even if the iterator represents a longer range.
|
/// 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")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<I> RandomAccessIterator for Rev<I>
|
impl<I> RandomAccessIterator for Rev<I>
|
||||||
where I: DoubleEndedIterator + RandomAccessIterator
|
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")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<'a, I, T: 'a> RandomAccessIterator for Cloned<I>
|
impl<'a, I, T: 'a> RandomAccessIterator for Cloned<I>
|
||||||
where I: RandomAccessIterator<Item=&'a T>, T: Clone
|
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")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<I> RandomAccessIterator for Cycle<I> where
|
impl<I> RandomAccessIterator for Cycle<I> where
|
||||||
I: Clone + RandomAccessIterator,
|
I: Clone + RandomAccessIterator,
|
||||||
{
|
{
|
||||||
|
@ -1577,6 +1581,7 @@ impl<A, B> DoubleEndedIterator for Chain<A, B> where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<A, B> RandomAccessIterator for Chain<A, B> where
|
impl<A, B> RandomAccessIterator for Chain<A, B> where
|
||||||
A: RandomAccessIterator,
|
A: RandomAccessIterator,
|
||||||
B: RandomAccessIterator<Item = A::Item>,
|
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")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<A, B> RandomAccessIterator for Zip<A, B> where
|
impl<A, B> RandomAccessIterator for Zip<A, B> where
|
||||||
A: RandomAccessIterator,
|
A: RandomAccessIterator,
|
||||||
B: 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")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<B, I: RandomAccessIterator, F> RandomAccessIterator for Map<I, F> where
|
impl<B, I: RandomAccessIterator, F> RandomAccessIterator for Map<I, F> where
|
||||||
F: FnMut(I::Item) -> B,
|
F: FnMut(I::Item) -> B,
|
||||||
{
|
{
|
||||||
|
@ -1893,6 +1900,7 @@ impl<I> DoubleEndedIterator for Enumerate<I> where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<I> RandomAccessIterator for Enumerate<I> where I: RandomAccessIterator {
|
impl<I> RandomAccessIterator for Enumerate<I> where I: RandomAccessIterator {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn indexable(&self) -> usize {
|
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")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{
|
impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn indexable(&self) -> usize {
|
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")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{
|
impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn indexable(&self) -> usize {
|
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
|
// Allow RandomAccessIterators to be fused without affecting random-access behavior
|
||||||
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<I> RandomAccessIterator for Fuse<I> where I: RandomAccessIterator {
|
impl<I> RandomAccessIterator for Fuse<I> where I: RandomAccessIterator {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn indexable(&self) -> usize {
|
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")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
|
impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
|
||||||
where F: FnMut(&I::Item),
|
where F: FnMut(&I::Item),
|
||||||
{
|
{
|
||||||
|
@ -2545,6 +2557,7 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
|
||||||
#[deprecated(since = "1.2.0",
|
#[deprecated(since = "1.2.0",
|
||||||
reason = "has gained enough traction to retain its position \
|
reason = "has gained enough traction to retain its position \
|
||||||
in the standard library")]
|
in the standard library")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub struct Unfold<St, F> {
|
pub struct Unfold<St, F> {
|
||||||
f: F,
|
f: F,
|
||||||
/// Internal state that will be passed to the closure on the next iteration
|
/// 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",
|
#[deprecated(since = "1.2.0",
|
||||||
reason = "has gained enough traction to retain its position \
|
reason = "has gained enough traction to retain its position \
|
||||||
in the standard library")]
|
in the standard library")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
|
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
|
/// Creates a new iterator with the specified closure as the "iterator
|
||||||
/// function" and an initial state to eventually pass to the closure
|
/// 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")]
|
#[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> {
|
impl<A, St, F> Iterator for Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
|
||||||
type Item = A;
|
type Item = A;
|
||||||
|
|
||||||
|
@ -2977,7 +2992,7 @@ impl<A: Clone> Iterator for Repeat<A> {
|
||||||
type Item = A;
|
type Item = A;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn next(&mut self) -> Option<A> { self.idx(0) }
|
fn next(&mut self) -> Option<A> { Some(self.element.clone()) }
|
||||||
#[inline]
|
#[inline]
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) { (usize::MAX, None) }
|
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")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<A: Clone> DoubleEndedIterator for Repeat<A> {
|
impl<A: Clone> DoubleEndedIterator for Repeat<A> {
|
||||||
#[inline]
|
#[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")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<A: Clone> RandomAccessIterator for Repeat<A> {
|
impl<A: Clone> RandomAccessIterator for Repeat<A> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn indexable(&self) -> usize { usize::MAX }
|
fn indexable(&self) -> usize { usize::MAX }
|
||||||
|
@ -3004,6 +3020,7 @@ type IterateState<T, F> = (F, Option<T>, bool);
|
||||||
#[deprecated(since = "1.2.0",
|
#[deprecated(since = "1.2.0",
|
||||||
reason = "has gained enough traction to retain its position \
|
reason = "has gained enough traction to retain its position \
|
||||||
in the standard library")]
|
in the standard library")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>;
|
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
|
/// 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",
|
#[deprecated(since = "1.2.0",
|
||||||
reason = "has gained enough traction to retain its position \
|
reason = "has gained enough traction to retain its position \
|
||||||
in the standard library")]
|
in the standard library")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
|
pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
|
||||||
T: Clone,
|
T: Clone,
|
||||||
F: FnMut(T) -> T,
|
F: FnMut(T) -> T,
|
||||||
|
|
|
@ -802,6 +802,7 @@ impl<'a, T> Clone for Iter<'a, T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<'a, T> RandomAccessIterator for Iter<'a, T> {
|
impl<'a, T> RandomAccessIterator for Iter<'a, T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn indexable(&self) -> usize {
|
fn indexable(&self) -> usize {
|
||||||
|
@ -1174,6 +1175,7 @@ impl<'a, T> DoubleEndedIterator for Windows<'a, T> {
|
||||||
impl<'a, T> ExactSizeIterator for Windows<'a, T> {}
|
impl<'a, T> ExactSizeIterator for Windows<'a, T> {}
|
||||||
|
|
||||||
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<'a, T> RandomAccessIterator for Windows<'a, T> {
|
impl<'a, T> RandomAccessIterator for Windows<'a, T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn indexable(&self) -> usize {
|
fn indexable(&self) -> usize {
|
||||||
|
@ -1261,6 +1263,7 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> {
|
||||||
impl<'a, T> ExactSizeIterator for Chunks<'a, T> {}
|
impl<'a, T> ExactSizeIterator for Chunks<'a, T> {}
|
||||||
|
|
||||||
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
|
impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn indexable(&self) -> usize {
|
fn indexable(&self) -> usize {
|
||||||
|
@ -1520,6 +1523,7 @@ pub trait IntSliceExt<U, S> {
|
||||||
macro_rules! impl_int_slice {
|
macro_rules! impl_int_slice {
|
||||||
($u:ty, $s:ty, $t:ty) => {
|
($u:ty, $s:ty, $t:ty) => {
|
||||||
#[unstable(feature = "int_slice")]
|
#[unstable(feature = "int_slice")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl IntSliceExt<$u, $s> for [$t] {
|
impl IntSliceExt<$u, $s> for [$t] {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn as_unsigned(&self) -> &[$u] { unsafe { transmute(self) } }
|
fn as_unsigned(&self) -> &[$u] { unsafe { transmute(self) } }
|
||||||
|
|
|
@ -173,12 +173,10 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(iter_cmp)]
|
#![feature(iter_cmp)]
|
||||||
#![feature(once_new)]
|
|
||||||
#![feature(rt)]
|
#![feature(rt)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(static_mutex)]
|
#![feature(static_mutex)]
|
||||||
|
|
||||||
use std::boxed;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io::{self, Stderr};
|
use std::io::{self, Stderr};
|
||||||
|
@ -437,12 +435,12 @@ fn init() {
|
||||||
|
|
||||||
assert!(FILTER.is_null());
|
assert!(FILTER.is_null());
|
||||||
match filter {
|
match filter {
|
||||||
Some(f) => FILTER = boxed::into_raw(box f),
|
Some(f) => FILTER = Box::into_raw(box f),
|
||||||
None => {}
|
None => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert!(DIRECTIVES.is_null());
|
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.
|
// Schedule the cleanup for the globals for when the runtime exits.
|
||||||
let _ = rt::at_exit(move || {
|
let _ = rt::at_exit(move || {
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
#![feature(slice_position_elem)]
|
#![feature(slice_position_elem)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(str_char)]
|
#![feature(str_char)]
|
||||||
#![feature(str_matches)]
|
#![feature(str_match_indices)]
|
||||||
#![feature(vec_push_all)]
|
#![feature(vec_push_all)]
|
||||||
#![feature(wrapping)]
|
#![feature(wrapping)]
|
||||||
#![cfg_attr(test, feature(test))]
|
#![cfg_attr(test, feature(test))]
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
html_root_url = "http://doc.rust-lang.org/nightly/")]
|
html_root_url = "http://doc.rust-lang.org/nightly/")]
|
||||||
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(exit_status)]
|
|
||||||
#![feature(libc)]
|
#![feature(libc)]
|
||||||
#![feature(quote)]
|
#![feature(quote)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
|
@ -73,6 +72,7 @@ use std::env;
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use std::process;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
@ -861,5 +861,5 @@ pub fn diagnostics_registry() -> diagnostics::registry::Registry {
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let result = run(env::args().collect());
|
let result = run(env::args().collect());
|
||||||
std::env::set_exit_status(result as i32);
|
process::exit(result as i32);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ use syntax::diagnostic::{Emitter, Handler, Level};
|
||||||
|
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::iter::Unfold;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
|
@ -913,11 +912,10 @@ fn run_work_singlethreaded(sess: &Session,
|
||||||
reachable: &[String],
|
reachable: &[String],
|
||||||
work_items: Vec<WorkItem>) {
|
work_items: Vec<WorkItem>) {
|
||||||
let cgcx = CodegenContext::new_with_session(sess, reachable);
|
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
|
// Since we're running single-threaded, we can pass the session to
|
||||||
// the proc, allowing `optimize_and_codegen` to perform LTO.
|
// 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);
|
execute_work_item(&cgcx, work);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,7 @@
|
||||||
#![feature(fs)]
|
#![feature(fs)]
|
||||||
#![feature(iter_cmp)]
|
#![feature(iter_cmp)]
|
||||||
#![feature(iter_arith)]
|
#![feature(iter_arith)]
|
||||||
#![feature(iter_unfold)]
|
|
||||||
#![feature(libc)]
|
#![feature(libc)]
|
||||||
#![feature(once_new)]
|
|
||||||
#![feature(path_ext)]
|
#![feature(path_ext)]
|
||||||
#![feature(path_ext)]
|
#![feature(path_ext)]
|
||||||
#![feature(path_relative_from)]
|
#![feature(path_relative_from)]
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(dynamic_lib)]
|
#![feature(dynamic_lib)]
|
||||||
#![feature(exit_status)]
|
|
||||||
#![feature(libc)]
|
#![feature(libc)]
|
||||||
#![feature(owned_ascii_ext)]
|
#![feature(owned_ascii_ext)]
|
||||||
#![feature(path_ext)]
|
#![feature(path_ext)]
|
||||||
|
@ -61,6 +60,7 @@ use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use std::process;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ pub fn main() {
|
||||||
let s = env::args().collect::<Vec<_>>();
|
let s = env::args().collect::<Vec<_>>();
|
||||||
main_args(&s)
|
main_args(&s)
|
||||||
}).unwrap().join().unwrap();
|
}).unwrap().join().unwrap();
|
||||||
env::set_exit_status(res as i32);
|
process::exit(res as i32);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn opts() -> Vec<getopts::OptGroup> {
|
pub fn opts() -> Vec<getopts::OptGroup> {
|
||||||
|
|
|
@ -32,7 +32,6 @@ Core encoding and decoding interfaces.
|
||||||
#![feature(enumset)]
|
#![feature(enumset)]
|
||||||
#![feature(hashmap_hasher)]
|
#![feature(hashmap_hasher)]
|
||||||
#![feature(num_bits_bytes)]
|
#![feature(num_bits_bytes)]
|
||||||
#![feature(num_wrapping)]
|
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(str_char)]
|
#![feature(str_char)]
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
// reconsider what crate these items belong in.
|
// reconsider what crate these items belong in.
|
||||||
|
|
||||||
use any::TypeId;
|
use any::TypeId;
|
||||||
use boxed::{self, Box};
|
use boxed::Box;
|
||||||
use convert::From;
|
use convert::From;
|
||||||
use fmt::{self, Debug, Display};
|
use fmt::{self, Debug, Display};
|
||||||
use marker::{Send, Sync, Reflect};
|
use marker::{Send, Sync, Reflect};
|
||||||
|
@ -249,7 +249,7 @@ impl Error {
|
||||||
if self.is::<T>() {
|
if self.is::<T>() {
|
||||||
unsafe {
|
unsafe {
|
||||||
// Get the raw representation of the trait object
|
// Get the raw representation of the trait object
|
||||||
let raw = boxed::into_raw(self);
|
let raw = Box::into_raw(self);
|
||||||
let to: TraitObject =
|
let to: TraitObject =
|
||||||
transmute::<*mut Error, TraitObject>(raw);
|
transmute::<*mut Error, TraitObject>(raw);
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
use borrow::{Cow, ToOwned};
|
use borrow::{Cow, ToOwned};
|
||||||
use boxed::{self, Box};
|
use boxed::Box;
|
||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
use convert::{Into, From};
|
use convert::{Into, From};
|
||||||
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
|
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
|
// It is important that the bytes be sized to fit - we need
|
||||||
// the capacity to be determinable from the string length, and
|
// the capacity to be determinable from the string length, and
|
||||||
// shrinking to fit is the only way to be sure.
|
// 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.
|
/// Returns the contents of this `CString` as a slice of bytes.
|
||||||
|
|
|
@ -465,6 +465,7 @@ pub struct BufStream<S: Write> {
|
||||||
leading to issues like #17136")]
|
leading to issues like #17136")]
|
||||||
#[deprecated(since = "1.2.0",
|
#[deprecated(since = "1.2.0",
|
||||||
reason = "use the crates.io `bufstream` crate instead")]
|
reason = "use the crates.io `bufstream` crate instead")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<S: Read + Write> BufStream<S> {
|
impl<S: Read + Write> BufStream<S> {
|
||||||
/// Creates a new buffered stream with explicitly listed capacities for the
|
/// Creates a new buffered stream with explicitly listed capacities for the
|
||||||
/// reader/writer buffer.
|
/// reader/writer buffer.
|
||||||
|
@ -516,6 +517,7 @@ impl<S: Read + Write> BufStream<S> {
|
||||||
#[unstable(feature = "buf_stream",
|
#[unstable(feature = "buf_stream",
|
||||||
reason = "unsure about semantics of buffering two directions, \
|
reason = "unsure about semantics of buffering two directions, \
|
||||||
leading to issues like #17136")]
|
leading to issues like #17136")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<S: Read + Write> BufRead for BufStream<S> {
|
impl<S: Read + Write> BufRead for BufStream<S> {
|
||||||
fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() }
|
fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() }
|
||||||
fn consume(&mut self, amt: usize) { self.inner.consume(amt) }
|
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",
|
#[unstable(feature = "buf_stream",
|
||||||
reason = "unsure about semantics of buffering two directions, \
|
reason = "unsure about semantics of buffering two directions, \
|
||||||
leading to issues like #17136")]
|
leading to issues like #17136")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<S: Read + Write> Read for BufStream<S> {
|
impl<S: Read + Write> Read for BufStream<S> {
|
||||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||||
self.inner.read(buf)
|
self.inner.read(buf)
|
||||||
|
@ -533,6 +536,7 @@ impl<S: Read + Write> Read for BufStream<S> {
|
||||||
#[unstable(feature = "buf_stream",
|
#[unstable(feature = "buf_stream",
|
||||||
reason = "unsure about semantics of buffering two directions, \
|
reason = "unsure about semantics of buffering two directions, \
|
||||||
leading to issues like #17136")]
|
leading to issues like #17136")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<S: Read + Write> Write for BufStream<S> {
|
impl<S: Read + Write> Write for BufStream<S> {
|
||||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||||
self.inner.inner.get_mut().write(buf)
|
self.inner.inner.get_mut().write(buf)
|
||||||
|
@ -545,6 +549,7 @@ impl<S: Read + Write> Write for BufStream<S> {
|
||||||
#[unstable(feature = "buf_stream",
|
#[unstable(feature = "buf_stream",
|
||||||
reason = "unsure about semantics of buffering two directions, \
|
reason = "unsure about semantics of buffering two directions, \
|
||||||
leading to issues like #17136")]
|
leading to issues like #17136")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<S: Write> fmt::Debug for BufStream<S> where S: fmt::Debug {
|
impl<S: Write> fmt::Debug for BufStream<S> where S: fmt::Debug {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let reader = &self.inner;
|
let reader = &self.inner;
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
|
||||||
use boxed;
|
|
||||||
use cell::Cell;
|
use cell::Cell;
|
||||||
use rt;
|
use rt;
|
||||||
use sync::{StaticMutex, Arc};
|
use sync::{StaticMutex, Arc};
|
||||||
|
@ -60,7 +59,7 @@ impl<T: Send + Sync + 'static> Lazy<T> {
|
||||||
});
|
});
|
||||||
let ret = (self.init)();
|
let ret = (self.init)();
|
||||||
if registered.is_ok() {
|
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
|
return ret
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,6 @@
|
||||||
#![feature(alloc)]
|
#![feature(alloc)]
|
||||||
#![feature(allow_internal_unstable)]
|
#![feature(allow_internal_unstable)]
|
||||||
#![feature(associated_consts)]
|
#![feature(associated_consts)]
|
||||||
#![feature(borrow_state)]
|
|
||||||
#![feature(box_raw)]
|
#![feature(box_raw)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(char_internals)]
|
#![feature(char_internals)]
|
||||||
|
|
|
@ -16,13 +16,12 @@
|
||||||
// segfaults (the queue's memory is mysteriously gone), so
|
// segfaults (the queue's memory is mysteriously gone), so
|
||||||
// instead the cleanup is tied to the `std::rt` entry point.
|
// instead the cleanup is tied to the `std::rt` entry point.
|
||||||
|
|
||||||
use boxed;
|
use alloc::boxed::FnBox;
|
||||||
use boxed::Box;
|
use boxed::Box;
|
||||||
use vec::Vec;
|
|
||||||
use thunk::Thunk;
|
|
||||||
use sys_common::mutex::Mutex;
|
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
|
// 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
|
// 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 {
|
unsafe fn init() -> bool {
|
||||||
if QUEUE.is_null() {
|
if QUEUE.is_null() {
|
||||||
let state: Box<Queue> = box Vec::new();
|
let state: Box<Queue> = box Vec::new();
|
||||||
QUEUE = boxed::into_raw(state);
|
QUEUE = Box::into_raw(state);
|
||||||
} else if QUEUE as usize == 1 {
|
} else if QUEUE as usize == 1 {
|
||||||
// can't re-init after a cleanup
|
// can't re-init after a cleanup
|
||||||
return false
|
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;
|
let mut ret = true;
|
||||||
unsafe {
|
unsafe {
|
||||||
LOCK.lock();
|
LOCK.lock();
|
||||||
|
|
|
@ -139,7 +139,9 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
|
||||||
if failed {
|
if failed {
|
||||||
rt::DEFAULT_ERROR_CODE
|
rt::DEFAULT_ERROR_CODE
|
||||||
} else {
|
} else {
|
||||||
env::get_exit_status() as isize
|
#[allow(deprecated)]
|
||||||
|
fn exit_status() -> isize { env::get_exit_status() as isize }
|
||||||
|
exit_status()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
|
||||||
use any::Any;
|
use any::Any;
|
||||||
use boxed;
|
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
use rt::libunwind as uw;
|
use rt::libunwind as uw;
|
||||||
|
|
||||||
|
@ -29,7 +28,7 @@ pub unsafe fn panic(data: Box<Any + Send + 'static>) -> ! {
|
||||||
},
|
},
|
||||||
cause: Some(data),
|
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);
|
let error = uw::_Unwind_RaiseException(exception_param);
|
||||||
rtabort!("Could not unwind stack, error = {}", error as isize);
|
rtabort!("Could not unwind stack, error = {}", error as isize);
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,11 @@
|
||||||
reason = "futures as-is have yet to be deeply reevaluated with recent \
|
reason = "futures as-is have yet to be deeply reevaluated with recent \
|
||||||
core changes to Rust's synchronization story, and will likely \
|
core changes to Rust's synchronization story, and will likely \
|
||||||
become stable in the future but are unstable until that time")]
|
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 \
|
reason = "implementation does not match the quality of the \
|
||||||
standard library and this will likely be prototyped \
|
standard library and this will likely be prototyped \
|
||||||
outside in crates.io first")]
|
outside in crates.io first")]
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
use core::mem::replace;
|
use core::mem::replace;
|
||||||
|
|
|
@ -30,6 +30,7 @@ pub use self::rwlock::{RwLockReadGuard, RwLockWriteGuard};
|
||||||
pub use self::rwlock::{RwLock, StaticRwLock, RW_LOCK_INIT};
|
pub use self::rwlock::{RwLock, StaticRwLock, RW_LOCK_INIT};
|
||||||
pub use self::semaphore::{Semaphore, SemaphoreGuard};
|
pub use self::semaphore::{Semaphore, SemaphoreGuard};
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
pub use self::future::Future;
|
pub use self::future::Future;
|
||||||
|
|
||||||
pub mod mpsc;
|
pub mod mpsc;
|
||||||
|
|
|
@ -42,7 +42,6 @@ pub use self::PopResult::*;
|
||||||
|
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use alloc::boxed;
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::cell::UnsafeCell;
|
use core::cell::UnsafeCell;
|
||||||
|
@ -80,7 +79,7 @@ unsafe impl<T: Send> Sync for Queue<T> { }
|
||||||
|
|
||||||
impl<T> Node<T> {
|
impl<T> Node<T> {
|
||||||
unsafe fn new(v: Option<T>) -> *mut 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()),
|
next: AtomicPtr::new(ptr::null_mut()),
|
||||||
value: v,
|
value: v,
|
||||||
})
|
})
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use alloc::boxed;
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::cell::UnsafeCell;
|
use core::cell::UnsafeCell;
|
||||||
|
@ -78,7 +77,7 @@ unsafe impl<T: Send> Sync for Queue<T> { }
|
||||||
|
|
||||||
impl<T> Node<T> {
|
impl<T> Node<T> {
|
||||||
fn new() -> *mut Node<T> {
|
fn new() -> *mut Node<T> {
|
||||||
boxed::into_raw(box Node {
|
Box::into_raw(box Node {
|
||||||
value: None,
|
value: None,
|
||||||
next: AtomicPtr::new(ptr::null_mut::<Node<T>>()),
|
next: AtomicPtr::new(ptr::null_mut::<Node<T>>()),
|
||||||
})
|
})
|
||||||
|
|
|
@ -85,8 +85,6 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
|
||||||
/// To recover from a poisoned mutex:
|
/// To recover from a poisoned mutex:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(sync_poison)]
|
|
||||||
///
|
|
||||||
/// use std::sync::{Arc, Mutex};
|
/// use std::sync::{Arc, Mutex};
|
||||||
/// use std::thread;
|
/// use std::thread;
|
||||||
///
|
///
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use core::char::{encode_utf8_raw, encode_utf16_raw};
|
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 ascii::*;
|
||||||
use borrow::Cow;
|
use borrow::Cow;
|
||||||
|
@ -1148,30 +1148,6 @@ mod tests {
|
||||||
assert_eq!(slice.ascii_byte_at(4), b'\xFF');
|
assert_eq!(slice.ascii_byte_at(4), b'\xFF');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn wtf8_code_point_at() {
|
|
||||||
let mut string = Wtf8Buf::from_str("aé ");
|
|
||||||
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("aé ");
|
|
||||||
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]
|
#[test]
|
||||||
fn wtf8_code_points() {
|
fn wtf8_code_points() {
|
||||||
fn c(value: u32) -> CodePoint { CodePoint::from_u32(value).unwrap() }
|
fn c(value: u32) -> CodePoint { CodePoint::from_u32(value).unwrap() }
|
||||||
|
|
|
@ -326,7 +326,6 @@ mod imp {
|
||||||
// Due to rust-lang/rust#18804, make sure this is not generic!
|
// Due to rust-lang/rust#18804, make sure this is not generic!
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) {
|
unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) {
|
||||||
use boxed;
|
|
||||||
use mem;
|
use mem;
|
||||||
use ptr;
|
use ptr;
|
||||||
use libc;
|
use libc;
|
||||||
|
@ -360,7 +359,7 @@ mod imp {
|
||||||
type List = Vec<(*mut u8, unsafe extern fn(*mut u8))>;
|
type List = Vec<(*mut u8, unsafe extern fn(*mut u8))>;
|
||||||
if DTORS.get().is_null() {
|
if DTORS.get().is_null() {
|
||||||
let v: Box<List> = box Vec::new();
|
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);
|
let list: &mut List = &mut *(DTORS.get() as *mut List);
|
||||||
list.push((t, dtor));
|
list.push((t, dtor));
|
||||||
|
|
|
@ -404,6 +404,7 @@ pub fn spawn<F, T>(f: F) -> JoinHandle<T> where
|
||||||
#[deprecated(since = "1.2.0",
|
#[deprecated(since = "1.2.0",
|
||||||
reason = "this unsafe API is unlikely to ever be stabilized \
|
reason = "this unsafe API is unlikely to ever be stabilized \
|
||||||
in this form")]
|
in this form")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub fn scoped<'a, T, F>(f: F) -> JoinGuard<'a, T> where
|
pub fn scoped<'a, T, F>(f: F) -> JoinGuard<'a, T> where
|
||||||
T: Send + 'a, F: FnOnce() -> T, F: Send + 'a
|
T: Send + 'a, F: FnOnce() -> T, F: Send + 'a
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
#![feature(set_stdio)]
|
#![feature(set_stdio)]
|
||||||
#![feature(slice_extras)]
|
#![feature(slice_extras)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(thunk)]
|
|
||||||
|
|
||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
|
@ -82,7 +81,6 @@ use std::path::PathBuf;
|
||||||
use std::sync::mpsc::{channel, Sender};
|
use std::sync::mpsc::{channel, Sender};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::thunk::Thunk;
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
// to be used by rustc to compile tests in libtest
|
// to be used by rustc to compile tests in libtest
|
||||||
|
@ -155,7 +153,7 @@ pub enum TestFn {
|
||||||
StaticTestFn(fn()),
|
StaticTestFn(fn()),
|
||||||
StaticBenchFn(fn(&mut Bencher)),
|
StaticBenchFn(fn(&mut Bencher)),
|
||||||
StaticMetricFn(fn(&mut MetricMap)),
|
StaticMetricFn(fn(&mut MetricMap)),
|
||||||
DynTestFn(Thunk<'static>),
|
DynTestFn(Box<FnBox() + Send>),
|
||||||
DynMetricFn(Box<FnBox(&mut MetricMap)+Send>),
|
DynMetricFn(Box<FnBox(&mut MetricMap)+Send>),
|
||||||
DynBenchFn(Box<TDynBenchFn+'static>)
|
DynBenchFn(Box<TDynBenchFn+'static>)
|
||||||
}
|
}
|
||||||
|
@ -961,7 +959,7 @@ pub fn run_test(opts: &TestOpts,
|
||||||
fn run_test_inner(desc: TestDesc,
|
fn run_test_inner(desc: TestDesc,
|
||||||
monitor_ch: Sender<MonitorMsg>,
|
monitor_ch: Sender<MonitorMsg>,
|
||||||
nocapture: bool,
|
nocapture: bool,
|
||||||
testfn: Thunk<'static>) {
|
testfn: Box<FnBox() + Send>) {
|
||||||
struct Sink(Arc<Mutex<Vec<u8>>>);
|
struct Sink(Arc<Mutex<Vec<u8>>>);
|
||||||
impl Write for Sink {
|
impl Write for Sink {
|
||||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||||
|
@ -1229,7 +1227,6 @@ mod tests {
|
||||||
TestDesc, TestDescAndFn, TestOpts, run_test,
|
TestDesc, TestDescAndFn, TestOpts, run_test,
|
||||||
MetricMap,
|
MetricMap,
|
||||||
StaticTestName, DynTestName, DynTestFn, ShouldPanic};
|
StaticTestName, DynTestName, DynTestFn, ShouldPanic};
|
||||||
use std::thunk::Thunk;
|
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
#![feature(exit_status)]
|
|
||||||
#![feature(iter_arith)]
|
#![feature(iter_arith)]
|
||||||
#![feature(path_relative_from)]
|
#![feature(path_relative_from)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
|
@ -21,6 +20,8 @@ extern crate rustc_back;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
use std::process;
|
||||||
|
use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT, Ordering};
|
||||||
use subcommand::Subcommand;
|
use subcommand::Subcommand;
|
||||||
use term::Term;
|
use term::Term;
|
||||||
|
|
||||||
|
@ -37,6 +38,8 @@ mod test;
|
||||||
mod css;
|
mod css;
|
||||||
mod javascript;
|
mod javascript;
|
||||||
|
|
||||||
|
static EXIT_STATUS: AtomicIsize = ATOMIC_ISIZE_INIT;
|
||||||
|
|
||||||
#[cfg(not(test))] // thanks #12327
|
#[cfg(not(test))] // thanks #12327
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut term = Term::new();
|
let mut term = Term::new();
|
||||||
|
@ -70,4 +73,5 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
process::exit(EXIT_STATUS.load(Ordering::SeqCst) as i32);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
//! An abstraction of the terminal. Eventually, provide color and
|
//! An abstraction of the terminal. Eventually, provide color and
|
||||||
//! verbosity support. For now, just a wrapper around stdout/stderr.
|
//! verbosity support. For now, just a wrapper around stdout/stderr.
|
||||||
|
|
||||||
use std::env;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
use std::sync::atomic::Ordering;
|
||||||
|
|
||||||
pub struct Term {
|
pub struct Term {
|
||||||
err: Box<Write + 'static>
|
err: Box<Write + 'static>
|
||||||
|
@ -29,6 +29,6 @@ impl Term {
|
||||||
pub fn err(&mut self, msg: &str) {
|
pub fn err(&mut self, msg: &str) {
|
||||||
// swallow any errors
|
// swallow any errors
|
||||||
let _ = writeln!(&mut self.err, "{}", msg);
|
let _ = writeln!(&mut self.err, "{}", msg);
|
||||||
env::set_exit_status(101);
|
::EXIT_STATUS.store(101, Ordering::SeqCst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,19 +8,11 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
|
||||||
|
|
||||||
#![forbid(warnings)]
|
#![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
|
// We shouldn't need to rebind a moved upvar as mut if it's already
|
||||||
// marked as mut
|
// marked as mut
|
||||||
|
|
||||||
use std::thunk::Thunk;
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let mut x = 1;
|
let mut x = 1;
|
||||||
let _thunk = Box::new(move|| { x = 2; });
|
let _thunk = Box::new(move|| { x = 2; });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue