]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #43270 - petrochenkov:fixstab, r=alexcrichton
authorbors <bors@rust-lang.org>
Thu, 20 Jul 2017 09:01:58 +0000 (09:01 +0000)
committerbors <bors@rust-lang.org>
Thu, 20 Jul 2017 09:01:58 +0000 (09:01 +0000)
Fix checking for missing stability annotations

This was a regression from https://github.com/rust-lang/rust/pull/37676 causing "unmarked API" ICEs like https://github.com/rust-lang/rust/issues/43027.

r? @alexcrichton

164 files changed:
.travis.yml
CONTRIBUTING.md
appveyor.yml
src/Cargo.lock
src/Cargo.toml
src/bootstrap/bin/rustc.rs
src/bootstrap/check.rs
src/bootstrap/mk/Makefile.in
src/bootstrap/step.rs
src/ci/docker/scripts/android-ndk.sh
src/ci/docker/scripts/android-sdk.sh
src/ci/docker/scripts/crosstool-ng.sh
src/ci/docker/scripts/dumb-init.sh
src/ci/docker/scripts/emscripten-wasm.sh
src/ci/docker/scripts/emscripten.sh
src/ci/docker/scripts/make3.sh
src/ci/docker/scripts/sccache.sh
src/liballoc/rc.rs
src/libcore/default.rs
src/libcore/fmt/mod.rs
src/libcore/mem.rs
src/librustc/ich/impls_ty.rs
src/librustc/lint/builtin.rs
src/librustc/middle/const_val.rs
src/librustc/middle/dependency_format.rs
src/librustc/session/config.rs
src/librustc/ty/mod.rs
src/librustc_back/lib.rs
src/librustc_back/target/bitrig_base.rs
src/librustc_back/target/dragonfly_base.rs
src/librustc_back/target/freebsd_base.rs
src/librustc_back/target/haiku_base.rs
src/librustc_back/target/linux_base.rs
src/librustc_back/target/mod.rs
src/librustc_back/target/netbsd_base.rs
src/librustc_back/target/openbsd_base.rs
src/librustc_back/target/powerpc64_unknown_linux_gnu.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_const_eval/_match.rs
src/librustc_const_eval/eval.rs
src/librustc_errors/diagnostic.rs
src/librustc_errors/emitter.rs
src/librustc_lint/lib.rs
src/librustc_metadata/creader.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_passes/ast_validation.rs
src/librustc_passes/consts.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/librustc_trans/back/link.rs
src/librustc_trans/back/linker.rs
src/librustc_trans/mir/constant.rs
src/librustc_typeck/check/cast.rs
src/librustc_typeck/check/demand.rs
src/librustc_typeck/check/method/confirm.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/op.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/diagnostics.rs
src/libstd/f32.rs
src/libstd/f64.rs
src/libstd/fs.rs
src/libstd/lib.rs
src/libstd/sys/redox/net/tcp.rs
src/libstd/sys/redox/net/udp.rs
src/libstd/sys/redox/os.rs
src/libstd/sys/redox/process.rs
src/libstd/sys/redox/syscall/call.rs
src/libstd/time/duration.rs
src/libsyntax/parse/classify.rs
src/libsyntax/parse/parser.rs
src/test/codegen/stack-probes.rs
src/test/compile-fail-fulldeps/proc-macro/resolve-error.rs [deleted file]
src/test/compile-fail/E0035.rs [deleted file]
src/test/compile-fail/E0036.rs [deleted file]
src/test/compile-fail/E0088.rs
src/test/compile-fail/cast-to-unsized-trait-object-suggestion.rs [deleted file]
src/test/compile-fail/const-size_of-cycle.rs [new file with mode: 0644]
src/test/compile-fail/constructor-lifetime-args.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-bench.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-deprecated.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-derive-2.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-derive.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-inline.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_escape.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_use.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-proc_macro_derive.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-test.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs [new file with mode: 0644]
src/test/compile-fail/issue-35675.rs
src/test/compile-fail/macro-name-typo.rs [deleted file]
src/test/compile-fail/macro_undefined.rs [deleted file]
src/test/compile-fail/method-call-lifetime-args-lint.rs [new file with mode: 0644]
src/test/compile-fail/method-call-lifetime-args-subst-index.rs [new file with mode: 0644]
src/test/compile-fail/method-call-lifetime-args-unresolved.rs [new file with mode: 0644]
src/test/compile-fail/method-call-lifetime-args.rs [new file with mode: 0644]
src/test/compile-fail/method-call-type-binding.rs
src/test/compile-fail/trait-test-2.rs
src/test/incremental/hashes/inherent_impls.rs
src/test/incremental/hashes/trait_defs.rs
src/test/run-make/sanitizer-address/overflow.rs
src/test/run-make/sanitizer-cdylib-link/Makefile [new file with mode: 0644]
src/test/run-make/sanitizer-cdylib-link/library.rs [new file with mode: 0644]
src/test/run-make/sanitizer-cdylib-link/program.rs [new file with mode: 0644]
src/test/run-make/sanitizer-dylib-link/Makefile [new file with mode: 0644]
src/test/run-make/sanitizer-dylib-link/library.rs [new file with mode: 0644]
src/test/run-make/sanitizer-dylib-link/program.rs [new file with mode: 0644]
src/test/run-make/sanitizer-dylib/Makefile [deleted file]
src/test/run-make/sanitizer-dylib/hello.rs [deleted file]
src/test/run-make/sanitizer-invalid-cratetype/Makefile [new file with mode: 0644]
src/test/run-make/sanitizer-invalid-cratetype/hello.rs [new file with mode: 0644]
src/test/run-make/sanitizer-staticlib-link/Makefile [new file with mode: 0644]
src/test/run-make/sanitizer-staticlib-link/library.rs [new file with mode: 0644]
src/test/run-make/sanitizer-staticlib-link/program.c [new file with mode: 0644]
src/test/run-pass/catch-expr.rs
src/test/run-pass/const-size_of-align_of.rs [new file with mode: 0644]
src/test/run-pass/optional_comma_in_match_arm.rs [new file with mode: 0644]
src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs [new file with mode: 0644]
src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs [new file with mode: 0644]
src/test/ui-fulldeps/auxiliary/derive-clona.rs [new file with mode: 0644]
src/test/ui-fulldeps/auxiliary/derive-foo.rs [new file with mode: 0644]
src/test/ui-fulldeps/resolve-error.rs [new file with mode: 0644]
src/test/ui-fulldeps/resolve-error.stderr [new file with mode: 0644]
src/test/ui/cast-to-unsized-trait-object-suggestion.rs [new file with mode: 0644]
src/test/ui/cast-to-unsized-trait-object-suggestion.stderr [new file with mode: 0644]
src/test/ui/check_match/issue-43253.rs [new file with mode: 0644]
src/test/ui/check_match/issue-43253.stderr [new file with mode: 0644]
src/test/ui/did_you_mean/issue-31424.stderr
src/test/ui/did_you_mean/issue-34126.stderr
src/test/ui/did_you_mean/issue-34337.stderr
src/test/ui/did_you_mean/issue-37139.stderr
src/test/ui/did_you_mean/issue-42764.rs [new file with mode: 0644]
src/test/ui/did_you_mean/issue-42764.stderr [new file with mode: 0644]
src/test/ui/issue-35675.rs [new file with mode: 0644]
src/test/ui/issue-35675.stderr [new file with mode: 0644]
src/test/ui/issue-40402-ref-hints/issue-40402-1.stderr
src/test/ui/macros/macro-name-typo.rs [new file with mode: 0644]
src/test/ui/macros/macro-name-typo.stderr [new file with mode: 0644]
src/test/ui/macros/macro_undefined.rs [new file with mode: 0644]
src/test/ui/macros/macro_undefined.stderr [new file with mode: 0644]
src/test/ui/mismatched_types/E0281.stderr
src/test/ui/mismatched_types/closure-mismatch.stderr
src/test/ui/mismatched_types/issue-19109.stderr
src/test/ui/mismatched_types/issue-36053-2.stderr
src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr
src/test/ui/resolve-error.stderr [new file with mode: 0644]
src/test/ui/resolve/issue-14254.stderr
src/test/ui/resolve/issue-2356.stderr
src/test/ui/resolve/issue-5035.stderr
src/test/ui/resolve/privacy-struct-ctor.stderr
src/test/ui/resolve/resolve-assoc-suggestions.stderr
src/test/ui/resolve/resolve-speculative-adjustment.stderr
src/test/ui/resolve/token-error-correct-3.stderr
src/test/ui/resolve/unresolved_static_type_field.stderr
src/test/ui/span/issue-39018.stderr
src/test/ui/span/suggestion-non-ascii.stderr
src/test/ui/suggestions/tuple-float-index.stderr
src/test/ui/type-check/assignment-in-if.stderr
src/tools/rls
src/tools/tidy/src/deps.rs
src/tools/tidy/src/features.rs

index d351bea477722fd8f4f2ea9dc8b8da74aab4e9e5..d315546930330d4de16c24ba50a802f0652e3a9f 100644 (file)
@@ -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 -o /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 -o /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,51 +129,74 @@ env:
     # AWS_SECRET_ACCESS_KEY=...
     - secure: "Pixhh0hXDqGCdOyLtGFjli3J2AtDWIpyb2btIrLe956nCBDRutRoMm6rv5DI9sFZN07Mms7VzNNvhc9wCW1y63JAm414d2Co7Ob8kWMZlz9l9t7ACHuktUiis8yr+S4Quq1Vqd6pqi7pf2J++UxC8R/uLeqVrubzr6+X7AbmEFE="
 
-# Note that this is overridden on OSX builders
-install: >
-  travis_retry curl -o $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
 # clock drift. Timezones don't matter since relative deltas give all the necessary info.
 script:
   - >
-      date && curl -s --head https://google.com | grep ^Date: | sed 's/Date: //g'
+      date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
   - stamp sh -x -c "$RUN_SCRIPT"
   - >
-      date && curl -s --head https://google.com | grep ^Date: | sed 's/Date: //g'
+      date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
 
 after_success:
   - >
@@ -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
index 370cf6c0b43867b4b14971c551a6837cde254b73..04b6fea75a78a87d962e33aa961635832fd7a404 100644 (file)
@@ -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
index 582ca5d0f9de3b545118aacf62188ec659f673c7..aaede7236a97be1dbab8609a16b6dddf8df3c1b3 100644 (file)
@@ -4,6 +4,12 @@ environment:
   AWS_SECRET_ACCESS_KEY:
     secure: 1UkmbiDd15tWtYbMm5O2Uqm0b0Ur8v1MoSlydxl4ojcroPeerRMlUges0l57py8c
   SCCACHE_DIGEST: f808afabb4a4eb1d7112bcb3fa6be03b61e93412890c88e177c667eb37f46353d7ec294e559b16f9f4b5e894f2185fe7670a0df15fd064889ecbd80f0c34166c
+
+  # By default schannel checks revocation of certificates unlike some other SSL
+  # backends, but we've historically had problems on CI where a revocation
+  # server goes down presumably. See #43333 for more info
+  CARGO_HTTP_CHECK_REVOKE: false
+
   matrix:
   # 32/64 bit MSVC tests
   - MSYS_BITS: 64
index dae1aea34186445c1752a847da154b008e70eb4f..3c8d1164863deb7b74abd4cbdfbd47060c219035 100644 (file)
@@ -102,6 +102,14 @@ dependencies = [
  "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "bin_lib"
+version = "0.1.0"
+
+[[package]]
+name = "bin_lib_no_cfg_test"
+version = "0.1.0"
+
 [[package]]
 name = "bitflags"
 version = "0.7.0"
@@ -132,6 +140,10 @@ dependencies = [
  "toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "borrow_error"
+version = "0.1.0"
+
 [[package]]
 name = "bufstream"
 version = "0.1.3"
@@ -155,7 +167,7 @@ dependencies = [
 [[package]]
 name = "cargo"
 version = "0.21.0"
-source = "git+https://github.com/rust-lang/cargo#1566c92b5d28e435613918e59dc94755f99d73b1"
+source = "git+https://github.com/rust-lang/cargo#5982cf904be1d72f575dcbd1e750c07bf730b966"
 replace = "cargo 0.21.0"
 
 [[package]]
@@ -191,8 +203,8 @@ dependencies = [
  "psapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "semver 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_ignored 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "shell-escape 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -218,7 +230,7 @@ dependencies = [
  "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "tar 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
  "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -289,6 +301,10 @@ dependencies = [
  "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "completion"
+version = "0.1.0"
+
 [[package]]
 name = "core"
 version = "0.0.0"
@@ -302,8 +318,8 @@ version = "0.10.0"
 dependencies = [
  "curl 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -370,8 +386,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -426,6 +442,14 @@ dependencies = [
  "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "find_all_refs"
+version = "0.1.0"
+
+[[package]]
+name = "find_all_refs_no_cfg_test"
+version = "0.1.0"
+
 [[package]]
 name = "flate2"
 version = "0.2.19"
@@ -493,6 +517,10 @@ name = "glob"
 version = "0.2.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
+[[package]]
+name = "goto_def"
+version = "0.1.0"
+
 [[package]]
 name = "graphviz"
 version = "0.0.0"
@@ -516,7 +544,7 @@ dependencies = [
  "pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "quick-error 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -525,6 +553,14 @@ name = "hex"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
+[[package]]
+name = "highlight"
+version = "0.1.0"
+
+[[package]]
+name = "hover"
+version = "0.1.0"
+
 [[package]]
 name = "idna"
 version = "0.1.2"
@@ -579,8 +615,8 @@ version = "0.11.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -677,7 +713,7 @@ dependencies = [
  "open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "pulldown-cmark 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -718,6 +754,10 @@ dependencies = [
  "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "multiple_bins"
+version = "0.1.0"
+
 [[package]]
 name = "net2"
 version = "0.2.29"
@@ -957,6 +997,14 @@ dependencies = [
  "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "reformat"
+version = "0.1.0"
+
+[[package]]
+name = "reformat_with_range"
+version = "0.1.0"
+
 [[package]]
 name = "regex"
 version = "0.1.80"
@@ -999,6 +1047,10 @@ version = "0.1.0"
 name = "remote-test-server"
 version = "0.1.0"
 
+[[package]]
+name = "rename"
+version = "0.1.0"
+
 [[package]]
 name = "rls"
 version = "0.1.0"
@@ -1009,13 +1061,13 @@ dependencies = [
  "languageserver-types 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "racer 2.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "rls-analysis 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rls-analysis 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-data 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-vfs 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustfmt-nightly 0.1.8 (git+https://github.com/rust-lang-nursery/rustfmt?branch=rustfmt-42492)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustfmt-nightly 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1024,7 +1076,7 @@ dependencies = [
 
 [[package]]
 name = "rls-analysis"
-version = "0.4.2"
+version = "0.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "derive-new 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1049,8 +1101,8 @@ version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1463,8 +1515,8 @@ dependencies = [
 
 [[package]]
 name = "rustfmt-nightly"
-version = "0.1.8"
-source = "git+https://github.com/rust-lang-nursery/rustfmt?branch=rustfmt-42492#7333dfc95b4af5c7283ba03f33c50f108d2be3f5"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "diff 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1473,8 +1525,8 @@ dependencies = [
  "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "strings 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1503,7 +1555,7 @@ version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1513,12 +1565,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "serde"
-version = "1.0.9"
+version = "1.0.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "serde_derive"
-version = "1.0.9"
+version = "1.0.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1540,7 +1592,7 @@ name = "serde_ignored"
 version = "0.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1551,7 +1603,7 @@ dependencies = [
  "dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1837,7 +1889,7 @@ name = "toml"
 version = "0.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1908,7 +1960,7 @@ name = "url_serde"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -2082,19 +2134,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b"
 "checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957"
 "checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db"
-"checksum rls-analysis 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "34c9957e6a7e336978f9262dff7552f80b6c8588483f221a8e63f5b436010862"
+"checksum rls-analysis 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ea940411ed2ad6d1e705fc2a0b146a0a3f30f8098ba4e61b45b4e5f2bfa7ed63"
 "checksum rls-data 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e502ac679bc35e023e982506c32d0278ef89e29af1e4ad21cb70c44b525b87a9"
 "checksum rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d7c7046dc6a92f2ae02ed302746db4382e75131b9ce20ce967259f6b5867a6a"
 "checksum rls-vfs 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ffd34691a510938bb67fe0444fb363103c73ffb31c121d1e16bc92d8945ea8ff"
 "checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95"
 "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
-"checksum rustfmt-nightly 0.1.8 (git+https://github.com/rust-lang-nursery/rustfmt?branch=rustfmt-42492)" = "<none>"
+"checksum rustfmt-nightly 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6693f90ac7d0a2291aa309f5214f5f3ac1bd79961c11116fcf6d5545749bf2e7"
 "checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"
 "checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
 "checksum semver 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fdd61b85a0fa777f7fb7c454b9189b2941b110d1385ce84d7f76efdf1606a85"
 "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-"checksum serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6a7c6b751a2e8d5df57a5ff71b5b4fc8aaee9ee28ff1341d640dd130bb5f4f7a"
-"checksum serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "2f6ca58905ebd3c3b285a8a6d4f3ac92b92c0d7951d5649b1bdd212549c06639"
+"checksum serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "433d7d9f8530d5a939ad5e0e72a6243d2e42a24804f70bf592c679363dcacb2f"
+"checksum serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7b707cf0d4cab852084f573058def08879bb467fda89d99052485e7d00edd624"
 "checksum serde_derive_internals 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37aee4e0da52d801acfbc0cc219eb1eda7142112339726e427926a6f6ee65d3a"
 "checksum serde_ignored 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c10e798e4405d7dcec3658989e35ee6706f730a9ed7c1184d5ebd84317e82f46"
 "checksum serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "48b04779552e92037212c3615370f6bd57a40ebba7f20e554ff9f55e41a69a7b"
index 9cf6297d463be27873c95629368db651dba8e72d..f027965e791bef9bb70ae7589dedf347b2c3bd9d 100644 (file)
@@ -17,6 +17,20 @@ members = [
   "tools/rust-installer",
   "tools/cargo",
   "tools/rls",
+  # FIXME(https://github.com/rust-lang/cargo/issues/4089): move these to exclude
+  "tools/rls/test_data/borrow_error",
+  "tools/rls/test_data/completion",
+  "tools/rls/test_data/find_all_refs",
+  "tools/rls/test_data/find_all_refs_no_cfg_test",
+  "tools/rls/test_data/goto_def",
+  "tools/rls/test_data/highlight",
+  "tools/rls/test_data/hover",
+  "tools/rls/test_data/rename",
+  "tools/rls/test_data/reformat",
+  "tools/rls/test_data/bin_lib_no_cfg_test",
+  "tools/rls/test_data/multiple_bins",
+  "tools/rls/test_data/bin_lib",
+  "tools/rls/test_data/reformat_with_range",
 ]
 
 # Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit
index 497a5ab6c536caef5e8fb8ba7e0fbb2afda85b65..134406b1acdb38dd78eaa4ead2f0e245985d774c 100644 (file)
@@ -150,7 +150,12 @@ fn main() {
         // This... is a bit of a hack how we detect this. Ideally this
         // information should be encoded in the crate I guess? Would likely
         // require an RFC amendment to RFC 1513, however.
-        if crate_name == "panic_abort" {
+        //
+        // `compiler_builtins` are unconditionally compiled with panic=abort to
+        // workaround undefined references to `rust_eh_unwind_resume` generated
+        // otherwise, see issue https://github.com/rust-lang/rust/issues/43095.
+        if crate_name == "panic_abort" ||
+           crate_name == "compiler_builtins" && stage != "0" {
             cmd.arg("-C").arg("panic=abort");
         }
 
index 371512908a03191fd9bba477d789f7b9f91fbefc..e4b0e2fb9ca0cdb8bffc23d81fd60abc590382e3 100644 (file)
@@ -15,6 +15,7 @@
 
 use std::collections::HashSet;
 use std::env;
+use std::ffi::OsString;
 use std::iter;
 use std::fmt;
 use std::fs::{self, File};
@@ -117,14 +118,7 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
 
 /// Runs `cargo test` for `cargo` packaged with Rust.
 pub fn cargo(build: &Build, stage: u32, host: &str) {
-    let ref compiler = Compiler::new(stage, host);
-
-    // Configure PATH to find the right rustc. NB. we have to use PATH
-    // and not RUSTC because the Cargo test suite has tests that will
-    // fail if rustc is not spelled `rustc`.
-    let path = build.sysroot(compiler).join("bin");
-    let old_path = env::var_os("PATH").unwrap_or_default();
-    let newpath = env::join_paths(iter::once(path).chain(env::split_paths(&old_path))).expect("");
+    let compiler = &Compiler::new(stage, host);
 
     let mut cargo = build.cargo(compiler, Mode::Tool, host, "test");
     cargo.arg("--manifest-path").arg(build.src.join("src/tools/cargo/Cargo.toml"));
@@ -139,7 +133,31 @@ pub fn cargo(build: &Build, stage: u32, host: &str) {
     // available.
     cargo.env("CFG_DISABLE_CROSS_TESTS", "1");
 
-    try_run(build, cargo.env("PATH", newpath));
+    try_run(build, cargo.env("PATH", &path_for_cargo(build, compiler)));
+}
+
+/// Runs `cargo test` for the rls.
+pub fn rls(build: &Build, stage: u32, host: &str) {
+    let compiler = &Compiler::new(stage, host);
+
+    let mut cargo = build.cargo(compiler, Mode::Tool, host, "test");
+    cargo.arg("--manifest-path").arg(build.src.join("src/tools/rls/Cargo.toml"));
+
+    // Don't build tests dynamically, just a pain to work with
+    cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
+
+    build.add_rustc_lib_path(compiler, &mut cargo);
+
+    try_run(build, &mut cargo);
+}
+
+fn path_for_cargo(build: &Build, compiler: &Compiler) -> OsString {
+    // Configure PATH to find the right rustc. NB. we have to use PATH
+    // and not RUSTC because the Cargo test suite has tests that will
+    // fail if rustc is not spelled `rustc`.
+    let path = build.sysroot(compiler).join("bin");
+    let old_path = env::var_os("PATH").unwrap_or_default();
+    env::join_paths(iter::once(path).chain(env::split_paths(&old_path))).expect("")
 }
 
 /// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.
index 47c792a510b1b265e1cf9225c8420b400df3898d..ad0ee8d47d64351d8d833f004246aed77173d87b 100644 (file)
@@ -55,7 +55,8 @@ check:
 check-aux:
        $(Q)$(BOOTSTRAP) test \
                src/tools/cargotest \
-               cargo \
+               src/tools/cargo \
+               src/tools/rls \
                src/test/pretty \
                src/test/run-pass/pretty \
                src/test/run-fail/pretty \
index 5a1ef818ccfc9357efb9830f2cefe32ccf031d5c..a1b26f44b7de132317834581a4fdddf1eaf05188 100644 (file)
@@ -472,10 +472,14 @@ fn crate_rule<'a, 'b>(build: &'a Build,
          .dep(|s| s.name("librustc"))
          .host(true)
          .run(move |s| check::cargotest(build, s.stage, s.target));
-    rules.test("check-cargo", "cargo")
+    rules.test("check-cargo", "src/tools/cargo")
          .dep(|s| s.name("tool-cargo"))
          .host(true)
          .run(move |s| check::cargo(build, s.stage, s.target));
+    rules.test("check-rls", "src/tools/rls")
+         .dep(|s| s.name("tool-rls"))
+         .host(true)
+         .run(move |s| check::rls(build, s.stage, s.target));
     rules.test("check-tidy", "src/tools/tidy")
          .dep(|s| s.name("tool-tidy").stage(0))
          .default(true)
index c3d83c087e52fee5a5ccec4206a6e936656d99f1..ec030496d393a4fb5f8285cc02feec096f8df32a 100644 (file)
@@ -15,7 +15,7 @@ URL=https://dl.google.com/android/repository
 download_ndk() {
     mkdir -p /android/ndk
     cd /android/ndk
-    curl -O $URL/$1
+    curl -fO $URL/$1
     unzip -q $1
     rm $1
     mv android-ndk-* ndk
index 7d8110efedec936d2ac49c8813c0b445193f21d7..d343aae9dfb6839e85a4de88e1cc9dd3a31dee70 100644 (file)
@@ -15,7 +15,7 @@ URL=https://dl.google.com/android/repository
 download_sdk() {
     mkdir -p /android/sdk
     cd /android/sdk
-    curl -O $URL/$1
+    curl -fO $URL/$1
     unzip -q $1
     rm -rf $1
 }
index 8b2747cf213098bcdbe70b17a9fde95405487aff..79a5bc3bb4ac620c8b0f30c304a686e7822ed0a5 100644 (file)
@@ -11,7 +11,7 @@
 set -ex
 
 url="http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2"
-curl $url | tar xjf -
+curl -f $url | tar xjf -
 cd crosstool-ng
 ./configure --prefix=/usr/local
 make -j$(nproc)
index 839c390799278c98ef227d6c63b2f440e2cb421e..42ecec6ba08dc6cd83c3ceb2ed4789ccb5defe4b 100644 (file)
@@ -10,6 +10,6 @@
 
 set -ex
 
-curl -OL 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
index 0e7da45907fcc61059844e18f3a9d22df92b70f3..18499060a20f5fd9cec1fb6c7b434c4eb21ee9d0 100644 (file)
@@ -28,14 +28,14 @@ exit 1
 }
 
 # Download last known good emscripten from WebAssembly waterfall
-BUILD=$(curl -L 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 -L https://storage.googleapis.com/wasm-llvm/builds/linux/$BUILD/wasm-binaries.tbz2 | \
+curl -sL https://storage.googleapis.com/wasm-llvm/builds/linux/$BUILD/wasm-binaries.tbz2 | \
     hide_output tar xvkj
 
 # node 8 is required to run wasm
 cd /
-curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
+curl -sL https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
     tar -xJ
 
 # Make emscripten use wasm-ready node and LLVM tools
index cf5eecbdb6c8c1e94a38789718d0894d2ff7eb01..d32ed6b461d858394775710d657f2cbe26bbfff4 100644 (file)
@@ -28,7 +28,7 @@ exit 1
 }
 
 cd /
-curl -L 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
@@ -49,5 +49,5 @@ chmod a+rxw -R /emsdk-portable
 
 # node 8 is required to run wasm
 cd /
-curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
+curl -sL https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
   tar -xJ
index 8a7845cb8f384bd82aeddb5d53723e45c6bf65fd..ec6e046c96452e3ec25499850643febe6fac97b5 100644 (file)
@@ -10,7 +10,7 @@
 
 set -ex
 
-curl 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
index 7a2befaf6715ff692a9c7d49409a6294c030d49a..98b0ed712c02a214736fffd9c0f980f1e7328d31 100644 (file)
@@ -10,7 +10,7 @@
 
 set -ex
 
-curl -o /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
index 306136b21c84b2cb6013be9e4ccbe044c4923fb3..9e72238fbd463f0f1dfdcae2e42ea5ef5d4c9ce1 100644 (file)
@@ -973,7 +973,7 @@ fn from(t: T) -> Self {
 /// 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.
 ///
index 244df1a9966d4c884265965a57d275d32e651a1b..ab36e29b1e1d4238cc4778754e605e0178c92d40 100644 (file)
@@ -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]
index 750e86114c4bb057446f1024dcaff0a22d7b066d..193c8b9f925fbf0011f00e73860d6c0636b14291 100644 (file)
@@ -81,6 +81,22 @@ pub mod rt {
 /// 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;
index 6c1e8e8960f7549f4b2f50f23e59714ae18375e3..86e5afa4c337f32186c5641d636fa7ffee1b37ac 100644 (file)
@@ -188,10 +188,30 @@ pub fn forget<T>(t: T) {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg(stage0)]
 pub fn size_of<T>() -> usize {
     unsafe { intrinsics::size_of::<T>() }
 }
 
+/// Returns the size of a type in bytes.
+///
+/// More specifically, this is the offset in bytes between successive
+/// items of the same type, including alignment padding.
+///
+/// # Examples
+///
+/// ```
+/// use std::mem;
+///
+/// assert_eq!(4, mem::size_of::<i32>());
+/// ```
+#[inline]
+#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg(not(stage0))]
+pub const fn size_of<T>() -> usize {
+    unsafe { intrinsics::size_of::<T>() }
+}
+
 /// Returns the size of the pointed-to value in bytes.
 ///
 /// This is usually the same as `size_of::<T>()`. However, when `T` *has* no
@@ -279,10 +299,33 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg(stage0)]
 pub fn align_of<T>() -> usize {
     unsafe { intrinsics::min_align_of::<T>() }
 }
 
+/// Returns the [ABI]-required minimum alignment of a type.
+///
+/// Every reference to a value of the type `T` must be a multiple of this number.
+///
+/// This is the alignment used for struct fields. It may be smaller than the preferred alignment.
+///
+/// [ABI]: https://en.wikipedia.org/wiki/Application_binary_interface
+///
+/// # Examples
+///
+/// ```
+/// use std::mem;
+///
+/// assert_eq!(4, mem::align_of::<i32>());
+/// ```
+#[inline]
+#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg(not(stage0))]
+pub const fn align_of<T>() -> usize {
+    unsafe { intrinsics::min_align_of::<T>() }
+}
+
 /// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to.
 ///
 /// Every reference to a value of the type `T` must be a multiple of this number.
index a1dd2caf786c207951ab26e97024d7e13734be44..3e227872848efb36efcd10ac1cde8ef167f5787e 100644 (file)
@@ -346,6 +346,7 @@ fn hash_stable<W: StableHasherResult>(&self,
             // `def_id.index` (`def_id.krate` is the same as the item's).
             type_param_to_index: _, // Don't hash this
             has_self,
+            has_late_bound_regions,
         } = *self;
 
         parent.hash_stable(hcx, hasher);
@@ -354,6 +355,7 @@ fn hash_stable<W: StableHasherResult>(&self,
         regions.hash_stable(hcx, hasher);
         types.hash_stable(hcx, hasher);
         has_self.hash_stable(hcx, hasher);
+        has_late_bound_regions.hash_stable(hcx, hasher);
     }
 }
 
index 2d088c4f6d1727729aaccd4d065e33b28669f985..cbe642a9a76a65b3afca29288f97de502778745e 100644 (file)
     "detects parenthesized generic parameters in type and module names"
 }
 
+declare_lint! {
+    pub LATE_BOUND_LIFETIME_ARGUMENTS,
+    Warn,
+    "detects generic lifetime arguments in path segments with late bound lifetime parameters"
+}
+
 declare_lint! {
     pub DEPRECATED,
     Warn,
@@ -249,6 +255,7 @@ fn get_lints(&self) -> LintArray {
             LEGACY_CONSTRUCTOR_VISIBILITY,
             MISSING_FRAGMENT_SPECIFIER,
             PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
+            LATE_BOUND_LIFETIME_ARGUMENTS,
             DEPRECATED
         )
     }
index 3bbaf5c9299f8945e301378c874a15cd57473c52..2637afdea5bcf17b5d893217ea9104207e3e7a95 100644 (file)
@@ -14,7 +14,7 @@
 use hir;
 use hir::def::Def;
 use hir::def_id::DefId;
-use ty::TyCtxt;
+use ty::{TyCtxt, layout};
 use ty::subst::Substs;
 use util::common::ErrorReported;
 use rustc_const_math::*;
@@ -101,6 +101,7 @@ pub enum ErrKind<'tcx> {
 
     IndexOpFeatureGated,
     Math(ConstMathErr),
+    LayoutError(layout::LayoutError<'tcx>),
 
     ErroneousReferencedConstant(Box<ConstEvalErr<'tcx>>),
 
@@ -164,6 +165,7 @@ macro_rules! simple {
             MiscCatchAll => simple!("unsupported constant expr"),
             IndexOpFeatureGated => simple!("the index operation on const values is unstable"),
             Math(ref err) => Simple(err.description().into_cow()),
+            LayoutError(ref err) => Simple(err.to_string().into_cow()),
 
             ErroneousReferencedConstant(_) => simple!("could not evaluate referenced constant"),
 
index 9af93d0d494244591cac86d942c6e59327e35537..837ab4fd4a3ccf7a64f8f71b581f10c072f688fb 100644 (file)
@@ -396,7 +396,8 @@ fn verify_ok<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, list: &[Linkage]) {
             }
             let cnum = CrateNum::new(i + 1);
             let found_strategy = sess.cstore.panic_strategy(cnum);
-            if desired_strategy == found_strategy {
+            let is_compiler_builtins = sess.cstore.is_compiler_builtins(cnum);
+            if is_compiler_builtins || desired_strategy == found_strategy {
                 continue
             }
 
index 4b41572c1a1049d3353553331e09cd49eb6c554f..2a790d0f61e923851ef8c947506cc16be0e2b403 100644 (file)
@@ -19,7 +19,7 @@
 use session::{early_error, early_warn, Session};
 use session::search_paths::SearchPaths;
 
-use rustc_back::{LinkerFlavor, PanicStrategy};
+use rustc_back::{LinkerFlavor, PanicStrategy, RelroLevel};
 use rustc_back::target::Target;
 use lint;
 use middle::cstore;
@@ -654,6 +654,8 @@ mod $mod_desc {
             Some("a number");
         pub const parse_panic_strategy: Option<&'static str> =
             Some("either `panic` or `abort`");
+        pub const parse_relro_level: Option<&'static str> =
+            Some("one of: `full`, `partial`, or `off`");
         pub const parse_sanitizer: Option<&'static str> =
             Some("one of: `address`, `leak`, `memory` or `thread`");
         pub const parse_linker_flavor: Option<&'static str> =
@@ -665,7 +667,7 @@ mod $mod_desc {
     #[allow(dead_code)]
     mod $mod_set {
         use super::{$struct_name, Passes, SomePasses, AllPasses, Sanitizer};
-        use rustc_back::{LinkerFlavor, PanicStrategy};
+        use rustc_back::{LinkerFlavor, PanicStrategy, RelroLevel};
 
         $(
             pub fn $opt(cg: &mut $struct_name, v: Option<&str>) -> bool {
@@ -786,6 +788,19 @@ fn parse_panic_strategy(slot: &mut Option<PanicStrategy>, v: Option<&str>) -> bo
             true
         }
 
+        fn parse_relro_level(slot: &mut Option<RelroLevel>, v: Option<&str>) -> bool {
+            match v {
+                Some(s) => {
+                    match s.parse::<RelroLevel>() {
+                        Ok(level) => *slot = Some(level),
+                        _ => return false
+                    }
+                },
+                _ => return false
+            }
+            true
+        }
+
         fn parse_sanitizer(slote: &mut Option<Sanitizer>, v: Option<&str>) -> bool {
             match v {
                 Some("address") => *slote = Some(Sanitizer::Address),
@@ -1043,6 +1058,8 @@ fn parse_optimization_fuel(slot: &mut Option<(String, u64)>, v: Option<&str>) ->
         "extra arguments to prepend to the linker invocation (space separated)"),
     profile: bool = (false, parse_bool, [TRACKED],
                      "insert profiling code"),
+    relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
+        "choose which RELRO level to use"),
 }
 
 pub fn default_lib_output() -> CrateType {
@@ -1598,8 +1615,15 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
             "target-features" => PrintRequest::TargetFeatures,
             "relocation-models" => PrintRequest::RelocationModels,
             "code-models" => PrintRequest::CodeModels,
-            "target-spec-json" if nightly_options::is_unstable_enabled(matches)
-                => PrintRequest::TargetSpec,
+            "target-spec-json" => {
+                if nightly_options::is_unstable_enabled(matches) {
+                    PrintRequest::TargetSpec
+                } else {
+                    early_error(error_format,
+                                &format!("the `-Z unstable-options` flag must also be passed to \
+                                          enable the target-spec-json print option"));
+                }
+            },
             req => {
                 early_error(error_format, &format!("unknown print request `{}`", req))
             }
@@ -1776,7 +1800,7 @@ mod dep_tracking {
     use super::{Passes, CrateType, OptLevel, DebugInfoLevel,
                 OutputTypes, Externs, ErrorOutputType, Sanitizer};
     use syntax::feature_gate::UnstableFeatures;
-    use rustc_back::PanicStrategy;
+    use rustc_back::{PanicStrategy, RelroLevel};
 
     pub trait DepTrackingHash {
         fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType);
@@ -1818,11 +1842,13 @@ fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) {
     impl_dep_tracking_hash_via_hash!(Option<String>);
     impl_dep_tracking_hash_via_hash!(Option<(String, u64)>);
     impl_dep_tracking_hash_via_hash!(Option<PanicStrategy>);
+    impl_dep_tracking_hash_via_hash!(Option<RelroLevel>);
     impl_dep_tracking_hash_via_hash!(Option<lint::Level>);
     impl_dep_tracking_hash_via_hash!(Option<PathBuf>);
     impl_dep_tracking_hash_via_hash!(Option<cstore::NativeLibraryKind>);
     impl_dep_tracking_hash_via_hash!(CrateType);
     impl_dep_tracking_hash_via_hash!(PanicStrategy);
+    impl_dep_tracking_hash_via_hash!(RelroLevel);
     impl_dep_tracking_hash_via_hash!(Passes);
     impl_dep_tracking_hash_via_hash!(OptLevel);
     impl_dep_tracking_hash_via_hash!(DebugInfoLevel);
@@ -1904,7 +1930,7 @@ mod tests {
     use std::path::PathBuf;
     use std::rc::Rc;
     use super::{OutputType, OutputTypes, Externs};
-    use rustc_back::PanicStrategy;
+    use rustc_back::{PanicStrategy, RelroLevel};
     use syntax::symbol::Symbol;
 
     fn optgroups() -> getopts::Options {
@@ -2582,5 +2608,9 @@ fn test_debugging_options_tracking_hash() {
         opts = reference.clone();
         opts.debugging_opts.mir_opt_level = 3;
         assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
+
+        opts = reference.clone();
+        opts.debugging_opts.relro_level = Some(RelroLevel::Full);
+        assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
     }
 }
index 5aaba526e265f8a40b5494f0a49cb7dc592de58d..1fee0dd98634ae3af07784b751bb122348240322 100644 (file)
@@ -719,6 +719,7 @@ pub struct Generics {
     pub type_param_to_index: BTreeMap<DefIndex, u32>,
 
     pub has_self: bool,
+    pub has_late_bound_regions: bool,
 }
 
 impl Generics {
index c776f28ecd0ba68c619d6dc81491279f2b2164ac..55b39f226701fb450f5120b32b8021c26240022b 100644 (file)
@@ -47,6 +47,8 @@
 pub mod slice;
 pub mod dynamic_lib;
 
+use std::str::FromStr;
+
 use serialize::json::{Json, ToJson};
 
 macro_rules! linker_flavor {
@@ -114,3 +116,43 @@ fn to_json(&self) -> Json {
         }
     }
 }
+
+#[derive(Clone, Copy, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
+pub enum RelroLevel {
+    Full,
+    Partial,
+    Off,
+}
+
+impl RelroLevel {
+    pub fn desc(&self) -> &str {
+        match *self {
+            RelroLevel::Full => "full",
+            RelroLevel::Partial => "partial",
+            RelroLevel::Off => "off",
+        }
+    }
+}
+
+impl FromStr for RelroLevel {
+    type Err = ();
+
+    fn from_str(s: &str) -> Result<RelroLevel, ()> {
+        match s {
+            "full" => Ok(RelroLevel::Full),
+            "partial" => Ok(RelroLevel::Partial),
+            "off" => Ok(RelroLevel::Off),
+            _ => Err(()),
+        }
+    }
+}
+
+impl ToJson for RelroLevel {
+    fn to_json(&self) -> Json {
+        match *self {
+            RelroLevel::Full => "full".to_json(),
+            RelroLevel::Partial => "partial".to_json(),
+            RelroLevel::Off => "off".to_json(),
+        }
+    }
+}
index 5c4e01886a434366f9de5eb085b584aa26f9aec3..45ceb2d5a6046f45b428ca992fab9df58daeb880 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use target::TargetOptions;
+use target::{TargetOptions, RelroLevel};
 use std::default::Default;
 
 pub fn opts() -> TargetOptions {
@@ -19,6 +19,7 @@ pub fn opts() -> TargetOptions {
         linker_is_gnu: true,
         has_rpath: true,
         position_independent_executables: true,
+        relro_level: RelroLevel::Full,
 
         .. Default::default()
     }
index e44cd393289be3a23afdd0911c4b2e5e5c7dcb6f..21dca99aa500504c8924fae1ee5735ca895a7355 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use LinkerFlavor;
-use target::{LinkArgs, TargetOptions};
+use target::{LinkArgs, TargetOptions, RelroLevel};
 use std::default::Default;
 
 pub fn opts() -> TargetOptions {
@@ -33,6 +33,7 @@ pub fn opts() -> TargetOptions {
         has_rpath: true,
         pre_link_args: args,
         position_independent_executables: true,
+        relro_level: RelroLevel::Full,
         exe_allocation_crate: super::maybe_jemalloc(),
         .. Default::default()
     }
index e44cd393289be3a23afdd0911c4b2e5e5c7dcb6f..21dca99aa500504c8924fae1ee5735ca895a7355 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use LinkerFlavor;
-use target::{LinkArgs, TargetOptions};
+use target::{LinkArgs, TargetOptions, RelroLevel};
 use std::default::Default;
 
 pub fn opts() -> TargetOptions {
@@ -33,6 +33,7 @@ pub fn opts() -> TargetOptions {
         has_rpath: true,
         pre_link_args: args,
         position_independent_executables: true,
+        relro_level: RelroLevel::Full,
         exe_allocation_crate: super::maybe_jemalloc(),
         .. Default::default()
     }
index 8e7f463563c38e947d1775cde793d35cfac86aa1..21410dcd4126448967a4aa3e40434ce3aad81d46 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use target::TargetOptions;
+use target::{TargetOptions, RelroLevel};
 use std::default::Default;
 
 pub fn opts() -> TargetOptions {
@@ -18,6 +18,7 @@ pub fn opts() -> TargetOptions {
         executables: true,
         has_rpath: false,
         target_family: Some("unix".to_string()),
+        relro_level: RelroLevel::Full,
         linker_is_gnu: true,
         no_integrated_as: true,
         .. Default::default()
index 722d2fa16ef7a06a23689366bbf3af017cc0984f..52f700ac7519f51f134d552f27cb640abea45b62 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use LinkerFlavor;
-use target::{LinkArgs, TargetOptions};
+use target::{LinkArgs, TargetOptions, RelroLevel};
 use std::default::Default;
 
 pub fn opts() -> TargetOptions {
@@ -36,6 +36,7 @@ pub fn opts() -> TargetOptions {
         has_rpath: true,
         pre_link_args: args,
         position_independent_executables: true,
+        relro_level: RelroLevel::Full,
         exe_allocation_crate: super::maybe_jemalloc(),
         has_elf_tls: true,
         .. Default::default()
index edbbcf6f0b64701c3f1d33a219d61ba65e528170..0dbfdb4d809e025722f78dfce92a63bded502144 100644 (file)
@@ -50,7 +50,7 @@
 use std::io::prelude::*;
 use syntax::abi::{Abi, lookup as lookup_abi};
 
-use {LinkerFlavor, PanicStrategy};
+use {LinkerFlavor, PanicStrategy, RelroLevel};
 
 mod android_base;
 mod apple_base;
@@ -367,6 +367,10 @@ pub struct TargetOptions {
     /// the functions in the executable are not randomized and can be used
     /// during an exploit of a vulnerability in any code.
     pub position_independent_executables: bool,
+    /// Either partial, full, or off. Full RELRO makes the dynamic linker
+    /// resolve all symbols at startup and marks the GOT read-only before
+    /// starting the program, preventing overwriting the GOT.
+    pub relro_level: RelroLevel,
     /// Format that archives should be emitted in. This affects whether we use
     /// LLVM to assemble an archive or fall back to the system linker, and
     /// currently only "gnu" is used to fall into LLVM. Unknown strings cause
@@ -454,6 +458,7 @@ fn default() -> TargetOptions {
             has_rpath: false,
             no_default_libraries: true,
             position_independent_executables: false,
+            relro_level: RelroLevel::Off,
             pre_link_objects_exe: Vec::new(),
             pre_link_objects_dll: Vec::new(),
             post_link_objects: Vec::new(),
@@ -580,6 +585,18 @@ macro_rules! key {
                 Some(Ok(()))
             })).unwrap_or(Ok(()))
             } );
+            ($key_name:ident, RelroLevel) => ( {
+                let name = (stringify!($key_name)).replace("_", "-");
+                obj.find(&name[..]).and_then(|o| o.as_string().and_then(|s| {
+                    match s.parse::<RelroLevel>() {
+                        Ok(level) => base.options.$key_name = level,
+                        _ => return Some(Err(format!("'{}' is not a valid value for \
+                                                      relro-level. Use 'full', 'partial, or 'off'.",
+                                                      s))),
+                    }
+                    Some(Ok(()))
+                })).unwrap_or(Ok(()))
+            } );
             ($key_name:ident, list) => ( {
                 let name = (stringify!($key_name)).replace("_", "-");
                 obj.find(&name[..]).map(|o| o.as_array()
@@ -683,6 +700,7 @@ macro_rules! key {
         key!(has_rpath, bool);
         key!(no_default_libraries, bool);
         key!(position_independent_executables, bool);
+        try!(key!(relro_level, RelroLevel));
         key!(archive_format);
         key!(allow_asm, bool);
         key!(custom_unwind_resume, bool);
@@ -870,6 +888,7 @@ macro_rules! target_option_val {
         target_option_val!(has_rpath);
         target_option_val!(no_default_libraries);
         target_option_val!(position_independent_executables);
+        target_option_val!(relro_level);
         target_option_val!(archive_format);
         target_option_val!(allow_asm);
         target_option_val!(custom_unwind_resume);
index 63245fcae767b34841a6cf9448b21c2518ef1a6c..1cb311371938e54bf332f8f99597e876ce04c120 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use LinkerFlavor;
-use target::{LinkArgs, TargetOptions};
+use target::{LinkArgs, TargetOptions, RelroLevel};
 use std::default::Default;
 
 pub fn opts() -> TargetOptions {
@@ -33,6 +33,7 @@ pub fn opts() -> TargetOptions {
         has_rpath: true,
         pre_link_args: args,
         position_independent_executables: true,
+        relro_level: RelroLevel::Full,
         .. Default::default()
     }
 }
index 051028d5c4a7752840887313af6e8fc6762c300e..a5f8e7ae5f91bf2bd00f7f8be8d7ef99600f2a72 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use LinkerFlavor;
-use target::{LinkArgs, TargetOptions};
+use target::{LinkArgs, TargetOptions, RelroLevel};
 use std::default::Default;
 
 pub fn opts() -> TargetOptions {
@@ -34,6 +34,7 @@ pub fn opts() -> TargetOptions {
         is_like_openbsd: true,
         pre_link_args: args,
         position_independent_executables: true,
+        relro_level: RelroLevel::Full,
         .. Default::default()
     }
 }
index 718a79a685e066b066b645b33464678c1f54e4e6..7b038ac007396e37c09636170ebbf4fde8d8f6d6 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use LinkerFlavor;
-use target::{Target, TargetResult};
+use target::{Target, TargetResult, RelroLevel};
 
 pub fn target() -> TargetResult {
     let mut base = super::linux_base::opts();
@@ -17,6 +17,10 @@ pub fn target() -> TargetResult {
     base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
     base.max_atomic_width = Some(64);
 
+    // ld.so in at least RHEL6 on ppc64 has a bug related to BIND_NOW, so only enable partial RELRO
+    // for now. https://github.com/rust-lang/rust/pull/43170#issuecomment-315411474
+    base.relro_level = RelroLevel::Partial;
+
     // see #36994
     base.exe_allocation_crate = None;
 
index 3be7c43cab9388c654b1355134a105b1002793e9..1bfc5805bc8fdad418988515f884257c6a7d11a2 100644 (file)
@@ -991,7 +991,7 @@ fn report_out_of_scope_escaping_closure_capture(&self,
             .span_suggestion(err.span,
                              &format!("to force the closure to take ownership of {} \
                                        (and any other referenced variables), \
-                                       use the `move` keyword, as shown:",
+                                       use the `move` keyword",
                                        cmt_path_or_string),
                              suggestion)
             .emit();
index 98d90188312df752de79898db0671cc40db568e6..bae44c0047e2e3f80c798a2d4b254073c780958b 100644 (file)
@@ -835,7 +835,7 @@ fn slice_pat_covered_by_constructor(_tcx: TyCtxt, _span: Span,
     Ok(true)
 }
 
-fn range_covered_by_constructor(tcx: TyCtxt, span: Span,
+fn constructor_covered_by_range(tcx: TyCtxt, span: Span,
                                 ctor: &Constructor,
                                 from: &ConstVal, to: &ConstVal,
                                 end: RangeEnd)
@@ -845,14 +845,14 @@ fn range_covered_by_constructor(tcx: TyCtxt, span: Span,
     match *ctor {
         ConstantValue(ref value) => {
             let to = cmp_to(value)?;
-            let end = (to != Ordering::Greater) ||
-                      (end == RangeEnd::Excluded && to == Ordering::Equal);
+            let end = (to == Ordering::Less) ||
+                      (end == RangeEnd::Included && to == Ordering::Equal);
             Ok(cmp_from(value)? && end)
         },
         ConstantRange(ref from, ref to, RangeEnd::Included) => {
             let to = cmp_to(to)?;
-            let end = (to != Ordering::Greater) ||
-                      (end == RangeEnd::Excluded && to == Ordering::Equal);
+            let end = (to == Ordering::Less) ||
+                      (end == RangeEnd::Included && to == Ordering::Equal);
             Ok(cmp_from(from)? && end)
         },
         ConstantRange(ref from, ref to, RangeEnd::Excluded) => {
@@ -933,7 +933,7 @@ fn specialize<'p, 'a: 'p, 'tcx: 'a>(
                         "unexpected const-val {:?} with ctor {:?}", value, constructor)
                 },
                 _ => {
-                    match range_covered_by_constructor(
+                    match constructor_covered_by_range(
                         cx.tcx, pat.span, constructor, value, value, RangeEnd::Included
                             ) {
                         Ok(true) => Some(vec![]),
@@ -945,7 +945,7 @@ fn specialize<'p, 'a: 'p, 'tcx: 'a>(
         }
 
         PatternKind::Range { ref lo, ref hi, ref end } => {
-            match range_covered_by_constructor(
+            match constructor_covered_by_range(
                 cx.tcx, pat.span, constructor, lo, hi, end.clone()
             ) {
                 Ok(true) => Some(vec![]),
index 4ce985568ce23adaf9bcfcf4f1d04819566712d5..72fa858e4cba8cc8f8b4a0ff6739b008e0a709f5 100644 (file)
@@ -25,6 +25,7 @@
 use rustc::util::common::ErrorReported;
 use rustc::util::nodemap::DefIdMap;
 
+use syntax::abi::Abi;
 use syntax::ast;
 use rustc::hir::{self, Expr};
 use syntax_pos::Span;
@@ -340,6 +341,28 @@ fn eval_const_expr_partial<'a, 'tcx>(cx: &ConstContext<'a, 'tcx>,
               _ => signal!(e, TypeckError),
           };
 
+          if tcx.fn_sig(def_id).abi() == Abi::RustIntrinsic {
+            let layout_of = |ty: Ty<'tcx>| {
+                ty.layout(tcx, ty::ParamEnv::empty(traits::Reveal::All))
+                    .map_err(|err| {
+                        ConstEvalErr { span: e.span, kind: LayoutError(err) }
+                    })
+            };
+            match &tcx.item_name(def_id).as_str()[..] {
+                "size_of" => {
+                    let size = layout_of(substs.type_at(0))?.size(tcx);
+                    return Ok(Integral(Usize(ConstUsize::new(size.bytes(),
+                        tcx.sess.target.uint_type).unwrap())));
+                }
+                "min_align_of" => {
+                    let align = layout_of(substs.type_at(0))?.align(tcx);
+                    return Ok(Integral(Usize(ConstUsize::new(align.abi(),
+                        tcx.sess.target.uint_type).unwrap())));
+                }
+                _ => signal!(e, TypeckError)
+            }
+          }
+
           let body = if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
             if let Some(fn_like) = FnLikeNode::from_node(tcx.hir.get(node_id)) {
                 if fn_like.constness() == hir::Constness::Const {
index d7c21127474a49053b001133ce9f8e7ee8cf5b84..ee07b6e909f7d3437daf1ff10de1c1bbee360d3e 100644 (file)
@@ -211,6 +211,18 @@ pub fn span_help<S: Into<MultiSpan>>(&mut self,
 
     /// Prints out a message with a suggested edit of the code.
     ///
+    /// In case of short messages and a simple suggestion,
+    /// rustc displays it as a label like
+    ///
+    /// "try adding parentheses: `(tup.0).1`"
+    ///
+    /// The message
+    /// * should not end in any punctuation (a `:` is added automatically)
+    /// * should not be a question
+    /// * should not contain any parts like "the following", "as shown"
+    /// * may look like "to do xyz, use" or "to do xyz, use abc"
+    /// * may contain a name of a function, variable or type, but not whole expressions
+    ///
     /// See `diagnostic::CodeSuggestion` for more information.
     pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self {
         self.suggestions.push(CodeSuggestion {
index 2aea6d125f201e3cf381a5c81e661cdb6d11da2f..ad2562e28fa4f5b001d88200144f0de85e01d455 100644 (file)
@@ -51,7 +51,7 @@ fn emit(&mut self, db: &DiagnosticBuilder) {
                     // This substitution is only removal, don't show it
                     format!("help: {}", sugg.msg)
                 } else {
-                    format!("help: {} `{}`", sugg.msg, substitution)
+                    format!("help: {}: `{}`", sugg.msg, substitution)
                 };
                 primary_span.push_span_label(sugg.substitution_spans().next().unwrap(), msg);
             } else {
@@ -346,9 +346,20 @@ fn render_source_line(&self,
         // and "annotations lines", where the highlight lines have the `^`.
 
         // Sort the annotations by (start, end col)
+        // The labels are reversed, sort and then reversed again.
+        // Consider a list of annotations (A1, A2, C1, C2, B1, B2) where
+        // the letter signifies the span. Here we are only sorting by the
+        // span and hence, the order of the elements with the same span will
+        // not change. On reversing the ordering (|a, b| but b.cmp(a)), you get
+        // (C1, C2, B1, B2, A1, A2). All the elements with the same span are
+        // still ordered first to last, but all the elements with different
+        // spans are ordered by their spans in last to first order. Last to
+        // first order is important, because the jiggly lines and | are on
+        // the left, so the rightmost span needs to be rendered first,
+        // otherwise the lines would end up needing to go over a message.
+
         let mut annotations = line.annotations.clone();
-        annotations.sort();
-        annotations.reverse();
+        annotations.sort_by(|a,b| b.start_col.cmp(&a.start_col));
 
         // First, figure out where each label will be positioned.
         //
index a03f12c3dfbca09dd054c2f732c4a6cda7bcd5f9..21dca7f6c61c413234671a38817e6aabba2c9231 100644 (file)
@@ -235,7 +235,11 @@ macro_rules! add_lint_group {
         FutureIncompatibleInfo {
             id: LintId::of(PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES),
             reference: "issue #42238 <https://github.com/rust-lang/rust/issues/42238>",
-        }
+        },
+        FutureIncompatibleInfo {
+            id: LintId::of(LATE_BOUND_LIFETIME_ARGUMENTS),
+            reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>",
+        },
         ]);
 
     // Register renamed and removed lints
index ac39da48ac1fc3ce8798359eae3947b2933953cf..d15843b4f318bbb5cf38fc9a67c6c211c793c990 100644 (file)
@@ -856,21 +856,48 @@ fn inject_sanitizer_runtime(&mut self) {
                 return
             }
 
-            if !self.sess.crate_types.borrow().iter().all(|ct| {
-                match *ct {
-                    // Link the runtime
-                    config::CrateTypeExecutable => true,
-                    // This crate will be compiled with the required
-                    // instrumentation pass
-                    config::CrateTypeRlib => false,
-                    _ => {
-                        self.sess.err(&format!("Only executables and rlibs can be \
-                                                compiled with `-Z sanitizer`"));
-                        false
+            // firstyear 2017 - during testing I was unable to access an OSX machine
+            // to make this work on different crate types. As a result, today I have
+            // only been able to test and support linux as a target.
+            if self.sess.target.target.llvm_target == "x86_64-unknown-linux-gnu" {
+                if !self.sess.crate_types.borrow().iter().all(|ct| {
+                    match *ct {
+                        // Link the runtime
+                        config::CrateTypeStaticlib |
+                        config::CrateTypeExecutable => true,
+                        // This crate will be compiled with the required
+                        // instrumentation pass
+                        config::CrateTypeRlib |
+                        config::CrateTypeDylib |
+                        config::CrateTypeCdylib =>
+                            false,
+                        _ => {
+                            self.sess.err(&format!("Only executables, staticlibs, \
+                                cdylibs, dylibs and rlibs can be compiled with \
+                                `-Z sanitizer`"));
+                            false
+                        }
                     }
+                }) {
+                    return
+                }
+            } else {
+                if !self.sess.crate_types.borrow().iter().all(|ct| {
+                    match *ct {
+                        // Link the runtime
+                        config::CrateTypeExecutable => true,
+                        // This crate will be compiled with the required
+                        // instrumentation pass
+                        config::CrateTypeRlib => false,
+                        _ => {
+                            self.sess.err(&format!("Only executables and rlibs can be \
+                                                    compiled with `-Z sanitizer`"));
+                            false
+                        }
+                    }
+                }) {
+                    return
                 }
-            }) {
-                return
             }
 
             let mut uses_std = false;
@@ -890,7 +917,7 @@ fn inject_sanitizer_runtime(&mut self) {
                 info!("loading sanitizer: {}", name);
 
                 let symbol = Symbol::intern(name);
-                let dep_kind = DepKind::Implicit;
+                let dep_kind = DepKind::Explicit;
                 let (_, data) =
                     self.resolve_crate(&None, symbol, symbol, None, DUMMY_SP,
                                        PathKind::Crate, dep_kind);
@@ -900,6 +927,8 @@ fn inject_sanitizer_runtime(&mut self) {
                     self.sess.err(&format!("the crate `{}` is not a sanitizer runtime",
                                            name));
                 }
+            } else {
+                self.sess.err(&format!("Must link std to be compiled with `-Z sanitizer`"));
             }
         }
     }
index 68b687a2e6182c8ba34fddadcfc442e1ded1b03f..9bb0f07aa68ac0fbed57efa502c746e2e3d3f3cc 100644 (file)
@@ -749,14 +749,27 @@ fn visit_terminator_kind(&mut self,
             self.visit_operand(func, location);
 
             let fn_ty = func.ty(self.mir, self.tcx);
-            let (is_shuffle, is_const_fn) = match fn_ty.sty {
-                ty::TyFnDef(def_id, _) => {
-                    (self.tcx.fn_sig(def_id).abi() == Abi::PlatformIntrinsic &&
-                     self.tcx.item_name(def_id).as_str().starts_with("simd_shuffle"),
-                     self.tcx.is_const_fn(def_id))
+            let (mut is_shuffle, mut is_const_fn) = (false, false);
+            if let ty::TyFnDef(def_id, _) = fn_ty.sty {
+                match self.tcx.fn_sig(def_id).abi() {
+                    Abi::RustIntrinsic |
+                    Abi::PlatformIntrinsic => {
+                        assert!(!self.tcx.is_const_fn(def_id));
+                        match &self.tcx.item_name(def_id).as_str()[..] {
+                            "size_of" | "min_align_of" => is_const_fn = true,
+
+                            name if name.starts_with("simd_shuffle") => {
+                                is_shuffle = true;
+                            }
+
+                            _ => {}
+                        }
+                    }
+                    _ => {
+                        is_const_fn = self.tcx.is_const_fn(def_id);
+                    }
                 }
-                _ => (false, false)
-            };
+            }
 
             for (i, arg) in args.iter().enumerate() {
                 self.nest(|this| {
index 72c7b92fe6e309e149eed66844ccb2f526a51c4f..99a49dbd7d732122c8a458ef8cac9804d5488005 100644 (file)
@@ -127,18 +127,9 @@ fn visit_expr(&mut self, expr: &'a Expr) {
             }
             ExprKind::MethodCall(ref segment, ..) => {
                 if let Some(ref params) = segment.parameters {
-                    match **params {
-                        PathParameters::AngleBracketed(ref param_data) => {
-                            if !param_data.bindings.is_empty() {
-                                let binding_span = param_data.bindings[0].span;
-                                self.err_handler().span_err(binding_span,
-                                    "type bindings cannot be used in method calls");
-                            }
-                        }
-                        PathParameters::Parenthesized(..) => {
-                            self.err_handler().span_err(expr.span,
-                                "parenthesized parameters cannot be used on method calls");
-                        }
+                    if let PathParameters::Parenthesized(..) = **params {
+                        self.err_handler().span_err(expr.span,
+                            "parenthesized parameters cannot be used on method calls");
                     }
                 }
             }
index bec4c083905a9c0144431a1a21eeb93d3eb9b89f..468646c1ced8fbdb56736b6d07a68959d3f38877 100644 (file)
@@ -29,7 +29,7 @@
 use rustc::middle::const_val::ConstEvalErr;
 use rustc::middle::const_val::ErrKind::{IndexOpFeatureGated, UnimplementedConstVal, MiscCatchAll};
 use rustc::middle::const_val::ErrKind::{ErroneousReferencedConstant, MiscBinaryOp, NonConstPath};
-use rustc::middle::const_val::ErrKind::{TypeckError, Math};
+use rustc::middle::const_val::ErrKind::{TypeckError, Math, LayoutError};
 use rustc_const_math::{ConstMathErr, Op};
 use rustc::hir::def::{Def, CtorKind};
 use rustc::hir::def_id::DefId;
@@ -252,6 +252,9 @@ fn visit_expr(&mut self, ex: &'tcx hir::Expr) {
                 Err(ConstEvalErr { kind: Math(ConstMathErr::Overflow(Op::Shl)), .. }) |
                 Err(ConstEvalErr { kind: IndexOpFeatureGated, .. }) => {}
                 Err(ConstEvalErr { kind: TypeckError, .. }) => {}
+                Err(ConstEvalErr {
+                    kind: LayoutError(ty::layout::LayoutError::Unknown(_)), ..
+                }) => {}
                 Err(msg) => {
                     self.tcx.sess.add_lint(CONST_ERR,
                                            ex.id,
index 7754cd7366ecfa6932104d056eaa25eb3e205f4d..49e6929aeef1d2e966cdd272b35c47922221f256 100644 (file)
@@ -2409,13 +2409,15 @@ fn smart_resolve_path_fragment(&mut self,
                     .map(|suggestion| import_candidate_to_paths(&suggestion)).collect::<Vec<_>>();
                 enum_candidates.sort();
                 for (sp, variant_path, enum_path) in enum_candidates {
-                    let msg = format!("there is an enum variant `{}`, did you mean to use `{}`?",
-                                      variant_path,
-                                      enum_path);
                     if sp == DUMMY_SP {
+                        let msg = format!("there is an enum variant `{}`, \
+                                        try using `{}`?",
+                                        variant_path,
+                                        enum_path);
                         err.help(&msg);
                     } else {
-                        err.span_help(sp, &msg);
+                        err.span_suggestion(span, "you can try using the variant's enum",
+                                            enum_path);
                     }
                 }
             }
@@ -2424,18 +2426,20 @@ fn smart_resolve_path_fragment(&mut self,
                     let self_is_available = this.self_value_is_available(path[0].ctxt, span);
                     match candidate {
                         AssocSuggestion::Field => {
-                            err.span_label(span, format!("did you mean `self.{}`?", path_str));
+                            err.span_suggestion(span, "try",
+                                                format!("self.{}", path_str));
                             if !self_is_available {
                                 err.span_label(span, format!("`self` value is only available in \
                                                                methods with `self` parameter"));
                             }
                         }
                         AssocSuggestion::MethodWithSelf if self_is_available => {
-                            err.span_label(span, format!("did you mean `self.{}(...)`?",
-                                                           path_str));
+                            err.span_suggestion(span, "try",
+                                                format!("self.{}", path_str));
                         }
                         AssocSuggestion::MethodWithSelf | AssocSuggestion::AssocItem => {
-                            err.span_label(span, format!("did you mean `Self::{}`?", path_str));
+                            err.span_suggestion(span, "try",
+                                                format!("Self::{}", path_str));
                         }
                     }
                     return err;
index 0fbc596f2e1c24f132ebbbcd292b094503279866..a993aca92dd1280bf9464739144601dc73b69e87 100644 (file)
@@ -658,9 +658,10 @@ fn suggest_macro_name(&mut self, name: &str, kind: MacroKind,
         if let Some(suggestion) = suggestion {
             if suggestion != name {
                 if let MacroKind::Bang = kind {
-                    err.help(&format!("did you mean `{}!`?", suggestion));
+                    err.span_suggestion(span, "you could try the macro",
+                                        format!("{}!", suggestion));
                 } else {
-                    err.help(&format!("did you mean `{}`?", suggestion));
+                    err.span_suggestion(span, "try", suggestion.to_string());
                 }
             } else {
                 err.help("have you added the `#[macro_use]` on the module/import?");
index 6cbdae7627714576fba5bbac009e075e5da66fb7..5e85771217b95e0253e99c6287a2a152bea43ece 100644 (file)
@@ -27,7 +27,7 @@
 use rustc::hir::def_id::CrateNum;
 use rustc::hir::svh::Svh;
 use rustc_back::tempdir::TempDir;
-use rustc_back::PanicStrategy;
+use rustc_back::{PanicStrategy, RelroLevel};
 use rustc_incremental::IncrementalHashesMap;
 use context::get_reloc_model;
 use llvm;
@@ -1029,6 +1029,20 @@ fn link_args(cmd: &mut Linker,
         }
     }
 
+    let relro_level = match sess.opts.debugging_opts.relro_level {
+        Some(level) => level,
+        None => t.options.relro_level,
+    };
+    match relro_level {
+        RelroLevel::Full => {
+            cmd.full_relro();
+        },
+        RelroLevel::Partial => {
+            cmd.partial_relro();
+        },
+        RelroLevel::Off => {},
+    }
+
     // Pass optimization flags down to the linker.
     cmd.optimize();
 
index 0b15886083a4e4d099613a43d86c06c88f86f74e..89ebfd0d254ecfd1df144d7d6fc5589b5e4434c1 100644 (file)
@@ -104,6 +104,8 @@ pub trait Linker {
     fn add_object(&mut self, path: &Path);
     fn gc_sections(&mut self, keep_metadata: bool);
     fn position_independent_executable(&mut self);
+    fn partial_relro(&mut self);
+    fn full_relro(&mut self);
     fn optimize(&mut self);
     fn debuginfo(&mut self);
     fn no_default_libraries(&mut self);
@@ -175,6 +177,8 @@ impl<'a> Linker for GccLinker<'a> {
     fn output_filename(&mut self, path: &Path) { self.cmd.arg("-o").arg(path); }
     fn add_object(&mut self, path: &Path) { self.cmd.arg(path); }
     fn position_independent_executable(&mut self) { self.cmd.arg("-pie"); }
+    fn partial_relro(&mut self) { self.linker_arg("-z,relro"); }
+    fn full_relro(&mut self) { self.linker_arg("-z,relro,-z,now"); }
     fn args(&mut self, args: &[String]) { self.cmd.args(args); }
 
     fn link_rust_dylib(&mut self, lib: &str, _path: &Path) {
@@ -428,6 +432,14 @@ fn position_independent_executable(&mut self) {
         // noop
     }
 
+    fn partial_relro(&mut self) {
+        // noop
+    }
+
+    fn full_relro(&mut self) {
+        // noop
+    }
+
     fn no_default_libraries(&mut self) {
         // Currently we don't pass the /NODEFAULTLIB flag to the linker on MSVC
         // as there's been trouble in the past of linking the C++ standard
@@ -595,6 +607,14 @@ fn position_independent_executable(&mut self) {
         // noop
     }
 
+    fn partial_relro(&mut self) {
+        // noop
+    }
+
+    fn full_relro(&mut self) {
+        // noop
+    }
+
     fn args(&mut self, args: &[String]) {
         self.cmd.args(args);
     }
index fcb4b25e6fe88d6a8bf6d6f7584ade9bad7ef86c..98e774a29877dd9808acf053ad435b9de0ba55b6 100644 (file)
@@ -22,7 +22,8 @@
 use rustc::ty::cast::{CastTy, IntTy};
 use rustc::ty::subst::{Kind, Substs, Subst};
 use rustc_data_structures::indexed_vec::{Idx, IndexVec};
-use {abi, adt, base, machine};
+use {adt, base, machine};
+use abi::{self, Abi};
 use callee;
 use builder::Builder;
 use common::{self, CrateContext, const_get_elt, val_ty};
@@ -339,17 +340,34 @@ fn trans(&mut self) -> Result<Const<'tcx>, ConstEvalErr<'tcx>> {
                                        func, fn_ty)
                     };
 
-                    let mut const_args = IndexVec::with_capacity(args.len());
+                    let mut arg_vals = IndexVec::with_capacity(args.len());
                     for arg in args {
                         match self.const_operand(arg, span) {
-                            Ok(arg) => { const_args.push(arg); },
+                            Ok(arg) => { arg_vals.push(arg); },
                             Err(err) => if failure.is_ok() { failure = Err(err); }
                         }
                     }
                     if let Some((ref dest, target)) = *destination {
-                        match MirConstContext::trans_def(self.ccx, def_id, substs, const_args) {
-                            Ok(value) => self.store(dest, value, span),
-                            Err(err) => if failure.is_ok() { failure = Err(err); }
+                        if fn_ty.fn_sig(tcx).abi() == Abi::RustIntrinsic {
+                            let value = match &tcx.item_name(def_id).as_str()[..] {
+                                "size_of" => {
+                                    let llval = C_uint(self.ccx,
+                                        self.ccx.size_of(substs.type_at(0)));
+                                    Const::new(llval, tcx.types.usize)
+                                }
+                                "min_align_of" => {
+                                    let llval = C_uint(self.ccx,
+                                        self.ccx.align_of(substs.type_at(0)));
+                                    Const::new(llval, tcx.types.usize)
+                                }
+                                _ => span_bug!(span, "{:?} in constant", terminator.kind)
+                            };
+                            self.store(dest, value, span);
+                        } else {
+                            match MirConstContext::trans_def(self.ccx, def_id, substs, arg_vals) {
+                                Ok(value) => self.store(dest, value, span),
+                                Err(err) => if failure.is_ok() { failure = Err(err); }
+                            }
                         }
                         target
                     } else {
index 7bd24c939caf0beef8e405216da7da4decfc25cb..b3f62de5b570ba3e31b12d0a4cce12f676431727 100644 (file)
@@ -253,7 +253,7 @@ fn report_cast_to_unsized_type(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) {
                     match fcx.tcx.sess.codemap().span_to_snippet(self.cast_span) {
                         Ok(s) => {
                             err.span_suggestion(self.cast_span,
-                                                "try casting to a reference instead:",
+                                                "try casting to a reference instead",
                                                 format!("&{}{}", mtstr, s));
                         }
                         Err(_) => {
@@ -272,7 +272,7 @@ fn report_cast_to_unsized_type(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) {
                 match fcx.tcx.sess.codemap().span_to_snippet(self.cast_span) {
                     Ok(s) => {
                         err.span_suggestion(self.cast_span,
-                                            "try casting to a `Box` instead:",
+                                            "try casting to a `Box` instead",
                                             format!("Box<{}>", s));
                     }
                     Err(_) => span_help!(err, self.cast_span, "did you mean `Box<{}>`?", tstr),
index f54ad54187267fd6d96ee6f48a22c9de61ad573a..828106df7821b2e1b435c295b4b3a40c471d36c4 100644 (file)
@@ -16,6 +16,7 @@
 use syntax::ast;
 use syntax_pos::{self, Span};
 use rustc::hir;
+use rustc::hir::print;
 use rustc::hir::def::Def;
 use rustc::ty::{self, Ty, AssociatedItem};
 use errors::{DiagnosticBuilder, CodeMapper};
@@ -94,6 +95,34 @@ pub fn demand_coerce_diag(&self,
             let cause = self.misc(expr.span);
             let expr_ty = self.resolve_type_vars_with_obligations(checked_ty);
             let mut err = self.report_mismatched_types(&cause, expected, expr_ty, e);
+
+            // If the expected type is an enum with any variants whose sole
+            // field is of the found type, suggest such variants. See Issue
+            // #42764.
+            if let ty::TyAdt(expected_adt, substs) = expected.sty {
+                let mut compatible_variants = vec![];
+                for variant in &expected_adt.variants {
+                    if variant.fields.len() == 1 {
+                        let sole_field = &variant.fields[0];
+                        let sole_field_ty = sole_field.ty(self.tcx, substs);
+                        if self.can_coerce(expr_ty, sole_field_ty) {
+                            let mut variant_path = self.tcx.item_path_str(variant.did);
+                            variant_path = variant_path.trim_left_matches("std::prelude::v1::")
+                                .to_string();
+                            compatible_variants.push(variant_path);
+                        }
+                    }
+                }
+                if !compatible_variants.is_empty() {
+                    let expr_text = print::to_string(print::NO_ANN, |s| s.print_expr(expr));
+                    let suggestions = compatible_variants.iter()
+                        .map(|v| format!("{}({})", v, expr_text)).collect::<Vec<_>>();
+                    err.span_suggestions(expr.span,
+                                         "perhaps you meant to use a variant of the expected type",
+                                         suggestions);
+                }
+            }
+
             if let Some(suggestion) = self.check_ref(expr,
                                                      checked_ty,
                                                      expected) {
index 0829951e12debfdaaed9d6d6d15f6aa5c89fc109..ad4ee5a9d6dcf2c7dea25f84cf8c0616edc94a9a 100644 (file)
@@ -10,6 +10,7 @@
 
 use super::{probe, MethodCallee};
 
+use astconv::AstConv;
 use check::{FnCtxt, LvalueOp, callee};
 use hir::def_id::DefId;
 use rustc::ty::subst::Substs;
@@ -280,62 +281,38 @@ fn extract_existential_trait_ref<R, F>(&mut self, self_ty: Ty<'tcx>, mut closure
     fn instantiate_method_substs(&mut self,
                                  pick: &probe::Pick<'tcx>,
                                  segment: &hir::PathSegment,
-                                 substs: &Substs<'tcx>)
+                                 parent_substs: &Substs<'tcx>)
                                  -> &'tcx Substs<'tcx> {
-        let supplied_method_types = match segment.parameters {
-            hir::AngleBracketedParameters(ref data) => &data.types,
-            _ => bug!("unexpected generic arguments: {:?}", segment.parameters),
-        };
-
         // Determine the values for the generic parameters of the method.
         // If they were not explicitly supplied, just construct fresh
         // variables.
-        let num_supplied_types = supplied_method_types.len();
         let method_generics = self.tcx.generics_of(pick.item.def_id);
-        let num_method_types = method_generics.types.len();
-
-        if num_supplied_types > 0 && num_supplied_types != num_method_types {
-            if num_method_types == 0 {
-                struct_span_err!(self.tcx.sess,
-                                 self.span,
-                                 E0035,
-                                 "does not take type parameters")
-                    .span_label(self.span, "called with unneeded type parameters")
-                    .emit();
-            } else {
-                struct_span_err!(self.tcx.sess,
-                                 self.span,
-                                 E0036,
-                                 "incorrect number of type parameters given for this method: \
-                                  expected {}, found {}",
-                                 num_method_types,
-                                 num_supplied_types)
-                    .span_label(self.span,
-                                format!("Passed {} type argument{}, expected {}",
-                                         num_supplied_types,
-                                         if num_supplied_types != 1 { "s" } else { "" },
-                                         num_method_types))
-                    .emit();
-            }
-        }
+        let mut fn_segment = Some((segment, method_generics));
+        self.fcx.check_path_parameter_count(self.span, &mut fn_segment, true);
 
         // Create subst for early-bound lifetime parameters, combining
         // parameters from the type and those from the method.
-        //
-        // FIXME -- permit users to manually specify lifetimes
-        let supplied_start = substs.len() + method_generics.regions.len();
+        let (supplied_types, supplied_lifetimes) = match segment.parameters {
+            hir::AngleBracketedParameters(ref data) => (&data.types, &data.lifetimes),
+            _ => bug!("unexpected generic arguments: {:?}", segment.parameters),
+        };
+        assert_eq!(method_generics.parent_count(), parent_substs.len());
         Substs::for_item(self.tcx, pick.item.def_id, |def, _| {
             let i = def.index as usize;
-            if i < substs.len() {
-                substs.region_at(i)
+            if i < parent_substs.len() {
+                parent_substs.region_at(i)
+            } else if let Some(lifetime) =
+                    supplied_lifetimes.get(i - parent_substs.len()) {
+                AstConv::ast_region_to_region(self.fcx, lifetime, Some(def))
             } else {
                 self.region_var_for_def(self.span, def)
             }
         }, |def, cur_substs| {
             let i = def.index as usize;
-            if i < substs.len() {
-                substs.type_at(i)
-            } else if let Some(ast_ty) = supplied_method_types.get(i - supplied_start) {
+            if i < parent_substs.len() {
+                parent_substs.type_at(i)
+            } else if let Some(ast_ty) =
+                    supplied_types.get(i - parent_substs.len() - method_generics.regions.len()) {
                 self.to_ty(ast_ty)
             } else {
                 self.type_var_for_def(self.span, def, cur_substs)
index cdbe5e14e90948fabb469189226f1d6465283578..af11cacb247b6b6b90bef620d7a28e58b0768893 100644 (file)
@@ -4491,8 +4491,8 @@ pub fn instantiate_value_path(&self,
         // variables. If the user provided some types, we may still need
         // to add defaults. If the user provided *too many* types, that's
         // a problem.
-        self.check_path_parameter_count(span, &mut type_segment);
-        self.check_path_parameter_count(span, &mut fn_segment);
+        self.check_path_parameter_count(span, &mut type_segment, false);
+        self.check_path_parameter_count(span, &mut fn_segment, false);
 
         let (fn_start, has_self) = match (type_segment, fn_segment) {
             (_, Some((_, generics))) => {
@@ -4618,7 +4618,8 @@ pub fn instantiate_value_path(&self,
     /// Report errors if the provided parameters are too few or too many.
     fn check_path_parameter_count(&self,
                                   span: Span,
-                                  segment: &mut Option<(&hir::PathSegment, &ty::Generics)>) {
+                                  segment: &mut Option<(&hir::PathSegment, &ty::Generics)>,
+                                  is_method_call: bool) {
         let (lifetimes, types, infer_types, bindings) = {
             match segment.map(|(s, _)| &s.parameters) {
                 Some(&hir::AngleBracketedParameters(ref data)) => {
@@ -4632,6 +4633,7 @@ fn check_path_parameter_count(&self,
                 None => (&[][..], &[][..], true, &[][..])
             }
         };
+        let infer_lifetimes = lifetimes.len() == 0;
 
         let count_lifetime_params = |n| {
             format!("{} lifetime parameter{}", n, if n == 1 { "" } else { "s" })
@@ -4640,32 +4642,6 @@ fn check_path_parameter_count(&self,
             format!("{} type parameter{}", n, if n == 1 { "" } else { "s" })
         };
 
-        // Check provided lifetime parameters.
-        let lifetime_defs = segment.map_or(&[][..], |(_, generics)| &generics.regions);
-        if lifetimes.len() > lifetime_defs.len() {
-            let expected_text = count_lifetime_params(lifetime_defs.len());
-            let actual_text = count_lifetime_params(lifetimes.len());
-            struct_span_err!(self.tcx.sess, span, E0088,
-                             "too many lifetime parameters provided: \
-                              expected at most {}, found {}",
-                             expected_text, actual_text)
-                .span_label(span, format!("expected {}", expected_text))
-                .emit();
-        } else if lifetimes.len() > 0 && lifetimes.len() < lifetime_defs.len() {
-            let expected_text = count_lifetime_params(lifetime_defs.len());
-            let actual_text = count_lifetime_params(lifetimes.len());
-            struct_span_err!(self.tcx.sess, span, E0090,
-                             "too few lifetime parameters provided: \
-                              expected {}, found {}",
-                             expected_text, actual_text)
-                .span_label(span, format!("expected {}", expected_text))
-                .emit();
-        }
-
-        // The case where there is not enough lifetime parameters is not checked,
-        // because this is not possible - a function never takes lifetime parameters.
-        // See discussion for Pull Request 36208.
-
         // Check provided type parameters.
         let type_defs = segment.map_or(&[][..], |(_, generics)| {
             if generics.parent.is_none() {
@@ -4690,7 +4666,7 @@ fn check_path_parameter_count(&self,
             // type parameters, we force instantiate_value_path to
             // use inference variables instead of the provided types.
             *segment = None;
-        } else if !infer_types && types.len() < required_len {
+        } else if types.len() < required_len && !infer_types {
             let expected_text = count_type_params(required_len);
             let actual_text = count_type_params(types.len());
             struct_span_err!(self.tcx.sess, span, E0089,
@@ -4706,6 +4682,51 @@ fn check_path_parameter_count(&self,
                       "unexpected binding of associated item in expression path \
                        (only allowed in type paths)");
         }
+
+        // Check provided lifetime parameters.
+        let lifetime_defs = segment.map_or(&[][..], |(_, generics)| &generics.regions);
+        let required_len = lifetime_defs.len();
+
+        // Prohibit explicit lifetime arguments if late bound lifetime parameters are present.
+        let has_late_bound_lifetime_defs =
+            segment.map_or(false, |(_, generics)| generics.has_late_bound_regions);
+        if has_late_bound_lifetime_defs && !lifetimes.is_empty() {
+            // Report this as a lint only if no error was reported previously.
+            if !is_method_call && (lifetimes.len() > lifetime_defs.len() ||
+                                   lifetimes.len() < required_len && !infer_lifetimes) {
+                self.tcx.sess.span_err(lifetimes[0].span,
+                                       "cannot specify lifetime arguments explicitly \
+                                        if late bound lifetime parameters are present");
+                *segment = None;
+            } else {
+                self.tcx.sess.add_lint(lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS,
+                                       lifetimes[0].id, lifetimes[0].span,
+                                       format!("cannot specify lifetime arguments explicitly \
+                                                if late bound lifetime parameters are present"));
+            }
+            return;
+        }
+
+        if lifetimes.len() > lifetime_defs.len() {
+            let span = lifetimes[lifetime_defs.len()].span;
+            let expected_text = count_lifetime_params(lifetime_defs.len());
+            let actual_text = count_lifetime_params(lifetimes.len());
+            struct_span_err!(self.tcx.sess, span, E0088,
+                             "too many lifetime parameters provided: \
+                              expected at most {}, found {}",
+                             expected_text, actual_text)
+                .span_label(span, format!("expected {}", expected_text))
+                .emit();
+        } else if lifetimes.len() < required_len && !infer_lifetimes {
+            let expected_text = count_lifetime_params(lifetime_defs.len());
+            let actual_text = count_lifetime_params(lifetimes.len());
+            struct_span_err!(self.tcx.sess, span, E0090,
+                             "too few lifetime parameters provided: \
+                              expected {}, found {}",
+                             expected_text, actual_text)
+                .span_label(span, format!("expected {}", expected_text))
+                .emit();
+        }
     }
 
     fn structurally_resolve_type_or_else<F>(&self, sp: Span, ty: Ty<'tcx>, f: F)
index 4d69b37b113cfbf2bfaf36b49e00f583d15d23ea..032e37a34a887f7acbfa478029100309b4d4ffc3 100644 (file)
@@ -320,7 +320,7 @@ fn check_str_addition(&self,
                                   from a string reference. String concatenation \
                                   appends the string on the right to the string \
                                   on the left and may require reallocation. This \
-                                  requires ownership of the string on the left."), suggestion);
+                                  requires ownership of the string on the left"), suggestion);
                     is_string_addition = true;
                 }
 
index 002a148c459a3be506f7196e64ee7b91b8ab3f1b..72bd084330dd3ca62d92373d351431533685dd09 100644 (file)
@@ -772,6 +772,95 @@ fn trait_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     tcx.alloc_trait_def(def)
 }
 
+fn has_late_bound_regions<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                                    node: hir_map::Node<'tcx>)
+                                    -> bool {
+    struct LateBoundRegionsDetector<'a, 'tcx: 'a> {
+        tcx: TyCtxt<'a, 'tcx, 'tcx>,
+        binder_depth: u32,
+        has_late_bound_regions: bool,
+    }
+
+    impl<'a, 'tcx> Visitor<'tcx> for LateBoundRegionsDetector<'a, 'tcx> {
+        fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
+            NestedVisitorMap::None
+        }
+
+        fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
+            if self.has_late_bound_regions { return }
+            match ty.node {
+                hir::TyBareFn(..) => {
+                    self.binder_depth += 1;
+                    intravisit::walk_ty(self, ty);
+                    self.binder_depth -= 1;
+                }
+                _ => intravisit::walk_ty(self, ty)
+            }
+        }
+
+        fn visit_poly_trait_ref(&mut self,
+                                tr: &'tcx hir::PolyTraitRef,
+                                m: hir::TraitBoundModifier) {
+            if self.has_late_bound_regions { return }
+            self.binder_depth += 1;
+            intravisit::walk_poly_trait_ref(self, tr, m);
+            self.binder_depth -= 1;
+        }
+
+        fn visit_lifetime(&mut self, lt: &'tcx hir::Lifetime) {
+            if self.has_late_bound_regions { return }
+
+            match self.tcx.named_region_map.defs.get(&lt.id).cloned() {
+                Some(rl::Region::Static) | Some(rl::Region::EarlyBound(..)) => {}
+                Some(rl::Region::LateBound(debruijn, _)) |
+                Some(rl::Region::LateBoundAnon(debruijn, _))
+                    if debruijn.depth < self.binder_depth => {}
+                _ => self.has_late_bound_regions = true,
+            }
+        }
+    }
+
+    fn has_late_bound_regions<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                                        generics: &'tcx hir::Generics,
+                                        decl: &'tcx hir::FnDecl)
+                                        -> bool {
+        let mut visitor = LateBoundRegionsDetector {
+            tcx, binder_depth: 1, has_late_bound_regions: false
+        };
+        for lifetime in &generics.lifetimes {
+            if tcx.named_region_map.late_bound.contains(&lifetime.lifetime.id) {
+                return true;
+            }
+        }
+        visitor.visit_fn_decl(decl);
+        visitor.has_late_bound_regions
+    }
+
+    match node {
+        hir_map::NodeTraitItem(item) => match item.node {
+            hir::TraitItemKind::Method(ref sig, _) =>
+                has_late_bound_regions(tcx, &sig.generics, &sig.decl),
+            _ => false,
+        },
+        hir_map::NodeImplItem(item) => match item.node {
+            hir::ImplItemKind::Method(ref sig, _) =>
+                has_late_bound_regions(tcx, &sig.generics, &sig.decl),
+            _ => false,
+        },
+        hir_map::NodeForeignItem(item) => match item.node {
+            hir::ForeignItemFn(ref fn_decl, _, ref generics) =>
+                has_late_bound_regions(tcx, generics, fn_decl),
+            _ => false,
+        },
+        hir_map::NodeItem(item) => match item.node {
+            hir::ItemFn(ref fn_decl, .., ref generics, _) =>
+                has_late_bound_regions(tcx, generics, fn_decl),
+            _ => false,
+        },
+        _ => false
+    }
+}
+
 fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                          def_id: DefId)
                          -> &'tcx ty::Generics {
@@ -959,7 +1048,8 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         regions: regions,
         types: types,
         type_param_to_index: type_param_to_index,
-        has_self: has_self || parent_has_self
+        has_self: has_self || parent_has_self,
+        has_late_bound_regions: has_late_bound_regions(tcx, node),
     })
 }
 
index 87e59683fd2a8d49a40593051312a84bad1f7211..1e26a734e7640d8e90765077522e6dba4ffade1d 100644 (file)
@@ -332,92 +332,6 @@ fn main() {
 ```
 "##,
 
-E0035: r##"
-You tried to give a type parameter where it wasn't needed. Erroneous code
-example:
-
-```compile_fail,E0035
-struct Test;
-
-impl Test {
-    fn method(&self) {}
-}
-
-fn main() {
-    let x = Test;
-
-    x.method::<i32>(); // Error: Test::method doesn't need type parameter!
-}
-```
-
-To fix this error, just remove the type parameter:
-
-```
-struct Test;
-
-impl Test {
-    fn method(&self) {}
-}
-
-fn main() {
-    let x = Test;
-
-    x.method(); // OK, we're good!
-}
-```
-"##,
-
-E0036: r##"
-This error occurrs when you pass too many or not enough type parameters to
-a method. Erroneous code example:
-
-```compile_fail,E0036
-struct Test;
-
-impl Test {
-    fn method<T>(&self, v: &[T]) -> usize {
-        v.len()
-    }
-}
-
-fn main() {
-    let x = Test;
-    let v = &[0];
-
-    x.method::<i32, i32>(v); // error: only one type parameter is expected!
-}
-```
-
-To fix it, just specify a correct number of type parameters:
-
-```
-struct Test;
-
-impl Test {
-    fn method<T>(&self, v: &[T]) -> usize {
-        v.len()
-    }
-}
-
-fn main() {
-    let x = Test;
-    let v = &[0];
-
-    x.method::<i32>(v); // OK, we're good!
-}
-```
-
-Please note on the last example that we could have called `method` like this:
-
-```
-# struct Test;
-# impl Test { fn method<T>(&self, v: &[T]) -> usize { v.len() } }
-# let x = Test;
-# let v = &[0];
-x.method(v);
-```
-"##,
-
 E0040: r##"
 It is not allowed to manually call destructors in Rust. It is also not
 necessary to do this since `drop` is called automatically whenever a value goes
@@ -4681,6 +4595,8 @@ fn i_am_a_function() {}
 }
 
 register_diagnostics! {
+//  E0035, merged into E0087/E0089
+//  E0036, merged into E0087/E0089
 //  E0068,
 //  E0085,
 //  E0086,
index a6eb17c8fa41bf6819bfe89af7c2bfca27659be1..0135cd0a588cf09e530499f3e4c60b571cbf62b2 100644 (file)
@@ -1090,12 +1090,11 @@ pub fn atanh(self) -> f32 {
     /// # Examples
     ///
     /// ```
-    /// #![feature(float_bits_conv)]
     /// assert_ne!((1f32).to_bits(), 1f32 as u32); // to_bits() is not casting!
     /// assert_eq!((12.5f32).to_bits(), 0x41480000);
     ///
     /// ```
-    #[unstable(feature = "float_bits_conv", reason = "recently added", issue = "40470")]
+    #[stable(feature = "float_bits_conv", since = "1.20.0")]
     #[inline]
     pub fn to_bits(self) -> u32 {
         unsafe { ::mem::transmute(self) }
@@ -1118,7 +1117,6 @@ pub fn to_bits(self) -> u32 {
     /// # Examples
     ///
     /// ```
-    /// #![feature(float_bits_conv)]
     /// use std::f32;
     /// let v = f32::from_bits(0x41480000);
     /// let difference = (v - 12.5).abs();
@@ -1127,7 +1125,7 @@ pub fn to_bits(self) -> u32 {
     /// let snan = 0x7F800001;
     /// assert_ne!(f32::from_bits(snan).to_bits(), snan);
     /// ```
-    #[unstable(feature = "float_bits_conv", reason = "recently added", issue = "40470")]
+    #[stable(feature = "float_bits_conv", since = "1.20.0")]
     #[inline]
     pub fn from_bits(mut v: u32) -> Self {
         const EXP_MASK: u32   = 0x7F800000;
index 4d8d8b4ebe6aa001d725972c3148a3c9cc62e193..d73d7cd2c7bd1cf52c088a0e45d45c4e5e688d84 100644 (file)
@@ -1005,12 +1005,11 @@ fn log_wrapper<F: Fn(f64) -> f64>(self, log_fn: F) -> f64 {
     /// # Examples
     ///
     /// ```
-    /// #![feature(float_bits_conv)]
     /// assert!((1f64).to_bits() != 1f64 as u64); // to_bits() is not casting!
     /// assert_eq!((12.5f64).to_bits(), 0x4029000000000000);
     ///
     /// ```
-    #[unstable(feature = "float_bits_conv", reason = "recently added", issue = "40470")]
+    #[stable(feature = "float_bits_conv", since = "1.20.0")]
     #[inline]
     pub fn to_bits(self) -> u64 {
         unsafe { ::mem::transmute(self) }
@@ -1033,7 +1032,6 @@ pub fn to_bits(self) -> u64 {
     /// # Examples
     ///
     /// ```
-    /// #![feature(float_bits_conv)]
     /// use std::f64;
     /// let v = f64::from_bits(0x4029000000000000);
     /// let difference = (v - 12.5).abs();
@@ -1042,7 +1040,7 @@ pub fn to_bits(self) -> u64 {
     /// let snan = 0x7FF0000000000001;
     /// assert_ne!(f64::from_bits(snan).to_bits(), snan);
     /// ```
-    #[unstable(feature = "float_bits_conv", reason = "recently added", issue = "40470")]
+    #[stable(feature = "float_bits_conv", since = "1.20.0")]
     #[inline]
     pub fn from_bits(mut v: u64) -> Self {
         const EXP_MASK: u64   = 0x7FF0000000000000;
index 88994b284c90dced81a4592873f405756d2c82d6..38d3312b4e7dd6a7569cdd5381de742edc8e538e 100644 (file)
@@ -2346,17 +2346,17 @@ fn concurrent_recursive_mkdir() {
 
     #[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]
index dda069324b08d0e78f990f075a9d8fb833a38503..a012f2f42c19c348e606bf8c52a9cdc59ef22f2e 100644 (file)
 #![feature(unwind_attributes)]
 #![feature(vec_push_all)]
 #![cfg_attr(test, feature(update_panic_count))]
-#![cfg_attr(test, feature(float_bits_conv))]
 
 #![cfg_attr(not(stage0), default_lib_allocator)]
 #![cfg_attr(stage0, feature(associated_consts))]
index 98ec3aa3e295986bc366d1302f22919a9f88b673..319965ab3965e21646216d88dad3b4b6a4cdb7ec 100644 (file)
@@ -29,7 +29,7 @@ pub fn connect(addr: &SocketAddr) -> Result<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 @@ pub fn bind(addr: &SocketAddr) -> Result<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)> {
index 93ebcc95fd0f87e0c70fa6584678ec2cab778a8a..7e7666e7ef3641b43ccced4bea02bdc11d1c37c2 100644 (file)
@@ -30,7 +30,7 @@ pub fn bind(addr: &SocketAddr) -> Result<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> {
index e38b7b29f4837e1de389bb51722d245ba78c62c7..efddd5f0294840afb40a94b8f627d5d23e4138e6 100644 (file)
@@ -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();
index 62d873d257d8ffcd7651af05640a1266b667d5b1..ff1626d9b31c1aaf5ba64d9f9ffd8ca6d28e7739 100644 (file)
@@ -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 @@ macro_rules! t {
         }
 
         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 @@ fn to_child_stdio(&self, readable: bool)
                 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))
             }
         }
index fadf7325d75757e92862db585af20acf5b782d63..ec9005c2cc3be702981a2febe47b20fc5307fe18 100644 (file)
@@ -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
index 55766ba3fed6a70660f53d4949e689d627ce7d80..48819adb23e2ea03c2f5c194b176be1dd9e59846 100644 (file)
@@ -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.
 //
 /// 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 @@ pub fn new(secs: u64, nanos: u32) -> 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 @@ pub fn from_millis(millis: u64) -> 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 @@ pub fn from_millis(millis: u64) -> 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 @@ pub fn as_secs(&self) -> u64 { self.secs }
     /// 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]
index 0c6f09ba7666cb0ed6b5896194c75794f1f2d5d1..b8e02556625d0c597456e39a00eb1eaebad4f387 100644 (file)
@@ -12,7 +12,7 @@
 
 // Predicates on exprs and stmts that the pretty-printer and parser use
 
-use ast::{self, BlockCheckMode};
+use ast;
 
 /// Does this expression require a semicolon to be treated
 /// as a statement? The negation of this: 'can this expression
@@ -30,18 +30,12 @@ pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool {
         ast::ExprKind::While(..) |
         ast::ExprKind::WhileLet(..) |
         ast::ExprKind::Loop(..) |
-        ast::ExprKind::ForLoop(..) => false,
+        ast::ExprKind::ForLoop(..) |
+        ast::ExprKind::Catch(..) => false,
         _ => true,
     }
 }
 
-pub fn expr_is_simple_block(e: &ast::Expr) -> bool {
-    match e.node {
-        ast::ExprKind::Block(ref block) => block.rules == BlockCheckMode::Default,
-        _ => false,
-    }
-}
-
 /// this statement requires a semicolon after it.
 /// note that in one case (`stmt_semi`), we've already
 /// seen the semicolon, and thus don't need another.
index 74b2ea1df323a178519b6b4a29f81bb6258b3ec2..ae3edfcbf325d2d179103106c9f7e2606ce0d045 100644 (file)
@@ -1490,7 +1490,7 @@ fn maybe_recover_from_bad_type_plus(&mut self, allow_plus: bool, ty: &Ty) -> PRe
                     s.print_bounds(" +", &bounds)?;
                     s.pclose()
                 });
-                err.span_suggestion(sum_span, "try adding parentheses:", sum_with_parens);
+                err.span_suggestion(sum_span, "try adding parentheses", sum_with_parens);
             }
             TyKind::Ptr(..) | TyKind::BareFn(..) => {
                 err.span_label(sum_span, "perhaps you forgot parentheses?");
@@ -3209,8 +3209,7 @@ pub fn parse_arm(&mut self) -> PResult<'a, Arm> {
         self.expect(&token::FatArrow)?;
         let expr = self.parse_expr_res(RESTRICTION_STMT_EXPR, None)?;
 
-        let require_comma =
-            !classify::expr_is_simple_block(&expr)
+        let require_comma = classify::expr_requires_semi_to_be_stmt(&expr)
             && self.token != token::CloseDelim(token::Brace);
 
         if require_comma {
@@ -5280,7 +5279,7 @@ pub fn parse_visibility(&mut self, can_take_tuple: bool) -> PResult<'a, Visibili
 `pub(in path::to::module)`: visible only on the specified path"##;
                 let path = self.parse_path(PathStyle::Mod)?;
                 let path_span = self.prev_span;
-                let help_msg = format!("make this visible only to module `{}` with `in`:", path);
+                let help_msg = format!("make this visible only to module `{}` with `in`", path);
                 self.expect(&token::CloseDelim(token::Paren))?;  // `)`
                 let mut err = self.span_fatal_help(path_span, msg, suggestion);
                 err.span_suggestion(path_span, &help_msg, format!("in {}", path));
index b7c794f4475a8837dfbbbc1b138a12ad5710a7ff..7dc9030ea055b3709cb92830acc313ed15ff43d9 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // ignore-arm
+// ignore-powerpc
 // ignore-wasm
 // ignore-emscripten
 // ignore-windows
diff --git a/src/test/compile-fail-fulldeps/proc-macro/resolve-error.rs b/src/test/compile-fail-fulldeps/proc-macro/resolve-error.rs
deleted file mode 100644 (file)
index ddd8631..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2016 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.
-
-// aux-build:derive-foo.rs
-// aux-build:derive-clona.rs
-// aux-build:attr_proc_macro.rs
-// aux-build:bang_proc_macro.rs
-
-#![feature(proc_macro)]
-#![allow(unused_macros)]
-
-#[macro_use]
-extern crate derive_foo;
-#[macro_use]
-extern crate derive_clona;
-extern crate attr_proc_macro;
-extern crate bang_proc_macro;
-
-use attr_proc_macro::attr_proc_macro;
-use bang_proc_macro::bang_proc_macro;
-
-macro_rules! FooWithLongNam {
-    () => {}
-}
-
-macro_rules! attr_proc_mac {
-    () => {}
-}
-
-#[derive(FooWithLongNan)]
-//~^ ERROR cannot find derive macro `FooWithLongNan` in this scope
-//~^^ HELP did you mean `FooWithLongName`?
-struct Foo;
-
-#[attr_proc_macra]
-//~^ ERROR cannot find attribute macro `attr_proc_macra` in this scope
-//~^^ HELP did you mean `attr_proc_macro`?
-struct Bar;
-
-#[FooWithLongNan]
-//~^ ERROR cannot find attribute macro `FooWithLongNan` in this scope
-struct Asdf;
-
-#[derive(Dlone)]
-//~^ ERROR cannot find derive macro `Dlone` in this scope
-//~^^ HELP did you mean `Clone`?
-struct A;
-
-#[derive(Dlona)]
-//~^ ERROR cannot find derive macro `Dlona` in this scope
-//~^^ HELP did you mean `Clona`?
-struct B;
-
-#[derive(attr_proc_macra)]
-//~^ ERROR cannot find derive macro `attr_proc_macra` in this scope
-struct C;
-
-fn main() {
-    FooWithLongNama!();
-    //~^ ERROR cannot find macro `FooWithLongNama!` in this scope
-    //~^^ HELP did you mean `FooWithLongNam!`?
-
-    attr_proc_macra!();
-    //~^ ERROR cannot find macro `attr_proc_macra!` in this scope
-    //~^^ HELP did you mean `attr_proc_mac!`?
-
-    Dlona!();
-    //~^ ERROR cannot find macro `Dlona!` in this scope
-
-    bang_proc_macrp!();
-    //~^ ERROR cannot find macro `bang_proc_macrp!` in this scope
-    //~^^ HELP did you mean `bang_proc_macro!`?
-}
diff --git a/src/test/compile-fail/E0035.rs b/src/test/compile-fail/E0035.rs
deleted file mode 100644 (file)
index 9322d21..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 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.
-
-struct Test;
-
-impl Test {
-    fn method(&self) {}
-}
-
-fn main() {
-    let x = Test;
-    x.method::<i32>(); //~ ERROR E0035
-                       //~| NOTE called with unneeded type parameters
-}
diff --git a/src/test/compile-fail/E0036.rs b/src/test/compile-fail/E0036.rs
deleted file mode 100644 (file)
index ecb6dac..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2016 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.
-
-struct Test;
-
-impl Test {
-    fn method<T>(&self, v: &[T]) -> usize {
-        v.len()
-    }
-}
-
-fn main() {
-    let x = Test;
-    let v = &[0];
-    x.method::<i32, i32>(v); //~ ERROR E0036
-                             //~| NOTE Passed 2 type arguments, expected 1
-}
index de188677a1121ba4513916fa06d8313b6dd92902..db84a4edc487c98914f839dd8e9f92415f2d8a65 100644 (file)
@@ -9,14 +9,9 @@
 // except according to those terms.
 
 fn f() {}
-fn g<'a>() {}
+fn g<'a>() -> &'a u8 { loop {} }
 
 fn main() {
-    f::<'static>();
-    //~^ ERROR expected at most 0 lifetime parameters, found 1 lifetime parameter [E0088]
-    //~| NOTE expected 0 lifetime parameters
-
-    g::<'static, 'static>();
-    //~^ ERROR expected at most 0 lifetime parameters, found 2 lifetime parameters [E0088]
-    //~| NOTE expected 0 lifetime parameters
+    f::<'static>(); //~ ERROR E0088
+    g::<'static, 'static>(); //~ ERROR E0088
 }
diff --git a/src/test/compile-fail/cast-to-unsized-trait-object-suggestion.rs b/src/test/compile-fail/cast-to-unsized-trait-object-suggestion.rs
deleted file mode 100644 (file)
index d18746c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2015 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.
-
-fn main() {
-    &1 as Send;
-    //~^ ERROR cast to unsized type
-    //~| HELP try casting to a reference instead:
-    //~| SUGGESTION &1 as &Send;
-    Box::new(1) as Send;
-    //~^ ERROR cast to unsized type
-    //~| HELP try casting to a `Box` instead:
-    //~| SUGGESTION Box::new(1) as Box<Send>;
-}
diff --git a/src/test/compile-fail/const-size_of-cycle.rs b/src/test/compile-fail/const-size_of-cycle.rs
new file mode 100644 (file)
index 0000000..a58be33
--- /dev/null
@@ -0,0 +1,18 @@
+// 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.
+
+#![feature(const_fn)]
+
+struct Foo {
+    bytes: [u8; std::mem::size_of::<Foo>()]
+    //~^ ERROR unsupported cyclic reference between types/traits detected
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/constructor-lifetime-args.rs b/src/test/compile-fail/constructor-lifetime-args.rs
new file mode 100644 (file)
index 0000000..50db970
--- /dev/null
@@ -0,0 +1,36 @@
+// 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.
+
+// All lifetime parameters in struct constructors are currently considered early bound,
+// i.e. `S::<ARGS>` is interpreted kinda like an associated item `S::<ARGS>::ctor`.
+// This behavior is a bit weird, because if equivalent constructor were written manually
+// it would get late bound lifetime parameters.
+// Variant constructors behave in the same way, lifetime parameters are considered
+// belonging to the enum and being early bound.
+// https://github.com/rust-lang/rust/issues/30904
+
+struct S<'a, 'b>(&'a u8, &'b u8);
+enum E<'a, 'b> {
+    V(&'a u8),
+    U(&'b u8),
+}
+
+fn main() {
+    S(&0, &0); // OK
+    S::<'static>(&0, &0);
+    //~^ ERROR expected 2 lifetime parameters, found 1 lifetime parameter
+    S::<'static, 'static, 'static>(&0, &0);
+    //~^ ERROR expected at most 2 lifetime parameters, found 3 lifetime parameters
+    E::V(&0); // OK
+    E::V::<'static>(&0);
+    //~^ ERROR expected 2 lifetime parameters, found 1 lifetime parameter
+    E::V::<'static, 'static, 'static>(&0);
+    //~^ ERROR expected at most 2 lifetime parameters, found 3 lifetime parameters
+}
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-bench.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-bench.rs
new file mode 100644 (file)
index 0000000..a34f98f
--- /dev/null
@@ -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.
+
+// error-pattern: main function not found
+
+// At time of authorship, a crate-level #![bench] with no `--test`
+// will cause compilation to error unconditionally with "main function
+// not found" (despite having one), similar to #[bench].
+//
+// (The non-crate level cases are in
+// issue-43106-gating-of-builtin-attrs.rs.)
+
+// See issue-12997-1.rs and issue-12997-2.rs to see how `#[bench]` is
+// handled in "weird places" when `--test` is passed.
+
+#![bench                   = "4100"]
+
+fn main() { }
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs
new file mode 100644 (file)
index 0000000..29a2b06
--- /dev/null
@@ -0,0 +1,878 @@
+// 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.
+
+// This test enumerates as many compiler-builtin ungated attributes as
+// possible (that is, all the mutually compatible ones), and checks
+// that we get "expected" (*) warnings for each in the various weird
+// places that users might put them in the syntax.
+//
+// (*): The word "expected" is in quotes above because the cases where
+// warnings are and are not emitted might not match a user's intuition
+// nor the rustc developers' intent. I am really just trying to
+// capture today's behavior in a test, not so that it become enshrined
+// as the absolute behavior going forward, but rather so that we do
+// not change the behavior in the future without even being *aware* of
+// the change when it happens.
+//
+// At the time of authoring, the attributes here are listed in the
+// order that they occur in libsyntax/feature_gate.rs.
+//
+// Any builtin attributes that:
+//
+//  - are not stable, or
+//
+//  - could not be included here covering the same cases as the other
+//    attributes without raising an *error* from rustc (note though
+//    that warnings are of course expected)
+//
+// have their own test case referenced by filename in an inline
+// comment.
+//
+// The test feeds numeric inputs to each attribute that accepts them
+// without error. We do this for two reasons: (1.) to exercise how
+// inputs are handled by each, and (2.) to ease searching for related
+// occurrences in the source text.
+
+#![feature(rustc_attrs)] // For `rustc_error`; see note below.
+#![warn(unused_attributes, unknown_lints)]
+#![allow(dead_code)]
+
+// UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES
+
+#![warn                        (x5400)] //~ WARN unknown lint: `x5400`
+#![allow                       (x5300)] //~ WARN unknown lint: `x5300`
+#![forbid                      (x5200)] //~ WARN unknown lint: `x5200`
+#![deny                        (x5100)] //~ WARN unknown lint: `x5100`
+#![macro_reexport             = "5000"] //~ WARN unused attribute
+#![macro_use] // (allowed if no argument; see issue-43160-gating-of-macro_use.rs)
+#![macro_export               = "4800"] //~ WARN unused attribute
+#![plugin_registrar           = "4700"] //~ WARN unused attribute
+// skipping testing of cfg
+// skipping testing of cfg_attr
+#![main                      = "x4400"] //~ WARN unused attribute
+#![start                     = "x4300"] //~ WARN unused attribute
+// see issue-43106-gating-of-test.rs for crate-level; but non crate-level is below at "4200"
+// see issue-43106-gating-of-bench.rs for crate-level; but non crate-level is below at "4100"
+#![simd                       = "4000"] //~ WARN unused attribute
+#![repr                       = "3900"] //~ WARN unused attribute
+#![path                       = "3800"] //~ WARN unused attribute
+#![abi                        = "3700"] //~ WARN unused attribute
+#![automatically_derived      = "3600"] //~ WARN unused attribute
+#![no_mangle                  = "3500"]
+#![no_link                    = "3400"] //~ WARN unused attribute
+// see issue-43106-gating-of-derive.rs
+#![should_panic               = "3200"] //~ WARN unused attribute
+#![ignore                     = "3100"] //~ WARN unused attribute
+#![no_implicit_prelude        = "3000"]
+#![reexport_test_harness_main = "2900"]
+// see gated-link-args.rs
+// see issue-43106-gating-of-macro_escape.rs for crate-level; but non crate-level is below at "2700"
+// (cannot easily test gating of crate-level #[no_std]; but non crate-level is below at "2600")
+#![proc_macro_derive          = "2500"] //~ WARN unused attribute
+#![doc                        = "2400"]
+#![cold                       = "2300"]
+#![export_name                = "2200"]
+// see issue-43106-gating-of-inline.rs
+#![link                       = "2000"]
+#![link_name                  = "1900"]
+#![link_section               = "1800"]
+#![no_builtins                = "1700"] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "0300")
+#![no_mangle                  = "1600"] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "3500")
+// see issue-43106-gating-of-rustc_deprecated.rs
+#![must_use                   = "1400"]
+// see issue-43106-gating-of-stable.rs
+// see issue-43106-gating-of-unstable.rs
+// see issue-43106-gating-of-deprecated.rs
+#![windows_subsystem          = "1000"]
+
+// UNGATED CRATE-LEVEL BUILT-IN ATTRIBUTES
+
+#![crate_name                 = "0900"]
+#![crate_type                 = "bin"] // cannot pass "0800" here
+
+// For #![crate_id], see issue #43142. (I cannot bear to enshrine current behavior in a test)
+
+#![feature                    ( x0600)] //~ WARN unused or unknown feature
+
+// For #![no_start], see issue #43144. (I cannot bear to enshrine current behavior in a test)
+
+// (cannot easily gating state of crate-level #[no_main]; but non crate-level is below at "0400")
+#![no_builtins                = "0300"]
+#![recursion_limit            = "0200"]
+#![type_length_limit          = "0100"]
+
+// USES OF BUILT-IN ATTRIBUTES IN OTHER ("UNUSUAL") PLACES
+
+#[warn(x5400)]
+//~^ WARN unknown lint: `x5400`
+mod warn {
+    mod inner { #![warn(x5400)] }
+    //~^ WARN unknown lint: `x5400`
+
+    #[warn(x5400)] fn f() { }
+    //~^ WARN unknown lint: `x5400`
+
+    #[warn(x5400)] struct S;
+    //~^ WARN unknown lint: `x5400`
+
+    #[warn(x5400)] type T = S;
+    //~^ WARN unknown lint: `x5400`
+
+    #[warn(x5400)] impl S { }
+    //~^ WARN unknown lint: `x5400`
+}
+
+#[allow(x5300)]
+//~^ WARN unknown lint: `x5300`
+mod allow {
+    mod inner { #![allow(x5300)] }
+    //~^ WARN unknown lint: `x5300`
+
+    #[allow(x5300)] fn f() { }
+    //~^ WARN unknown lint: `x5300`
+
+    #[allow(x5300)] struct S;
+    //~^ WARN unknown lint: `x5300`
+
+    #[allow(x5300)] type T = S;
+    //~^ WARN unknown lint: `x5300`
+
+    #[allow(x5300)] impl S { }
+    //~^ WARN unknown lint: `x5300`
+}
+
+#[forbid(x5200)]
+//~^ WARN unknown lint: `x5200`
+mod forbid {
+    mod inner { #![forbid(x5200)] }
+    //~^ WARN unknown lint: `x5200`
+
+    #[forbid(x5200)] fn f() { }
+    //~^ WARN unknown lint: `x5200`
+
+    #[forbid(x5200)] struct S;
+    //~^ WARN unknown lint: `x5200`
+
+    #[forbid(x5200)] type T = S;
+    //~^ WARN unknown lint: `x5200`
+
+    #[forbid(x5200)] impl S { }
+    //~^ WARN unknown lint: `x5200`
+}
+
+#[deny(x5100)]
+//~^ WARN unknown lint: `x5100`
+mod deny {
+    mod inner { #![deny(x5100)] }
+    //~^ WARN unknown lint: `x5100`
+
+    #[deny(x5100)] fn f() { }
+    //~^ WARN unknown lint: `x5100`
+
+    #[deny(x5100)] struct S;
+    //~^ WARN unknown lint: `x5100`
+
+    #[deny(x5100)] type T = S;
+    //~^ WARN unknown lint: `x5100`
+
+    #[deny(x5100)] impl S { }
+    //~^ WARN unknown lint: `x5100`
+}
+
+#[macro_reexport = "5000"]
+//~^ WARN unused attribute
+mod macro_reexport {
+    mod inner { #![macro_reexport="5000"] }
+    //~^ WARN unused attribute
+
+    #[macro_reexport = "5000"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[macro_reexport = "5000"] struct S;
+    //~^ WARN unused attribute
+
+    #[macro_reexport = "5000"] type T = S;
+    //~^ WARN unused attribute
+
+    #[macro_reexport = "5000"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[macro_use]
+mod macro_use {
+    mod inner { #![macro_use] }
+
+    #[macro_use] fn f() { }
+    //~^ WARN unused attribute
+
+    #[macro_use] struct S;
+    //~^ WARN unused attribute
+
+    #[macro_use] type T = S;
+    //~^ WARN unused attribute
+
+    #[macro_use] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[macro_export = "4800"]
+//~^ WARN unused attribute
+mod macro_export {
+    mod inner { #![macro_export="4800"] }
+    //~^ WARN unused attribute
+
+    #[macro_export = "4800"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[macro_export = "4800"] struct S;
+    //~^ WARN unused attribute
+
+    #[macro_export = "4800"] type T = S;
+    //~^ WARN unused attribute
+
+    #[macro_export = "4800"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[plugin_registrar = "4700"]
+//~^ WARN unused attribute
+mod plugin_registrar {
+    mod inner { #![plugin_registrar="4700"] }
+    //~^ WARN unused attribute
+
+    // for `fn f()` case, see gated-plugin_registrar.rs
+
+    #[plugin_registrar = "4700"] struct S;
+    //~^ WARN unused attribute
+
+    #[plugin_registrar = "4700"] type T = S;
+    //~^ WARN unused attribute
+
+    #[plugin_registrar = "4700"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[main = "4400"]
+//~^ WARN unused attribute
+mod main {
+    mod inner { #![main="4300"] }
+    //~^ WARN unused attribute
+
+    // for `fn f()` case, see feature-gate-main.rs
+
+    #[main = "4400"] struct S;
+    //~^ WARN unused attribute
+
+    #[main = "4400"] type T = S;
+    //~^ WARN unused attribute
+
+    #[main = "4400"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[start = "4300"]
+//~^ WARN unused attribute
+mod start {
+    mod inner { #![start="4300"] }
+    //~^ WARN unused attribute
+
+    // for `fn f()` case, see feature-gate-start.rs
+
+    #[start = "4300"] struct S;
+    //~^ WARN unused attribute
+
+    #[start = "4300"] type T = S;
+    //~^ WARN unused attribute
+
+    #[start = "4300"] impl S { }
+    //~^ WARN unused attribute
+}
+
+// At time of unit test authorship, if compiling without `--test` then
+// non-crate-level #[test] attributes seem to be ignored.
+
+#[test = "4200"]
+mod test { mod inner { #![test="4200"] }
+
+    fn f() { }
+
+    struct S;
+
+    type T = S;
+
+    impl S { }
+}
+
+// At time of unit test authorship, if compiling without `--test` then
+// non-crate-level #[bench] attributes seem to be ignored.
+
+#[bench = "4100"]
+mod bench {
+    mod inner { #![bench="4100"] }
+
+    #[bench = "4100"]
+    struct S;
+
+    #[bench = "4100"]
+    type T = S;
+
+    #[bench = "4100"]
+    impl S { }
+}
+
+#[simd = "4000"]
+//~^ WARN unused attribute
+mod simd {
+    mod inner { #![simd="4000"] }
+    //~^ WARN unused attribute
+
+    #[simd = "4000"] fn f() { }
+    //~^ WARN unused attribute
+
+    struct S; // for `struct S` case, see feature-gate-repr-simd.rs
+
+    #[simd = "4000"] type T = S;
+    //~^ WARN unused attribute
+
+    #[simd = "4000"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[repr = "3900"]
+//~^ WARN unused attribute
+mod repr {
+    mod inner { #![repr="3900"] }
+    //~^ WARN unused attribute
+
+    #[repr = "3900"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[repr = "3900"] struct S;
+    //~^ WARN unused attribute
+
+    #[repr = "3900"] type T = S;
+    //~^ WARN unused attribute
+
+    #[repr = "3900"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[path = "3800"]
+mod path {
+    mod inner { #![path="3800"] }
+
+    #[path = "3800"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[path = "3800"]  struct S;
+    //~^ WARN unused attribute
+
+    #[path = "3800"] type T = S;
+    //~^ WARN unused attribute
+
+    #[path = "3800"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[abi = "3700"]
+//~^ WARN unused attribute
+mod abi {
+    mod inner { #![abi="3700"] }
+    //~^ WARN unused attribute
+
+    #[abi = "3700"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[abi = "3700"] struct S;
+    //~^ WARN unused attribute
+
+    #[abi = "3700"] type T = S;
+    //~^ WARN unused attribute
+
+    #[abi = "3700"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[automatically_derived = "3600"]
+//~^ WARN unused attribute
+mod automatically_derived {
+    mod inner { #![automatically_derived="3600"] }
+    //~^ WARN unused attribute
+
+    #[automatically_derived = "3600"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[automatically_derived = "3600"] struct S;
+    //~^ WARN unused attribute
+
+    #[automatically_derived = "3600"] type T = S;
+    //~^ WARN unused attribute
+
+    #[automatically_derived = "3600"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[no_mangle = "3500"]
+mod no_mangle {
+    mod inner { #![no_mangle="3500"] }
+
+    #[no_mangle = "3500"] fn f() { }
+    //~^ WARN function f is marked #[no_mangle], but not exported
+
+    #[no_mangle = "3500"] struct S;
+
+    #[no_mangle = "3500"] type T = S;
+
+    #[no_mangle = "3500"] impl S { }
+}
+
+#[no_link = "3400"]
+//~^ WARN unused attribute
+mod no_link {
+    mod inner { #![no_link="3400"] }
+    //~^ WARN unused attribute
+
+    #[no_link = "3400"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[no_link = "3400"] struct S;
+    //~^ WARN unused attribute
+
+    #[no_link = "3400"]type T = S;
+    //~^ WARN unused attribute
+
+    #[no_link = "3400"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[should_panic = "3200"]
+//~^ WARN unused attribute
+mod should_panic {
+    mod inner { #![should_panic="3200"] }
+    //~^ WARN unused attribute
+
+    #[should_panic = "3200"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[should_panic = "3200"] struct S;
+    //~^ WARN unused attribute
+
+    #[should_panic = "3200"] type T = S;
+    //~^ WARN unused attribute
+
+    #[should_panic = "3200"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[ignore = "3100"]
+//~^ WARN unused attribute
+mod ignore {
+    mod inner { #![ignore="3100"] }
+    //~^ WARN unused attribute
+
+    #[ignore = "3100"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[ignore = "3100"] struct S;
+    //~^ WARN unused attribute
+
+    #[ignore = "3100"] type T = S;
+    //~^ WARN unused attribute
+
+    #[ignore = "3100"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[no_implicit_prelude = "3000"]
+//~^ WARN unused attribute
+mod no_implicit_prelude {
+    mod inner { #![no_implicit_prelude="3000"] }
+    //~^ WARN unused attribute
+
+    #[no_implicit_prelude = "3000"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[no_implicit_prelude = "3000"] struct S;
+    //~^ WARN unused attribute
+
+    #[no_implicit_prelude = "3000"] type T = S;
+    //~^ WARN unused attribute
+
+    #[no_implicit_prelude = "3000"] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[reexport_test_harness_main = "2900"]
+//~^ WARN unused attribute
+mod reexport_test_harness_main {
+    mod inner { #![reexport_test_harness_main="2900"] }
+    //~^ WARN unused attribute
+
+    #[reexport_test_harness_main = "2900"] fn f() { }
+    //~^ WARN unused attribute
+
+    #[reexport_test_harness_main = "2900"] struct S;
+    //~^ WARN unused attribute
+
+    #[reexport_test_harness_main = "2900"] type T = S;
+    //~^ WARN unused attribute
+
+    #[reexport_test_harness_main = "2900"] impl S { }
+    //~^ WARN unused attribute
+}
+
+// Cannnot feed "2700" to `#[macro_escape]` without signaling an error.
+#[macro_escape]
+//~^ WARN macro_escape is a deprecated synonym for macro_use
+mod macro_escape {
+    mod inner { #![macro_escape] }
+    //~^ WARN macro_escape is a deprecated synonym for macro_use
+
+    #[macro_escape] fn f() { }
+    //~^ WARN unused attribute
+
+    #[macro_escape] struct S;
+    //~^ WARN unused attribute
+
+    #[macro_escape] type T = S;
+    //~^ WARN unused attribute
+
+    #[macro_escape] impl S { }
+    //~^ WARN unused attribute
+}
+
+#[no_std = "2600"]
+//~^ WARN unused attribute
+//~| WARN crate-level attribute should be an inner attribute
+mod no_std {
+    mod inner { #![no_std="2600"] }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be in the root module
+
+    #[no_std = "2600"] fn f() { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[no_std = "2600"] struct S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[no_std = "2600"] type T = S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[no_std = "2600"] impl S { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+}
+
+// At time of authorship, #[proc_macro_derive = "2500"] signals error
+// when it occurs on a mod (apart from crate-level). Therefore it goes
+// into its own file; see issue-43106-gating-of-proc_macro_derive.rs
+
+#[doc = "2400"]
+mod doc {
+    mod inner { #![doc="2400"] }
+
+    #[doc = "2400"] fn f() { }
+
+    #[doc = "2400"] struct S;
+
+    #[doc = "2400"] type T = S;
+
+    #[doc = "2400"] impl S { }
+}
+
+#[cold = "2300"]
+mod cold {
+    mod inner { #![cold="2300"] }
+
+    #[cold = "2300"] fn f() { }
+
+    #[cold = "2300"] struct S;
+
+    #[cold = "2300"] type T = S;
+
+    #[cold = "2300"] impl S { }
+}
+
+#[export_name = "2200"]
+mod export_name {
+    mod inner { #![export_name="2200"] }
+
+    #[export_name = "2200"] fn f() { }
+
+    #[export_name = "2200"] struct S;
+
+    #[export_name = "2200"] type T = S;
+
+    #[export_name = "2200"] impl S { }
+}
+
+// Note that this test ends with a `#[rustc_error] fn main()`, so it
+// will never invoke the linker. These are here nonetheless to point
+// out that we allow them at non-crate-level (though I do not know
+// whether they have the same effect here as at crate-level).
+
+#[link = "2000"]
+mod link {
+    mod inner { #![link="2000"] }
+
+    #[link = "2000"] fn f() { }
+
+    #[link = "2000"] struct S;
+
+    #[link = "2000"] type T = S;
+
+    #[link = "2000"] impl S { }
+}
+
+#[link_name = "1900"]
+mod link_name {
+    mod inner { #![link_name="1900"] }
+
+    #[link_name = "1900"] fn f() { }
+
+    #[link_name = "1900"] struct S;
+
+    #[link_name = "1900"] type T = S;
+
+    #[link_name = "1900"] impl S { }
+}
+
+#[link_section = "1800"]
+mod link_section {
+    mod inner { #![link_section="1800"] }
+
+    #[link_section = "1800"] fn f() { }
+
+    #[link_section = "1800"] struct S;
+
+    #[link_section = "1800"] type T = S;
+
+    #[link_section = "1800"] impl S { }
+}
+
+struct StructForDeprecated;
+
+#[deprecated = "1500"]
+mod deprecated {
+    mod inner { #![deprecated="1500"] }
+
+    #[deprecated = "1500"] fn f() { }
+
+    #[deprecated = "1500"] struct S1;
+
+    #[deprecated = "1500"] type T = super::StructForDeprecated;
+
+    #[deprecated = "1500"] impl super::StructForDeprecated { }
+}
+
+#[must_use = "1400"]
+mod must_use {
+    mod inner { #![must_use="1400"] }
+
+    #[must_use = "1400"] fn f() { }
+
+    #[must_use = "1400"] struct S;
+
+    #[must_use = "1400"] type T = S;
+
+    #[must_use = "1400"] impl S { }
+}
+
+#[windows_subsystem = "1000"]
+mod windows_subsystem {
+    mod inner { #![windows_subsystem="1000"] }
+
+    #[windows_subsystem = "1000"] fn f() { }
+
+    #[windows_subsystem = "1000"] struct S;
+
+    #[windows_subsystem = "1000"] type T = S;
+
+    #[windows_subsystem = "1000"] impl S { }
+}
+
+// BROKEN USES OF CRATE-LEVEL BUILT-IN ATTRIBUTES
+
+#[crate_name = "0900"]
+//~^ WARN unused attribute
+//~| WARN crate-level attribute should be an inner attribute
+mod crate_name {
+    mod inner { #![crate_name="0900"] }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be in the root module
+
+    #[crate_name = "0900"] fn f() { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[crate_name = "0900"] struct S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[crate_name = "0900"] type T = S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[crate_name = "0900"] impl S { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+}
+
+#[crate_type = "0800"]
+//~^ WARN unused attribute
+//~| WARN crate-level attribute should be an inner attribute
+mod crate_type {
+    mod inner { #![crate_type="0800"] }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be in the root module
+
+    #[crate_type = "0800"] fn f() { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[crate_type = "0800"] struct S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[crate_type = "0800"] type T = S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[crate_type = "0800"] impl S { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+}
+
+#[feature(x0600)]
+//~^ WARN unused attribute
+//~| WARN crate-level attribute should be an inner attribute
+mod feature {
+    mod inner { #![feature(x0600)] }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be in the root module
+
+    #[feature(x0600)] fn f() { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[feature(x0600)] struct S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[feature(x0600)] type T = S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[feature(x0600)] impl S { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+}
+
+
+#[no_main = "0400"]
+//~^ WARN unused attribute
+//~| WARN crate-level attribute should be an inner attribute
+mod no_main_1 {
+    mod inner { #![no_main="0400"] }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be in the root module
+
+    #[no_main = "0400"] fn f() { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[no_main = "0400"] struct S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[no_main = "0400"] type T = S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[no_main = "0400"] impl S { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+}
+
+#[no_builtins = "0300"]
+mod no_builtins {
+    mod inner { #![no_builtins="0200"] }
+
+    #[no_builtins = "0300"] fn f() { }
+
+    #[no_builtins = "0300"] struct S;
+
+    #[no_builtins = "0300"] type T = S;
+
+    #[no_builtins = "0300"] impl S { }
+}
+
+#[recursion_limit="0200"]
+//~^ WARN unused attribute
+//~| WARN crate-level attribute should be an inner attribute
+mod recursion_limit {
+    mod inner { #![recursion_limit="0200"] }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be in the root module
+
+    #[recursion_limit="0200"] fn f() { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[recursion_limit="0200"] struct S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[recursion_limit="0200"] type T = S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[recursion_limit="0200"] impl S { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+}
+
+#[type_length_limit="0100"]
+//~^ WARN unused attribute
+//~| WARN crate-level attribute should be an inner attribute
+mod type_length_limit {
+    mod inner { #![type_length_limit="0100"] }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be in the root module
+
+    #[type_length_limit="0100"] fn f() { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[type_length_limit="0100"] struct S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[type_length_limit="0100"] type T = S;
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+
+    #[type_length_limit="0100"] impl S { }
+    //~^ WARN unused attribute
+    //~| WARN crate-level attribute should be an inner attribute
+}
+
+// Since we expect for the mix of attributes used here to compile
+// successfully, and we are just testing for the expected warnings of
+// various (mis)uses of attributes, we use the `rustc_error` attribute
+// on the `fn main()`.
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+    println!("Hello World");
+}
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-deprecated.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-deprecated.rs
new file mode 100644 (file)
index 0000000..98da43c
--- /dev/null
@@ -0,0 +1,31 @@
+// 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.
+
+// This test just shows that a crate-level `#![deprecated]` does not
+// signal a warning or error. (This file sits on its own because a
+// crate-level `#![deprecated]` causes all that crate's item
+// definitions to be deprecated, which is a pain to work with.)
+//
+// (For non-crate-level cases, see issue-43106-gating-of-builtin-attrs.rs)
+
+#![feature(rustc_attrs)] // For `rustc_error`; see note below.
+#![allow(dead_code)]
+
+#![deprecated           = "1100"]
+
+// Since we expect for the mix of attributes used here to compile
+// successfully, and we are just testing for the expected warnings of
+// various (mis)uses of attributes, we use the `rustc_error` attribute
+// on the `fn main()`.
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+    println!("Hello World");
+}
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-derive-2.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-derive-2.rs
new file mode 100644 (file)
index 0000000..be82d0a
--- /dev/null
@@ -0,0 +1,47 @@
+// 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.
+
+// `#![derive]` is interpreted (and raises errors) when it occurs at
+// contexts other than ADT definitions. This test checks cases where
+// the derive-macro does not exist.
+
+#![derive(x3300)]
+//~^ ERROR cannot find derive macro `x3300` in this scope
+
+#[derive(x3300)]
+//~^ ERROR cannot find derive macro `x3300` in this scope
+mod derive {
+    mod inner { #![derive(x3300)] }
+    //~^ ERROR cannot find derive macro `x3300` in this scope
+
+    #[derive(x3300)]
+    //~^ ERROR cannot find derive macro `x3300` in this scope
+    fn derive() { }
+
+    #[derive(x3300)]
+    //~^ ERROR cannot find derive macro `x3300` in this scope
+    union U { f: i32 }
+
+    #[derive(x3300)]
+    //~^ ERROR cannot find derive macro `x3300` in this scope
+    enum E { }
+
+    #[derive(x3300)]
+    //~^ ERROR cannot find derive macro `x3300` in this scope
+    struct S;
+
+    #[derive(x3300)]
+    //~^ ERROR cannot find derive macro `x3300` in this scope
+    type T = S;
+
+    #[derive(x3300)]
+    //~^ ERROR cannot find derive macro `x3300` in this scope
+    impl S { }
+}
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-derive.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-derive.rs
new file mode 100644 (file)
index 0000000..41c3d0e
--- /dev/null
@@ -0,0 +1,44 @@
+// 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.
+
+// `#![derive]` is interpreted (and raises errors) when it occurs at
+// contexts other than ADT definitions. This test checks cases where
+// the derive-macro exists.
+
+#![derive(Debug)]
+//~^ ERROR `derive` may only be applied to structs, enums and unions
+
+#[derive(Debug)]
+//~^ ERROR `derive` may only be applied to structs, enums and unions
+mod derive {
+    mod inner { #![derive(Debug)] }
+    //~^ ERROR `derive` may only be applied to structs, enums and unions
+
+    #[derive(Debug)]
+    //~^ ERROR `derive` may only be applied to structs, enums and unions
+    fn derive() { }
+
+    #[derive(Copy, Clone)] // (can't derive Debug for unions)
+    union U { f: i32 }
+
+    #[derive(Debug)]
+    struct S;
+
+    #[derive(Debug)]
+    enum E { }
+
+    #[derive(Debug)]
+    //~^ ERROR `derive` may only be applied to structs, enums and unions
+    type T = S;
+
+    #[derive(Debug)]
+    //~^ ERROR `derive` may only be applied to structs, enums and unions
+    impl S { }
+}
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-inline.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-inline.rs
new file mode 100644 (file)
index 0000000..24e77bf
--- /dev/null
@@ -0,0 +1,37 @@
+// 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.
+
+// This is testing whether `#[inline]` signals an error or warning
+// when put in "weird" places.
+//
+// (This file sits on its own because it actually signals an error,
+// which would mess up the treatment of other cases in
+// issue-43106-gating-of-builtin-attrs.rs)
+
+// Crate-level is accepted, though it is almost certainly unused?
+#![inline                     = "2100"]
+
+#[inline = "2100"]
+//~^ ERROR attribute should be applied to function
+mod inline {
+    mod inner { #![inline="2100"] }
+    //~^ ERROR attribute should be applied to function
+
+    #[inline = "2100"] fn f() { }
+
+    #[inline = "2100"] struct S;
+    //~^ ERROR attribute should be applied to function
+
+    #[inline = "2100"] type T = S;
+    //~^ ERROR attribute should be applied to function
+
+    #[inline = "2100"] impl S { }
+    //~^ ERROR attribute should be applied to function
+}
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_escape.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_escape.rs
new file mode 100644 (file)
index 0000000..3b2dbde
--- /dev/null
@@ -0,0 +1,17 @@
+// 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.
+
+// Testing that crate-level `#![macro_escape]` is not gated beyond a
+// depecation warning.  This file sits on its own, because crate-level
+// `#![macro_escape]` is incompatible with crate-level `#![macro_use]`
+// already present in issue-43106-gating-of-builtin-attrs.
+
+#![macro_escape]
+//~^ WARN macro_escape is a deprecated synonym for macro_use
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_use.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_use.rs
new file mode 100644 (file)
index 0000000..cf5619d
--- /dev/null
@@ -0,0 +1,33 @@
+// 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.
+
+// This is just a check-list of the cases where feeding arguments to
+// `#[macro_use]` is rejected. (The cases where no error is emitted
+// corresponds to cases where the attribute is currently unused, so we
+// get that warning; see issue-43106-gating-of-builtin-attrs.rs
+
+#![macro_use                  = "4900"] //~ ERROR arguments to macro_use are not allowed here
+
+#[macro_use = "2700"]
+//~^ ERROR arguments to macro_use are not allowed here
+mod macro_escape {
+    mod inner { #![macro_use="2700"] }
+    //~^ ERROR arguments to macro_use are not allowed here
+
+    #[macro_use = "2700"] fn f() { }
+
+    #[macro_use = "2700"] struct S;
+
+    #[macro_use = "2700"] type T = S;
+
+    #[macro_use = "2700"] impl S { }
+}
+
+fn main() { }
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-proc_macro_derive.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-proc_macro_derive.rs
new file mode 100644 (file)
index 0000000..133f70e
--- /dev/null
@@ -0,0 +1,42 @@
+// 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.
+
+// At time of authorship, #[proc_macro_derive = "2500"] will emit an
+// error when it occurs on a mod (apart from crate-level), but will
+// not descend further into the mod for other occurrences of the same
+// error.
+//
+// This file sits on its own because the the "weird" occurrences here
+// signal errors, making it incompatible with the "warnings only"
+// nature of issue-43106-gating-of-builtin-attrs.rs
+
+#[proc_macro_derive = "2500"]
+//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
+mod proc_macro_derive1 {
+    mod inner { #![proc_macro_derive="2500"] }
+    // (no error issued here if there was one on outer module)
+}
+
+mod proc_macro_derive2 {
+    mod inner { #![proc_macro_derive="2500"] }
+    //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
+
+    #[proc_macro_derive = "2500"] fn f() { }
+    //~^ ERROR the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro`
+
+    #[proc_macro_derive = "2500"] struct S;
+    //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
+
+    #[proc_macro_derive = "2500"] type T = S;
+    //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
+
+    #[proc_macro_derive = "2500"] impl S { }
+    //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
+}
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs
new file mode 100644 (file)
index 0000000..4709ec2
--- /dev/null
@@ -0,0 +1,39 @@
+// 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.
+
+// Testing gating of `#[rustc_deprecated]` in "weird" places.
+//
+// This file sits on its own because these signal errors, making
+// this test incompatible with the "warnings only" nature of
+// issue-43106-gating-of-builtin-attrs.rs
+
+#![rustc_deprecated           = "1500"]
+//~^ ERROR stability attributes may not be used outside of the standard library
+
+#[rustc_deprecated = "1500"]
+//~^ ERROR stability attributes may not be used outside of the standard library
+mod rustc_deprecated {
+    mod inner { #![rustc_deprecated="1500"] }
+    //~^ ERROR stability attributes may not be used outside of the standard library
+
+    #[rustc_deprecated = "1500"] fn f() { }
+    //~^ ERROR stability attributes may not be used outside of the standard library
+
+    #[rustc_deprecated = "1500"] struct S;
+    //~^ ERROR stability attributes may not be used outside of the standard library
+    //~| ERROR stability attributes may not be used outside of the standard library
+
+    #[rustc_deprecated = "1500"] type T = S;
+    //~^ ERROR stability attributes may not be used outside of the standard library
+
+    #[rustc_deprecated = "1500"] impl S { }
+    //~^ ERROR stability attributes may not be used outside of the standard library
+}
+
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs
new file mode 100644 (file)
index 0000000..9627d32
--- /dev/null
@@ -0,0 +1,38 @@
+// 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.
+
+// Testing gating of `#[stable]` in "weird" places.
+//
+// This file sits on its own because these signal errors, making
+// this test incompatible with the "warnings only" nature of
+// issue-43106-gating-of-builtin-attrs.rs
+
+#![stable                     = "1300"]
+//~^ ERROR stability attributes may not be used outside of the standard library
+
+#[stable = "1300"]
+//~^ ERROR stability attributes may not be used outside of the standard library
+mod stable {
+    mod inner { #![stable="1300"] }
+    //~^ ERROR stability attributes may not be used outside of the standard library
+
+    #[stable = "1300"] fn f() { }
+    //~^ ERROR stability attributes may not be used outside of the standard library
+
+    #[stable = "1300"] struct S;
+    //~^ ERROR stability attributes may not be used outside of the standard library
+    //~| ERROR stability attributes may not be used outside of the standard library
+
+    #[stable = "1300"] type T = S;
+    //~^ ERROR stability attributes may not be used outside of the standard library
+
+    #[stable = "1300"] impl S { }
+    //~^ ERROR stability attributes may not be used outside of the standard library
+}
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-test.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-test.rs
new file mode 100644 (file)
index 0000000..adcbfe7
--- /dev/null
@@ -0,0 +1,22 @@
+// 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.
+
+// error-pattern: main function not found
+
+// At time of authorship, crate-level #[test] attribute with no
+// `--test` signals unconditional error complaining of missing main
+// function (despite having one), similar to #[bench].
+//
+// (The non-crate level cases are in
+// issue-43106-gating-of-builtin-attrs.rs.)
+
+#![test                    = "4200"]
+
+fn main() { }
diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs
new file mode 100644 (file)
index 0000000..0708dc8
--- /dev/null
@@ -0,0 +1,38 @@
+// 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.
+
+// Testing gating of `#[unstable]` in "weird" places.
+//
+// This file sits on its own because these signal errors, making
+// this test incompatible with the "warnings only" nature of
+// issue-43106-gating-of-builtin-attrs.rs
+
+#![unstable                   = "1200"]
+//~^ ERROR stability attributes may not be used outside of the standard library
+
+#[unstable = "1200"]
+//~^ ERROR stability attributes may not be used outside of the standard library
+mod unstable {
+    mod inner { #![unstable="1200"] }
+    //~^ ERROR stability attributes may not be used outside of the standard library
+
+    #[unstable = "1200"] fn f() { }
+    //~^ ERROR stability attributes may not be used outside of the standard library
+
+    #[unstable = "1200"] struct S;
+    //~^ ERROR stability attributes may not be used outside of the standard library
+    //~| ERROR stability attributes may not be used outside of the standard library
+
+    #[unstable = "1200"] type T = S;
+    //~^ ERROR stability attributes may not be used outside of the standard library
+
+    #[unstable = "1200"] impl S { }
+    //~^ ERROR stability attributes may not be used outside of the standard library
+}
index 001c1f2eddca1e3ccbeabaf58450b6296547847c..c09e56cbc5bcaeeaf15e7238b45e82bc8cd55e33 100644 (file)
 enum Fruit { //~ HELP possible candidate is found in another module, you can import it into scope
     //~^ HELP possible candidate is found in another module, you can import it into scope
     Apple(i64),
-    //~^ HELP there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
-    //~| HELP there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
     Orange(i64),
 }
 
 fn should_return_fruit() -> Apple {
     //~^ ERROR cannot find type `Apple` in this scope
     //~| NOTE not found in this scope
+    //~| HELP you can try using the variant's enum
     Apple(5)
     //~^ ERROR cannot find function `Apple` in this scope
     //~| NOTE not found in this scope
@@ -27,6 +26,7 @@ fn should_return_fruit() -> Apple {
 
 fn should_return_fruit_too() -> Fruit::Apple {
     //~^ ERROR expected type, found variant `Fruit::Apple`
+    //~| HELP you can try using the variant's enum
     //~| NOTE not a type
     Apple(5)
     //~^ ERROR cannot find function `Apple` in this scope
@@ -43,6 +43,7 @@ fn foo() -> Ok {
 
 fn bar() -> Variant3 {
     //~^ ERROR cannot find type `Variant3` in this scope
+    //~| HELP you can try using the variant's enum
     //~| NOTE not found in this scope
 }
 
@@ -61,7 +62,6 @@ enum Enum {
         Variant1,
         Variant2(),
         Variant3(usize),
-        //~^ HELP there is an enum variant `x::Enum::Variant3`, did you mean to use `x::Enum`?
         Variant4 {},
     }
 }
diff --git a/src/test/compile-fail/macro-name-typo.rs b/src/test/compile-fail/macro-name-typo.rs
deleted file mode 100644 (file)
index 4840205..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2015 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.
-
-fn main() {
-    printlx!("oh noes!");
-    //~^ ERROR cannot find macro
-    //~^^ HELP did you mean `println!`?
-}
diff --git a/src/test/compile-fail/macro_undefined.rs b/src/test/compile-fail/macro_undefined.rs
deleted file mode 100644 (file)
index 00c8d44..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2014 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.
-
-// Test macro_undefined issue
-
-mod m {
-    #[macro_export]
-    macro_rules! kl {
-        () => ()
-    }
-}
-
-fn main() {
-    k!();
-    //~^ ERROR cannot find macro `k!` in this scope
-    //~^^ HELP did you mean `kl!`?
-    kl!();
-    //~^ ERROR cannot find macro `kl!` in this scope
-    //~^^ HELP have you added the `#[macro_use]` on the module/import?
-}
diff --git a/src/test/compile-fail/method-call-lifetime-args-lint.rs b/src/test/compile-fail/method-call-lifetime-args-lint.rs
new file mode 100644 (file)
index 0000000..b2a94e0
--- /dev/null
@@ -0,0 +1,97 @@
+// 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.
+
+#![deny(late_bound_lifetime_arguments)]
+#![allow(unused)]
+
+struct S;
+
+impl S {
+    fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {}
+    fn late_implicit(self, _: &u8, _: &u8) {}
+    fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} }
+    fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} }
+
+    // 'late lifetimes here belong to nested types not to the tested functions.
+    fn early_tricky_explicit<'a>(_: for<'late> fn(&'late u8),
+                                 _: Box<for<'late> Fn(&'late u8)>)
+                                 -> &'a u8 { loop {} }
+    fn early_tricky_implicit<'a>(_: fn(&u8),
+                                 _: Box<Fn(&u8)>)
+                                 -> &'a u8 { loop {} }
+}
+
+fn method_call() {
+    S.late(&0, &0); // OK
+    S.late::<'static>(&0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+    S.late::<'static, 'static>(&0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+    S.late::<'static, 'static, 'static>(&0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+    S.late_early(&0); // OK
+    S.late_early::<'static>(&0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+    S.late_early::<'static, 'static>(&0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+    S.late_early::<'static, 'static, 'static>(&0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+
+    S.late_implicit(&0, &0); // OK
+    S.late_implicit::<'static>(&0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+    S.late_implicit::<'static, 'static>(&0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+    S.late_implicit::<'static, 'static, 'static>(&0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+    S.late_implicit_early(&0); // OK
+    S.late_implicit_early::<'static>(&0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+    S.late_implicit_early::<'static, 'static>(&0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+    S.late_implicit_early::<'static, 'static, 'static>(&0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+
+    S::early_tricky_explicit::<'static>(loop {}, loop {}); // OK
+    S::early_tricky_implicit::<'static>(loop {}, loop {}); // OK
+}
+
+fn ufcs() {
+    S::late_early::<'static>(S, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+
+    S::late_implicit_early::<'static>(S, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+}
+
+fn lint_not_inference_error() {
+    fn f<'early, 'late, T: 'early>() {}
+
+    // Make sure `u8` is substituted and not replaced with an inference variable
+    f::<'static, u8>;
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    //~| WARN this was previously accepted
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/method-call-lifetime-args-subst-index.rs b/src/test/compile-fail/method-call-lifetime-args-subst-index.rs
new file mode 100644 (file)
index 0000000..a9505e4
--- /dev/null
@@ -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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+struct S;
+
+impl S {
+    fn early_and_type<'a, T>(self) -> &'a T { loop {} }
+}
+
+fn test() {
+    S.early_and_type::<u16>();
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/method-call-lifetime-args-unresolved.rs b/src/test/compile-fail/method-call-lifetime-args-unresolved.rs
new file mode 100644 (file)
index 0000000..4910bfa
--- /dev/null
@@ -0,0 +1,13 @@
+// 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.
+
+fn main() {
+    0.clone::<'a>(); //~ ERROR use of undeclared lifetime name `'a`
+}
diff --git a/src/test/compile-fail/method-call-lifetime-args.rs b/src/test/compile-fail/method-call-lifetime-args.rs
new file mode 100644 (file)
index 0000000..f0a87c7
--- /dev/null
@@ -0,0 +1,82 @@
+// 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.
+
+struct S;
+
+impl S {
+    fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {}
+    fn late_implicit(self, _: &u8, _: &u8) {}
+    fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} }
+    fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} }
+    fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} }
+    fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} }
+    fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} }
+    fn life_and_type<'a, T>(self) -> &'a T { loop {} }
+}
+
+fn method_call() {
+    S.early(); // OK
+    S.early::<'static>();
+    //~^ ERROR expected 2 lifetime parameters, found 1 lifetime parameter
+    S.early::<'static, 'static, 'static>();
+    //~^ ERROR expected at most 2 lifetime parameters, found 3 lifetime parameters
+    let _: &u8 = S.life_and_type::<'static>();
+    S.life_and_type::<u8>();
+    S.life_and_type::<'static, u8>();
+}
+
+fn ufcs() {
+    S::late(S, &0, &0); // OK
+    S::late::<'static>(S, &0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late::<'static, 'static>(S, &0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late::<'static, 'static, 'static>(S, &0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late_early(S, &0); // OK
+    S::late_early::<'static, 'static>(S, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late_early::<'static, 'static, 'static>(S, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+
+    S::late_implicit(S, &0, &0); // OK
+    S::late_implicit::<'static>(S, &0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late_implicit::<'static, 'static>(S, &0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late_implicit::<'static, 'static, 'static>(S, &0, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late_implicit_early(S, &0); // OK
+    S::late_implicit_early::<'static, 'static>(S, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late_implicit_early::<'static, 'static, 'static>(S, &0);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late_implicit_self_early(&S); // OK
+    S::late_implicit_self_early::<'static, 'static>(&S);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late_implicit_self_early::<'static, 'static, 'static>(&S);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late_unused_early(S); // OK
+    S::late_unused_early::<'static, 'static>(S);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+    S::late_unused_early::<'static, 'static, 'static>(S);
+    //~^ ERROR cannot specify lifetime arguments explicitly
+
+    S::early(S); // OK
+    S::early::<'static>(S);
+    //~^ ERROR expected 2 lifetime parameters, found 1 lifetime parameter
+    S::early::<'static, 'static, 'static>(S);
+    //~^ ERROR expected at most 2 lifetime parameters, found 3 lifetime parameters
+    let _: &u8 = S::life_and_type::<'static>(S);
+    S::life_and_type::<u8>(S);
+    S::life_and_type::<'static, u8>(S);
+}
+
+fn main() {}
index acffb06ebecf2cc4cbfdef6441e2cd8cf9d1190a..3ae878ed1cbc0659929d47885f8daaa90ce154ab 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 fn main() {
-    0.clone::<T = u8>(); //~ ERROR type bindings cannot be used in method calls
+    0.clone::<T = u8>(); //~ ERROR unexpected binding of associated item
 }
index 2d4df77f960452a126928ce40ee05fb108324012..b08aab6da852a71c6dfd3db0dce616c0d737a18b 100644 (file)
@@ -15,9 +15,8 @@ impl bar for i32 { fn dup(&self) -> i32 { *self } fn blah<X>(&self) {} }
 impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah<X>(&self) {} }
 
 fn main() {
-    10.dup::<i32>(); //~ ERROR does not take type parameters
-    10.blah::<i32, i32>();
-    //~^ ERROR incorrect number of type parameters given for this method: expected 1, found 2
+    10.dup::<i32>(); //~ ERROR expected at most 0 type parameters, found 1 type parameter
+    10.blah::<i32, i32>(); //~ ERROR expected at most 1 type parameter, found 2 type parameters
     (box 10 as Box<bar>).dup();
     //~^ ERROR E0038
     //~| ERROR E0038
index 899aefa24a033b0e3d4eeeb666b96c7e3b9c86d2..daddc0c9f5459a3af5c09c80158be76b96651db5 100644 (file)
@@ -369,7 +369,7 @@ pub fn add_lifetime_parameter_to_method(&self) { }
 impl Foo {
     #[rustc_dirty(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
-    #[rustc_metadata_clean(cfg="cfail2")] // Apparently unused lifetimes don't show up in the type.
+    #[rustc_metadata_clean(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     pub fn add_lifetime_parameter_to_method<'a>(&self) { }
 }
index e47556a790b62652835cc525e652fb5e69536da2..44950ee8a601f90865698e22d955bc9a07344bf5 100644 (file)
@@ -448,7 +448,7 @@ trait TraitAddLifetimeParameterToMethod {
 trait TraitAddLifetimeParameterToMethod {
     #[rustc_dirty(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
-    #[rustc_metadata_clean(cfg="cfail2")] // Unused lifetimes don't seem to show up in type?
+    #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     fn method<'a>();
 }
index e35c3873f7eb5a23554fb3a10e40e98face92db5..1f3c64c8c322dd3459f2cc82345ccc5116cb2caf 100644 (file)
@@ -10,5 +10,5 @@
 
 fn main() {
     let xs = [0, 1, 2, 3];
-    let y = unsafe { *xs.as_ptr().offset(4) };
+    let _y = unsafe { *xs.as_ptr().offset(4) };
 }
diff --git a/src/test/run-make/sanitizer-cdylib-link/Makefile b/src/test/run-make/sanitizer-cdylib-link/Makefile
new file mode 100644 (file)
index 0000000..9b0470f
--- /dev/null
@@ -0,0 +1,19 @@
+-include ../tools.mk
+
+# This test builds a shared object, then an executable that links it as a native
+# rust library (constrast to an rlib). The shared library and executable both
+# are compiled with address sanitizer, and we assert that a fault in the cdylib
+# is correctly detected.
+
+ifeq ($(TARGET),x86_64-unknown-linux-gnu)
+ASAN_SUPPORT=$(SANITIZER_SUPPORT)
+EXTRA_RUSTFLAG=
+endif
+
+all:
+ifeq ($(ASAN_SUPPORT),1)
+       $(RUSTC) -g -Z sanitizer=address --crate-type cdylib --target $(TARGET) library.rs
+       $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs
+       LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | grep -q stack-buffer-overflow
+endif
+
diff --git a/src/test/run-make/sanitizer-cdylib-link/library.rs b/src/test/run-make/sanitizer-cdylib-link/library.rs
new file mode 100644 (file)
index 0000000..4ceef5d
--- /dev/null
@@ -0,0 +1,15 @@
+// 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.
+
+#[no_mangle]
+pub extern fn overflow() {
+    let xs = [0, 1, 2, 3];
+    let _y = unsafe { *xs.as_ptr().offset(4) };
+}
diff --git a/src/test/run-make/sanitizer-cdylib-link/program.rs b/src/test/run-make/sanitizer-cdylib-link/program.rs
new file mode 100644 (file)
index 0000000..9f52817
--- /dev/null
@@ -0,0 +1,17 @@
+// 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.
+
+extern {
+    fn overflow();
+}
+
+fn main() {
+    unsafe { overflow() }
+}
diff --git a/src/test/run-make/sanitizer-dylib-link/Makefile b/src/test/run-make/sanitizer-dylib-link/Makefile
new file mode 100644 (file)
index 0000000..d75241f
--- /dev/null
@@ -0,0 +1,19 @@
+-include ../tools.mk
+
+# This test builds a shared object, then an executable that links it as a native
+# rust library (constrast to an rlib). The shared library and executable both
+# are compiled with address sanitizer, and we assert that a fault in the dylib
+# is correctly detected.
+
+ifeq ($(TARGET),x86_64-unknown-linux-gnu)
+ASAN_SUPPORT=$(SANITIZER_SUPPORT)
+EXTRA_RUSTFLAG=
+endif
+
+all:
+ifeq ($(ASAN_SUPPORT),1)
+       $(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) library.rs
+       $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs
+       LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | grep -q stack-buffer-overflow
+endif
+
diff --git a/src/test/run-make/sanitizer-dylib-link/library.rs b/src/test/run-make/sanitizer-dylib-link/library.rs
new file mode 100644 (file)
index 0000000..4ceef5d
--- /dev/null
@@ -0,0 +1,15 @@
+// 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.
+
+#[no_mangle]
+pub extern fn overflow() {
+    let xs = [0, 1, 2, 3];
+    let _y = unsafe { *xs.as_ptr().offset(4) };
+}
diff --git a/src/test/run-make/sanitizer-dylib-link/program.rs b/src/test/run-make/sanitizer-dylib-link/program.rs
new file mode 100644 (file)
index 0000000..9f52817
--- /dev/null
@@ -0,0 +1,17 @@
+// 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.
+
+extern {
+    fn overflow();
+}
+
+fn main() {
+    unsafe { overflow() }
+}
diff --git a/src/test/run-make/sanitizer-dylib/Makefile b/src/test/run-make/sanitizer-dylib/Makefile
deleted file mode 100644 (file)
index 835d5b0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
--include ../tools.mk
-
-ifeq ($(TARGET),x86_64-unknown-linux-gnu)
-all:
-       $(RUSTC) -Z sanitizer=leak --crate-type dylib --target $(TARGET) hello.rs 2>&1 | grep -q 'Only executables and rlibs can be compiled with `-Z sanitizer`'
-else
-all:
-endif
diff --git a/src/test/run-make/sanitizer-dylib/hello.rs b/src/test/run-make/sanitizer-dylib/hello.rs
deleted file mode 100644 (file)
index 4178285..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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.
-
-fn main() {
-    println!("Hello, world!");
-}
diff --git a/src/test/run-make/sanitizer-invalid-cratetype/Makefile b/src/test/run-make/sanitizer-invalid-cratetype/Makefile
new file mode 100644 (file)
index 0000000..d03bbf8
--- /dev/null
@@ -0,0 +1,18 @@
+-include ../tools.mk
+
+# NOTE the address sanitizer only supports x86_64 linux and macOS
+
+ifeq ($(TARGET),x86_64-apple-darwin)
+ASAN_SUPPORT=$(SANITIZER_SUPPORT)
+EXTRA_RUSTFLAG=-C rpath
+else
+ifeq ($(TARGET),x86_64-unknown-linux-gnu)
+ASAN_SUPPORT=$(SANITIZER_SUPPORT)
+EXTRA_RUSTFLAG=
+endif
+endif
+
+all:
+ifeq ($(ASAN_SUPPORT),1)
+       $(RUSTC) -Z sanitizer=address --crate-type proc-macro --target $(TARGET) hello.rs 2>&1 | grep -q -- '-Z sanitizer'
+endif
diff --git a/src/test/run-make/sanitizer-invalid-cratetype/hello.rs b/src/test/run-make/sanitizer-invalid-cratetype/hello.rs
new file mode 100644 (file)
index 0000000..4178285
--- /dev/null
@@ -0,0 +1,13 @@
+// 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.
+
+fn main() {
+    println!("Hello, world!");
+}
diff --git a/src/test/run-make/sanitizer-staticlib-link/Makefile b/src/test/run-make/sanitizer-staticlib-link/Makefile
new file mode 100644 (file)
index 0000000..f92dc52
--- /dev/null
@@ -0,0 +1,18 @@
+-include ../tools.mk
+
+# This test builds a staticlib, then an executable that links to it.
+# The staticlib and executable both  are compiled with address sanitizer, 
+# and we assert that a fault in the staticlib is correctly detected.
+
+ifeq ($(TARGET),x86_64-unknown-linux-gnu)
+ASAN_SUPPORT=$(SANITIZER_SUPPORT)
+EXTRA_RUSTFLAG=
+endif
+
+all:
+ifeq ($(ASAN_SUPPORT),1)
+       $(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs
+       $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS)
+       LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | grep -q stack-buffer-overflow
+endif
+
diff --git a/src/test/run-make/sanitizer-staticlib-link/library.rs b/src/test/run-make/sanitizer-staticlib-link/library.rs
new file mode 100644 (file)
index 0000000..4ceef5d
--- /dev/null
@@ -0,0 +1,15 @@
+// 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.
+
+#[no_mangle]
+pub extern fn overflow() {
+    let xs = [0, 1, 2, 3];
+    let _y = unsafe { *xs.as_ptr().offset(4) };
+}
diff --git a/src/test/run-make/sanitizer-staticlib-link/program.c b/src/test/run-make/sanitizer-staticlib-link/program.c
new file mode 100644 (file)
index 0000000..abd5d50
--- /dev/null
@@ -0,0 +1,8 @@
+// ignore-license
+void overflow();
+
+int main() {
+    overflow();
+    return 0;
+}
+
index 5a757161a78a4e6858e4d6bf7e4717c67d861d23..310b6ea5bcc6d448e809a2ce4addd3a645e1fe85 100644 (file)
@@ -71,4 +71,10 @@ pub fn main() {
         Ok(&my_string)
     };
     assert_eq!(res, Ok("test"));
+
+    do catch {
+        ()
+    }
+
+    ();
 }
diff --git a/src/test/run-pass/const-size_of-align_of.rs b/src/test/run-pass/const-size_of-align_of.rs
new file mode 100644 (file)
index 0000000..06fbe9b
--- /dev/null
@@ -0,0 +1,60 @@
+// 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.
+
+#![feature(const_fn)]
+
+use std::mem;
+
+// Get around the limitations of CTFE in today's Rust.
+const fn choice_u64(c: bool, a: u64, b: u64) -> u64 {
+    (-(c as i64) as u64) & a | (-(!c as i64) as u64) & b
+}
+
+const fn max_usize(a: usize, b: usize) -> usize {
+    choice_u64(a > b, a as u64, b as u64) as usize
+}
+
+const fn align_to(size: usize, align: usize) -> usize {
+    (size + (align - 1)) & !(align - 1)
+}
+
+const fn packed_union_size_of<A, B>() -> usize {
+    max_usize(mem::size_of::<A>(), mem::size_of::<B>())
+}
+
+const fn union_align_of<A, B>() -> usize {
+    max_usize(mem::align_of::<A>(), mem::align_of::<B>())
+}
+
+const fn union_size_of<A, B>() -> usize {
+    align_to(packed_union_size_of::<A, B>(), union_align_of::<A, B>())
+}
+
+macro_rules! fake_union {
+    ($name:ident { $a:ty, $b:ty }) => (
+        struct $name {
+            _align: ([$a; 0], [$b; 0]),
+            _bytes: [u8; union_size_of::<$a, $b>()]
+        }
+    )
+}
+
+// Check that we can (poorly) emulate unions by
+// calling size_of and align_of at compile-time.
+fake_union!(U { u16, [u8; 3] });
+
+fn test(u: U) {
+    assert_eq!(mem::size_of_val(&u._bytes), 4);
+}
+
+fn main() {
+    assert_eq!(mem::size_of::<U>(), 4);
+    assert_eq!(mem::align_of::<U>(), 2);
+}
diff --git a/src/test/run-pass/optional_comma_in_match_arm.rs b/src/test/run-pass/optional_comma_in_match_arm.rs
new file mode 100644 (file)
index 0000000..b25ec44
--- /dev/null
@@ -0,0 +1,47 @@
+// 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.
+
+// ignore-pretty issue #37199
+
+fn main() {
+    let x = 1;
+
+    match x {
+        1 => loop { break; },
+        2 => while true { break; },
+        3 => if true { () },
+        4 => if true { () } else { () },
+        5 => match () { () => () },
+        6 => { () },
+        7 => unsafe { () },
+        _ => (),
+    }
+
+    match x {
+        1 => loop { break; }
+        2 => while true { break; }
+        3 => if true { () }
+        4 => if true { () } else { () }
+        5 => match () { () => () }
+        6 => { () }
+        7 => unsafe { () }
+        _ => ()
+    }
+
+    let r: &i32 = &x;
+
+    match r {
+        // Absence of comma should not cause confusion between a pattern
+        // and a bitwise and.
+        &1 => if true { () } else { () }
+        &2 => (),
+        _ =>()
+    }
+}
diff --git a/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs b/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs
new file mode 100644 (file)
index 0000000..db0c19e
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 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.
+
+// force-host
+// no-prefer-dynamic
+#![feature(proc_macro)]
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn attr_proc_macro(_: TokenStream, input: TokenStream) -> TokenStream {
+    input
+}
diff --git a/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs b/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs
new file mode 100644 (file)
index 0000000..89ac11b
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 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.
+
+// force-host
+// no-prefer-dynamic
+#![feature(proc_macro)]
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro]
+pub fn bang_proc_macro(input: TokenStream) -> TokenStream {
+    input
+}
diff --git a/src/test/ui-fulldeps/auxiliary/derive-clona.rs b/src/test/ui-fulldeps/auxiliary/derive-clona.rs
new file mode 100644 (file)
index 0000000..719fbdb
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(Clona)]
+pub fn derive_clonea(input: TokenStream) -> TokenStream {
+    "".parse().unwrap()
+}
diff --git a/src/test/ui-fulldeps/auxiliary/derive-foo.rs b/src/test/ui-fulldeps/auxiliary/derive-foo.rs
new file mode 100644 (file)
index 0000000..64dcf72
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(FooWithLongName)]
+pub fn derive_foo(input: TokenStream) -> TokenStream {
+    "".parse().unwrap()
+}
diff --git a/src/test/ui-fulldeps/resolve-error.rs b/src/test/ui-fulldeps/resolve-error.rs
new file mode 100644 (file)
index 0000000..dfaa1d7
--- /dev/null
@@ -0,0 +1,63 @@
+// Copyright 2016 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.
+
+// aux-build:derive-foo.rs
+// aux-build:derive-clona.rs
+// aux-build:attr_proc_macro.rs
+// aux-build:bang_proc_macro.rs
+
+#![feature(proc_macro)]
+#![allow(unused_macros)]
+
+#[macro_use]
+extern crate derive_foo;
+#[macro_use]
+extern crate derive_clona;
+extern crate attr_proc_macro;
+extern crate bang_proc_macro;
+
+use attr_proc_macro::attr_proc_macro;
+use bang_proc_macro::bang_proc_macro;
+
+macro_rules! FooWithLongNam {
+    () => {}
+}
+
+macro_rules! attr_proc_mac {
+    () => {}
+}
+
+#[derive(FooWithLongNan)]
+struct Foo;
+
+#[attr_proc_macra]
+struct Bar;
+
+#[FooWithLongNan]
+struct Asdf;
+
+#[derive(Dlone)]
+struct A;
+
+#[derive(Dlona)]
+struct B;
+
+#[derive(attr_proc_macra)]
+struct C;
+
+fn main() {
+    FooWithLongNama!();
+
+    attr_proc_macra!();
+
+    Dlona!();
+
+    bang_proc_macrp!();
+}
diff --git a/src/test/ui-fulldeps/resolve-error.stderr b/src/test/ui-fulldeps/resolve-error.stderr
new file mode 100644 (file)
index 0000000..754f6bc
--- /dev/null
@@ -0,0 +1,62 @@
+error: cannot find derive macro `FooWithLongNan` in this scope
+  --> $DIR/resolve-error.rs:37:10
+   |
+37 | #[derive(FooWithLongNan)]
+   |          ^^^^^^^^^^^^^^ help: try: `FooWithLongName`
+
+error: cannot find attribute macro `attr_proc_macra` in this scope
+  --> $DIR/resolve-error.rs:40:3
+   |
+40 | #[attr_proc_macra]
+   |   ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro`
+
+error: cannot find attribute macro `FooWithLongNan` in this scope
+  --> $DIR/resolve-error.rs:43:3
+   |
+43 | #[FooWithLongNan]
+   |   ^^^^^^^^^^^^^^
+
+error: cannot find derive macro `Dlone` in this scope
+  --> $DIR/resolve-error.rs:46:10
+   |
+46 | #[derive(Dlone)]
+   |          ^^^^^ help: try: `Clone`
+
+error: cannot find derive macro `Dlona` in this scope
+  --> $DIR/resolve-error.rs:49:10
+   |
+49 | #[derive(Dlona)]
+   |          ^^^^^ help: try: `Clona`
+
+error: cannot find derive macro `attr_proc_macra` in this scope
+  --> $DIR/resolve-error.rs:52:10
+   |
+52 | #[derive(attr_proc_macra)]
+   |          ^^^^^^^^^^^^^^^
+
+error: cannot find macro `FooWithLongNama!` in this scope
+  --> $DIR/resolve-error.rs:56:5
+   |
+56 |     FooWithLongNama!();
+   |     ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam!`
+
+error: cannot find macro `attr_proc_macra!` in this scope
+  --> $DIR/resolve-error.rs:58:5
+   |
+58 |     attr_proc_macra!();
+   |     ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac!`
+
+error: cannot find macro `Dlona!` in this scope
+  --> $DIR/resolve-error.rs:60:5
+   |
+60 |     Dlona!();
+   |     ^^^^^
+
+error: cannot find macro `bang_proc_macrp!` in this scope
+  --> $DIR/resolve-error.rs:62:5
+   |
+62 |     bang_proc_macrp!();
+   |     ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro!`
+
+error: aborting due to 10 previous errors
+
diff --git a/src/test/ui/cast-to-unsized-trait-object-suggestion.rs b/src/test/ui/cast-to-unsized-trait-object-suggestion.rs
new file mode 100644 (file)
index 0000000..c793454
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2015 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.
+
+fn main() {
+    &1 as Send;
+    Box::new(1) as Send;
+}
diff --git a/src/test/ui/cast-to-unsized-trait-object-suggestion.stderr b/src/test/ui/cast-to-unsized-trait-object-suggestion.stderr
new file mode 100644 (file)
index 0000000..4d4eb7b
--- /dev/null
@@ -0,0 +1,18 @@
+error[E0620]: cast to unsized type: `&{integer}` as `std::marker::Send`
+  --> $DIR/cast-to-unsized-trait-object-suggestion.rs:12:5
+   |
+12 |     &1 as Send;
+   |     ^^^^^^----
+   |           |
+   |           help: try casting to a reference instead: `&Send`
+
+error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `std::marker::Send`
+  --> $DIR/cast-to-unsized-trait-object-suggestion.rs:13:5
+   |
+13 |     Box::new(1) as Send;
+   |     ^^^^^^^^^^^^^^^----
+   |                    |
+   |                    help: try casting to a `Box` instead: `Box<Send>`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/check_match/issue-43253.rs b/src/test/ui/check_match/issue-43253.rs
new file mode 100644 (file)
index 0000000..c77fa74
--- /dev/null
@@ -0,0 +1,51 @@
+// 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.
+
+#![feature(exclusive_range_pattern)]
+
+fn main() {
+    // These cases should generate no warning.
+    match 10 {
+        1..10 => {},
+        10 => {},
+        _ => {},
+    }
+
+    match 10 {
+        1..10 => {},
+        9...10 => {},
+        _ => {},
+    }
+
+    match 10 {
+        1..10 => {},
+        10...10 => {},
+        _ => {},
+    }
+
+    // These cases should generate an "unreachable pattern" warning.
+    match 10 {
+        1..10 => {},
+        9 => {},
+        _ => {},
+    }
+
+    match 10 {
+        1..10 => {},
+        8...9 => {},
+        _ => {},
+    }
+
+    match 10 {
+        1..10 => {},
+        9...9 => {},
+        _ => {},
+    }
+}
\ No newline at end of file
diff --git a/src/test/ui/check_match/issue-43253.stderr b/src/test/ui/check_match/issue-43253.stderr
new file mode 100644 (file)
index 0000000..0d4a2ec
--- /dev/null
@@ -0,0 +1,20 @@
+warning: unreachable pattern
+  --> $DIR/issue-43253.rs:36:9
+   |
+36 |         9 => {},
+   |         ^
+   |
+   = note: #[warn(unreachable_patterns)] on by default
+
+warning: unreachable pattern
+  --> $DIR/issue-43253.rs:42:9
+   |
+42 |         8...9 => {},
+   |         ^^^^^
+
+warning: unreachable pattern
+  --> $DIR/issue-43253.rs:48:9
+   |
+48 |         9...9 => {},
+   |         ^^^^^
+
index c7d43a0fc0b6f1b794dc7a49d199dec7c6c4e8e2..023f9ef1defb735d91c9c9cb49b4a64aac361ccb 100644 (file)
@@ -4,8 +4,8 @@ error[E0596]: cannot borrow immutable argument `self` as mutable
 17 |         (&mut self).bar();
    |               ^^^^
    |               |
-   |               try removing `&mut` here
    |               cannot reborrow mutably
+   |               try removing `&mut` here
 
 error[E0596]: cannot borrow immutable argument `self` as mutable
   --> $DIR/issue-31424.rs:23:15
index 63d59a59238b538dd5c4869dc8f4930d1652e16e..d9ef0c45410418c057b6a83a37996ffb3930a653 100644 (file)
@@ -4,8 +4,8 @@ error[E0596]: cannot borrow immutable argument `self` as mutable
 16 |         self.run(&mut self);
    |                       ^^^^
    |                       |
-   |                       try removing `&mut` here
    |                       cannot reborrow mutably
+   |                       try removing `&mut` here
 
 error: aborting due to previous error
 
index 9eb88cdeddbe6d4a027cfa9fc1f4488a42fddcfc..20478165c7ea0309c6917bd4048a2d3ad7518693 100644 (file)
@@ -4,8 +4,8 @@ error[E0596]: cannot borrow immutable local variable `key` as mutable
 16 |     get(&mut key);
    |              ^^^
    |              |
-   |              try removing `&mut` here
    |              cannot reborrow mutably
+   |              try removing `&mut` here
 
 error: aborting due to previous error
 
index 4348b6fca63b6878deba32ad226a48c910f17afd..9fc364f861275a6b977d8376a12eba1c01cf9bc0 100644 (file)
@@ -4,8 +4,8 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable
 22 |             test(&mut x);
    |                       ^
    |                       |
-   |                       try removing `&mut` here
    |                       cannot reborrow mutably
+   |                       try removing `&mut` here
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/did_you_mean/issue-42764.rs b/src/test/ui/did_you_mean/issue-42764.rs
new file mode 100644 (file)
index 0000000..ecaeb7b
--- /dev/null
@@ -0,0 +1,22 @@
+// 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.
+
+enum DoubleOption<T> {
+    FirstSome(T),
+    AlternativeSome(T),
+    Nothing,
+}
+
+fn this_function_expects_a_double_option<T>(d: DoubleOption<T>) {}
+
+fn main() {
+    let n: usize = 42;
+    this_function_expects_a_double_option(n);
+}
diff --git a/src/test/ui/did_you_mean/issue-42764.stderr b/src/test/ui/did_you_mean/issue-42764.stderr
new file mode 100644 (file)
index 0000000..7ba1290
--- /dev/null
@@ -0,0 +1,17 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-42764.rs:21:43
+   |
+21 |     this_function_expects_a_double_option(n);
+   |                                           ^ expected enum `DoubleOption`, found usize
+   |
+   = note: expected type `DoubleOption<_>`
+              found type `usize`
+help: perhaps you meant to use a variant of the expected type
+   |
+21 |     this_function_expects_a_double_option(DoubleOption::FirstSome(n));
+   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
+21 |     this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
+   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-35675.rs b/src/test/ui/issue-35675.rs
new file mode 100644 (file)
index 0000000..391e1f2
--- /dev/null
@@ -0,0 +1,51 @@
+// 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.
+
+// these two HELPs are actually in a new line between this line and the `enum Fruit` line
+enum Fruit { //~ HELP possible candidate is found in another module, you can import it into scope
+    //~^ HELP possible candidate is found in another module, you can import it into scope
+    Apple(i64),
+    //~^ HELP there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
+    //~| HELP there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
+    Orange(i64),
+}
+
+fn should_return_fruit() -> Apple {
+    //~^ ERROR cannot find type `Apple` in this scope
+    //~| NOTE not found in this scope
+    Apple(5)
+    //~^ ERROR cannot find function `Apple` in this scope
+    //~| NOTE not found in this scope
+}
+
+fn should_return_fruit_too() -> Fruit::Apple {
+    //~^ ERROR expected type, found variant `Fruit::Apple`
+    //~| NOTE not a type
+    Apple(5)
+    //~^ ERROR cannot find function `Apple` in this scope
+    //~| NOTE not found in this scope
+}
+
+fn bar() -> Variant3 {
+    //~^ ERROR cannot find type `Variant3` in this scope
+    //~| NOTE not found in this scope
+}
+
+fn main() {}
+
+mod x {
+    enum Enum {
+        Variant1,
+        Variant2(),
+        Variant3(usize),
+        //~^ HELP there is an enum variant `x::Enum::Variant3`, did you mean to use `x::Enum`?
+        Variant4 {},
+    }
+}
diff --git a/src/test/ui/issue-35675.stderr b/src/test/ui/issue-35675.stderr
new file mode 100644 (file)
index 0000000..c2c1072
--- /dev/null
@@ -0,0 +1,51 @@
+error[E0412]: cannot find type `Apple` in this scope
+  --> $DIR/issue-35675.rs:20:29
+   |
+20 | fn should_return_fruit() -> Apple {
+   |                             ^^^^^
+   |                             |
+   |                             not found in this scope
+   |                             help: you can try using the variant's enum: `Fruit`
+
+error[E0425]: cannot find function `Apple` in this scope
+  --> $DIR/issue-35675.rs:23:5
+   |
+23 |     Apple(5)
+   |     ^^^^^ not found in this scope
+   |
+help: possible candidate is found in another module, you can import it into scope
+   |
+12 | use Fruit::Apple;
+   |
+
+error[E0573]: expected type, found variant `Fruit::Apple`
+  --> $DIR/issue-35675.rs:28:33
+   |
+28 | fn should_return_fruit_too() -> Fruit::Apple {
+   |                                 ^^^^^^^^^^^^
+   |                                 |
+   |                                 not a type
+   |                                 help: you can try using the variant's enum: `Fruit`
+
+error[E0425]: cannot find function `Apple` in this scope
+  --> $DIR/issue-35675.rs:31:5
+   |
+31 |     Apple(5)
+   |     ^^^^^ not found in this scope
+   |
+help: possible candidate is found in another module, you can import it into scope
+   |
+12 | use Fruit::Apple;
+   |
+
+error[E0412]: cannot find type `Variant3` in this scope
+  --> $DIR/issue-35675.rs:36:13
+   |
+36 | fn bar() -> Variant3 {
+   |             ^^^^^^^^
+   |             |
+   |             not found in this scope
+   |             help: you can try using the variant's enum: `x::Enum`
+
+error: aborting due to 5 previous errors
+
index de110ac12b70398a3fc7f8d6ca7f051f71ff73b1..56d0a5351ce83ed53712282d984365f552c32064 100644 (file)
@@ -4,8 +4,8 @@ error[E0507]: cannot move out of indexed content
 19 |     let e = f.v[0];
    |             ^^^^^^
    |             |
-   |             help: consider using a reference instead `&f.v[0]`
    |             cannot move out of indexed content
+   |             help: consider using a reference instead: `&f.v[0]`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/macros/macro-name-typo.rs b/src/test/ui/macros/macro-name-typo.rs
new file mode 100644 (file)
index 0000000..ec8d27f
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2015 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.
+
+fn main() {
+    printlx!("oh noes!");
+}
diff --git a/src/test/ui/macros/macro-name-typo.stderr b/src/test/ui/macros/macro-name-typo.stderr
new file mode 100644 (file)
index 0000000..7c83250
--- /dev/null
@@ -0,0 +1,8 @@
+error: cannot find macro `printlx!` in this scope
+  --> $DIR/macro-name-typo.rs:12:5
+   |
+12 |     printlx!("oh noes!");
+   |     ^^^^^^^ help: you could try the macro: `println!`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/macros/macro_undefined.rs b/src/test/ui/macros/macro_undefined.rs
new file mode 100644 (file)
index 0000000..db93ba5
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2014 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.
+
+// Test macro_undefined issue
+
+mod m {
+    #[macro_export]
+    macro_rules! kl {
+        () => ()
+    }
+}
+
+fn main() {
+    k!();
+    kl!();
+}
diff --git a/src/test/ui/macros/macro_undefined.stderr b/src/test/ui/macros/macro_undefined.stderr
new file mode 100644 (file)
index 0000000..5c33ae9
--- /dev/null
@@ -0,0 +1,16 @@
+error: cannot find macro `kl!` in this scope
+  --> $DIR/macro_undefined.rs:22:5
+   |
+22 |     kl!();
+   |     ^^
+   |
+   = help: have you added the `#[macro_use]` on the module/import?
+
+error: cannot find macro `k!` in this scope
+  --> $DIR/macro_undefined.rs:21:5
+   |
+21 |     k!();
+   |     ^ help: you could try the macro: `kl!`
+
+error: aborting due to 2 previous errors
+
index 887412d1be7af5eba8acc1b40d44032c84e2cd27..744e8c309392513b9a2f4de9606c4e631f9786f9 100644 (file)
@@ -4,8 +4,8 @@ error[E0281]: type mismatch: `[closure@$DIR/E0281.rs:14:9: 14:24]` implements th
 14 |     foo(|y: String| { });
    |     ^^^ --------------- implements `std::ops::Fn<(std::string::String,)>`
    |     |
-   |     requires `std::ops::Fn<(usize,)>`
    |     expected usize, found struct `std::string::String`
+   |     requires `std::ops::Fn<(usize,)>`
    |
    = note: required by `foo`
 
index 5b3eb5931896aee60c50c0e36b8efa0c97379607..b7479f15b181294b88bb7cebba33c910d5224e65 100644 (file)
@@ -14,8 +14,8 @@ error[E0281]: type mismatch: `[closure@$DIR/closure-mismatch.rs:18:9: 18:15]` im
 18 |     baz(|_| ());
    |     ^^^ ------ implements `std::ops::Fn<(_,)>`
    |     |
-   |     requires `for<'r> std::ops::Fn<(&'r (),)>`
    |     expected concrete lifetime, found bound lifetime parameter
+   |     requires `for<'r> std::ops::Fn<(&'r (),)>`
    |
    = note: required because of the requirements on the impl of `Foo` for `[closure@$DIR/closure-mismatch.rs:18:9: 18:15]`
    = note: required by `baz`
index 2b4b8242af6fb7620bc961454e364f53de96a718..2d8d557d9f35f78dc116753b06a5524f9d7563cb 100644 (file)
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
   --> $DIR/issue-19109.rs:14:5
    |
 13 | fn function(t: &mut Trait) {
-   |                            - help: possibly return type missing here? `-> *mut Trait `
+   |                            - help: possibly return type missing here?: `-> *mut Trait `
 14 |     t as *mut Trait
    |     ^^^^^^^^^^^^^^^ expected (), found *-ptr
    |
index 51acdb719b69afc04c5e7bab30235d01c2a4b57e..174f7dfa0d0f5f897b93ecbb14edb66735457329 100644 (file)
@@ -14,8 +14,8 @@ error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` impl
 17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
    |                                ^^^^^^ -------------- implements `for<'r> std::ops::FnMut<(&'r str,)>`
    |                                |
-   |                                requires `for<'r> std::ops::FnMut<(&'r &str,)>`
    |                                expected &str, found str
+   |                                requires `for<'r> std::ops::FnMut<(&'r &str,)>`
 
 error: aborting due to 2 previous errors
 
index 995a12584547734a84abf2a68dec2b2aba38c496..f14e711b23a1eea02972ad127388f49442fd5cab 100644 (file)
@@ -7,8 +7,8 @@ error[E0281]: type mismatch: `[closure@$DIR/unboxed-closures-vtable-mismatch.rs:
 25 |     let z = call_it(3, f);
    |             ^^^^^^^
    |             |
-   |             requires `std::ops::FnMut<(isize, isize)>`
    |             expected isize, found usize
+   |             requires `std::ops::FnMut<(isize, isize)>`
    |
    = note: required by `call_it`
 
diff --git a/src/test/ui/resolve-error.stderr b/src/test/ui/resolve-error.stderr
new file mode 100644 (file)
index 0000000..27f9393
--- /dev/null
@@ -0,0 +1,62 @@
+error: cannot find derive macro `FooWithLongNan` in this scope
+  --> $DIR/resolve-error.rs:37:10
+   |
+37 | #[derive(FooWithLongNan)]
+   |          ^^^^^^^^^^^^^^ help: try: `FooWithLongName`
+
+error: cannot find attribute macro `attr_proc_macra` in this scope
+  --> $DIR/resolve-error.rs:40:3
+   |
+40 | #[attr_proc_macra]
+   |   ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro`
+
+error: cannot find attribute macro `FooWithLongNan` in this scope
+  --> $DIR/resolve-error.rs:43:3
+   |
+43 | #[FooWithLongNan]
+   |   ^^^^^^^^^^^^^^
+
+error: cannot find derive macro `Dlone` in this scope
+  --> $DIR/resolve-error.rs:46:10
+   |
+46 | #[derive(Dlone)]
+   |          ^^^^^ help: try: `Clone`
+
+error: cannot find derive macro `Dlona` in this scope
+  --> $DIR/resolve-error.rs:49:10
+   |
+49 | #[derive(Dlona)]
+   |          ^^^^^ help: try: `Clona`
+
+error: cannot find derive macro `attr_proc_macra` in this scope
+  --> $DIR/resolve-error.rs:52:10
+   |
+52 | #[derive(attr_proc_macra)]
+   |          ^^^^^^^^^^^^^^^
+
+error: cannot find macro `FooWithLongNama!` in this scope
+  --> $DIR/resolve-error.rs:56:5
+   |
+56 |     FooWithLongNama!();
+   |     ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam!`
+
+error: cannot find macro `attr_proc_macra!` in this scope
+  --> $DIR/resolve-error.rs:58:5
+   |
+58 |     attr_proc_macra!();
+   |     ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac!`
+
+error: cannot find macro `Dlona!` in this scope
+  --> $DIR/resolve-error.rs:60:5
+   |
+60 |     Dlona!();
+   |     ^^^^^
+
+error: cannot find macro `bang_proc_macrp!` in this scope
+  --> $DIR/resolve-error.rs:62:5
+   |
+62 |     bang_proc_macrp!();
+   |     ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro!`
+
+error: aborting due to previous error(s)
+
index 11268e593c4131bf40a958c5b60cc8b368aefea6..7aa0c2707b56fb1b9393901f10b0ee583b089d8c 100644 (file)
@@ -2,7 +2,7 @@ error[E0425]: cannot find function `baz` in this scope
   --> $DIR/issue-14254.rs:29:9
    |
 29 |         baz();
-   |         ^^^ did you mean `self.baz(...)`?
+   |         ^^^ help: try: `self.baz`
 
 error[E0425]: cannot find value `a` in this scope
   --> $DIR/issue-14254.rs:32:9
@@ -14,19 +14,19 @@ error[E0425]: cannot find function `baz` in this scope
   --> $DIR/issue-14254.rs:40:9
    |
 40 |         baz();
-   |         ^^^ did you mean `self.baz(...)`?
+   |         ^^^ help: try: `self.baz`
 
 error[E0425]: cannot find value `x` in this scope
   --> $DIR/issue-14254.rs:43:9
    |
 43 |         x;
-   |         ^ did you mean `self.x`?
+   |         ^ help: try: `self.x`
 
 error[E0425]: cannot find value `y` in this scope
   --> $DIR/issue-14254.rs:46:9
    |
 46 |         y;
-   |         ^ did you mean `self.y`?
+   |         ^ help: try: `self.y`
 
 error[E0425]: cannot find value `a` in this scope
   --> $DIR/issue-14254.rs:49:9
@@ -38,7 +38,7 @@ error[E0425]: cannot find value `bah` in this scope
   --> $DIR/issue-14254.rs:52:9
    |
 52 |         bah;
-   |         ^^^ did you mean `Self::bah`?
+   |         ^^^ help: try: `Self::bah`
 
 error[E0425]: cannot find value `b` in this scope
   --> $DIR/issue-14254.rs:55:9
@@ -50,19 +50,19 @@ error[E0425]: cannot find function `baz` in this scope
   --> $DIR/issue-14254.rs:63:9
    |
 63 |         baz();
-   |         ^^^ did you mean `self.baz(...)`?
+   |         ^^^ help: try: `self.baz`
 
 error[E0425]: cannot find value `x` in this scope
   --> $DIR/issue-14254.rs:66:9
    |
 66 |         x;
-   |         ^ did you mean `self.x`?
+   |         ^ help: try: `self.x`
 
 error[E0425]: cannot find value `y` in this scope
   --> $DIR/issue-14254.rs:69:9
    |
 69 |         y;
-   |         ^ did you mean `self.y`?
+   |         ^ help: try: `self.y`
 
 error[E0425]: cannot find value `a` in this scope
   --> $DIR/issue-14254.rs:72:9
@@ -74,7 +74,7 @@ error[E0425]: cannot find value `bah` in this scope
   --> $DIR/issue-14254.rs:75:9
    |
 75 |         bah;
-   |         ^^^ did you mean `Self::bah`?
+   |         ^^^ help: try: `Self::bah`
 
 error[E0425]: cannot find value `b` in this scope
   --> $DIR/issue-14254.rs:78:9
@@ -86,61 +86,61 @@ error[E0425]: cannot find function `baz` in this scope
   --> $DIR/issue-14254.rs:86:9
    |
 86 |         baz();
-   |         ^^^ did you mean `self.baz(...)`?
+   |         ^^^ help: try: `self.baz`
 
 error[E0425]: cannot find value `bah` in this scope
   --> $DIR/issue-14254.rs:89:9
    |
 89 |         bah;
-   |         ^^^ did you mean `Self::bah`?
+   |         ^^^ help: try: `Self::bah`
 
 error[E0425]: cannot find function `baz` in this scope
   --> $DIR/issue-14254.rs:97:9
    |
 97 |         baz();
-   |         ^^^ did you mean `self.baz(...)`?
+   |         ^^^ help: try: `self.baz`
 
 error[E0425]: cannot find value `bah` in this scope
    --> $DIR/issue-14254.rs:100:9
     |
 100 |         bah;
-    |         ^^^ did you mean `Self::bah`?
+    |         ^^^ help: try: `Self::bah`
 
 error[E0425]: cannot find function `baz` in this scope
    --> $DIR/issue-14254.rs:108:9
     |
 108 |         baz();
-    |         ^^^ did you mean `self.baz(...)`?
+    |         ^^^ help: try: `self.baz`
 
 error[E0425]: cannot find value `bah` in this scope
    --> $DIR/issue-14254.rs:111:9
     |
 111 |         bah;
-    |         ^^^ did you mean `Self::bah`?
+    |         ^^^ help: try: `Self::bah`
 
 error[E0425]: cannot find function `baz` in this scope
    --> $DIR/issue-14254.rs:119:9
     |
 119 |         baz();
-    |         ^^^ did you mean `self.baz(...)`?
+    |         ^^^ help: try: `self.baz`
 
 error[E0425]: cannot find value `bah` in this scope
    --> $DIR/issue-14254.rs:122:9
     |
 122 |         bah;
-    |         ^^^ did you mean `Self::bah`?
+    |         ^^^ help: try: `Self::bah`
 
 error[E0425]: cannot find function `baz` in this scope
    --> $DIR/issue-14254.rs:130:9
     |
 130 |         baz();
-    |         ^^^ did you mean `self.baz(...)`?
+    |         ^^^ help: try: `self.baz`
 
 error[E0425]: cannot find value `bah` in this scope
    --> $DIR/issue-14254.rs:133:9
     |
 133 |         bah;
-    |         ^^^ did you mean `Self::bah`?
+    |         ^^^ help: try: `Self::bah`
 
 error[E0601]: main function not found
 
index 039887d8da65fe169b5695d5b880f6d1a47f2724..ed0edd52587ec6906b5ae93b8fdcecb8c5613c72 100644 (file)
@@ -8,13 +8,13 @@ error[E0425]: cannot find function `clone` in this scope
   --> $DIR/issue-2356.rs:35:5
    |
 35 |     clone();
-   |     ^^^^^ did you mean `self.clone(...)`?
+   |     ^^^^^ help: try: `self.clone`
 
 error[E0425]: cannot find function `default` in this scope
   --> $DIR/issue-2356.rs:43:5
    |
 43 |     default();
-   |     ^^^^^^^ did you mean `Self::default`?
+   |     ^^^^^^^ help: try: `Self::default`
 
 error[E0425]: cannot find value `whiskers` in this scope
   --> $DIR/issue-2356.rs:52:5
@@ -22,14 +22,14 @@ error[E0425]: cannot find value `whiskers` in this scope
 52 |     whiskers -= other;
    |     ^^^^^^^^
    |     |
-   |     did you mean `self.whiskers`?
    |     `self` value is only available in methods with `self` parameter
+   |     help: try: `self.whiskers`
 
 error[E0425]: cannot find function `shave` in this scope
   --> $DIR/issue-2356.rs:57:5
    |
 57 |     shave(4);
-   |     ^^^^^ did you mean `Self::shave`?
+   |     ^^^^^ help: try: `Self::shave`
 
 error[E0425]: cannot find function `purr` in this scope
   --> $DIR/issue-2356.rs:60:5
@@ -83,7 +83,7 @@ error[E0425]: cannot find value `whiskers` in this scope
    --> $DIR/issue-2356.rs:104:5
     |
 104 |     whiskers = 0;
-    |     ^^^^^^^^ did you mean `self.whiskers`?
+    |     ^^^^^^^^ help: try: `self.whiskers`
 
 error[E0425]: cannot find value `whiskers` in this scope
    --> $DIR/issue-2356.rs:110:5
@@ -91,8 +91,8 @@ error[E0425]: cannot find value `whiskers` in this scope
 110 |     whiskers = 4;
     |     ^^^^^^^^
     |     |
-    |     did you mean `self.whiskers`?
     |     `self` value is only available in methods with `self` parameter
+    |     help: try: `self.whiskers`
 
 error[E0425]: cannot find function `purr_louder` in this scope
    --> $DIR/issue-2356.rs:115:5
index 19adecc7b4bd2212c9848cf996d70a9af4150316..3c093e068c507eb9cbf708f0d2ceb8ad804cebbe 100644 (file)
@@ -10,8 +10,8 @@ error[E0404]: expected trait, found type alias `K`
 13 | impl K for isize {} //~ ERROR expected trait, found type alias `K`
    |      ^
    |      |
-   |      type aliases cannot be used for traits
    |      did you mean `I`?
+   |      type aliases cannot be used for traits
 
 error: cannot continue compilation due to previous error
 
index 57b143d34dbd20ef602f50944186aa9448a9dada..47141eda33c5531ae25da7dd546ed619d1a5eddd 100644 (file)
@@ -4,9 +4,9 @@ error[E0423]: expected value, found struct `Z`
 26 |         Z;
    |         ^
    |         |
-   |         did you mean `Z { /* fields */ }`?
    |         did you mean `S`?
    |         constructor is not visible here due to private fields
+   |         did you mean `Z { /* fields */ }`?
    |
 help: possible better candidate is found in another module, you can import it into scope
    |
@@ -19,8 +19,8 @@ error[E0423]: expected value, found struct `S`
 36 |     S;
    |     ^
    |     |
-   |     did you mean `S { /* fields */ }`?
    |     constructor is not visible here due to private fields
+   |     did you mean `S { /* fields */ }`?
    |
 help: possible better candidate is found in another module, you can import it into scope
    |
@@ -33,8 +33,8 @@ error[E0423]: expected value, found struct `xcrate::S`
 42 |     xcrate::S;
    |     ^^^^^^^^^
    |     |
-   |     did you mean `xcrate::S { /* fields */ }`?
    |     constructor is not visible here due to private fields
+   |     did you mean `xcrate::S { /* fields */ }`?
    |
 help: possible better candidate is found in another module, you can import it into scope
    |
index 7975c168de7d4d39075ed8e349aeeec795b8f249..77aa545e2ad6b4f1611c25725d2be61451dab2ee 100644 (file)
@@ -14,13 +14,13 @@ error[E0425]: cannot find value `field` in this scope
   --> $DIR/resolve-assoc-suggestions.rs:32:9
    |
 32 |         field;
-   |         ^^^^^ did you mean `self.field`?
+   |         ^^^^^ help: try: `self.field`
 
 error[E0412]: cannot find type `Type` in this scope
   --> $DIR/resolve-assoc-suggestions.rs:36:16
    |
 36 |         let _: Type;
-   |                ^^^^ did you mean `Self::Type`?
+   |                ^^^^ help: try: `Self::Type`
 
 error[E0531]: cannot find tuple struct/variant `Type` in this scope
   --> $DIR/resolve-assoc-suggestions.rs:39:13
@@ -50,7 +50,7 @@ error[E0425]: cannot find value `method` in this scope
   --> $DIR/resolve-assoc-suggestions.rs:52:9
    |
 52 |         method;
-   |         ^^^^^^ did you mean `self.method(...)`?
+   |         ^^^^^^ help: try: `self.method`
 
 error: aborting due to 9 previous errors
 
index e7df8140bc577bbb0d207cf85801c736c330d6a9..3e1b075679a50feedb8415b0bb4dd62a7f3356c0 100644 (file)
@@ -14,13 +14,13 @@ error[E0425]: cannot find value `field` in this scope
   --> $DIR/resolve-speculative-adjustment.rs:35:9
    |
 35 |         field;
-   |         ^^^^^ did you mean `self.field`?
+   |         ^^^^^ help: try: `self.field`
 
 error[E0425]: cannot find function `method` in this scope
   --> $DIR/resolve-speculative-adjustment.rs:38:9
    |
 38 |         method();
-   |         ^^^^^^ did you mean `self.method(...)`?
+   |         ^^^^^^ help: try: `self.method`
 
 error: aborting due to 4 previous errors
 
index bd3bdf35da60900c2874febe3b10297e56118457..2e8cc40dc5175dd73b38d09c9b55ca9b90dc866f 100644 (file)
@@ -35,7 +35,7 @@ error[E0308]: mismatched types
   --> $DIR/token-error-correct-3.rs:25:13
    |
 25 |             fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: did you mean to add a semicolon here? `;`
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: did you mean to add a semicolon here?: `;`
    |             |
    |             expected (), found enum `std::result::Result`
    |
index 5fbaf66e014af073f45aef78a325c8347a7c1cef..014e03eb252beba351ea4b9d156113e77fb1756e 100644 (file)
@@ -4,8 +4,8 @@ error[E0425]: cannot find value `cx` in this scope
 19 |         f(cx);
    |           ^^
    |           |
-   |           did you mean `self.cx`?
    |           `self` value is only available in methods with `self` parameter
+   |           help: try: `self.cx`
 
 error: aborting due to previous error
 
index a0445eaee9162dd519724f16bbc8a098ee465096..d87fc122d8ee2edda68ecdcf2bf6ad34b8f63e08 100644 (file)
@@ -4,7 +4,7 @@ error[E0369]: binary operation `+` cannot be applied to type `&'static str`
 12 |     let x = "Hello " + "World!";
    |             ^^^^^^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
    |
-help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left.
+help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
    |
 12 |     let x = "Hello ".to_owned() + "World!";
    |             ^^^^^^^^^^^^^^^^^^^
index c2ab7542d8a98ed8d89e115e3bfde24f3bb5415c..c67a8fe32b9ddd8faed450a7e570a13d1d4471ad 100644 (file)
@@ -2,7 +2,7 @@ error[E0608]: cannot index into a value of type `({integer},)`
   --> $DIR/suggestion-non-ascii.rs:14:21
    |
 14 |     println!("☃{}", tup[0]);
-   |                     ^^^^^^ help: to access tuple elements, use `tup.0`
+   |                     ^^^^^^ help: to access tuple elements, use: `tup.0`
 
 error: aborting due to previous error
 
index 8a121b145366250abbcd1d39a05c42ca1d4e63d5..4b1be26c86b0e7c1c434286790f56083a4527cfd 100644 (file)
@@ -5,7 +5,7 @@ error: unexpected token: `1.1`
    |     ------------^^^
    |     |           |
    |     |           unexpected token
-   |     help: try parenthesizing the first index `((1, (2, 3)).1).1`
+   |     help: try parenthesizing the first index: `((1, (2, 3)).1).1`
 
 error: aborting due to previous error
 
index a077f37eae6eeff367197194391b25a1c93122de..4b8a3744bcf8ad7fb40d5a8d85661d9c91871472 100644 (file)
@@ -4,8 +4,8 @@ error[E0308]: mismatched types
 25 |     if x = x {
    |        ^^^^^
    |        |
-   |        help: did you mean to compare equality? `x == x`
    |        expected bool, found ()
+   |        help: did you mean to compare equality?: `x == x`
    |
    = note: expected type `bool`
               found type `()`
@@ -16,8 +16,8 @@ error[E0308]: mismatched types
 31 |     if (x = x) {
    |        ^^^^^^^
    |        |
-   |        help: did you mean to compare equality? `x == x`
    |        expected bool, found ()
+   |        help: did you mean to compare equality?: `x == x`
    |
    = note: expected type `bool`
               found type `()`
@@ -28,8 +28,8 @@ error[E0308]: mismatched types
 37 |     if y = (Foo { foo: x }) {
    |        ^^^^^^^^^^^^^^^^^^^^
    |        |
-   |        help: did you mean to compare equality? `y == (Foo { foo: x })`
    |        expected bool, found ()
+   |        help: did you mean to compare equality?: `y == (Foo { foo: x })`
    |
    = note: expected type `bool`
               found type `()`
@@ -40,8 +40,8 @@ error[E0308]: mismatched types
 43 |     if 3 = x {
    |        ^^^^^
    |        |
-   |        help: did you mean to compare equality? `3 == x`
    |        expected bool, found ()
+   |        help: did you mean to compare equality?: `3 == x`
    |
    = note: expected type `bool`
               found type `()`
index 70b89fdd7e5e77a3b88fc68982861d39d155be29..618f802f0dcebc9f23a527afd3cd228c1fa468f8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 70b89fdd7e5e77a3b88fc68982861d39d155be29
+Subproject commit 618f802f0dcebc9f23a527afd3cd228c1fa468f8
index ba02ee0c6d73b7a39cfa9caf95695cec951b10f2..8b7da2267cdedc191fb7e3f9e0e1f64c3368475f 100644 (file)
@@ -32,7 +32,6 @@
     "openssl", // BSD+advertising clause, cargo, mdbook
     "pest", // MPL2, mdbook via handlebars
     "thread-id", // Apache-2.0, mdbook
-    "strings", // this is actually MIT/Apache-2.0 but it's not in the manifest yet
 ];
 
 pub fn check(path: &Path, bad: &mut bool) {
index 4c94ade98d96524749bf00a3ab7845e91bcd4925..e72f249896913a6023e6cd199525fee9fc6379ed 100644 (file)
@@ -50,6 +50,34 @@ pub struct Feature {
     pub tracking_issue: Option<u32>,
 }
 
+impl Feature {
+    fn check_match(&self, other: &Feature)-> Result<(), Vec<&'static str>> {
+        let mut mismatches = Vec::new();
+        if self.level != other.level {
+            mismatches.push("stability level");
+        }
+        if self.level == Status::Stable || other.level == Status::Stable {
+            // As long as a feature is unstable, the since field tracks
+            // when the given part of the feature has been implemented.
+            // Mismatches are tolerable as features evolve and functionality
+            // gets added.
+            // Once a feature is stable, the since field tracks the first version
+            // it was part of the stable distribution, and mismatches are disallowed.
+            if self.since != other.since {
+                mismatches.push("since");
+            }
+        }
+        if self.tracking_issue != other.tracking_issue {
+            mismatches.push("tracking issue");
+        }
+        if mismatches.is_empty() {
+            Ok(())
+        } else {
+            Err(mismatches)
+        }
+    }
+}
+
 pub type Features = HashMap<String, Feature>;
 
 pub fn check(path: &Path, bad: &mut bool, quiet: bool) {
@@ -242,23 +270,20 @@ fn get_and_check_lib_features(base_src_path: &Path,
                      &mut |res, file, line| {
             match res {
                 Ok((name, f)) => {
-                    let mut err = |msg: &str| {
-                        tidy_error!(bad, "{}:{}: {}", file.display(), line, msg);
-                    };
-                    if lang_features.contains_key(name) && name != "proc_macro" {
-                        err("duplicating a lang feature");
-                    }
-                    if let Some(ref s) = lib_features.get(name) {
-                        if s.level != f.level {
-                            err("different stability level than before");
-                        }
-                        if s.since != f.since {
-                            err("different `since` than before");
+                    let mut check_features = |f: &Feature, list: &Features, display: &str| {
+                        if let Some(ref s) = list.get(name) {
+                            if let Err(m) = (&f).check_match(s) {
+                                tidy_error!(bad,
+                                            "{}:{}: mismatches to {} in: {:?}",
+                                            file.display(),
+                                            line,
+                                            display,
+                                            &m);
+                            }
                         }
-                        if s.tracking_issue != f.tracking_issue {
-                            err("different `tracking_issue` than before");
-                        }
-                    }
+                    };
+                    check_features(&f, &lang_features, "corresponding lang feature");
+                    check_features(&f, &lib_features, "previous");
                     lib_features.insert(name.to_owned(), f);
                 },
                 Err(msg) => {