Auto merge of #43316 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 11 pull requests - Successful merges: #42837, #43282, #43287, #43290, #43292, #43294, #43304, #43310, #43312, #43314, #43315 - Failed merges:
This commit is contained in:
commit
af049cd08b
23 changed files with 209 additions and 176 deletions
245
.travis.yml
245
.travis.yml
|
@ -11,7 +11,82 @@ git:
|
|||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
# Linux builders, all docker images
|
||||
# Images used in testing PR and try-build should be run first.
|
||||
- env: IMAGE=x86_64-gnu-llvm-3.7 ALLOW_PR=1 RUST_BACKTRACE=1
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY=1 ALLOW_TRY=1
|
||||
|
||||
# "alternate" deployments, these are "nightlies" but don't have assertions
|
||||
# turned on, they're deployed to a different location primarily for projects
|
||||
# which are stuck on nightly and don't want llvm assertions in the artifacts
|
||||
# that they use.
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY_ALT=1
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
RUST_CONFIGURE_ARGS="--enable-extended --enable-profiler"
|
||||
SRC=.
|
||||
DEPLOY_ALT=1
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
|
||||
# macOS builders. These are placed near the beginning because they are very
|
||||
# slow to run.
|
||||
|
||||
# OSX builders running tests, these run the full test suite.
|
||||
#
|
||||
# Note that the compiler is compiled to target 10.8 here because the Xcode
|
||||
# version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=check
|
||||
RUST_CONFIGURE_ARGS="--build=x86_64-apple-darwin --enable-sanitizers --enable-profiler"
|
||||
SRC=.
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
MACOSX_STD_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=check
|
||||
RUST_CONFIGURE_ARGS=--build=i686-apple-darwin
|
||||
SRC=.
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
MACOSX_STD_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
|
||||
# OSX builders producing releases. These do not run the full test suite and
|
||||
# just produce a bunch of artifacts.
|
||||
#
|
||||
# Note that these are running in the `xcode7` image instead of the
|
||||
# `xcode8.2` image as above. That's because we want to build releases for
|
||||
# OSX 10.7 and `xcode7` is the latest Xcode able to compile LLVM for 10.7.
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
RUST_CONFIGURE_ARGS="--build=i686-apple-darwin --enable-extended --enable-profiler"
|
||||
SRC=.
|
||||
DEPLOY=1
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended --enable-sanitizers --enable-profiler"
|
||||
SRC=.
|
||||
DEPLOY=1
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
|
||||
# Linux builders, remaining docker images
|
||||
- env: IMAGE=arm-android
|
||||
- env: IMAGE=armhf-gnu
|
||||
- env: IMAGE=cross DEPLOY=1
|
||||
|
@ -33,7 +108,6 @@ matrix:
|
|||
- env: IMAGE=dist-powerpc64le-linux DEPLOY=1
|
||||
- env: IMAGE=dist-s390x-linux DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-freebsd DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY=1 ALLOW_TRY=1
|
||||
- env: IMAGE=dist-x86_64-musl DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-netbsd DEPLOY=1
|
||||
- env: IMAGE=asmjs
|
||||
|
@ -45,96 +119,9 @@ matrix:
|
|||
- env: IMAGE=x86_64-gnu-aux
|
||||
- env: IMAGE=x86_64-gnu-debug
|
||||
- env: IMAGE=x86_64-gnu-nopt
|
||||
- env: IMAGE=x86_64-gnu-llvm-3.7 ALLOW_PR=1 RUST_BACKTRACE=1
|
||||
- env: IMAGE=x86_64-gnu-distcheck
|
||||
- env: IMAGE=x86_64-gnu-incremental
|
||||
|
||||
# OSX builders running tests, these run the full test suite.
|
||||
#
|
||||
# Note that the compiler is compiled to target 10.8 here because the Xcode
|
||||
# version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=check
|
||||
RUST_CONFIGURE_ARGS="--build=x86_64-apple-darwin --enable-sanitizers --enable-profiler"
|
||||
SRC=.
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
MACOSX_STD_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
install: &osx_install_sccache >
|
||||
travis_retry curl -fo /usr/local/bin/sccache https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-apple-darwin &&
|
||||
chmod +x /usr/local/bin/sccache &&
|
||||
travis_retry curl -fo /usr/local/bin/stamp https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-17-stamp-x86_64-apple-darwin &&
|
||||
chmod +x /usr/local/bin/stamp
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=check
|
||||
RUST_CONFIGURE_ARGS=--build=i686-apple-darwin
|
||||
SRC=.
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
MACOSX_STD_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
install: *osx_install_sccache
|
||||
|
||||
# OSX builders producing releases. These do not run the full test suite and
|
||||
# just produce a bunch of artifacts.
|
||||
#
|
||||
# Note that these are running in the `xcode7` image instead of the
|
||||
# `xcode8.2` image as above. That's because we want to build releases for
|
||||
# OSX 10.7 and `xcode7` is the latest Xcode able to compile LLVM for 10.7.
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
RUST_CONFIGURE_ARGS="--build=i686-apple-darwin --enable-extended --enable-profiler"
|
||||
SRC=.
|
||||
DEPLOY=1
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
install:
|
||||
- travis_retry brew update
|
||||
- travis_retry brew install xz
|
||||
- *osx_install_sccache
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended --enable-sanitizers --enable-profiler"
|
||||
SRC=.
|
||||
DEPLOY=1
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
install:
|
||||
- travis_retry brew update
|
||||
- travis_retry brew install xz
|
||||
- *osx_install_sccache
|
||||
|
||||
# "alternate" deployments, these are "nightlies" but don't have assertions
|
||||
# turned on, they're deployed to a different location primarily for projects
|
||||
# which are stuck on nightly and don't want llvm assertions in the artifacts
|
||||
# that they use.
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY_ALT=1
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
RUST_CONFIGURE_ARGS="--enable-extended --enable-profiler"
|
||||
SRC=.
|
||||
DEPLOY_ALT=1
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
install:
|
||||
- travis_retry brew update
|
||||
- travis_retry brew install xz
|
||||
- *osx_install_sccache
|
||||
|
||||
env:
|
||||
global:
|
||||
- SCCACHE_BUCKET=rust-lang-ci-sccache
|
||||
|
@ -142,41 +129,64 @@ env:
|
|||
# AWS_SECRET_ACCESS_KEY=...
|
||||
- secure: "Pixhh0hXDqGCdOyLtGFjli3J2AtDWIpyb2btIrLe956nCBDRutRoMm6rv5DI9sFZN07Mms7VzNNvhc9wCW1y63JAm414d2Co7Ob8kWMZlz9l9t7ACHuktUiis8yr+S4Quq1Vqd6pqi7pf2J++UxC8R/uLeqVrubzr6+X7AbmEFE="
|
||||
|
||||
# Note that this is overridden on OSX builders
|
||||
install: >
|
||||
travis_retry curl -fo $HOME/stamp https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-17-stamp-x86_64-unknown-linux-musl &&
|
||||
chmod +x $HOME/stamp &&
|
||||
export PATH=$PATH:$HOME
|
||||
before_install:
|
||||
# If we are building a pull request, do the build if $ALLOW_PR == 1
|
||||
# Otherwise, do the build if we are on the auto branch, or the try branch and $ALLOW_TRY == 1
|
||||
- >
|
||||
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
|
||||
if [[ "$ALLOW_PR" == "1" ]]; then
|
||||
export SKIP_BUILD=false;
|
||||
else
|
||||
export SKIP_BUILD=true;
|
||||
fi;
|
||||
elif [[ "$TRAVIS_BRANCH" == "auto" || ( "$ALLOW_TRY" == "1" && "$TRAVIS_BRANCH" == "try" ) ]]; then
|
||||
export SKIP_BUILD=false;
|
||||
else
|
||||
export SKIP_BUILD=true;
|
||||
fi
|
||||
- >
|
||||
if [[ "$SKIP_BUILD" == false ]]; then
|
||||
zcat $HOME/docker/rust-ci.tar.gz | docker load || true
|
||||
fi
|
||||
- mkdir -p $HOME/rustsrc
|
||||
|
||||
install:
|
||||
- >
|
||||
if [[ "$SKIP_BUILD" == true ]]; then
|
||||
echo echo skipping, not a full build > $HOME/stamp &&
|
||||
chmod +x $HOME/stamp &&
|
||||
export PATH=$PATH:$HOME;
|
||||
else
|
||||
case "$TRAVIS_OS_NAME" in
|
||||
linux)
|
||||
travis_retry curl -fo $HOME/stamp https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-17-stamp-x86_64-unknown-linux-musl &&
|
||||
chmod +x $HOME/stamp &&
|
||||
export PATH=$PATH:$HOME
|
||||
;;
|
||||
osx)
|
||||
if [[ "$RUST_CHECK_TARGET" == dist ]]; then
|
||||
travis_retry brew update &&
|
||||
travis_retry brew install xz;
|
||||
fi &&
|
||||
travis_retry curl -fo /usr/local/bin/sccache https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-apple-darwin &&
|
||||
chmod +x /usr/local/bin/sccache &&
|
||||
travis_retry curl -fo /usr/local/bin/stamp https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-17-stamp-x86_64-apple-darwin &&
|
||||
chmod +x /usr/local/bin/stamp
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
before_script:
|
||||
- >
|
||||
echo "#### Disk usage before running script:";
|
||||
df -h;
|
||||
du . | sort -nr | head -n100
|
||||
# If we are building a pull request, do the build if $ALLOW_PR == 1
|
||||
# Otherwise, do the build if we are on the auto branch, or the try branch and $ALLOW_TRY == 1
|
||||
- >
|
||||
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
|
||||
if [[ "$ALLOW_PR" == "1" ]]; then
|
||||
SKIP_BUILD=false;
|
||||
else
|
||||
SKIP_BUILD=true;
|
||||
fi
|
||||
elif [[ "$TRAVIS_BRANCH" == "auto" || ( "$ALLOW_TRY" == "1" && "$TRAVIS_BRANCH" == "try" ) ]]; then
|
||||
SKIP_BUILD=false;
|
||||
RUN_SCRIPT="src/ci/init_repo.sh . $HOME/rustsrc";
|
||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
export RUN_SCRIPT="$RUN_SCRIPT && src/ci/run.sh";
|
||||
else
|
||||
SKIP_BUILD=true;
|
||||
fi
|
||||
|
||||
if [[ "$SKIP_BUILD" == true ]]; then
|
||||
export RUN_SCRIPT="echo 'skipping, not a full build'";
|
||||
else
|
||||
RUN_SCRIPT="src/ci/init_repo.sh . $HOME/rustsrc";
|
||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
export RUN_SCRIPT="$RUN_SCRIPT && src/ci/run.sh";
|
||||
else
|
||||
export RUN_SCRIPT="$RUN_SCRIPT && src/ci/docker/run.sh $IMAGE";
|
||||
fi
|
||||
export RUN_SCRIPT="$RUN_SCRIPT && src/ci/docker/run.sh $IMAGE";
|
||||
fi
|
||||
|
||||
# Log time information from this machine and an external machine for insight into possible
|
||||
|
@ -223,9 +233,6 @@ before_cache:
|
|||
grep -v missing |
|
||||
xargs docker save |
|
||||
gzip > $HOME/docker/rust-ci.tar.gz
|
||||
before_install:
|
||||
- zcat $HOME/docker/rust-ci.tar.gz | docker load || true
|
||||
- mkdir -p $HOME/rustsrc
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
|
|
@ -289,7 +289,7 @@ been approved. The PR then enters the [merge queue][merge-queue], where @bors
|
|||
will run all the tests on every platform we support. If it all works out,
|
||||
@bors will merge your code into `master` and close the pull request.
|
||||
|
||||
[merge-queue]: https://buildbot.rust-lang.org/homu/queue/rust
|
||||
[merge-queue]: https://buildbot2.rust-lang.org/homu/queue/rust
|
||||
|
||||
Speaking of tests, Rust has a comprehensive test suite. More information about
|
||||
it can be found
|
||||
|
|
|
@ -15,7 +15,7 @@ URL=https://dl.google.com/android/repository
|
|||
download_ndk() {
|
||||
mkdir -p /android/ndk
|
||||
cd /android/ndk
|
||||
curl -sO $URL/$1
|
||||
curl -fO $URL/$1
|
||||
unzip -q $1
|
||||
rm $1
|
||||
mv android-ndk-* ndk
|
||||
|
|
|
@ -15,7 +15,7 @@ URL=https://dl.google.com/android/repository
|
|||
download_sdk() {
|
||||
mkdir -p /android/sdk
|
||||
cd /android/sdk
|
||||
curl -sO $URL/$1
|
||||
curl -fO $URL/$1
|
||||
unzip -q $1
|
||||
rm -rf $1
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
set -ex
|
||||
|
||||
url="http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2"
|
||||
curl -s $url | tar xjf -
|
||||
curl -f $url | tar xjf -
|
||||
cd crosstool-ng
|
||||
./configure --prefix=/usr/local
|
||||
make -j$(nproc)
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
set -ex
|
||||
|
||||
curl -sOL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb
|
||||
curl -fOL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb
|
||||
dpkg -i dumb-init_*.deb
|
||||
rm dumb-init_*.deb
|
||||
|
|
|
@ -28,7 +28,7 @@ exit 1
|
|||
}
|
||||
|
||||
# Download last known good emscripten from WebAssembly waterfall
|
||||
BUILD=$(curl -sL https://storage.googleapis.com/wasm-llvm/builds/linux/lkgr.json | \
|
||||
BUILD=$(curl -fL https://storage.googleapis.com/wasm-llvm/builds/linux/lkgr.json | \
|
||||
jq '.build | tonumber')
|
||||
curl -sL https://storage.googleapis.com/wasm-llvm/builds/linux/$BUILD/wasm-binaries.tbz2 | \
|
||||
hide_output tar xvkj
|
||||
|
|
|
@ -28,7 +28,7 @@ exit 1
|
|||
}
|
||||
|
||||
cd /
|
||||
curl -sL https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
|
||||
curl -fL https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
|
||||
tar -xz
|
||||
|
||||
cd /emsdk-portable
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
set -ex
|
||||
|
||||
curl -s https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf -
|
||||
curl -f https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf -
|
||||
cd make-3.81
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
set -ex
|
||||
|
||||
curl -so /usr/local/bin/sccache \
|
||||
curl -fo /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl
|
||||
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
|
|
@ -973,7 +973,7 @@ impl<T> From<T> for Rc<T> {
|
|||
/// A `Weak` pointer is useful for keeping a temporary reference to the value
|
||||
/// within [`Rc`] without extending its lifetime. It is also used to prevent
|
||||
/// circular references between [`Rc`] pointers, since mutual owning references
|
||||
/// would never allow either [`Arc`] to be dropped. For example, a tree could
|
||||
/// would never allow either [`Rc`] to be dropped. For example, a tree could
|
||||
/// have strong [`Rc`] pointers from parent nodes to children, and `Weak`
|
||||
/// pointers from children back to their parents.
|
||||
///
|
||||
|
|
|
@ -126,7 +126,7 @@ pub trait Default: Sized {
|
|||
}
|
||||
|
||||
macro_rules! default_impl {
|
||||
($t:ty, $v:expr, $doc:expr) => {
|
||||
($t:ty, $v:expr, $doc:tt) => {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Default for $t {
|
||||
#[inline]
|
||||
|
|
|
@ -81,6 +81,22 @@ pub type Result = result::Result<(), Error>;
|
|||
/// This type does not support transmission of an error other than that an error
|
||||
/// occurred. Any extra information must be arranged to be transmitted through
|
||||
/// some other means.
|
||||
///
|
||||
/// An important thing to remember is that the type `fmt::Error` should not be
|
||||
/// confused with `std::io::Error` or `std::error::Error`, which you may also
|
||||
/// have in scope.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use std::fmt::{self, write};
|
||||
///
|
||||
/// let mut output = String::new();
|
||||
/// match write(&mut output, format_args!("Hello {}!", "world")) {
|
||||
/// Err(fmt::Error) => panic!("An error occurred"),
|
||||
/// _ => (),
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
pub struct Error;
|
||||
|
|
|
@ -1094,7 +1094,7 @@ impl f32 {
|
|||
/// assert_eq!((12.5f32).to_bits(), 0x41480000);
|
||||
///
|
||||
/// ```
|
||||
#[stable(feature = "float_bits_conv", since = "1.21.0")]
|
||||
#[stable(feature = "float_bits_conv", since = "1.20.0")]
|
||||
#[inline]
|
||||
pub fn to_bits(self) -> u32 {
|
||||
unsafe { ::mem::transmute(self) }
|
||||
|
@ -1125,7 +1125,7 @@ impl f32 {
|
|||
/// let snan = 0x7F800001;
|
||||
/// assert_ne!(f32::from_bits(snan).to_bits(), snan);
|
||||
/// ```
|
||||
#[stable(feature = "float_bits_conv", since = "1.21.0")]
|
||||
#[stable(feature = "float_bits_conv", since = "1.20.0")]
|
||||
#[inline]
|
||||
pub fn from_bits(mut v: u32) -> Self {
|
||||
const EXP_MASK: u32 = 0x7F800000;
|
||||
|
|
|
@ -1009,7 +1009,7 @@ impl f64 {
|
|||
/// assert_eq!((12.5f64).to_bits(), 0x4029000000000000);
|
||||
///
|
||||
/// ```
|
||||
#[stable(feature = "float_bits_conv", since = "1.21.0")]
|
||||
#[stable(feature = "float_bits_conv", since = "1.20.0")]
|
||||
#[inline]
|
||||
pub fn to_bits(self) -> u64 {
|
||||
unsafe { ::mem::transmute(self) }
|
||||
|
@ -1040,7 +1040,7 @@ impl f64 {
|
|||
/// let snan = 0x7FF0000000000001;
|
||||
/// assert_ne!(f64::from_bits(snan).to_bits(), snan);
|
||||
/// ```
|
||||
#[stable(feature = "float_bits_conv", since = "1.21.0")]
|
||||
#[stable(feature = "float_bits_conv", since = "1.20.0")]
|
||||
#[inline]
|
||||
pub fn from_bits(mut v: u64) -> Self {
|
||||
const EXP_MASK: u64 = 0x7FF0000000000000;
|
||||
|
|
|
@ -2346,17 +2346,17 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn recursive_mkdir_slash() {
|
||||
check!(fs::create_dir_all(&Path::new("/")));
|
||||
check!(fs::create_dir_all(Path::new("/")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recursive_mkdir_dot() {
|
||||
check!(fs::create_dir_all(&Path::new(".")));
|
||||
check!(fs::create_dir_all(Path::new(".")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recursive_mkdir_empty() {
|
||||
check!(fs::create_dir_all(&Path::new("")));
|
||||
check!(fs::create_dir_all(Path::new("")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -29,7 +29,7 @@ impl TcpStream {
|
|||
let mut options = OpenOptions::new();
|
||||
options.read(true);
|
||||
options.write(true);
|
||||
Ok(TcpStream(File::open(&Path::new(path.as_str()), &options)?))
|
||||
Ok(TcpStream(File::open(Path::new(path.as_str()), &options)?))
|
||||
}
|
||||
|
||||
pub fn connect_timeout(_addr: &SocketAddr, _timeout: Duration) -> Result<TcpStream> {
|
||||
|
@ -177,7 +177,7 @@ impl TcpListener {
|
|||
let mut options = OpenOptions::new();
|
||||
options.read(true);
|
||||
options.write(true);
|
||||
Ok(TcpListener(File::open(&Path::new(path.as_str()), &options)?))
|
||||
Ok(TcpListener(File::open(Path::new(path.as_str()), &options)?))
|
||||
}
|
||||
|
||||
pub fn accept(&self) -> Result<(TcpStream, SocketAddr)> {
|
||||
|
|
|
@ -30,7 +30,7 @@ impl UdpSocket {
|
|||
let mut options = OpenOptions::new();
|
||||
options.read(true);
|
||||
options.write(true);
|
||||
Ok(UdpSocket(File::open(&Path::new(path.as_str()), &options)?, UnsafeCell::new(None)))
|
||||
Ok(UdpSocket(File::open(Path::new(path.as_str()), &options)?, UnsafeCell::new(None)))
|
||||
}
|
||||
|
||||
fn get_conn(&self) -> &mut Option<SocketAddr> {
|
||||
|
|
|
@ -73,10 +73,10 @@ pub fn split_paths(unparsed: &OsStr) -> SplitPaths {
|
|||
fn bytes_to_path(b: &[u8]) -> PathBuf {
|
||||
PathBuf::from(<OsStr as OsStrExt>::from_bytes(b))
|
||||
}
|
||||
fn is_colon(b: &u8) -> bool { *b == b':' }
|
||||
fn is_semicolon(b: &u8) -> bool { *b == b';' }
|
||||
let unparsed = unparsed.as_bytes();
|
||||
SplitPaths {
|
||||
iter: unparsed.split(is_colon as fn(&u8) -> bool)
|
||||
iter: unparsed.split(is_semicolon as fn(&u8) -> bool)
|
||||
.map(bytes_to_path as fn(&[u8]) -> PathBuf)
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
|
|||
where I: Iterator<Item=T>, T: AsRef<OsStr>
|
||||
{
|
||||
let mut joined = Vec::new();
|
||||
let sep = b':';
|
||||
let sep = b';';
|
||||
|
||||
for (i, path) in paths.enumerate() {
|
||||
let path = path.as_ref().as_bytes();
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
// except according to those terms.
|
||||
|
||||
use collections::hash_map::HashMap;
|
||||
use env;
|
||||
use env::{self, split_paths};
|
||||
use ffi::OsStr;
|
||||
use os::unix::ffi::OsStrExt;
|
||||
use fmt;
|
||||
use io::{self, Error, ErrorKind};
|
||||
use path::Path;
|
||||
use path::{Path, PathBuf};
|
||||
use sys::fd::FileDesc;
|
||||
use sys::fs::{File, OpenOptions};
|
||||
use sys::pipe::{self, AnonPipe};
|
||||
|
@ -313,23 +314,29 @@ impl Command {
|
|||
}
|
||||
|
||||
let program = if self.program.contains(':') || self.program.contains('/') {
|
||||
self.program.to_owned()
|
||||
} else {
|
||||
let mut path_env = ::env::var("PATH").unwrap_or(".".to_string());
|
||||
|
||||
if ! path_env.ends_with('/') {
|
||||
path_env.push('/');
|
||||
Some(PathBuf::from(&self.program))
|
||||
} else if let Ok(path_env) = ::env::var("PATH") {
|
||||
let mut program = None;
|
||||
for mut path in split_paths(&path_env) {
|
||||
path.push(&self.program);
|
||||
if path.exists() {
|
||||
program = Some(path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
path_env.push_str(&self.program);
|
||||
|
||||
path_env
|
||||
program
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
if let Err(err) = syscall::execve(&program, &args) {
|
||||
io::Error::from_raw_os_error(err.errno as i32)
|
||||
if let Some(program) = program {
|
||||
if let Err(err) = syscall::execve(program.as_os_str().as_bytes(), &args) {
|
||||
io::Error::from_raw_os_error(err.errno as i32)
|
||||
} else {
|
||||
panic!("return from exec without err");
|
||||
}
|
||||
} else {
|
||||
panic!("return from exec without err");
|
||||
io::Error::new(io::ErrorKind::NotFound, "")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,7 +400,7 @@ impl Stdio {
|
|||
let mut opts = OpenOptions::new();
|
||||
opts.read(readable);
|
||||
opts.write(!readable);
|
||||
let fd = File::open(&Path::new("null:"), &opts)?;
|
||||
let fd = File::open(Path::new("null:"), &opts)?;
|
||||
Ok((ChildStdio::Owned(fd.into_fd()), None))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ pub fn dup2(fd: usize, newfd: usize, buf: &[u8]) -> Result<usize> {
|
|||
}
|
||||
|
||||
/// Replace the current process with a new executable
|
||||
pub fn execve(path: &str, args: &[[usize; 2]]) -> Result<usize> {
|
||||
unsafe { syscall4(SYS_EXECVE, path.as_ptr() as usize, path.len(),
|
||||
args.as_ptr() as usize, args.len()) }
|
||||
pub fn execve<T: AsRef<[u8]>>(path: T, args: &[[usize; 2]]) -> Result<usize> {
|
||||
unsafe { syscall4(SYS_EXECVE, path.as_ref().as_ptr() as usize,
|
||||
path.as_ref().len(), args.as_ptr() as usize, args.len()) }
|
||||
}
|
||||
|
||||
/// Exit the current process
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
|
@ -18,9 +18,10 @@ const MILLIS_PER_SEC: u64 = 1_000;
|
|||
/// A `Duration` type to represent a span of time, typically used for system
|
||||
/// timeouts.
|
||||
///
|
||||
/// Each `Duration` is composed of a number of seconds and nanosecond precision.
|
||||
/// APIs binding a system timeout will typically round up the nanosecond
|
||||
/// precision if the underlying system does not support that level of precision.
|
||||
/// Each `Duration` is composed of a whole number of seconds and a fractional part
|
||||
/// represented in nanoseconds. If the underlying system does not support
|
||||
/// nanosecond-level precision, APIs binding a system timeout will typically round up
|
||||
/// the number of nanoseconds.
|
||||
///
|
||||
/// `Duration`s implement many common traits, including [`Add`], [`Sub`], and other
|
||||
/// [`ops`] traits.
|
||||
|
@ -50,11 +51,11 @@ pub struct Duration {
|
|||
}
|
||||
|
||||
impl Duration {
|
||||
/// Creates a new `Duration` from the specified number of seconds and
|
||||
/// additional nanosecond precision.
|
||||
/// Creates a new `Duration` from the specified number of whole seconds and
|
||||
/// additional nanoseconds.
|
||||
///
|
||||
/// If the nanoseconds is greater than 1 billion (the number of nanoseconds
|
||||
/// in a second), then it will carry over into the seconds provided.
|
||||
/// If the number of nanoseconds is greater than 1 billion (the number of
|
||||
/// nanoseconds in a second), then it will carry over into the seconds provided.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
|
@ -77,7 +78,7 @@ impl Duration {
|
|||
Duration { secs: secs, nanos: nanos }
|
||||
}
|
||||
|
||||
/// Creates a new `Duration` from the specified number of seconds.
|
||||
/// Creates a new `Duration` from the specified number of whole seconds.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -115,10 +116,10 @@ impl Duration {
|
|||
Duration { secs: secs, nanos: nanos }
|
||||
}
|
||||
|
||||
/// Returns the number of whole seconds represented by this `Duration`.
|
||||
/// Returns the number of _whole_ seconds contained by this `Duration`.
|
||||
///
|
||||
/// The extra precision represented by this duration is ignored (i.e. extra
|
||||
/// nanoseconds are not represented in the returned value).
|
||||
/// The returned value does not include the fractional (nanosecond) part of the
|
||||
/// duration, which can be obtained using [`subsec_nanos`].
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -147,7 +148,7 @@ impl Duration {
|
|||
#[inline]
|
||||
pub fn as_secs(&self) -> u64 { self.secs }
|
||||
|
||||
/// Returns the nanosecond precision represented by this `Duration`.
|
||||
/// Returns the fractional part of this `Duration`, in nanoseconds.
|
||||
///
|
||||
/// This method does **not** return the length of the duration when
|
||||
/// represented by nanoseconds. The returned number always represents a
|
||||
|
@ -159,7 +160,8 @@ impl Duration {
|
|||
/// use std::time::Duration;
|
||||
///
|
||||
/// let duration = Duration::from_millis(5010);
|
||||
/// assert_eq!(duration.subsec_nanos(), 10000000);
|
||||
/// assert_eq!(duration.as_secs(), 5);
|
||||
/// assert_eq!(duration.subsec_nanos(), 10_000_000);
|
||||
/// ```
|
||||
#[stable(feature = "duration", since = "1.3.0")]
|
||||
#[inline]
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// ignore-arm
|
||||
// ignore-powerpc
|
||||
// ignore-wasm
|
||||
// ignore-emscripten
|
||||
// ignore-windows
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue