Skip to content

Commit 456ca95

Browse files
committed
Auto merge of #40600 - alexcrichton:beta-next, r=alexcrichton
[beta] Backports to beta This is a backport of the following PRs to beta: * #40507 * #40482 * #40526 * #40539 * #40538
2 parents 408d49e + 4a8900f commit 456ca95

File tree

29 files changed

+141
-159
lines changed

29 files changed

+141
-159
lines changed

.travis.yml

+10
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ matrix:
4848
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
4949
SCCACHE_ERROR_LOG=/tmp/sccache.log
5050
RUST_LOG=sccache=debug
51+
MACOSX_DEPLOYMENT_TARGET=10.8
52+
MACOSX_STD_DEPLOYMENT_TARGET=10.7
5153
os: osx
5254
osx_image: xcode8.2
5355
install: &osx_install_sccache >
@@ -60,6 +62,8 @@ matrix:
6062
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
6163
SCCACHE_ERROR_LOG=/tmp/sccache.log
6264
RUST_LOG=sccache=debug
65+
MACOSX_DEPLOYMENT_TARGET=10.8
66+
MACOSX_STD_DEPLOYMENT_TARGET=10.7
6367
os: osx
6468
osx_image: xcode8.2
6569
install: *osx_install_sccache
@@ -72,6 +76,8 @@ matrix:
7276
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
7377
SCCACHE_ERROR_LOG=/tmp/sccache.log
7478
RUST_LOG=sccache=debug
79+
MACOSX_DEPLOYMENT_TARGET=10.8
80+
MACOSX_STD_DEPLOYMENT_TARGET=10.7
7581
os: osx
7682
osx_image: xcode8.2
7783
install: >
@@ -85,6 +91,8 @@ matrix:
8591
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
8692
SCCACHE_ERROR_LOG=/tmp/sccache.log
8793
RUST_LOG=sccache=debug
94+
MACOSX_DEPLOYMENT_TARGET=10.8
95+
MACOSX_STD_DEPLOYMENT_TARGET=10.7
8896
os: osx
8997
osx_image: xcode8.2
9098
install: *osx_install_sccache
@@ -102,6 +110,8 @@ matrix:
102110
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
103111
SCCACHE_ERROR_LOG=/tmp/sccache.log
104112
RUST_LOG=sccache=debug
113+
MACOSX_DEPLOYMENT_TARGET=10.8
114+
MACOSX_STD_DEPLOYMENT_TARGET=10.7
105115
os: osx
106116
osx_image: xcode8.2
107117
install: *osx_install_sccache

src/bootstrap/compile.rs

+9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::collections::HashMap;
2020
use std::fs::{self, File};
2121
use std::path::{Path, PathBuf};
2222
use std::process::Command;
23+
use std::env;
2324

2425
use build_helper::{output, mtime, up_to_date};
2526
use filetime::FileTime;
@@ -44,6 +45,11 @@ pub fn std(build: &Build, target: &str, compiler: &Compiler) {
4445
build.clear_if_dirty(&out_dir, &build.compiler_path(compiler));
4546
let mut cargo = build.cargo(compiler, Mode::Libstd, target, "build");
4647
let mut features = build.std_features();
48+
49+
if let Ok(target) = env::var("MACOSX_STD_DEPLOYMENT_TARGET") {
50+
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
51+
}
52+
4753
// When doing a local rebuild we tell cargo that we're stage1 rather than
4854
// stage0. This works fine if the local rust and being-built rust have the
4955
// 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) {
170176
let out_dir = build.cargo_out(compiler, Mode::Libtest, target);
171177
build.clear_if_dirty(&out_dir, &libstd_stamp(build, compiler, target));
172178
let mut cargo = build.cargo(compiler, Mode::Libtest, target, "build");
179+
if let Ok(target) = env::var("MACOSX_STD_DEPLOYMENT_TARGET") {
180+
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
181+
}
173182
cargo.arg("--manifest-path")
174183
.arg(build.src.join("src/libtest/Cargo.toml"));
175184
build.run(&mut cargo);

src/ci/docker/dist-powerpc64-linux/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ USER rustbuild
6161
WORKDIR /tmp
6262

6363
COPY patches/ /tmp/patches/
64-
COPY powerpc64-linux-gnu.config build-powerpc64-toolchain.sh /tmp/
64+
COPY shared.sh powerpc64-linux-gnu.config build-powerpc64-toolchain.sh /tmp/
6565
RUN ./build-powerpc64-toolchain.sh
6666

6767
USER root

src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh

+1-16
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,7 @@
1111

1212
set -ex
1313

14-
hide_output() {
15-
set +x
16-
on_err="
17-
echo ERROR: An error was encountered with the build.
18-
cat /tmp/build.log
19-
exit 1
20-
"
21-
trap "$on_err" ERR
22-
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
23-
PING_LOOP_PID=$!
24-
$@ &> /tmp/build.log
25-
rm /tmp/build.log
26-
trap - ERR
27-
kill $PING_LOOP_PID
28-
set -x
29-
}
14+
source shared.sh
3015

3116
mkdir build
3217
cd build

src/ci/docker/dist-powerpc64-linux/build-powerpc64le-toolchain.sh

+9-7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
set -ex
1313

14+
source shared.sh
15+
1416
BINUTILS=2.25.1
1517
GCC=5.3.0
1618
TARGET=powerpc64le-linux-gnu
@@ -40,9 +42,9 @@ pushd binutils-$TARGET
4042
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
4143
mkdir binutils-build
4244
cd binutils-build
43-
../binutils-$BINUTILS/configure --target=$TARGET --with-sysroot=$SYSROOT
44-
make -j10
45-
make install
45+
hide_output ../binutils-$BINUTILS/configure --target=$TARGET --with-sysroot=$SYSROOT
46+
hide_output make -j10
47+
hide_output make install
4648
popd
4749
rm -rf binutils-$TARGET
4850

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

5658
mkdir ../gcc-build
5759
cd ../gcc-build
58-
../gcc-$GCC/configure \
60+
hide_output ../gcc-$GCC/configure \
5961
--enable-languages=c,c++ \
6062
--target=$TARGET \
6163
--with-cpu=power8 \
@@ -72,8 +74,8 @@ cd ../gcc-build
7274
--disable-libsanitizer \
7375
--disable-libquadmath-support \
7476
--disable-lto
75-
make -j10
76-
make install
77+
hide_output hide_output make -j10
78+
hide_output make install
7779

7880
popd
7981
rm -rf gcc-$TARGET
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
# file at the top-level directory of this distribution and at
3+
# http://rust-lang.org/COPYRIGHT.
4+
#
5+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
# option. This file may not be copied, modified, or distributed
9+
# except according to those terms.
10+
11+
hide_output() {
12+
set +x
13+
on_err="
14+
echo ERROR: An error was encountered with the build.
15+
cat /tmp/build.log
16+
exit 1
17+
"
18+
trap "$on_err" ERR
19+
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
20+
PING_LOOP_PID=$!
21+
$@ &> /tmp/build.log
22+
trap - ERR
23+
kill $PING_LOOP_PID
24+
set -x
25+
}

src/ci/docker/dist-x86-linux/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,10 @@ ENV RUST_CONFIGURE_ARGS \
8686
--enable-extended \
8787
--enable-sanitizers
8888
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
89+
90+
# This is the only builder which will create source tarballs
8991
ENV DIST_SRC 1
92+
93+
# When we build cargo in this container, we don't want it to use the system
94+
# libcurl, instead it should compile its own.
95+
ENV LIBCURL_NO_PKG_CONFIG 1

src/liballoc/arc.rs

+13-18
Original file line numberDiff line numberDiff line change
@@ -287,17 +287,15 @@ impl<T> Arc<T> {
287287
/// # Examples
288288
///
289289
/// ```
290-
/// #![feature(rc_raw)]
291-
///
292290
/// use std::sync::Arc;
293291
///
294292
/// let x = Arc::new(10);
295293
/// let x_ptr = Arc::into_raw(x);
296294
/// assert_eq!(unsafe { *x_ptr }, 10);
297295
/// ```
298-
#[unstable(feature = "rc_raw", issue = "37197")]
299-
pub fn into_raw(this: Self) -> *mut T {
300-
let ptr = unsafe { &mut (**this.ptr).data as *mut _ };
296+
#[stable(feature = "rc_raw", since = "1.17.0")]
297+
pub fn into_raw(this: Self) -> *const T {
298+
let ptr = unsafe { &(**this.ptr).data as *const _ };
301299
mem::forget(this);
302300
ptr
303301
}
@@ -315,8 +313,6 @@ impl<T> Arc<T> {
315313
/// # Examples
316314
///
317315
/// ```
318-
/// #![feature(rc_raw)]
319-
///
320316
/// use std::sync::Arc;
321317
///
322318
/// let x = Arc::new(10);
@@ -332,11 +328,14 @@ impl<T> Arc<T> {
332328
///
333329
/// // The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!
334330
/// ```
335-
#[unstable(feature = "rc_raw", issue = "37197")]
336-
pub unsafe fn from_raw(ptr: *mut T) -> Self {
331+
#[stable(feature = "rc_raw", since = "1.17.0")]
332+
pub unsafe fn from_raw(ptr: *const T) -> Self {
337333
// To find the corresponding pointer to the `ArcInner` we need to subtract the offset of the
338334
// `data` field from the pointer.
339-
Arc { ptr: Shared::new((ptr as *mut u8).offset(-offset_of!(ArcInner<T>, data)) as *mut _) }
335+
let ptr = (ptr as *const u8).offset(-offset_of!(ArcInner<T>, data));
336+
Arc {
337+
ptr: Shared::new(ptr as *const _),
338+
}
340339
}
341340
}
342341

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

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

463462
#[inline]
464-
#[unstable(feature = "ptr_eq",
465-
reason = "newly added",
466-
issue = "36497")]
463+
#[stable(feature = "ptr_eq", since = "1.17.0")]
467464
/// Returns true if the two `Arc`s point to the same value (not
468465
/// just values that compare as equal).
469466
///
470467
/// # Examples
471468
///
472469
/// ```
473-
/// #![feature(ptr_eq)]
474-
///
475470
/// use std::sync::Arc;
476471
///
477472
/// let five = Arc::new(5);
@@ -628,7 +623,7 @@ impl<T: Clone> Arc<T> {
628623
// As with `get_mut()`, the unsafety is ok because our reference was
629624
// either unique to begin with, or became one upon cloning the contents.
630625
unsafe {
631-
let inner = &mut **this.ptr;
626+
let inner = &mut *this.ptr.as_mut_ptr();
632627
&mut inner.data
633628
}
634629
}
@@ -671,7 +666,7 @@ impl<T: ?Sized> Arc<T> {
671666
// the Arc itself to be `mut`, so we're returning the only possible
672667
// reference to the inner data.
673668
unsafe {
674-
let inner = &mut **this.ptr;
669+
let inner = &mut *this.ptr.as_mut_ptr();
675670
Some(&mut inner.data)
676671
}
677672
} else {

src/liballoc/rc.rs

+10-18
Original file line numberDiff line numberDiff line change
@@ -364,17 +364,15 @@ impl<T> Rc<T> {
364364
/// # Examples
365365
///
366366
/// ```
367-
/// #![feature(rc_raw)]
368-
///
369367
/// use std::rc::Rc;
370368
///
371369
/// let x = Rc::new(10);
372370
/// let x_ptr = Rc::into_raw(x);
373371
/// assert_eq!(unsafe { *x_ptr }, 10);
374372
/// ```
375-
#[unstable(feature = "rc_raw", issue = "37197")]
376-
pub fn into_raw(this: Self) -> *mut T {
377-
let ptr = unsafe { &mut (**this.ptr).value as *mut _ };
373+
#[stable(feature = "rc_raw", since = "1.17.0")]
374+
pub fn into_raw(this: Self) -> *const T {
375+
let ptr = unsafe { &mut (*this.ptr.as_mut_ptr()).value as *const _ };
378376
mem::forget(this);
379377
ptr
380378
}
@@ -392,8 +390,6 @@ impl<T> Rc<T> {
392390
/// # Examples
393391
///
394392
/// ```
395-
/// #![feature(rc_raw)]
396-
///
397393
/// use std::rc::Rc;
398394
///
399395
/// let x = Rc::new(10);
@@ -409,11 +405,11 @@ impl<T> Rc<T> {
409405
///
410406
/// // The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!
411407
/// ```
412-
#[unstable(feature = "rc_raw", issue = "37197")]
413-
pub unsafe fn from_raw(ptr: *mut T) -> Self {
408+
#[stable(feature = "rc_raw", since = "1.17.0")]
409+
pub unsafe fn from_raw(ptr: *const T) -> Self {
414410
// To find the corresponding pointer to the `RcBox` we need to subtract the offset of the
415411
// `value` field from the pointer.
416-
Rc { ptr: Shared::new((ptr as *mut u8).offset(-offset_of!(RcBox<T>, value)) as *mut _) }
412+
Rc { ptr: Shared::new((ptr as *const u8).offset(-offset_of!(RcBox<T>, value)) as *const _) }
417413
}
418414
}
419415

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

553549
#[inline]
554-
#[unstable(feature = "ptr_eq",
555-
reason = "newly added",
556-
issue = "36497")]
550+
#[stable(feature = "ptr_eq", since = "1.17.0")]
557551
/// Returns true if the two `Rc`s point to the same value (not
558552
/// just values that compare as equal).
559553
///
560554
/// # Examples
561555
///
562556
/// ```
563-
/// #![feature(ptr_eq)]
564-
///
565557
/// use std::rc::Rc;
566558
///
567559
/// let five = Rc::new(5);
@@ -631,7 +623,7 @@ impl<T: Clone> Rc<T> {
631623
// reference count is guaranteed to be 1 at this point, and we required
632624
// the `Rc<T>` itself to be `mut`, so we're returning the only possible
633625
// reference to the inner value.
634-
let inner = unsafe { &mut **this.ptr };
626+
let inner = unsafe { &mut *this.ptr.as_mut_ptr() };
635627
&mut inner.value
636628
}
637629
}
@@ -677,7 +669,7 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Rc<T> {
677669
/// ```
678670
fn drop(&mut self) {
679671
unsafe {
680-
let ptr = *self.ptr;
672+
let ptr = self.ptr.as_mut_ptr();
681673

682674
self.dec_strong();
683675
if self.strong() == 0 {

0 commit comments

Comments
 (0)