Skip to content

[beta] Backports to beta #40600

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Mar 18, 2017
Merged
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -48,6 +48,8 @@ matrix:
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
SCCACHE_ERROR_LOG=/tmp/sccache.log
RUST_LOG=sccache=debug
MACOSX_DEPLOYMENT_TARGET=10.8
MACOSX_STD_DEPLOYMENT_TARGET=10.7
os: osx
osx_image: xcode8.2
install: &osx_install_sccache >
@@ -60,6 +62,8 @@ matrix:
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
SCCACHE_ERROR_LOG=/tmp/sccache.log
RUST_LOG=sccache=debug
MACOSX_DEPLOYMENT_TARGET=10.8
MACOSX_STD_DEPLOYMENT_TARGET=10.7
os: osx
osx_image: xcode8.2
install: *osx_install_sccache
@@ -72,6 +76,8 @@ matrix:
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
SCCACHE_ERROR_LOG=/tmp/sccache.log
RUST_LOG=sccache=debug
MACOSX_DEPLOYMENT_TARGET=10.8
MACOSX_STD_DEPLOYMENT_TARGET=10.7
os: osx
osx_image: xcode8.2
install: >
@@ -85,6 +91,8 @@ matrix:
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
SCCACHE_ERROR_LOG=/tmp/sccache.log
RUST_LOG=sccache=debug
MACOSX_DEPLOYMENT_TARGET=10.8
MACOSX_STD_DEPLOYMENT_TARGET=10.7
os: osx
osx_image: xcode8.2
install: *osx_install_sccache
@@ -102,6 +110,8 @@ matrix:
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
SCCACHE_ERROR_LOG=/tmp/sccache.log
RUST_LOG=sccache=debug
MACOSX_DEPLOYMENT_TARGET=10.8
MACOSX_STD_DEPLOYMENT_TARGET=10.7
os: osx
osx_image: xcode8.2
install: *osx_install_sccache
9 changes: 9 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ use std::collections::HashMap;
use std::fs::{self, File};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::env;

use build_helper::{output, mtime, up_to_date};
use filetime::FileTime;
@@ -44,6 +45,11 @@ pub fn std(build: &Build, target: &str, compiler: &Compiler) {
build.clear_if_dirty(&out_dir, &build.compiler_path(compiler));
let mut cargo = build.cargo(compiler, Mode::Libstd, target, "build");
let mut features = build.std_features();

if let Ok(target) = env::var("MACOSX_STD_DEPLOYMENT_TARGET") {
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
}

// When doing a local rebuild we tell cargo that we're stage1 rather than
// stage0. This works fine if the local rust and being-built rust have the
// same view of what the default allocator is, but fails otherwise. Since
@@ -170,6 +176,9 @@ pub fn test(build: &Build, target: &str, compiler: &Compiler) {
let out_dir = build.cargo_out(compiler, Mode::Libtest, target);
build.clear_if_dirty(&out_dir, &libstd_stamp(build, compiler, target));
let mut cargo = build.cargo(compiler, Mode::Libtest, target, "build");
if let Ok(target) = env::var("MACOSX_STD_DEPLOYMENT_TARGET") {
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
}
cargo.arg("--manifest-path")
.arg(build.src.join("src/libtest/Cargo.toml"));
build.run(&mut cargo);
2 changes: 1 addition & 1 deletion src/ci/docker/dist-powerpc64-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ USER rustbuild
WORKDIR /tmp

COPY patches/ /tmp/patches/
COPY powerpc64-linux-gnu.config build-powerpc64-toolchain.sh /tmp/
COPY shared.sh powerpc64-linux-gnu.config build-powerpc64-toolchain.sh /tmp/
RUN ./build-powerpc64-toolchain.sh

USER root
17 changes: 1 addition & 16 deletions src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh
Original file line number Diff line number Diff line change
@@ -11,22 +11,7 @@

set -ex

hide_output() {
set +x
on_err="
echo ERROR: An error was encountered with the build.
cat /tmp/build.log
exit 1
"
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
}
source shared.sh

mkdir build
cd build
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@

set -ex

source shared.sh

BINUTILS=2.25.1
GCC=5.3.0
TARGET=powerpc64le-linux-gnu
@@ -40,9 +42,9 @@ pushd binutils-$TARGET
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
mkdir binutils-build
cd binutils-build
../binutils-$BINUTILS/configure --target=$TARGET --with-sysroot=$SYSROOT
make -j10
make install
hide_output ../binutils-$BINUTILS/configure --target=$TARGET --with-sysroot=$SYSROOT
hide_output make -j10
hide_output make install
popd
rm -rf binutils-$TARGET

@@ -51,11 +53,11 @@ mkdir gcc-$TARGET
pushd gcc-$TARGET
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
cd gcc-$GCC
./contrib/download_prerequisites
hide_output ./contrib/download_prerequisites

mkdir ../gcc-build
cd ../gcc-build
../gcc-$GCC/configure \
hide_output ../gcc-$GCC/configure \
--enable-languages=c,c++ \
--target=$TARGET \
--with-cpu=power8 \
@@ -72,8 +74,8 @@ cd ../gcc-build
--disable-libsanitizer \
--disable-libquadmath-support \
--disable-lto
make -j10
make install
hide_output hide_output make -j10
hide_output make install

popd
rm -rf gcc-$TARGET
25 changes: 25 additions & 0 deletions src/ci/docker/dist-powerpc64-linux/shared.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

hide_output() {
set +x
on_err="
echo ERROR: An error was encountered with the build.
cat /tmp/build.log
exit 1
"
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
}
6 changes: 6 additions & 0 deletions src/ci/docker/dist-x86-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -86,4 +86,10 @@ ENV RUST_CONFIGURE_ARGS \
--enable-extended \
--enable-sanitizers
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

# This is the only builder which will create source tarballs
ENV DIST_SRC 1

# When we build cargo in this container, we don't want it to use the system
# libcurl, instead it should compile its own.
ENV LIBCURL_NO_PKG_CONFIG 1
31 changes: 13 additions & 18 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
@@ -287,17 +287,15 @@ impl<T> Arc<T> {
/// # Examples
///
/// ```
/// #![feature(rc_raw)]
///
/// use std::sync::Arc;
///
/// let x = Arc::new(10);
/// let x_ptr = Arc::into_raw(x);
/// assert_eq!(unsafe { *x_ptr }, 10);
/// ```
#[unstable(feature = "rc_raw", issue = "37197")]
pub fn into_raw(this: Self) -> *mut T {
let ptr = unsafe { &mut (**this.ptr).data as *mut _ };
#[stable(feature = "rc_raw", since = "1.17.0")]
pub fn into_raw(this: Self) -> *const T {
let ptr = unsafe { &(**this.ptr).data as *const _ };
mem::forget(this);
ptr
}
@@ -315,8 +313,6 @@ impl<T> Arc<T> {
/// # Examples
///
/// ```
/// #![feature(rc_raw)]
///
/// use std::sync::Arc;
///
/// let x = Arc::new(10);
@@ -332,11 +328,14 @@ impl<T> Arc<T> {
///
/// // The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!
/// ```
#[unstable(feature = "rc_raw", issue = "37197")]
pub unsafe fn from_raw(ptr: *mut T) -> Self {
#[stable(feature = "rc_raw", since = "1.17.0")]
pub unsafe fn from_raw(ptr: *const T) -> Self {
// To find the corresponding pointer to the `ArcInner` we need to subtract the offset of the
// `data` field from the pointer.
Arc { ptr: Shared::new((ptr as *mut u8).offset(-offset_of!(ArcInner<T>, data)) as *mut _) }
let ptr = (ptr as *const u8).offset(-offset_of!(ArcInner<T>, data));
Arc {
ptr: Shared::new(ptr as *const _),
}
}
}

@@ -448,7 +447,7 @@ impl<T: ?Sized> Arc<T> {
// Non-inlined part of `drop`.
#[inline(never)]
unsafe fn drop_slow(&mut self) {
let ptr = *self.ptr;
let ptr = self.ptr.as_mut_ptr();

// Destroy the data at this time, even though we may not free the box
// allocation itself (there may still be weak pointers lying around).
@@ -461,17 +460,13 @@ impl<T: ?Sized> Arc<T> {
}

#[inline]
#[unstable(feature = "ptr_eq",
reason = "newly added",
issue = "36497")]
#[stable(feature = "ptr_eq", since = "1.17.0")]
/// Returns true if the two `Arc`s point to the same value (not
/// just values that compare as equal).
///
/// # Examples
///
/// ```
/// #![feature(ptr_eq)]
///
/// use std::sync::Arc;
///
/// let five = Arc::new(5);
@@ -628,7 +623,7 @@ impl<T: Clone> Arc<T> {
// As with `get_mut()`, the unsafety is ok because our reference was
// either unique to begin with, or became one upon cloning the contents.
unsafe {
let inner = &mut **this.ptr;
let inner = &mut *this.ptr.as_mut_ptr();
&mut inner.data
}
}
@@ -671,7 +666,7 @@ impl<T: ?Sized> Arc<T> {
// the Arc itself to be `mut`, so we're returning the only possible
// reference to the inner data.
unsafe {
let inner = &mut **this.ptr;
let inner = &mut *this.ptr.as_mut_ptr();
Some(&mut inner.data)
}
} else {
28 changes: 10 additions & 18 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
@@ -364,17 +364,15 @@ impl<T> Rc<T> {
/// # Examples
///
/// ```
/// #![feature(rc_raw)]
///
/// use std::rc::Rc;
///
/// let x = Rc::new(10);
/// let x_ptr = Rc::into_raw(x);
/// assert_eq!(unsafe { *x_ptr }, 10);
/// ```
#[unstable(feature = "rc_raw", issue = "37197")]
pub fn into_raw(this: Self) -> *mut T {
let ptr = unsafe { &mut (**this.ptr).value as *mut _ };
#[stable(feature = "rc_raw", since = "1.17.0")]
pub fn into_raw(this: Self) -> *const T {
let ptr = unsafe { &mut (*this.ptr.as_mut_ptr()).value as *const _ };
mem::forget(this);
ptr
}
@@ -392,8 +390,6 @@ impl<T> Rc<T> {
/// # Examples
///
/// ```
/// #![feature(rc_raw)]
///
/// use std::rc::Rc;
///
/// let x = Rc::new(10);
@@ -409,11 +405,11 @@ impl<T> Rc<T> {
///
/// // The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!
/// ```
#[unstable(feature = "rc_raw", issue = "37197")]
pub unsafe fn from_raw(ptr: *mut T) -> Self {
#[stable(feature = "rc_raw", since = "1.17.0")]
pub unsafe fn from_raw(ptr: *const T) -> Self {
// To find the corresponding pointer to the `RcBox` we need to subtract the offset of the
// `value` field from the pointer.
Rc { ptr: Shared::new((ptr as *mut u8).offset(-offset_of!(RcBox<T>, value)) as *mut _) }
Rc { ptr: Shared::new((ptr as *const u8).offset(-offset_of!(RcBox<T>, value)) as *const _) }
}
}

@@ -543,25 +539,21 @@ impl<T: ?Sized> Rc<T> {
#[stable(feature = "rc_unique", since = "1.4.0")]
pub fn get_mut(this: &mut Self) -> Option<&mut T> {
if Rc::is_unique(this) {
let inner = unsafe { &mut **this.ptr };
let inner = unsafe { &mut *this.ptr.as_mut_ptr() };
Some(&mut inner.value)
} else {
None
}
}

#[inline]
#[unstable(feature = "ptr_eq",
reason = "newly added",
issue = "36497")]
#[stable(feature = "ptr_eq", since = "1.17.0")]
/// Returns true if the two `Rc`s point to the same value (not
/// just values that compare as equal).
///
/// # Examples
///
/// ```
/// #![feature(ptr_eq)]
///
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
@@ -631,7 +623,7 @@ impl<T: Clone> Rc<T> {
// reference count is guaranteed to be 1 at this point, and we required
// the `Rc<T>` itself to be `mut`, so we're returning the only possible
// reference to the inner value.
let inner = unsafe { &mut **this.ptr };
let inner = unsafe { &mut *this.ptr.as_mut_ptr() };
&mut inner.value
}
}
@@ -677,7 +669,7 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Rc<T> {
/// ```
fn drop(&mut self) {
unsafe {
let ptr = *self.ptr;
let ptr = self.ptr.as_mut_ptr();

self.dec_strong();
if self.strong() == 0 {
14 changes: 4 additions & 10 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
@@ -338,6 +338,7 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> {
}

/// An iterator over a sub-range of BTreeMap's entries.
#[stable(feature = "btree_range", since = "1.17.0")]
pub struct Range<'a, K: 'a, V: 'a> {
front: Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>,
back: Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>,
@@ -351,6 +352,7 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V>
}

/// A mutable iterator over a sub-range of BTreeMap's entries.
#[stable(feature = "btree_range", since = "1.17.0")]
pub struct RangeMut<'a, K: 'a, V: 'a> {
front: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>,
back: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>,
@@ -724,8 +726,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// Basic usage:
///
/// ```
/// #![feature(btree_range, collections_bound)]
///
/// use std::collections::BTreeMap;
/// use std::collections::Bound::Included;
///
@@ -738,9 +738,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// }
/// assert_eq!(Some((&5, &"b")), map.range(4..).next());
/// ```
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle",
issue = "27787")]
#[stable(feature = "btree_range", since = "1.17.0")]
pub fn range<T: ?Sized, R>(&self, range: R) -> Range<K, V>
where T: Ord, K: Borrow<T>, R: RangeArgument<T>
{
@@ -768,8 +766,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// Basic usage:
///
/// ```
/// #![feature(btree_range)]
///
/// use std::collections::BTreeMap;
///
/// let mut map: BTreeMap<&str, i32> = ["Alice", "Bob", "Carol", "Cheryl"].iter()
@@ -782,9 +778,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// println!("{} => {}", name, balance);
/// }
/// ```
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle",
issue = "27787")]
#[stable(feature = "btree_range", since = "1.17.0")]
pub fn range_mut<T: ?Sized, R>(&mut self, range: R) -> RangeMut<K, V>
where T: Ord, K: Borrow<T>, R: RangeArgument<T>
{
7 changes: 2 additions & 5 deletions src/libcollections/btree/set.rs
Original file line number Diff line number Diff line change
@@ -113,6 +113,7 @@ pub struct IntoIter<T> {
/// [`BTreeSet`]: struct.BTreeSet.html
/// [`range`]: struct.BTreeSet.html#method.range
#[derive(Debug)]
#[stable(feature = "btree_range", since = "1.17.0")]
pub struct Range<'a, T: 'a> {
iter: ::btree_map::Range<'a, T, ()>,
}
@@ -264,8 +265,6 @@ impl<T: Ord> BTreeSet<T> {
/// # Examples
///
/// ```
/// #![feature(btree_range, collections_bound)]
///
/// use std::collections::BTreeSet;
/// use std::collections::Bound::Included;
///
@@ -278,9 +277,7 @@ impl<T: Ord> BTreeSet<T> {
/// }
/// assert_eq!(Some(&5), set.range(4..).next());
/// ```
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle",
issue = "27787")]
#[stable(feature = "btree_range", since = "1.17.0")]
pub fn range<K: ?Sized, R>(&self, range: R) -> Range<T>
where K: Ord, T: Borrow<K>, R: RangeArgument<K>
{
5 changes: 4 additions & 1 deletion src/libcollections/lib.rs
Original file line number Diff line number Diff line change
@@ -129,14 +129,17 @@ mod std {
}

/// An endpoint of a range of keys.
#[unstable(feature = "collections_bound", issue = "27787")]
#[stable(feature = "collections_bound", since = "1.17.0")]
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
pub enum Bound<T> {
/// An inclusive bound.
#[stable(feature = "collections_bound", since = "1.17.0")]
Included(T),
/// An exclusive bound.
#[stable(feature = "collections_bound", since = "1.17.0")]
Excluded(T),
/// An infinite endpoint. Indicates that there is no bound in this direction.
#[stable(feature = "collections_bound", since = "1.17.0")]
Unbounded,
}

34 changes: 17 additions & 17 deletions src/libcollections/linked_list.rs
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@ impl<T> LinkedList<T> {

match self.head {
None => self.tail = node,
Some(head) => (**head).prev = node,
Some(head) => (*head.as_mut_ptr()).prev = node,
}

self.head = node;
@@ -154,12 +154,12 @@ impl<T> LinkedList<T> {
#[inline]
fn pop_front_node(&mut self) -> Option<Box<Node<T>>> {
self.head.map(|node| unsafe {
let node = Box::from_raw(*node);
let node = Box::from_raw(node.as_mut_ptr());
self.head = node.next;

match self.head {
None => self.tail = None,
Some(head) => (**head).prev = None,
Some(head) => (*head.as_mut_ptr()).prev = None,
}

self.len -= 1;
@@ -177,7 +177,7 @@ impl<T> LinkedList<T> {

match self.tail {
None => self.head = node,
Some(tail) => (**tail).next = node,
Some(tail) => (*tail.as_mut_ptr()).next = node,
}

self.tail = node;
@@ -189,12 +189,12 @@ impl<T> LinkedList<T> {
#[inline]
fn pop_back_node(&mut self) -> Option<Box<Node<T>>> {
self.tail.map(|node| unsafe {
let node = Box::from_raw(*node);
let node = Box::from_raw(node.as_mut_ptr());
self.tail = node.prev;

match self.tail {
None => self.head = None,
Some(tail) => (**tail).next = None,
Some(tail) => (*tail.as_mut_ptr()).next = None,
}

self.len -= 1;
@@ -269,8 +269,8 @@ impl<T> LinkedList<T> {
Some(tail) => {
if let Some(other_head) = other.head.take() {
unsafe {
(**tail).next = Some(other_head);
(**other_head).prev = Some(tail);
(*tail.as_mut_ptr()).next = Some(other_head);
(*other_head.as_mut_ptr()).prev = Some(tail);
}

self.tail = other.tail.take();
@@ -484,7 +484,7 @@ impl<T> LinkedList<T> {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn front_mut(&mut self) -> Option<&mut T> {
self.head.map(|node| unsafe { &mut (**node).element })
self.head.map(|node| unsafe { &mut (*node.as_mut_ptr()).element })
}

/// Provides a reference to the back element, or `None` if the list is
@@ -530,7 +530,7 @@ impl<T> LinkedList<T> {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn back_mut(&mut self) -> Option<&mut T> {
self.tail.map(|node| unsafe { &mut (**node).element })
self.tail.map(|node| unsafe { &mut (*node.as_mut_ptr()).element })
}

/// Adds an element first in the list.
@@ -675,9 +675,9 @@ impl<T> LinkedList<T> {
let second_part_head;

unsafe {
second_part_head = (**split_node.unwrap()).next.take();
second_part_head = (*split_node.unwrap().as_mut_ptr()).next.take();
if let Some(head) = second_part_head {
(**head).prev = None;
(*head.as_mut_ptr()).prev = None;
}
}

@@ -816,7 +816,7 @@ impl<'a, T> Iterator for IterMut<'a, T> {
None
} else {
self.head.map(|node| unsafe {
let node = &mut **node;
let node = &mut *node.as_mut_ptr();
self.len -= 1;
self.head = node.next;
&mut node.element
@@ -838,7 +838,7 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
None
} else {
self.tail.map(|node| unsafe {
let node = &mut **node;
let node = &mut *node.as_mut_ptr();
self.len -= 1;
self.tail = node.prev;
&mut node.element
@@ -896,8 +896,8 @@ impl<'a, T> IterMut<'a, T> {
element: element,
})));

(**prev).next = node;
(**head).prev = node;
(*prev.as_mut_ptr()).next = node;
(*head.as_mut_ptr()).prev = node;

self.list.len += 1;
},
@@ -929,7 +929,7 @@ impl<'a, T> IterMut<'a, T> {
if self.len == 0 {
None
} else {
self.head.map(|node| unsafe { &mut (**node).element })
self.head.map(|node| unsafe { &mut (*node.as_mut_ptr()).element })
}
}
}
2 changes: 0 additions & 2 deletions src/libcollections/range.rs
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@ pub trait RangeArgument<T: ?Sized> {
/// ```
/// #![feature(collections)]
/// #![feature(collections_range)]
/// #![feature(collections_bound)]
///
/// extern crate collections;
///
@@ -52,7 +51,6 @@ pub trait RangeArgument<T: ?Sized> {
/// ```
/// #![feature(collections)]
/// #![feature(collections_range)]
/// #![feature(collections_bound)]
///
/// extern crate collections;
///
4 changes: 2 additions & 2 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
@@ -2100,7 +2100,7 @@ unsafe impl<#[may_dangle] T> Drop for IntoIter<T> {
for _x in self.by_ref() {}

// RawVec handles deallocation
let _ = unsafe { RawVec::from_raw_parts(*self.buf, self.cap) };
let _ = unsafe { RawVec::from_raw_parts(self.buf.as_mut_ptr(), self.cap) };
}
}

@@ -2165,7 +2165,7 @@ impl<'a, T> Drop for Drain<'a, T> {

if self.tail_len > 0 {
unsafe {
let source_vec = &mut **self.vec;
let source_vec = &mut *self.vec.as_mut_ptr();
// memmove back untouched tail, update to new length
let start = source_vec.len();
let tail = self.tail_start;
2 changes: 1 addition & 1 deletion src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
@@ -2125,7 +2125,7 @@ impl<'a, T: 'a> Drop for Drain<'a, T> {
fn drop(&mut self) {
for _ in self.by_ref() {}

let source_deque = unsafe { &mut **self.deque };
let source_deque = unsafe { &mut *self.deque.as_mut_ptr() };

// T = source_deque_tail; H = source_deque_head; t = drain_tail; h = drain_head
//
2 changes: 0 additions & 2 deletions src/libcollectionstest/lib.rs
Original file line number Diff line number Diff line change
@@ -13,11 +13,9 @@
#![feature(binary_heap_extras)]
#![feature(binary_heap_peek_mut_pop)]
#![feature(box_syntax)]
#![feature(btree_range)]
#![feature(inclusive_range_syntax)]
#![feature(collection_placement)]
#![feature(collections)]
#![feature(collections_bound)]
#![feature(const_fn)]
#![feature(exact_size_is_empty)]
#![feature(pattern)]
12 changes: 4 additions & 8 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
@@ -394,7 +394,6 @@ impl<T> Cell<T> {
/// # Examples
///
/// ```
/// #![feature(move_cell)]
/// use std::cell::Cell;
///
/// let c1 = Cell::new(5i32);
@@ -404,7 +403,7 @@ impl<T> Cell<T> {
/// assert_eq!(5, c2.get());
/// ```
#[inline]
#[unstable(feature = "move_cell", issue = "39264")]
#[stable(feature = "move_cell", since = "1.17.0")]
pub fn swap(&self, other: &Self) {
if ptr::eq(self, other) {
return;
@@ -419,15 +418,14 @@ impl<T> Cell<T> {
/// # Examples
///
/// ```
/// #![feature(move_cell)]
/// use std::cell::Cell;
///
/// let c = Cell::new(5);
/// let old = c.replace(10);
///
/// assert_eq!(5, old);
/// ```
#[unstable(feature = "move_cell", issue = "39264")]
#[stable(feature = "move_cell", since = "1.17.0")]
pub fn replace(&self, val: T) -> T {
mem::replace(unsafe { &mut *self.value.get() }, val)
}
@@ -437,15 +435,14 @@ impl<T> Cell<T> {
/// # Examples
///
/// ```
/// #![feature(move_cell)]
/// use std::cell::Cell;
///
/// let c = Cell::new(5);
/// let five = c.into_inner();
///
/// assert_eq!(five, 5);
/// ```
#[unstable(feature = "move_cell", issue = "39264")]
#[stable(feature = "move_cell", since = "1.17.0")]
pub fn into_inner(self) -> T {
unsafe { self.value.into_inner() }
}
@@ -457,7 +454,6 @@ impl<T: Default> Cell<T> {
/// # Examples
///
/// ```
/// #![feature(move_cell)]
/// use std::cell::Cell;
///
/// let c = Cell::new(5);
@@ -466,7 +462,7 @@ impl<T: Default> Cell<T> {
/// assert_eq!(five, 5);
/// assert_eq!(c.into_inner(), 0);
/// ```
#[unstable(feature = "move_cell", issue = "39264")]
#[stable(feature = "move_cell", since = "1.17.0")]
pub fn take(&self) -> T {
self.replace(Default::default())
}
8 changes: 2 additions & 6 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
@@ -255,8 +255,6 @@ impl Ordering {
/// # Examples
///
/// ```
/// #![feature(ordering_chaining)]
///
/// use std::cmp::Ordering;
///
/// let result = Ordering::Equal.then(Ordering::Less);
@@ -277,7 +275,7 @@ impl Ordering {
///
/// assert_eq!(result, Ordering::Less);
/// ```
#[unstable(feature = "ordering_chaining", issue = "37053")]
#[stable(feature = "ordering_chaining", since = "1.17.0")]
pub fn then(self, other: Ordering) -> Ordering {
match self {
Equal => other,
@@ -293,8 +291,6 @@ impl Ordering {
/// # Examples
///
/// ```
/// #![feature(ordering_chaining)]
///
/// use std::cmp::Ordering;
///
/// let result = Ordering::Equal.then_with(|| Ordering::Less);
@@ -315,7 +311,7 @@ impl Ordering {
///
/// assert_eq!(result, Ordering::Less);
/// ```
#[unstable(feature = "ordering_chaining", issue = "37053")]
#[stable(feature = "ordering_chaining", since = "1.17.0")]
pub fn then_with<F: FnOnce() -> Ordering>(self, f: F) -> Ordering {
match self {
Equal => f(),
25 changes: 14 additions & 11 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
@@ -161,8 +161,6 @@ pub unsafe fn read<T>(src: *const T) -> T {
/// Basic usage:
///
/// ```
/// #![feature(ptr_unaligned)]
///
/// let x = 12;
/// let y = &x as *const i32;
///
@@ -171,7 +169,7 @@ pub unsafe fn read<T>(src: *const T) -> T {
/// }
/// ```
#[inline(always)]
#[unstable(feature = "ptr_unaligned", issue = "37955")]
#[stable(feature = "ptr_unaligned", since = "1.17.0")]
pub unsafe fn read_unaligned<T>(src: *const T) -> T {
let mut tmp: T = mem::uninitialized();
copy_nonoverlapping(src as *const u8,
@@ -241,8 +239,6 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
/// Basic usage:
///
/// ```
/// #![feature(ptr_unaligned)]
///
/// let mut x = 0;
/// let y = &mut x as *mut i32;
/// let z = 12;
@@ -253,7 +249,7 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
/// }
/// ```
#[inline]
#[unstable(feature = "ptr_unaligned", issue = "37955")]
#[stable(feature = "ptr_unaligned", since = "1.17.0")]
pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
copy_nonoverlapping(&src as *const T as *const u8,
dst as *mut u8,
@@ -660,7 +656,6 @@ impl<T: ?Sized> Eq for *mut T {}
/// # Examples
///
/// ```
/// #![feature(ptr_eq)]
/// use std::ptr;
///
/// let five = 5;
@@ -675,7 +670,7 @@ impl<T: ?Sized> Eq for *mut T {}
/// assert!(ptr::eq(five_ref, same_five_ref));
/// assert!(!ptr::eq(five_ref, other_five_ref));
/// ```
#[unstable(feature = "ptr_eq", reason = "newly added", issue = "36497")]
#[stable(feature = "ptr_eq", since = "1.17.0")]
#[inline]
pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
a == b
@@ -970,11 +965,19 @@ impl<T: ?Sized> Shared<T> {
/// # Safety
///
/// `ptr` must be non-null.
pub unsafe fn new(ptr: *mut T) -> Self {
pub unsafe fn new(ptr: *const T) -> Self {
Shared { pointer: NonZero::new(ptr), _marker: PhantomData }
}
}

#[unstable(feature = "shared", issue = "27730")]
impl<T: ?Sized> Shared<T> {
/// Acquires the underlying pointer as a `*mut` pointer.
pub unsafe fn as_mut_ptr(&self) -> *mut T {
**self as _
}
}

#[unstable(feature = "shared", issue = "27730")]
impl<T: ?Sized> Clone for Shared<T> {
fn clone(&self) -> Self {
@@ -990,10 +993,10 @@ impl<T: ?Sized, U: ?Sized> CoerceUnsized<Shared<U>> for Shared<T> where T: Unsiz

#[unstable(feature = "shared", issue = "27730")]
impl<T: ?Sized> Deref for Shared<T> {
type Target = *mut T;
type Target = *const T;

#[inline]
fn deref(&self) -> &*mut T {
fn deref(&self) -> &*const T {
unsafe { mem::transmute(&*self.pointer) }
}
}
3 changes: 1 addition & 2 deletions src/libcore/result.rs
Original file line number Diff line number Diff line change
@@ -803,12 +803,11 @@ impl<T: fmt::Debug, E> Result<T, E> {
/// Basic usage:
///
/// ```{.should_panic}
/// # #![feature(result_expect_err)]
/// let x: Result<u32, &str> = Ok(10);
/// x.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10`
/// ```
#[inline]
#[unstable(feature = "result_expect_err", issue = "39041")]
#[stable(feature = "result_expect_err", since = "1.17.0")]
pub fn expect_err(self, msg: &str) -> E {
match self {
Ok(t) => unwrap_failed(msg, t),
4 changes: 0 additions & 4 deletions src/libcoretest/lib.rs
Original file line number Diff line number Diff line change
@@ -23,17 +23,13 @@
#![feature(nonzero)]
#![feature(rand)]
#![feature(raw)]
#![feature(result_expect_err)]
#![feature(sip_hash_13)]
#![feature(slice_patterns)]
#![feature(step_by)]
#![feature(test)]
#![feature(try_from)]
#![feature(unicode)]
#![feature(unique)]
#![feature(ordering_chaining)]
#![feature(ptr_unaligned)]
#![feature(move_cell)]
#![feature(fmt_internals)]

extern crate core;
3 changes: 1 addition & 2 deletions src/librustc_data_structures/array_vec.rs
Original file line number Diff line number Diff line change
@@ -248,7 +248,7 @@ impl<'a, A: Array> Drop for Drain<'a, A> {

if self.tail_len > 0 {
unsafe {
let source_array_vec = &mut **self.array_vec;
let source_array_vec = &mut *self.array_vec.as_mut_ptr();
// memmove back untouched tail, update to new length
let start = source_array_vec.len();
let tail = self.tail_start;
@@ -317,4 +317,3 @@ impl<T> Default for ManuallyDrop<T> {
ManuallyDrop::new()
}
}

1 change: 0 additions & 1 deletion src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
@@ -27,7 +27,6 @@

#![feature(shared)]
#![feature(collections_range)]
#![feature(collections_bound)]
#![cfg_attr(stage0,feature(field_init_shorthand))]
#![feature(nonzero)]
#![feature(rustc_private)]
2 changes: 1 addition & 1 deletion src/libstd/collections/hash/table.rs
Original file line number Diff line number Diff line change
@@ -1154,7 +1154,7 @@ impl<'a, K, V> Iterator for Drain<'a, K, V> {
fn next(&mut self) -> Option<(SafeHash, K, V)> {
self.iter.next().map(|bucket| {
unsafe {
(**self.table).size -= 1;
(*self.table.as_mut_ptr()).size -= 1;
let (k, v) = ptr::read(bucket.pair);
(SafeHash { hash: ptr::replace(bucket.hash, EMPTY_BUCKET) }, k, v)
}
1 change: 0 additions & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
@@ -245,7 +245,6 @@
#![feature(char_escape_debug)]
#![feature(char_internals)]
#![feature(collections)]
#![feature(collections_bound)]
#![feature(collections_range)]
#![feature(compiler_builtins_lib)]
#![feature(const_fn)]
14 changes: 0 additions & 14 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
@@ -1210,14 +1210,6 @@ impl<'a> From<&'a Path> for Box<Path> {
}
}

#[stable(feature = "box_default_extra", since = "1.17.0")]
impl Default for Box<Path> {
fn default() -> Box<Path> {
let boxed: Box<OsStr> = Default::default();
unsafe { mem::transmute(boxed) }
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for PathBuf {
fn from(s: &'a T) -> PathBuf {
@@ -3710,10 +3702,4 @@ mod tests {
assert_eq!(box1, box2);
assert_eq!(&*box2, path);
}

#[test]
fn boxed_default() {
let boxed = <Box<Path>>::default();
assert!(boxed.as_os_str().is_empty());
}
}
2 changes: 1 addition & 1 deletion src/libstd/process.rs
Original file line number Diff line number Diff line change
@@ -1032,7 +1032,7 @@ pub fn exit(code: i32) -> ! {
/// will be run. If a clean shutdown is needed it is recommended to only call
/// this function at a known point where there are no more destructors left
/// to run.
#[unstable(feature = "process_abort", issue = "37838")]
#[stable(feature = "process_abort", since = "1.17.0")]
pub fn abort() -> ! {
unsafe { ::sys::abort_internal() };
}
11 changes: 3 additions & 8 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
@@ -250,12 +250,13 @@ impl Builder {
let mut components = Vec::new();
let mut extensions = Vec::new();

// rustc/rust-std/cargo are all required, and so is rust-mingw if it's
// available for the target.
// rustc/rust-std/cargo/docs are all required, and so is rust-mingw
// if it's available for the target.
components.extend(vec![
Component { pkg: "rustc".to_string(), target: host.to_string() },
Component { pkg: "rust-std".to_string(), target: host.to_string() },
Component { pkg: "cargo".to_string(), target: host.to_string() },
Component { pkg: "rust-docs".to_string(), target: host.to_string() },
]);
if host.contains("pc-windows-gnu") {
components.push(Component {
@@ -264,12 +265,6 @@ impl Builder {
});
}

// Docs, other standard libraries, and the source package are all
// optional.
extensions.push(Component {
pkg: "rust-docs".to_string(),
target: host.to_string(),
});
for target in TARGETS {
if target != host {
extensions.push(Component {