]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #55469 - pnkfelix:issue-54477-regression-tests, r=nikomatsakis
authorPietro Albini <pietro@pietroalbini.org>
Thu, 1 Nov 2018 10:55:20 +0000 (11:55 +0100)
committerGitHub <noreply@github.com>
Thu, 1 Nov 2018 10:55:20 +0000 (11:55 +0100)
Regression tests for issue #54477.

At some point someone may want to revisit PR #53564

it would be really good to have regression tests for #54477 before that happens. :)

153 files changed:
.travis.yml
appveyor.yml
src/Cargo.lock
src/bootstrap/channel.rs
src/bootstrap/dist.rs
src/ci/docker/x86_64-gnu/Dockerfile
src/liballoc/collections/vec_deque.rs
src/liballoc/lib.rs
src/liballoc/rc.rs
src/liballoc/sync.rs
src/liballoc/tests/lib.rs
src/libcompiler_builtins
src/libcore/lib.rs
src/libcore/mem.rs
src/libcore/num/mod.rs
src/libcore/ops/range.rs
src/libcore/ptr.rs
src/libcore/tests/lib.rs
src/libcore/time.rs
src/librustc/hir/lowering.rs
src/librustc/hir/map/collector.rs
src/librustc/ich/caching_codemap_view.rs [deleted file]
src/librustc/ich/caching_source_map_view.rs [new file with mode: 0644]
src/librustc/ich/mod.rs
src/librustc/infer/lexical_region_resolve/graphviz.rs
src/librustc/lib.rs
src/librustc/middle/dependency_format.rs
src/librustc/traits/util.rs
src/librustc/ty/query/on_disk_cache.rs
src/librustc/ty/steal.rs
src/librustc_codegen_llvm/debuginfo/metadata.rs
src/librustc_codegen_llvm/llvm/ffi.rs
src/librustc_data_structures/lib.rs
src/librustc_data_structures/tiny_list.rs
src/librustc_errors/emitter.rs
src/librustc_errors/lib.rs
src/librustc_lint/unused.rs
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/mutability_errors.rs
src/librustc_mir/const_eval.rs
src/librustc_mir/interpret/validity.rs
src/librustc_mir/lib.rs
src/librustc_resolve/lib.rs
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/json_dumper.rs
src/librustc_target/lib.rs
src/librustc_target/spec/msp430_none_elf.rs
src/librustc_traits/implied_outlives_bounds.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/mod.rs
src/librustdoc/html/static/main.js
src/librustdoc/html/static/rustdoc.css
src/libstd/lib.rs
src/libstd/thread/mod.rs
src/libsyntax/json.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/source_map.rs
src/libsyntax/test_snippet.rs
src/libsyntax_pos/analyze_source_file.rs
src/libsyntax_pos/lib.rs
src/llvm
src/rustllvm/RustWrapper.cpp
src/stage0.txt
src/test/codegen/enum-debug-clike.rs [new file with mode: 0644]
src/test/codegen/enum-debug-niche.rs [new file with mode: 0644]
src/test/codegen/enum-debug-tagged.rs [new file with mode: 0644]
src/test/debuginfo/basic-types.rs
src/test/debuginfo/borrowed-enum-legacy.rs [new file with mode: 0644]
src/test/debuginfo/borrowed-enum.rs
src/test/debuginfo/cross-crate-spans.rs
src/test/debuginfo/destructured-for-loop-variable.rs
src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs [new file with mode: 0644]
src/test/debuginfo/generic-enum-with-different-disr-sizes.rs
src/test/debuginfo/generic-struct-style-enum-legacy.rs [new file with mode: 0644]
src/test/debuginfo/generic-struct-style-enum.rs
src/test/debuginfo/generic-tuple-style-enum-legacy.rs [new file with mode: 0644]
src/test/debuginfo/generic-tuple-style-enum.rs
src/test/debuginfo/method-on-tuple-struct.rs
src/test/debuginfo/nil-enum.rs
src/test/debuginfo/recursive-struct-legacy.rs [new file with mode: 0644]
src/test/debuginfo/recursive-struct.rs
src/test/debuginfo/struct-style-enum-legacy.rs [new file with mode: 0644]
src/test/debuginfo/struct-style-enum.rs
src/test/debuginfo/tuple-style-enum-legacy.rs [new file with mode: 0644]
src/test/debuginfo/tuple-style-enum.rs
src/test/debuginfo/unique-enum-legacy.rs [new file with mode: 0644]
src/test/debuginfo/unique-enum.rs
src/test/debuginfo/vec-slices.rs
src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs
src/test/run-pass/issue-55376.rs [new file with mode: 0644]
src/test/ui/access-mode-in-closures.nll.stderr
src/test/ui/binop/binop-move-semantics.nll.stderr
src/test/ui/borrowck/borrowck-closures-unique.nll.stderr
src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr
src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr [deleted file]
src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr
src/test/ui/borrowck/borrowck-in-static.nll.stderr
src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr
src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr
src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr
src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr
src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr
src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr
src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr
src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr
src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr [deleted file]
src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr
src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr
src/test/ui/borrowck/issue-51415.nll.stderr
src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr [new file with mode: 0644]
src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr [new file with mode: 0644]
src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs [new file with mode: 0644]
src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr [deleted file]
src/test/ui/borrowck/mutability-errors.nll.stderr
src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr
src/test/ui/by-move-pattern-binding.nll.stderr
src/test/ui/check-static-values-constraints.nll.stderr
src/test/ui/consts/const-eval/issue-49296.rs [new file with mode: 0644]
src/test/ui/consts/const-eval/issue-49296.stderr [new file with mode: 0644]
src/test/ui/consts/const-validation-fail-55455.rs [new file with mode: 0644]
src/test/ui/consts/promoted-validation-55454.rs [new file with mode: 0644]
src/test/ui/dst/dst-index.nll.stderr
src/test/ui/dst/dst-rvalue.nll.stderr
src/test/ui/error-codes/E0507.nll.stderr [deleted file]
src/test/ui/issues/issue-12567.nll.stderr
src/test/ui/issues/issue-17718-static-move.nll.stderr
src/test/ui/issues/issue-20801.nll.stderr
src/test/ui/issues/issue-2590.nll.stderr
src/test/ui/issues/issue-30355.nll.stderr
src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr
src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr
src/test/ui/issues/issue-4335.nll.stderr
src/test/ui/lint/unused_parens_json_suggestion.rs
src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr
src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr
src/test/ui/nll/cannot-move-block-spans.nll.stderr
src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr
src/test/ui/static/static-items-cant-move.nll.stderr [deleted file]
src/test/ui/std-uncopyable-atomics.nll.stderr
src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr [deleted file]
src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr
src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr
src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr
src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr
src/test/ui/unop-move-semantics.nll.stderr
src/test/ui/unsized-locals/unsized-exprs2.nll.stderr
src/tools/cargo
src/tools/clippy
src/tools/compiletest/src/header.rs
src/tools/lldb

index ec8060b9f56aaae8c934c60f9e11ae613306dd74..990cac4dbe98b04621f14d66473ed8d870867317 100644 (file)
@@ -197,23 +197,10 @@ matrix:
         . src/ci/docker/x86_64-gnu-tools/repo.sh;
         commit_toolstate_change "$MESSAGE_FILE" "$TRAVIS_BUILD_DIR/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "$MESSAGE_FILE" "$TOOLSTATE_REPO_ACCESS_TOKEN";
 
-env:
-  global:
-    - SCCACHE_BUCKET=rust-lang-ci-sccache2
-    - SCCACHE_REGION=us-west-1
-    - AWS_ACCESS_KEY_ID=AKIAJAMV3QAMMA6AXHFQ
-    # AWS_SECRET_ACCESS_KEY=...
-    - secure: "j96XxTVOSUf4s4r4htIxn/fvIa5DWbMgLqWl7r8z2QfgUwscmkMXAwXuFNc7s7bGTpV/+CgDiMFFM6BAFLGKutytIF6oA02s9b+usQYnM0th7YQ2AIgm9GtMTJCJp4AoyfFmh8F2faUICBZlfVLUJ34udHEe35vOklix+0k4WDo="
-    # TOOLSTATE_REPO_ACCESS_TOKEN=...
-    - secure: "ESfcXqv4N2VMhqi2iIyw6da9VrsA78I4iR1asouCaq4hzTTrkB4WNRrfURy6xg72gQ4nMhtRJbB0/2jmc9Cu1+g2CzXtyiL223aJ5CKrXdcvbitopQSDfp07dMWm+UED+hNFEanpErKAeU/6FM3A+J+60PMk8MCF1h9tqNRISJw="
-
 before_install:
-  # We'll use the AWS cli to download/upload cached docker layers, so install
-  # that here.
-  - if [ "$TRAVIS_OS_NAME" = linux ]; then
-      pip install --user awscli;
-      export PATH=$PATH:$HOME/.local/bin;
-    fi
+  # We'll use the AWS cli to download/upload cached docker layers as well as
+  # push our deployments, so download that here.
+  - pip install --user awscli; export PATH=$PATH:$HOME/.local/bin
   - mkdir -p $HOME/rustsrc
   # FIXME(#46924): these two commands are required to enable IPv6,
   # they shouldn't exist, please revert once more official solutions appeared.
@@ -276,6 +263,23 @@ after_success:
       echo "#### Build successful; Disk usage after running script:";
       df -h;
       du . | sort -nr | head -n100
+  - >
+      if [ "$DEPLOY$DEPLOY_ALT" == "1" ]; then
+        mkdir -p deploy/$TRAVIS_COMMIT;
+        if [ "$TRAVIS_OS_NAME" == "osx" ]; then
+            rm -rf build/dist/doc &&
+            cp -r build/dist/* deploy/$TRAVIS_COMMIT;
+        else
+            rm -rf obj/build/dist/doc &&
+            cp -r obj/build/dist/* deploy/$TRAVIS_COMMIT;
+        fi;
+        ls -la deploy/$TRAVIS_COMMIT;
+        deploy_dir=rustc-builds;
+        if [ "$DEPLOY_ALT" == "1" ]; then
+            deploy_dir=rustc-builds-alt;
+        fi;
+        travis_retry aws s3 cp --no-progress --recursive --acl public-read ./deploy s3://rust-lang-ci2/$deploy_dir
+      fi
 
 after_failure:
   - >
@@ -322,77 +326,3 @@ after_failure:
 
 notifications:
   email: false
-
-before_deploy:
-  - mkdir -p deploy/$TRAVIS_COMMIT
-  - >
-      if [ "$TRAVIS_OS_NAME" == "osx" ]; then
-          rm -rf build/dist/doc &&
-          cp -r build/dist/* deploy/$TRAVIS_COMMIT;
-      else
-          rm -rf obj/build/dist/doc &&
-          cp -r obj/build/dist/* deploy/$TRAVIS_COMMIT;
-      fi
-  - ls -la deploy/$TRAVIS_COMMIT
-
-deploy:
-  - provider: s3
-    bucket: rust-lang-ci2
-    skip_cleanup: true
-    local_dir: deploy
-    upload_dir: rustc-builds
-    acl: public_read
-    region: us-west-1
-    access_key_id: AKIAJVBODR3IA4O72THQ
-    secret_access_key:
-      secure: "kUGd3t7JcVWFESgIlzvsM8viZgCA9Encs3creW0xLJaLSeI1iVjlJK4h/2/nO6y224AFrh/GUfsNr4/4AlxPuYb8OU5oC5Lv+Ff2JiRDYtuNpyQSKAQp+bRYytWMtrmhja91h118Mbm90cUfcLPwkdiINgJNTXhPKg5Cqu3VYn0="
-    on:
-      branch: auto
-      condition: $DEPLOY = 1
-
-  # this is the same as the above deployment provider except that it uploads to
-  # a slightly different directory and has a different trigger
-  - provider: s3
-    bucket: rust-lang-ci2
-    skip_cleanup: true
-    local_dir: deploy
-    upload_dir: rustc-builds-alt
-    acl: public_read
-    region: us-west-1
-    access_key_id: AKIAJVBODR3IA4O72THQ
-    secret_access_key:
-      secure: "kUGd3t7JcVWFESgIlzvsM8viZgCA9Encs3creW0xLJaLSeI1iVjlJK4h/2/nO6y224AFrh/GUfsNr4/4AlxPuYb8OU5oC5Lv+Ff2JiRDYtuNpyQSKAQp+bRYytWMtrmhja91h118Mbm90cUfcLPwkdiINgJNTXhPKg5Cqu3VYn0="
-    on:
-      branch: auto
-      condition: $DEPLOY_ALT = 1
-
-  # These two providers are the same as the two above, except deploy on the
-  # try branch. Travis does not appear to provide a way to use "or" in these
-  # conditions.
-  - provider: s3
-    bucket: rust-lang-ci2
-    skip_cleanup: true
-    local_dir: deploy
-    upload_dir: rustc-builds
-    acl: public_read
-    region: us-west-1
-    access_key_id: AKIAJVBODR3IA4O72THQ
-    secret_access_key:
-      secure: "kUGd3t7JcVWFESgIlzvsM8viZgCA9Encs3creW0xLJaLSeI1iVjlJK4h/2/nO6y224AFrh/GUfsNr4/4AlxPuYb8OU5oC5Lv+Ff2JiRDYtuNpyQSKAQp+bRYytWMtrmhja91h118Mbm90cUfcLPwkdiINgJNTXhPKg5Cqu3VYn0="
-    on:
-      branch: try
-      condition: $DEPLOY = 1
-
-  - provider: s3
-    bucket: rust-lang-ci2
-    skip_cleanup: true
-    local_dir: deploy
-    upload_dir: rustc-builds-alt
-    acl: public_read
-    region: us-west-1
-    access_key_id: AKIAJVBODR3IA4O72THQ
-    secret_access_key:
-      secure: "kUGd3t7JcVWFESgIlzvsM8viZgCA9Encs3creW0xLJaLSeI1iVjlJK4h/2/nO6y224AFrh/GUfsNr4/4AlxPuYb8OU5oC5Lv+Ff2JiRDYtuNpyQSKAQp+bRYytWMtrmhja91h118Mbm90cUfcLPwkdiINgJNTXhPKg5Cqu3VYn0="
-    on:
-      branch: try
-      condition: $DEPLOY_ALT = 1
index 04951454c29e1316fa7a08fcd5a5cbf3cc9c760d..d519993f142882a31024067c0482cedf97ff214f 100644 (file)
@@ -1,12 +1,5 @@
 environment:
-  SCCACHE_BUCKET: rust-lang-ci-sccache2
-  SCCACHE_REGION: us-west-1
-  AWS_ACCESS_KEY_ID: AKIAJAMV3QAMMA6AXHFQ
-  AWS_SECRET_ACCESS_KEY:
-    secure: 7Y+JiquYedOAgnUU26uL0DPzrxmTtR+qIwG6rNKSuWDffqU3vVZxbGXim9QpTO80
   SCCACHE_DIGEST: f808afabb4a4eb1d7112bcb3fa6be03b61e93412890c88e177c667eb37f46353d7ec294e559b16f9f4b5e894f2185fe7670a0df15fd064889ecbd80f0c34166c
-  TOOLSTATE_REPO_ACCESS_TOKEN:
-    secure: gKGlVktr7iuqCoYSxHxDE9ltLOKU0nYDEuQxvWbNxUIW7ri5ppn8L06jQzN0GGzN
 
   # By default schannel checks revocation of certificates unlike some other SSL
   # backends, but we've historically had problems on CI where a revocation
@@ -235,10 +228,8 @@ before_deploy:
 
 deploy:
   - provider: S3
-    skip_cleanup: true
-    access_key_id: AKIAJVBODR3IA4O72THQ
-    secret_access_key:
-      secure: tQWIE+DJHjXaV4np/3YeETkEmXngtIuIgAO/LYKQaUshGLgN8cBCFGG3cHx5lKLt
+    access_key_id: $(AWS_ACCESS_KEY_ID)
+    secret_access_key: $(AWS_SECRET_ACCESS_KEY)
     bucket: rust-lang-ci2
     set_public: true
     region: us-west-1
@@ -252,10 +243,8 @@ deploy:
   # This provider is the same as the one above except that it has a slightly
   # different upload directory and a slightly different trigger
   - provider: S3
-    skip_cleanup: true
-    access_key_id: AKIAJVBODR3IA4O72THQ
-    secret_access_key:
-      secure: tQWIE+DJHjXaV4np/3YeETkEmXngtIuIgAO/LYKQaUshGLgN8cBCFGG3cHx5lKLt
+    access_key_id: $(AWS_ACCESS_KEY_ID)
+    secret_access_key: $(AWS_SECRET_ACCESS_KEY)
     bucket: rust-lang-ci2
     set_public: true
     region: us-west-1
index dd211083527922861f13b5b6bb884151a50604d8..db111b5d2b524ccdd281ed21a9a11ad1b18b42e6 100644 (file)
@@ -198,14 +198,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "cargo"
-version = "0.32.0"
+version = "0.33.0"
 dependencies = [
  "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "crates-io 0.20.0",
+ "crates-io 0.21.0",
  "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -326,7 +326,7 @@ dependencies = [
  "clippy-mini-macro-test 0.2.0",
  "clippy_dev 0.0.1",
  "clippy_lints 0.0.212",
- "compiletest_rs 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiletest_rs 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
  "derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -443,7 +443,7 @@ dependencies = [
 
 [[package]]
 name = "compiletest_rs"
-version = "0.3.13"
+version = "0.3.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -452,6 +452,7 @@ dependencies = [
  "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -482,7 +483,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "crates-io"
-version = "0.20.0"
+version = "0.21.0"
 dependencies = [
  "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)",
  "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1289,7 +1290,7 @@ dependencies = [
  "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiletest_rs 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiletest_rs 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
  "env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "vergen 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1783,7 +1784,7 @@ dependencies = [
 name = "rls"
 version = "0.130.5"
 dependencies = [
- "cargo 0.32.0",
+ "cargo 0.33.0",
  "cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "clippy_lints 0.0.212",
  "crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3202,7 +3203,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc"
 "checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007"
 "checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2"
-"checksum compiletest_rs 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "d3064bc712922596dd5ab449fca9261d411893356581fe5297b96aa8f53bb1b8"
+"checksum compiletest_rs 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "75e809f56d6aa9575b67924b0af686c4f4c1380314f47947e235e9ff7fa94bed"
 "checksum core-foundation 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cc3532ec724375c7cb7ff0a097b714fde180bb1f6ed2ab27cfcd99ffca873cd2"
 "checksum core-foundation-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a3fb15cdbdd9cf8b82d97d0296bb5cd3631bba58d6e31650a002a8e7fb5721f9"
 "checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19"
index 91bec69cfa401913105aa44418b6b86a88e28fbd..88b6925b2b1e72b445c5cb06fd67e1704ccb19ea 100644 (file)
@@ -24,7 +24,7 @@
 use config::Config;
 
 // The version number
-pub const CFG_RELEASE_NUM: &str = "1.31.0";
+pub const CFG_RELEASE_NUM: &str = "1.32.0";
 
 pub struct GitInfo {
     inner: Option<Info>,
index fea6302d0a119e6a5f0916dfefa4628bc040eebe..6d40575352418d45456ac7bde1b7e114cb47f770 100644 (file)
@@ -881,6 +881,7 @@ fn run(self, builder: &Builder) -> PathBuf {
             "src/jemalloc",
             "src/libprofiler_builtins",
             "src/stdsimd",
+            "src/libproc_macro",
         ];
         let std_src_dirs_exclude = [
             "src/libcompiler_builtins/compiler-rt/test",
index 444a8fe5da87ada787299721764de0589d7cd722..dd94f2652b4c9a86a9145cec5114dacdaec428d9 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:16.04
+FROM ubuntu:18.10
 
 RUN apt-get update && apt-get install -y --no-install-recommends \
   g++ \
index 571f35a2031d2a0b9e1eb57ac1f9728ca2fb245f..88e76033f273ed5ae7fed104539ef46a17412b5b 100644 (file)
@@ -36,6 +36,8 @@
 
 const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
 const MINIMUM_CAPACITY: usize = 1; // 2 - 1
+#[cfg(target_pointer_width = "16")]
+const MAXIMUM_ZST_CAPACITY: usize = 1 << (16 - 1); // Largest possible power of two
 #[cfg(target_pointer_width = "32")]
 const MAXIMUM_ZST_CAPACITY: usize = 1 << (32 - 1); // Largest possible power of two
 #[cfg(target_pointer_width = "64")]
index 84ca7c4fec9e5d4f154b4fe98a6aaea545887844..7db6261a01c0b0324180c59b08b0064731e6a22f 100644 (file)
@@ -86,7 +86,6 @@
 #![feature(box_syntax)]
 #![feature(cfg_target_has_atomic)]
 #![feature(coerce_unsized)]
-#![cfg_attr(stage0, feature(min_const_fn))]
 #![feature(core_intrinsics)]
 #![feature(custom_attribute)]
 #![feature(dropck_eyepatch)]
index 40bb2faa3623b0f357b983fd3ac0d7d3a9461eca..3e8dfd105de2ecf0dde779bdf38727fd8cd71321 100644 (file)
@@ -282,7 +282,7 @@ struct RcBox<T: ?Sized> {
 /// type `T`.
 ///
 /// [get_mut]: #method.get_mut
-#[cfg_attr(all(not(stage0), not(test)), lang = "rc")]
+#[cfg_attr(not(test), lang = "rc")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Rc<T: ?Sized> {
     ptr: NonNull<RcBox<T>>,
index 35935861fb18297ef11646d7e26feada3b2c8356..bcf5212f1ff6f2afb5b934cd6b64aee976e9e909 100644 (file)
 /// counting in general.
 ///
 /// [rc_examples]: ../../std/rc/index.html#examples
-#[cfg_attr(all(not(stage0), not(test)), lang = "arc")]
+#[cfg_attr(not(test), lang = "arc")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Arc<T: ?Sized> {
     ptr: NonNull<ArcInner<T>>,
index 6d1cfb10859d4bc4ee433c9247c66dbcbad1c088..3294837cb91c4ff2fa92defccc08e410ccae84a4 100644 (file)
@@ -11,7 +11,6 @@
 #![feature(allocator_api)]
 #![feature(alloc_system)]
 #![feature(box_syntax)]
-#![cfg_attr(stage0, feature(min_const_fn))]
 #![feature(drain_filter)]
 #![feature(exact_size_is_empty)]
 #![feature(pattern)]
index 0703bfa72524e01e414477657ca9b64794c5c1c3..939cbca6e9d829265d6cf006d3532142a4061cd3 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0703bfa72524e01e414477657ca9b64794c5c1c3
+Subproject commit 939cbca6e9d829265d6cf006d3532142a4061cd3
index 06727d8292d367e422f89d87542a82413d80cc0e..1bbc7892c6bef664ca4c91524252b436d1c36083 100644 (file)
@@ -88,7 +88,6 @@
 #![feature(doc_spotlight)]
 #![feature(extern_types)]
 #![feature(fundamental)]
-#![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
 #![feature(intrinsics)]
 #![feature(lang_items)]
 #![feature(link_llvm_intrinsics)]
index 22016e8cf41742612d1a1e62665ac03f93aec27f..1d0b194487e68d9bc9d65ef6841421544dffe5c9 100644 (file)
@@ -285,7 +285,7 @@ pub fn forget<T>(t: T) {
 /// [alignment]: ./fn.align_of.html
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-#[cfg_attr(not(stage0), rustc_promotable)]
+#[rustc_promotable]
 pub const fn size_of<T>() -> usize {
     intrinsics::size_of::<T>()
 }
@@ -377,7 +377,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-#[cfg_attr(not(stage0), rustc_promotable)]
+#[rustc_promotable]
 pub const fn align_of<T>() -> usize {
     intrinsics::min_align_of::<T>()
 }
@@ -458,19 +458,10 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize {
 #[inline]
 #[stable(feature = "needs_drop", since = "1.21.0")]
 #[rustc_const_unstable(feature = "const_needs_drop")]
-#[cfg(not(stage0))]
 pub const fn needs_drop<T>() -> bool {
     intrinsics::needs_drop::<T>()
 }
 
-#[inline]
-#[stable(feature = "needs_drop", since = "1.21.0")]
-#[cfg(stage0)]
-/// Ceci n'est pas la documentation
-pub fn needs_drop<T>() -> bool {
-    unsafe { intrinsics::needs_drop::<T>() }
-}
-
 /// Creates a value whose bytes are all zero.
 ///
 /// This has the same effect as allocating space with
index 772502cc800e868c4ca230328d548a0aabb21402..c6cbeea5a0ea61788979c6689e5a910bf9bd2b3e 100644 (file)
@@ -216,7 +216,7 @@ macro_rules! int_impl {
 ```"),
             #[stable(feature = "rust1", since = "1.0.0")]
             #[inline]
-            #[cfg_attr(not(stage0), rustc_promotable)]
+            #[rustc_promotable]
             pub const fn min_value() -> Self {
                 !0 ^ ((!0 as $UnsignedT) >> 1) as Self
             }
@@ -235,7 +235,7 @@ pub const fn min_value() -> Self {
 ```"),
             #[stable(feature = "rust1", since = "1.0.0")]
             #[inline]
-            #[cfg_attr(not(stage0), rustc_promotable)]
+            #[rustc_promotable]
             pub const fn max_value() -> Self {
                 !Self::min_value()
             }
index fd3e50998fe8c5e5909f7d4fb60f63a7c1f96551..6cfb1005325ba644223311f773bcdcfc4cd0033c 100644 (file)
@@ -391,7 +391,7 @@ impl<Idx> RangeInclusive<Idx> {
     /// ```
     #[stable(feature = "inclusive_range_methods", since = "1.27.0")]
     #[inline]
-    #[cfg_attr(not(stage0), rustc_promotable)]
+    #[rustc_promotable]
     pub const fn new(start: Idx, end: Idx) -> Self {
         Self { start, end, is_empty: None }
     }
index 0fe82b93ff7a14bca4c961ca03d8ab68dd38ca44..36852b10facde2a2222d6b933d78bf8f4578a503 100644 (file)
@@ -209,7 +209,7 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-#[cfg_attr(not(stage0), rustc_promotable)]
+#[rustc_promotable]
 pub const fn null<T>() -> *const T { 0 as *const T }
 
 /// Creates a null mutable raw pointer.
@@ -224,7 +224,7 @@ pub const fn null<T>() -> *const T { 0 as *const T }
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-#[cfg_attr(not(stage0), rustc_promotable)]
+#[rustc_promotable]
 pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
 
 /// Swaps the values at two mutable locations of the same type, without
index d340924aab1db7b602ef44070b11a1f7eaa3327f..5ac89912268986d0e75f7940f333e289dac51d1d 100644 (file)
@@ -19,7 +19,6 @@
 #![feature(flt2dec)]
 #![feature(fmt_internals)]
 #![feature(hashmap_internals)]
-#![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
 #![feature(pattern)]
 #![feature(range_is_empty)]
 #![feature(raw)]
index 81ae8ade12d93146afc32e15859fc96dcded4551..cfbd431aef0a00e87d5d9f0bf82cfbf15cf90919 100644 (file)
@@ -109,7 +109,7 @@ pub fn new(secs: u64, nanos: u32) -> Duration {
     /// ```
     #[stable(feature = "duration", since = "1.3.0")]
     #[inline]
-    #[cfg_attr(not(stage0), rustc_promotable)]
+    #[rustc_promotable]
     pub const fn from_secs(secs: u64) -> Duration {
         Duration { secs, nanos: 0 }
     }
@@ -128,7 +128,7 @@ pub const fn from_secs(secs: u64) -> Duration {
     /// ```
     #[stable(feature = "duration", since = "1.3.0")]
     #[inline]
-    #[cfg_attr(not(stage0), rustc_promotable)]
+    #[rustc_promotable]
     pub const fn from_millis(millis: u64) -> Duration {
         Duration {
             secs: millis / MILLIS_PER_SEC,
@@ -150,7 +150,7 @@ pub const fn from_millis(millis: u64) -> Duration {
     /// ```
     #[stable(feature = "duration_from_micros", since = "1.27.0")]
     #[inline]
-    #[cfg_attr(not(stage0), rustc_promotable)]
+    #[rustc_promotable]
     pub const fn from_micros(micros: u64) -> Duration {
         Duration {
             secs: micros / MICROS_PER_SEC,
@@ -172,7 +172,7 @@ pub const fn from_micros(micros: u64) -> Duration {
     /// ```
     #[stable(feature = "duration_extras", since = "1.27.0")]
     #[inline]
-    #[cfg_attr(not(stage0), rustc_promotable)]
+    #[rustc_promotable]
     pub const fn from_nanos(nanos: u64) -> Duration {
         Duration {
             secs: nanos / (NANOS_PER_SEC as u64),
index 9795c0cba61545a36015976b083cbae0a3d14b17..b6621e0962cf6e384e044a0f59bb42b87c3709b8 100644 (file)
@@ -1754,7 +1754,6 @@ fn lower_path_extra(
         &mut self,
         def: Def,
         p: &Path,
-        ident: Option<Ident>,
         param_mode: ParamMode,
         explicit_owner: Option<NodeId>,
     ) -> hir::Path {
@@ -1773,7 +1772,6 @@ fn lower_path_extra(
                         explicit_owner,
                     )
                 })
-                .chain(ident.map(|ident| hir::PathSegment::from_ident(ident)))
                 .collect(),
             span: p.span,
         }
@@ -1781,7 +1779,7 @@ fn lower_path_extra(
 
     fn lower_path(&mut self, id: NodeId, p: &Path, param_mode: ParamMode) -> hir::Path {
         let def = self.expect_full_def(id);
-        self.lower_path_extra(def, p, None, param_mode, None)
+        self.lower_path_extra(def, p, param_mode, None)
     }
 
     fn lower_path_segment(
@@ -3014,7 +3012,7 @@ fn lower_use_tree(
                     self.with_hir_id_owner(new_node_id, |this| {
                         let new_id = this.lower_node_id(new_node_id);
                         let path =
-                            this.lower_path_extra(def, &path, None, ParamMode::Explicit, None);
+                            this.lower_path_extra(def, &path, ParamMode::Explicit, None);
                         let item = hir::ItemKind::Use(P(path), hir::UseKind::Single);
                         let vis_kind = match vis.node {
                             hir::VisibilityKind::Public => hir::VisibilityKind::Public,
@@ -3022,8 +3020,14 @@ fn lower_use_tree(
                             hir::VisibilityKind::Inherited => hir::VisibilityKind::Inherited,
                             hir::VisibilityKind::Restricted { ref path, id: _, hir_id: _ } => {
                                 let id = this.next_id();
+                                let mut path = path.clone();
+                                for seg in path.segments.iter_mut() {
+                                    if seg.id.is_some() {
+                                        seg.id = Some(this.next_id().node_id);
+                                    }
+                                }
                                 hir::VisibilityKind::Restricted {
-                                    path: path.clone(),
+                                    path,
                                     id: id.node_id,
                                     hir_id: id.hir_id,
                                 }
@@ -3047,7 +3051,7 @@ fn lower_use_tree(
                 }
 
                 let path =
-                    P(self.lower_path_extra(ret_def, &path, None, ParamMode::Explicit, None));
+                    P(self.lower_path_extra(ret_def, &path, ParamMode::Explicit, None));
                 hir::ItemKind::Use(path, hir::UseKind::Single)
             }
             UseTreeKind::Glob => {
@@ -3134,7 +3138,7 @@ fn lower_use_tree(
                 // the stability of `use a::{};`, to avoid it showing up as
                 // a re-export by accident when `pub`, e.g. in documentation.
                 let def = self.expect_full_def_from_use(id).next().unwrap_or(Def::Err);
-                let path = P(self.lower_path_extra(def, &prefix, None, ParamMode::Explicit, None));
+                let path = P(self.lower_path_extra(def, &prefix, ParamMode::Explicit, None));
                 *vis = respan(prefix.span.shrink_to_lo(), hir::VisibilityKind::Inherited);
                 hir::ItemKind::Use(path, hir::UseKind::ListStem)
             }
@@ -4544,7 +4548,6 @@ fn lower_visibility(
                     path: P(self.lower_path_extra(
                         def,
                         path,
-                        None,
                         ParamMode::Explicit,
                         explicit_owner,
                     )),
index 8c701d9e4188fafa44fcebf7fdd4d536f3fb9087..4fbcd83adb555c70ce811bf61d24afbc7a62a824 100644 (file)
@@ -217,7 +217,7 @@ fn insert(&mut self, id: NodeId, node: Node<'hir>) {
                 };
 
                 bug!("inconsistent DepNode for `{}`: \
-                      current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?}) {}",
+                      current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?}){}",
                     node_str,
                     self.definitions
                         .def_path(self.current_dep_node_owner)
diff --git a/src/librustc/ich/caching_codemap_view.rs b/src/librustc/ich/caching_codemap_view.rs
deleted file mode 100644 (file)
index fbf4297..0000000
+++ /dev/null
@@ -1,113 +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.
-
-use rustc_data_structures::sync::Lrc;
-use syntax::source_map::SourceMap;
-use syntax_pos::{BytePos, SourceFile};
-
-#[derive(Clone)]
-struct CacheEntry {
-    time_stamp: usize,
-    line_number: usize,
-    line_start: BytePos,
-    line_end: BytePos,
-    file: Lrc<SourceFile>,
-    file_index: usize,
-}
-
-#[derive(Clone)]
-pub struct CachingSourceMapView<'cm> {
-    source_map: &'cm SourceMap,
-    line_cache: [CacheEntry; 3],
-    time_stamp: usize,
-}
-
-impl<'cm> CachingSourceMapView<'cm> {
-    pub fn new(source_map: &'cm SourceMap) -> CachingSourceMapView<'cm> {
-        let files = source_map.files();
-        let first_file = files[0].clone();
-        let entry = CacheEntry {
-            time_stamp: 0,
-            line_number: 0,
-            line_start: BytePos(0),
-            line_end: BytePos(0),
-            file: first_file,
-            file_index: 0,
-        };
-
-        CachingSourceMapView {
-            source_map,
-            line_cache: [entry.clone(), entry.clone(), entry],
-            time_stamp: 0,
-        }
-    }
-
-    pub fn byte_pos_to_line_and_col(&mut self,
-                                    pos: BytePos)
-                                    -> Option<(Lrc<SourceFile>, usize, BytePos)> {
-        self.time_stamp += 1;
-
-        // Check if the position is in one of the cached lines
-        for cache_entry in self.line_cache.iter_mut() {
-            if pos >= cache_entry.line_start && pos < cache_entry.line_end {
-                cache_entry.time_stamp = self.time_stamp;
-
-                return Some((cache_entry.file.clone(),
-                             cache_entry.line_number,
-                             pos - cache_entry.line_start));
-            }
-        }
-
-        // No cache hit ...
-        let mut oldest = 0;
-        for index in 1 .. self.line_cache.len() {
-            if self.line_cache[index].time_stamp < self.line_cache[oldest].time_stamp {
-                oldest = index;
-            }
-        }
-
-        let cache_entry = &mut self.line_cache[oldest];
-
-        // If the entry doesn't point to the correct file, fix it up
-        if pos < cache_entry.file.start_pos || pos >= cache_entry.file.end_pos {
-            let file_valid;
-            if self.source_map.files().len() > 0 {
-                let file_index = self.source_map.lookup_source_file_idx(pos);
-                let file = self.source_map.files()[file_index].clone();
-
-                if pos >= file.start_pos && pos < file.end_pos {
-                    cache_entry.file = file;
-                    cache_entry.file_index = file_index;
-                    file_valid = true;
-                } else {
-                    file_valid = false;
-                }
-            } else {
-                file_valid = false;
-            }
-
-            if !file_valid {
-                return None;
-            }
-        }
-
-        let line_index = cache_entry.file.lookup_line(pos).unwrap();
-        let line_bounds = cache_entry.file.line_bounds(line_index);
-
-        cache_entry.line_number = line_index + 1;
-        cache_entry.line_start = line_bounds.0;
-        cache_entry.line_end = line_bounds.1;
-        cache_entry.time_stamp = self.time_stamp;
-
-        return Some((cache_entry.file.clone(),
-                     cache_entry.line_number,
-                     pos - cache_entry.line_start));
-    }
-}
diff --git a/src/librustc/ich/caching_source_map_view.rs b/src/librustc/ich/caching_source_map_view.rs
new file mode 100644 (file)
index 0000000..fbf4297
--- /dev/null
@@ -0,0 +1,113 @@
+// 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.
+
+use rustc_data_structures::sync::Lrc;
+use syntax::source_map::SourceMap;
+use syntax_pos::{BytePos, SourceFile};
+
+#[derive(Clone)]
+struct CacheEntry {
+    time_stamp: usize,
+    line_number: usize,
+    line_start: BytePos,
+    line_end: BytePos,
+    file: Lrc<SourceFile>,
+    file_index: usize,
+}
+
+#[derive(Clone)]
+pub struct CachingSourceMapView<'cm> {
+    source_map: &'cm SourceMap,
+    line_cache: [CacheEntry; 3],
+    time_stamp: usize,
+}
+
+impl<'cm> CachingSourceMapView<'cm> {
+    pub fn new(source_map: &'cm SourceMap) -> CachingSourceMapView<'cm> {
+        let files = source_map.files();
+        let first_file = files[0].clone();
+        let entry = CacheEntry {
+            time_stamp: 0,
+            line_number: 0,
+            line_start: BytePos(0),
+            line_end: BytePos(0),
+            file: first_file,
+            file_index: 0,
+        };
+
+        CachingSourceMapView {
+            source_map,
+            line_cache: [entry.clone(), entry.clone(), entry],
+            time_stamp: 0,
+        }
+    }
+
+    pub fn byte_pos_to_line_and_col(&mut self,
+                                    pos: BytePos)
+                                    -> Option<(Lrc<SourceFile>, usize, BytePos)> {
+        self.time_stamp += 1;
+
+        // Check if the position is in one of the cached lines
+        for cache_entry in self.line_cache.iter_mut() {
+            if pos >= cache_entry.line_start && pos < cache_entry.line_end {
+                cache_entry.time_stamp = self.time_stamp;
+
+                return Some((cache_entry.file.clone(),
+                             cache_entry.line_number,
+                             pos - cache_entry.line_start));
+            }
+        }
+
+        // No cache hit ...
+        let mut oldest = 0;
+        for index in 1 .. self.line_cache.len() {
+            if self.line_cache[index].time_stamp < self.line_cache[oldest].time_stamp {
+                oldest = index;
+            }
+        }
+
+        let cache_entry = &mut self.line_cache[oldest];
+
+        // If the entry doesn't point to the correct file, fix it up
+        if pos < cache_entry.file.start_pos || pos >= cache_entry.file.end_pos {
+            let file_valid;
+            if self.source_map.files().len() > 0 {
+                let file_index = self.source_map.lookup_source_file_idx(pos);
+                let file = self.source_map.files()[file_index].clone();
+
+                if pos >= file.start_pos && pos < file.end_pos {
+                    cache_entry.file = file;
+                    cache_entry.file_index = file_index;
+                    file_valid = true;
+                } else {
+                    file_valid = false;
+                }
+            } else {
+                file_valid = false;
+            }
+
+            if !file_valid {
+                return None;
+            }
+        }
+
+        let line_index = cache_entry.file.lookup_line(pos).unwrap();
+        let line_bounds = cache_entry.file.line_bounds(line_index);
+
+        cache_entry.line_number = line_index + 1;
+        cache_entry.line_start = line_bounds.0;
+        cache_entry.line_end = line_bounds.1;
+        cache_entry.time_stamp = self.time_stamp;
+
+        return Some((cache_entry.file.clone(),
+                     cache_entry.line_number,
+                     pos - cache_entry.line_start));
+    }
+}
index a23bab6226ef31480e595273e25044cec20f3927..9751c560acd1e0535a4aa057b945bfc27188a974 100644 (file)
 //! ICH - Incremental Compilation Hash
 
 crate use rustc_data_structures::fingerprint::Fingerprint;
-pub use self::caching_codemap_view::CachingSourceMapView;
+pub use self::caching_source_map_view::CachingSourceMapView;
 pub use self::hcx::{StableHashingContextProvider, StableHashingContext, NodeIdHashingMode,
                     hash_stable_trait_impls};
-mod caching_codemap_view;
+mod caching_source_map_view;
 mod hcx;
 
 mod impls_cstore;
index 3b92d032bdc5a07716adbd662b1f96aab1cfdc08..a210d63f129e31e6527389b8b4274917f50e0ab2 100644 (file)
@@ -230,10 +230,7 @@ impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
     type Node = Node;
     type Edge = Edge<'tcx>;
     fn nodes(&self) -> dot::Nodes<'_, Node> {
-        let mut set = FxHashSet::default();
-        for node in self.node_ids.keys() {
-            set.insert(*node);
-        }
+        let set = self.node_ids.keys().cloned().collect::<FxHashSet<_>>();
         debug!("constraint graph has {} nodes", set.len());
         set.into_iter().collect()
     }
index d8defabd3fe6616f90802efe8d956f438952c158..0aa964a44fd2cf962d5d8fe83d6cfef765af0f6e 100644 (file)
@@ -42,7 +42,6 @@
 
 #![feature(box_patterns)]
 #![feature(box_syntax)]
-#![cfg_attr(stage0, feature(min_const_fn))]
 #![feature(core_intrinsics)]
 #![feature(drain_filter)]
 #![cfg_attr(windows, feature(libc))]
@@ -67,7 +66,6 @@
 #![feature(step_trait)]
 #![feature(integer_atomics)]
 #![feature(test)]
-#![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
 #![feature(in_band_lifetimes)]
 #![feature(macro_at_most_once_rep)]
 #![feature(crate_visibility_modifier)]
index 8b5c6d147d7819bf2c6528a93a272651eb8b050f..e3f9c51a1235ee934e046c90e09046d9689097d8 100644 (file)
@@ -94,12 +94,11 @@ pub enum Linkage {
 
 pub fn calculate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let sess = &tcx.sess;
-    let mut fmts = FxHashMap::default();
-    for &ty in sess.crate_types.borrow().iter() {
+    let fmts = sess.crate_types.borrow().iter().map(|&ty| {
         let linkage = calculate_type(tcx, ty);
         verify_ok(tcx, &linkage);
-        fmts.insert(ty, linkage);
-    }
+        (ty, linkage)
+    }).collect::<FxHashMap<_, _>>();
     sess.abort_if_errors();
     sess.dependency_formats.set(fmts);
 }
index 0b7526dd78428d7ece38f345b521e69fd3bb5e0d..940cf736012ec0c0e2a9bde0ffdce2c34b5a0270 100644 (file)
@@ -103,11 +103,10 @@ pub fn elaborate_trait_ref<'cx, 'gcx, 'tcx>(
 
 pub fn elaborate_trait_refs<'cx, 'gcx, 'tcx>(
     tcx: TyCtxt<'cx, 'gcx, 'tcx>,
-    trait_refs: &[ty::PolyTraitRef<'tcx>])
+    trait_refs: impl Iterator<Item = ty::PolyTraitRef<'tcx>>)
     -> Elaborator<'cx, 'gcx, 'tcx>
 {
-    let predicates = trait_refs.iter()
-                               .map(|trait_ref| trait_ref.to_predicate())
+    let predicates = trait_refs.map(|trait_ref| trait_ref.to_predicate())
                                .collect();
     elaborate_predicates(tcx, predicates)
 }
@@ -271,7 +270,7 @@ pub fn supertraits<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>,
 }
 
 pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>,
-                                          bounds: &[ty::PolyTraitRef<'tcx>])
+                                          bounds: impl Iterator<Item = ty::PolyTraitRef<'tcx>>)
                                           -> Supertraits<'cx, 'gcx, 'tcx>
 {
     elaborate_trait_refs(tcx, bounds).filter_to_traits()
index 636720bf3c47c44a74d69530f0e4b76f1e9b69d4..3dc31c517169f2a0f9708186e3315cc797e74793 100644 (file)
@@ -25,7 +25,7 @@
 use session::{CrateDisambiguator, Session};
 use std::mem;
 use syntax::ast::NodeId;
-use syntax::source_map::{SourceMap, StableFilemapId};
+use syntax::source_map::{SourceMap, StableSourceFileId};
 use syntax_pos::{BytePos, Span, DUMMY_SP, SourceFile};
 use syntax_pos::hygiene::{Mark, SyntaxContext, ExpnInfo};
 use ty;
@@ -62,7 +62,7 @@ pub struct OnDiskCache<'sess> {
     cnum_map: Once<IndexVec<CrateNum, Option<CrateNum>>>,
 
     source_map: &'sess SourceMap,
-    file_index_to_stable_id: FxHashMap<SourceFileIndex, StableFilemapId>,
+    file_index_to_stable_id: FxHashMap<SourceFileIndex, StableSourceFileId>,
 
     // These two fields caches that are populated lazily during decoding.
     file_index_to_file: Lock<FxHashMap<SourceFileIndex, Lrc<SourceFile>>>,
@@ -82,7 +82,7 @@ pub struct OnDiskCache<'sess> {
 // This type is used only for (de-)serialization.
 #[derive(RustcEncodable, RustcDecodable)]
 struct Footer {
-    file_index_to_stable_id: FxHashMap<SourceFileIndex, StableFilemapId>,
+    file_index_to_stable_id: FxHashMap<SourceFileIndex, StableSourceFileId>,
     prev_cnums: Vec<(u32, String, CrateDisambiguator)>,
     query_result_index: EncodedQueryResultIndex,
     diagnostics_index: EncodedQueryResultIndex,
@@ -174,14 +174,17 @@ pub fn serialize<'a, 'tcx, E>(&self,
         tcx.dep_graph.with_ignore(|| {
             // Allocate SourceFileIndices
             let (file_to_file_index, file_index_to_stable_id) = {
-                let mut file_to_file_index = FxHashMap::default();
-                let mut file_index_to_stable_id = FxHashMap::default();
+                let files = tcx.sess.source_map().files();
+                let mut file_to_file_index = FxHashMap::with_capacity_and_hasher(
+                    files.len(), Default::default());
+                let mut file_index_to_stable_id = FxHashMap::with_capacity_and_hasher(
+                    files.len(), Default::default());
 
-                for (index, file) in tcx.sess.source_map().files().iter().enumerate() {
+                for (index, file) in files.iter().enumerate() {
                     let index = SourceFileIndex(index as u32);
                     let file_ptr: *const SourceFile = &**file as *const _;
                     file_to_file_index.insert(file_ptr, index);
-                    file_index_to_stable_id.insert(index, StableFilemapId::new(&file));
+                    file_index_to_stable_id.insert(index, StableSourceFileId::new(&file));
                 }
 
                 (file_to_file_index, file_index_to_stable_id)
@@ -473,7 +476,7 @@ struct CacheDecoder<'a, 'tcx: 'a, 'x> {
     cnum_map: &'x IndexVec<CrateNum, Option<CrateNum>>,
     synthetic_expansion_infos: &'x Lock<FxHashMap<AbsoluteBytePos, SyntaxContext>>,
     file_index_to_file: &'x Lock<FxHashMap<SourceFileIndex, Lrc<SourceFile>>>,
-    file_index_to_stable_id: &'x FxHashMap<SourceFileIndex, StableFilemapId>,
+    file_index_to_stable_id: &'x FxHashMap<SourceFileIndex, StableSourceFileId>,
     alloc_decoding_session: AllocDecodingSession<'x>,
 }
 
index 1092e23ec3b1d4b182fd9447a7ab7c4731e15f0d..fc3353e339b4d77a27dbad8f0ce933cc656b44bc 100644 (file)
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 use rustc_data_structures::sync::{RwLock, ReadGuard, MappedReadGuard};
-use std::mem;
 
 /// The `Steal` struct is intended to used as the value for a query.
 /// Specifically, we sometimes have queries (*cough* MIR *cough*)
@@ -51,7 +50,7 @@ pub fn borrow(&self) -> MappedReadGuard<'_, T> {
 
     pub fn steal(&self) -> T {
         let value_ref = &mut *self.value.try_write().expect("stealing value which is locked");
-        let value = mem::replace(value_ref, None);
+        let value = value_ref.take();
         value.expect("attempt to read from stolen value")
     }
 }
index 846d505641103dd864de097c137b2d19165fad62..ba1e3f5960c8596b0d4c484aff8f703fd986d8ef 100644 (file)
 use rustc::ich::NodeIdHashingMode;
 use rustc_data_structures::fingerprint::Fingerprint;
 use rustc::ty::Instance;
-use common::CodegenCx;
+use common::{CodegenCx, C_u64};
 use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt};
-use rustc::ty::layout::{self, Align, LayoutOf, PrimitiveExt, Size, TyLayout};
+use rustc::ty::layout::{self, Align, HasDataLayout, Integer, IntegerExt, LayoutOf,
+                        PrimitiveExt, Size, TyLayout};
 use rustc::session::config;
 use rustc::util::nodemap::FxHashMap;
 use rustc_fs_util::path2cstr;
@@ -205,6 +206,7 @@ enum RecursiveTypeDescription<'ll, 'tcx> {
         unfinished_type: Ty<'tcx>,
         unique_type_id: UniqueTypeId,
         metadata_stub: &'ll DICompositeType,
+        member_holding_stub: &'ll DICompositeType,
         member_description_factory: MemberDescriptionFactory<'ll, 'tcx>,
     },
     FinalMetadata(&'ll DICompositeType)
@@ -215,6 +217,7 @@ fn create_and_register_recursive_type_forward_declaration(
     unfinished_type: Ty<'tcx>,
     unique_type_id: UniqueTypeId,
     metadata_stub: &'ll DICompositeType,
+    member_holding_stub: &'ll DICompositeType,
     member_description_factory: MemberDescriptionFactory<'ll, 'tcx>,
 ) -> RecursiveTypeDescription<'ll, 'tcx> {
 
@@ -227,6 +230,7 @@ fn create_and_register_recursive_type_forward_declaration(
         unfinished_type,
         unique_type_id,
         metadata_stub,
+        member_holding_stub,
         member_description_factory,
     }
 }
@@ -242,6 +246,7 @@ fn finalize(&self, cx: &CodegenCx<'ll, 'tcx>) -> MetadataCreationResult<'ll> {
                 unfinished_type,
                 unique_type_id,
                 metadata_stub,
+                member_holding_stub,
                 ref member_description_factory,
             } => {
                 // Make sure that we have a forward declaration of the type in
@@ -266,7 +271,7 @@ fn finalize(&self, cx: &CodegenCx<'ll, 'tcx>) -> MetadataCreationResult<'ll> {
 
                 // ... and attach them to the stub to complete it.
                 set_members_of_composite_type(cx,
-                                              metadata_stub,
+                                              member_holding_stub,
                                               member_descriptions);
                 return MetadataCreationResult::new(metadata_stub, true);
             }
@@ -350,6 +355,7 @@ fn vec_slice_metadata(
             size: pointer_size,
             align: pointer_align,
             flags: DIFlags::FlagZero,
+            discriminant: None,
         },
         MemberDescription {
             name: "length".to_owned(),
@@ -358,6 +364,7 @@ fn vec_slice_metadata(
             size: usize_size,
             align: usize_align,
             flags: DIFlags::FlagZero,
+            discriminant: None,
         },
     ];
 
@@ -458,6 +465,7 @@ fn trait_pointer_metadata(
             size: data_ptr_field.size,
             align: data_ptr_field.align,
             flags: DIFlags::FlagArtificial,
+            discriminant: None,
         },
         MemberDescription {
             name: "vtable".to_owned(),
@@ -466,6 +474,7 @@ fn trait_pointer_metadata(
             size: vtable_field.size,
             align: vtable_field.align,
             flags: DIFlags::FlagArtificial,
+            discriminant: None,
         },
     ];
 
@@ -914,6 +923,7 @@ struct MemberDescription<'ll> {
     size: Size,
     align: Align,
     flags: DIFlags,
+    discriminant: Option<u64>,
 }
 
 // A factory for MemberDescriptions. It produces a list of member descriptions
@@ -981,6 +991,7 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
                 size,
                 align,
                 flags: DIFlags::FlagZero,
+                discriminant: None,
             }
         }).collect()
     }
@@ -1013,6 +1024,7 @@ fn prepare_struct_metadata(
         struct_type,
         unique_type_id,
         struct_metadata_stub,
+        struct_metadata_stub,
         StructMDF(StructMemberDescriptionFactory {
             ty: struct_type,
             variant,
@@ -1045,6 +1057,7 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
                 size,
                 align,
                 flags: DIFlags::FlagZero,
+                discriminant: None,
             }
         }).collect()
     }
@@ -1059,15 +1072,18 @@ fn prepare_tuple_metadata(
 ) -> RecursiveTypeDescription<'ll, 'tcx> {
     let tuple_name = compute_debuginfo_type_name(cx, tuple_type, false);
 
+    let struct_stub = create_struct_stub(cx,
+                                         tuple_type,
+                                         &tuple_name[..],
+                                         unique_type_id,
+                                         NO_SCOPE_METADATA);
+
     create_and_register_recursive_type_forward_declaration(
         cx,
         tuple_type,
         unique_type_id,
-        create_struct_stub(cx,
-                           tuple_type,
-                           &tuple_name[..],
-                           unique_type_id,
-                           NO_SCOPE_METADATA),
+        struct_stub,
+        struct_stub,
         TupleMDF(TupleMemberDescriptionFactory {
             ty: tuple_type,
             component_types: component_types.to_vec(),
@@ -1099,6 +1115,7 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
                 size,
                 align,
                 flags: DIFlags::FlagZero,
+                discriminant: None,
             }
         }).collect()
     }
@@ -1130,6 +1147,7 @@ fn prepare_union_metadata(
         union_type,
         unique_type_id,
         union_metadata_stub,
+        union_metadata_stub,
         UnionMDF(UnionMemberDescriptionFactory {
             layout: cx.layout_of(union_type),
             variant,
@@ -1142,6 +1160,20 @@ fn prepare_union_metadata(
 // Enums
 //=-----------------------------------------------------------------------------
 
+// DWARF variant support is only available starting in LLVM 7.
+// Although the earlier enum debug info output did not work properly
+// in all situations, it is better for the time being to continue to
+// sometimes emit the old style rather than emit something completely
+// useless when rust is compiled against LLVM 6 or older.  This
+// function decides which representation will be emitted.
+fn use_enum_fallback(cx: &CodegenCx) -> bool {
+    // On MSVC we have to use the fallback mode, because LLVM doesn't
+    // lower variant parts to PDB.
+    return cx.sess().target.target.options.is_like_msvc || unsafe {
+        llvm::LLVMRustVersionMajor() < 7
+    };
+}
+
 // Describes the members of an enum value: An enum is described as a union of
 // structs in DWARF. This MemberDescriptionFactory provides the description for
 // the members of this union; so for every variant of the given enum, this
@@ -1159,6 +1191,15 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
     fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
                                   -> Vec<MemberDescription<'ll>> {
         let adt = &self.enum_type.ty_adt_def().unwrap();
+
+        // This will always find the metadata in the type map.
+        let fallback = use_enum_fallback(cx);
+        let self_metadata = if fallback {
+            self.containing_scope
+        } else {
+            type_metadata(cx, self.enum_type, self.span)
+        };
+
         match self.layout.variants {
             layout::Variants::Single { .. } if adt.variants.is_empty() => vec![],
             layout::Variants::Single { index } => {
@@ -1167,7 +1208,7 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
                                           self.layout,
                                           &adt.variants[index],
                                           NoDiscriminant,
-                                          self.containing_scope,
+                                          self_metadata,
                                           self.span);
 
                 let member_descriptions =
@@ -1178,18 +1219,28 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
                                               member_descriptions);
                 vec![
                     MemberDescription {
-                        name: String::new(),
+                        name: if fallback {
+                            String::new()
+                        } else {
+                            adt.variants[index].name.as_str().to_string()
+                        },
                         type_metadata: variant_type_metadata,
                         offset: Size::ZERO,
                         size: self.layout.size,
                         align: self.layout.align,
-                        flags: DIFlags::FlagZero
+                        flags: DIFlags::FlagZero,
+                        discriminant: None,
                     }
                 ]
             }
             layout::Variants::Tagged { ref variants, .. } => {
-                let discriminant_info = RegularDiscriminant(self.discriminant_type_metadata
-                    .expect(""));
+                let discriminant_info = if fallback {
+                    RegularDiscriminant(self.discriminant_type_metadata
+                                        .expect(""))
+                } else {
+                    // This doesn't matter in this case.
+                    NoDiscriminant
+                };
                 (0..variants.len()).map(|i| {
                     let variant = self.layout.for_variant(cx, i);
                     let (variant_type_metadata, member_desc_factory) =
@@ -1197,7 +1248,7 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
                                               variant,
                                               &adt.variants[i],
                                               discriminant_info,
-                                              self.containing_scope,
+                                              self_metadata,
                                               self.span);
 
                     let member_descriptions = member_desc_factory
@@ -1207,75 +1258,127 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
                                                   variant_type_metadata,
                                                   member_descriptions);
                     MemberDescription {
-                        name: String::new(),
+                        name: if fallback {
+                            String::new()
+                        } else {
+                            adt.variants[i].name.as_str().to_string()
+                        },
                         type_metadata: variant_type_metadata,
                         offset: Size::ZERO,
-                        size: variant.size,
-                        align: variant.align,
-                        flags: DIFlags::FlagZero
+                        size: self.layout.size,
+                        align: self.layout.align,
+                        flags: DIFlags::FlagZero,
+                        discriminant: Some(self.layout.ty.ty_adt_def().unwrap()
+                                           .discriminant_for_variant(cx.tcx, i)
+                                           .val as u64),
                     }
                 }).collect()
             }
-            layout::Variants::NicheFilling { dataful_variant, ref niche_variants, .. } => {
-                let variant = self.layout.for_variant(cx, dataful_variant);
-                // Create a description of the non-null variant
-                let (variant_type_metadata, member_description_factory) =
-                    describe_enum_variant(cx,
-                                          variant,
-                                          &adt.variants[dataful_variant],
-                                          OptimizedDiscriminant,
-                                          self.containing_scope,
-                                          self.span);
+            layout::Variants::NicheFilling {
+                ref niche_variants,
+                niche_start,
+                ref variants,
+                dataful_variant,
+                ..
+            } => {
+                if fallback {
+                    let variant = self.layout.for_variant(cx, dataful_variant);
+                    // Create a description of the non-null variant
+                    let (variant_type_metadata, member_description_factory) =
+                        describe_enum_variant(cx,
+                                              variant,
+                                              &adt.variants[dataful_variant],
+                                              OptimizedDiscriminant,
+                                              self.containing_scope,
+                                              self.span);
 
-                let variant_member_descriptions =
-                    member_description_factory.create_member_descriptions(cx);
+                    let variant_member_descriptions =
+                        member_description_factory.create_member_descriptions(cx);
 
-                set_members_of_composite_type(cx,
-                                              variant_type_metadata,
-                                              variant_member_descriptions);
-
-                // Encode the information about the null variant in the union
-                // member's name.
-                let mut name = String::from("RUST$ENCODED$ENUM$");
-                // HACK(eddyb) the debuggers should just handle offset+size
-                // of discriminant instead of us having to recover its path.
-                // Right now it's not even going to work for `niche_start > 0`,
-                // and for multiple niche variants it only supports the first.
-                fn compute_field_path<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
-                                                name: &mut String,
-                                                layout: TyLayout<'tcx>,
-                                                offset: Size,
-                                                size: Size) {
-                    for i in 0..layout.fields.count() {
-                        let field_offset = layout.fields.offset(i);
-                        if field_offset > offset {
-                            continue;
-                        }
-                        let inner_offset = offset - field_offset;
-                        let field = layout.field(cx, i);
-                        if inner_offset + size <= field.size {
-                            write!(name, "{}$", i).unwrap();
-                            compute_field_path(cx, name, field, inner_offset, size);
+                    set_members_of_composite_type(cx,
+                                                  variant_type_metadata,
+                                                  variant_member_descriptions);
+
+                    // Encode the information about the null variant in the union
+                    // member's name.
+                    let mut name = String::from("RUST$ENCODED$ENUM$");
+                    // Right now it's not even going to work for `niche_start > 0`,
+                    // and for multiple niche variants it only supports the first.
+                    fn compute_field_path<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
+                                                    name: &mut String,
+                                                    layout: TyLayout<'tcx>,
+                                                    offset: Size,
+                                                    size: Size) {
+                        for i in 0..layout.fields.count() {
+                            let field_offset = layout.fields.offset(i);
+                            if field_offset > offset {
+                                continue;
+                            }
+                            let inner_offset = offset - field_offset;
+                            let field = layout.field(cx, i);
+                            if inner_offset + size <= field.size {
+                                write!(name, "{}$", i).unwrap();
+                                compute_field_path(cx, name, field, inner_offset, size);
+                            }
                         }
                     }
+                    compute_field_path(cx, &mut name,
+                                       self.layout,
+                                       self.layout.fields.offset(0),
+                                       self.layout.field(cx, 0).size);
+                    name.push_str(&adt.variants[*niche_variants.start()].name.as_str());
+
+                    // Create the (singleton) list of descriptions of union members.
+                    vec![
+                        MemberDescription {
+                            name,
+                            type_metadata: variant_type_metadata,
+                            offset: Size::ZERO,
+                            size: variant.size,
+                            align: variant.align,
+                            flags: DIFlags::FlagZero,
+                            discriminant: None,
+                        }
+                    ]
+                } else {
+                    (0..variants.len()).map(|i| {
+                        let variant = self.layout.for_variant(cx, i);
+                        let (variant_type_metadata, member_desc_factory) =
+                            describe_enum_variant(cx,
+                                                  variant,
+                                                  &adt.variants[i],
+                                                  OptimizedDiscriminant,
+                                                  self_metadata,
+                                                  self.span);
+
+                        let member_descriptions = member_desc_factory
+                            .create_member_descriptions(cx);
+
+                        set_members_of_composite_type(cx,
+                                                      variant_type_metadata,
+                                                      member_descriptions);
+
+                        let niche_value = if i == dataful_variant {
+                            None
+                        } else {
+                            let niche = (i as u128)
+                                .wrapping_sub(*niche_variants.start() as u128)
+                                .wrapping_add(niche_start);
+                            assert_eq!(niche as u64 as u128, niche);
+                            Some(niche as u64)
+                        };
+
+                        MemberDescription {
+                            name: adt.variants[i].name.as_str().to_string(),
+                            type_metadata: variant_type_metadata,
+                            offset: Size::ZERO,
+                            size: self.layout.size,
+                            align: self.layout.align,
+                            flags: DIFlags::FlagZero,
+                            discriminant: niche_value,
+                        }
+                    }).collect()
                 }
-                compute_field_path(cx, &mut name,
-                                   self.layout,
-                                   self.layout.fields.offset(0),
-                                   self.layout.field(cx, 0).size);
-                name.push_str(&adt.variants[*niche_variants.start()].name.as_str());
-
-                // Create the (singleton) list of descriptions of union members.
-                vec![
-                    MemberDescription {
-                        name,
-                        type_metadata: variant_type_metadata,
-                        offset: Size::ZERO,
-                        size: variant.size,
-                        align: variant.align,
-                        flags: DIFlags::FlagZero
-                    }
-                ]
             }
         }
     }
@@ -1297,14 +1400,19 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
             let (size, align) = cx.size_and_align_of(ty);
             MemberDescription {
                 name: name.to_string(),
-                type_metadata: match self.discriminant_type_metadata {
-                    Some(metadata) if i == 0 => metadata,
-                    _ => type_metadata(cx, ty, self.span)
+                type_metadata: if use_enum_fallback(cx) {
+                    match self.discriminant_type_metadata {
+                        Some(metadata) if i == 0 => metadata,
+                        _ => type_metadata(cx, ty, self.span)
+                    }
+                } else {
+                    type_metadata(cx, ty, self.span)
                 },
                 offset: self.offsets[i],
                 size,
                 align,
-                flags: DIFlags::FlagZero
+                flags: DIFlags::FlagZero,
+                discriminant: None,
             }
         }).collect()
     }
@@ -1317,10 +1425,10 @@ enum EnumDiscriminantInfo<'ll> {
     NoDiscriminant
 }
 
-// Returns a tuple of (1) type_metadata_stub of the variant, (2) the llvm_type
-// of the variant, and (3) a MemberDescriptionFactory for producing the
-// descriptions of the fields of the variant. This is a rudimentary version of a
-// full RecursiveTypeDescription.
+// Returns a tuple of (1) type_metadata_stub of the variant, (2) a
+// MemberDescriptionFactory for producing the descriptions of the
+// fields of the variant. This is a rudimentary version of a full
+// RecursiveTypeDescription.
 fn describe_enum_variant(
     cx: &CodegenCx<'ll, 'tcx>,
     layout: layout::TyLayout<'tcx>,
@@ -1343,29 +1451,46 @@ fn describe_enum_variant(
                                            unique_type_id,
                                            Some(containing_scope));
 
-    // If this is not a univariant enum, there is also the discriminant field.
-    let (discr_offset, discr_arg) = match discriminant_info {
-        RegularDiscriminant(_) => {
-            // We have the layout of an enum variant, we need the layout of the outer enum
-            let enum_layout = cx.layout_of(layout.ty);
-            (Some(enum_layout.fields.offset(0)),
-             Some(("RUST$ENUM$DISR".to_owned(), enum_layout.field(cx, 0).ty)))
-        }
-        _ => (None, None),
-    };
-    let offsets = discr_offset.into_iter().chain((0..layout.fields.count()).map(|i| {
-        layout.fields.offset(i)
-    })).collect();
-
     // Build an array of (field name, field type) pairs to be captured in the factory closure.
-    let args = discr_arg.into_iter().chain((0..layout.fields.count()).map(|i| {
-        let name = if variant.ctor_kind == CtorKind::Fn {
-            format!("__{}", i)
-        } else {
-            variant.fields[i].ident.to_string()
+    let (offsets, args) = if use_enum_fallback(cx) {
+        // If this is not a univariant enum, there is also the discriminant field.
+        let (discr_offset, discr_arg) = match discriminant_info {
+            RegularDiscriminant(_) => {
+                // We have the layout of an enum variant, we need the layout of the outer enum
+                let enum_layout = cx.layout_of(layout.ty);
+                (Some(enum_layout.fields.offset(0)),
+                 Some(("RUST$ENUM$DISR".to_owned(), enum_layout.field(cx, 0).ty)))
+            }
+            _ => (None, None),
         };
-        (name, layout.field(cx, i).ty)
-    })).collect();
+        (
+            discr_offset.into_iter().chain((0..layout.fields.count()).map(|i| {
+                layout.fields.offset(i)
+            })).collect(),
+            discr_arg.into_iter().chain((0..layout.fields.count()).map(|i| {
+                let name = if variant.ctor_kind == CtorKind::Fn {
+                    format!("__{}", i)
+                } else {
+                    variant.fields[i].ident.to_string()
+                };
+                (name, layout.field(cx, i).ty)
+            })).collect()
+        )
+    } else {
+        (
+            (0..layout.fields.count()).map(|i| {
+                layout.fields.offset(i)
+            }).collect(),
+            (0..layout.fields.count()).map(|i| {
+                let name = if variant.ctor_kind == CtorKind::Fn {
+                    format!("__{}", i)
+                } else {
+                    variant.fields[i].ident.to_string()
+                };
+                (name, layout.field(cx, i).ty)
+            }).collect()
+        )
+    };
 
     let member_description_factory =
         VariantMDF(VariantMemberDescriptionFactory {
@@ -1401,22 +1526,22 @@ fn prepare_enum_metadata(
     // <unknown>
     let file_metadata = unknown_file_metadata(cx);
 
-    let def = enum_type.ty_adt_def().unwrap();
-    let enumerators_metadata: Vec<_> = def.discriminants(cx.tcx)
-        .zip(&def.variants)
-        .map(|(discr, v)| {
-            let name = SmallCStr::new(&v.name.as_str());
-            unsafe {
-                Some(llvm::LLVMRustDIBuilderCreateEnumerator(
-                    DIB(cx),
-                    name.as_ptr(),
-                    // FIXME: what if enumeration has i128 discriminant?
-                    discr.val as u64))
-            }
-        })
-        .collect();
-
     let discriminant_type_metadata = |discr: layout::Primitive| {
+        let def = enum_type.ty_adt_def().unwrap();
+        let enumerators_metadata: Vec<_> = def.discriminants(cx.tcx)
+            .zip(&def.variants)
+            .map(|(discr, v)| {
+                let name = SmallCStr::new(&v.name.as_str());
+                unsafe {
+                    Some(llvm::LLVMRustDIBuilderCreateEnumerator(
+                        DIB(cx),
+                        name.as_ptr(),
+                        // FIXME: what if enumeration has i128 discriminant?
+                        discr.val as u64))
+                }
+            })
+            .collect();
+
         let disr_type_key = (enum_def_id, discr);
         let cached_discriminant_type_metadata = debug_context(cx).created_enum_disr_types
                                                                  .borrow()
@@ -1441,7 +1566,7 @@ fn prepare_enum_metadata(
                         discriminant_size.bits(),
                         discriminant_align.abi_bits() as u32,
                         create_DIArray(DIB(cx), &enumerators_metadata),
-                        discriminant_base_type_metadata)
+                        discriminant_base_type_metadata, true)
                 };
 
                 debug_context(cx).created_enum_disr_types
@@ -1455,16 +1580,10 @@ fn prepare_enum_metadata(
 
     let layout = cx.layout_of(enum_type);
 
-    let discriminant_type_metadata = match layout.variants {
-        layout::Variants::Single { .. } |
-        layout::Variants::NicheFilling { .. } => None,
-        layout::Variants::Tagged { ref tag, .. } => {
-            Some(discriminant_type_metadata(tag.value))
-        }
-    };
-
-    if let (&layout::Abi::Scalar(_), Some(discr)) = (&layout.abi, discriminant_type_metadata) {
-        return FinalMetadata(discr);
+    match (&layout.abi, &layout.variants) {
+        (&layout::Abi::Scalar(_), &layout::Variants::Tagged {ref tag, .. }) =>
+            return FinalMetadata(discriminant_type_metadata(tag.value)),
+        _ => {}
     }
 
     let (enum_type_size, enum_type_align) = layout.size_and_align();
@@ -1473,30 +1592,145 @@ fn prepare_enum_metadata(
     let unique_type_id_str = SmallCStr::new(
         debug_context(cx).type_map.borrow().get_unique_type_id_as_string(unique_type_id)
     );
-    let enum_metadata = unsafe {
-        llvm::LLVMRustDIBuilderCreateUnionType(
-        DIB(cx),
-        containing_scope,
-        enum_name.as_ptr(),
-        file_metadata,
-        UNKNOWN_LINE_NUMBER,
-        enum_type_size.bits(),
-        enum_type_align.abi_bits() as u32,
-        DIFlags::FlagZero,
-        None,
-        0, // RuntimeLang
-        unique_type_id_str.as_ptr())
+
+    if use_enum_fallback(cx) {
+        let discriminant_type_metadata = match layout.variants {
+            layout::Variants::Single { .. } |
+            layout::Variants::NicheFilling { .. } => None,
+            layout::Variants::Tagged { ref tag, .. } => {
+                Some(discriminant_type_metadata(tag.value))
+            }
+        };
+
+        let enum_metadata = unsafe {
+            llvm::LLVMRustDIBuilderCreateUnionType(
+                DIB(cx),
+                containing_scope,
+                enum_name.as_ptr(),
+                file_metadata,
+                UNKNOWN_LINE_NUMBER,
+                enum_type_size.bits(),
+                enum_type_align.abi_bits() as u32,
+                DIFlags::FlagZero,
+                None,
+                0, // RuntimeLang
+                unique_type_id_str.as_ptr())
+        };
+
+        return create_and_register_recursive_type_forward_declaration(
+            cx,
+            enum_type,
+            unique_type_id,
+            enum_metadata,
+            enum_metadata,
+            EnumMDF(EnumMemberDescriptionFactory {
+                enum_type,
+                layout,
+                discriminant_type_metadata,
+                containing_scope,
+                span,
+            }),
+        );
+    }
+
+    let discriminator_metadata = match &layout.variants {
+        // A single-variant enum has no discriminant.
+        &layout::Variants::Single { .. } => None,
+
+        &layout::Variants::NicheFilling { ref niche, .. } => {
+            // Find the integer type of the correct size.
+            let size = niche.value.size(cx);
+            let align = niche.value.align(cx);
+
+            let discr_type = match niche.value {
+                layout::Int(t, _) => t,
+                layout::Float(layout::FloatTy::F32) => Integer::I32,
+                layout::Float(layout::FloatTy::F64) => Integer::I64,
+                layout::Pointer => cx.data_layout().ptr_sized_integer(),
+            }.to_ty(cx.tcx, false);
+
+            let discr_metadata = basic_type_metadata(cx, discr_type);
+            unsafe {
+                Some(llvm::LLVMRustDIBuilderCreateMemberType(
+                    DIB(cx),
+                    containing_scope,
+                    ptr::null_mut(),
+                    file_metadata,
+                    UNKNOWN_LINE_NUMBER,
+                    size.bits(),
+                    align.abi_bits() as u32,
+                    layout.fields.offset(0).bits(),
+                    DIFlags::FlagArtificial,
+                    discr_metadata))
+            }
+        },
+
+        &layout::Variants::Tagged { ref tag, .. } => {
+            let discr_type = tag.value.to_ty(cx.tcx);
+            let (size, align) = cx.size_and_align_of(discr_type);
+
+            let discr_metadata = basic_type_metadata(cx, discr_type);
+            unsafe {
+                Some(llvm::LLVMRustDIBuilderCreateMemberType(
+                    DIB(cx),
+                    containing_scope,
+                    ptr::null_mut(),
+                    file_metadata,
+                    UNKNOWN_LINE_NUMBER,
+                    size.bits(),
+                    align.abi_bits() as u32,
+                    layout.fields.offset(0).bits(),
+                    DIFlags::FlagArtificial,
+                    discr_metadata))
+            }
+        },
+    };
+
+    let empty_array = create_DIArray(DIB(cx), &[]);
+    let variant_part = unsafe {
+        llvm::LLVMRustDIBuilderCreateVariantPart(
+            DIB(cx),
+            containing_scope,
+            ptr::null_mut(),
+            file_metadata,
+            UNKNOWN_LINE_NUMBER,
+            enum_type_size.bits(),
+            enum_type_align.abi_bits() as u32,
+            DIFlags::FlagZero,
+            discriminator_metadata,
+            empty_array,
+            unique_type_id_str.as_ptr())
+    };
+
+    // The variant part must be wrapped in a struct according to DWARF.
+    let type_array = create_DIArray(DIB(cx), &[Some(variant_part)]);
+    let struct_wrapper = unsafe {
+        llvm::LLVMRustDIBuilderCreateStructType(
+            DIB(cx),
+            Some(containing_scope),
+            enum_name.as_ptr(),
+            file_metadata,
+            UNKNOWN_LINE_NUMBER,
+            enum_type_size.bits(),
+            enum_type_align.abi_bits() as u32,
+            DIFlags::FlagZero,
+            None,
+            type_array,
+            0,
+            None,
+            unique_type_id_str.as_ptr())
     };
 
     return create_and_register_recursive_type_forward_declaration(
         cx,
         enum_type,
         unique_type_id,
-        enum_metadata,
+        struct_wrapper,
+        variant_part,
         EnumMDF(EnumMemberDescriptionFactory {
             enum_type,
             layout,
-            discriminant_type_metadata,
+            discriminant_type_metadata: None,
             containing_scope,
             span,
         }),
@@ -1565,7 +1799,7 @@ fn set_members_of_composite_type(cx: &CodegenCx<'ll, '_>,
         .map(|member_description| {
             let member_name = CString::new(member_description.name).unwrap();
             unsafe {
-                Some(llvm::LLVMRustDIBuilderCreateMemberType(
+                Some(llvm::LLVMRustDIBuilderCreateVariantMemberType(
                     DIB(cx),
                     composite_type_metadata,
                     member_name.as_ptr(),
@@ -1574,6 +1808,10 @@ fn set_members_of_composite_type(cx: &CodegenCx<'ll, '_>,
                     member_description.size.bits(),
                     member_description.align.abi_bits() as u32,
                     member_description.offset.bits(),
+                    match member_description.discriminant {
+                        None => None,
+                        Some(value) => Some(C_u64(cx, value)),
+                    },
                     member_description.flags,
                     member_description.type_metadata))
             }
index 0b98fa4eaf55139ebce5967de1a234a26379b759..f046ea030272afe045dfa05b59295aee2f019806 100644 (file)
@@ -1307,6 +1307,19 @@ pub fn LLVMRustDIBuilderCreateMemberType(Builder: &DIBuilder<'a>,
                                              Ty: &'a DIType)
                                              -> &'a DIDerivedType;
 
+    pub fn LLVMRustDIBuilderCreateVariantMemberType(Builder: &DIBuilder<'a>,
+                                                    Scope: &'a DIScope,
+                                                    Name: *const c_char,
+                                                    File: &'a DIFile,
+                                                    LineNumber: c_uint,
+                                                    SizeInBits: u64,
+                                                    AlignInBits: u32,
+                                                    OffsetInBits: u64,
+                                                    Discriminant: Option<&'a Value>,
+                                                    Flags: DIFlags,
+                                                    Ty: &'a DIType)
+                                                    -> &'a DIType;
+
     pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: &DIBuilder<'a>,
                                                Scope: &'a DIScope,
                                                File: &'a DIFile,
@@ -1384,7 +1397,8 @@ pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: &DIBuilder<'a>,
                                                   SizeInBits: u64,
                                                   AlignInBits: u32,
                                                   Elements: &'a DIArray,
-                                                  ClassType: &'a DIType)
+                                                  ClassType: &'a DIType,
+                                                  IsFixed: bool)
                                                   -> &'a DIType;
 
     pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
@@ -1400,6 +1414,19 @@ pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
                                             UniqueId: *const c_char)
                                             -> &'a DIType;
 
+    pub fn LLVMRustDIBuilderCreateVariantPart(Builder: &DIBuilder<'a>,
+                                              Scope: &'a DIScope,
+                                              Name: *const c_char,
+                                              File: &'a DIFile,
+                                              LineNo: c_uint,
+                                              SizeInBits: u64,
+                                              AlignInBits: u32,
+                                              Flags: DIFlags,
+                                              Discriminator: Option<&'a DIDerivedType>,
+                                              Elements: &'a DIArray,
+                                              UniqueId: *const c_char)
+                                              -> &'a DIDerivedType;
+
     pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
 
     pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: &DIBuilder<'a>,
index b197d29b184de11f6adec4e559c466290d270f06..07e5548216f3cee30dcf4fa17f434961053016e2 100644 (file)
@@ -21,7 +21,6 @@
       html_root_url = "https://doc.rust-lang.org/nightly/")]
 
 #![feature(in_band_lifetimes)]
-#![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
 #![feature(unboxed_closures)]
 #![feature(fn_traits)]
 #![feature(unsize)]
index e1bfdf35b274e0d31ff7be040948e0319cf9d0bb..9dbf0ea9f438cb19b5b5ff4970ddf45b604e73a8 100644 (file)
@@ -22,8 +22,6 @@
 //! If you expect to store more than 1 element in the common case, steer clear
 //! and use a `Vec<T>`, `Box<[T]>`, or a `SmallVec<T>`.
 
-use std::mem;
-
 #[derive(Clone, Hash, Debug, PartialEq)]
 pub struct TinyList<T: PartialEq> {
     head: Option<Element<T>>
@@ -52,7 +50,7 @@ pub fn new_single(data: T) -> TinyList<T> {
     pub fn insert(&mut self, data: T) {
         self.head = Some(Element {
             data,
-            next: mem::replace(&mut self.head, None).map(Box::new),
+            next: self.head.take().map(Box::new)
         });
     }
 
@@ -60,7 +58,7 @@ pub fn insert(&mut self, data: T) {
     pub fn remove(&mut self, data: &T) -> bool {
         self.head = match self.head {
             Some(ref mut head) if head.data == *data => {
-                mem::replace(&mut head.next, None).map(|x| *x)
+                head.next.take().map(|x| *x)
             }
             Some(ref mut head) => return head.remove_next(data),
             None => return false,
@@ -100,7 +98,7 @@ fn remove_next(&mut self, data: &T) -> bool {
             if next.data != *data {
                 return next.remove_next(data)
             } else {
-                mem::replace(&mut next.next, None)
+                next.next.take()
             }
         } else {
             return false
index 5f275b700387360eaec802315d1fffc30a726853..720e8def5ab1c2a7d30abec1e97e67649736e39e 100644 (file)
@@ -120,7 +120,7 @@ fn to_color_choice(&self) -> ColorChoice {
 
 pub struct EmitterWriter {
     dst: Destination,
-    cm: Option<Lrc<SourceMapperDyn>>,
+    sm: Option<Lrc<SourceMapperDyn>>,
     short_message: bool,
     teach: bool,
     ui_testing: bool,
@@ -134,14 +134,14 @@ struct FileWithAnnotatedLines {
 
 impl EmitterWriter {
     pub fn stderr(color_config: ColorConfig,
-                  code_map: Option<Lrc<SourceMapperDyn>>,
+                  source_map: Option<Lrc<SourceMapperDyn>>,
                   short_message: bool,
                   teach: bool)
                   -> EmitterWriter {
         let dst = Destination::from_stderr(color_config);
         EmitterWriter {
             dst,
-            cm: code_map,
+            sm: source_map,
             short_message,
             teach,
             ui_testing: false,
@@ -149,13 +149,13 @@ pub fn stderr(color_config: ColorConfig,
     }
 
     pub fn new(dst: Box<dyn Write + Send>,
-               code_map: Option<Lrc<SourceMapperDyn>>,
+               source_map: Option<Lrc<SourceMapperDyn>>,
                short_message: bool,
                teach: bool)
                -> EmitterWriter {
         EmitterWriter {
             dst: Raw(dst),
-            cm: code_map,
+            sm: source_map,
             short_message,
             teach,
             ui_testing: false,
@@ -214,14 +214,14 @@ fn add_annotation_to_file(file_vec: &mut Vec<FileWithAnnotatedLines>,
         let mut output = vec![];
         let mut multiline_annotations = vec![];
 
-        if let Some(ref cm) = self.cm {
+        if let Some(ref sm) = self.sm {
             for span_label in msp.span_labels() {
                 if span_label.span.is_dummy() {
                     continue;
                 }
 
-                let lo = cm.lookup_char_pos(span_label.span.lo());
-                let mut hi = cm.lookup_char_pos(span_label.span.hi());
+                let lo = sm.lookup_char_pos(span_label.span.lo());
+                let mut hi = sm.lookup_char_pos(span_label.span.hi());
 
                 // Watch out for "empty spans". If we get a span like 6..6, we
                 // want to just display a `^` at 6, so convert that to
@@ -724,10 +724,10 @@ fn render_source_line(&self,
 
     fn get_multispan_max_line_num(&mut self, msp: &MultiSpan) -> usize {
         let mut max = 0;
-        if let Some(ref cm) = self.cm {
+        if let Some(ref sm) = self.sm {
             for primary_span in msp.primary_spans() {
                 if !primary_span.is_dummy() {
-                    let hi = cm.lookup_char_pos(primary_span.hi());
+                    let hi = sm.lookup_char_pos(primary_span.hi());
                     if hi.line > max {
                         max = hi.line;
                     }
@@ -736,7 +736,7 @@ fn get_multispan_max_line_num(&mut self, msp: &MultiSpan) -> usize {
             if !self.short_message {
                 for span_label in msp.span_labels() {
                     if !span_label.span.is_dummy() {
-                        let hi = cm.lookup_char_pos(span_label.span.hi());
+                        let hi = sm.lookup_char_pos(span_label.span.hi());
                         if hi.line > max {
                             max = hi.line;
                         }
@@ -768,7 +768,7 @@ fn fix_multispan_in_std_macros(&mut self,
                                    always_backtrace: bool) -> bool {
         let mut spans_updated = false;
 
-        if let Some(ref cm) = self.cm {
+        if let Some(ref sm) = self.sm {
             let mut before_after: Vec<(Span, Span)> = vec![];
             let mut new_labels: Vec<(Span, String)> = vec![];
 
@@ -777,7 +777,7 @@ fn fix_multispan_in_std_macros(&mut self,
                 if sp.is_dummy() {
                     continue;
                 }
-                let call_sp = cm.call_span_if_macro(*sp);
+                let call_sp = sm.call_span_if_macro(*sp);
                 if call_sp != *sp && !always_backtrace {
                     before_after.push((*sp, call_sp));
                 }
@@ -802,7 +802,7 @@ fn fix_multispan_in_std_macros(&mut self,
                                                      })));
                         }
                         // Check to make sure we're not in any <*macros>
-                        if !cm.span_to_filename(def_site).is_macros() &&
+                        if !sm.span_to_filename(def_site).is_macros() &&
                            !trace.macro_decl_name.starts_with("desugaring of ") &&
                            !trace.macro_decl_name.starts_with("#[") ||
                            always_backtrace {
@@ -829,7 +829,7 @@ fn fix_multispan_in_std_macros(&mut self,
                 if sp_label.span.is_dummy() {
                     continue;
                 }
-                if cm.span_to_filename(sp_label.span.clone()).is_macros() &&
+                if sm.span_to_filename(sp_label.span.clone()).is_macros() &&
                     !always_backtrace
                 {
                     let v = sp_label.span.macro_backtrace();
@@ -1000,10 +1000,10 @@ fn emit_message_default(&mut self,
         let mut annotated_files = self.preprocess_annotations(msp);
 
         // Make sure our primary file comes first
-        let (primary_lo, cm) = if let (Some(cm), Some(ref primary_span)) =
-            (self.cm.as_ref(), msp.primary_span().as_ref()) {
+        let (primary_lo, sm) = if let (Some(sm), Some(ref primary_span)) =
+            (self.sm.as_ref(), msp.primary_span().as_ref()) {
             if !primary_span.is_dummy() {
-                (cm.lookup_char_pos(primary_span.lo()), cm)
+                (sm.lookup_char_pos(primary_span.lo()), sm)
             } else {
                 emit_to_destination(&buffer.render(), level, &mut self.dst, self.short_message)?;
                 return Ok(());
@@ -1021,7 +1021,7 @@ fn emit_message_default(&mut self,
         // Print out the annotate source lines that correspond with the error
         for annotated_file in annotated_files {
             // we can't annotate anything if the source is unavailable.
-            if !cm.ensure_source_file_source_present(annotated_file.file.clone()) {
+            if !sm.ensure_source_file_source_present(annotated_file.file.clone()) {
                 continue;
             }
 
@@ -1038,7 +1038,7 @@ fn emit_message_default(&mut self,
                     buffer.append(buffer_msg_line_offset,
                                   &format!("{}:{}:{}",
                                            loc.file.name,
-                                           cm.doctest_offset_line(loc.line),
+                                           sm.doctest_offset_line(loc.line),
                                            loc.col.0 + 1),
                                   Style::LineAndColumn);
                     for _ in 0..max_line_num_len {
@@ -1048,7 +1048,7 @@ fn emit_message_default(&mut self,
                     buffer.prepend(0,
                                    &format!("{}:{}:{}: ",
                                             loc.file.name,
-                                            cm.doctest_offset_line(loc.line),
+                                            sm.doctest_offset_line(loc.line),
                                             loc.col.0 + 1),
                                    Style::LineAndColumn);
                 }
@@ -1069,7 +1069,7 @@ fn emit_message_default(&mut self,
                     };
                     format!("{}:{}{}",
                             annotated_file.file.name,
-                            cm.doctest_offset_line(first_line.line_index),
+                            sm.doctest_offset_line(first_line.line_index),
                             col)
                 } else {
                     annotated_file.file.name.to_string()
@@ -1194,7 +1194,7 @@ fn emit_suggestion_default(&mut self,
                                level: &Level,
                                max_line_num_len: usize)
                                -> io::Result<()> {
-        if let Some(ref cm) = self.cm {
+        if let Some(ref sm) = self.sm {
             let mut buffer = StyledBuffer::new();
 
             // Render the suggestion message
@@ -1210,7 +1210,7 @@ fn emit_suggestion_default(&mut self,
                                Some(Style::HeaderMsg));
 
             // Render the replacements for each suggestion
-            let suggestions = suggestion.splice_lines(&**cm);
+            let suggestions = suggestion.splice_lines(&**sm);
 
             let mut row_num = 2;
             for &(ref complete, ref parts) in suggestions.iter().take(MAX_SUGGESTIONS) {
@@ -1221,11 +1221,11 @@ fn emit_suggestion_default(&mut self,
                     && parts[0].snippet.trim() == complete.trim())
                     && complete.lines().count() == 1;
 
-                let lines = cm.span_to_lines(parts[0].span).unwrap();
+                let lines = sm.span_to_lines(parts[0].span).unwrap();
 
                 assert!(!lines.lines.is_empty());
 
-                let line_start = cm.lookup_char_pos(parts[0].span.lo()).line;
+                let line_start = sm.lookup_char_pos(parts[0].span.lo()).line;
                 draw_col_separator_no_space(&mut buffer, 1, max_line_num_len + 1);
                 let mut line_pos = 0;
                 let mut lines = complete.lines();
@@ -1250,8 +1250,8 @@ fn emit_suggestion_default(&mut self,
                 if show_underline {
                     draw_col_separator(&mut buffer, row_num, max_line_num_len + 1);
                     for part in parts {
-                        let span_start_pos = cm.lookup_char_pos(part.span.lo()).col_display;
-                        let span_end_pos = cm.lookup_char_pos(part.span.hi()).col_display;
+                        let span_start_pos = sm.lookup_char_pos(part.span.lo()).col_display;
+                        let span_end_pos = sm.lookup_char_pos(part.span.hi()).col_display;
 
                         // Do not underline the leading...
                         let start = part.snippet.len()
index 9bd95e8262fc63fd7ecfd13b683b70e371b3e9d9..0fb77a7a3ab526a59a5708fd78b51b05b353f40d 100644 (file)
@@ -129,7 +129,7 @@ pub trait SourceMapper {
     fn span_to_filename(&self, sp: Span) -> FileName;
     fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>;
     fn call_span_if_macro(&self, sp: Span) -> Span;
-    fn ensure_source_file_source_present(&self, file_map: Lrc<SourceFile>) -> bool;
+    fn ensure_source_file_source_present(&self, source_file: Lrc<SourceFile>) -> bool;
     fn doctest_offset_line(&self, line: usize) -> usize;
 }
 
index 96d04253cc48549f3fd981e0a774ee922a21ab44..5950e19b0ee1d449562e8007ead16b09df8603dc 100644 (file)
@@ -278,10 +278,9 @@ fn check_unused_parens_expr(&self,
                                 msg: &str,
                                 followed_by_block: bool) {
         if let ast::ExprKind::Paren(ref inner) = value.node {
-            let necessary = followed_by_block && if let ast::ExprKind::Ret(_) = inner.node {
-                true
-            } else {
-                parser::contains_exterior_struct_lit(&inner)
+            let necessary = followed_by_block && match inner.node {
+                ast::ExprKind::Ret(_) | ast::ExprKind::Break(..) => true,
+                _ => parser::contains_exterior_struct_lit(&inner),
             };
             if !necessary {
                 let expr_text = if let Ok(snippet) = cx.sess().source_map()
index 6ef8b155458721e556496d62584a921c77586116..8d10c0395f5083fac7316a777e154ad5421cbf78 100644 (file)
@@ -346,7 +346,33 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
         mbcx.errors_buffer.sort_by_key(|diag| diag.span.primary_span());
 
         if tcx.migrate_borrowck() {
-            match tcx.borrowck(def_id).signalled_any_error {
+            // When borrowck=migrate, check if AST-borrowck would
+            // error on the given code.
+
+            // rust-lang/rust#55492: loop over parents to ensure that
+            // errors that AST-borrowck only detects in some parent of
+            // a closure still allows NLL to signal an error.
+            let mut curr_def_id = def_id;
+            let signalled_any_error = loop {
+                match tcx.borrowck(curr_def_id).signalled_any_error {
+                    SignalledError::NoErrorsSeen => {
+                        // keep traversing (and borrow-checking) parents
+                    }
+                    SignalledError::SawSomeError => {
+                        // stop search here
+                        break SignalledError::SawSomeError;
+                    }
+                }
+
+                if tcx.is_closure(curr_def_id) {
+                    curr_def_id = tcx.parent_def_id(curr_def_id)
+                        .expect("a closure must have a parent_def_id");
+                } else {
+                    break SignalledError::NoErrorsSeen;
+                }
+            };
+
+            match signalled_any_error {
                 SignalledError::NoErrorsSeen => {
                     // if AST-borrowck signalled no errors, then
                     // downgrade all the buffered MIR-borrowck errors
@@ -1831,7 +1857,10 @@ fn check_access_permissions(
             | Write(wk @ WriteKind::StorageDeadOrDrop)
             | Write(wk @ WriteKind::MutableBorrow(BorrowKind::Shared))
             | Write(wk @ WriteKind::MutableBorrow(BorrowKind::Shallow)) => {
-                if let Err(_place_err) = self.is_mutable(place, is_local_mutation_allowed) {
+                if let (Err(_place_err), true) = (
+                    self.is_mutable(place, is_local_mutation_allowed),
+                    self.errors_buffer.is_empty()
+                ) {
                     if self.infcx.tcx.migrate_borrowck() {
                         // rust-lang/rust#46908: In pure NLL mode this
                         // code path should be unreachable (and thus
@@ -1855,12 +1884,11 @@ fn check_access_permissions(
                             location,
                         );
                     } else {
-                        self.infcx.tcx.sess.delay_span_bug(
+                        span_bug!(
                             span,
-                            &format!(
-                                "Accessing `{:?}` with the kind `{:?}` shouldn't be possible",
-                                place, kind
-                            ),
+                            "Accessing `{:?}` with the kind `{:?}` shouldn't be possible",
+                            place,
+                            kind,
                         );
                     }
                 }
index b71b131570d7b1133e322ada408936f56fbbdc28..7afe2c67adc9b8e5bbf26dcc892535986ec1d6bc 100644 (file)
@@ -180,9 +180,9 @@ pub(super) fn report_mutability_error(
             AccessKind::Move => {
                 err = self.infcx.tcx
                     .cannot_move_out_of(span, &(item_msg + &reason), Origin::Mir);
-                act = "move";
-                acted_on = "moved";
-                span
+                err.span_label(span, "cannot move");
+                err.buffer(&mut self.errors_buffer);
+                return;
             }
             AccessKind::Mutate => {
                 err = self.infcx.tcx
index 7db9c3f110272cd34982044c596f94825be524bb..38ab21b7c8c85bcf5728b46f2dc4ec4ab19162d8 100644 (file)
@@ -576,7 +576,11 @@ pub fn const_eval_provider<'a, 'tcx>(
         key.param_env.reveal = Reveal::UserFacing;
         match tcx.const_eval(key) {
             // try again with reveal all as requested
-            Err(ErrorHandled::TooGeneric) => {},
+            Err(ErrorHandled::TooGeneric) => {
+                // Promoteds should never be "too generic" when getting evaluated.
+                // They either don't get evaluated, or we are in a monomorphic context
+                assert!(key.value.promoted.is_none());
+            },
             // dedupliate calls
             other => return other,
         }
index 226717538a29484e9e793af4bb882751d43549cc..9d86e737dd5b6aa8acd953ce895f6f055beb1896 100644 (file)
@@ -303,7 +303,8 @@ fn validate_scalar_layout(
         let (lo, hi) = layout.valid_range.clone().into_inner();
         let max_hi = u128::max_value() >> (128 - size.bits()); // as big as the size fits
         assert!(hi <= max_hi);
-        if lo == 0 && hi == max_hi {
+        // We could also write `(hi + 1) % (max_hi + 1) == lo` but `max_hi + 1` overflows for `u128`
+        if (lo == 0 && hi == max_hi) || (hi + 1 == lo) {
             // Nothing to check
             return Ok(());
         }
index aaa97e337265331ca88cea0774cf109902206553..9c4b92aa2742b1c7abc5140ea416f5fa0aff4382 100644 (file)
@@ -16,7 +16,6 @@
 
 #![feature(nll)]
 #![feature(in_band_lifetimes)]
-#![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
 #![feature(slice_patterns)]
 #![feature(slice_sort_by_cached_key)]
 #![feature(box_patterns)]
index ebd87e87ff60a4c2a72adefc9073d73ac31b5580..094488f3af3cf00ac2b5b0eb5b654fe1e725fe47 100644 (file)
@@ -3589,7 +3589,17 @@ fn resolve_path(
         );
 
         for (i, &Segment { ident, id }) in path.iter().enumerate() {
-            debug!("resolve_path ident {} {:?}", i, ident);
+            debug!("resolve_path ident {} {:?} {:?}", i, ident, id);
+            let record_segment_def = |this: &mut Self, def| {
+                if record_used {
+                    if let Some(id) = id {
+                        if !this.def_map.contains_key(&id) {
+                            assert!(id != ast::DUMMY_NODE_ID, "Trying to resolve dummy id");
+                            this.record_def(id, PathResolution::new(def));
+                        }
+                    }
+                }
+            };
 
             let is_last = i == path.len() - 1;
             let ns = if is_last { opt_ns.unwrap_or(TypeNS) } else { TypeNS };
@@ -3673,6 +3683,7 @@ fn resolve_path(
                     // we found a local variable or type param
                     Some(LexicalScopeBinding::Def(def))
                             if opt_ns == Some(TypeNS) || opt_ns == Some(ValueNS) => {
+                        record_segment_def(self, def);
                         return PathResult::NonModule(PathResolution::with_unresolved_segments(
                             def, path.len() - 1
                         ));
@@ -3690,14 +3701,7 @@ fn resolve_path(
                     let maybe_assoc = opt_ns != Some(MacroNS) && PathSource::Type.is_expected(def);
                     if let Some(next_module) = binding.module() {
                         module = Some(ModuleOrUniformRoot::Module(next_module));
-                        if record_used {
-                            if let Some(id) = id {
-                                if !self.def_map.contains_key(&id) {
-                                    assert!(id != ast::DUMMY_NODE_ID, "Trying to resolve dummy id");
-                                    self.record_def(id, PathResolution::new(def));
-                                }
-                            }
-                        }
+                        record_segment_def(self, def);
                     } else if def == Def::ToolMod && i + 1 != path.len() {
                         let def = Def::NonMacroAttr(NonMacroAttrKind::Tool);
                         return PathResult::NonModule(PathResolution::new(def));
index c0b718e4863fc05afaf06e649433194f7dddea5f..9bc3fbe7c245a9ef3238439977640aabd963dba7 100644 (file)
@@ -92,7 +92,7 @@ pub struct DumpVisitor<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> {
     // we only write one macro def per unique macro definition, and
     // one macro use per unique callsite span.
     // mac_defs: FxHashSet<Span>,
-    macro_calls: FxHashSet<Span>,
+    // macro_calls: FxHashSet<Span>,
 }
 
 impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
@@ -108,7 +108,7 @@ pub fn new(
             span: span_utils,
             cur_scope: CRATE_NODE_ID,
             // mac_defs: FxHashSet::default(),
-            macro_calls: FxHashSet::default(),
+            // macro_calls: FxHashSet::default(),
         }
     }
 
@@ -771,8 +771,7 @@ fn dump_path_ref(&mut self, id: NodeId, path: &ast::Path) {
     }
 
     fn process_path(&mut self, id: NodeId, path: &'l ast::Path) {
-        debug!("process_path {:?}", path);
-        if generated_code(path.span) {
+        if self.span.filter_generated(path.span) {
             return;
         }
         self.dump_path_ref(id, path);
@@ -1031,18 +1030,20 @@ fn process_var_decl(&mut self, p: &'l ast::Pat, value: String) {
     /// If the span is not macro-generated, do nothing, else use callee and
     /// callsite spans to record macro definition and use data, using the
     /// mac_uses and mac_defs sets to prevent multiples.
-    fn process_macro_use(&mut self, span: Span) {
-        let source_span = span.source_callsite();
-        if !self.macro_calls.insert(source_span) {
-            return;
-        }
+    fn process_macro_use(&mut self, _span: Span) {
+        // FIXME if we're not dumping the defs (see below), there is no point
+        // dumping refs either.
+        // let source_span = span.source_callsite();
+        // if !self.macro_calls.insert(source_span) {
+        //     return;
+        // }
 
-        let data = match self.save_ctxt.get_macro_use_data(span) {
-            None => return,
-            Some(data) => data,
-        };
+        // let data = match self.save_ctxt.get_macro_use_data(span) {
+        //     None => return,
+        //     Some(data) => data,
+        // };
 
-        self.dumper.macro_use(data);
+        // self.dumper.macro_use(data);
 
         // FIXME write the macro def
         // let mut hasher = DefaultHasher::new();
index e14ac73ee10202b1eb450fdf5de59d5511f810c9..d2354f38e2685e90c55105952795a3133211034f 100644 (file)
@@ -93,7 +93,7 @@ pub fn compilation_opts(&mut self, data: CompilationOptions) {
         self.result.compilation = Some(data);
     }
 
-    pub fn macro_use(&mut self, data: MacroRef) {
+    pub fn _macro_use(&mut self, data: MacroRef) {
         if self.config.pub_only || self.config.reachable_only {
             return;
         }
index 10ba27e38f47c7dc0e1662310dcb27648b678e51..e60c9922d467a5193a43ab78977fb40d41cddf57 100644 (file)
@@ -22,7 +22,6 @@
       html_root_url = "https://doc.rust-lang.org/nightly/")]
 
 #![feature(box_syntax)]
-#![cfg_attr(stage0, feature(min_const_fn))]
 #![feature(nll)]
 #![feature(slice_patterns)]
 
index 0958a958986933d589232710c7e7fb9eda4e7e89..d9ab23844918d02c2d0e719f1c22e7eae403c53d 100644 (file)
@@ -35,9 +35,14 @@ pub fn target() -> TargetResult {
             no_integrated_as: true,
 
             // There are no atomic CAS instructions available in the MSP430
-            // instruction set
-            max_atomic_width: Some(16),
+            // instruction set, and the LLVM backend doesn't currently support
+            // compiler fences so the Atomic* API is missing on this target.
+            // When the LLVM backend gains support for compile fences uncomment
+            // the `singlethread: true` line and set `max_atomic_width` to
+            // `Some(16)`.
+            max_atomic_width: Some(0),
             atomic_cas: false,
+            // singlethread: true,
 
             // Because these devices have very little resources having an
             // unwinder is too onerous so we default to "abort" because the
index ad0a54e392f583ed55d483180a87a3d9f688ea32..cde08f6832ace274442b89c18e51996c782ed491 100644 (file)
@@ -159,14 +159,14 @@ fn implied_bounds_from_components(
 ) -> Vec<OutlivesBound<'tcx>> {
     sup_components
         .into_iter()
-        .flat_map(|component| {
+        .filter_map(|component| {
             match component {
                 Component::Region(r) =>
-                    vec![OutlivesBound::RegionSubRegion(sub_region, r)],
+                    Some(OutlivesBound::RegionSubRegion(sub_region, r)),
                 Component::Param(p) =>
-                    vec![OutlivesBound::RegionSubParam(sub_region, p)],
+                    Some(OutlivesBound::RegionSubParam(sub_region, p)),
                 Component::Projection(p) =>
-                    vec![OutlivesBound::RegionSubProjection(sub_region, p)],
+                    Some(OutlivesBound::RegionSubProjection(sub_region, p)),
                 Component::EscapingProjection(_) =>
                 // If the projection has escaping regions, don't
                 // try to infer any implied bounds even for its
@@ -176,9 +176,9 @@ fn implied_bounds_from_components(
                 // idea is that the WAY that the caller proves
                 // that may change in the future and we want to
                 // give ourselves room to get smarter here.
-                    vec![],
+                    None,
                 Component::UnresolvedInferenceVariable(..) =>
-                    vec![],
+                    None,
             }
         })
         .collect()
index 1978f86545e7bfc5d4372273401a45675b1e2891..7ddc56974d816157abbf594c8c15c24f7d52765e 100644 (file)
@@ -1112,12 +1112,12 @@ fn find_bound_for_assoc_item(&self,
     {
         let tcx = self.tcx();
 
-        let bounds: Vec<_> = self.get_type_parameter_bounds(span, ty_param_def_id)
-            .predicates.into_iter().filter_map(|(p, _)| p.to_opt_poly_trait_ref()).collect();
+        let bounds = self.get_type_parameter_bounds(span, ty_param_def_id)
+            .predicates.into_iter().filter_map(|(p, _)| p.to_opt_poly_trait_ref());
 
         // Check that there is exactly one way to find an associated type with the
         // correct name.
-        let suitable_bounds = traits::transitive_bounds(tcx, &bounds)
+        let suitable_bounds = traits::transitive_bounds(tcx, bounds)
             .filter(|b| self.trait_defines_associated_type_named(b.def_id(), assoc_name));
 
         let param_node_id = tcx.hir.as_local_node_id(ty_param_def_id).unwrap();
index c506f23078f25fe32a3735103a85a84c4411f577..5a8a9632350f2621959bd8d811a3a36b98574c24 100644 (file)
@@ -31,6 +31,7 @@
 use syntax::ast;
 use syntax::util::lev_distance::{lev_distance, find_best_match_for_name};
 use syntax_pos::{Span, symbol::Symbol};
+use std::iter;
 use std::mem;
 use std::ops::Deref;
 use std::rc::Rc;
@@ -627,7 +628,7 @@ fn assemble_inherent_candidates_from_object(&mut self,
         // itself. Hence, a `&self` method will wind up with an
         // argument type like `&Trait`.
         let trait_ref = principal.with_self_ty(self.tcx, self_ty);
-        self.elaborate_bounds(&[trait_ref], |this, new_trait_ref, item| {
+        self.elaborate_bounds(iter::once(trait_ref), |this, new_trait_ref, item| {
             let new_trait_ref = this.erase_late_bound_regions(&new_trait_ref);
 
             let (xform_self_ty, xform_ret_ty) =
@@ -645,7 +646,7 @@ fn assemble_inherent_candidates_from_param(&mut self,
                                                param_ty: ty::ParamTy) {
         // FIXME -- Do we want to commit to this behavior for param bounds?
 
-        let bounds: Vec<_> = self.param_env
+        let bounds = self.param_env
             .caller_bounds
             .iter()
             .filter_map(|predicate| {
@@ -667,10 +668,9 @@ fn assemble_inherent_candidates_from_param(&mut self,
                     ty::Predicate::TypeOutlives(..) |
                     ty::Predicate::ConstEvaluatable(..) => None,
                 }
-            })
-            .collect();
+            });
 
-        self.elaborate_bounds(&bounds, |this, poly_trait_ref, item| {
+        self.elaborate_bounds(bounds, |this, poly_trait_ref, item| {
             let trait_ref = this.erase_late_bound_regions(&poly_trait_ref);
 
             let (xform_self_ty, xform_ret_ty) =
@@ -693,15 +693,16 @@ fn assemble_inherent_candidates_from_param(&mut self,
 
     // Do a search through a list of bounds, using a callback to actually
     // create the candidates.
-    fn elaborate_bounds<F>(&mut self, bounds: &[ty::PolyTraitRef<'tcx>], mut mk_cand: F)
+    fn elaborate_bounds<F>(&mut self,
+                           bounds: impl Iterator<Item = ty::PolyTraitRef<'tcx>>,
+                           mut mk_cand: F)
         where F: for<'b> FnMut(&mut ProbeContext<'b, 'gcx, 'tcx>,
                                ty::PolyTraitRef<'tcx>,
                                ty::AssociatedItem)
     {
-        debug!("elaborate_bounds(bounds={:?})", bounds);
-
         let tcx = self.tcx;
         for bound_trait_ref in traits::transitive_bounds(tcx, bounds) {
+            debug!("elaborate_bounds(bound_trait_ref={:?})", bound_trait_ref);
             for item in self.impl_or_trait_item(bound_trait_ref.def_id()) {
                 if !self.has_applicable_self(&item) {
                     self.record_static_candidate(TraitSource(bound_trait_ref.def_id()));
@@ -831,7 +832,7 @@ fn pick(mut self) -> PickResult<'tcx> {
         }
 
         let static_candidates = mem::replace(&mut self.static_candidates, vec![]);
-        let private_candidate = mem::replace(&mut self.private_candidate, None);
+        let private_candidate = self.private_candidate.take();
         let unsatisfied_predicates = mem::replace(&mut self.unsatisfied_predicates, vec![]);
 
         // things failed, so lets look at all traits, for diagnostic purposes now:
index 7e25694d5598fc9b00a0c7b13a5af14a701fe583..4851938653b53d33eeebd38b78dd083c3a76234d 100644 (file)
@@ -3510,10 +3510,9 @@ fn check_expr_struct_fields(&self,
             _ => span_bug!(span, "non-ADT passed to check_expr_struct_fields")
         };
 
-        let mut remaining_fields = FxHashMap::default();
-        for (i, field) in variant.fields.iter().enumerate() {
-            remaining_fields.insert(field.ident.modern(), (i, field));
-        }
+        let mut remaining_fields = variant.fields.iter().enumerate().map(|(i, field)|
+            (field.ident.modern(), (i, field))
+        ).collect::<FxHashMap<_, _>>();
 
         let mut seen_fields = FxHashMap::default();
 
@@ -5051,10 +5050,8 @@ pub fn instantiate_value_path(&self,
         // provided (if any) into their appropriate spaces. We'll also report
         // errors if type parameters are provided in an inappropriate place.
 
-        let mut generic_segs = FxHashSet::default();
-        for PathSeg(_, index) in &path_segs {
-            generic_segs.insert(index);
-        }
+        let generic_segs = path_segs.iter().map(|PathSeg(_, index)| index)
+            .collect::<FxHashSet<_>>();
         AstConv::prohibit_generics(self, segments.iter().enumerate().filter_map(|(index, seg)| {
             if !generic_segs.contains(&index) {
                 Some(seg)
index 3174c1be3adc80a26824d8dbfc2f7569e15c1834..b31100716397b81e581e0b94ac195a82967953b4 100644 (file)
         return wrapper;
     }
 
-    var hideItemDeclarations = getCurrentValue('rustdoc-item-declarations') === "false";
+    var showItemDeclarations = getCurrentValue('rustdoc-item-declarations') === "false";
     function buildToggleWrapper(e) {
         if (hasClass(e, 'autohide')) {
             var wrap = e.previousElementSibling;
             if (hasClass(e, "type-decl")) {
                 fontSize = "20px";
                 otherMessage = '&nbsp;Show&nbsp;declaration';
-                if (hideItemDeclarations === false) {
+                if (showItemDeclarations === false) {
                     extraClass = 'collapsed';
                 }
             } else if (hasClass(e, "sub-variant")) {
                 extraClass = "marg-left";
             }
 
-            e.parentNode.insertBefore(createToggle(otherMessage,
-                                                   fontSize,
-                                                   extraClass,
-                                                   hideItemDeclarations),
-                                      e);
-            if (otherMessage.length > 0 && hideItemDeclarations === true) {
+            e.parentNode.insertBefore(
+                createToggle(otherMessage,
+                             fontSize,
+                             extraClass,
+                             hasClass(e, "type-decl") === false || showItemDeclarations === true),
+                e);
+            if (hasClass(e, "type-decl") === true && showItemDeclarations === true) {
                 collapseDocs(e.previousSibling.childNodes[0], "toggle");
             }
         }
index 8bcb828a5ade1e22f961bf5d68fb3ac1ed1eec5d..ad6cdfd3e733b131b13f7c9891629f490c40ebbc 100644 (file)
@@ -282,8 +282,11 @@ nav.sub {
        padding-left: 0;
 }
 
-.example-wrap {
+body:not(.source) .example-wrap {
        display: inline-flex;
+}
+
+.example-wrap {
        width: 100%;
 }
 
@@ -296,7 +299,7 @@ nav.sub {
        text-align: right;
 }
 
-.example-wrap > pre.rust {
+body:not(.source) .example-wrap > pre.rust {
        width: 100%;
 }
 
index a4db879680566d2a98634e675052e5ba52312b95..42a34c32e4fa3b7504adad61f54a0ee1441ab905 100644 (file)
 #![feature(cfg_target_vendor)]
 #![feature(char_error_internals)]
 #![feature(compiler_builtins_lib)]
-#![cfg_attr(stage0, feature(min_const_fn))]
 #![feature(const_int_ops)]
 #![feature(const_ip)]
 #![feature(const_raw_ptr_deref)]
index 3702c91966fdacbddc3fa554ed3d5285aaf8f413..a57b8dc7237678489baf2476a7350cc6f26e7b09 100644 (file)
@@ -1149,8 +1149,18 @@ pub fn unpark(&self) {
             _ => panic!("inconsistent state in unpark"),
         }
 
-        // Coordinate wakeup through the mutex and a condvar notification
-        let _lock = self.inner.lock.lock().unwrap();
+        // There is a period between when the parked thread sets `state` to
+        // `PARKED` (or last checked `state` in the case of a spurious wake
+        // up) and when it actually waits on `cvar`. If we were to notify
+        // during this period it would be ignored and then when the parked
+        // thread went to sleep it would never wake up. Fortunately, it has
+        // `lock` locked at this stage so we can acquire `lock` to wait until
+        // it is ready to receive the notification.
+        //
+        // Releasing `lock` before the call to `notify_one` means that when the
+        // parked thread wakes it doesn't get woken only to have to wait for us
+        // to release `lock`.
+        drop(self.inner.lock.lock().unwrap());
         self.inner.cvar.notify_one()
     }
 
index b0cf29e9f63a4a2322467778dba3767ca543a29a..a32682967c7409de4d28874a3dd1d9aabff8796e 100644 (file)
 pub struct JsonEmitter {
     dst: Box<dyn Write + Send>,
     registry: Option<Registry>,
-    cm: Lrc<dyn SourceMapper + sync::Send + sync::Sync>,
+    sm: Lrc<dyn SourceMapper + sync::Send + sync::Sync>,
     pretty: bool,
     ui_testing: bool,
 }
 
 impl JsonEmitter {
     pub fn stderr(registry: Option<Registry>,
-                  code_map: Lrc<SourceMap>,
+                  source_map: Lrc<SourceMap>,
                   pretty: bool) -> JsonEmitter {
         JsonEmitter {
             dst: Box::new(io::stderr()),
             registry,
-            cm: code_map,
+            sm: source_map,
             pretty,
             ui_testing: false,
         }
@@ -62,12 +62,12 @@ pub fn basic(pretty: bool) -> JsonEmitter {
 
     pub fn new(dst: Box<dyn Write + Send>,
                registry: Option<Registry>,
-               code_map: Lrc<SourceMap>,
+               source_map: Lrc<SourceMap>,
                pretty: bool) -> JsonEmitter {
         JsonEmitter {
             dst,
             registry,
-            cm: code_map,
+            sm: source_map,
             pretty,
             ui_testing: false,
         }
@@ -199,7 +199,7 @@ fn flush(&mut self) -> io::Result<()> {
         }
         let buf = BufWriter::default();
         let output = buf.clone();
-        EmitterWriter::new(Box::new(buf), Some(je.cm.clone()), false, false)
+        EmitterWriter::new(Box::new(buf), Some(je.sm.clone()), false, false)
             .ui_testing(je.ui_testing).emit(db);
         let output = Arc::try_unwrap(output.0).unwrap().into_inner().unwrap();
         let output = String::from_utf8(output).unwrap();
@@ -269,8 +269,8 @@ fn from_span_full(span: Span,
                       mut backtrace: vec::IntoIter<MacroBacktrace>,
                       je: &JsonEmitter)
                       -> DiagnosticSpan {
-        let start = je.cm.lookup_char_pos(span.lo());
-        let end = je.cm.lookup_char_pos(span.hi());
+        let start = je.sm.lookup_char_pos(span.lo());
+        let end = je.sm.lookup_char_pos(span.hi());
         let backtrace_step = backtrace.next().map(|bt| {
             let call_site =
                 Self::from_span_full(bt.call_site,
@@ -356,7 +356,7 @@ fn line_from_source_file(fm: &syntax_pos::SourceFile,
     /// of `span` gets a DiagnosticSpanLine, with the highlight indicating the
     /// `span` within the line.
     fn from_span(span: Span, je: &JsonEmitter) -> Vec<DiagnosticSpanLine> {
-        je.cm.span_to_lines(span)
+        je.sm.span_to_lines(span)
              .map(|lines| {
                  let fm = &*lines.file;
                  lines.lines
index a814c88ee78216babc4db391df90667d0efabcf7..465ce73e01de20d6dc0097eab8c6db41f8bfc342 100644 (file)
@@ -256,11 +256,11 @@ pub fn retokenize(sess: &'a ParseSess, mut span: Span) -> Self {
         let end = sess.source_map().lookup_byte_offset(span.hi());
 
         // Make the range zero-length if the span is invalid.
-        if span.lo() > span.hi() || begin.fm.start_pos != end.fm.start_pos {
+        if span.lo() > span.hi() || begin.sf.start_pos != end.sf.start_pos {
             span = span.shrink_to_lo();
         }
 
-        let mut sr = StringReader::new_raw_internal(sess, begin.fm, None);
+        let mut sr = StringReader::new_raw_internal(sess, begin.sf, None);
 
         // Seek the lexer to the right byte range.
         sr.next_pos = span.lo();
@@ -640,9 +640,9 @@ fn scan_comment(&mut self) -> Option<TokenAndSpan> {
 
                 // I guess this is the only way to figure out if
                 // we're at the beginning of the file...
-                let cmap = SourceMap::new(FilePathMapping::empty());
-                cmap.files.borrow_mut().file_maps.push(self.source_file.clone());
-                let loc = cmap.lookup_char_pos_adj(self.pos);
+                let smap = SourceMap::new(FilePathMapping::empty());
+                smap.files.borrow_mut().source_files.push(self.source_file.clone());
+                let loc = smap.lookup_char_pos_adj(self.pos);
                 debug!("Skipping a shebang");
                 if loc.line == 1 && loc.col == CharPos(0) {
                     // FIXME: Add shebang "token", return it
@@ -1855,9 +1855,9 @@ mod tests {
     use rustc_data_structures::fx::FxHashSet;
     use rustc_data_structures::sync::Lock;
     use with_globals;
-    fn mk_sess(cm: Lrc<SourceMap>) -> ParseSess {
+    fn mk_sess(sm: Lrc<SourceMap>) -> ParseSess {
         let emitter = errors::emitter::EmitterWriter::new(Box::new(io::sink()),
-                                                          Some(cm.clone()),
+                                                          Some(sm.clone()),
                                                           false,
                                                           false);
         ParseSess {
@@ -1865,7 +1865,7 @@ fn mk_sess(cm: Lrc<SourceMap>) -> ParseSess {
             unstable_features: UnstableFeatures::from_environment(),
             config: CrateConfig::default(),
             included_mod_stack: Lock::new(Vec::new()),
-            code_map: cm,
+            source_map: sm,
             missing_fragment_specifiers: Lock::new(FxHashSet::default()),
             raw_identifier_spans: Lock::new(Vec::new()),
             registered_diagnostics: Lock::new(ErrorMap::new()),
@@ -1875,20 +1875,20 @@ fn mk_sess(cm: Lrc<SourceMap>) -> ParseSess {
     }
 
     // open a string reader for the given string
-    fn setup<'a>(cm: &SourceMap,
+    fn setup<'a>(sm: &SourceMap,
                  sess: &'a ParseSess,
                  teststr: String)
                  -> StringReader<'a> {
-        let fm = cm.new_source_file(PathBuf::from("zebra.rs").into(), teststr);
-        StringReader::new(sess, fm, None)
+        let sf = sm.new_source_file(PathBuf::from("zebra.rs").into(), teststr);
+        StringReader::new(sess, sf, None)
     }
 
     #[test]
     fn t1() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            let mut string_reader = setup(&cm,
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            let mut string_reader = setup(&sm,
                                         &sh,
                                         "/* my source file */ fn main() { println!(\"zebra\"); }\n"
                                             .to_string());
@@ -1934,9 +1934,9 @@ fn mk_ident(id: &str) -> token::Token {
     #[test]
     fn doublecolonparsing() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            check_tokenization(setup(&cm, &sh, "a b".to_string()),
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            check_tokenization(setup(&sm, &sh, "a b".to_string()),
                             vec![mk_ident("a"), token::Whitespace, mk_ident("b")]);
         })
     }
@@ -1944,9 +1944,9 @@ fn doublecolonparsing() {
     #[test]
     fn dcparsing_2() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            check_tokenization(setup(&cm, &sh, "a::b".to_string()),
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            check_tokenization(setup(&sm, &sh, "a::b".to_string()),
                             vec![mk_ident("a"), token::ModSep, mk_ident("b")]);
         })
     }
@@ -1954,9 +1954,9 @@ fn dcparsing_2() {
     #[test]
     fn dcparsing_3() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            check_tokenization(setup(&cm, &sh, "a ::b".to_string()),
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            check_tokenization(setup(&sm, &sh, "a ::b".to_string()),
                             vec![mk_ident("a"), token::Whitespace, token::ModSep, mk_ident("b")]);
         })
     }
@@ -1964,9 +1964,9 @@ fn dcparsing_3() {
     #[test]
     fn dcparsing_4() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            check_tokenization(setup(&cm, &sh, "a:: b".to_string()),
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            check_tokenization(setup(&sm, &sh, "a:: b".to_string()),
                             vec![mk_ident("a"), token::ModSep, token::Whitespace, mk_ident("b")]);
         })
     }
@@ -1974,9 +1974,9 @@ fn dcparsing_4() {
     #[test]
     fn character_a() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            assert_eq!(setup(&cm, &sh, "'a'".to_string()).next_token().tok,
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            assert_eq!(setup(&sm, &sh, "'a'".to_string()).next_token().tok,
                     token::Literal(token::Char(Symbol::intern("a")), None));
         })
     }
@@ -1984,9 +1984,9 @@ fn character_a() {
     #[test]
     fn character_space() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            assert_eq!(setup(&cm, &sh, "' '".to_string()).next_token().tok,
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            assert_eq!(setup(&sm, &sh, "' '".to_string()).next_token().tok,
                     token::Literal(token::Char(Symbol::intern(" ")), None));
         })
     }
@@ -1994,9 +1994,9 @@ fn character_space() {
     #[test]
     fn character_escaped() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            assert_eq!(setup(&cm, &sh, "'\\n'".to_string()).next_token().tok,
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            assert_eq!(setup(&sm, &sh, "'\\n'".to_string()).next_token().tok,
                     token::Literal(token::Char(Symbol::intern("\\n")), None));
         })
     }
@@ -2004,9 +2004,9 @@ fn character_escaped() {
     #[test]
     fn lifetime_name() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            assert_eq!(setup(&cm, &sh, "'abc".to_string()).next_token().tok,
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            assert_eq!(setup(&sm, &sh, "'abc".to_string()).next_token().tok,
                     token::Lifetime(Ident::from_str("'abc")));
         })
     }
@@ -2014,9 +2014,9 @@ fn lifetime_name() {
     #[test]
     fn raw_string() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            assert_eq!(setup(&cm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string())
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            assert_eq!(setup(&sm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string())
                         .next_token()
                         .tok,
                     token::Literal(token::StrRaw(Symbol::intern("\"#a\\b\x00c\""), 3), None));
@@ -2026,15 +2026,15 @@ fn raw_string() {
     #[test]
     fn literal_suffixes() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
             macro_rules! test {
                 ($input: expr, $tok_type: ident, $tok_contents: expr) => {{
-                    assert_eq!(setup(&cm, &sh, format!("{}suffix", $input)).next_token().tok,
+                    assert_eq!(setup(&sm, &sh, format!("{}suffix", $input)).next_token().tok,
                             token::Literal(token::$tok_type(Symbol::intern($tok_contents)),
                                             Some(Symbol::intern("suffix"))));
                     // with a whitespace separator:
-                    assert_eq!(setup(&cm, &sh, format!("{} suffix", $input)).next_token().tok,
+                    assert_eq!(setup(&sm, &sh, format!("{} suffix", $input)).next_token().tok,
                             token::Literal(token::$tok_type(Symbol::intern($tok_contents)),
                                             None));
                 }}
@@ -2050,13 +2050,13 @@ macro_rules! test {
             test!("1.0", Float, "1.0");
             test!("1.0e10", Float, "1.0e10");
 
-            assert_eq!(setup(&cm, &sh, "2us".to_string()).next_token().tok,
+            assert_eq!(setup(&sm, &sh, "2us".to_string()).next_token().tok,
                     token::Literal(token::Integer(Symbol::intern("2")),
                                     Some(Symbol::intern("us"))));
-            assert_eq!(setup(&cm, &sh, "r###\"raw\"###suffix".to_string()).next_token().tok,
+            assert_eq!(setup(&sm, &sh, "r###\"raw\"###suffix".to_string()).next_token().tok,
                     token::Literal(token::StrRaw(Symbol::intern("raw"), 3),
                                     Some(Symbol::intern("suffix"))));
-            assert_eq!(setup(&cm, &sh, "br###\"raw\"###suffix".to_string()).next_token().tok,
+            assert_eq!(setup(&sm, &sh, "br###\"raw\"###suffix".to_string()).next_token().tok,
                     token::Literal(token::ByteStrRaw(Symbol::intern("raw"), 3),
                                     Some(Symbol::intern("suffix"))));
         })
@@ -2072,9 +2072,9 @@ fn line_doc_comments() {
     #[test]
     fn nested_block_comments() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            let mut lexer = setup(&cm, &sh, "/* /* */ */'a'".to_string());
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            let mut lexer = setup(&sm, &sh, "/* /* */ */'a'".to_string());
             match lexer.next_token().tok {
                 token::Comment => {}
                 _ => panic!("expected a comment!"),
@@ -2087,9 +2087,9 @@ fn nested_block_comments() {
     #[test]
     fn crlf_comments() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            let mut lexer = setup(&cm, &sh, "// test\r\n/// test\r\n".to_string());
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            let mut lexer = setup(&sm, &sh, "// test\r\n/// test\r\n".to_string());
             let comment = lexer.next_token();
             assert_eq!(comment.tok, token::Comment);
             assert_eq!((comment.sp.lo(), comment.sp.hi()), (BytePos(0), BytePos(7)));
index 77a2ae6acf00b680e4028bd5d98012f20b225980..ce32520b8e74603e3f58a25cbe4fb34e4ba1b5f7 100644 (file)
@@ -57,7 +57,7 @@ pub struct ParseSess {
     pub non_modrs_mods: Lock<Vec<(ast::Ident, Span)>>,
     /// Used to determine and report recursive mod inclusions
     included_mod_stack: Lock<Vec<PathBuf>>,
-    code_map: Lrc<SourceMap>,
+    source_map: Lrc<SourceMap>,
     pub buffered_lints: Lock<Vec<BufferedEarlyLint>>,
 }
 
@@ -71,7 +71,7 @@ pub fn new(file_path_mapping: FilePathMapping) -> Self {
         ParseSess::with_span_handler(handler, cm)
     }
 
-    pub fn with_span_handler(handler: Handler, code_map: Lrc<SourceMap>) -> ParseSess {
+    pub fn with_span_handler(handler: Handler, source_map: Lrc<SourceMap>) -> ParseSess {
         ParseSess {
             span_diagnostic: handler,
             unstable_features: UnstableFeatures::from_environment(),
@@ -80,14 +80,14 @@ pub fn with_span_handler(handler: Handler, code_map: Lrc<SourceMap>) -> ParseSes
             raw_identifier_spans: Lock::new(Vec::new()),
             registered_diagnostics: Lock::new(ErrorMap::new()),
             included_mod_stack: Lock::new(vec![]),
-            code_map,
+            source_map,
             non_modrs_mods: Lock::new(vec![]),
             buffered_lints: Lock::new(vec![]),
         }
     }
 
     pub fn source_map(&self) -> &SourceMap {
-        &self.code_map
+        &self.source_map
     }
 
     pub fn buffer_lint<S: Into<MultiSpan>>(&self,
index 17586a442daa9b4de42755fa4dc0b3d414dfa9dd..e8cacc3b5aff31e4d4560491c3574ae68cffdc9e 100644 (file)
@@ -106,17 +106,17 @@ fn read_file(&self, path: &Path) -> io::Result<String> {
 // subsequent compilation sessions (which is something we need to do during
 // incremental compilation).
 #[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)]
-pub struct StableFilemapId(u128);
+pub struct StableSourceFileId(u128);
 
-impl StableFilemapId {
-    pub fn new(source_file: &SourceFile) -> StableFilemapId {
+impl StableSourceFileId {
+    pub fn new(source_file: &SourceFile) -> StableSourceFileId {
         let mut hasher = StableHasher::new();
 
         source_file.name.hash(&mut hasher);
         source_file.name_was_remapped.hash(&mut hasher);
         source_file.unmapped_path.hash(&mut hasher);
 
-        StableFilemapId(hasher.finish())
+        StableSourceFileId(hasher.finish())
     }
 }
 
@@ -126,8 +126,8 @@ pub fn new(source_file: &SourceFile) -> StableFilemapId {
 
 #[derive(Default)]
 pub(super) struct SourceMapFiles {
-    pub(super) file_maps: Vec<Lrc<SourceFile>>,
-    stable_id_to_source_file: FxHashMap<StableFilemapId, Lrc<SourceFile>>
+    pub(super) source_files: Vec<Lrc<SourceFile>>,
+    stable_id_to_source_file: FxHashMap<StableSourceFileId, Lrc<SourceFile>>
 }
 
 pub struct SourceMap {
@@ -190,15 +190,16 @@ pub fn load_file(&self, path: &Path) -> io::Result<Lrc<SourceFile>> {
     }
 
     pub fn files(&self) -> MappedLockGuard<Vec<Lrc<SourceFile>>> {
-        LockGuard::map(self.files.borrow(), |files| &mut files.file_maps)
+        LockGuard::map(self.files.borrow(), |files| &mut files.source_files)
     }
 
-    pub fn source_file_by_stable_id(&self, stable_id: StableFilemapId) -> Option<Lrc<SourceFile>> {
-        self.files.borrow().stable_id_to_source_file.get(&stable_id).map(|fm| fm.clone())
+    pub fn source_file_by_stable_id(&self, stable_id: StableSourceFileId) ->
+    Option<Lrc<SourceFile>> {
+        self.files.borrow().stable_id_to_source_file.get(&stable_id).map(|sf| sf.clone())
     }
 
     fn next_start_pos(&self) -> usize {
-        match self.files.borrow().file_maps.last() {
+        match self.files.borrow().source_files.last() {
             None => 0,
             // Add one so there is some space between files. This lets us distinguish
             // positions in the source_map, even in the presence of zero-length files.
@@ -235,8 +236,8 @@ pub fn new_source_file(&self, filename: FileName, src: String) -> Lrc<SourceFile
 
         let mut files = self.files.borrow_mut();
 
-        files.file_maps.push(source_file.clone());
-        files.stable_id_to_source_file.insert(StableFilemapId::new(&source_file),
+        files.source_files.push(source_file.clone());
+        files.stable_id_to_source_file.insert(StableSourceFileId::new(&source_file),
                                               source_file.clone());
 
         source_file
@@ -293,8 +294,8 @@ pub fn new_imported_source_file(
 
         let mut files = self.files.borrow_mut();
 
-        files.file_maps.push(source_file.clone());
-        files.stable_id_to_source_file.insert(StableFilemapId::new(&source_file),
+        files.source_files.push(source_file.clone());
+        files.stable_id_to_source_file.insert(StableSourceFileId::new(&source_file),
                                               source_file.clone());
 
         source_file
@@ -324,7 +325,7 @@ pub fn doctest_offset_line(&self, mut orig: usize) -> usize {
     pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
         let chpos = self.bytepos_to_file_charpos(pos);
         match self.lookup_line(pos) {
-            Ok(SourceFileAndLine { fm: f, line: a }) => {
+            Ok(SourceFileAndLine { sf: f, line: a }) => {
                 let line = a + 1; // Line numbers start at 1
                 let linebpos = f.lines[a];
                 let linechpos = self.bytepos_to_file_charpos(linebpos);
@@ -387,10 +388,10 @@ pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
     pub fn lookup_line(&self, pos: BytePos) -> Result<SourceFileAndLine, Lrc<SourceFile>> {
         let idx = self.lookup_source_file_idx(pos);
 
-        let f = (*self.files.borrow().file_maps)[idx].clone();
+        let f = (*self.files.borrow().source_files)[idx].clone();
 
         match f.lookup_line(pos) {
-            Some(line) => Ok(SourceFileAndLine { fm: f, line: line }),
+            Some(line) => Ok(SourceFileAndLine { sf: f, line: line }),
             None => Err(f)
         }
     }
@@ -441,7 +442,7 @@ pub fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span> {
     }
 
     pub fn span_to_string(&self, sp: Span) -> String {
-        if self.files.borrow().file_maps.is_empty() && sp.is_dummy() {
+        if self.files.borrow().source_files.is_empty() && sp.is_dummy() {
             return "no-location".to_string();
         }
 
@@ -531,38 +532,38 @@ fn span_to_source<F>(&self, sp: Span, extract_source: F) -> Result<String, SpanS
         let local_begin = self.lookup_byte_offset(sp.lo());
         let local_end = self.lookup_byte_offset(sp.hi());
 
-        if local_begin.fm.start_pos != local_end.fm.start_pos {
+        if local_begin.sf.start_pos != local_end.sf.start_pos {
             return Err(SpanSnippetError::DistinctSources(DistinctSources {
-                begin: (local_begin.fm.name.clone(),
-                        local_begin.fm.start_pos),
-                end: (local_end.fm.name.clone(),
-                      local_end.fm.start_pos)
+                begin: (local_begin.sf.name.clone(),
+                        local_begin.sf.start_pos),
+                end: (local_end.sf.name.clone(),
+                      local_end.sf.start_pos)
             }));
         } else {
-            self.ensure_source_file_source_present(local_begin.fm.clone());
+            self.ensure_source_file_source_present(local_begin.sf.clone());
 
             let start_index = local_begin.pos.to_usize();
             let end_index = local_end.pos.to_usize();
-            let source_len = (local_begin.fm.end_pos -
-                              local_begin.fm.start_pos).to_usize();
+            let source_len = (local_begin.sf.end_pos -
+                              local_begin.sf.start_pos).to_usize();
 
             if start_index > end_index || end_index > source_len {
-                return Err(SpanSnippetError::MalformedForCodemap(
-                    MalformedCodemapPositions {
-                        name: local_begin.fm.name.clone(),
+                return Err(SpanSnippetError::MalformedForSourcemap(
+                    MalformedSourceMapPositions {
+                        name: local_begin.sf.name.clone(),
                         source_len,
                         begin_pos: local_begin.pos,
                         end_pos: local_end.pos,
                     }));
             }
 
-            if let Some(ref src) = local_begin.fm.src {
+            if let Some(ref src) = local_begin.sf.src {
                 return Ok(extract_source(src, start_index, end_index));
-            } else if let Some(src) = local_begin.fm.external_src.borrow().get_source() {
+            } else if let Some(src) = local_begin.sf.external_src.borrow().get_source() {
                 return Ok(extract_source(src, start_index, end_index));
             } else {
                 return Err(SpanSnippetError::SourceNotAvailable {
-                    filename: local_begin.fm.name.clone()
+                    filename: local_begin.sf.name.clone()
                 });
             }
         }
@@ -757,7 +758,7 @@ fn find_width_of_character_at_span(&self, sp: Span, forwards: bool) -> u32 {
             return 1;
         }
 
-        let source_len = (local_begin.fm.end_pos - local_begin.fm.start_pos).to_usize();
+        let source_len = (local_begin.sf.end_pos - local_begin.sf.start_pos).to_usize();
         debug!("find_width_of_character_at_span: source_len=`{:?}`", source_len);
         // Ensure indexes are also not malformed.
         if start_index > end_index || end_index > source_len {
@@ -765,11 +766,11 @@ fn find_width_of_character_at_span(&self, sp: Span, forwards: bool) -> u32 {
             return 1;
         }
 
-        let src = local_begin.fm.external_src.borrow();
+        let src = local_begin.sf.external_src.borrow();
 
         // We need to extend the snippet to the end of the src rather than to end_index so when
         // searching forwards for boundaries we've got somewhere to search.
-        let snippet = if let Some(ref src) = local_begin.fm.src {
+        let snippet = if let Some(ref src) = local_begin.sf.src {
             let len = src.len();
             (&src[start_index..len])
         } else if let Some(src) = src.get_source() {
@@ -806,9 +807,9 @@ fn find_width_of_character_at_span(&self, sp: Span, forwards: bool) -> u32 {
     }
 
     pub fn get_source_file(&self, filename: &FileName) -> Option<Lrc<SourceFile>> {
-        for fm in self.files.borrow().file_maps.iter() {
-            if *filename == fm.name {
-                return Some(fm.clone());
+        for sf in self.files.borrow().source_files.iter() {
+            if *filename == sf.name {
+                return Some(sf.clone());
             }
         }
         None
@@ -817,15 +818,15 @@ pub fn get_source_file(&self, filename: &FileName) -> Option<Lrc<SourceFile>> {
     /// For a global BytePos compute the local offset within the containing SourceFile
     pub fn lookup_byte_offset(&self, bpos: BytePos) -> SourceFileAndBytePos {
         let idx = self.lookup_source_file_idx(bpos);
-        let fm = (*self.files.borrow().file_maps)[idx].clone();
-        let offset = bpos - fm.start_pos;
-        SourceFileAndBytePos {fm: fm, pos: offset}
+        let sf = (*self.files.borrow().source_files)[idx].clone();
+        let offset = bpos - sf.start_pos;
+        SourceFileAndBytePos {sf: sf, pos: offset}
     }
 
     /// Converts an absolute BytePos to a CharPos relative to the source_file.
     pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos {
         let idx = self.lookup_source_file_idx(bpos);
-        let map = &(*self.files.borrow().file_maps)[idx];
+        let map = &(*self.files.borrow().source_files)[idx];
 
         // The number of extra bytes due to multibyte chars in the SourceFile
         let mut total_extra_bytes = 0;
@@ -851,7 +852,7 @@ pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos {
     // Return the index of the source_file (in self.files) which contains pos.
     pub fn lookup_source_file_idx(&self, pos: BytePos) -> usize {
         let files = self.files.borrow();
-        let files = &files.file_maps;
+        let files = &files.source_files;
         let count = files.len();
 
         // Binary search for the source_file.
@@ -974,9 +975,9 @@ fn call_span_if_macro(&self, sp: Span) -> Span {
         }
         sp
     }
-    fn ensure_source_file_source_present(&self, file_map: Lrc<SourceFile>) -> bool {
-        file_map.add_external_src(
-            || match file_map.name {
+    fn ensure_source_file_source_present(&self, source_file: Lrc<SourceFile>) -> bool {
+        source_file.add_external_src(
+            || match source_file.name {
                 FileName::Real(ref name) => self.file_loader.read_file(name).ok(),
                 _ => None,
             }
@@ -1031,97 +1032,97 @@ mod tests {
     use super::*;
     use rustc_data_structures::sync::Lrc;
 
-    fn init_code_map() -> SourceMap {
-        let cm = SourceMap::new(FilePathMapping::empty());
-        cm.new_source_file(PathBuf::from("blork.rs").into(),
+    fn init_source_map() -> SourceMap {
+        let sm = SourceMap::new(FilePathMapping::empty());
+        sm.new_source_file(PathBuf::from("blork.rs").into(),
                        "first line.\nsecond line".to_string());
-        cm.new_source_file(PathBuf::from("empty.rs").into(),
+        sm.new_source_file(PathBuf::from("empty.rs").into(),
                        String::new());
-        cm.new_source_file(PathBuf::from("blork2.rs").into(),
+        sm.new_source_file(PathBuf::from("blork2.rs").into(),
                        "first line.\nsecond line".to_string());
-        cm
+        sm
     }
 
     #[test]
     fn t3() {
         // Test lookup_byte_offset
-        let cm = init_code_map();
+        let sm = init_source_map();
 
-        let fmabp1 = cm.lookup_byte_offset(BytePos(23));
-        assert_eq!(fmabp1.fm.name, PathBuf::from("blork.rs").into());
-        assert_eq!(fmabp1.pos, BytePos(23));
+        let srcfbp1 = sm.lookup_byte_offset(BytePos(23));
+        assert_eq!(srcfbp1.sf.name, PathBuf::from("blork.rs").into());
+        assert_eq!(srcfbp1.pos, BytePos(23));
 
-        let fmabp1 = cm.lookup_byte_offset(BytePos(24));
-        assert_eq!(fmabp1.fm.name, PathBuf::from("empty.rs").into());
-        assert_eq!(fmabp1.pos, BytePos(0));
+        let srcfbp1 = sm.lookup_byte_offset(BytePos(24));
+        assert_eq!(srcfbp1.sf.name, PathBuf::from("empty.rs").into());
+        assert_eq!(srcfbp1.pos, BytePos(0));
 
-        let fmabp2 = cm.lookup_byte_offset(BytePos(25));
-        assert_eq!(fmabp2.fm.name, PathBuf::from("blork2.rs").into());
-        assert_eq!(fmabp2.pos, BytePos(0));
+        let srcfbp2 = sm.lookup_byte_offset(BytePos(25));
+        assert_eq!(srcfbp2.sf.name, PathBuf::from("blork2.rs").into());
+        assert_eq!(srcfbp2.pos, BytePos(0));
     }
 
     #[test]
     fn t4() {
         // Test bytepos_to_file_charpos
-        let cm = init_code_map();
+        let sm = init_source_map();
 
-        let cp1 = cm.bytepos_to_file_charpos(BytePos(22));
+        let cp1 = sm.bytepos_to_file_charpos(BytePos(22));
         assert_eq!(cp1, CharPos(22));
 
-        let cp2 = cm.bytepos_to_file_charpos(BytePos(25));
+        let cp2 = sm.bytepos_to_file_charpos(BytePos(25));
         assert_eq!(cp2, CharPos(0));
     }
 
     #[test]
     fn t5() {
         // Test zero-length source_files.
-        let cm = init_code_map();
+        let sm = init_source_map();
 
-        let loc1 = cm.lookup_char_pos(BytePos(22));
+        let loc1 = sm.lookup_char_pos(BytePos(22));
         assert_eq!(loc1.file.name, PathBuf::from("blork.rs").into());
         assert_eq!(loc1.line, 2);
         assert_eq!(loc1.col, CharPos(10));
 
-        let loc2 = cm.lookup_char_pos(BytePos(25));
+        let loc2 = sm.lookup_char_pos(BytePos(25));
         assert_eq!(loc2.file.name, PathBuf::from("blork2.rs").into());
         assert_eq!(loc2.line, 1);
         assert_eq!(loc2.col, CharPos(0));
     }
 
-    fn init_code_map_mbc() -> SourceMap {
-        let cm = SourceMap::new(FilePathMapping::empty());
+    fn init_source_map_mbc() -> SourceMap {
+        let sm = SourceMap::new(FilePathMapping::empty());
         // â‚¬ is a three byte utf8 char.
-        cm.new_source_file(PathBuf::from("blork.rs").into(),
+        sm.new_source_file(PathBuf::from("blork.rs").into(),
                        "fir€st â‚¬â‚¬â‚¬â‚¬ line.\nsecond line".to_string());
-        cm.new_source_file(PathBuf::from("blork2.rs").into(),
+        sm.new_source_file(PathBuf::from("blork2.rs").into(),
                        "first line€€.\n€ second line".to_string());
-        cm
+        sm
     }
 
     #[test]
     fn t6() {
         // Test bytepos_to_file_charpos in the presence of multi-byte chars
-        let cm = init_code_map_mbc();
+        let sm = init_source_map_mbc();
 
-        let cp1 = cm.bytepos_to_file_charpos(BytePos(3));
+        let cp1 = sm.bytepos_to_file_charpos(BytePos(3));
         assert_eq!(cp1, CharPos(3));
 
-        let cp2 = cm.bytepos_to_file_charpos(BytePos(6));
+        let cp2 = sm.bytepos_to_file_charpos(BytePos(6));
         assert_eq!(cp2, CharPos(4));
 
-        let cp3 = cm.bytepos_to_file_charpos(BytePos(56));
+        let cp3 = sm.bytepos_to_file_charpos(BytePos(56));
         assert_eq!(cp3, CharPos(12));
 
-        let cp4 = cm.bytepos_to_file_charpos(BytePos(61));
+        let cp4 = sm.bytepos_to_file_charpos(BytePos(61));
         assert_eq!(cp4, CharPos(15));
     }
 
     #[test]
     fn t7() {
         // Test span_to_lines for a span ending at the end of source_file
-        let cm = init_code_map();
+        let sm = init_source_map();
         let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
-        let file_lines = cm.span_to_lines(span).unwrap();
+        let file_lines = sm.span_to_lines(span).unwrap();
 
         assert_eq!(file_lines.file.name, PathBuf::from("blork.rs").into());
         assert_eq!(file_lines.lines.len(), 1);
@@ -1143,17 +1144,17 @@ fn span_from_selection(input: &str, selection: &str) -> Span {
     /// lines in the middle of a file.
     #[test]
     fn span_to_snippet_and_lines_spanning_multiple_lines() {
-        let cm = SourceMap::new(FilePathMapping::empty());
+        let sm = SourceMap::new(FilePathMapping::empty());
         let inputtext = "aaaaa\nbbbbBB\nCCC\nDDDDDddddd\neee\n";
         let selection = "     \n    ~~\n~~~\n~~~~~     \n   \n";
-        cm.new_source_file(Path::new("blork.rs").to_owned().into(), inputtext.to_string());
+        sm.new_source_file(Path::new("blork.rs").to_owned().into(), inputtext.to_string());
         let span = span_from_selection(inputtext, selection);
 
         // check that we are extracting the text we thought we were extracting
-        assert_eq!(&cm.span_to_snippet(span).unwrap(), "BB\nCCC\nDDDDD");
+        assert_eq!(&sm.span_to_snippet(span).unwrap(), "BB\nCCC\nDDDDD");
 
         // check that span_to_lines gives us the complete result with the lines/cols we expected
-        let lines = cm.span_to_lines(span).unwrap();
+        let lines = sm.span_to_lines(span).unwrap();
         let expected = vec![
             LineInfo { line_index: 1, start_col: CharPos(4), end_col: CharPos(6) },
             LineInfo { line_index: 2, start_col: CharPos(0), end_col: CharPos(3) },
@@ -1165,9 +1166,9 @@ fn span_to_snippet_and_lines_spanning_multiple_lines() {
     #[test]
     fn t8() {
         // Test span_to_snippet for a span ending at the end of source_file
-        let cm = init_code_map();
+        let sm = init_source_map();
         let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
-        let snippet = cm.span_to_snippet(span);
+        let snippet = sm.span_to_snippet(span);
 
         assert_eq!(snippet, Ok("second line".to_string()));
     }
@@ -1175,9 +1176,9 @@ fn t8() {
     #[test]
     fn t9() {
         // Test span_to_str for a span ending at the end of source_file
-        let cm = init_code_map();
+        let sm = init_source_map();
         let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
-        let sstr =  cm.span_to_string(span);
+        let sstr =  sm.span_to_string(span);
 
         assert_eq!(sstr, "blork.rs:2:1: 2:12");
     }
@@ -1185,15 +1186,15 @@ fn t9() {
     /// Test failing to merge two spans on different lines
     #[test]
     fn span_merging_fail() {
-        let cm = SourceMap::new(FilePathMapping::empty());
+        let sm = SourceMap::new(FilePathMapping::empty());
         let inputtext  = "bbbb BB\ncc CCC\n";
         let selection1 = "     ~~\n      \n";
         let selection2 = "       \n   ~~~\n";
-        cm.new_source_file(Path::new("blork.rs").to_owned().into(), inputtext.to_owned());
+        sm.new_source_file(Path::new("blork.rs").to_owned().into(), inputtext.to_owned());
         let span1 = span_from_selection(inputtext, selection1);
         let span2 = span_from_selection(inputtext, selection2);
 
-        assert!(cm.merge_spans(span1, span2).is_none());
+        assert!(sm.merge_spans(span1, span2).is_none());
     }
 
     /// Returns the span corresponding to the `n`th occurrence of
index d49965fd93642dd957aa92a56dba3ab5370acce6..799489ba42cc31b528c0ed6336594b4f2ca08277 100644 (file)
@@ -50,8 +50,8 @@ fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &
     with_globals(|| {
         let output = Arc::new(Mutex::new(Vec::new()));
 
-        let code_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-        code_map.new_source_file(Path::new("test.rs").to_owned().into(), file_text.to_owned());
+        let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+        source_map.new_source_file(Path::new("test.rs").to_owned().into(), file_text.to_owned());
 
         let primary_span = make_span(&file_text, &span_labels[0].start, &span_labels[0].end);
         let mut msp = MultiSpan::from_span(primary_span);
@@ -59,11 +59,11 @@ fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &
             let span = make_span(&file_text, &span_label.start, &span_label.end);
             msp.push_span_label(span, span_label.label.to_string());
             println!("span: {:?} label: {:?}", span, span_label.label);
-            println!("text: {:?}", code_map.span_to_snippet(span));
+            println!("text: {:?}", source_map.span_to_snippet(span));
         }
 
         let emitter = EmitterWriter::new(Box::new(Shared { data: output.clone() }),
-                                        Some(code_map.clone()),
+                                        Some(source_map.clone()),
                                         false,
                                         false);
         let handler = Handler::with_emitter(true, false, Box::new(emitter));
index e468aaac7a30686d46d640d0581e07d03a10083a..7bc9a1af62c19b1e45710ce549c51480c1c4690f 100644 (file)
@@ -36,9 +36,9 @@ pub fn analyze_source_file(
     // it encounters. If that point is already outside the source_file, remove
     // it again.
     if let Some(&last_line_start) = lines.last() {
-        let file_map_end = source_file_start_pos + BytePos::from_usize(src.len());
-        assert!(file_map_end >= last_line_start);
-        if last_line_start == file_map_end {
+        let source_file_end = source_file_start_pos + BytePos::from_usize(src.len());
+        assert!(source_file_end >= last_line_start);
+        if last_line_start == source_file_end {
             lines.pop();
         }
     }
index 639155636edfa9ecf7f1e7375d9f3aaeaff79f34..a780a38ff96f53fb1b8ea73fa1036c7e17771154 100644 (file)
@@ -1266,9 +1266,9 @@ pub struct LocWithOpt {
 
 // used to be structural records. Better names, anyone?
 #[derive(Debug)]
-pub struct SourceFileAndLine { pub fm: Lrc<SourceFile>, pub line: usize }
+pub struct SourceFileAndLine { pub sf: Lrc<SourceFile>, pub line: usize }
 #[derive(Debug)]
-pub struct SourceFileAndBytePos { pub fm: Lrc<SourceFile>, pub pos: BytePos }
+pub struct SourceFileAndBytePos { pub sf: Lrc<SourceFile>, pub pos: BytePos }
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
 pub struct LineInfo {
@@ -1303,7 +1303,7 @@ pub struct MacroBacktrace {
 }
 
 // _____________________________________________________________________________
-// SpanLinesError, SpanSnippetError, DistinctSources, MalformedCodemapPositions
+// SpanLinesError, SpanSnippetError, DistinctSources, MalformedSourceMapPositions
 //
 
 pub type FileLinesResult = Result<FileLines, SpanLinesError>;
@@ -1318,7 +1318,7 @@ pub enum SpanLinesError {
 pub enum SpanSnippetError {
     IllFormedSpan(Span),
     DistinctSources(DistinctSources),
-    MalformedForCodemap(MalformedCodemapPositions),
+    MalformedForSourcemap(MalformedSourceMapPositions),
     SourceNotAvailable { filename: FileName }
 }
 
@@ -1329,7 +1329,7 @@ pub struct DistinctSources {
 }
 
 #[derive(Clone, PartialEq, Eq, Debug)]
-pub struct MalformedCodemapPositions {
+pub struct MalformedSourceMapPositions {
     pub name: FileName,
     pub source_len: usize,
     pub begin_pos: BytePos,
index caddcd9b9dc9479a20908d93c3e47c49b021379e..7051ead40a5f825878b59bf08d4e768be9e99a4a 160000 (submodule)
--- a/src/llvm
+++ b/src/llvm
@@ -1 +1 @@
-Subproject commit caddcd9b9dc9479a20908d93c3e47c49b021379e
+Subproject commit 7051ead40a5f825878b59bf08d4e768be9e99a4a
index bf7afa1b6c0684d15f2e19300e114af89c8ce3a4..affec73e3ac62d608c8db0fbf46090698b2e74cc 100644 (file)
@@ -713,6 +713,21 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStructType(
       unwrapDI<DIType>(VTableHolder), UniqueId));
 }
 
+extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantPart(
+    LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
+    LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits,
+    uint32_t AlignInBits, LLVMRustDIFlags Flags, LLVMMetadataRef Discriminator,
+    LLVMMetadataRef Elements, const char *UniqueId) {
+#if LLVM_VERSION_GE(7, 0)
+  return wrap(Builder->createVariantPart(
+      unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNumber,
+      SizeInBits, AlignInBits, fromRust(Flags), unwrapDI<DIDerivedType>(Discriminator),
+      DINodeArray(unwrapDI<MDTuple>(Elements)), UniqueId));
+#else
+  abort();
+#endif
+}
+
 extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMemberType(
     LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
     LLVMMetadataRef File, unsigned LineNo, uint64_t SizeInBits,
@@ -724,6 +739,28 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMemberType(
                                         fromRust(Flags), unwrapDI<DIType>(Ty)));
 }
 
+extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantMemberType(
+    LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope,
+    const char *Name, LLVMMetadataRef File, unsigned LineNo, uint64_t SizeInBits,
+    uint32_t AlignInBits, uint64_t OffsetInBits, LLVMValueRef Discriminant,
+    LLVMRustDIFlags Flags, LLVMMetadataRef Ty) {
+#if LLVM_VERSION_GE(7, 0)
+  llvm::ConstantInt* D = nullptr;
+  if (Discriminant) {
+    D = unwrap<llvm::ConstantInt>(Discriminant);
+  }
+  return wrap(Builder->createVariantMemberType(unwrapDI<DIDescriptor>(Scope), Name,
+                                               unwrapDI<DIFile>(File), LineNo,
+                                               SizeInBits, AlignInBits, OffsetInBits, D,
+                                               fromRust(Flags), unwrapDI<DIType>(Ty)));
+#else
+  return wrap(Builder->createMemberType(unwrapDI<DIDescriptor>(Scope), Name,
+                                        unwrapDI<DIFile>(File), LineNo,
+                                        SizeInBits, AlignInBits, OffsetInBits,
+                                        fromRust(Flags), unwrapDI<DIType>(Ty)));
+#endif
+}
+
 extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateLexicalBlock(
     LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope,
     LLVMMetadataRef File, unsigned Line, unsigned Col) {
@@ -826,11 +863,19 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerationType(
     LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
     LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits,
     uint32_t AlignInBits, LLVMMetadataRef Elements,
-    LLVMMetadataRef ClassTy) {
+    LLVMMetadataRef ClassTy, bool IsFixed) {
+#if LLVM_VERSION_GE(7, 0)
   return wrap(Builder->createEnumerationType(
       unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNumber,
       SizeInBits, AlignInBits, DINodeArray(unwrapDI<MDTuple>(Elements)),
-      unwrapDI<DIType>(ClassTy)));
+      unwrapDI<DIType>(ClassTy), "", IsFixed));
+#else
+  // Ignore IsFixed on older LLVM.
+  return wrap(Builder->createEnumerationType(
+      unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNumber,
+      SizeInBits, AlignInBits, DINodeArray(unwrapDI<MDTuple>(Elements)),
+      unwrapDI<DIType>(ClassTy), ""));
+#endif
 }
 
 extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateUnionType(
index 6e931a84bacb9f6f7d5175f6eab3f49043eb55c2..9326e22090c22300101815c99b5a49eadebc5f60 100644 (file)
@@ -12,7 +12,7 @@
 # source tarball for a stable release you'll likely see `1.x.0` for rustc and
 # `0.x.0` for Cargo where they were released on `date`.
 
-date: 2018-10-13
+date: 2018-10-30
 rustc: beta
 cargo: beta
 
diff --git a/src/test/codegen/enum-debug-clike.rs b/src/test/codegen/enum-debug-clike.rs
new file mode 100644 (file)
index 0000000..528e84b
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright 2018 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 depends on a patch that was committed to upstream LLVM
+// before 7.0, then backported to the Rust LLVM fork.  It tests that
+// debug info for "c-like" enums is properly emitted.
+
+// ignore-tidy-linelength
+// ignore-windows
+// min-system-llvm-version 7.0
+
+// compile-flags: -g -C no-prepopulate-passes
+
+// CHECK-LABEL: @main
+// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_enumeration_type,{{.*}}name: "E",{{.*}}flags: DIFlagFixedEnum,{{.*}}
+// CHECK: {{.*}}DIEnumerator{{.*}}name: "A",{{.*}}value: {{[0-9].*}}
+// CHECK: {{.*}}DIEnumerator{{.*}}name: "B",{{.*}}value: {{[0-9].*}}
+// CHECK: {{.*}}DIEnumerator{{.*}}name: "C",{{.*}}value: {{[0-9].*}}
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+#![allow(unused_assignments)]
+
+enum E { A, B, C }
+
+pub fn main() {
+    let e = E::C;
+}
diff --git a/src/test/codegen/enum-debug-niche.rs b/src/test/codegen/enum-debug-niche.rs
new file mode 100644 (file)
index 0000000..6326ba9
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright 2018 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 depends on a patch that was committed to upstream LLVM
+// before 7.0, then backported to the Rust LLVM fork.  It tests that
+// optimized enum debug info accurately reflects the enum layout.
+
+// ignore-tidy-linelength
+// ignore-windows
+// min-system-llvm-version 7.0
+
+// compile-flags: -g -C no-prepopulate-passes
+
+// CHECK-LABEL: @main
+// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}discriminator:{{.*}}
+// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "A",{{.*}}extraData:{{.*}}
+// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "A",{{.*}}
+// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "B",{{.*}}extraData:{{.*}}
+// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "B",{{.*}}
+// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "C",{{.*}}extraData:{{.*}}
+// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "C",{{.*}}
+// CHECK-NOT: {{.*}}DIDerivedType{{.*}}name: "D",{{.*}}extraData:{{.*}}
+// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "D",{{.*}}
+// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "D",{{.*}}
+// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}flags: DIFlagArtificial{{.*}}
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+#![allow(unused_assignments)]
+
+enum E { A, B, C, D(bool) }
+
+pub fn main() {
+    let e = E::D(true);
+}
diff --git a/src/test/codegen/enum-debug-tagged.rs b/src/test/codegen/enum-debug-tagged.rs
new file mode 100644 (file)
index 0000000..e862d29
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright 2018 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 depends on a patch that was committed to upstream LLVM
+// before 7.0, then backported to the Rust LLVM fork.  It tests that
+// debug info for tagged (ordinary) enums is properly emitted.
+
+// ignore-tidy-linelength
+// ignore-windows
+// min-system-llvm-version 7.0
+
+// compile-flags: -g -C no-prepopulate-passes
+
+// CHECK-LABEL: @main
+// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "E",{{.*}}
+// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}discriminator:{{.*}}
+// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "A",{{.*}}extraData:{{.*}}
+// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "A",{{.*}}
+// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "__0",{{.*}}
+// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "B",{{.*}}extraData:{{.*}}
+// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "B",{{.*}}
+// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "__0",{{.*}}
+// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}flags: DIFlagArtificial{{.*}}
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+#![allow(unused_assignments)]
+
+enum E { A(u32), B(u32) }
+
+pub fn main() {
+    let e = E::A(23);
+}
index 75737cd6f135e835cdc9337a8a77c1a2fd2eeaae..dcd4588af76c7710b063a0dd63d1da6ec12b5b9b 100644 (file)
 
 // min-lldb-version: 310
 
+// This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only
+// for now.
+// only-macos
+
 // compile-flags:-g
 
 // === GDB TESTS ===================================================================================
diff --git a/src/test/debuginfo/borrowed-enum-legacy.rs b/src/test/debuginfo/borrowed-enum-legacy.rs
new file mode 100644 (file)
index 0000000..a04f7d6
--- /dev/null
@@ -0,0 +1,94 @@
+// Copyright 2013-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.
+
+// ignore-tidy-linelength
+// min-lldb-version: 310
+
+// As long as LLVM 5 and LLVM 6 are supported, we want to test the
+// enum debuginfo fallback mode.  Once those are desupported, this
+// test can be removed, as there is another (non-"legacy") test that
+// tests the new mode.
+// ignore-llvm-version: 7.0 - 9.9.9
+// ignore-gdb-version: 7.11.90 - 7.12.9
+// ignore-gdb-version: 8.2 - 9.9
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *the_a_ref
+// gdbg-check:$1 = {{RUST$ENUM$DISR = TheA, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = TheA, [...]}}
+// gdbr-check:$1 = borrowed_enum_legacy::ABC::TheA{x: 0, y: 8970181431921507452}
+
+// gdb-command:print *the_b_ref
+// gdbg-check:$2 = {{RUST$ENUM$DISR = TheB, [...]}, {RUST$ENUM$DISR = TheB, __0 = 0, __1 = 286331153, __2 = 286331153}}
+// gdbr-check:$2 = borrowed_enum_legacy::ABC::TheB(0, 286331153, 286331153)
+
+// gdb-command:print *univariant_ref
+// gdbg-check:$3 = {{__0 = 4820353753753434}}
+// gdbr-check:$3 = borrowed_enum_legacy::Univariant::TheOnlyCase(4820353753753434)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print *the_a_ref
+// lldbg-check:[...]$0 = TheA { x: 0, y: 8970181431921507452 }
+// lldbr-check:(borrowed_enum_legacy::ABC::TheA) *the_a_ref = TheA { borrowed_enum_legacy::ABC::TheA: 0, borrowed_enum_legacy::ABC::TheB: 8970181431921507452 }
+// lldb-command:print *the_b_ref
+// lldbg-check:[...]$1 = TheB(0, 286331153, 286331153)
+// lldbr-check:(borrowed_enum_legacy::ABC::TheB) *the_b_ref = { = 0 = 286331153 = 286331153 }
+// lldb-command:print *univariant_ref
+// lldbg-check:[...]$2 = TheOnlyCase(4820353753753434)
+// lldbr-check:(borrowed_enum_legacy::Univariant) *univariant_ref = { borrowed_enum_legacy::TheOnlyCase = { = 4820353753753434 } }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum ABC {
+    TheA { x: i64, y: i64 },
+    TheB (i64, i32, i32),
+}
+
+// This is a special case since it does not have the implicit discriminant field.
+enum Univariant {
+    TheOnlyCase(i64)
+}
+
+fn main() {
+
+    // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+    // 0b01111100011111000111110001111100 = 2088533116
+    // 0b0111110001111100 = 31868
+    // 0b01111100 = 124
+    let the_a = ABC::TheA { x: 0, y: 8970181431921507452 };
+    let the_a_ref: &ABC = &the_a;
+
+    // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+    // 0b00010001000100010001000100010001 = 286331153
+    // 0b0001000100010001 = 4369
+    // 0b00010001 = 17
+    let the_b = ABC::TheB (0, 286331153, 286331153);
+    let the_b_ref: &ABC = &the_b;
+
+    let univariant = Univariant::TheOnlyCase(4820353753753434);
+    let univariant_ref: &Univariant = &univariant;
+
+    zzz(); // #break
+}
+
+fn zzz() {()}
index 9143e83343fb89cddc0ee653302d92e8e4c585c1..8362934166cf56a7abeab87cc76e00929e2906fa 100644 (file)
@@ -9,8 +9,11 @@
 // except according to those terms.
 
 // ignore-tidy-linelength
-// min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// Require LLVM with DW_TAG_variant_part and a gdb or lldb that can read it.
+// min-system-llvm-version: 7.0
+// min-gdb-version: 8.2
+// rust-lldb
 
 // compile-flags:-g
 
 // gdb-command:run
 
 // gdb-command:print *the_a_ref
-// gdbg-check:$1 = {{RUST$ENUM$DISR = TheA, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = TheA, [...]}}
 // gdbr-check:$1 = borrowed_enum::ABC::TheA{x: 0, y: 8970181431921507452}
 
 // gdb-command:print *the_b_ref
-// gdbg-check:$2 = {{RUST$ENUM$DISR = TheB, [...]}, {RUST$ENUM$DISR = TheB, __0 = 0, __1 = 286331153, __2 = 286331153}}
 // gdbr-check:$2 = borrowed_enum::ABC::TheB(0, 286331153, 286331153)
 
 // gdb-command:print *univariant_ref
-// gdbg-check:$3 = {{__0 = 4820353753753434}}
 // gdbr-check:$3 = borrowed_enum::Univariant::TheOnlyCase(4820353753753434)
 
 
 // lldb-command:run
 
 // lldb-command:print *the_a_ref
-// lldbg-check:[...]$0 = TheA { x: 0, y: 8970181431921507452 }
-// lldbr-check:(borrowed_enum::ABC::TheA) *the_a_ref = TheA { borrowed_enum::ABC::TheA: 0, borrowed_enum::ABC::TheB: 8970181431921507452 }
+// lldbr-check:(borrowed_enum::ABC::TheA) *the_a_ref = TheA { TheA: 0, TheB: 8970181431921507452 }
 // lldb-command:print *the_b_ref
-// lldbg-check:[...]$1 = TheB(0, 286331153, 286331153)
 // lldbr-check:(borrowed_enum::ABC::TheB) *the_b_ref = { = 0 = 286331153 = 286331153 }
 // lldb-command:print *univariant_ref
-// lldbg-check:[...]$2 = TheOnlyCase(4820353753753434)
-// lldbr-check:(borrowed_enum::Univariant) *univariant_ref = { borrowed_enum::TheOnlyCase = { = 4820353753753434 } }
+// lldbr-check:(borrowed_enum::Univariant) *univariant_ref = { TheOnlyCase = { = 4820353753753434 } }
 
 #![allow(unused_variables)]
 #![feature(omit_gdb_pretty_printer_section)]
index 9002e19ce21baa77b38b903e732393794e475362..715024a2ef9130ba800a9d5a35a167bfe37ce8fd 100644 (file)
 
 // min-lldb-version: 310
 
+// This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only
+// for now.
+// only-macos
+
 // aux-build:cross_crate_spans.rs
 extern crate cross_crate_spans;
 
index 48231a906c902a7032a7187f33dc6c2dac277621..77583ab10377919c75f57508134b781248a0d5fb 100644 (file)
 
 // min-lldb-version: 310
 
+// This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only
+// for now.
+// only-macos
+
 // compile-flags:-g
 
 // === GDB TESTS ===================================================================================
diff --git a/src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs b/src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs
new file mode 100644 (file)
index 0000000..092b31b
--- /dev/null
@@ -0,0 +1,115 @@
+// Copyright 2013-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.
+
+// ignore-tidy-linelength
+// ignore-lldb: FIXME(#27089)
+// min-lldb-version: 310
+
+// As long as LLVM 5 and LLVM 6 are supported, we want to test the
+// enum debuginfo fallback mode.  Once those are desupported, this
+// test can be removed, as there is another (non-"legacy") test that
+// tests the new mode.
+// ignore-llvm-version: 7.0 - 9.9.9
+// ignore-gdb-version: 8.2 - 9.9
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+// gdb-command:run
+
+// gdb-command:print eight_bytes1
+// gdbg-check:$1 = {{RUST$ENUM$DISR = Variant1, __0 = 100}, {RUST$ENUM$DISR = Variant1, __0 = 100}}
+// gdbr-check:$1 = generic_enum_with_different_disr_sizes_legacy::Enum::Variant1(100)
+
+// gdb-command:print four_bytes1
+// gdbg-check:$2 = {{RUST$ENUM$DISR = Variant1, __0 = 101}, {RUST$ENUM$DISR = Variant1, __0 = 101}}
+// gdbr-check:$2 = generic_enum_with_different_disr_sizes_legacy::Enum::Variant1(101)
+
+// gdb-command:print two_bytes1
+// gdbg-check:$3 = {{RUST$ENUM$DISR = Variant1, __0 = 102}, {RUST$ENUM$DISR = Variant1, __0 = 102}}
+// gdbr-check:$3 = generic_enum_with_different_disr_sizes_legacy::Enum::Variant1(102)
+
+// gdb-command:print one_byte1
+// gdbg-check:$4 = {{RUST$ENUM$DISR = Variant1, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant1, __0 = 65 'A'}}
+// gdbr-check:$4 = generic_enum_with_different_disr_sizes_legacy::Enum::Variant1(65)
+
+
+// gdb-command:print eight_bytes2
+// gdbg-check:$5 = {{RUST$ENUM$DISR = Variant2, __0 = 100}, {RUST$ENUM$DISR = Variant2, __0 = 100}}
+// gdbr-check:$5 = generic_enum_with_different_disr_sizes_legacy::Enum::Variant2(100)
+
+// gdb-command:print four_bytes2
+// gdbg-check:$6 = {{RUST$ENUM$DISR = Variant2, __0 = 101}, {RUST$ENUM$DISR = Variant2, __0 = 101}}
+// gdbr-check:$6 = generic_enum_with_different_disr_sizes_legacy::Enum::Variant2(101)
+
+// gdb-command:print two_bytes2
+// gdbg-check:$7 = {{RUST$ENUM$DISR = Variant2, __0 = 102}, {RUST$ENUM$DISR = Variant2, __0 = 102}}
+// gdbr-check:$7 = generic_enum_with_different_disr_sizes_legacy::Enum::Variant2(102)
+
+// gdb-command:print one_byte2
+// gdbg-check:$8 = {{RUST$ENUM$DISR = Variant2, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant2, __0 = 65 'A'}}
+// gdbr-check:$8 = generic_enum_with_different_disr_sizes_legacy::Enum::Variant2(65)
+
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+// lldb-command:run
+
+// lldb-command:print eight_bytes1
+// lldb-check:[...]$0 = Variant1(100)
+// lldb-command:print four_bytes1
+// lldb-check:[...]$1 = Variant1(101)
+// lldb-command:print two_bytes1
+// lldb-check:[...]$2 = Variant1(102)
+// lldb-command:print one_byte1
+// lldb-check:[...]$3 = Variant1('A')
+
+// lldb-command:print eight_bytes2
+// lldb-check:[...]$4 = Variant2(100)
+// lldb-command:print four_bytes2
+// lldb-check:[...]$5 = Variant2(101)
+// lldb-command:print two_bytes2
+// lldb-check:[...]$6 = Variant2(102)
+// lldb-command:print one_byte2
+// lldb-check:[...]$7 = Variant2('A')
+
+// lldb-command:continue
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// This test case makes sure that we get correct type descriptions for the enum
+// discriminant of different instantiations of the same generic enum type where,
+// dependending on the generic type parameter(s), the discriminant has a
+// different size in memory.
+
+enum Enum<T> {
+    Variant1(T),
+    Variant2(T)
+}
+
+fn main() {
+    // These are ordered for descending size on purpose
+    let eight_bytes1 = Enum::Variant1(100.0f64);
+    let four_bytes1 = Enum::Variant1(101i32);
+    let two_bytes1 = Enum::Variant1(102i16);
+    let one_byte1 = Enum::Variant1(65u8);
+
+    let eight_bytes2 = Enum::Variant2(100.0f64);
+    let four_bytes2 = Enum::Variant2(101i32);
+    let two_bytes2 = Enum::Variant2(102i16);
+    let one_byte2 = Enum::Variant2(65u8);
+
+    zzz(); // #break
+}
+
+fn zzz() { () }
index 1fc05b3752f04126b23fef8707aa46317b546150..988ec4a65f1e2a8e041d82f3727bd92daafd1885 100644 (file)
 // ignore-lldb: FIXME(#27089)
 // min-lldb-version: 310
 
+// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
+// min-system-llvm-version: 7.0
+// min-gdb-version: 8.2
+
 // compile-flags:-g
 
 // === GDB TESTS ===================================================================================
 // gdb-command:run
 
 // gdb-command:print eight_bytes1
-// gdbg-check:$1 = {{RUST$ENUM$DISR = Variant1, __0 = 100}, {RUST$ENUM$DISR = Variant1, __0 = 100}}
-// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum::Variant1(100)
+// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant1(100)
 
 // gdb-command:print four_bytes1
-// gdbg-check:$2 = {{RUST$ENUM$DISR = Variant1, __0 = 101}, {RUST$ENUM$DISR = Variant1, __0 = 101}}
-// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum::Variant1(101)
+// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant1(101)
 
 // gdb-command:print two_bytes1
-// gdbg-check:$3 = {{RUST$ENUM$DISR = Variant1, __0 = 102}, {RUST$ENUM$DISR = Variant1, __0 = 102}}
-// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum::Variant1(102)
+// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant1(102)
 
 // gdb-command:print one_byte1
-// gdbg-check:$4 = {{RUST$ENUM$DISR = Variant1, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant1, __0 = 65 'A'}}
-// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum::Variant1(65)
+// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant1(65)
 
 
 // gdb-command:print eight_bytes2
-// gdbg-check:$5 = {{RUST$ENUM$DISR = Variant2, __0 = 100}, {RUST$ENUM$DISR = Variant2, __0 = 100}}
-// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum::Variant2(100)
+// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant2(100)
 
 // gdb-command:print four_bytes2
-// gdbg-check:$6 = {{RUST$ENUM$DISR = Variant2, __0 = 101}, {RUST$ENUM$DISR = Variant2, __0 = 101}}
-// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum::Variant2(101)
+// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant2(101)
 
 // gdb-command:print two_bytes2
-// gdbg-check:$7 = {{RUST$ENUM$DISR = Variant2, __0 = 102}, {RUST$ENUM$DISR = Variant2, __0 = 102}}
-// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum::Variant2(102)
+// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant2(102)
 
 // gdb-command:print one_byte2
-// gdbg-check:$8 = {{RUST$ENUM$DISR = Variant2, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant2, __0 = 65 'A'}}
-// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum::Variant2(65)
+// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant2(65)
 
 // gdb-command:continue
 
diff --git a/src/test/debuginfo/generic-struct-style-enum-legacy.rs b/src/test/debuginfo/generic-struct-style-enum-legacy.rs
new file mode 100644 (file)
index 0000000..47c4ea7
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright 2013-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.
+
+// ignore-tidy-linelength
+// min-lldb-version: 310
+// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// As long as LLVM 5 and LLVM 6 are supported, we want to test the
+// enum debuginfo fallback mode.  Once those are desupported, this
+// test can be removed, as there is another (non-"legacy") test that
+// tests the new mode.
+// ignore-llvm-version: 7.0 - 9.9.9
+// ignore-gdb-version: 8.2 - 9.9
+
+// compile-flags:-g
+
+// gdb-command:set print union on
+// gdb-command:run
+
+// gdb-command:print case1
+// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
+// gdbr-check:$1 = generic_struct_style_enum_legacy::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
+
+// gdb-command:print case2
+// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, a = 0, b = 286331153, c = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
+// gdbr-check:$2 = generic_struct_style_enum_legacy::Regular::Case2{a: 0, b: 286331153, c: 286331153}
+
+// gdb-command:print case3
+// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, a = 0, b = 6438275382588823897}}
+// gdbr-check:$3 = generic_struct_style_enum_legacy::Regular::Case3{a: 0, b: 6438275382588823897}
+
+// gdb-command:print univariant
+// gdbg-check:$4 = {{a = -1}}
+// gdbr-check:$4 = generic_struct_style_enum_legacy::Univariant<i32>::TheOnlyCase{a: -1}
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Regular::{Case1, Case2, Case3};
+use self::Univariant::TheOnlyCase;
+
+// NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be
+// substituted with something of size `xx` bits and the same alignment as an integer type of the
+// same size.
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular<T16, T32, T64> {
+    Case1 { a: T64, b: T16, c: T16, d: T16, e: T16},
+    Case2 { a: T64, b: T32, c: T32},
+    Case3 { a: T64, b: T64 }
+}
+
+enum Univariant<T> {
+    TheOnlyCase { a: T }
+}
+
+fn main() {
+
+    // In order to avoid endianness trouble all of the following test values consist of a single
+    // repeated byte. This way each interpretation of the union should look the same, no matter if
+    // this is a big or little endian machine.
+
+    // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+    // 0b01111100011111000111110001111100 = 2088533116
+    // 0b0111110001111100 = 31868
+    // 0b01111100 = 124
+    let case1: Regular<u16, u32, i64> = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 };
+
+    // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+    // 0b00010001000100010001000100010001 = 286331153
+    // 0b0001000100010001 = 4369
+    // 0b00010001 = 17
+    let case2: Regular<i16, u32, i64>  = Case2 { a: 0, b: 286331153, c: 286331153 };
+
+    // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+    // 0b01011001010110010101100101011001 = 1499027801
+    // 0b0101100101011001 = 22873
+    // 0b01011001 = 89
+    let case3: Regular<u16, i32, u64>  = Case3 { a: 0, b: 6438275382588823897 };
+
+    let univariant = TheOnlyCase { a: -1 };
+
+    zzz(); // #break
+}
+
+fn zzz() {()}
index 4a1d14ccf6118c862f540777a3b4e49186356226..e08cde03c477b92aa3a91e6dcfeef993d79fc0a5 100644 (file)
 
 // ignore-tidy-linelength
 // min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
+// min-system-llvm-version: 7.0
+// min-gdb-version: 8.2
 
 // compile-flags:-g
 
 // gdb-command:run
 
 // gdb-command:print case1
-// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
-// gdbr-check:$1 = generic_struct_style_enum::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
+// gdbr-check:$1 = generic_struct_style_enum::Regular<u16, u32, i64>::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
 
 // gdb-command:print case2
-// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, a = 0, b = 286331153, c = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
-// gdbr-check:$2 = generic_struct_style_enum::Regular::Case2{a: 0, b: 286331153, c: 286331153}
+// gdbr-check:$2 = generic_struct_style_enum::Regular<i16, u32, i64>::Case2{a: 0, b: 286331153, c: 286331153}
 
 // gdb-command:print case3
-// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, a = 0, b = 6438275382588823897}}
-// gdbr-check:$3 = generic_struct_style_enum::Regular::Case3{a: 0, b: 6438275382588823897}
+// gdbr-check:$3 = generic_struct_style_enum::Regular<u16, i32, u64>::Case3{a: 0, b: 6438275382588823897}
 
 // gdb-command:print univariant
-// gdbg-check:$4 = {{a = -1}}
 // gdbr-check:$4 = generic_struct_style_enum::Univariant<i32>::TheOnlyCase{a: -1}
 
 
diff --git a/src/test/debuginfo/generic-tuple-style-enum-legacy.rs b/src/test/debuginfo/generic-tuple-style-enum-legacy.rs
new file mode 100644 (file)
index 0000000..ee28968
--- /dev/null
@@ -0,0 +1,118 @@
+// Copyright 2013-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.
+
+// ignore-tidy-linelength
+// min-lldb-version: 310
+// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// As long as LLVM 5 and LLVM 6 are supported, we want to test the
+// enum debuginfo fallback mode.  Once those are desupported, this
+// test can be removed, as there is another (non-"legacy") test that
+// tests the new mode.
+// ignore-llvm-version: 7.0 - 9.9.9
+// ignore-gdb-version: 8.2 - 9.9
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:set print union on
+// gdb-command:run
+
+// gdb-command:print case1
+// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = 31868, __2 = 31868, __3 = 31868, __4 = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
+// gdbr-check:$1 = generic_tuple_style_enum_legacy::Regular::Case1(0, 31868, 31868, 31868, 31868)
+
+// gdb-command:print case2
+// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 286331153, __2 = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
+// gdbr-check:$2 = generic_tuple_style_enum_legacy::Regular::Case2(0, 286331153, 286331153)
+
+// gdb-command:print case3
+// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, __0 = 0, __1 = 6438275382588823897}}
+// gdbr-check:$3 = generic_tuple_style_enum_legacy::Regular::Case3(0, 6438275382588823897)
+
+// gdb-command:print univariant
+// gdbg-check:$4 = {{__0 = -1}}
+// gdbr-check:$4 = generic_tuple_style_enum_legacy::Univariant<i64>::TheOnlyCase(-1)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print case1
+// lldbg-check:[...]$0 = Case1(0, 31868, 31868, 31868, 31868)
+// lldbr-check:(generic_tuple_style_enum_legacy::Regular<u16, u32, u64>::Case1) case1 = { = 0 = 31868 = 31868 = 31868 = 31868 }
+
+// lldb-command:print case2
+// lldbg-check:[...]$1 = Case2(0, 286331153, 286331153)
+// lldbr-check:(generic_tuple_style_enum_legacy::Regular<i16, i32, i64>::Case2) case2 = Regular<i16, i32, i64>::Case2 { generic_tuple_style_enum_legacy::Regular<i16, i32, i64>::Case1: 0, generic_tuple_style_enum_legacy::Regular<i16, i32, i64>::Case2: 286331153, generic_tuple_style_enum_legacy::Regular<i16, i32, i64>::Case3: 286331153 }
+
+// lldb-command:print case3
+// lldbg-check:[...]$2 = Case3(0, 6438275382588823897)
+// lldbr-check:(generic_tuple_style_enum_legacy::Regular<i16, i32, i64>::Case3) case3 = Regular<i16, i32, i64>::Case3 { generic_tuple_style_enum_legacy::Regular<i16, i32, i64>::Case1: 0, generic_tuple_style_enum_legacy::Regular<i16, i32, i64>::Case2: 6438275382588823897 }
+
+// lldb-command:print univariant
+// lldbg-check:[...]$3 = TheOnlyCase(-1)
+// lldbr-check:(generic_tuple_style_enum_legacy::Univariant<i64>) univariant = { generic_tuple_style_enum_legacy::TheOnlyCase = { = -1 } }
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Regular::{Case1, Case2, Case3};
+use self::Univariant::TheOnlyCase;
+
+// NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be
+// substituted with something of size `xx` bits and the same alignment as an integer type of the
+// same size.
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular<T16, T32, T64> {
+    Case1(T64, T16, T16, T16, T16),
+    Case2(T64, T32, T32),
+    Case3(T64, T64)
+}
+
+enum Univariant<T64> {
+    TheOnlyCase(T64)
+}
+
+fn main() {
+
+    // In order to avoid endianness trouble all of the following test values consist of a single
+    // repeated byte. This way each interpretation of the union should look the same, no matter if
+    // this is a big or little endian machine.
+
+    // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+    // 0b01111100011111000111110001111100 = 2088533116
+    // 0b0111110001111100 = 31868
+    // 0b01111100 = 124
+    let case1: Regular<u16, u32, u64> = Case1(0_u64, 31868_u16, 31868_u16, 31868_u16, 31868_u16);
+
+    // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+    // 0b00010001000100010001000100010001 = 286331153
+    // 0b0001000100010001 = 4369
+    // 0b00010001 = 17
+    let case2: Regular<i16, i32, i64> = Case2(0_i64, 286331153_i32, 286331153_i32);
+
+    // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+    // 0b01011001010110010101100101011001 = 1499027801
+    // 0b0101100101011001 = 22873
+    // 0b01011001 = 89
+    let case3: Regular<i16, i32, i64> = Case3(0_i64, 6438275382588823897_i64);
+
+    let univariant = TheOnlyCase(-1_i64);
+
+    zzz(); // #break
+}
+
+fn zzz() { () }
index 62bec28a022af0ab397827956926f5a7edd28fb9..ebd43daf46479f7ecf363d3ef2a0bc245bd99b77 100644 (file)
@@ -9,8 +9,12 @@
 // except according to those terms.
 
 // ignore-tidy-linelength
-// min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// Require LLVM with DW_TAG_variant_part and a gdb and lldb that can
+// read it.
+// min-system-llvm-version: 7.0
+// min-gdb-version: 8.2
+// rust-lldb
 
 // compile-flags:-g
 
 // gdb-command:run
 
 // gdb-command:print case1
-// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = 31868, __2 = 31868, __3 = 31868, __4 = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
-// gdbr-check:$1 = generic_tuple_style_enum::Regular::Case1(0, 31868, 31868, 31868, 31868)
+// gdbr-check:$1 = generic_tuple_style_enum::Regular<u16, u32, u64>::Case1(0, 31868, 31868, 31868, 31868)
 
 // gdb-command:print case2
-// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 286331153, __2 = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
-// gdbr-check:$2 = generic_tuple_style_enum::Regular::Case2(0, 286331153, 286331153)
+// gdbr-check:$2 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case2(0, 286331153, 286331153)
 
 // gdb-command:print case3
-// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, __0 = 0, __1 = 6438275382588823897}}
-// gdbr-check:$3 = generic_tuple_style_enum::Regular::Case3(0, 6438275382588823897)
+// gdbr-check:$3 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case3(0, 6438275382588823897)
 
 // gdb-command:print univariant
-// gdbg-check:$4 = {{__0 = -1}}
 // gdbr-check:$4 = generic_tuple_style_enum::Univariant<i64>::TheOnlyCase(-1)
 
 
 // lldb-command:run
 
 // lldb-command:print case1
-// lldbg-check:[...]$0 = Case1(0, 31868, 31868, 31868, 31868)
 // lldbr-check:(generic_tuple_style_enum::Regular<u16, u32, u64>::Case1) case1 = { = 0 = 31868 = 31868 = 31868 = 31868 }
 
 // lldb-command:print case2
-// lldbg-check:[...]$1 = Case2(0, 286331153, 286331153)
-// lldbr-check:(generic_tuple_style_enum::Regular<i16, i32, i64>::Case2) case2 = Regular<i16, i32, i64>::Case2 { generic_tuple_style_enum::Regular<i16, i32, i64>::Case1: 0, generic_tuple_style_enum::Regular<i16, i32, i64>::Case2: 286331153, generic_tuple_style_enum::Regular<i16, i32, i64>::Case3: 286331153 }
+// lldbr-check:(generic_tuple_style_enum::Regular<i16, i32, i64>::Case2) case2 = Regular<i16, i32, i64>::Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 }
 
 // lldb-command:print case3
-// lldbg-check:[...]$2 = Case3(0, 6438275382588823897)
-// lldbr-check:(generic_tuple_style_enum::Regular<i16, i32, i64>::Case3) case3 = Regular<i16, i32, i64>::Case3 { generic_tuple_style_enum::Regular<i16, i32, i64>::Case1: 0, generic_tuple_style_enum::Regular<i16, i32, i64>::Case2: 6438275382588823897 }
+// lldbr-check:(generic_tuple_style_enum::Regular<i16, i32, i64>::Case3) case3 = Regular<i16, i32, i64>::Case3 { Case1: 0, Case2: 6438275382588823897 }
 
 // lldb-command:print univariant
-// lldbg-check:[...]$3 = TheOnlyCase(-1)
-// lldbr-check:(generic_tuple_style_enum::Univariant<i64>) univariant = { generic_tuple_style_enum::TheOnlyCase = { = -1 } }
+// lldbr-check:(generic_tuple_style_enum::Univariant<i64>) univariant = { TheOnlyCase = { = -1 } }
 
 #![feature(omit_gdb_pretty_printer_section)]
 #![omit_gdb_pretty_printer_section]
index cef7a1cbf1b569c5baedf2c2acc3085f426adeaf..ffd402ec9361043f476b206a9e7208f883a1c4e0 100644 (file)
@@ -74,7 +74,7 @@
 // STACK BY REF
 // lldb-command:print *self
 // lldbg-check:[...]$0 = TupleStruct(100, -100.5)
-// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { = 100 = -100.5 }
+// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = TupleStruct(100, -100.5)
 // lldb-command:print arg1
 // lldbg-check:[...]$1 = -1
 // lldbr-check:(isize) arg1 = -1
@@ -86,7 +86,7 @@
 // STACK BY VAL
 // lldb-command:print self
 // lldbg-check:[...]$3 = TupleStruct(100, -100.5)
-// lldbr-check:(method_on_tuple_struct::TupleStruct) self = { = 100 = -100.5 }
+// lldbr-check:(method_on_tuple_struct::TupleStruct) self = TupleStruct(100, -100.5)
 // lldb-command:print arg1
 // lldbg-check:[...]$4 = -3
 // lldbr-check:(isize) arg1 = -3
@@ -98,7 +98,7 @@
 // OWNED BY REF
 // lldb-command:print *self
 // lldbg-check:[...]$6 = TupleStruct(200, -200.5)
-// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { = 200 = -200.5 }
+// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = TupleStruct(200, -200.5)
 // lldb-command:print arg1
 // lldbg-check:[...]$7 = -5
 // lldbr-check:(isize) arg1 = -5
 // OWNED BY VAL
 // lldb-command:print self
 // lldbg-check:[...]$9 = TupleStruct(200, -200.5)
-// lldbr-check:(method_on_tuple_struct::TupleStruct) self = { = 200 = -200.5 }
+// lldbr-check:(method_on_tuple_struct::TupleStruct) self = TupleStruct(200, -200.5)
 // lldb-command:print arg1
 // lldbg-check:[...]$10 = -7
 // lldbr-check:(isize) arg1 = -7
 // OWNED MOVED
 // lldb-command:print *self
 // lldbg-check:[...]$12 = TupleStruct(200, -200.5)
-// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { = 200 = -200.5 }
+// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = TupleStruct(200, -200.5)
 // lldb-command:print arg1
 // lldbg-check:[...]$13 = -9
 // lldbr-check:(isize) arg1 = -9
index ab9c7e2dd2758a5d4dec1827be9c915f7fef0848..ab42b2eff99f858bffac19b006b2e23c015fa4ee 100644 (file)
 // ignore-lldb
 
 
+// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
+// gdb 8.2.0 crashes on this test case, see
+// https://sourceware.org/bugzilla/show_bug.cgi?id=23626
+// This will be fixed in the next release, which will be >= 8.2.1.
+// min-system-llvm-version: 7.0
+// min-gdb-version: 8.2.1
+
 // compile-flags:-g
 // gdb-command:run
 
 // gdb-command:print first
-// gdbg-check:$1 = {<No data fields>}
-// gdbr-check:$1 = <error reading variable>
+// gdbr-check:$1 = nil_enum::ANilEnum {<No data fields>}
 
 // gdb-command:print second
-// gdbg-check:$2 = {<No data fields>}
-// gdbr-check:$2 = <error reading variable>
+// gdbr-check:$2 = nil_enum::AnotherNilEnum {<No data fields>}
 
 #![allow(unused_variables)]
 #![feature(omit_gdb_pretty_printer_section)]
diff --git a/src/test/debuginfo/recursive-struct-legacy.rs b/src/test/debuginfo/recursive-struct-legacy.rs
new file mode 100644 (file)
index 0000000..ac407ce
--- /dev/null
@@ -0,0 +1,245 @@
+// Copyright 2013-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.
+
+// ignore-tidy-linelength
+// ignore-lldb
+
+// As long as LLVM 5 and LLVM 6 are supported, we want to test the
+// enum debuginfo fallback mode.  Once those are desupported, this
+// test can be removed, as there is another (non-"legacy") test that
+// tests the new mode.
+// ignore-llvm-version: 7.0 - 9.9.9
+// ignore-gdb-version: 7.11.90 - 7.12.9
+// ignore-gdb-version: 8.2 - 9.9
+
+// compile-flags:-g
+
+// gdb-command:run
+
+// gdb-command:print stack_unique.value
+// gdb-check:$1 = 0
+// gdbg-command:print stack_unique.next.RUST$ENCODED$ENUM$0$Empty.val->value
+// gdbr-command:print stack_unique.next.val.value
+// gdb-check:$2 = 1
+
+// gdbg-command:print unique_unique->value
+// gdbr-command:print unique_unique.value
+// gdb-check:$3 = 2
+// gdbg-command:print unique_unique->next.RUST$ENCODED$ENUM$0$Empty.val->value
+// gdbr-command:print unique_unique.next.val.value
+// gdb-check:$4 = 3
+
+// gdb-command:print vec_unique[0].value
+// gdb-check:$5 = 6.5
+// gdbg-command:print vec_unique[0].next.RUST$ENCODED$ENUM$0$Empty.val->value
+// gdbr-command:print vec_unique[0].next.val.value
+// gdb-check:$6 = 7.5
+
+// gdbg-command:print borrowed_unique->value
+// gdbr-command:print borrowed_unique.value
+// gdb-check:$7 = 8.5
+// gdbg-command:print borrowed_unique->next.RUST$ENCODED$ENUM$0$Empty.val->value
+// gdbr-command:print borrowed_unique.next.val.value
+// gdb-check:$8 = 9.5
+
+// LONG CYCLE
+// gdb-command:print long_cycle1.value
+// gdb-check:$9 = 20
+// gdbg-command:print long_cycle1.next->value
+// gdbr-command:print long_cycle1.next.value
+// gdb-check:$10 = 21
+// gdbg-command:print long_cycle1.next->next->value
+// gdbr-command:print long_cycle1.next.next.value
+// gdb-check:$11 = 22
+// gdbg-command:print long_cycle1.next->next->next->value
+// gdbr-command:print long_cycle1.next.next.next.value
+// gdb-check:$12 = 23
+
+// gdb-command:print long_cycle2.value
+// gdb-check:$13 = 24
+// gdbg-command:print long_cycle2.next->value
+// gdbr-command:print long_cycle2.next.value
+// gdb-check:$14 = 25
+// gdbg-command:print long_cycle2.next->next->value
+// gdbr-command:print long_cycle2.next.next.value
+// gdb-check:$15 = 26
+
+// gdb-command:print long_cycle3.value
+// gdb-check:$16 = 27
+// gdbg-command:print long_cycle3.next->value
+// gdbr-command:print long_cycle3.next.value
+// gdb-check:$17 = 28
+
+// gdb-command:print long_cycle4.value
+// gdb-check:$18 = 29.5
+
+// gdbg-command:print (*****long_cycle_w_anonymous_types).value
+// gdbr-command:print long_cycle_w_anonymous_types.value
+// gdb-check:$19 = 30
+
+// gdbg-command:print (*****((*****long_cycle_w_anonymous_types).next.RUST$ENCODED$ENUM$0$Empty.val)).value
+// gdbr-command:print long_cycle_w_anonymous_types.next.val.value
+// gdb-check:$20 = 31
+
+// gdb-command:continue
+
+#![allow(unused_variables)]
+#![feature(box_syntax)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Opt::{Empty, Val};
+
+enum Opt<T> {
+    Empty,
+    Val { val: T }
+}
+
+struct UniqueNode<T> {
+    next: Opt<Box<UniqueNode<T>>>,
+    value: T
+}
+
+struct LongCycle1<T> {
+    next: Box<LongCycle2<T>>,
+    value: T,
+}
+
+struct LongCycle2<T> {
+    next: Box<LongCycle3<T>>,
+    value: T,
+}
+
+struct LongCycle3<T> {
+    next: Box<LongCycle4<T>>,
+    value: T,
+}
+
+struct LongCycle4<T> {
+    next: Option<Box<LongCycle1<T>>>,
+    value: T,
+}
+
+struct LongCycleWithAnonymousTypes {
+    next: Opt<Box<Box<Box<Box<Box<LongCycleWithAnonymousTypes>>>>>>,
+    value: usize,
+}
+
+// This test case makes sure that recursive structs are properly described. The Node structs are
+// generic so that we can have a new type (that newly needs to be described) for the different
+// cases. The potential problem with recursive types is that the DI generation algorithm gets
+// trapped in an endless loop. To make sure, we actually test this in the different cases, we have
+// to operate on a new type each time, otherwise we would just hit the DI cache for all but the
+// first case.
+
+// The different cases below (stack_*, unique_*, box_*, etc) are set up so that the type description
+// algorithm will enter the type reference cycle that is created by a recursive definition from a
+// different context each time.
+
+// The "long cycle" cases are constructed to span a longer, indirect recursion cycle between types.
+// The different locals will cause the DI algorithm to enter the type reference cycle at different
+// points.
+
+fn main() {
+    let stack_unique: UniqueNode<u16> = UniqueNode {
+        next: Val {
+            val: box UniqueNode {
+                next: Empty,
+                value: 1,
+            }
+        },
+        value: 0,
+    };
+
+    let unique_unique: Box<UniqueNode<u32>> = box UniqueNode {
+        next: Val {
+            val: box UniqueNode {
+                next: Empty,
+                value: 3,
+            }
+        },
+        value: 2,
+    };
+
+    let vec_unique: [UniqueNode<f32>; 1] = [UniqueNode {
+        next: Val {
+            val: box UniqueNode {
+                next: Empty,
+                value: 7.5,
+            }
+        },
+        value: 6.5,
+    }];
+
+    let borrowed_unique: &UniqueNode<f64> = &UniqueNode {
+        next: Val {
+            val: box UniqueNode {
+                next: Empty,
+                value: 9.5,
+            }
+        },
+        value: 8.5,
+    };
+
+    // LONG CYCLE
+    let long_cycle1: LongCycle1<u16> = LongCycle1 {
+        next: box LongCycle2 {
+            next: box LongCycle3 {
+                next: box LongCycle4 {
+                    next: None,
+                    value: 23,
+                },
+                value: 22,
+            },
+            value: 21
+        },
+        value: 20
+    };
+
+    let long_cycle2: LongCycle2<u32> = LongCycle2 {
+        next: box LongCycle3 {
+            next: box LongCycle4 {
+                next: None,
+                value: 26,
+            },
+            value: 25,
+        },
+        value: 24
+    };
+
+    let long_cycle3: LongCycle3<u64> = LongCycle3 {
+        next: box LongCycle4 {
+            next: None,
+            value: 28,
+        },
+        value: 27,
+    };
+
+    let long_cycle4: LongCycle4<f32> = LongCycle4 {
+        next: None,
+        value: 29.5,
+    };
+
+    // It's important that LongCycleWithAnonymousTypes is encountered only at the end of the
+    // `box` chain.
+    let long_cycle_w_anonymous_types = box box box box box LongCycleWithAnonymousTypes {
+        next: Val {
+            val: box box box box box LongCycleWithAnonymousTypes {
+                next: Empty,
+                value: 31,
+            }
+        },
+        value: 30
+    };
+
+    zzz(); // #break
+}
+
+fn zzz() {()}
index 75c2feb480ede8f32d0aae9055d9a60a0890ac84..647f95197894e52546814dc5c961e383feccea70 100644 (file)
 
 // ignore-tidy-linelength
 // ignore-lldb
-// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
+// min-system-llvm-version: 7.0
+// min-gdb-version: 8.2
 
 // compile-flags:-g
 
 
 // gdb-command:print stack_unique.value
 // gdb-check:$1 = 0
-// gdbg-command:print stack_unique.next.RUST$ENCODED$ENUM$0$Empty.val->value
 // gdbr-command:print stack_unique.next.val.value
 // gdb-check:$2 = 1
 
-// gdbg-command:print unique_unique->value
 // gdbr-command:print unique_unique.value
 // gdb-check:$3 = 2
-// gdbg-command:print unique_unique->next.RUST$ENCODED$ENUM$0$Empty.val->value
 // gdbr-command:print unique_unique.next.val.value
 // gdb-check:$4 = 3
 
 // gdb-command:print vec_unique[0].value
 // gdb-check:$5 = 6.5
-// gdbg-command:print vec_unique[0].next.RUST$ENCODED$ENUM$0$Empty.val->value
 // gdbr-command:print vec_unique[0].next.val.value
 // gdb-check:$6 = 7.5
 
-// gdbg-command:print borrowed_unique->value
 // gdbr-command:print borrowed_unique.value
 // gdb-check:$7 = 8.5
-// gdbg-command:print borrowed_unique->next.RUST$ENCODED$ENUM$0$Empty.val->value
 // gdbr-command:print borrowed_unique.next.val.value
 // gdb-check:$8 = 9.5
 
 // LONG CYCLE
 // gdb-command:print long_cycle1.value
 // gdb-check:$9 = 20
-// gdbg-command:print long_cycle1.next->value
 // gdbr-command:print long_cycle1.next.value
 // gdb-check:$10 = 21
-// gdbg-command:print long_cycle1.next->next->value
 // gdbr-command:print long_cycle1.next.next.value
 // gdb-check:$11 = 22
-// gdbg-command:print long_cycle1.next->next->next->value
 // gdbr-command:print long_cycle1.next.next.next.value
 // gdb-check:$12 = 23
 
 // gdb-command:print long_cycle2.value
 // gdb-check:$13 = 24
-// gdbg-command:print long_cycle2.next->value
 // gdbr-command:print long_cycle2.next.value
 // gdb-check:$14 = 25
-// gdbg-command:print long_cycle2.next->next->value
 // gdbr-command:print long_cycle2.next.next.value
 // gdb-check:$15 = 26
 
 // gdb-command:print long_cycle3.value
 // gdb-check:$16 = 27
-// gdbg-command:print long_cycle3.next->value
 // gdbr-command:print long_cycle3.next.value
 // gdb-check:$17 = 28
 
 // gdb-command:print long_cycle4.value
 // gdb-check:$18 = 29.5
 
-// gdbg-command:print (*****long_cycle_w_anonymous_types).value
 // gdbr-command:print long_cycle_w_anonymous_types.value
 // gdb-check:$19 = 30
 
-// gdbg-command:print (*****((*****long_cycle_w_anonymous_types).next.RUST$ENCODED$ENUM$0$Empty.val)).value
 // gdbr-command:print long_cycle_w_anonymous_types.next.val.value
 // gdb-check:$20 = 31
 
diff --git a/src/test/debuginfo/struct-style-enum-legacy.rs b/src/test/debuginfo/struct-style-enum-legacy.rs
new file mode 100644 (file)
index 0000000..fd2c6fa
--- /dev/null
@@ -0,0 +1,115 @@
+// Copyright 2013-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.
+
+// ignore-tidy-linelength
+// min-lldb-version: 310
+
+// As long as LLVM 5 and LLVM 6 are supported, we want to test the
+// enum debuginfo fallback mode.  Once those are desupported, this
+// test can be removed, as there is another (non-"legacy") test that
+// tests the new mode.
+// ignore-llvm-version: 7.0 - 9.9.9
+// ignore-gdb-version: 7.11.90 - 7.12.9
+// ignore-gdb-version: 8.2 - 9.9
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:set print union on
+// gdb-command:run
+
+// gdb-command:print case1
+// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
+// gdbr-check:$1 = struct_style_enum_legacy::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
+
+// gdb-command:print case2
+// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, a = 0, b = 286331153, c = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
+// gdbr-check:$2 = struct_style_enum_legacy::Regular::Case2{a: 0, b: 286331153, c: 286331153}
+
+// gdb-command:print case3
+// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, a = 0, b = 6438275382588823897}}
+// gdbr-check:$3 = struct_style_enum_legacy::Regular::Case3{a: 0, b: 6438275382588823897}
+
+// gdb-command:print univariant
+// gdbg-check:$4 = {{a = -1}}
+// gdbr-check:$4 = struct_style_enum_legacy::Univariant::TheOnlyCase{a: -1}
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print case1
+// lldbg-check:[...]$0 = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 }
+// lldbr-check:(struct_style_enum_legacy::Regular::Case1) case1 = { a = 0 b = 31868 c = 31868 d = 31868 e = 31868 }
+
+// lldb-command:print case2
+// lldbg-check:[...]$1 = Case2 { a: 0, b: 286331153, c: 286331153 }
+// lldbr-check:(struct_style_enum_legacy::Regular::Case2) case2 = Case2 { struct_style_enum_legacy::Regular::Case1: 0, struct_style_enum_legacy::Regular::Case2: 286331153, struct_style_enum_legacy::Regular::Case3: 286331153 }
+
+// lldb-command:print case3
+// lldbg-check:[...]$2 = Case3 { a: 0, b: 6438275382588823897 }
+// lldbr-check:(struct_style_enum_legacy::Regular::Case3) case3 = Case3 { struct_style_enum_legacy::Regular::Case1: 0, struct_style_enum_legacy::Regular::Case2: 6438275382588823897 }
+
+// lldb-command:print univariant
+// lldbg-check:[...]$3 = TheOnlyCase { a: -1 }
+// lldbr-check:(struct_style_enum_legacy::Univariant) univariant = Univariant { struct_style_enum_legacy::TheOnlyCase: TheOnlyCase { a: -1 } }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Regular::{Case1, Case2, Case3};
+use self::Univariant::TheOnlyCase;
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular {
+    Case1 { a: u64, b: u16, c: u16, d: u16, e: u16},
+    Case2 { a: u64, b: u32, c: u32},
+    Case3 { a: u64, b: u64 }
+}
+
+enum Univariant {
+    TheOnlyCase { a: i64 }
+}
+
+fn main() {
+
+    // In order to avoid endianness trouble all of the following test values consist of a single
+    // repeated byte. This way each interpretation of the union should look the same, no matter if
+    // this is a big or little endian machine.
+
+    // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+    // 0b01111100011111000111110001111100 = 2088533116
+    // 0b0111110001111100 = 31868
+    // 0b01111100 = 124
+    let case1 = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 };
+
+    // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+    // 0b00010001000100010001000100010001 = 286331153
+    // 0b0001000100010001 = 4369
+    // 0b00010001 = 17
+    let case2 = Case2 { a: 0, b: 286331153, c: 286331153 };
+
+    // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+    // 0b01011001010110010101100101011001 = 1499027801
+    // 0b0101100101011001 = 22873
+    // 0b01011001 = 89
+    let case3 = Case3 { a: 0, b: 6438275382588823897 };
+
+    let univariant = TheOnlyCase { a: -1 };
+
+    zzz(); // #break
+}
+
+fn zzz() {()}
index 36cd85fb4dc6503945c48f94bd5ad0026ad917fd..722ca00e0488908a64c70e6bdeb8c0f2b6d18f6f 100644 (file)
@@ -9,8 +9,12 @@
 // except according to those terms.
 
 // ignore-tidy-linelength
-// min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// Require LLVM with DW_TAG_variant_part and a gdb and lldb that can
+// read it.
+// min-system-llvm-version: 7.0
+// min-gdb-version: 8.2
+// rust-lldb
 
 // compile-flags:-g
 
 // gdb-command:run
 
 // gdb-command:print case1
-// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
 // gdbr-check:$1 = struct_style_enum::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
 
 // gdb-command:print case2
-// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, a = 0, b = 286331153, c = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
 // gdbr-check:$2 = struct_style_enum::Regular::Case2{a: 0, b: 286331153, c: 286331153}
 
 // gdb-command:print case3
-// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, a = 0, b = 6438275382588823897}}
 // gdbr-check:$3 = struct_style_enum::Regular::Case3{a: 0, b: 6438275382588823897}
 
 // gdb-command:print univariant
-// gdbg-check:$4 = {{a = -1}}
 // gdbr-check:$4 = struct_style_enum::Univariant::TheOnlyCase{a: -1}
 
 
 // lldb-command:run
 
 // lldb-command:print case1
-// lldbg-check:[...]$0 = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 }
 // lldbr-check:(struct_style_enum::Regular::Case1) case1 = { a = 0 b = 31868 c = 31868 d = 31868 e = 31868 }
 
 // lldb-command:print case2
-// lldbg-check:[...]$1 = Case2 { a: 0, b: 286331153, c: 286331153 }
-// lldbr-check:(struct_style_enum::Regular::Case2) case2 = Case2 { struct_style_enum::Regular::Case1: 0, struct_style_enum::Regular::Case2: 286331153, struct_style_enum::Regular::Case3: 286331153 }
+// lldbr-check:(struct_style_enum::Regular::Case2) case2 = Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 }
 
 // lldb-command:print case3
-// lldbg-check:[...]$2 = Case3 { a: 0, b: 6438275382588823897 }
-// lldbr-check:(struct_style_enum::Regular::Case3) case3 = Case3 { struct_style_enum::Regular::Case1: 0, struct_style_enum::Regular::Case2: 6438275382588823897 }
+// lldbr-check:(struct_style_enum::Regular::Case3) case3 = Case3 { Case1: 0, Case2: 6438275382588823897 }
 
 // lldb-command:print univariant
-// lldbg-check:[...]$3 = TheOnlyCase { a: -1 }
-// lldbr-check:(struct_style_enum::Univariant) univariant = Univariant { struct_style_enum::TheOnlyCase: TheOnlyCase { a: -1 } }
+// lldbr-check:(struct_style_enum::Univariant) univariant = Univariant { TheOnlyCase: TheOnlyCase { a: -1 } }
 
 #![allow(unused_variables)]
 #![feature(omit_gdb_pretty_printer_section)]
diff --git a/src/test/debuginfo/tuple-style-enum-legacy.rs b/src/test/debuginfo/tuple-style-enum-legacy.rs
new file mode 100644 (file)
index 0000000..e33f6db
--- /dev/null
@@ -0,0 +1,115 @@
+// Copyright 2013-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.
+
+// ignore-tidy-linelength
+// min-lldb-version: 310
+
+// As long as LLVM 5 and LLVM 6 are supported, we want to test the
+// enum debuginfo fallback mode.  Once those are desupported, this
+// test can be removed, as there is another (non-"legacy") test that
+// tests the new mode.
+// ignore-llvm-version: 7.0 - 9.9.9
+// ignore-gdb-version: 7.11.90 - 7.12.9
+// ignore-gdb-version: 8.2 - 9.9
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:set print union on
+// gdb-command:run
+
+// gdb-command:print case1
+// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = 31868, __2 = 31868, __3 = 31868, __4 = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
+// gdbr-check:$1 = tuple_style_enum_legacy::Regular::Case1(0, 31868, 31868, 31868, 31868)
+
+// gdb-command:print case2
+// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 286331153, __2 = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
+// gdbr-check:$2 = tuple_style_enum_legacy::Regular::Case2(0, 286331153, 286331153)
+
+// gdb-command:print case3
+// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, __0 = 0, __1 = 6438275382588823897}}
+// gdbr-check:$3 = tuple_style_enum_legacy::Regular::Case3(0, 6438275382588823897)
+
+// gdb-command:print univariant
+// gdbg-check:$4 = {{__0 = -1}}
+// gdbr-check:$4 = tuple_style_enum_legacy::Univariant::TheOnlyCase(-1)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print case1
+// lldbg-check:[...]$0 = Case1(0, 31868, 31868, 31868, 31868)
+// lldbr-check:(tuple_style_enum_legacy::Regular::Case1) case1 = { = 0 = 31868 = 31868 = 31868 = 31868 }
+
+// lldb-command:print case2
+// lldbg-check:[...]$1 = Case2(0, 286331153, 286331153)
+// lldbr-check:(tuple_style_enum_legacy::Regular::Case2) case2 = Case2 { tuple_style_enum_legacy::Regular::Case1: 0, tuple_style_enum_legacy::Regular::Case2: 286331153, tuple_style_enum_legacy::Regular::Case3: 286331153 }
+
+// lldb-command:print case3
+// lldbg-check:[...]$2 = Case3(0, 6438275382588823897)
+// lldbr-check:(tuple_style_enum_legacy::Regular::Case3) case3 = Case3 { tuple_style_enum_legacy::Regular::Case1: 0, tuple_style_enum_legacy::Regular::Case2: 6438275382588823897 }
+
+// lldb-command:print univariant
+// lldbg-check:[...]$3 = TheOnlyCase(-1)
+// lldbr-check:(tuple_style_enum_legacy::Univariant) univariant = { tuple_style_enum_legacy::TheOnlyCase = { = -1 } }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Regular::{Case1, Case2, Case3};
+use self::Univariant::TheOnlyCase;
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular {
+    Case1(u64, u16, u16, u16, u16),
+    Case2(u64, u32, u32),
+    Case3(u64, u64)
+}
+
+enum Univariant {
+    TheOnlyCase(i64)
+}
+
+fn main() {
+
+    // In order to avoid endianness trouble all of the following test values consist of a single
+    // repeated byte. This way each interpretation of the union should look the same, no matter if
+    // this is a big or little endian machine.
+
+    // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+    // 0b01111100011111000111110001111100 = 2088533116
+    // 0b0111110001111100 = 31868
+    // 0b01111100 = 124
+    let case1 = Case1(0, 31868, 31868, 31868, 31868);
+
+    // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+    // 0b00010001000100010001000100010001 = 286331153
+    // 0b0001000100010001 = 4369
+    // 0b00010001 = 17
+    let case2 = Case2(0, 286331153, 286331153);
+
+    // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+    // 0b01011001010110010101100101011001 = 1499027801
+    // 0b0101100101011001 = 22873
+    // 0b01011001 = 89
+    let case3 = Case3(0, 6438275382588823897);
+
+    let univariant = TheOnlyCase(-1);
+
+    zzz(); // #break
+}
+
+fn zzz() {()}
index 682e74601b0a11b7f15f2a3357ec22e175dd8c66..d976839f08c1135ae740d977c34f18a1787d5ea6 100644 (file)
@@ -9,8 +9,12 @@
 // except according to those terms.
 
 // ignore-tidy-linelength
-// min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// Require LLVM with DW_TAG_variant_part and a gdb and lldb that can
+// read it.
+// min-system-llvm-version: 7.0
+// min-gdb-version: 8.2
+// rust-lldb
 
 // compile-flags:-g
 
 // gdb-command:run
 
 // gdb-command:print case1
-// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = 31868, __2 = 31868, __3 = 31868, __4 = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
 // gdbr-check:$1 = tuple_style_enum::Regular::Case1(0, 31868, 31868, 31868, 31868)
 
 // gdb-command:print case2
-// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 286331153, __2 = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
 // gdbr-check:$2 = tuple_style_enum::Regular::Case2(0, 286331153, 286331153)
 
 // gdb-command:print case3
-// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, __0 = 0, __1 = 6438275382588823897}}
 // gdbr-check:$3 = tuple_style_enum::Regular::Case3(0, 6438275382588823897)
 
 // gdb-command:print univariant
-// gdbg-check:$4 = {{__0 = -1}}
 // gdbr-check:$4 = tuple_style_enum::Univariant::TheOnlyCase(-1)
 
 
 // lldb-command:run
 
 // lldb-command:print case1
-// lldbg-check:[...]$0 = Case1(0, 31868, 31868, 31868, 31868)
 // lldbr-check:(tuple_style_enum::Regular::Case1) case1 = { = 0 = 31868 = 31868 = 31868 = 31868 }
 
 // lldb-command:print case2
-// lldbg-check:[...]$1 = Case2(0, 286331153, 286331153)
-// lldbr-check:(tuple_style_enum::Regular::Case2) case2 = Case2 { tuple_style_enum::Regular::Case1: 0, tuple_style_enum::Regular::Case2: 286331153, tuple_style_enum::Regular::Case3: 286331153 }
+// lldbr-check:(tuple_style_enum::Regular::Case2) case2 = Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 }
 
 // lldb-command:print case3
-// lldbg-check:[...]$2 = Case3(0, 6438275382588823897)
-// lldbr-check:(tuple_style_enum::Regular::Case3) case3 = Case3 { tuple_style_enum::Regular::Case1: 0, tuple_style_enum::Regular::Case2: 6438275382588823897 }
+// lldbr-check:(tuple_style_enum::Regular::Case3) case3 = Case3 { Case1: 0, Case2: 6438275382588823897 }
 
 // lldb-command:print univariant
-// lldbg-check:[...]$3 = TheOnlyCase(-1)
-// lldbr-check:(tuple_style_enum::Univariant) univariant = { tuple_style_enum::TheOnlyCase = { = -1 } }
+// lldbr-check:(tuple_style_enum::Univariant) univariant = { TheOnlyCase = { = -1 } }
 
 #![allow(unused_variables)]
 #![feature(omit_gdb_pretty_printer_section)]
diff --git a/src/test/debuginfo/unique-enum-legacy.rs b/src/test/debuginfo/unique-enum-legacy.rs
new file mode 100644 (file)
index 0000000..91fece3
--- /dev/null
@@ -0,0 +1,98 @@
+// Copyright 2013-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.
+
+// ignore-tidy-linelength
+// min-lldb-version: 310
+
+// As long as LLVM 5 and LLVM 6 are supported, we want to test the
+// enum debuginfo fallback mode.  Once those are desupported, this
+// test can be removed, as there is another (non-"legacy") test that
+// tests the new mode.
+// ignore-llvm-version: 7.0 - 9.9.9
+// ignore-gdb-version: 7.11.90 - 7.12.9
+// ignore-gdb-version: 8.2 - 9.9
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *the_a
+// gdbg-check:$1 = {{RUST$ENUM$DISR = TheA, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = TheA, [...]}}
+// gdbr-check:$1 = unique_enum_legacy::ABC::TheA{x: 0, y: 8970181431921507452}
+
+// gdb-command:print *the_b
+// gdbg-check:$2 = {{RUST$ENUM$DISR = TheB, [...]}, {RUST$ENUM$DISR = TheB, __0 = 0, __1 = 286331153, __2 = 286331153}}
+// gdbr-check:$2 = unique_enum_legacy::ABC::TheB(0, 286331153, 286331153)
+
+// gdb-command:print *univariant
+// gdbg-check:$3 = {{__0 = 123234}}
+// gdbr-check:$3 = unique_enum_legacy::Univariant::TheOnlyCase(123234)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print *the_a
+// lldbg-check:[...]$0 = TheA { x: 0, y: 8970181431921507452 }
+// lldbr-check:(unique_enum_legacy::ABC::TheA) *the_a = TheA { unique_enum_legacy::ABC::TheA: 0, unique_enum_legacy::ABC::TheB: 8970181431921507452 }
+
+// lldb-command:print *the_b
+// lldbg-check:[...]$1 = TheB(0, 286331153, 286331153)
+// lldbr-check:(unique_enum_legacy::ABC::TheB) *the_b = { = 0 = 286331153 = 286331153 }
+
+// lldb-command:print *univariant
+// lldbg-check:[...]$2 = TheOnlyCase(123234)
+// lldbr-check:(unique_enum_legacy::Univariant) *univariant = { unique_enum_legacy::TheOnlyCase = { = 123234 } }
+
+#![allow(unused_variables)]
+#![feature(box_syntax)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum ABC {
+    TheA { x: i64, y: i64 },
+    TheB (i64, i32, i32),
+}
+
+// This is a special case since it does not have the implicit discriminant field.
+enum Univariant {
+    TheOnlyCase(i64)
+}
+
+fn main() {
+
+    // In order to avoid endianness trouble all of the following test values consist of a single
+    // repeated byte. This way each interpretation of the union should look the same, no matter if
+    // this is a big or little endian machine.
+
+    // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+    // 0b01111100011111000111110001111100 = 2088533116
+    // 0b0111110001111100 = 31868
+    // 0b01111100 = 124
+    let the_a: Box<_> = box ABC::TheA { x: 0, y: 8970181431921507452 };
+
+    // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+    // 0b00010001000100010001000100010001 = 286331153
+    // 0b0001000100010001 = 4369
+    // 0b00010001 = 17
+    let the_b: Box<_> = box ABC::TheB (0, 286331153, 286331153);
+
+    let univariant: Box<_> = box Univariant::TheOnlyCase(123234);
+
+    zzz(); // #break
+}
+
+fn zzz() {()}
index 6b62c304513944ea0ea0f7abd220493c0258d084..aab8edc55f74c108c2c07db5f4745165e5df27d2 100644 (file)
@@ -9,8 +9,12 @@
 // except according to those terms.
 
 // ignore-tidy-linelength
-// min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// Require LLVM with DW_TAG_variant_part and a gdb and lldb that can
+// read it.
+// min-system-llvm-version: 7.0
+// min-gdb-version: 8.2
+// rust-lldb
 
 // compile-flags:-g
 
 // gdb-command:run
 
 // gdb-command:print *the_a
-// gdbg-check:$1 = {{RUST$ENUM$DISR = TheA, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = TheA, [...]}}
 // gdbr-check:$1 = unique_enum::ABC::TheA{x: 0, y: 8970181431921507452}
 
 // gdb-command:print *the_b
-// gdbg-check:$2 = {{RUST$ENUM$DISR = TheB, [...]}, {RUST$ENUM$DISR = TheB, __0 = 0, __1 = 286331153, __2 = 286331153}}
 // gdbr-check:$2 = unique_enum::ABC::TheB(0, 286331153, 286331153)
 
 // gdb-command:print *univariant
-// gdbg-check:$3 = {{__0 = 123234}}
 // gdbr-check:$3 = unique_enum::Univariant::TheOnlyCase(123234)
 
 
 // lldb-command:run
 
 // lldb-command:print *the_a
-// lldbg-check:[...]$0 = TheA { x: 0, y: 8970181431921507452 }
-// lldbr-check:(unique_enum::ABC::TheA) *the_a = TheA { unique_enum::ABC::TheA: 0, unique_enum::ABC::TheB: 8970181431921507452 }
+// lldbr-check:(unique_enum::ABC::TheA) *the_a = TheA { TheA: 0, TheB: 8970181431921507452 }
 
 // lldb-command:print *the_b
-// lldbg-check:[...]$1 = TheB(0, 286331153, 286331153)
 // lldbr-check:(unique_enum::ABC::TheB) *the_b = { = 0 = 286331153 = 286331153 }
 
 // lldb-command:print *univariant
-// lldbg-check:[...]$2 = TheOnlyCase(123234)
-// lldbr-check:(unique_enum::Univariant) *univariant = { unique_enum::TheOnlyCase = { = 123234 } }
+// lldbr-check:(unique_enum::Univariant) *univariant = { TheOnlyCase = { = 123234 } }
 
 #![allow(unused_variables)]
 #![feature(box_syntax)]
index 39bf0c175ebcb7ea41eb7401ee965b3d42888f5a..39267edaac04566b535657a5ec1920928b7a881f 100644 (file)
@@ -99,7 +99,7 @@
 
 // lldb-command:print padded_tuple
 // lldbg-check:[...]$4 = &[(6, 7), (8, 9)]
-// lldbr-check:(&[(i32, i16)]) padded_tuple = { data_ptr = *0x555555554ff0 length = 2 }
+// lldbr-check:(&[(i32, i16)]) padded_tuple = { data_ptr = *0x555555555030 length = 2 }
 
 // lldb-command:print padded_struct
 // lldbg-check:[...]$5 = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }]
index b37533d2da76337c6eb1bdccd2c47341aef82870..dd26cf78fdabeea6f1110b9e601132ee32f54d0b 100644 (file)
@@ -23,8 +23,8 @@ pub fn exported_generic<T>(x: T, y: u32) -> (T, u32) {
     // The AST node for the (1 + y) expression generated by the macro will then
     // take it's `lo` span bound from the `1` literal in the macro-defining file
     // and it's `hi` bound from `y` in this file, which should be lower than the
-    // `lo` and even lower than the lower bound of the FileMap it is supposedly
-    // contained in because the FileMap for this file was allocated earlier than
-    // the FileMap of the macro-defining file.
+    // `lo` and even lower than the lower bound of the SourceFile it is supposedly
+    // contained in because the SourceFile for this file was allocated earlier than
+    // the SourceFile of the macro-defining file.
     return (x, add1!(y));
 }
diff --git a/src/test/run-pass/issue-55376.rs b/src/test/run-pass/issue-55376.rs
new file mode 100644 (file)
index 0000000..9c7256f
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2018 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.
+
+// Tests that paths in `pub(...)` don't fail HIR verification.
+
+#![allow(unused_imports)]
+#![allow(dead_code)]
+
+pub(self) use self::my_mod::Foo;
+
+mod my_mod {
+    pub(super) use self::Foo as Bar;
+    pub(in super::my_mod) use self::Foo as Baz;
+
+    pub struct Foo;
+}
+
+fn main() {}
index 3366f0639caa5cadfe22e00ad1f276c29affa313..b9de60f43f703f72c82096ffa92e995bea3c211d 100644 (file)
@@ -13,18 +13,6 @@ note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not im
 LL |         match *s { sty(v) => v } //~ ERROR cannot move out
    |                        ^
 
-error[E0507]: cannot move out of `s.0` which is behind a `&` reference
-  --> $DIR/access-mode-in-closures.rs:19:24
-   |
-LL |     let _foo = unpack(|s| {
-   |                        - help: consider changing this to be a mutable reference: `&mut sty`
-LL |         // Test that `s` is moved here.
-LL |         match *s { sty(v) => v } //~ ERROR cannot move out
-   |                        ^
-   |                        |
-   |                        cannot move out of `s.0` which is behind a `&` reference
-   |                        `s` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 94676f0e5ad77e0f76ac6a702d6dbbbdd1565312..545a60f6770d9471d24ffd0230fc4c8c0de8c17a 100644 (file)
@@ -32,18 +32,6 @@ error[E0507]: cannot move out of borrowed content
 LL |     *n;  //~ ERROR: cannot move out of borrowed content
    |     ^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of `*n` which is behind a `&` reference
-  --> $DIR/binop-move-semantics.rs:42:5
-   |
-LL |     let n = &y;
-   |             -- help: consider changing this to be a mutable reference: `&mut y`
-...
-LL |     *n;  //~ ERROR: cannot move out of borrowed content
-   |     ^^
-   |     |
-   |     cannot move out of `*n` which is behind a `&` reference
-   |     `n` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
   --> $DIR/binop-move-semantics.rs:64:5
    |
@@ -74,7 +62,7 @@ LL | |     &mut f;  //~ ERROR: cannot borrow `f` as mutable because it is also b
    |       |    immutable borrow later used here
    |       mutable borrow occurs here
 
-error: aborting due to 7 previous errors
+error: aborting due to 6 previous errors
 
 Some errors occurred: E0382, E0502, E0507.
 For more information about an error, try `rustc --explain E0382`.
index 771ef88a662b1ebfcc3af54028f5032b0874d6af..231ae53fe82bf97484dfbf112c1372e557d6b38a 100644 (file)
@@ -40,19 +40,15 @@ LL |     let c2 = || set(x); //~ ERROR two closures require unique access to `x`
 LL |     c1;
    |     -- first borrow later used here
 
-warning[E0594]: cannot assign to `x`, as it is not declared as mutable
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
   --> $DIR/borrowck-closures-unique.rs:57:38
    |
 LL | fn e(x: &'static mut isize) {
    |      - help: consider changing this to be mutable: `mut x`
 LL |     let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument
    |                                      ^^^^^ cannot assign
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
 Some errors occurred: E0500, E0524, E0594.
 For more information about an error, try `rustc --explain E0500`.
index 88ae73b6368e7162d3ce9aa58ef1bad2e2503804..c3aba793f190e617191eaf215608c30deac7d85f 100644 (file)
@@ -20,7 +20,7 @@ LL |                    //[mir]~^ ERROR cannot borrow `x` as mutable more than o
 LL |                    *y = 1;
    |                    ------ first borrow later used here
 
-warning: captured variable cannot escape `FnMut` closure body
+error: captured variable cannot escape `FnMut` closure body
   --> $DIR/borrowck-describe-lvalue.rs:305:16
    |
 LL |              || {
@@ -36,9 +36,6 @@ LL | |                 }
    |
    = note: `FnMut` closures only have access to their captured variables while they are executing...
    = note: ...therefore, they cannot allow references to captured variables to escape
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
 error[E0503]: cannot use `f.x` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:53:9
@@ -382,7 +379,7 @@ LL |                 drop(x); //[ast]~ ERROR use of moved value: `x`
    |
    = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
 
-error: aborting due to 29 previous errors
+error: aborting due to 30 previous errors
 
 Some errors occurred: E0382, E0499, E0502, E0503.
 For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr
deleted file mode 100644 (file)
index b171a48..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/borrowck-fn-in-const-a.rs:19:16
-   |
-LL |         return *x //[ast]~ ERROR cannot move out of borrowed content [E0507]
-   |                ^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of `*x` which is behind a `&` reference
-  --> $DIR/borrowck-fn-in-const-a.rs:19:16
-   |
-LL |     fn broken(x: &String) -> String {
-   |                  ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |         return *x //[ast]~ ERROR cannot move out of borrowed content [E0507]
-   |                ^^
-   |                |
-   |                cannot move out of `*x` which is behind a `&` reference
-   |                `x` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index 0ab3d3ea5cdfea15c158258e48501d7fcb9860c7..25eb69ad9377dfe21b260a35ad50463847956d75 100644 (file)
@@ -1,13 +1,3 @@
-error[E0507]: cannot move out of `*__next` which is behind a `&` reference
-  --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10
-   |
-LL |     for &a in x.iter() {    //~ ERROR cannot move out
-   |         -^
-   |         ||
-   |         |cannot move out of `*__next` which is behind a `&` reference
-   |         |`__next` is a `&` reference, so the data it refers to cannot be moved
-   |         help: consider changing this to be a mutable reference: `&mut a`
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15
    |
@@ -23,16 +13,6 @@ note: move occurs because `a` has type `&mut i32`, which does not implement the
 LL |     for &a in x.iter() {    //~ ERROR cannot move out
    |          ^
 
-error[E0507]: cannot move out of `*__next` which is behind a `&` reference
-  --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:10
-   |
-LL |     for &a in &f.a {  //~ ERROR cannot move out
-   |         -^
-   |         ||
-   |         |cannot move out of `*__next` which is behind a `&` reference
-   |         |`__next` is a `&` reference, so the data it refers to cannot be moved
-   |         help: consider changing this to be a mutable reference: `&mut a`
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:15
    |
@@ -48,16 +28,6 @@ note: move occurs because `a` has type `std::boxed::Box<isize>`, which does not
 LL |     for &a in &f.a {  //~ ERROR cannot move out
    |          ^
 
-error[E0507]: cannot move out of `*__next` which is behind a `&` reference
-  --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:10
-   |
-LL |     for &a in x.iter() {    //~ ERROR cannot move out
-   |         -^
-   |         ||
-   |         |cannot move out of `*__next` which is behind a `&` reference
-   |         |`__next` is a `&` reference, so the data it refers to cannot be moved
-   |         help: consider changing this to be a mutable reference: `&mut a`
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:15
    |
@@ -73,6 +43,6 @@ note: move occurs because `a` has type `std::boxed::Box<i32>`, which does not im
 LL |     for &a in x.iter() {    //~ ERROR cannot move out
    |          ^
 
-error: aborting due to 6 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
index ba42dc2436377c3792f917f890c39e9ea9c8f43c..45fa1764f7027230af918979f7648d00e8a418cb 100644 (file)
@@ -6,21 +6,6 @@ LL |     let x = Box::new(0);
 LL |     Box::new(|| x) //~ ERROR cannot move out of captured outer variable
    |                 ^ cannot move out of captured variable in an `Fn` closure
 
-error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure
-  --> $DIR/borrowck-in-static.rs:15:17
-   |
-LL |     Box::new(|| x) //~ ERROR cannot move out of captured outer variable
-   |                 ^
-   |                 |
-   |                 cannot move out of `x`, as it is a captured variable in a `Fn` closure
-   |                 cannot move
-   |
-help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/borrowck-in-static.rs:15:14
-   |
-LL |     Box::new(|| x) //~ ERROR cannot move out of captured outer variable
-   |              ^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 0445a75d61a9daccd504a45e061d9b685cd022e2..cdbfab8bd054a1903c2d53ce953bc577d7f9faeb 100644 (file)
@@ -7,17 +7,6 @@ LL |         let _b = *y; //~ ERROR cannot move out
    |                  cannot move out of borrowed content
    |                  help: consider removing the `*`: `y`
 
-error[E0507]: cannot move out of `*y` which is behind a `&` reference
-  --> $DIR/borrowck-issue-2657-2.rs:17:18
-   |
-LL |       Some(ref y) => {
-   |            ----- help: consider changing this to be a mutable reference: `ref mut y`
-LL |         let _b = *y; //~ ERROR cannot move out
-   |                  ^^
-   |                  |
-   |                  cannot move out of `*y` which is behind a `&` reference
-   |                  `y` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index f5a9db364065fab0b5da3b2f8589ec7f3e92f155..e7dbc6f6e3ba04ab0ebed1a372805711cd37ed82 100644 (file)
@@ -8,17 +8,3 @@ LL |                 (|| { let bar = foo; bar.take() })();
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.
 
-warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
-  --> $DIR/borrowck-migrate-to-nll.rs:35:17
-   |
-LL |                 (|| { let bar = foo; bar.take() })();
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |                 |
-   |                 cannot move out of `foo`, as it is immutable for the pattern guard
-   |                 cannot move
-   |
-   = note: variables bound in patterns are immutable until the end of the pattern guard
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
-
index f5a9db364065fab0b5da3b2f8589ec7f3e92f155..e7dbc6f6e3ba04ab0ebed1a372805711cd37ed82 100644 (file)
@@ -8,17 +8,3 @@ LL |                 (|| { let bar = foo; bar.take() })();
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.
 
-warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
-  --> $DIR/borrowck-migrate-to-nll.rs:35:17
-   |
-LL |                 (|| { let bar = foo; bar.take() })();
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |                 |
-   |                 cannot move out of `foo`, as it is immutable for the pattern guard
-   |                 cannot move
-   |
-   = note: variables bound in patterns are immutable until the end of the pattern guard
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
-
index 99f69515a473210c326fbecd5b78c74fb2bd89db..2df520a936c9d4a9975563d5eb6221917fda2853 100644 (file)
@@ -24,42 +24,6 @@ LL |                   num2) => (),
 LL |         Foo::Foo2(num) => (),
    |                   ^^^
 
-error[E0507]: cannot move out of `f.0` which is behind a `&` reference
-  --> $DIR/borrowck-move-error-with-note.rs:23:19
-   |
-LL |     let f = &Foo::Foo1(box 1, box 2);
-   |             ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)`
-...
-LL |         Foo::Foo1(num1,
-   |                   ^^^^
-   |                   |
-   |                   cannot move out of `f.0` which is behind a `&` reference
-   |                   `f` is a `&` reference, so the data it refers to cannot be moved
-
-error[E0507]: cannot move out of `f.1` which is behind a `&` reference
-  --> $DIR/borrowck-move-error-with-note.rs:24:19
-   |
-LL |     let f = &Foo::Foo1(box 1, box 2);
-   |             ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)`
-...
-LL |                   num2) => (),
-   |                   ^^^^
-   |                   |
-   |                   cannot move out of `f.1` which is behind a `&` reference
-   |                   `f` is a `&` reference, so the data it refers to cannot be moved
-
-error[E0507]: cannot move out of `f.0` which is behind a `&` reference
-  --> $DIR/borrowck-move-error-with-note.rs:25:19
-   |
-LL |     let f = &Foo::Foo1(box 1, box 2);
-   |             ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)`
-...
-LL |         Foo::Foo2(num) => (),
-   |                   ^^^
-   |                   |
-   |                   cannot move out of `f.0` which is behind a `&` reference
-   |                   `f` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
   --> $DIR/borrowck-move-error-with-note.rs:39:11
    |
@@ -97,19 +61,7 @@ note: move occurs because `n` has type `std::boxed::Box<isize>`, which does not
 LL |         n => {
    |         ^
 
-error[E0507]: cannot move out of `a.a` which is behind a `&` reference
-  --> $DIR/borrowck-move-error-with-note.rs:59:9
-   |
-LL |     let a = &A { a: box 1 };
-   |             --------------- help: consider changing this to be a mutable reference: `&mut A { a: box 1 }`
-...
-LL |         n => {
-   |         ^
-   |         |
-   |         cannot move out of `a.a` which is behind a `&` reference
-   |         `a` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 7 previous errors
+error: aborting due to 3 previous errors
 
 Some errors occurred: E0507, E0509.
 For more information about an error, try `rustc --explain E0507`.
index 83c5b82957deaf85738174d3342fb31a68430c59..c3a2180b9f082e062f9afab0ede465a7511ac8f3 100644 (file)
@@ -7,17 +7,6 @@ LL |     let y = *x; //~ ERROR cannot move out of dereference of raw pointer
    |             cannot move out of dereference of raw pointer
    |             help: consider removing the `*`: `x`
 
-error[E0507]: cannot move out of `*x` which is behind a `*const` pointer
-  --> $DIR/borrowck-move-from-unsafe-ptr.rs:13:13
-   |
-LL | unsafe fn foo(x: *const Box<isize>) -> Box<isize> {
-   |                  ----------------- help: consider changing this to be a mutable pointer: `*mut std::boxed::Box<isize>`
-LL |     let y = *x; //~ ERROR cannot move out of dereference of raw pointer
-   |             ^^
-   |             |
-   |             cannot move out of `*x` which is behind a `*const` pointer
-   |             `x` is a `*const` pointer, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index f22aca9994986846585b8b30d3244e6b04df796d..49c2ec0dcf4e7c996e77b3f918f482664288f74f 100644 (file)
@@ -14,15 +14,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im
 LL | fn arg_item(&_x: &String) {}
    |              ^^
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-move-in-irrefut-pat.rs:16:14
-   |
-LL | fn arg_item(&_x: &String) {}
-   |              ^^
-   |              |
-   |              cannot move out of data in a `&` reference
-   |              cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/borrowck-move-in-irrefut-pat.rs:21:11
    |
@@ -39,24 +30,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im
 LL |     with(|&_x| ())
    |            ^^
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-move-in-irrefut-pat.rs:21:12
-   |
-LL |     with(|&_x| ())
-   |            ^^
-   |            |
-   |            cannot move out of data in a `&` reference
-   |            cannot move
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-move-in-irrefut-pat.rs:27:10
-   |
-LL |     let &_x = &"hi".to_string();
-   |          ^^
-   |          |
-   |          cannot move out of data in a `&` reference
-   |          cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/borrowck-move-in-irrefut-pat.rs:27:15
    |
@@ -72,6 +45,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im
 LL |     let &_x = &"hi".to_string();
    |          ^^
 
-error: aborting due to 6 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
index ba74cd2514e1a244d84191c517ab4f681b80f959..d58beabb3038af551493e03d3d7a35312c100b9f 100644 (file)
@@ -4,15 +4,6 @@ error[E0507]: cannot move out of an `Rc`
 LL |     let _x = Rc::new(vec![1, 2]).into_iter();
    |              ^^^^^^^^^^^^^^^^^^^ cannot move out of an `Rc`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:17:14
-   |
-LL |     let _x = Rc::new(vec![1, 2]).into_iter();
-   |              ^^^^^^^^^^^^^^^^^^^
-   |              |
-   |              cannot move out of data in a `&` reference
-   |              cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 205044bb368851166a9d571ad260566b62d9908a..c9c8cf104ce2e769fa4aa36749ce6b14f9c1894f 100644 (file)
@@ -7,15 +7,6 @@ LL |     let _x = *Rc::new("hi".to_string());
    |              cannot move out of an `Rc`
    |              help: consider removing the `*`: `Rc::new("hi".to_string())`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-move-out-of-overloaded-deref.rs:14:14
-   |
-LL |     let _x = *Rc::new("hi".to_string());
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |              |
-   |              cannot move out of data in a `&` reference
-   |              cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr
deleted file mode 100644 (file)
index 675458d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0507]: cannot move out of static item
-  --> $DIR/borrowck-move-out-of-static-item.rs:28:10
-   |
-LL |     test(BAR); //[ast]~ ERROR cannot move out of static item [E0507]
-   |          ^^^ cannot move out of static item
-
-error[E0507]: cannot move out of immutable static item `BAR`
-  --> $DIR/borrowck-move-out-of-static-item.rs:28:10
-   |
-LL |     test(BAR); //[ast]~ ERROR cannot move out of static item [E0507]
-   |          ^^^
-   |          |
-   |          cannot move out of immutable static item `BAR`
-   |          cannot move
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index dea42c53992b19bdabae96a6dd490d9f88c06a41..f3430ba4e06c9038310a8f087594447e8b89dbce 100644 (file)
@@ -26,31 +26,6 @@ LL |                 //~| to prevent move
 LL |                   Foo { string: b }] => {
    |
 
-error[E0507]: cannot move out of `tail[..].string` which is behind a `&` reference
-  --> $DIR/borrowck-move-out-of-vec-tail.rs:30:33
-   |
-LL |         [_, ref tail..] => {
-   |             -------- help: consider changing this to be a mutable reference: `ref mut tail`
-LL |             match tail {
-LL |                 &[Foo { string: a },
-   |                                 ^
-   |                                 |
-   |                                 cannot move out of `tail[..].string` which is behind a `&` reference
-   |                                 `tail` is a `&` reference, so the data it refers to cannot be moved
-
-error[E0507]: cannot move out of `tail[..].string` which is behind a `&` reference
-  --> $DIR/borrowck-move-out-of-vec-tail.rs:34:33
-   |
-LL |         [_, ref tail..] => {
-   |             -------- help: consider changing this to be a mutable reference: `ref mut tail`
-...
-LL |                   Foo { string: b }] => {
-   |                                 ^
-   |                                 |
-   |                                 cannot move out of `tail[..].string` which is behind a `&` reference
-   |                                 `tail` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 3 previous errors
+error: aborting due to previous error
 
-Some errors occurred: E0507, E0508.
-For more information about an error, try `rustc --explain E0507`.
+For more information about this error, try `rustc --explain E0508`.
index 05fd6d71520c76c52a2b7b4c9839faa8fe8cd310..92e10c258c269efbd9cca6855d1dcd0e351bf573 100644 (file)
@@ -7,15 +7,6 @@ LL |     let bad = v[0];
    |               cannot move out of borrowed content
    |               help: consider borrowing here: `&v[0]`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-overloaded-index-move-from-vec.rs:30:15
-   |
-LL |     let bad = v[0];
-   |               ^^^^
-   |               |
-   |               cannot move out of data in a `&` reference
-   |               cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index ee7e3e71962e8b38784b6e22332c2a1f5161370b..d4340938eebc14880e7b4409021344c26f733c86 100644 (file)
@@ -13,15 +13,6 @@ note: move occurs because `s` has type `std::string::String`, which does not imp
 LL |     let opt = a.iter().enumerate().find(|(_, &s)| {
    |                                               ^
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-51415.rs:16:47
-   |
-LL |     let opt = a.iter().enumerate().find(|(_, &s)| {
-   |                                               ^
-   |                                               |
-   |                                               cannot move out of data in a `&` reference
-   |                                               cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr
new file mode 100644 (file)
index 0000000..3180823
--- /dev/null
@@ -0,0 +1,55 @@
+error[E0595]: closure cannot assign to immutable argument `x`
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:22
+   |
+LL |         let mut c1 = |y: &'static mut isize| x = y;
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably
+help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
+   |
+LL |         x
+   |
+
+error[E0595]: closure cannot assign to immutable argument `x`
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:29:22
+   |
+LL |         let mut c1 = |z: &'static mut isize| {
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably
+help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
+   |
+LL |         x
+   |
+
+error[E0595]: closure cannot assign to immutable argument `x`
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:9
+   |
+LL |     pub fn capture_assign_whole(x: (i32,)) {
+   |                                 - help: make this binding mutable: `mut x`
+LL |         || { x = (1,); };
+   |         ^^ cannot borrow mutably
+
+error[E0595]: closure cannot assign to immutable argument `x`
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:9
+   |
+LL |     pub fn capture_assign_part(x: (i32,)) {
+   |                                - help: make this binding mutable: `mut x`
+LL |         || { x.0 = 1; };
+   |         ^^ cannot borrow mutably
+
+error[E0595]: closure cannot assign to immutable argument `x`
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:9
+   |
+LL |     pub fn capture_reborrow_whole(x: (i32,)) {
+   |                                   - help: make this binding mutable: `mut x`
+LL |         || { &mut x; };
+   |         ^^ cannot borrow mutably
+
+error[E0595]: closure cannot assign to immutable argument `x`
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:9
+   |
+LL |     pub fn capture_reborrow_part(x: (i32,)) {
+   |                                  - help: make this binding mutable: `mut x`
+LL |         || { &mut x.0; };
+   |         ^^ cannot borrow mutably
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0595`.
diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr
new file mode 100644 (file)
index 0000000..0ccddf0
--- /dev/null
@@ -0,0 +1,54 @@
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:46
+   |
+LL |     pub fn e(x: &'static mut isize) {
+   |              - help: consider changing this to be mutable: `mut x`
+LL |         static mut Y: isize = 3;
+LL |         let mut c1 = |y: &'static mut isize| x = y;
+   |                                              ^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50
+   |
+LL |     pub fn ee(x: &'static mut isize) {
+   |               - help: consider changing this to be mutable: `mut x`
+...
+LL |             let mut c2 = |y: &'static mut isize| x = y;
+   |                                                  ^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14
+   |
+LL |     pub fn capture_assign_whole(x: (i32,)) {
+   |                                 - help: consider changing this to be mutable: `mut x`
+LL |         || { x = (1,); };
+   |              ^^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14
+   |
+LL |     pub fn capture_assign_part(x: (i32,)) {
+   |                                - help: consider changing this to be mutable: `mut x`
+LL |         || { x.0 = 1; };
+   |              ^^^^^^^ cannot assign
+
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14
+   |
+LL |     pub fn capture_reborrow_whole(x: (i32,)) {
+   |                                   - help: consider changing this to be mutable: `mut x`
+LL |         || { &mut x; };
+   |              ^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14
+   |
+LL |     pub fn capture_reborrow_part(x: (i32,)) {
+   |                                  - help: consider changing this to be mutable: `mut x`
+LL |         || { &mut x.0; };
+   |              ^^^^^^^^ cannot borrow as mutable
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr
new file mode 100644 (file)
index 0000000..0ccddf0
--- /dev/null
@@ -0,0 +1,54 @@
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:46
+   |
+LL |     pub fn e(x: &'static mut isize) {
+   |              - help: consider changing this to be mutable: `mut x`
+LL |         static mut Y: isize = 3;
+LL |         let mut c1 = |y: &'static mut isize| x = y;
+   |                                              ^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50
+   |
+LL |     pub fn ee(x: &'static mut isize) {
+   |               - help: consider changing this to be mutable: `mut x`
+...
+LL |             let mut c2 = |y: &'static mut isize| x = y;
+   |                                                  ^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14
+   |
+LL |     pub fn capture_assign_whole(x: (i32,)) {
+   |                                 - help: consider changing this to be mutable: `mut x`
+LL |         || { x = (1,); };
+   |              ^^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14
+   |
+LL |     pub fn capture_assign_part(x: (i32,)) {
+   |                                - help: consider changing this to be mutable: `mut x`
+LL |         || { x.0 = 1; };
+   |              ^^^^^^^ cannot assign
+
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14
+   |
+LL |     pub fn capture_reborrow_whole(x: (i32,)) {
+   |                                   - help: consider changing this to be mutable: `mut x`
+LL |         || { &mut x; };
+   |              ^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
+  --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14
+   |
+LL |     pub fn capture_reborrow_part(x: (i32,)) {
+   |                                  - help: consider changing this to be mutable: `mut x`
+LL |         || { &mut x.0; };
+   |              ^^^^^^^^ cannot borrow as mutable
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs
new file mode 100644 (file)
index 0000000..25ad66a
--- /dev/null
@@ -0,0 +1,61 @@
+// rust-lang/rust#55492: errors detected during MIR-borrowck's
+// analysis of a closure body may only be caught when AST-borrowck
+// looks at some parent.
+
+// revisions: ast migrate nll
+
+// Since we are testing nll (and migration) explicitly as a separate
+// revisions, don't worry about the --compare-mode=nll on this test.
+
+// ignore-compare-mode-nll
+
+//[ast]compile-flags: -Z borrowck=ast
+//[migrate]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows
+
+
+// transcribed from borrowck-closures-unique.rs
+mod borrowck_closures_unique {
+    pub fn e(x: &'static mut isize) {
+        static mut Y: isize = 3;
+        let mut c1 = |y: &'static mut isize| x = y;
+        unsafe { c1(&mut Y); }
+    }
+}
+
+mod borrowck_closures_unique_grandparent {
+    pub fn ee(x: &'static mut isize) {
+        static mut Z: isize = 3;
+        let mut c1 = |z: &'static mut isize| {
+            let mut c2 = |y: &'static mut isize| x = y;
+            c2(z);
+        };
+        unsafe { c1(&mut Z); }
+    }
+}
+
+// adapted from mutability_errors.rs
+mod mutability_errors {
+    pub fn capture_assign_whole(x: (i32,)) {
+        || { x = (1,); };
+    }
+    pub fn capture_assign_part(x: (i32,)) {
+        || { x.0 = 1; };
+    }
+    pub fn capture_reborrow_whole(x: (i32,)) {
+        || { &mut x; };
+    }
+    pub fn capture_reborrow_part(x: (i32,)) {
+        || { &mut x.0; };
+    }
+}
+
+fn main() {
+    static mut X: isize = 2;
+    unsafe { borrowck_closures_unique::e(&mut X); }
+
+    mutability_errors::capture_assign_whole((1000,));
+    mutability_errors::capture_assign_part((2000,));
+    mutability_errors::capture_reborrow_whole((3000,));
+    mutability_errors::capture_reborrow_part((4000,));
+}
diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr
deleted file mode 100644 (file)
index d25fc75..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/move-in-static-initializer-issue-38520.rs:25:23
-   |
-LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507
-   |                       ^^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/move-in-static-initializer-issue-38520.rs:25:23
-   |
-LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507
-   |                       ^^^
-   |                       |
-   |                       cannot move out of data in a `&` reference
-   |                       cannot move
-
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/move-in-static-initializer-issue-38520.rs:27:22
-   |
-LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507
-   |                      ^^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/move-in-static-initializer-issue-38520.rs:27:22
-   |
-LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507
-   |                      ^^^
-   |                      |
-   |                      cannot move out of data in a `&` reference
-   |                      cannot move
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index bb45fe2da81174d5605bb85e3f81ef64346ff471..14c41bb81b2c65594af40320298f4e157a95e47b 100644 (file)
@@ -277,7 +277,7 @@ LL |     &mut x; //~ ERROR
 LL |     &mut x.0; //~ ERROR
    |     ^^^^^^^^ cannot borrow as mutable
 
-warning[E0594]: cannot assign to `x`, as it is not declared as mutable
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
   --> $DIR/mutability-errors.rs:70:9
    |
 LL | fn imm_capture(x: (i32,)) {
@@ -285,12 +285,8 @@ LL | fn imm_capture(x: (i32,)) {
 LL |     || { //~ ERROR
 LL |         x = (1,);
    |         ^^^^^^^^ cannot assign
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
-warning[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
   --> $DIR/mutability-errors.rs:71:9
    |
 LL | fn imm_capture(x: (i32,)) {
@@ -298,12 +294,8 @@ LL | fn imm_capture(x: (i32,)) {
 ...
 LL |         x.0 = 1;
    |         ^^^^^^^ cannot assign
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
-warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
   --> $DIR/mutability-errors.rs:72:9
    |
 LL | fn imm_capture(x: (i32,)) {
@@ -311,12 +303,8 @@ LL | fn imm_capture(x: (i32,)) {
 ...
 LL |         &mut x;
    |         ^^^^^^ cannot borrow as mutable
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
-warning[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
+error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
   --> $DIR/mutability-errors.rs:73:9
    |
 LL | fn imm_capture(x: (i32,)) {
@@ -324,10 +312,6 @@ LL | fn imm_capture(x: (i32,)) {
 ...
 LL |         &mut x.0;
    |         ^^^^^^^^ cannot borrow as mutable
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
 error[E0594]: cannot assign to `x`, as it is not declared as mutable
   --> $DIR/mutability-errors.rs:76:9
@@ -389,7 +373,7 @@ error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item
 LL |     &mut X.0; //~ ERROR
    |     ^^^^^^^^ cannot borrow as mutable
 
-error: aborting due to 34 previous errors
+error: aborting due to 38 previous errors
 
 Some errors occurred: E0594, E0596.
 For more information about an error, try `rustc --explain E0594`.
index 0844ac32b8b60a37edf562e5e167c22b23e3a31f..0eb5fc8c324356ad358fa2438ac9bb1c992834a0 100644 (file)
@@ -7,25 +7,6 @@ LL |     call(|| {
 LL |         y.into_iter();
    |         ^ cannot move out of captured variable in an `Fn` closure
 
-error[E0507]: cannot move out of `y`, as it is a captured variable in a `Fn` closure
-  --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9
-   |
-LL |         y.into_iter();
-   |         ^
-   |         |
-   |         cannot move out of `y`, as it is a captured variable in a `Fn` closure
-   |         cannot move
-   |
-help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:20:10
-   |
-LL |       call(|| {
-   |  __________^
-LL | |         y.into_iter();
-LL | |         //~^ ERROR cannot move out of captured outer variable in an `Fn` closure
-LL | |     });
-   | |_____^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 40987958115895deb46cf043e85040f6516de69d..491b5b5bd74abef53a40f7b6d0e963f9c0683bd5 100644 (file)
@@ -16,15 +16,6 @@ note: move occurs because `identifier` has type `std::string::String`, which doe
 LL |         &E::Bar(identifier) => f(identifier.clone())  //~ ERROR cannot move
    |                 ^^^^^^^^^^
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/by-move-pattern-binding.rs:26:17
-   |
-LL |         &E::Bar(identifier) => f(identifier.clone())  //~ ERROR cannot move
-   |                 ^^^^^^^^^^
-   |                 |
-   |                 cannot move out of data in a `&` reference
-   |                 cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 576322ff5c1953d2087d5d88f19bdb19b9c20574..5522e22fb1fa28089a33a6c8851a39b7b52cf70a 100644 (file)
@@ -58,22 +58,13 @@ LL |     let y = { static x: Box<isize> = box 3; x };
    |                                             cannot move out of static item
    |                                             help: consider borrowing here: `&x`
 
-error[E0507]: cannot move out of immutable static item `x`
-  --> $DIR/check-static-values-constraints.rs:120:45
-   |
-LL |     let y = { static x: Box<isize> = box 3; x };
-   |                                             ^
-   |                                             |
-   |                                             cannot move out of immutable static item `x`
-   |                                             cannot move
-
 error[E0010]: allocations are not allowed in statics
   --> $DIR/check-static-values-constraints.rs:120:38
    |
 LL |     let y = { static x: Box<isize> = box 3; x };
    |                                      ^^^^^ allocation not allowed in statics
 
-error: aborting due to 11 previous errors
+error: aborting due to 10 previous errors
 
 Some errors occurred: E0010, E0015, E0493, E0507.
 For more information about an error, try `rustc --explain E0010`.
diff --git a/src/test/ui/consts/const-eval/issue-49296.rs b/src/test/ui/consts/const-eval/issue-49296.rs
new file mode 100644 (file)
index 0000000..a7c3c53
--- /dev/null
@@ -0,0 +1,23 @@
+// issue-49296: Unsafe shenigans in constants can result in missing errors
+
+#![feature(const_fn)]
+#![feature(const_fn_union)]
+
+const unsafe fn transmute<T: Copy, U: Copy>(t: T) -> U {
+    union Transmute<T: Copy, U: Copy> {
+        from: T,
+        to: U,
+    }
+
+    Transmute { from: t }.to
+}
+
+const fn wat(x: u64) -> &'static u64 {
+    unsafe { transmute(&x) }
+}
+const X: u64 = *wat(42);
+//~^ ERROR any use of this value will cause an error
+
+fn main() {
+    println!("{}", X);
+}
diff --git a/src/test/ui/consts/const-eval/issue-49296.stderr b/src/test/ui/consts/const-eval/issue-49296.stderr
new file mode 100644 (file)
index 0000000..37462db
--- /dev/null
@@ -0,0 +1,12 @@
+error: any use of this value will cause an error
+  --> $DIR/issue-49296.rs:18:1
+   |
+LL | const X: u64 = *wat(42);
+   | ^^^^^^^^^^^^^^^--------^
+   |                |
+   |                dangling pointer was dereferenced
+   |
+   = note: #[deny(const_err)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/consts/const-validation-fail-55455.rs b/src/test/ui/consts/const-validation-fail-55455.rs
new file mode 100644 (file)
index 0000000..def4062
--- /dev/null
@@ -0,0 +1,9 @@
+// https://github.com/rust-lang/rust/issues/55454
+// compile-pass
+
+struct This<T>(T);
+
+const C: This<Option<&i32>> = This(Some(&1));
+
+fn main() {
+}
diff --git a/src/test/ui/consts/promoted-validation-55454.rs b/src/test/ui/consts/promoted-validation-55454.rs
new file mode 100644 (file)
index 0000000..5e193b1
--- /dev/null
@@ -0,0 +1,9 @@
+// https://github.com/rust-lang/rust/issues/55454
+// compile-pass
+
+#[derive(PartialEq)]
+struct This<T>(T);
+
+fn main() {
+    This(Some(&1)) == This(Some(&1));
+}
index d14760b707db2875b2a50e6b0391265912bfa661..0aa85d3ed7a3d36f248e6d25c10b99f68c55adbd 100644 (file)
@@ -16,31 +16,13 @@ error[E0507]: cannot move out of borrowed content
 LL |     S[0];
    |     ^^^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/dst-index.rs:41:5
-   |
-LL |     S[0];
-   |     ^^^^
-   |     |
-   |     cannot move out of data in a `&` reference
-   |     cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/dst-index.rs:44:5
    |
 LL |     T[0];
    |     ^^^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/dst-index.rs:44:5
-   |
-LL |     T[0];
-   |     ^^^^
-   |     |
-   |     cannot move out of data in a `&` reference
-   |     cannot move
-
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
 
 Some errors occurred: E0161, E0507.
 For more information about an error, try `rustc --explain E0161`.
index 537ece48e012c63eb9983500b0a6ac3f83b73dcc..b120da773a24a3448d80882dfaf46fa498d4be5d 100644 (file)
@@ -16,33 +16,13 @@ error[E0507]: cannot move out of borrowed content
 LL |     let _x: Box<str> = box *"hello world";
    |                            ^^^^^^^^^^^^^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/dst-rvalue.rs:16:28
-   |
-LL |     let _x: Box<str> = box *"hello world";
-   |                            ^^^^^^^^^^^^^^
-   |                            |
-   |                            cannot move out of data in a `&` reference
-   |                            cannot move
-
 error[E0508]: cannot move out of type `[isize]`, a non-copy slice
   --> $DIR/dst-rvalue.rs:21:32
    |
 LL |     let _x: Box<[isize]> = box *array;
    |                                ^^^^^^ cannot move out of here
 
-error[E0507]: cannot move out of `*array` which is behind a `&` reference
-  --> $DIR/dst-rvalue.rs:21:32
-   |
-LL |     let array: &[isize] = &[1, 2, 3];
-   |                           ---------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3]`
-LL |     let _x: Box<[isize]> = box *array;
-   |                                ^^^^^^
-   |                                |
-   |                                cannot move out of `*array` which is behind a `&` reference
-   |                                `array` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
 
 Some errors occurred: E0161, E0507, E0508.
 For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/ui/error-codes/E0507.nll.stderr b/src/test/ui/error-codes/E0507.nll.stderr
deleted file mode 100644 (file)
index 43795e5..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/E0507.rs:22:5
-   |
-LL |     x.borrow().nothing_is_true(); //~ ERROR E0507
-   |     ^^^^^^^^^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/E0507.rs:22:5
-   |
-LL |     x.borrow().nothing_is_true(); //~ ERROR E0507
-   |     ^^^^^^^^^^
-   |     |
-   |     cannot move out of data in a `&` reference
-   |     cannot move
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index bb844c4a69f22096775807aff91292c82f34764f..72d21d47d86fa765985da974e0b8b2664837d7fa 100644 (file)
@@ -40,43 +40,6 @@ LL |         (&[], &[hd, ..]) | (&[hd, ..], &[])
 LL |         (&[hd1, ..], &[hd2, ..])
    |            ^^^
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-12567.rs:16:17
-   |
-LL |         (&[], &[hd, ..]) | (&[hd, ..], &[])
-   |                 ^^
-   |                 |
-   |                 cannot move out of data in a `&` reference
-   |                 cannot move
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-12567.rs:16:31
-   |
-LL |         (&[], &[hd, ..]) | (&[hd, ..], &[])
-   |                               ^^
-   |                               |
-   |                               cannot move out of data in a `&` reference
-   |                               cannot move
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-12567.rs:20:12
-   |
-LL |         (&[hd1, ..], &[hd2, ..])
-   |            ^^^
-   |            |
-   |            cannot move out of data in a `&` reference
-   |            cannot move
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-12567.rs:20:24
-   |
-LL |         (&[hd1, ..], &[hd2, ..])
-   |                        ^^^
-   |                        |
-   |                        cannot move out of data in a `&` reference
-   |                        cannot move
-
-error: aborting due to 6 previous errors
+error: aborting due to 2 previous errors
 
-Some errors occurred: E0507, E0508.
-For more information about an error, try `rustc --explain E0507`.
+For more information about this error, try `rustc --explain E0508`.
index 66fba7749f4791544665507456c64fc834beb17a..f8da3c3d5989eceb45282da4c0f45502ba96354c 100644 (file)
@@ -7,15 +7,6 @@ LL |     let _a = FOO; //~ ERROR: cannot move out of static item
    |              cannot move out of static item
    |              help: consider borrowing here: `&FOO`
 
-error[E0507]: cannot move out of immutable static item `FOO`
-  --> $DIR/issue-17718-static-move.rs:16:14
-   |
-LL |     let _a = FOO; //~ ERROR: cannot move out of static item
-   |              ^^^
-   |              |
-   |              cannot move out of immutable static item `FOO`
-   |              cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 60e3056b8c4d4a15af495563f838ba8a2a895bcc..362778b26c861911d2624046c87cd15c65d575ea 100644 (file)
@@ -16,15 +16,6 @@ LL |     let b = unsafe { *imm_ref() };
    |                      cannot move out of borrowed content
    |                      help: consider removing the `*`: `imm_ref()`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-20801.rs:39:22
-   |
-LL |     let b = unsafe { *imm_ref() };
-   |                      ^^^^^^^^^^
-   |                      |
-   |                      cannot move out of data in a `&` reference
-   |                      cannot move
-
 error[E0507]: cannot move out of dereference of raw pointer
   --> $DIR/issue-20801.rs:42:22
    |
@@ -43,15 +34,6 @@ LL |     let d = unsafe { *const_ptr() };
    |                      cannot move out of dereference of raw pointer
    |                      help: consider removing the `*`: `const_ptr()`
 
-error[E0507]: cannot move out of data in a `*const` pointer
-  --> $DIR/issue-20801.rs:45:22
-   |
-LL |     let d = unsafe { *const_ptr() };
-   |                      ^^^^^^^^^^^^
-   |                      |
-   |                      cannot move out of data in a `*const` pointer
-   |                      cannot move
-
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
index ae726d26d072b80203d31f10cb28fc6eb1cd7b5e..fa2df26498a061dc0fa0ac12d94550dcb349c01f 100644 (file)
@@ -4,17 +4,6 @@ error[E0507]: cannot move out of borrowed content
 LL |         self.tokens //~ ERROR cannot move out of borrowed content
    |         ^^^^^^^^^^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of `self.tokens` which is behind a `&` reference
-  --> $DIR/issue-2590.rs:22:9
-   |
-LL |     fn parse(&self) -> Vec<isize> {
-   |              ----- help: consider changing this to be a mutable reference: `&mut self`
-LL |         self.tokens //~ ERROR cannot move out of borrowed content
-   |         ^^^^^^^^^^^
-   |         |
-   |         cannot move out of `self.tokens` which is behind a `&` reference
-   |         `self` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 78cf3661bb76338d365291dd99fe67944a4e8833..fdf8157dcf833918233aacc1107973455570d2df 100644 (file)
@@ -16,16 +16,7 @@ error[E0508]: cannot move out of type `[u8]`, a non-copy slice
 LL |     &X(*Y)
    |        ^^ cannot move out of here
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-30355.rs:15:8
-   |
-LL |     &X(*Y)
-   |        ^^
-   |        |
-   |        cannot move out of data in a `&` reference
-   |        cannot move
-
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
-Some errors occurred: E0161, E0507, E0508.
+Some errors occurred: E0161, E0508.
 For more information about an error, try `rustc --explain E0161`.
index 22fcffb9527a4b651c54fea1bb424bfdb2770301..9020d3778c3730820347651be4554a9b7d9c1f0b 100644 (file)
@@ -7,15 +7,6 @@ LL |     let e = f.v[0]; //~ ERROR cannot move out of indexed content
    |             cannot move out of borrowed content
    |             help: consider borrowing here: `&f.v[0]`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-40402-1.rs:19:13
-   |
-LL |     let e = f.v[0]; //~ ERROR cannot move out of indexed content
-   |             ^^^^^^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index cdb547ad10064f8b2734400d3d32c1f58d4705f2..a80e9a5fe091f70343247033078fb2881a09d61d 100644 (file)
@@ -1,21 +1,3 @@
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-40402-2.rs:15:10
-   |
-LL |     let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
-   |          ^
-   |          |
-   |          cannot move out of data in a `&` reference
-   |          cannot move
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-40402-2.rs:15:13
-   |
-LL |     let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
-   |             ^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/issue-40402-2.rs:15:18
    |
@@ -33,6 +15,6 @@ note: move occurs because these variables have types that don't implement the `C
 LL |     let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
    |          ^  ^
 
-error: aborting due to 3 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index beb853fc91ae504c96115018b02595406c2ee959..d31eddfa5b65deb908818dac6eee2ab8c0accbd9 100644 (file)
@@ -6,15 +6,6 @@ LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
 LL |     id(Box::new(|| *v))
    |                    ^^ cannot move out of captured variable in an `FnMut` closure
 
-error[E0507]: cannot move out of `*v` which is behind a `&` reference
-  --> $DIR/issue-4335.rs:16:20
-   |
-LL |     id(Box::new(|| *v))
-   |                    ^^
-   |                    |
-   |                    cannot move out of `*v` which is behind a `&` reference
-   |                    cannot move
-
 error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function
   --> $DIR/issue-4335.rs:16:17
    |
@@ -33,7 +24,7 @@ help: to force the closure to take ownership of `v` (and any other referenced va
 LL |     id(Box::new(move || *v))
    |                 ^^^^^^^
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
 Some errors occurred: E0373, E0507.
 For more information about an error, try `rustc --explain E0373`.
index 187e7f31dfd710331942a3711a2fc8a740801c40..9eda59614f45828074ccfdd1a2b30e6b2801b0b2 100644 (file)
@@ -23,4 +23,13 @@ fn main() {
     // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not
     // the malformed `1 / (2 + 3`
     let _a = (1 / (2 + 3));
+    f();
+}
+
+fn f() -> bool {
+    loop {
+        if (break { return true }) {
+        }
+    }
+    false
 }
index 1ded703fd5a2f0bc49f3dbaf832a07fbf91492a1..1f22ab148185296bbf3ca71abe0a75ca06630a3d 100644 (file)
@@ -16,18 +16,6 @@ note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not
 LL |                 box E::Bar(x) => println!("{}", x.to_string()),
    |                            ^
 
-error[E0507]: cannot move out of `hellothere.x.0` which is behind a `&` reference
-  --> $DIR/moves-based-on-type-block-bad.rs:37:28
-   |
-LL |         f(&s, |hellothere| {
-   |                ---------- help: consider changing this to be a mutable reference: `&mut S`
-...
-LL |                 box E::Bar(x) => println!("{}", x.to_string()),
-   |                            ^
-   |                            |
-   |                            cannot move out of `hellothere.x.0` which is behind a `&` reference
-   |                            `hellothere` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index a34a9efab6bce413f317a557d9da135e6b17c453..13a6fc15ce3185b7ebbbd5093d018c515fad9293 100644 (file)
@@ -6,21 +6,6 @@ LL |     let i = box 3;
 LL |     let _f = to_fn(|| test(i)); //~ ERROR cannot move out
    |                            ^ cannot move out of captured variable in an `Fn` closure
 
-error[E0507]: cannot move out of `i`, as it is a captured variable in a `Fn` closure
-  --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:28
-   |
-LL |     let _f = to_fn(|| test(i)); //~ ERROR cannot move out
-   |                            ^
-   |                            |
-   |                            cannot move out of `i`, as it is a captured variable in a `Fn` closure
-   |                            cannot move
-   |
-help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:20
-   |
-LL |     let _f = to_fn(|| test(i)); //~ ERROR cannot move out
-   |                    ^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 2d54ae0b81ec820c054aca57ec17a481432a9cea..6a4c8f2e8d81570161b7d251523acb9c6483235f 100644 (file)
@@ -7,17 +7,6 @@ LL |     let x = { *r }; //~ ERROR
    |               cannot move out of borrowed content
    |               help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:15:15
-   |
-LL | pub fn deref(r: &String) {
-   |                 ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |     let x = { *r }; //~ ERROR
-   |               ^^
-   |               |
-   |               cannot move out of `*r` which is behind a `&` reference
-   |               `r` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/cannot-move-block-spans.rs:16:22
    |
@@ -27,18 +16,6 @@ LL |     let y = unsafe { *r }; //~ ERROR
    |                      cannot move out of borrowed content
    |                      help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:16:22
-   |
-LL | pub fn deref(r: &String) {
-   |                 ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |     let x = { *r }; //~ ERROR
-LL |     let y = unsafe { *r }; //~ ERROR
-   |                      ^^
-   |                      |
-   |                      cannot move out of `*r` which is behind a `&` reference
-   |                      `r` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/cannot-move-block-spans.rs:17:26
    |
@@ -48,18 +25,6 @@ LL |     let z = loop { break *r; }; //~ ERROR
    |                          cannot move out of borrowed content
    |                          help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:17:26
-   |
-LL | pub fn deref(r: &String) {
-   |                 ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-...
-LL |     let z = loop { break *r; }; //~ ERROR
-   |                          ^^
-   |                          |
-   |                          cannot move out of `*r` which is behind a `&` reference
-   |                          `r` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
   --> $DIR/cannot-move-block-spans.rs:21:15
    |
@@ -96,17 +61,6 @@ LL |     let x = { let mut u = 0; u += 1; *r }; //~ ERROR
    |                                      cannot move out of borrowed content
    |                                      help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:27:38
-   |
-LL | pub fn additional_statement_cases(r: &String) {
-   |                                      ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |     let x = { let mut u = 0; u += 1; *r }; //~ ERROR
-   |                                      ^^
-   |                                      |
-   |                                      cannot move out of `*r` which is behind a `&` reference
-   |                                      `r` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/cannot-move-block-spans.rs:28:45
    |
@@ -116,18 +70,6 @@ LL |     let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR
    |                                             cannot move out of borrowed content
    |                                             help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:28:45
-   |
-LL | pub fn additional_statement_cases(r: &String) {
-   |                                      ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |     let x = { let mut u = 0; u += 1; *r }; //~ ERROR
-LL |     let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR
-   |                                             ^^
-   |                                             |
-   |                                             cannot move out of `*r` which is behind a `&` reference
-   |                                             `r` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/cannot-move-block-spans.rs:29:49
    |
@@ -137,19 +79,7 @@ LL |     let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR
    |                                                 cannot move out of borrowed content
    |                                                 help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:29:49
-   |
-LL | pub fn additional_statement_cases(r: &String) {
-   |                                      ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-...
-LL |     let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR
-   |                                                 ^^
-   |                                                 |
-   |                                                 cannot move out of `*r` which is behind a `&` reference
-   |                                                 `r` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 15 previous errors
+error: aborting due to 9 previous errors
 
 Some errors occurred: E0507, E0508.
 For more information about an error, try `rustc --explain E0507`.
index 4fe01d472f50edac8829c1d09a3e89ca5b654258..afb85c69990f9851fb3702ae4b689c8b52d78856 100644 (file)
@@ -8,20 +8,6 @@ LL |             (|| { let bar = foo; bar.take() })();
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.
 
-warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
-  --> $DIR/match-guards-always-borrow.rs:23:13
-   |
-LL |             (|| { let bar = foo; bar.take() })();
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |             |
-   |             cannot move out of `foo`, as it is immutable for the pattern guard
-   |             cannot move
-   |
-   = note: variables bound in patterns are immutable until the end of the pattern guard
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
-
 error: compilation successful
   --> $DIR/match-guards-always-borrow.rs:57:1
    |
diff --git a/src/test/ui/static/static-items-cant-move.nll.stderr b/src/test/ui/static/static-items-cant-move.nll.stderr
deleted file mode 100644 (file)
index 35a400b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0507]: cannot move out of static item
-  --> $DIR/static-items-cant-move.rs:28:10
-   |
-LL |     test(BAR); //~ ERROR cannot move out of static item
-   |          ^^^ cannot move out of static item
-
-error[E0507]: cannot move out of immutable static item `BAR`
-  --> $DIR/static-items-cant-move.rs:28:10
-   |
-LL |     test(BAR); //~ ERROR cannot move out of static item
-   |          ^^^
-   |          |
-   |          cannot move out of immutable static item `BAR`
-   |          cannot move
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index d2576a4baf369ab657e287a0e4b3f71f37beeb33..e6b612fed85885c1a24cae4ce2bfc59e0b3b87f3 100644 (file)
@@ -7,15 +7,6 @@ LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
    |             cannot move out of borrowed content
    |             help: consider removing the `*`: `&x`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/std-uncopyable-atomics.rs:19:13
-   |
-LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
-   |             ^^^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/std-uncopyable-atomics.rs:21:13
    |
@@ -25,15 +16,6 @@ LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
    |             cannot move out of borrowed content
    |             help: consider removing the `*`: `&x`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/std-uncopyable-atomics.rs:21:13
-   |
-LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
-   |             ^^^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/std-uncopyable-atomics.rs:23:13
    |
@@ -43,15 +25,6 @@ LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
    |             cannot move out of borrowed content
    |             help: consider removing the `*`: `&x`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/std-uncopyable-atomics.rs:23:13
-   |
-LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
-   |             ^^^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/std-uncopyable-atomics.rs:25:13
    |
@@ -61,15 +34,6 @@ LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
    |             cannot move out of borrowed content
    |             help: consider removing the `*`: `&x`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/std-uncopyable-atomics.rs:25:13
-   |
-LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
-   |             ^^^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
-error: aborting due to 8 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr
deleted file mode 100644 (file)
index 9f56bf0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/trivial-bounds-leak-copy.rs:19:5
-   |
-LL |     *t //~ ERROR
-   |     ^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of `*t` which is behind a `&` reference
-  --> $DIR/trivial-bounds-leak-copy.rs:19:5
-   |
-LL | fn move_out_string(t: &String) -> String {
-   |                       ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |     *t //~ ERROR
-   |     ^^
-   |     |
-   |     cannot move out of `*t` which is behind a `&` reference
-   |     `t` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index 625084efec2ff38002627fb1ac27da748bab7e31..4baa54e34c75532750ffba07c939ae627e9639c8 100644 (file)
@@ -6,21 +6,6 @@ LL |         let x = Box::new(0);
 LL |         let f = to_fn(|| drop(x)); //~ ERROR cannot move
    |                               ^ cannot move out of captured variable in an `Fn` closure
 
-error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure
-  --> $DIR/unboxed-closure-illegal-move.rs:25:31
-   |
-LL |         let f = to_fn(|| drop(x)); //~ ERROR cannot move
-   |                               ^
-   |                               |
-   |                               cannot move out of `x`, as it is a captured variable in a `Fn` closure
-   |                               cannot move
-   |
-help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/unboxed-closure-illegal-move.rs:25:23
-   |
-LL |         let f = to_fn(|| drop(x)); //~ ERROR cannot move
-   |                       ^^^^^^^^^^
-
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
   --> $DIR/unboxed-closure-illegal-move.rs:29:35
    |
@@ -37,21 +22,6 @@ LL |         let x = Box::new(0);
 LL |         let f = to_fn(move || drop(x)); //~ ERROR cannot move
    |                                    ^ cannot move out of captured variable in an `Fn` closure
 
-error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure
-  --> $DIR/unboxed-closure-illegal-move.rs:38:36
-   |
-LL |         let f = to_fn(move || drop(x)); //~ ERROR cannot move
-   |                                    ^
-   |                                    |
-   |                                    cannot move out of `x`, as it is a captured variable in a `Fn` closure
-   |                                    cannot move
-   |
-help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/unboxed-closure-illegal-move.rs:38:23
-   |
-LL |         let f = to_fn(move || drop(x)); //~ ERROR cannot move
-   |                       ^^^^^^^^^^^^^^^
-
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
   --> $DIR/unboxed-closure-illegal-move.rs:42:40
    |
@@ -60,6 +30,6 @@ LL |         let x = Box::new(0);
 LL |         let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move
    |                                        ^ cannot move out of captured variable in an `FnMut` closure
 
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
index ee91ea3b66f304e61d41fc7073ddb4cb0fa0f759..084d7ff3bcd61f85d26f3db6a4c7bc4c87908e32 100644 (file)
@@ -33,7 +33,7 @@ LL |     let x = 0;
 LL |     move || set(&mut x); //~ ERROR cannot borrow
    |                 ^^^^^^ cannot borrow as mutable
 
-warning[E0594]: cannot assign to `x`, as it is not declared as mutable
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
   --> $DIR/unboxed-closure-immutable-capture.rs:23:8
    |
 LL |     let x = 0;
@@ -41,12 +41,8 @@ LL |     let x = 0;
 ...
 LL |     || x = 1; //~ ERROR cannot assign
    |        ^^^^^ cannot assign
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
-warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
   --> $DIR/unboxed-closure-immutable-capture.rs:25:12
    |
 LL |     let x = 0;
@@ -54,12 +50,8 @@ LL |     let x = 0;
 ...
 LL |     || set(&mut x); //~ ERROR cannot assign
    |            ^^^^^^ cannot borrow as mutable
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
-warning[E0594]: cannot assign to `x`, as it is not declared as mutable
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
   --> $DIR/unboxed-closure-immutable-capture.rs:26:8
    |
 LL |     let x = 0;
@@ -67,12 +59,8 @@ LL |     let x = 0;
 ...
 LL |     || x = 1; //~ ERROR cannot assign
    |        ^^^^^ cannot assign
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
-warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
   --> $DIR/unboxed-closure-immutable-capture.rs:28:12
    |
 LL |     let x = 0;
@@ -80,12 +68,8 @@ LL |     let x = 0;
 ...
 LL |     || set(&mut x); //~ ERROR cannot assign
    |            ^^^^^^ cannot borrow as mutable
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
-error: aborting due to 4 previous errors
+error: aborting due to 8 previous errors
 
 Some errors occurred: E0594, E0596.
 For more information about an error, try `rustc --explain E0594`.
index fa0aba96e18be314935d4c93d5622ee3735b026c..718c3a19938c4a8735ea1cffe8f973501520884d 100644 (file)
@@ -1,4 +1,4 @@
-warning[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable
+error[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable
   --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:27:9
    |
 LL |     let tick1 = || {
@@ -6,10 +6,6 @@ LL |     let tick1 = || {
 ...
 LL |         tick1();
    |         ^^^^^ cannot borrow as mutable
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
 error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable
   --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:30:5
@@ -20,6 +16,6 @@ LL |     let tick2 = || { //~ ERROR closure cannot assign to immutable local var
 LL |     tick2(); //~ ERROR cannot borrow
    |     ^^^^^ cannot borrow as mutable
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0596`.
index 9858b8db2112d1ae6a819e985c8ec0626821934d..f765f207303d2dd1b9bc74ee926c75820baf9469 100644 (file)
@@ -1,4 +1,4 @@
-warning[E0594]: cannot assign to `n`, as it is not declared as mutable
+error[E0594]: cannot assign to `n`, as it is not declared as mutable
   --> $DIR/unboxed-closures-mutate-upvar.rs:25:9
    |
 LL |     let n = 0;
@@ -6,10 +6,6 @@ LL |     let n = 0;
 LL |     let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign
 LL |         n += 1;
    |         ^^^^^^ cannot assign
-   |
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
 
 error[E0594]: cannot assign to `n`, as it is not declared as mutable
   --> $DIR/unboxed-closures-mutate-upvar.rs:42:9
@@ -44,6 +40,6 @@ LL | |         n += 1; //~ ERROR cannot assign
 LL | |     });
    | |_____^
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0594`.
index 8112ddbe2f16e8db858080f795c9fa8daca7bcfb..111940aab2c322764150b4a5be8539b966a6a6ad 100644 (file)
@@ -21,19 +21,7 @@ error[E0507]: cannot move out of borrowed content
 LL |     !*n;  //~ ERROR: cannot move out of borrowed content
    |      ^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of `*n` which is behind a `&` reference
-  --> $DIR/unop-move-semantics.rs:36:6
-   |
-LL |     let n = &y;
-   |             -- help: consider changing this to be a mutable reference: `&mut y`
-...
-LL |     !*n;  //~ ERROR: cannot move out of borrowed content
-   |      ^^
-   |      |
-   |      cannot move out of `*n` which is behind a `&` reference
-   |      `n` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
 Some errors occurred: E0382, E0507.
 For more information about an error, try `rustc --explain E0382`.
index 675457b0db6bb2ff72251c490388a544408219be..a94414ef5603b7a10464c3d687c133dc4111b9bd 100644 (file)
@@ -4,16 +4,6 @@ error[E0508]: cannot move out of type `[u8]`, a non-copy slice
 LL |     udrop::<[u8]>(foo()[..]);
    |                   ^^^^^^^^^ cannot move out of here
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/unsized-exprs2.rs:22:19
-   |
-LL |     udrop::<[u8]>(foo()[..]);
-   |                   ^^^^^^^^^
-   |                   |
-   |                   cannot move out of data in a `&` reference
-   |                   cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors occurred: E0507, E0508.
-For more information about an error, try `rustc --explain E0507`.
+For more information about this error, try `rustc --explain E0508`.
index 2d0863f657e6f45159fc7412267eee3e659185e5..1fa30882067703202d13ad0bd53d630bc2c1de66 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 2d0863f657e6f45159fc7412267eee3e659185e5
+Subproject commit 1fa30882067703202d13ad0bd53d630bc2c1de66
index b1d0343749bdc87e5cbbe7f1aeaa9d2a2c9dbc5b..481f7880df428020480eb343c209072c6db10503 160000 (submodule)
@@ -1 +1 @@
-Subproject commit b1d0343749bdc87e5cbbe7f1aeaa9d2a2c9dbc5b
+Subproject commit 481f7880df428020480eb343c209072c6db10503
index 06eeef61a194ddf3e535e77c979df2add9bce39c..f12dd31c402d9e85d11b1cc542ac477136290b5d 100644 (file)
@@ -243,6 +243,29 @@ fn ignore_llvm(config: &Config, line: &str) -> bool {
                     // Ignore if using system LLVM and actual version
                     // is smaller the minimum required version
                     config.system_llvm && &actual_version[..] < min_version
+                } else if line.starts_with("ignore-llvm-version") {
+                    // Syntax is: "ignore-llvm-version <version1> [- <version2>]"
+                    let range_components = line.split(' ')
+                        .skip(1) // Skip the directive.
+                        .map(|s| s.trim())
+                        .filter(|word| !word.is_empty() && word != &"-")
+                        .take(3) // 3 or more = invalid, so take at most 3.
+                        .collect::<Vec<&str>>();
+                    match range_components.len() {
+                        1 => {
+                            &actual_version[..] == range_components[0]
+                        }
+                        2 => {
+                            let v_min = range_components[0];
+                            let v_max = range_components[1];
+                            if v_max < v_min {
+                                panic!("Malformed LLVM version range: max < min")
+                            }
+                            // Ignore if version lies inside of range.
+                            &actual_version[..] >= v_min && &actual_version[..] <= v_max
+                        }
+                        _ => panic!("Malformed LLVM version directive"),
+                    }
                 } else {
                     false
                 }
index 7728fa22bebea288abfea3b70cf795c60b93df3a..29bf48582812212450f4caf7da1af3f18c52bfef 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 7728fa22bebea288abfea3b70cf795c60b93df3a
+Subproject commit 29bf48582812212450f4caf7da1af3f18c52bfef