diff --git a/.travis.yml b/.travis.yml index eb8db13c0bb7f..d315546930330 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,43 +11,28 @@ git: matrix: fast_finish: true include: - # Linux builders, all docker images - - env: IMAGE=arm-android - - env: IMAGE=armhf-gnu - - env: IMAGE=cross DEPLOY=1 - - env: IMAGE=dist-aarch64-linux DEPLOY=1 - - env: IMAGE=dist-android DEPLOY=1 - - env: IMAGE=dist-arm-linux DEPLOY=1 - - env: IMAGE=dist-armhf-linux DEPLOY=1 - - env: IMAGE=dist-armv7-linux DEPLOY=1 - - env: IMAGE=dist-fuchsia DEPLOY=1 - - env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1 - - env: IMAGE=dist-i686-freebsd DEPLOY=1 - - env: IMAGE=dist-i686-linux DEPLOY=1 - - env: IMAGE=dist-mips-linux DEPLOY=1 - - env: IMAGE=dist-mips64-linux DEPLOY=1 - - env: IMAGE=dist-mips64el-linux DEPLOY=1 - - env: IMAGE=dist-mipsel-linux DEPLOY=1 - - env: IMAGE=dist-powerpc-linux DEPLOY=1 - - env: IMAGE=dist-powerpc64-linux DEPLOY=1 - - 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 - - env: IMAGE=i686-gnu - - env: IMAGE=i686-gnu-nopt - # - env: IMAGE=wasm32 issue 42646 - - env: IMAGE=x86_64-gnu - - env: IMAGE=x86_64-gnu-full-bootstrap - - env: IMAGE=x86_64-gnu-aux - - env: IMAGE=x86_64-gnu-debug - - env: IMAGE=x86_64-gnu-nopt + # 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=x86_64-gnu-distcheck - - env: IMAGE=x86_64-gnu-incremental + - 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. # @@ -63,11 +48,6 @@ matrix: 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 @@ -78,7 +58,6 @@ matrix: 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. @@ -96,10 +75,6 @@ matrix: 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" @@ -110,30 +85,42 @@ matrix: 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 + # Linux builders, remaining docker images + - env: IMAGE=arm-android + - env: IMAGE=armhf-gnu + - env: IMAGE=cross DEPLOY=1 + - env: IMAGE=dist-aarch64-linux DEPLOY=1 + - env: IMAGE=dist-android DEPLOY=1 + - env: IMAGE=dist-arm-linux DEPLOY=1 + - env: IMAGE=dist-armhf-linux DEPLOY=1 + - env: IMAGE=dist-armv7-linux DEPLOY=1 + - env: IMAGE=dist-fuchsia DEPLOY=1 + - env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1 + - env: IMAGE=dist-i686-freebsd DEPLOY=1 + - env: IMAGE=dist-i686-linux DEPLOY=1 + - env: IMAGE=dist-mips-linux DEPLOY=1 + - env: IMAGE=dist-mips64-linux DEPLOY=1 + - env: IMAGE=dist-mips64el-linux DEPLOY=1 + - env: IMAGE=dist-mipsel-linux DEPLOY=1 + - env: IMAGE=dist-powerpc-linux DEPLOY=1 + - env: IMAGE=dist-powerpc64-linux DEPLOY=1 + - 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-musl DEPLOY=1 + - env: IMAGE=dist-x86_64-netbsd DEPLOY=1 + - env: IMAGE=asmjs + - env: IMAGE=i686-gnu + - env: IMAGE=i686-gnu-nopt + # - env: IMAGE=wasm32 issue 42646 + - env: IMAGE=x86_64-gnu + - env: IMAGE=x86_64-gnu-full-bootstrap + - env: IMAGE=x86_64-gnu-aux + - env: IMAGE=x86_64-gnu-debug + - env: IMAGE=x86_64-gnu-nopt + - env: IMAGE=x86_64-gnu-distcheck + - env: IMAGE=x86_64-gnu-incremental env: global: @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 370cf6c0b4386..04b6fea75a78a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/src/ci/docker/scripts/android-ndk.sh b/src/ci/docker/scripts/android-ndk.sh index 7fc2ebafea8c2..ec030496d393a 100644 --- a/src/ci/docker/scripts/android-ndk.sh +++ b/src/ci/docker/scripts/android-ndk.sh @@ -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 diff --git a/src/ci/docker/scripts/android-sdk.sh b/src/ci/docker/scripts/android-sdk.sh index 90257dc411ea8..d343aae9dfb68 100644 --- a/src/ci/docker/scripts/android-sdk.sh +++ b/src/ci/docker/scripts/android-sdk.sh @@ -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 } diff --git a/src/ci/docker/scripts/crosstool-ng.sh b/src/ci/docker/scripts/crosstool-ng.sh index 53ad0f8a2ebc5..79a5bc3bb4ac6 100644 --- a/src/ci/docker/scripts/crosstool-ng.sh +++ b/src/ci/docker/scripts/crosstool-ng.sh @@ -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) diff --git a/src/ci/docker/scripts/dumb-init.sh b/src/ci/docker/scripts/dumb-init.sh index 616288f572b11..42ecec6ba08dc 100644 --- a/src/ci/docker/scripts/dumb-init.sh +++ b/src/ci/docker/scripts/dumb-init.sh @@ -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 diff --git a/src/ci/docker/scripts/emscripten-wasm.sh b/src/ci/docker/scripts/emscripten-wasm.sh index 18792c139ba76..18499060a20f5 100644 --- a/src/ci/docker/scripts/emscripten-wasm.sh +++ b/src/ci/docker/scripts/emscripten-wasm.sh @@ -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 diff --git a/src/ci/docker/scripts/emscripten.sh b/src/ci/docker/scripts/emscripten.sh index 0a570f18bfe75..d32ed6b461d85 100644 --- a/src/ci/docker/scripts/emscripten.sh +++ b/src/ci/docker/scripts/emscripten.sh @@ -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 diff --git a/src/ci/docker/scripts/make3.sh b/src/ci/docker/scripts/make3.sh index a0b15cca1f146..ec6e046c96452 100644 --- a/src/ci/docker/scripts/make3.sh +++ b/src/ci/docker/scripts/make3.sh @@ -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 diff --git a/src/ci/docker/scripts/sccache.sh b/src/ci/docker/scripts/sccache.sh index 4e497a6c9ce94..98b0ed712c02a 100644 --- a/src/ci/docker/scripts/sccache.sh +++ b/src/ci/docker/scripts/sccache.sh @@ -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 diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 306136b21c84b..9e72238fbd463 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -973,7 +973,7 @@ impl From for Rc { /// 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. /// diff --git a/src/libcore/default.rs b/src/libcore/default.rs index 244df1a9966d4..ab36e29b1e1d4 100644 --- a/src/libcore/default.rs +++ b/src/libcore/default.rs @@ -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] diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 750e86114c4bb..193c8b9f925fb 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -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; diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 9bacfee055385..0135cd0a588cf 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -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; diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 5236048ade43f..d73d7cd2c7bd1 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -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; diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 88994b284c90d..38d3312b4e7dd 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -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] diff --git a/src/libstd/sys/redox/net/tcp.rs b/src/libstd/sys/redox/net/tcp.rs index 98ec3aa3e2959..319965ab3965e 100644 --- a/src/libstd/sys/redox/net/tcp.rs +++ b/src/libstd/sys/redox/net/tcp.rs @@ -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 { @@ -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)> { diff --git a/src/libstd/sys/redox/net/udp.rs b/src/libstd/sys/redox/net/udp.rs index 93ebcc95fd0f8..7e7666e7ef364 100644 --- a/src/libstd/sys/redox/net/udp.rs +++ b/src/libstd/sys/redox/net/udp.rs @@ -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 { diff --git a/src/libstd/sys/redox/os.rs b/src/libstd/sys/redox/os.rs index e38b7b29f4837..efddd5f029484 100644 --- a/src/libstd/sys/redox/os.rs +++ b/src/libstd/sys/redox/os.rs @@ -73,10 +73,10 @@ pub fn split_paths(unparsed: &OsStr) -> SplitPaths { fn bytes_to_path(b: &[u8]) -> PathBuf { PathBuf::from(::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(paths: I) -> Result where I: Iterator, T: AsRef { let mut joined = Vec::new(); - let sep = b':'; + let sep = b';'; for (i, path) in paths.enumerate() { let path = path.as_ref().as_bytes(); diff --git a/src/libstd/sys/redox/process.rs b/src/libstd/sys/redox/process.rs index 62d873d257d8f..ff1626d9b31c1 100644 --- a/src/libstd/sys/redox/process.rs +++ b/src/libstd/sys/redox/process.rs @@ -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)) } } diff --git a/src/libstd/sys/redox/syscall/call.rs b/src/libstd/sys/redox/syscall/call.rs index fadf7325d7575..ec9005c2cc3be 100644 --- a/src/libstd/sys/redox/syscall/call.rs +++ b/src/libstd/sys/redox/syscall/call.rs @@ -77,9 +77,9 @@ pub fn dup2(fd: usize, newfd: usize, buf: &[u8]) -> Result { } /// Replace the current process with a new executable -pub fn execve(path: &str, args: &[[usize; 2]]) -> Result { - unsafe { syscall4(SYS_EXECVE, path.as_ptr() as usize, path.len(), - args.as_ptr() as usize, args.len()) } +pub fn execve>(path: T, args: &[[usize; 2]]) -> Result { + 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 diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 55766ba3fed6a..48819adb23e2e 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -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] diff --git a/src/test/codegen/stack-probes.rs b/src/test/codegen/stack-probes.rs index b7c794f4475a8..7dc9030ea055b 100644 --- a/src/test/codegen/stack-probes.rs +++ b/src/test/codegen/stack-probes.rs @@ -9,6 +9,7 @@ // except according to those terms. // ignore-arm +// ignore-powerpc // ignore-wasm // ignore-emscripten // ignore-windows