]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #56078 - ehuss:fix-panic-opt-msg, r=alexcrichton
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Thu, 22 Nov 2018 09:37:54 +0000 (10:37 +0100)
committerGitHub <noreply@github.com>
Thu, 22 Nov 2018 09:37:54 +0000 (10:37 +0100)
Fix error message for `-C panic=xxx`.

Fixes rust-lang/cargo#6334

138 files changed:
RELEASES.md
src/Cargo.lock
src/bootstrap/doc.rs
src/bootstrap/tool.rs
src/doc/book
src/doc/nomicon
src/doc/reference
src/doc/rust-by-example
src/doc/unstable-book/src/language-features/macro-literal-matcher.md
src/doc/unstable-book/src/language-features/plugin.md
src/etc/gdb_rust_pretty_printing.py
src/liballoc/rc.rs
src/liballoc/sync.rs
src/libcore/any.rs
src/libcore/char/convert.rs
src/libcore/iter/iterator.rs
src/libcore/iter/mod.rs
src/libcore/mem.rs
src/libcore/ptr.rs
src/libcore/raw.rs
src/libcore/tests/iter.rs
src/librustc/dep_graph/graph.rs
src/librustc/hir/lowering.rs
src/librustc/hir/map/definitions.rs
src/librustc/ich/hcx.rs
src/librustc/ich/impls_ty.rs
src/librustc/infer/opaque_types/mod.rs
src/librustc/infer/region_constraints/mod.rs
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/librustc/lint/mod.rs
src/librustc/middle/borrowck.rs
src/librustc/middle/liveness.rs
src/librustc/middle/reachable.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/mir/interpret/error.rs
src/librustc/mir/interpret/mod.rs
src/librustc/mir/interpret/value.rs
src/librustc/session/mod.rs
src/librustc/traits/error_reporting.rs
src/librustc/ty/context.rs
src/librustc/ty/mod.rs
src/librustc/ty/query/mod.rs
src/librustc/util/nodemap.rs
src/librustc_codegen_llvm/debuginfo/mod.rs
src/librustc_codegen_ssa/back/linker.rs
src/librustc_codegen_ssa/back/symbol_export.rs
src/librustc_data_structures/Cargo.toml
src/librustc_data_structures/fx.rs
src/librustc_data_structures/snapshot_map/mod.rs
src/librustc_data_structures/transitive_relation.rs
src/librustc_lint/builtin.rs
src/librustc_lint/unused.rs
src/librustc_metadata/cstore_impl.rs
src/librustc_mir/build/mod.rs
src/librustc_mir/const_eval.rs
src/librustc_mir/interpret/eval_context.rs
src/librustc_mir/interpret/memory.rs
src/librustc_mir/interpret/operand.rs
src/librustc_mir/interpret/place.rs
src/librustc_mir/monomorphize/collector.rs
src/librustc_mir/transform/const_prop.rs
src/librustc_mir/transform/mod.rs
src/librustc_mir/transform/qualify_min_const_fn.rs
src/librustc_passes/rvalue_promotion.rs
src/librustc_privacy/lib.rs
src/librustc_resolve/check_unused.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/librustc_resolve/resolve_imports.rs
src/librustc_target/spec/mod.rs
src/librustc_target/spec/x86_64_fortanix_unknown_sgx.rs [new file with mode: 0644]
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/check_unused.rs
src/librustc_typeck/coherence/inherent_impls.rs
src/librustc_typeck/variance/terms.rs
src/librustdoc/core.rs
src/librustdoc/passes/collect_intra_doc_links.rs
src/librustdoc/passes/mod.rs
src/librustdoc/passes/private_items_doc_tests.rs [new file with mode: 0644]
src/librustdoc/passes/strip_hidden.rs
src/librustdoc/passes/strip_private.rs
src/libstd/collections/hash/map.rs
src/libstd/lib.rs
src/libstd/macros.rs
src/libstd/primitive_docs.rs
src/libsyntax/feature_gate.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/tokenstream.rs
src/test/debuginfo/pretty-std-collections.rs
src/test/rustdoc-ui/private-item-doc-test.rs [new file with mode: 0644]
src/test/rustdoc-ui/private-item-doc-test.stderr [new file with mode: 0644]
src/test/ui-fulldeps/proc-macro/auxiliary/span-preservation.rs [new file with mode: 0644]
src/test/ui-fulldeps/proc-macro/extern-prelude-extern-crate-proc-macro.rs
src/test/ui-fulldeps/proc-macro/span-preservation.rs [new file with mode: 0644]
src/test/ui-fulldeps/proc-macro/span-preservation.stderr [new file with mode: 0644]
src/test/ui/consts/const-err4.rs
src/test/ui/consts/const-err4.stderr
src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs
src/test/ui/consts/const-eval/const-pointer-values-in-various-types.stderr
src/test/ui/consts/const-eval/ub-enum.rs
src/test/ui/consts/const-eval/ub-enum.stderr
src/test/ui/consts/const-eval/union-const-eval-field.rs
src/test/ui/consts/const-eval/union-const-eval-field.stderr
src/test/ui/consts/const-eval/union-ice.rs
src/test/ui/consts/const-eval/union-ice.stderr
src/test/ui/consts/min_const_fn/loop_ice.rs [new file with mode: 0644]
src/test/ui/consts/min_const_fn/loop_ice.stderr [new file with mode: 0644]
src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.rs [deleted file]
src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr [deleted file]
src/test/ui/imports/auxiliary/issue-55811.rs [new file with mode: 0644]
src/test/ui/imports/auxiliary/issue-56125.rs [new file with mode: 0644]
src/test/ui/imports/extern-prelude-extern-crate-absolute-expanded.rs
src/test/ui/imports/extern-prelude-extern-crate-cfg.rs
src/test/ui/imports/extern-prelude-extern-crate-pass.rs
src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs
src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr
src/test/ui/imports/extern-prelude-extern-crate-shadowing.rs [new file with mode: 0644]
src/test/ui/imports/issue-55811.rs [new file with mode: 0644]
src/test/ui/imports/issue-56125.rs [new file with mode: 0644]
src/test/ui/imports/issue-56125.stderr [new file with mode: 0644]
src/test/ui/invalid-self-argument/bare-fn-start.rs [new file with mode: 0644]
src/test/ui/invalid-self-argument/bare-fn-start.stderr [new file with mode: 0644]
src/test/ui/invalid-self-argument/bare-fn.rs [new file with mode: 0644]
src/test/ui/invalid-self-argument/bare-fn.stderr [new file with mode: 0644]
src/test/ui/invalid-self-argument/trait-fn.rs [new file with mode: 0644]
src/test/ui/invalid-self-argument/trait-fn.stderr [new file with mode: 0644]
src/test/ui/lint/must_use-trait.rs [new file with mode: 0644]
src/test/ui/lint/must_use-trait.stderr [new file with mode: 0644]
src/test/ui/mismatched_types/closure-arg-count.rs
src/test/ui/mismatched_types/closure-arg-count.stderr
src/test/ui/underscore_const_names_feature_gate.rs [new file with mode: 0644]
src/test/ui/underscore_const_names_feature_gate.stderr [new file with mode: 0644]
src/tools/build-manifest/src/main.rs
src/tools/rls
src/tools/rustfmt

index 15ab97e26fc78cae320cd2108dea76a9ae875d66..a455186859f863eff229390ce0542fc18ed5fca1 100644 (file)
@@ -1,3 +1,80 @@
+Version 1.31.0 (2018-12-06)
+==========================
+
+Language
+--------
+- ðŸŽ‰ [This version marks the release of the 2018 edition of Rust.][54057] ðŸŽ‰ 
+- [New lifetime elision rules now allow for eliding lifetimes in functions and
+  impl headers.][54778] E.g. `impl<'a> Reader for BufReader<'a> {}` can now be
+  `impl Reader for BufReader<'_> {}`. Lifetimes are still required to be defined
+  in structs.
+- [You can now define and use `const` functions.][54835] These are currently
+  a strict minimal subset of the [const fn RFC][RFC-911]. Refer to the
+  [language reference][const-reference] for what exactly is available.
+- [You can now use tool lints, which allow you to scope lints from external
+  tools using attributes.][54870] E.g. `#[allow(clippy::filter_map)]`.
+- [`#[no_mangle]` and `#[export_name]` attributes can now be located anywhere in
+  a crate, not just in exported functions.][54451]
+- [You can now use parentheses in pattern matches.][54497]
+
+Compiler
+--------
+- [Updated musl to 1.1.20][54430]
+
+Libraries
+---------
+- [You can now convert `num::NonZero*` types to their raw equivalvents using the
+  `From` trait.][54240] E.g. `u8` now implements `From<NonZeroU8>`.
+- [You can now convert a `&Option<T>` into `Option<&T>` and `&mut Option<T>`
+  into `Option<&mut T>` using the `From` trait.][53218]
+- [You can now multiply (`*`) a `time::Duration` by a `u32`.][52813]
+
+
+Stabilized APIs
+---------------
+- [`slice::align_to`]
+- [`slice::align_to_mut`]
+- [`slice::chunks_exact`]
+- [`slice::chunks_exact_mut`]
+- [`slice::rchunks`]
+- [`slice::rchunks_mut`]
+- [`slice::rchunks_exact`]
+- [`slice::rchunks_exact_mut`]
+- [`Option::replace`]
+
+Cargo
+-----
+- [Cargo will now download crates in parallel using HTTP/2.][cargo/6005]
+- [You can now rename packages in your Cargo.toml][cargo/6319] We have a guide
+  on [how to use the `package` key in your dependencies.][cargo-rename-reference]
+
+[52813]: https://github.com/rust-lang/rust/pull/52813/
+[53218]: https://github.com/rust-lang/rust/pull/53218/
+[53555]: https://github.com/rust-lang/rust/issues/53555/
+[54057]: https://github.com/rust-lang/rust/pull/54057/
+[54240]: https://github.com/rust-lang/rust/pull/54240/
+[54430]: https://github.com/rust-lang/rust/pull/54430/
+[54451]: https://github.com/rust-lang/rust/pull/54451/
+[54497]: https://github.com/rust-lang/rust/pull/54497/
+[54778]: https://github.com/rust-lang/rust/pull/54778/
+[54835]: https://github.com/rust-lang/rust/pull/54835/
+[54870]: https://github.com/rust-lang/rust/pull/54870/
+[RFC-911]: https://github.com/rust-lang/rfcs/pull/911
+[`Option::replace`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.replace
+[`slice::align_to_mut`]: https://doc.rust-lang.org/std/primitive.slice.html#method.align_to_mut
+[`slice::align_to`]: https://doc.rust-lang.org/std/primitive.slice.html#method.align_to
+[`slice::chunks_exact_mut`]: https://doc.rust-lang.org/std/primitive.slice.html#method.chunks_exact_mut
+[`slice::chunks_exact`]: https://doc.rust-lang.org/std/primitive.slice.html#method.chunks_exact
+[`slice::rchunks_exact_mut`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks_mut
+[`slice::rchunks_exact`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks_exact
+[`slice::rchunks_mut`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks_mut
+[`slice::rchunks`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks
+[cargo/6005]: https://github.com/rust-lang/cargo/pull/6005/
+[cargo/6319]: https://github.com/rust-lang/cargo/pull/6319/
+[cargo-rename-reference]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml
+[const-reference]: https://doc.rust-lang.org/reference/items/functions.html#const-functions
+
+
 Version 1.30.0 (2018-10-25)
 ==========================
 
index 94a07f6c91cfa07d42ac9024059ba4887b7f4403..0dd693e7217e768af59c17ec1cfd2dd90c72d2ee 100644 (file)
@@ -605,12 +605,13 @@ dependencies = [
 
 [[package]]
 name = "derive_more"
-version = "0.11.0"
+version = "0.13.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -658,6 +659,14 @@ dependencies = [
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "ena"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "env_logger"
 version = "0.5.12"
@@ -724,7 +733,7 @@ name = "failure_derive"
 version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "proc-macro2 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1331,7 +1340,7 @@ version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro2 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -1581,7 +1590,7 @@ dependencies = [
 
 [[package]]
 name = "proc-macro2"
-version = "0.4.13"
+version = "0.4.24"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1660,23 +1669,23 @@ name = "quote"
 version = "0.6.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "proc-macro2 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "racer"
-version = "2.1.9"
+version = "2.1.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "derive_more 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1798,7 +1807,7 @@ dependencies = [
 
 [[package]]
 name = "rls"
-version = "0.130.5"
+version = "1.31.6"
 dependencies = [
  "cargo 0.33.0",
  "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1813,20 +1822,20 @@ dependencies = [
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "racer 2.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "racer 2.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "rls-analysis 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "rls-blacklist 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rls-analysis 0.16.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rls-vfs 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rls-vfs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-workspace-hack 1.0.0",
  "rustc_tools_util 0.1.0",
- "rustfmt-nightly 0.99.6",
+ "rustfmt-nightly 1.0.0",
  "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)",
@@ -1837,7 +1846,7 @@ dependencies = [
 
 [[package]]
 name = "rls-analysis"
-version = "0.16.1"
+version = "0.16.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1852,7 +1861,7 @@ dependencies = [
 
 [[package]]
 name = "rls-blacklist"
-version = "0.1.2"
+version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -1883,9 +1892,10 @@ dependencies = [
 
 [[package]]
 name = "rls-vfs"
-version = "0.4.6"
+version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
+ "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -1932,15 +1942,20 @@ dependencies = [
 
 [[package]]
 name = "rustc-ap-arena"
-version = "274.0.0"
+version = "297.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "rustc-ap-rustc_data_structures 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "rustc-ap-graphviz"
+version = "297.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
 [[package]]
 name = "rustc-ap-rustc_cratesio_shim"
-version = "274.0.0"
+version = "297.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1950,7 +1965,7 @@ dependencies = [
 
 [[package]]
 name = "rustc-ap-rustc_data_structures"
-version = "274.0.0"
+version = "297.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1958,8 +1973,9 @@ dependencies = [
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_cratesio_shim 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-serialize 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-graphviz 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_cratesio_shim 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1969,33 +1985,34 @@ dependencies = [
 
 [[package]]
 name = "rustc-ap-rustc_errors"
-version = "274.0.0"
+version = "297.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_cratesio_shim 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_data_structures 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-serialize 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax_pos 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_cratesio_shim 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax_pos 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "rustc-ap-rustc_target"
-version = "274.0.0"
+version = "297.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_cratesio_shim 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-serialize 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_cratesio_shim 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "rustc-ap-serialize"
-version = "274.0.0"
+version = "297.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2003,29 +2020,29 @@ dependencies = [
 
 [[package]]
 name = "rustc-ap-syntax"
-version = "274.0.0"
+version = "297.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_data_structures 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_errors 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_target 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-serialize 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax_pos 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_errors 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_target 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax_pos 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "rustc-ap-syntax_pos"
-version = "274.0.0"
+version = "297.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-arena 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_data_structures 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-serialize 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-arena 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -2187,7 +2204,7 @@ name = "rustc_data_structures"
 version = "0.0.0"
 dependencies = [
  "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "graphviz 0.0.0",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2526,7 +2543,7 @@ dependencies = [
 
 [[package]]
 name = "rustfmt-nightly"
-version = "0.99.6"
+version = "1.0.0"
 dependencies = [
  "assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2541,9 +2558,9 @@ dependencies = [
  "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_target 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax_pos 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_target 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax_pos 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-workspace-hack 1.0.0",
  "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)",
@@ -2620,7 +2637,7 @@ name = "serde_derive"
 version = "1.0.75"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "proc-macro2 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -2762,7 +2779,7 @@ name = "strum_macros"
 version = "0.9.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "proc-macro2 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -2792,7 +2809,17 @@ name = "syn"
 version = "0.14.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "proc-macro2 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "syn"
+version = "0.15.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -2810,7 +2837,7 @@ name = "synstructure"
 version = "0.9.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "proc-macro2 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3237,11 +3264,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "721c204978be2143fab0a84b708c49d79d1f6100b8785610f456043a90708870"
 "checksum datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16d724bf4ffe77cdceeecd461009b5f8d9e23c5d645d68bedb4586bf43e7e142"
 "checksum derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ceed73957c449214f8440eec8ad7fa282b67dc9eacbb24a3085b15d60397a17a"
-"checksum derive_more 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46c7f14685a20f5dd08e7f754f2ea8cc064d8f4214ae21116c106a2768ba7b9b"
+"checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871"
 "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
 "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
 "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
 "checksum elasticlunr-rs 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4837d77a1e157489a3933b743fd774ae75074e0e390b2b7f071530048a0d87ee"
+"checksum ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25b4e5febb25f08c49f1b07dc33a182729a6b21edfb562b5aef95f78e0dbe5bb"
 "checksum ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "88dc8393b3c7352f94092497f6b52019643e493b6b890eb417cdb7c46117e621"
 "checksum env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)" = "f4d7e69c283751083d53d01eac767407343b8b69c4bd70058e08adc2637cb257"
 "checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
@@ -3342,7 +3370,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
 "checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6"
 "checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7"
-"checksum proc-macro2 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "ee5697238f0d893c7f0ecc59c0999f18d2af85e424de441178bcacc9f9e6cf67"
+"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
 "checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f"
 "checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32"
 "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
@@ -3350,7 +3378,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
 "checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8"
 "checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5"
-"checksum racer 2.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5eeddfffd44c83eb03eedf5eb336e9c75303534fe28728a9f6b39a6e6f07ccff"
+"checksum racer 2.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "344a53b68d889ab5f44d0617f2bbe1f696abe6a730bd41fa619cfc6fa83a6078"
 "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
 "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
 "checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2"
@@ -3363,20 +3391,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7"
 "checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d"
 "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
-"checksum rls-analysis 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9a625690e3bf1204ce27b50f71e508ee788214b2d51e26e4e5db884a83627673"
-"checksum rls-blacklist 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e4a9cc2545ccb7e05b355bfe047b8039a6ec12270d5f3c996b766b340a50f7d2"
+"checksum rls-analysis 0.16.8 (registry+https://github.com/rust-lang/crates.io-index)" = "2a1d3a2a8c03e380331aefb8b5e3e06f3065602fbaa6657ba0ac649dc99d8537"
+"checksum rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ce1fdac03e138c4617ff87b194e1ff57a39bb985a044ccbd8673d30701e411"
 "checksum rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a209ce46bb52813cbe0786a7baadc0c1a3f5543ef93f179eda3b841ed72cf2e"
 "checksum rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9dba7390427aefa953608429701e3665192ca810ba8ae09301e001b7c7bed0"
 "checksum rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d7c7046dc6a92f2ae02ed302746db4382e75131b9ce20ce967259f6b5867a6a"
-"checksum rls-vfs 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ecbc8541b4c341d6271eae10f869dd9d36db871afe184f5b6f9bffbd6ed0373f"
-"checksum rustc-ap-arena 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "866fda692855b38f9d6562f0e952c75c6ebe4032d7dd63c608a88e7c4d3f8087"
-"checksum rustc-ap-rustc_cratesio_shim 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6c2343e11a97b4eb3bee29cd5f9314ea409a87baee5d3fec8d1516d1633412e"
-"checksum rustc-ap-rustc_data_structures 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b88f905f7ab99bf14220a3a87eff60ec143af8136fd0ca8573641c78be532ec8"
-"checksum rustc-ap-rustc_errors 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c86fda6cf42e0355b7ecf40f14888340c20b7b864c9d37f6ffca85fe87200652"
-"checksum rustc-ap-rustc_target 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8fa8622299beac8c40270e8536a7b0509ca80f227a2b56550019a325fa5a60c0"
-"checksum rustc-ap-serialize 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d16cc3d014af9a524c0bed6ca806c3170e39d5987180f0f8ce8fb7df5113576c"
-"checksum rustc-ap-syntax 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a29f280f04f4f45e1bdd773ab5e667b36e757bfbbd01193c330815b9e76d05a"
-"checksum rustc-ap-syntax_pos 274.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c2ea27b65311571c7614deb393691eb18c5e41fd4fd9d8490304e128e1358646"
+"checksum rls-vfs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72d56425bd5aa86d9d4372b76f0381d3b4bda9c0220e71956c9fcc929f45c1f1"
+"checksum rustc-ap-arena 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b69fd4a0e8a3ecd99b497965d05f6f04dd2e4601a6146a841dbe4c8e77c2b30c"
+"checksum rustc-ap-graphviz 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8136418dbc491bab74aa0565eaa2086754a7a81a5e74a1d84d6168d18e889e7"
+"checksum rustc-ap-rustc_cratesio_shim 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a972feda82332d1d05b1ba5a097e915cd9c9c8f1af2bd7b08af09fb88c753d5f"
+"checksum rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "582584c6c48b0ece4b8aef3f9bb59d94d17c5665612bc87a71f509e45a3113b5"
+"checksum rustc-ap-rustc_errors 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cd852096944d0ac6af1aefa9639a2ae6dede217606ce97f88ff0dcc8c86d6ff6"
+"checksum rustc-ap-rustc_target 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "98301a272ecfeec29d2d4e97b07238707c2b89d86fc3a4a5f31a00728f14e288"
+"checksum rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f13510e617e2e322e3297038fd6a7346f2297124af9e10e33a627c5d544e9d"
+"checksum rustc-ap-syntax 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0792f5a9ccfc5ec13bb5b0472fa49e145481029c39f6bf5b1a36decc99c3328f"
+"checksum rustc-ap-syntax_pos 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0df9f97f41650d23b14f92f7267f8c61089655efb4533d82bf8991f99245198d"
 "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395"
 "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
 "checksum rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c6d5a683c6ba4ed37959097e88d71c9e8e26659a3cb5be8b389078e7ad45306"
@@ -3412,6 +3441,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
 "checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b"
 "checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"
+"checksum syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)" = "816b7af21405b011a23554ea2dc3f6576dc86ca557047c34098c1d741f10f823"
 "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
 "checksum synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85bb9b7550d063ea184027c9b8c20ac167cd36d3e06b3a40bceb9d746dc1a7b7"
 "checksum tar 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "69e16840a1e0a1f1a880b739ef1cc6a4b85496c99b8aa786ccffce6e0c15624c"
index 7623ca1e27ea6cdbc691fa4b91678413f80daec5..f9b19ffb10d69bfe2454e7184fddb5588bf68b8b 100644 (file)
@@ -260,22 +260,31 @@ fn run(self, builder: &Builder) {
         let compiler = self.compiler;
         let target = self.target;
         let name = self.name;
-        // build book first edition
+
+        // build book
         builder.ensure(Rustbook {
             target,
-            name: INTERNER.intern_string(format!("{}/first-edition", name)),
+            name: INTERNER.intern_string(name.to_string()),
         });
 
-        // build book second edition
+        // building older edition redirects
+
+        let source_name = format!("{}/first-edition", name);
         builder.ensure(Rustbook {
             target,
-            name: INTERNER.intern_string(format!("{}/second-edition", name)),
+            name: INTERNER.intern_string(source_name),
         });
 
-        // build book 2018 edition
+        let source_name = format!("{}/second-edition", name);
         builder.ensure(Rustbook {
             target,
-            name: INTERNER.intern_string(format!("{}/2018-edition", name)),
+            name: INTERNER.intern_string(source_name),
+        });
+
+        let source_name = format!("{}/2018-edition", name);
+        builder.ensure(Rustbook {
+            target,
+            name: INTERNER.intern_string(source_name),
         });
 
         // build the version info page and CSS
@@ -284,11 +293,6 @@ fn run(self, builder: &Builder) {
             target,
         });
 
-        // build the index page
-        let index = format!("{}/index.md", name);
-        builder.info(&format!("Documenting book index ({})", target));
-        invoke_rustdoc(builder, compiler, target, &index);
-
         // build the redirect pages
         builder.info(&format!("Documenting book redirect pages ({})", target));
         for file in t!(fs::read_dir(builder.src.join("src/doc/book/redirects"))) {
index 978e3602e7dbc5c132c37507135686ab36c7061f..d8e86644ee0540ac09b629fa9ba4abacbcf6509f 100644 (file)
@@ -22,6 +22,7 @@
 use compile;
 use native;
 use channel::GitInfo;
+use channel;
 use cache::Interned;
 use toolstate::ToolState;
 
@@ -240,6 +241,7 @@ pub fn prepare_tool_cargo(
 
     cargo.env("CFG_RELEASE_CHANNEL", &builder.config.channel);
     cargo.env("CFG_VERSION", builder.rust_version());
+    cargo.env("CFG_RELEASE_NUM", channel::CFG_RELEASE_NUM);
 
     let info = GitInfo::new(&builder.config, &dir);
     if let Some(sha) = info.sha() {
index e871c4598925594421d63e929fee292e6e071f97..616fe4172b688393aeee5f34935cc25733c9c062 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e871c4598925594421d63e929fee292e6e071f97
+Subproject commit 616fe4172b688393aeee5f34935cc25733c9c062
index 7f7a597b47ed6c35c2a0f0ee6a69050fe2d5e013..f8a4e96feb2e5a6ed1ef170ad40e3509a7755cb4 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 7f7a597b47ed6c35c2a0f0ee6a69050fe2d5e013
+Subproject commit f8a4e96feb2e5a6ed1ef170ad40e3509a7755cb4
index b9fb838054b8441223c22eeae5b6d8e498071cd0..60077efda319c95a89fe39609803c5433567adbf 160000 (submodule)
@@ -1 +1 @@
-Subproject commit b9fb838054b8441223c22eeae5b6d8e498071cd0
+Subproject commit 60077efda319c95a89fe39609803c5433567adbf
index bc342a475c09b6df8004d518382e6d5b6bcb49f7..2ce92beabb912d417a7314d6da83ac9b50dc2afb 160000 (submodule)
@@ -1 +1 @@
-Subproject commit bc342a475c09b6df8004d518382e6d5b6bcb49f7
+Subproject commit 2ce92beabb912d417a7314d6da83ac9b50dc2afb
index 7e3638fd1cf4c1d1362320d0efcab2323491a341..870158200dee90aa9c2787bed74d71e60cff9365 100644 (file)
@@ -4,7 +4,7 @@ The tracking issue for this feature is: [#35625]
 
 The RFC is: [rfc#1576].
 
-With this feature gate enabled, the [list of fragment specifiers][frags] gains one more entry:
+With this feature gate enabled, the [list of designators] gains one more entry:
 
 * `literal`: a literal. Examples: 2, "string", 'c'
 
@@ -12,6 +12,6 @@ A `literal` may be followed by anything, similarly to the `ident` specifier.
 
 [rfc#1576]: http://rust-lang.github.io/rfcs/1576-macros-literal-matcher.html
 [#35625]: https://github.com/rust-lang/rust/issues/35625
-[frags]: ../book/first-edition/macros.html#syntactic-requirements
+[list of designators]: ../reference/macros-by-example.html
 
 ------------------------
index b408d5d0805152008ed803dbd6c5fa8ef0fd5128..74bdd4dc3b5993e4e06d5c2765af977c6fa71538 100644 (file)
@@ -137,8 +137,6 @@ of extensions.  See `Registry::register_syntax_extension` and the
 
 ## Tips and tricks
 
-Some of the [macro debugging tips](../book/first-edition/macros.html#debugging-macro-code) are applicable.
-
 You can use `syntax::parse` to turn token trees into
 higher-level syntax elements like expressions:
 
index e6d5ef1a23ff786890e14b28c81029ff1ce20ea6..27275ba37957e1e93fe6cdd2c0b60be277e43963 100755 (executable)
@@ -293,15 +293,23 @@ class RustStdVecDequePrinter(object):
     def to_string(self):
         (tail, head, data_ptr, cap) = \
             rustpp.extract_tail_head_ptr_and_cap_from_std_vecdeque(self.__val)
+        if head >= tail:
+            size = head - tail
+        else:
+            size = cap + head - tail
         return (self.__val.type.get_unqualified_type_name() +
-                ("(len: %i, cap: %i)" % (head - tail, cap)))
+                ("(len: %i, cap: %i)" % (size, cap)))
 
     def children(self):
         (tail, head, data_ptr, cap) = \
             rustpp.extract_tail_head_ptr_and_cap_from_std_vecdeque(self.__val)
         gdb_ptr = data_ptr.get_wrapped_value()
-        for index in xrange(tail, head):
-            yield (str(index), (gdb_ptr + index).dereference())
+        if head >= tail:
+            size = head - tail
+        else:
+            size = cap + head - tail
+        for index in xrange(0, size):
+            yield (str(index), (gdb_ptr + ((tail + index) % cap)).dereference())
 
 
 class RustStdBTreeSetPrinter(object):
index bb52d7990ff5772fdc27c821ee3c730896af9630..705345ce963bb28f48aea4565cf6ecc855f4908f 100644 (file)
@@ -43,8 +43,8 @@
 //!
 //! `Rc<T>` automatically dereferences to `T` (via the [`Deref`] trait),
 //! so you can call `T`'s methods on a value of type [`Rc<T>`][`Rc`]. To avoid name
-//! clashes with `T`'s methods, the methods of [`Rc<T>`][`Rc`] itself are [associated
-//! functions][assoc], called using function-like syntax:
+//! clashes with `T`'s methods, the methods of [`Rc<T>`][`Rc`] itself are associated
+//! functions, called using function-like syntax:
 //!
 //! ```
 //! use std::rc::Rc;
 //! [downgrade]: struct.Rc.html#method.downgrade
 //! [upgrade]: struct.Weak.html#method.upgrade
 //! [`None`]: ../../std/option/enum.Option.html#variant.None
-//! [assoc]: ../../book/first-edition/method-syntax.html#associated-functions
 //! [mutability]: ../../std/cell/index.html#introducing-mutability-inside-of-something-immutable
 
 #![stable(feature = "rust1", since = "1.0.0")]
index b63b3684964bb64038366cf6d12365614a99c2a9..4f4031e3c4e32a120f86f02fb950a0c36c2f107b 100644 (file)
 ///
 /// `Arc<T>` automatically dereferences to `T` (via the [`Deref`][deref] trait),
 /// so you can call `T`'s methods on a value of type `Arc<T>`. To avoid name
-/// clashes with `T`'s methods, the methods of `Arc<T>` itself are [associated
-/// functions][assoc], called using function-like syntax:
+/// clashes with `T`'s methods, the methods of `Arc<T>` itself are associated
+/// functions, called using function-like syntax:
 ///
 /// ```
 /// use std::sync::Arc;
 /// [downgrade]: struct.Arc.html#method.downgrade
 /// [upgrade]: struct.Weak.html#method.upgrade
 /// [`None`]: ../../std/option/enum.Option.html#variant.None
-/// [assoc]: ../../book/first-edition/method-syntax.html#associated-functions
 /// [`RefCell<T>`]: ../../std/cell/struct.RefCell.html
 /// [`std::sync`]: ../../std/sync/index.html
 /// [`Arc::clone(&from)`]: #method.clone
index 6b26093439e4f509925d0be5eff19329f554b6b8..c2113dfd2a06714e5224dc58a59585b4a9d5b74c 100644 (file)
@@ -39,7 +39,7 @@
 //!
 //! // Logger function for any type that implements Debug.
 //! fn log<T: Any + Debug>(value: &T) {
-//!     let value_any = value as &Any;
+//!     let value_any = value as &dyn Any;
 //!
 //!     // try to convert our value to a String.  If successful, we want to
 //!     // output the String's length as well as its value.  If not, it's a
@@ -95,7 +95,7 @@ pub trait Any: 'static {
     ///
     /// use std::any::{Any, TypeId};
     ///
-    /// fn is_string(s: &Any) -> bool {
+    /// fn is_string(s: &dyn Any) -> bool {
     ///     TypeId::of::<String>() == s.get_type_id()
     /// }
     ///
@@ -151,7 +151,7 @@ impl dyn Any {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn is_string(s: &Any) {
+    /// fn is_string(s: &dyn Any) {
     ///     if s.is::<String>() {
     ///         println!("It's a string!");
     ///     } else {
@@ -185,7 +185,7 @@ pub fn is<T: Any>(&self) -> bool {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn print_if_string(s: &Any) {
+    /// fn print_if_string(s: &dyn Any) {
     ///     if let Some(string) = s.downcast_ref::<String>() {
     ///         println!("It's a string({}): '{}'", string.len(), string);
     ///     } else {
@@ -218,7 +218,7 @@ pub fn downcast_ref<T: Any>(&self) -> Option<&T> {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn modify_if_u32(s: &mut Any) {
+    /// fn modify_if_u32(s: &mut dyn Any) {
     ///     if let Some(num) = s.downcast_mut::<u32>() {
     ///         *num = 42;
     ///     }
@@ -256,7 +256,7 @@ impl dyn Any+Send {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn is_string(s: &(Any + Send)) {
+    /// fn is_string(s: &(dyn Any + Send)) {
     ///     if s.is::<String>() {
     ///         println!("It's a string!");
     ///     } else {
@@ -282,7 +282,7 @@ pub fn is<T: Any>(&self) -> bool {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn print_if_string(s: &(Any + Send)) {
+    /// fn print_if_string(s: &(dyn Any + Send)) {
     ///     if let Some(string) = s.downcast_ref::<String>() {
     ///         println!("It's a string({}): '{}'", string.len(), string);
     ///     } else {
@@ -308,7 +308,7 @@ pub fn downcast_ref<T: Any>(&self) -> Option<&T> {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn modify_if_u32(s: &mut (Any + Send)) {
+    /// fn modify_if_u32(s: &mut (dyn Any + Send)) {
     ///     if let Some(num) = s.downcast_mut::<u32>() {
     ///         *num = 42;
     ///     }
@@ -340,7 +340,7 @@ impl dyn Any+Send+Sync {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn is_string(s: &(Any + Send + Sync)) {
+    /// fn is_string(s: &(dyn Any + Send + Sync)) {
     ///     if s.is::<String>() {
     ///         println!("It's a string!");
     ///     } else {
@@ -366,7 +366,7 @@ pub fn is<T: Any>(&self) -> bool {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn print_if_string(s: &(Any + Send + Sync)) {
+    /// fn print_if_string(s: &(dyn Any + Send + Sync)) {
     ///     if let Some(string) = s.downcast_ref::<String>() {
     ///         println!("It's a string({}): '{}'", string.len(), string);
     ///     } else {
@@ -392,7 +392,7 @@ pub fn downcast_ref<T: Any>(&self) -> Option<&T> {
     /// ```
     /// use std::any::Any;
     ///
-    /// fn modify_if_u32(s: &mut (Any + Send + Sync)) {
+    /// fn modify_if_u32(s: &mut (dyn Any + Send + Sync)) {
     ///     if let Some(num) = s.downcast_mut::<u32>() {
     ///         *num = 42;
     ///     }
index e9ccdd0ea3c578ee0fdbb6fa820cb50e9f70efb9..160728f923dbcbac4fa5a65b67121c504c4119d7 100644 (file)
@@ -19,7 +19,7 @@
 /// Converts a `u32` to a `char`.
 ///
 /// Note that all [`char`]s are valid [`u32`]s, and can be cast to one with
-/// [`as`]:
+/// `as`:
 ///
 /// ```
 /// let c = '💯';
@@ -34,7 +34,6 @@
 ///
 /// [`char`]: ../../std/primitive.char.html
 /// [`u32`]: ../../std/primitive.u32.html
-/// [`as`]: ../../book/first-edition/casting-between-types.html#as
 ///
 /// For an unsafe version of this function which ignores these checks, see
 /// [`from_u32_unchecked`].
@@ -71,7 +70,7 @@ pub fn from_u32(i: u32) -> Option<char> {
 /// Converts a `u32` to a `char`, ignoring validity.
 ///
 /// Note that all [`char`]s are valid [`u32`]s, and can be cast to one with
-/// [`as`]:
+/// `as`:
 ///
 /// ```
 /// let c = '💯';
@@ -86,7 +85,6 @@ pub fn from_u32(i: u32) -> Option<char> {
 ///
 /// [`char`]: ../../std/primitive.char.html
 /// [`u32`]: ../../std/primitive.u32.html
-/// [`as`]: ../../book/first-edition/casting-between-types.html#as
 ///
 /// # Safety
 ///
index 2903c370df898e3d107f6946d14268dd69f09693..fd4189ef50df54a9466ca3aa159f5692cd05506f 100644 (file)
@@ -532,7 +532,7 @@ fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where
     /// If you're doing some sort of looping for a side effect, it's considered
     /// more idiomatic to use [`for`] than `map()`.
     ///
-    /// [`for`]: ../../book/first-edition/loops.html#for
+    /// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
     ///
     /// # Examples
     ///
@@ -580,7 +580,7 @@ fn map<B, F>(self, f: F) -> Map<Self, F> where
     /// cases `for_each` may also be faster than a loop, because it will use
     /// internal iteration on adaptors like `Chain`.
     ///
-    /// [`for`]: ../../book/first-edition/loops.html#for
+    /// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
     ///
     /// # Examples
     ///
@@ -1669,7 +1669,7 @@ fn try_for_each<F, R>(&mut self, mut f: F) -> R where
     /// use a `for` loop with a list of things to build up a result. Those
     /// can be turned into `fold()`s:
     ///
-    /// [`for`]: ../../book/first-edition/loops.html#for
+    /// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
     ///
     /// ```
     /// let numbers = [1, 2, 3, 4, 5];
index c42fb7019c77108f2f79d262aade754e71bf33ae..509068843d193b15cba6e168e8a3fd195baadf72 100644 (file)
 use cmp;
 use fmt;
 use iter_private::TrustedRandomAccess;
-use ops::{self, Try};
+use ops::Try;
 use usize;
 use intrinsics;
-use mem;
 
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use self::iterator::Iterator;
@@ -673,7 +672,12 @@ impl<I> Iterator for StepBy<I> where I: Iterator {
 
     #[inline]
     fn next(&mut self) -> Option<Self::Item> {
-        <Self as StepBySpecIterator>::spec_next(self)
+        if self.first_take {
+            self.first_take = false;
+            self.iter.next()
+        } else {
+            self.iter.nth(self.step)
+        }
     }
 
     #[inline]
@@ -733,78 +737,6 @@ fn nth(&mut self, mut n: usize) -> Option<Self::Item> {
     }
 }
 
-// hidden trait for specializing iterator methods
-// could be generalized but is currently only used for StepBy
-trait StepBySpecIterator {
-    type Item;
-    fn spec_next(&mut self) -> Option<Self::Item>;
-}
-
-impl<I> StepBySpecIterator for StepBy<I>
-where
-    I: Iterator,
-{
-    type Item = I::Item;
-
-    #[inline]
-    default fn spec_next(&mut self) -> Option<I::Item> {
-        if self.first_take {
-            self.first_take = false;
-            self.iter.next()
-        } else {
-            self.iter.nth(self.step)
-        }
-    }
-}
-
-impl<T> StepBySpecIterator for StepBy<ops::Range<T>>
-where
-    T: Step,
-{
-    #[inline]
-    fn spec_next(&mut self) -> Option<Self::Item> {
-        self.first_take = false;
-        if !(self.iter.start < self.iter.end) {
-            return None;
-        }
-        // add 1 to self.step to get original step size back
-        // it was decremented for the general case on construction
-        if let Some(n) = self.iter.start.add_usize(self.step+1) {
-            let next = mem::replace(&mut self.iter.start, n);
-            Some(next)
-        } else {
-            let last = self.iter.start.clone();
-            self.iter.start = self.iter.end.clone();
-            Some(last)
-        }
-    }
-}
-
-impl<T> StepBySpecIterator for StepBy<ops::RangeInclusive<T>>
-where
-    T: Step,
-{
-    #[inline]
-    fn spec_next(&mut self) -> Option<Self::Item> {
-        self.first_take = false;
-        self.iter.compute_is_empty();
-        if self.iter.is_empty.unwrap_or_default() {
-            return None;
-        }
-        // add 1 to self.step to get original step size back
-        // it was decremented for the general case on construction
-        if let Some(n) = self.iter.start.add_usize(self.step+1) {
-            self.iter.is_empty = Some(!(n <= self.iter.end));
-            let next = mem::replace(&mut self.iter.start, n);
-            Some(next)
-        } else {
-            let last = self.iter.start.clone();
-            self.iter.is_empty = Some(true);
-            Some(last)
-        }
-    }
-}
-
 // StepBy can only make the iterator shorter, so the len will still fit.
 #[stable(feature = "iterator_step_by", since = "1.28.0")]
 impl<I> ExactSizeIterator for StepBy<I> where I: ExactSizeIterator {}
index d8eec2bd9a6a2558e9f6c7fc65fd2400fe561913..56ba10c49f41f7d01c84ef509f904d481bd71eab 100644 (file)
 /// [uninit]: fn.uninitialized.html
 /// [clone]: ../clone/trait.Clone.html
 /// [swap]: fn.swap.html
-/// [FFI]: ../../book/first-edition/ffi.html
 /// [box]: ../../std/boxed/struct.Box.html
 /// [leak]: ../../std/boxed/struct.Box.html#method.leak
 /// [into_raw]: ../../std/boxed/struct.Box.html#method.into_raw
@@ -479,7 +478,7 @@ pub const fn needs_drop<T>() -> bool {
 ///
 /// This has the same effect as allocating space with
 /// [`mem::uninitialized`][uninit] and then zeroing it out. It is useful for
-/// [FFI] sometimes, but should generally be avoided.
+/// FFI sometimes, but should generally be avoided.
 ///
 /// There is no guarantee that an all-zero byte-pattern represents a valid value of
 /// some type `T`. If `T` has a destructor and the value is destroyed (due to
@@ -490,7 +489,6 @@ pub const fn needs_drop<T>() -> bool {
 /// many of the same caveats.
 ///
 /// [uninit]: fn.uninitialized.html
-/// [FFI]: ../../book/first-edition/ffi.html
 /// [ub]: ../../reference/behavior-considered-undefined.html
 ///
 /// # Examples
@@ -514,11 +512,9 @@ pub unsafe fn zeroed<T>() -> T {
 /// **This is incredibly dangerous and should not be done lightly. Deeply
 /// consider initializing your memory with a default value instead.**
 ///
-/// This is useful for [FFI] functions and initializing arrays sometimes,
+/// This is useful for FFI functions and initializing arrays sometimes,
 /// but should generally be avoided.
 ///
-/// [FFI]: ../../book/first-edition/ffi.html
-///
 /// # Undefined behavior
 ///
 /// It is [undefined behavior][ub] to read uninitialized memory, even just an
@@ -689,10 +685,9 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
 /// While this does call the argument's implementation of [`Drop`][drop],
 /// it will not release any borrows, as borrows are based on lexical scope.
 ///
-/// This effectively does nothing for
-/// [types which implement `Copy`](../../book/first-edition/ownership.html#copy-types),
-/// e.g. integers. Such values are copied and _then_ moved into the function,
-/// so the value persists after this function call.
+/// This effectively does nothing for types which implement `Copy`, e.g.
+/// integers. Such values are copied and _then_ moved into the function, so the
+/// value persists after this function call.
 ///
 /// This function is not magic; it is literally defined as
 ///
@@ -1021,7 +1016,7 @@ pub unsafe fn drop(slot: &mut ManuallyDrop<T>) {
 impl<T: ?Sized> Deref for ManuallyDrop<T> {
     type Target = T;
     #[inline]
-    fn deref(&self) -> &Self::Target {
+    fn deref(&self) -> &T {
         &self.value
     }
 }
@@ -1029,7 +1024,7 @@ fn deref(&self) -> &Self::Target {
 #[stable(feature = "manually_drop", since = "1.20.0")]
 impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
     #[inline]
-    fn deref_mut(&mut self) -> &mut Self::Target {
+    fn deref_mut(&mut self) -> &mut T {
         &mut self.value
     }
 }
index a7bfc3f51244720b5990f3bde99239b695250e38..e9cf11424cae1bd6a24f3ea9875c73e9de70e211 100644 (file)
@@ -58,7 +58,7 @@
 //! [`NonNull::dangling`] in such cases.
 //!
 //! [aliasing]: ../../nomicon/aliasing.html
-//! [book]: ../../book/second-edition/ch19-01-unsafe-rust.html#dereferencing-a-raw-pointer
+//! [book]: ../../book/ch19-01-unsafe-rust.html#dereferencing-a-raw-pointer
 //! [ub]: ../../reference/behavior-considered-undefined.html
 //! [null]: ./fn.null.html
 //! [zst]: ../../nomicon/exotic-sizes.html#zero-sized-types-zsts
index a95f05227fb8b1b38ef596cdacaae5744569c1f7..495b9afe86023ef6c06b3b615680ad5afc174c91 100644 (file)
 /// The representation of a trait object like `&SomeTrait`.
 ///
 /// This struct has the same layout as types like `&SomeTrait` and
-/// `Box<AnotherTrait>`. The [Trait Objects chapter of the
-/// Book][moreinfo] contains more details about the precise nature of
-/// these internals.
-///
-/// [moreinfo]: ../../book/first-edition/trait-objects.html#representation
+/// `Box<AnotherTrait>`.
 ///
 /// `TraitObject` is guaranteed to match layouts, but it is not the
 /// type of trait objects (e.g. the fields are not directly accessible
index 2476c07cbd9ca307baa5b8eaa676c4601492684c..ec09071b3d0f06feb7645ba603d861f5ee378739 100644 (file)
@@ -1618,6 +1618,13 @@ fn test_range_step() {
     assert_eq!((isize::MIN..isize::MAX).step_by(1).size_hint(), (usize::MAX, Some(usize::MAX)));
 }
 
+#[test]
+fn test_step_by_skip() {
+    assert_eq!((0..640).step_by(128).skip(1).collect::<Vec<_>>(), [128, 256, 384, 512]);
+    assert_eq!((0..=50).step_by(10).nth(3), Some(30));
+    assert_eq!((200..=255u8).step_by(10).nth(3), Some(230));
+}
+
 #[test]
 fn test_range_inclusive_step() {
     assert_eq!((0..=50).step_by(10).collect::<Vec<_>>(), [0, 10, 20, 30, 40, 50]);
index ddc5676c74eb55699c554f679729208db16829cb..63b749c548e2419157f53b19d5b6d5819c09f56c 100644 (file)
@@ -101,11 +101,11 @@ pub fn new(prev_graph: PreviousDepGraph,
         DepGraph {
             data: Some(Lrc::new(DepGraphData {
                 previous_work_products: prev_work_products,
-                dep_node_debug: Lock::new(Default::default()),
+                dep_node_debug: Default::default(),
                 current: Lock::new(CurrentDepGraph::new()),
                 previous: prev_graph,
                 colors: Lock::new(DepNodeColorMap::new(prev_graph_node_count)),
-                loaded_from_cache: Lock::new(Default::default()),
+                loaded_from_cache: Default::default(),
             })),
             fingerprints: Lrc::new(Lock::new(fingerprints)),
         }
index ce1e678043188c5d7802778b97f2e2aa65fb4997..7ac3b033437fa733dd9e3bca7cc12aaf63fec233 100644 (file)
@@ -244,9 +244,9 @@ pub fn lower_crate(
         loop_scopes: Vec::new(),
         is_in_loop_condition: false,
         anonymous_lifetime_mode: AnonymousLifetimeMode::PassThrough,
-        type_def_lifetime_params: DefIdMap(),
+        type_def_lifetime_params: Default::default(),
         current_hir_id_owner: vec![(CRATE_DEF_INDEX, 0)],
-        item_local_id_counters: NodeMap(),
+        item_local_id_counters: Default::default(),
         node_id_to_hir_id: IndexVec::new(),
         is_generator: false,
         is_in_trait_impl: false,
@@ -1168,7 +1168,7 @@ fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_>) -> hir::T
                             hir::TyKind::BareFn(P(hir::BareFnTy {
                                 generic_params: this.lower_generic_params(
                                     &f.generic_params,
-                                    &NodeMap(),
+                                    &NodeMap::default(),
                                     ImplTraitContext::disallowed(),
                                 ),
                                 unsafety: this.lower_unsafety(f.unsafety),
@@ -2467,7 +2467,7 @@ fn lower_generics(
         // FIXME: This could probably be done with less rightward drift. Also looks like two control
         //        paths where report_error is called are also the only paths that advance to after
         //        the match statement, so the error reporting could probably just be moved there.
-        let mut add_bounds: NodeMap<Vec<_>> = NodeMap();
+        let mut add_bounds: NodeMap<Vec<_>> = Default::default();
         for pred in &generics.where_clause.predicates {
             if let WherePredicate::BoundPredicate(ref bound_pred) = *pred {
                 'next_bound: for bound in &bound_pred.bounds {
@@ -2552,7 +2552,7 @@ fn lower_where_predicate(&mut self, pred: &WherePredicate) -> hir::WherePredicat
                         hir::WherePredicate::BoundPredicate(hir::WhereBoundPredicate {
                             bound_generic_params: this.lower_generic_params(
                                 bound_generic_params,
-                                &NodeMap(),
+                                &NodeMap::default(),
                                 ImplTraitContext::disallowed(),
                             ),
                             bounded_ty: this.lower_ty(bounded_ty, ImplTraitContext::disallowed()),
@@ -2636,8 +2636,11 @@ fn lower_poly_trait_ref(
         p: &PolyTraitRef,
         mut itctx: ImplTraitContext<'_>,
     ) -> hir::PolyTraitRef {
-        let bound_generic_params =
-            self.lower_generic_params(&p.bound_generic_params, &NodeMap(), itctx.reborrow());
+        let bound_generic_params = self.lower_generic_params(
+            &p.bound_generic_params,
+            &NodeMap::default(),
+            itctx.reborrow(),
+        );
         let trait_ref = self.with_parent_impl_lifetime_defs(
             &bound_generic_params,
             |this| this.lower_trait_ref(&p.trait_ref, itctx),
index dd6891540868db318949414b00067f531430577d..eb9bd183fd939a12d8defaa5240d64f4f3d716eb 100644 (file)
@@ -36,6 +36,7 @@
 /// Internally the DefPathTable holds a tree of DefKeys, where each DefKey
 /// stores the DefIndex of its parent.
 /// There is one DefPathTable for each crate.
+#[derive(Default)]
 pub struct DefPathTable {
     index_to_key: [Vec<DefKey>; 2],
     def_path_hashes: [Vec<DefPathHash>; 2],
@@ -153,7 +154,7 @@ fn decode<D: Decoder>(d: &mut D) -> Result<DefPathTable, D::Error> {
 /// The definition table containing node definitions.
 /// It holds the DefPathTable for local DefIds/DefPaths and it also stores a
 /// mapping from NodeIds to local DefIds.
-#[derive(Clone)]
+#[derive(Clone, Default)]
 pub struct Definitions {
     table: DefPathTable,
     node_to_def_index: NodeMap<DefIndex>,
@@ -412,20 +413,8 @@ impl Definitions {
     ///     ascending order.
     ///
     /// FIXME: there is probably a better place to put this comment.
-    pub fn new() -> Definitions {
-        Definitions {
-            table: DefPathTable {
-                index_to_key: [vec![], vec![]],
-                def_path_hashes: [vec![], vec![]],
-            },
-            node_to_def_index: NodeMap(),
-            def_index_to_node: [vec![], vec![]],
-            node_to_hir_id: IndexVec::new(),
-            parent_modules_of_macro_defs: Default::default(),
-            expansions_that_defined: Default::default(),
-            next_disambiguator: Default::default(),
-            def_index_to_span: Default::default(),
-        }
+    pub fn new() -> Self {
+        Self::default()
     }
 
     pub fn def_path_table(&self) -> &DefPathTable {
index 1c7c1b854da4545a45b4c035c3a49ba91faa68b5..7c623a1874e7b4cc7bbf51b05d19eab57294652c 100644 (file)
@@ -369,8 +369,7 @@ fn hash_stable<W: StableHasherResult>(&self,
             // times, we cache a stable hash of it and hash that instead of
             // recursing every time.
             thread_local! {
-                static CACHE: RefCell<FxHashMap<hygiene::Mark, u64>> =
-                    RefCell::new(Default::default());
+                static CACHE: RefCell<FxHashMap<hygiene::Mark, u64>> = Default::default();
             }
 
             let sub_hash: u64 = CACHE.with(|cache| {
index 64685446e8fe14383a52e610b2fa96a5911eedde..679107160a6fc4a4785d6aea8639d401363cdd4a 100644 (file)
@@ -317,6 +317,10 @@ impl<'tcx> for enum mir::interpret::ConstValue<'tcx> [ mir::interpret::ConstValu
         ByRef(id, alloc, offset),
     }
 );
+impl_stable_hash_for!(struct ::mir::interpret::RawConst<'tcx> {
+    alloc_id,
+    ty,
+});
 
 impl_stable_hash_for! {
     impl<Tag> for struct mir::interpret::Pointer<Tag> {
index cc73dd63816aa466b4b75c1eaab89f59e65c120f..fda9817cc88ae0c621b681b844b15ccade8e6062 100644 (file)
@@ -121,7 +121,7 @@ pub fn instantiate_opaque_types<T: TypeFoldable<'tcx>>(
             parent_def_id,
             body_id,
             param_env,
-            opaque_types: DefIdMap(),
+            opaque_types: Default::default(),
             obligations: vec![],
         };
         let value = instantiator.instantiate_opaque_types_in_map(value);
index 46b12d01829e7089835c2090715878efd39a79f9..391bfc428c3bb49696f288a30456ee7a1e1627f6 100644 (file)
@@ -29,6 +29,7 @@
 
 mod taint;
 
+#[derive(Default)]
 pub struct RegionConstraintCollector<'tcx> {
     /// For each `RegionVid`, the corresponding `RegionVariableOrigin`.
     var_infos: IndexVec<RegionVid, RegionVariableInfo>,
@@ -341,17 +342,8 @@ pub fn both() -> Self {
 }
 
 impl<'tcx> RegionConstraintCollector<'tcx> {
-    pub fn new() -> RegionConstraintCollector<'tcx> {
-        RegionConstraintCollector {
-            var_infos: VarInfos::default(),
-            data: RegionConstraintData::default(),
-            lubs: Default::default(),
-            glbs: Default::default(),
-            bound_count: 0,
-            undo_log: Vec::new(),
-            unification_table: ut::UnificationTable::new(),
-            any_unifications: false,
-        }
+    pub fn new() -> Self {
+        Self::default()
     }
 
     pub fn num_region_vars(&self) -> usize {
index 01d87bdbf63374ff4b38e86f077bd8444c38fdfd..22f2023eefbd874693121105c5deefbe6a9c39e8 100644 (file)
     "warn about missing code example in an item's documentation"
 }
 
+declare_lint! {
+    pub PRIVATE_DOC_TESTS,
+    Allow,
+    "warn about doc test in private item"
+}
+
 declare_lint! {
     pub WHERE_CLAUSES_OBJECT_SAFETY,
     Warn,
@@ -415,6 +421,7 @@ fn get_lints(&self) -> LintArray {
             DUPLICATE_MACRO_EXPORTS,
             INTRA_DOC_LINK_RESOLUTION_FAILURE,
             MISSING_DOC_CODE_EXAMPLES,
+            PRIVATE_DOC_TESTS,
             WHERE_CLAUSES_OBJECT_SAFETY,
             PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
             MACRO_USE_EXTERN_CRATE,
index 8acbaaa844d74d06f64d4b52cd4c2843fcabd6f8..469d77403a3d82ae45faf16115eea847b7422bce 100644 (file)
@@ -1233,7 +1233,7 @@ pub fn check_ast_crate(
     let (passes, buffered) = if pre_expansion {
         (
             sess.lint_store.borrow_mut().pre_expansion_passes.take(),
-            LintBuffer::new(),
+            LintBuffer::default(),
         )
     } else {
         (
index 18922ec5d1739861c19c9de861441162979f2ef5..4b878b862526bde194af600cec2bfacc542cbcf7 100644 (file)
@@ -490,15 +490,12 @@ pub enum LintSource {
 
 pub use self::levels::{LintLevelSets, LintLevelMap};
 
+#[derive(Default)]
 pub struct LintBuffer {
     map: NodeMap<Vec<BufferedEarlyLint>>,
 }
 
 impl LintBuffer {
-    pub fn new() -> LintBuffer {
-        LintBuffer { map: NodeMap() }
-    }
-
     pub fn add_lint(&mut self,
                     lint: &'static Lint,
                     id: ast::NodeId,
index c8d513a59f00de4776015a98a67b7107aee3060a..633c58413780644ddf52d90ba6b7e55759cc5480 100644 (file)
 #[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
 pub enum SignalledError { SawSomeError, NoErrorsSeen }
 
+impl Default for SignalledError {
+    fn default() -> SignalledError {
+        SignalledError::NoErrorsSeen
+    }
+}
+
 impl_stable_hash_for!(enum self::SignalledError { SawSomeError, NoErrorsSeen });
 
-#[derive(Debug, RustcEncodable, RustcDecodable)]
+#[derive(Debug, Default, RustcEncodable, RustcDecodable)]
 pub struct BorrowCheckResult {
     pub used_mut_nodes: FxHashSet<HirId>,
     pub signalled_any_error: SignalledError,
index 1b258a23462c722b31a7e7875abb1ce38841b44e..54a0192d2e8a541376026c670de2d240ff04c01b 100644 (file)
@@ -272,9 +272,9 @@ fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> IrMaps<'a, 'tcx> {
             tcx,
             num_live_nodes: 0,
             num_vars: 0,
-            live_node_map: HirIdMap(),
-            variable_map: HirIdMap(),
-            capture_info_map: NodeMap(),
+            live_node_map: HirIdMap::default(),
+            variable_map: HirIdMap::default(),
+            capture_info_map: Default::default(),
             var_kinds: Vec::new(),
             lnks: Vec::new(),
         }
@@ -397,7 +397,7 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>,
 fn add_from_pat<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, pat: &P<hir::Pat>) {
     // For struct patterns, take note of which fields used shorthand
     // (`x` rather than `x: x`).
-    let mut shorthand_field_ids = HirIdSet();
+    let mut shorthand_field_ids = HirIdSet::default();
     let mut pats = VecDeque::new();
     pats.push_back(pat);
     while let Some(pat) = pats.pop_front() {
@@ -691,8 +691,8 @@ fn new(ir: &'a mut IrMaps<'a, 'tcx>, body: hir::BodyId) -> Liveness<'a, 'tcx> {
             s: specials,
             successors: vec![invalid_node(); num_live_nodes],
             rwu_table: RWUTable::new(num_live_nodes * num_vars),
-            break_ln: NodeMap(),
-            cont_ln: NodeMap(),
+            break_ln: Default::default(),
+            cont_ln: Default::default(),
         }
     }
 
index 8c3a3fb6dc1d82b30d50a295cbf4999696f8ebd6..0009a517dd1dba50232f940e451c42ed32c879b9 100644 (file)
@@ -408,7 +408,7 @@ fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) ->
     let mut reachable_context = ReachableContext {
         tcx,
         tables: &ty::TypeckTables::empty(None),
-        reachable_symbols: NodeSet(),
+        reachable_symbols: Default::default(),
         worklist: Vec::new(),
         any_library,
     };
index 79cd8b21f1b6aa7d7fd68499f4f8f604c4ca3553..6ff450508d13641a36d9de750e882e3de55c83ba 100644 (file)
@@ -425,8 +425,8 @@ fn resolve_lifetimes<'tcx>(
 fn krate<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> NamedRegionMap {
     let krate = tcx.hir.krate();
     let mut map = NamedRegionMap {
-        defs: NodeMap(),
-        late_bound: NodeSet(),
+        defs: Default::default(),
+        late_bound: Default::default(),
         object_lifetime_defaults: compute_object_lifetime_defaults(tcx),
     };
     {
@@ -437,8 +437,8 @@ fn krate<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> NamedRegionMap {
             trait_ref_hack: false,
             is_in_fn_syntax: false,
             labels_in_fn: vec![],
-            xcrate_object_lifetime_defaults: DefIdMap(),
-            lifetime_uses: &mut DefIdMap(),
+            xcrate_object_lifetime_defaults: Default::default(),
+            lifetime_uses: &mut Default::default(),
         };
         for (_, item) in &krate.items {
             visitor.visit_item(item);
@@ -1278,7 +1278,7 @@ fn check_if_label_shadows_lifetime(
 fn compute_object_lifetime_defaults(
     tcx: TyCtxt<'_, '_, '_>,
 ) -> NodeMap<Vec<ObjectLifetimeDefault>> {
-    let mut map = NodeMap();
+    let mut map = NodeMap::default();
     for item in tcx.hir.krate().items.values() {
         match item.node {
             hir::ItemKind::Struct(_, ref generics)
@@ -1432,7 +1432,7 @@ fn with<F>(&mut self, wrap_scope: Scope<'_>, f: F)
         } = self;
         let labels_in_fn = replace(&mut self.labels_in_fn, vec![]);
         let xcrate_object_lifetime_defaults =
-            replace(&mut self.xcrate_object_lifetime_defaults, DefIdMap());
+            replace(&mut self.xcrate_object_lifetime_defaults, DefIdMap::default());
         let mut this = LifetimeContext {
             tcx: *tcx,
             map: map,
@@ -2741,9 +2741,7 @@ fn insert_late_bound_lifetimes(
         constrained_by_input.visit_ty(arg_ty);
     }
 
-    let mut appears_in_output = AllCollector {
-        regions: Default::default(),
-    };
+    let mut appears_in_output = AllCollector::default();
     intravisit::walk_fn_ret_ty(&mut appears_in_output, &decl.output);
 
     debug!(
@@ -2755,9 +2753,7 @@ fn insert_late_bound_lifetimes(
     //
     // Subtle point: because we disallow nested bindings, we can just
     // ignore binders here and scrape up all names we see.
-    let mut appears_in_where_clause = AllCollector {
-        regions: Default::default(),
-    };
+    let mut appears_in_where_clause = AllCollector::default();
     appears_in_where_clause.visit_generics(generics);
 
     for param in &generics.params {
@@ -2854,6 +2850,7 @@ fn visit_lifetime(&mut self, lifetime_ref: &'v hir::Lifetime) {
         }
     }
 
+    #[derive(Default)]
     struct AllCollector {
         regions: FxHashSet<hir::LifetimeName>,
     }
index f1c95e0f00024a57204a55a8dfb0ce82b0947aa8..f1ac4b210583e6d935b6cc9983cf4284d798f171 100644 (file)
@@ -16,7 +16,7 @@
 use ty::layout::{Size, Align, LayoutError};
 use rustc_target::spec::abi::Abi;
 
-use super::{Pointer, InboundsCheck, ScalarMaybeUndef};
+use super::{RawConst, Pointer, InboundsCheck, ScalarMaybeUndef};
 
 use backtrace::Backtrace;
 
@@ -46,6 +46,7 @@ pub fn assert_reported(self) {
     }
 }
 
+pub type ConstEvalRawResult<'tcx> = Result<RawConst<'tcx>, ErrorHandled>;
 pub type ConstEvalResult<'tcx> = Result<&'tcx ty::Const<'tcx>, ErrorHandled>;
 
 #[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
index ec25431bd1ffe505ad1b40ea817cfe90a63af481..9369b6e56f1d018f3992c096ccc648da1dedcc62 100644 (file)
@@ -22,10 +22,10 @@ macro_rules! err {
 
 pub use self::error::{
     EvalError, EvalResult, EvalErrorKind, AssertMessage, ConstEvalErr, struct_error,
-    FrameInfo, ConstEvalResult, ErrorHandled,
+    FrameInfo, ConstEvalRawResult, ConstEvalResult, ErrorHandled,
 };
 
-pub use self::value::{Scalar, ConstValue, ScalarMaybeUndef};
+pub use self::value::{Scalar, ScalarMaybeUndef, RawConst, ConstValue};
 
 pub use self::allocation::{
     InboundsCheck, Allocation, AllocationExtra,
index 47c42c9431a210325e7e8ab9130268c22411ca83..4bcba9d54674e3f7f610b59ab4bfaa2c26170b01 100644 (file)
 
 use std::fmt;
 
-use ty::layout::{HasDataLayout, Size};
-use ty::subst::Substs;
-use hir::def_id::DefId;
+use crate::ty::{Ty, subst::Substs, layout::{HasDataLayout, Size}};
+use crate::hir::def_id::DefId;
 
 use super::{EvalResult, Pointer, PointerArithmetic, Allocation, AllocId, sign_extend, truncate};
 
+/// Represents the result of a raw const operation, pre-validation.
+#[derive(Copy, Clone, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable, Hash)]
+pub struct RawConst<'tcx> {
+    // the value lives here, at offset 0, and that allocation definitely is a `AllocType::Memory`
+    // (so you can use `AllocMap::unwrap_memory`).
+    pub alloc_id: AllocId,
+    pub ty: Ty<'tcx>,
+}
+
 /// Represents a constant value in Rust. Scalar and ScalarPair are optimizations which
 /// matches the LocalValue optimizations for easy conversions between Value and ConstValue.
 #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)]
@@ -23,6 +31,7 @@ pub enum ConstValue<'tcx> {
     /// Never returned from the `const_eval` query, but the HIR contains these frequently in order
     /// to allow HIR creation to happen for everything before needing to be able to run constant
     /// evaluation
+    /// FIXME: The query should then return a type that does not even have this variant.
     Unevaluated(DefId, &'tcx Substs<'tcx>),
 
     /// Used only for types with layout::abi::Scalar ABI and ZSTs
index 8582900b72c83c5b120a7cf5ee33a374cd174425..d688d93b80842c6734841c7b4951b2bb7db6460a 100644 (file)
@@ -1149,7 +1149,7 @@ pub fn build_session_(
         local_crate_source_file,
         working_dir,
         lint_store: RwLock::new(lint::LintStore::new()),
-        buffered_lints: Lock::new(Some(lint::LintBuffer::new())),
+        buffered_lints: Lock::new(Some(Default::default())),
         one_time_diagnostics: Default::default(),
         plugin_llvm_passes: OneThread::new(RefCell::new(Vec::new())),
         plugin_attributes: OneThread::new(RefCell::new(Vec::new())),
index 2761a954cea88deb69adb23334728fb9cb839698..48b2b25d6adf917d54a244cf70c24dfbb1dcd254 100644 (file)
@@ -1092,13 +1092,27 @@ pub fn report_arg_count_mismatch(
         if let Some(found_span) = found_span {
             err.span_label(found_span, format!("takes {}", found_str));
 
+            // move |_| { ... }
+            // ^^^^^^^^-- def_span
+            //
+            // move |_| { ... }
+            // ^^^^^-- prefix
+            let prefix_span = self.tcx.sess.source_map().span_until_non_whitespace(found_span);
+            // move |_| { ... }
+            //      ^^^-- pipe_span
+            let pipe_span = if let Some(span) = found_span.trim_start(prefix_span) {
+                span
+            } else {
+                found_span
+            };
+
             // Suggest to take and ignore the arguments with expected_args_length `_`s if
             // found arguments is empty (assume the user just wants to ignore args in this case).
             // For example, if `expected_args_length` is 2, suggest `|_, _|`.
             if found_args.is_empty() && is_closure {
                 let underscores = vec!["_"; expected_args.len()].join(", ");
                 err.span_suggestion_with_applicability(
-                    found_span,
+                    pipe_span,
                     &format!(
                         "consider changing the closure to take and ignore the expected argument{}",
                         if expected_args.len() < 2 {
index 923d362c2345ff6a4fcdcdd163de411683463da4..a8ce52a8e156ce676a49edb458295536eda9ec4e 100644 (file)
@@ -446,22 +446,22 @@ impl<'tcx> TypeckTables<'tcx> {
     pub fn empty(local_id_root: Option<DefId>) -> TypeckTables<'tcx> {
         TypeckTables {
             local_id_root,
-            type_dependent_defs: ItemLocalMap(),
-            field_indices: ItemLocalMap(),
-            user_provided_tys: ItemLocalMap(),
+            type_dependent_defs: Default::default(),
+            field_indices: Default::default(),
+            user_provided_tys: Default::default(),
             user_provided_sigs: Default::default(),
-            node_types: ItemLocalMap(),
-            node_substs: ItemLocalMap(),
-            user_substs: ItemLocalMap(),
-            adjustments: ItemLocalMap(),
-            pat_binding_modes: ItemLocalMap(),
-            pat_adjustments: ItemLocalMap(),
+            node_types: Default::default(),
+            node_substs: Default::default(),
+            user_substs: Default::default(),
+            adjustments: Default::default(),
+            pat_binding_modes: Default::default(),
+            pat_adjustments: Default::default(),
             upvar_capture_map: Default::default(),
-            closure_kind_origins: ItemLocalMap(),
-            liberated_fn_sigs: ItemLocalMap(),
-            fru_field_types: ItemLocalMap(),
-            cast_kinds: ItemLocalMap(),
-            used_trait_imports: Lrc::new(DefIdSet()),
+            closure_kind_origins: Default::default(),
+            liberated_fn_sigs: Default::default(),
+            fru_field_types: Default::default(),
+            cast_kinds: Default::default(),
+            used_trait_imports: Lrc::new(Default::default()),
             tainted_by_errors: false,
             free_region_map: Default::default(),
             concrete_existential_types: Default::default(),
index dfdffa2d54783dcb87baf7a6b9571ab000c931d8..ad200449f8907dda9adb00be03bb31e0b7044499 100644 (file)
@@ -3183,7 +3183,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
 /// rather, you should request the vector for a specific type via
 /// `tcx.inherent_impls(def_id)` so as to minimize your dependencies
 /// (constructing this map requires touching the entire crate).
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, Default)]
 pub struct CrateInherentImpls {
     pub inherent_impls: DefIdMap<Lrc<Vec<DefId>>>,
 }
index 89e7f4db502bb73138e73cdc1a23e0733d298dfe..22bd1e26ba3eea36d86e2e30da850cbd1c44b178 100644 (file)
@@ -27,7 +27,7 @@
 use middle::lib_features::LibFeatures;
 use middle::lang_items::{LanguageItems, LangItem};
 use middle::exported_symbols::{SymbolExportLevel, ExportedSymbol};
-use mir::interpret::ConstEvalResult;
+use mir::interpret::{ConstEvalRawResult, ConstEvalResult};
 use mir::mono::CodegenUnit;
 use mir;
 use mir::interpret::GlobalId;
         /// validation. Please add a comment to every use site explaining why using `const_eval`
         /// isn't sufficient
         [] fn const_eval_raw: const_eval_raw_dep_node(ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
-            -> ConstEvalResult<'tcx>,
+            -> ConstEvalRawResult<'tcx>,
 
         /// Results of evaluating const items or constants embedded in
         /// other items (such as enum variant explicit discriminants).
index dbd3e00d9fd1da2de58bde4106ea64bafc56d2c5..6adfe2cde6c3b227078102eb45733f01046863a8 100644 (file)
@@ -10,8 +10,6 @@
 
 //! An efficient hash map for node IDs
 
-#![allow(non_snake_case)]
-
 use hir::def_id::DefId;
 use hir::{HirId, ItemLocalId};
 use syntax::ast;
@@ -22,9 +20,7 @@
 macro_rules! define_id_collections {
     ($map_name:ident, $set_name:ident, $key:ty) => {
         pub type $map_name<T> = FxHashMap<$key, T>;
-        pub fn $map_name<T>() -> $map_name<T> { Default::default() }
         pub type $set_name = FxHashSet<$key>;
-        pub fn $set_name() -> $set_name { Default::default() }
     }
 }
 
index 9784cc6cf9c80054f0126da502405bea656b12a8..6dd13447fb559fc8c6c31df5842c77305138f736 100644 (file)
@@ -106,7 +106,7 @@ pub fn new(llmod: &'a llvm::Module) -> Self {
             created_files: Default::default(),
             created_enum_disr_types: Default::default(),
             type_map: Default::default(),
-            namespace_map: RefCell::new(DefIdMap()),
+            namespace_map: RefCell::new(Default::default()),
             composite_types_completed: Default::default(),
         }
     }
index da9cfbb94d1c5425ba2df5239fc51a1723e2337e..ec5ca5801049eebe45b8d74bfcf98bb0c6b06f3b 100644 (file)
@@ -1050,6 +1050,10 @@ fn cross_lang_lto(&mut self) {
 }
 
 fn exported_symbols(tcx: TyCtxt, crate_type: CrateType) -> Vec<String> {
+    if let Some(ref exports) = tcx.sess.target.target.options.override_export_symbols {
+        return exports.clone()
+    }
+
     let mut symbols = Vec::new();
 
     let export_threshold = symbol_export::crates_export_threshold(&[crate_type]);
index dff7e518630e4d23628aea3f6db9000caf04a35a..0463da00c89d98d9134952f7bd560c427ee58001 100644 (file)
@@ -64,7 +64,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     assert_eq!(cnum, LOCAL_CRATE);
 
     if !tcx.sess.opts.output_types.should_codegen() {
-        return Lrc::new(DefIdMap())
+        return Default::default();
     }
 
     // Check to see if this crate is a "special runtime crate". These
@@ -299,7 +299,7 @@ fn upstream_monomorphizations_provider<'a, 'tcx>(
 
     let cnums = tcx.all_crate_nums(LOCAL_CRATE);
 
-    let mut instances: DefIdMap<FxHashMap<_, _>> = DefIdMap();
+    let mut instances: DefIdMap<FxHashMap<_, _>> = Default::default();
 
     let cnum_stable_ids: IndexVec<CrateNum, Fingerprint> = {
         let mut cnum_stable_ids = IndexVec::from_elem_n(Fingerprint::ZERO,
index 79f073d643ddcb437641cc0f5bc7804292e0b1d1..5b3dd38adf23f98a8eb8eb16a3f2e84e89d3bc8f 100644 (file)
@@ -9,7 +9,7 @@ path = "lib.rs"
 crate-type = ["dylib"]
 
 [dependencies]
-ena = "0.9.3"
+ena = "0.10.1"
 log = "0.4"
 rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
 serialize = { path = "../libserialize" }
index bce21f5085c7c9b4d31133667853f08db01592a3..7c7fc3a934620e15f216a2de8f5c8b87b9efa02b 100644 (file)
@@ -8,6 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub use rustc_hash::FxHashMap;
-pub use rustc_hash::FxHashSet;
-pub use rustc_hash::FxHasher;
+pub use rustc_hash::{FxHasher, FxHashMap, FxHashSet};
index f8663cd4fd43677a30b866e9dc12950f5cec8809..0b42cb1edddecc23eb9fde51fa32ec09e940f1f8 100644 (file)
@@ -23,6 +23,18 @@ pub struct SnapshotMap<K, V>
     undo_log: Vec<UndoLog<K, V>>,
 }
 
+// HACK(eddyb) manual impl avoids `Default` bounds on `K` and `V`.
+impl<K, V> Default for SnapshotMap<K, V>
+    where K: Hash + Clone + Eq
+{
+    fn default() -> Self {
+        SnapshotMap {
+            map: Default::default(),
+            undo_log: Default::default(),
+        }
+    }
+}
+
 pub struct Snapshot {
     len: usize,
 }
@@ -35,17 +47,6 @@ enum UndoLog<K, V> {
     Noop,
 }
 
-impl<K, V> Default for SnapshotMap<K, V>
-    where K: Hash + Clone + Eq
-{
-    fn default() -> Self {
-        SnapshotMap {
-            map: FxHashMap::default(),
-            undo_log: vec![],
-        }
-    }
-}
-
 impl<K, V> SnapshotMap<K, V>
     where K: Hash + Clone + Eq
 {
index e1318eb54d581df20643b9cd4d2d4bc486a738a6..fd5dfab9e61be6702d36a264810f8657e41cbe04 100644 (file)
@@ -42,6 +42,18 @@ pub struct TransitiveRelation<T: Clone + Debug + Eq + Hash> {
     closure: Lock<Option<BitMatrix<usize, usize>>>,
 }
 
+// HACK(eddyb) manual impl avoids `Default` bound on `T`.
+impl<T: Clone + Debug + Eq + Hash> Default for TransitiveRelation<T> {
+    fn default() -> Self {
+        TransitiveRelation {
+            elements: Default::default(),
+            map: Default::default(),
+            edges: Default::default(),
+            closure: Default::default(),
+        }
+    }
+}
+
 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug)]
 struct Index(usize);
 
@@ -51,17 +63,6 @@ struct Edge {
     target: Index,
 }
 
-impl<T: Clone + Debug + Eq + Hash> Default for TransitiveRelation<T> {
-    fn default() -> TransitiveRelation<T> {
-        TransitiveRelation {
-            elements: vec![],
-            map: FxHashMap::default(),
-            edges: vec![],
-            closure: Lock::new(None),
-        }
-    }
-}
-
 impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> {
     pub fn is_empty(&self) -> bool {
         self.edges.is_empty()
index bef7b364d844780b238a87d8c23980db9ff298a1..7dd1ca3493e9d12b9a656376b050c7c6e6861b97 100644 (file)
@@ -603,7 +603,7 @@ fn check_item(&mut self, cx: &LateContext, item: &hir::Item) {
         };
 
         if self.impling_types.is_none() {
-            let mut impls = NodeSet();
+            let mut impls = NodeSet::default();
             cx.tcx.for_each_impl(debug, |d| {
                 if let Some(ty_def) = cx.tcx.type_of(d).ty_adt_def() {
                     if let Some(node_id) = cx.tcx.hir.as_local_node_id(ty_def.did) {
index 7eab7d21002905778c494089850c05c9b957bdf4..fab618d9c8ec843b23763a95188db35dca20fba2 100644 (file)
@@ -60,18 +60,39 @@ fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
         }
 
         let t = cx.tables.expr_ty(&expr);
-        // FIXME(varkor): replace with `t.is_unit() || t.conservative_is_uninhabited()`.
-        let type_permits_no_use = match t.sty {
-            ty::Tuple(ref tys) if tys.is_empty() => true,
-            ty::Never => true,
-            ty::Adt(def, _) => {
-                if def.variants.is_empty() {
-                    true
-                } else {
-                    check_must_use(cx, def.did, s.span, "")
+        let type_permits_lack_of_use = if t.is_unit()
+            || cx.tcx.is_ty_uninhabited_from(cx.tcx.hir.get_module_parent(expr.id), t) {
+            true
+        } else {
+            match t.sty {
+                ty::Adt(def, _) => check_must_use(cx, def.did, s.span, "", ""),
+                ty::Opaque(def, _) => {
+                    let mut must_use = false;
+                    for (predicate, _) in &cx.tcx.predicates_of(def).predicates {
+                        if let ty::Predicate::Trait(ref poly_trait_predicate) = predicate {
+                            let trait_ref = poly_trait_predicate.skip_binder().trait_ref;
+                            if check_must_use(cx, trait_ref.def_id, s.span, "implementer of ", "") {
+                                must_use = true;
+                                break;
+                            }
+                        }
+                    }
+                    must_use
+                }
+                ty::Dynamic(binder, _) => {
+                    let mut must_use = false;
+                    for predicate in binder.skip_binder().iter() {
+                        if let ty::ExistentialPredicate::Trait(ref trait_ref) = predicate {
+                            if check_must_use(cx, trait_ref.def_id, s.span, "", " trait object") {
+                                must_use = true;
+                                break;
+                            }
+                        }
+                    }
+                    must_use
                 }
+                _ => false,
             }
-            _ => false,
         };
 
         let mut fn_warned = false;
@@ -98,8 +119,8 @@ fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
         };
         if let Some(def) = maybe_def {
             let def_id = def.def_id();
-            fn_warned = check_must_use(cx, def_id, s.span, "return value of ");
-        } else if type_permits_no_use {
+            fn_warned = check_must_use(cx, def_id, s.span, "return value of ", "");
+        } else if type_permits_lack_of_use {
             // We don't warn about unused unit or uninhabited types.
             // (See https://github.com/rust-lang/rust/issues/43806 for details.)
             return;
@@ -148,15 +169,21 @@ fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
             op_warned = true;
         }
 
-        if !(type_permits_no_use || fn_warned || op_warned) {
+        if !(type_permits_lack_of_use || fn_warned || op_warned) {
             cx.span_lint(UNUSED_RESULTS, s.span, "unused result");
         }
 
-        fn check_must_use(cx: &LateContext, def_id: DefId, sp: Span, describe_path: &str) -> bool {
+        fn check_must_use(
+            cx: &LateContext,
+            def_id: DefId,
+            sp: Span,
+            descr_pre_path: &str,
+            descr_post_path: &str,
+        ) -> bool {
             for attr in cx.tcx.get_attrs(def_id).iter() {
                 if attr.check_name("must_use") {
-                    let msg = format!("unused {}`{}` that must be used",
-                                          describe_path, cx.tcx.item_path_str(def_id));
+                    let msg = format!("unused {}`{}`{} that must be used",
+                        descr_pre_path, cx.tcx.item_path_str(def_id), descr_post_path);
                     let mut err = cx.struct_span_lint(UNUSED_MUST_USE, sp, &msg);
                     // check for #[must_use = "..."]
                     if let Some(note) = attr.value_str() {
index e1d9ca5339e6a4201114ff324a10e79346db6e04..c7bd1744a3d6d53dfea9f4282c02bb8bf41f074d 100644 (file)
@@ -316,7 +316,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
             use std::collections::hash_map::Entry;
 
             assert_eq!(cnum, LOCAL_CRATE);
-            let mut visible_parent_map: DefIdMap<DefId> = DefIdMap();
+            let mut visible_parent_map: DefIdMap<DefId> = Default::default();
 
             // Issue 46112: We want the map to prefer the shortest
             // paths when reporting the path to an item. Therefore we
index 0aa1924c0e59c693df6a4524a569418391aa0111..d95a74be77696018fffe42c381b30c9885af4e69 100644 (file)
@@ -829,7 +829,7 @@ fn new(hir: Cx<'a, 'gcx, 'tcx>,
                 1,
             ),
             upvar_decls,
-            var_indices: NodeMap(),
+            var_indices: Default::default(),
             unit_temp: None,
             cached_resume_block: None,
             cached_return_block: None,
index 51046399ec2017bed8a78d95f84f155f6fc38bd1..3b32fe21adf8377c051f011e91b967e25bb153da 100644 (file)
@@ -31,8 +31,8 @@
 use syntax::ast::Mutability;
 use syntax::source_map::{Span, DUMMY_SP};
 
-use interpret::{self,
-    PlaceTy, MemPlace, OpTy, Operand, Immediate, Scalar, ConstValue, Pointer,
+use crate::interpret::{self,
+    PlaceTy, MPlaceTy, MemPlace, OpTy, Operand, Immediate, Scalar, RawConst, ConstValue, Pointer,
     EvalResult, EvalError, EvalErrorKind, GlobalId, EvalContext, StackPopCleanup,
     Allocation, AllocId, MemoryKind,
     snapshot, RefTracking,
@@ -94,11 +94,12 @@ pub(crate) fn eval_promoted<'a, 'mir, 'tcx>(
     cid: GlobalId<'tcx>,
     mir: &'mir mir::Mir<'tcx>,
     param_env: ty::ParamEnv<'tcx>,
-) -> EvalResult<'tcx, OpTy<'tcx>> {
+) -> EvalResult<'tcx, MPlaceTy<'tcx>> {
     let mut ecx = mk_borrowck_eval_cx(tcx, cid.instance, mir, DUMMY_SP).unwrap();
     eval_body_using_ecx(&mut ecx, cid, Some(mir), param_env)
 }
 
+// FIXME: These two conversion functions are bad hacks.  We should just always use allocations.
 pub fn op_to_const<'tcx>(
     ecx: &CompileTimeEvalContext<'_, '_, 'tcx>,
     op: OpTy<'tcx>,
@@ -144,13 +145,20 @@ pub fn op_to_const<'tcx>(
     };
     Ok(ty::Const::from_const_value(ecx.tcx.tcx, val, op.layout.ty))
 }
+pub fn const_to_op<'tcx>(
+    ecx: &CompileTimeEvalContext<'_, '_, 'tcx>,
+    cnst: &ty::Const<'tcx>,
+) -> EvalResult<'tcx, OpTy<'tcx>> {
+    let op = ecx.const_value_to_op(cnst.val)?;
+    Ok(OpTy { op, layout: ecx.layout_of(cnst.ty)? })
+}
 
 fn eval_body_and_ecx<'a, 'mir, 'tcx>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     cid: GlobalId<'tcx>,
     mir: Option<&'mir mir::Mir<'tcx>>,
     param_env: ty::ParamEnv<'tcx>,
-) -> (EvalResult<'tcx, OpTy<'tcx>>, CompileTimeEvalContext<'a, 'mir, 'tcx>) {
+) -> (EvalResult<'tcx, MPlaceTy<'tcx>>, CompileTimeEvalContext<'a, 'mir, 'tcx>) {
     // we start out with the best span we have
     // and try improving it down the road when more information is available
     let span = tcx.def_span(cid.instance.def_id());
@@ -166,7 +174,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
     cid: GlobalId<'tcx>,
     mir: Option<&'mir mir::Mir<'tcx>>,
     param_env: ty::ParamEnv<'tcx>,
-) -> EvalResult<'tcx, OpTy<'tcx>> {
+) -> EvalResult<'tcx, MPlaceTy<'tcx>> {
     debug!("eval_body_using_ecx: {:?}, {:?}", cid, param_env);
     let tcx = ecx.tcx.tcx;
     let mut mir = match mir {
@@ -206,7 +214,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
     ecx.memory.intern_static(ret.ptr.to_ptr()?.alloc_id, mutability)?;
 
     debug!("eval_body_using_ecx done: {:?}", *ret);
-    Ok(ret.into())
+    Ok(ret)
 }
 
 impl<'tcx> Into<EvalError<'tcx>> for ConstEvalError {
@@ -494,7 +502,7 @@ pub fn const_field<'a, 'tcx>(
     let ecx = mk_eval_cx(tcx, instance, param_env).unwrap();
     let result = (|| {
         // get the operand again
-        let op = ecx.const_to_op(value)?;
+        let op = const_to_op(&ecx, value)?;
         // downcast
         let down = match variant {
             None => op,
@@ -521,7 +529,7 @@ pub fn const_variant_index<'a, 'tcx>(
 ) -> EvalResult<'tcx, VariantIdx> {
     trace!("const_variant_index: {:?}, {:?}", instance, val);
     let ecx = mk_eval_cx(tcx, instance, param_env).unwrap();
-    let op = ecx.const_to_op(val)?;
+    let op = const_to_op(&ecx, val)?;
     Ok(ecx.read_discriminant(op)?.1)
 }
 
@@ -534,15 +542,17 @@ pub fn error_to_const_error<'a, 'mir, 'tcx>(
     ConstEvalErr { error: error.kind, stacktrace, span: ecx.tcx.span }
 }
 
-fn validate_const<'a, 'tcx>(
+fn validate_and_turn_into_const<'a, 'tcx>(
     tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
-    constant: &'tcx ty::Const<'tcx>,
+    constant: RawConst<'tcx>,
     key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,
 ) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> {
     let cid = key.value;
     let ecx = mk_eval_cx(tcx, cid.instance, key.param_env).unwrap();
     let val = (|| {
-        let op = ecx.const_to_op(constant)?;
+        let op = ecx.raw_const_to_mplace(constant)?.into();
+        // FIXME: Once the visitor infrastructure landed, change validation to
+        // work directly on `MPlaceTy`.
         let mut ref_tracking = RefTracking::new(op);
         while let Some((op, path)) = ref_tracking.todo.pop() {
             ecx.validate_operand(
@@ -552,7 +562,10 @@ fn validate_const<'a, 'tcx>(
                 /* const_mode */ true,
             )?;
         }
-        Ok(constant)
+        // Now that we validated, turn this into a proper constant
+        let def_id = cid.instance.def.def_id();
+        let normalize = tcx.is_static(def_id).is_none() && cid.promoted.is_none();
+        op_to_const(&ecx, op, normalize)
     })();
 
     val.map_err(|error| {
@@ -591,14 +604,14 @@ pub fn const_eval_provider<'a, 'tcx>(
         }
     }
     tcx.const_eval_raw(key).and_then(|val| {
-        validate_const(tcx, val, key)
+        validate_and_turn_into_const(tcx, val, key)
     })
 }
 
 pub fn const_eval_raw_provider<'a, 'tcx>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,
-) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> {
+) -> ::rustc::mir::interpret::ConstEvalRawResult<'tcx> {
     // Because the constant is computed twice (once per value of `Reveal`), we are at risk of
     // reporting the same error twice here. To resolve this, we check whether we can evaluate the
     // constant in the more restrictive `Reveal::UserFacing`, which most likely already was
@@ -648,16 +661,11 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
     };
 
     let (res, ecx) = eval_body_and_ecx(tcx, cid, None, key.param_env);
-    res.and_then(|op| {
-        let normalize = tcx.is_static(def_id).is_none() && cid.promoted.is_none();
-        if !normalize {
-            // Sanity check: These must always be a MemPlace
-            match op.op {
-                Operand::Indirect(_) => { /* all is good */ },
-                Operand::Immediate(_) => bug!("const eval gave us an Immediate"),
-            }
-        }
-        op_to_const(&ecx, op, normalize)
+    res.and_then(|place| {
+        Ok(RawConst {
+            alloc_id: place.to_ptr().expect("we allocated this ptr!").alloc_id,
+            ty: place.layout.ty
+        })
     }).map_err(|error| {
         let err = error_to_const_error(&ecx, error);
         // errors in statics are always emitted as fatal errors
index ce7269d1e78394f65c798d3337a3590d114079ac..59083413582469f231b98054250fce80ca0fc2b7 100644 (file)
@@ -588,18 +588,26 @@ pub(super) fn deallocate_local(
         Ok(())
     }
 
-    pub fn const_eval(&self, gid: GlobalId<'tcx>) -> EvalResult<'tcx, &'tcx ty::Const<'tcx>> {
+    pub fn const_eval_raw(
+        &self,
+        gid: GlobalId<'tcx>,
+    ) -> EvalResult<'tcx, MPlaceTy<'tcx, M::PointerTag>> {
         let param_env = if self.tcx.is_static(gid.instance.def_id()).is_some() {
             ty::ParamEnv::reveal_all()
         } else {
             self.param_env
         };
-        self.tcx.const_eval(param_env.and(gid)).map_err(|err| {
+        // We use `const_eval_raw` here, and get an unvalidated result.  That is okay:
+        // Our result will later be validated anyway, and there seems no good reason
+        // to have to fail early here.  This is also more consistent with
+        // `Memory::get_static_alloc` which has to use `const_eval_raw` to avoid cycles.
+        let val = self.tcx.const_eval_raw(param_env.and(gid)).map_err(|err| {
             match err {
-                ErrorHandled::Reported => EvalErrorKind::ReferencedConstant.into(),
-                ErrorHandled::TooGeneric => EvalErrorKind::TooGeneric.into(),
+                ErrorHandled::Reported => EvalErrorKind::ReferencedConstant,
+                ErrorHandled::TooGeneric => EvalErrorKind::TooGeneric,
             }
-        })
+        })?;
+        self.raw_const_to_mplace(val)
     }
 
     pub fn dump_place(&self, place: Place<M::PointerTag>) {
index c5a242f334c90ebedca7b1fc14bfcd7b150ace62..7dd42c6664968c3099af4f802e700e1dacda6ea3 100644 (file)
@@ -28,7 +28,7 @@
 use syntax::ast::Mutability;
 
 use super::{
-    Pointer, AllocId, Allocation, ConstValue, GlobalId, AllocationExtra, InboundsCheck,
+    Pointer, AllocId, Allocation, GlobalId, AllocationExtra, InboundsCheck,
     EvalResult, Scalar, EvalErrorKind, AllocType, PointerArithmetic,
     Machine, AllocMap, MayLeak, ScalarMaybeUndef, ErrorHandled,
 };
@@ -374,14 +374,11 @@ fn get_static_alloc(
                 ErrorHandled::Reported => EvalErrorKind::ReferencedConstant.into(),
                 ErrorHandled::TooGeneric => EvalErrorKind::TooGeneric.into(),
             }
-        }).map(|const_val| {
-            if let ConstValue::ByRef(_, allocation, _) = const_val.val {
-                // We got tcx memory. Let the machine figure out whether and how to
-                // turn that into memory with the right pointer tag.
-                M::adjust_static_allocation(allocation)
-            } else {
-                bug!("Matching on non-ByRef static")
-            }
+        }).map(|raw_const| {
+            let allocation = tcx.alloc_map.lock().unwrap_memory(raw_const.alloc_id);
+            // We got tcx memory. Let the machine figure out whether and how to
+            // turn that into memory with the right pointer tag.
+            M::adjust_static_allocation(allocation)
         })
     }
 
index b7910ad3bce9ed1adf8ece1a301320b9131c4942..5d993cfee084cc2c3aef5defcd4af0408d09c9e3 100644 (file)
@@ -13,7 +13,7 @@
 
 use std::convert::TryInto;
 
-use rustc::{mir, ty};
+use rustc::mir;
 use rustc::ty::layout::{self, Size, LayoutOf, TyLayout, HasDataLayout, IntegerExt, VariantIdx};
 
 use rustc::mir::interpret::{
@@ -535,8 +535,10 @@ pub(super) fn eval_operands(
             .collect()
     }
 
-    // Also used e.g. when miri runs into a constant.
-    pub(super) fn const_value_to_op(
+    // Used when miri runs into a constant, and by CTFE.
+    // FIXME: CTFE should use allocations, then we can make this private (embed it into
+    // `eval_operand`, ideally).
+    pub(crate) fn const_value_to_op(
         &self,
         val: ConstValue<'tcx>,
     ) -> EvalResult<'tcx, Operand<M::PointerTag>> {
@@ -544,10 +546,10 @@ pub(super) fn const_value_to_op(
         match val {
             ConstValue::Unevaluated(def_id, substs) => {
                 let instance = self.resolve(def_id, substs)?;
-                self.global_to_op(GlobalId {
+                Ok(*OpTy::from(self.const_eval_raw(GlobalId {
                     instance,
                     promoted: None,
-                })
+                })?))
             }
             ConstValue::ByRef(id, alloc, offset) => {
                 // We rely on mutability being set correctly in that allocation to prevent writes
@@ -565,21 +567,6 @@ pub(super) fn const_value_to_op(
                 Ok(Operand::Immediate(Immediate::Scalar(x.into())).with_default_tag()),
         }
     }
-    pub fn const_to_op(
-        &self,
-        cnst: &ty::Const<'tcx>,
-    ) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>> {
-        let op = self.const_value_to_op(cnst.val)?;
-        Ok(OpTy { op, layout: self.layout_of(cnst.ty)? })
-    }
-
-    pub(super) fn global_to_op(
-        &self,
-        gid: GlobalId<'tcx>
-    ) -> EvalResult<'tcx, Operand<M::PointerTag>> {
-        let cv = self.const_eval(gid)?;
-        self.const_value_to_op(cv.val)
-    }
 
     /// Read discriminant, return the runtime value as well as the variant index.
     pub fn read_discriminant(
index fa76eeb2fedd580a99233cd760233f4100bc28c2..9f248d46350740a4203504d32f0a96444ed5fc11 100644 (file)
 use rustc::ty::{self, Ty};
 use rustc::ty::layout::{self, Size, Align, LayoutOf, TyLayout, HasDataLayout, VariantIdx};
 
-use rustc::mir::interpret::{
-    GlobalId, AllocId, Allocation, Scalar, EvalResult, Pointer, PointerArithmetic
-};
 use super::{
+    GlobalId, AllocId, Allocation, Scalar, EvalResult, Pointer, PointerArithmetic,
     EvalContext, Machine, AllocMap, AllocationExtra,
-    Immediate, ImmTy, ScalarMaybeUndef, Operand, OpTy, MemoryKind
+    RawConst, Immediate, ImmTy, ScalarMaybeUndef, Operand, OpTy, MemoryKind
 };
 
 #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
@@ -555,16 +553,10 @@ pub(super) fn eval_place_to_mplace(
         Ok(match *mir_place {
             Promoted(ref promoted) => {
                 let instance = self.frame().instance;
-                let op = self.global_to_op(GlobalId {
+                self.const_eval_raw(GlobalId {
                     instance,
                     promoted: Some(promoted.0),
-                })?;
-                let mplace = op.to_mem_place(); // these are always in memory
-                let ty = self.monomorphize(promoted.1, self.substs());
-                MPlaceTy {
-                    mplace,
-                    layout: self.layout_of(ty)?,
-                }
+                })?
             }
 
             Static(ref static_) => {
@@ -981,6 +973,19 @@ pub fn place_to_op(
         Ok(OpTy { op, layout: place.layout })
     }
 
+    pub fn raw_const_to_mplace(
+        &self,
+        raw: RawConst<'tcx>,
+    ) -> EvalResult<'tcx, MPlaceTy<'tcx, M::PointerTag>> {
+        // This must be an allocation in `tcx`
+        assert!(self.tcx.alloc_map.lock().get(raw.alloc_id).is_some());
+        let layout = self.layout_of(raw.ty)?;
+        Ok(MPlaceTy::from_aligned_ptr(
+            Pointer::new(raw.alloc_id, Size::ZERO).with_default_tag(),
+            layout,
+        ))
+    }
+
     /// Turn a place with a `dyn Trait` type into a place with the actual dynamic type.
     /// Also return some more information so drop doesn't have to run the same code twice.
     pub(super) fn unpack_dyn_trait(&self, mplace: MPlaceTy<'tcx, M::PointerTag>)
index 8e27635dee8c13868c3d5e9a04cd1bf3289a83f0..b4ffb39a2ebd6ae48b599c7ff2c0c03388233eca 100644 (file)
@@ -314,7 +314,7 @@ pub fn collect_crate_mono_items<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
         time(tcx.sess, "collecting mono items", || {
             par_iter(roots).for_each(|root| {
-                let mut recursion_depths = DefIdMap();
+                let mut recursion_depths = DefIdMap::default();
                 collect_items_rec(tcx,
                                 root,
                                 visited,
index 885d70dc4304dee3e3cd02c3118df7555aab58b6..661ca4773b4a91939d0d3eade2d3ab2f3e9a9fa4 100644 (file)
@@ -29,7 +29,9 @@
 };
 
 use interpret::{self, EvalContext, ScalarMaybeUndef, Immediate, OpTy, MemoryKind};
-use const_eval::{CompileTimeInterpreter, error_to_const_error, eval_promoted, mk_borrowck_eval_cx};
+use const_eval::{
+    CompileTimeInterpreter, const_to_op, error_to_const_error, eval_promoted, mk_borrowck_eval_cx
+};
 use transform::{MirPass, MirSource};
 
 pub struct ConstProp;
@@ -262,7 +264,7 @@ fn eval_constant(
         source_info: SourceInfo,
     ) -> Option<Const<'tcx>> {
         self.ecx.tcx.span = source_info.span;
-        match self.ecx.const_to_op(c.literal) {
+        match const_to_op(&self.ecx, c.literal) {
             Ok(op) => {
                 Some((op, c.span))
             },
@@ -309,7 +311,7 @@ fn eval_place(&mut self, place: &Place<'tcx>, source_info: SourceInfo) -> Option
                     eval_promoted(this.tcx, cid, this.mir, this.param_env)
                 })?;
                 trace!("evaluated promoted {:?} to {:?}", promoted, res);
-                Some((res, source_info.span))
+                Some((res.into(), source_info.span))
             },
             _ => None,
         }
index 92cfcb3fd56cb4d3f04898c972206ff9e07349fb..8d3a04f9f3c2c52b9866b31f054bf3709d72f9ef 100644 (file)
@@ -72,7 +72,7 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum)
                       -> Lrc<DefIdSet> {
     assert_eq!(krate, LOCAL_CRATE);
 
-    let mut set = DefIdSet();
+    let mut set = DefIdSet::default();
 
     // All body-owners have MIR associated with them.
     set.extend(tcx.body_owners());
index ed13063cfdf1700d3abd4a64eaff14a5cd200f59..958e5efe3ec74e9b3ffde0f33324917fdd1d38ff 100644 (file)
@@ -365,10 +365,8 @@ fn check_terminator(
             cleanup: _,
         } => check_operand(tcx, mir, cond, span),
 
-        | TerminatorKind::FalseUnwind { .. } => span_bug!(
-            terminator.source_info.span,
-            "min_const_fn encountered `{:#?}`",
-            terminator
-        ),
+        TerminatorKind::FalseUnwind { .. } => {
+            Err((span, "loops are not allowed in const fn".into()))
+        },
     }
 }
index a90cccfa7a7749dd4e87d10a12c4d3c66d2207ab..099c6df32ad18cc55e47d81e98b9cbc2863683a2 100644 (file)
@@ -84,10 +84,10 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         tables: &ty::TypeckTables::empty(None),
         in_fn: false,
         in_static: false,
-        mut_rvalue_borrows: NodeSet(),
+        mut_rvalue_borrows: Default::default(),
         param_env: ty::ParamEnv::empty(),
         identity_substs: Substs::empty(),
-        result: ItemLocalSet(),
+        result: ItemLocalSet::default(),
     };
 
     // `def_id` should be a `Body` owner
index 5f8c7daea6e9bbc13024836076bf9449ec362da1..fbd6f6edd31c5af4bc6b1589e6e3a7c79b42fdd1 100644 (file)
@@ -1761,7 +1761,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             tcx,
             access_levels: &visitor.access_levels,
             in_variant: false,
-            old_error_set: NodeSet(),
+            old_error_set: Default::default(),
         };
         intravisit::walk_crate(&mut visitor, krate);
 
index ddcaf128bf5bbfad9ece862a83c0f3bca10f3b86..659ca1f5b9f3123e4dadfb9373a2c18d92401415 100644 (file)
@@ -162,7 +162,7 @@ pub fn check_crate(resolver: &mut Resolver, krate: &ast::Crate) {
 
     let mut visitor = UnusedImportCheckVisitor {
         resolver,
-        unused_imports: NodeMap(),
+        unused_imports: Default::default(),
         base_id: ast::DUMMY_NODE_ID,
         item_span: DUMMY_SP,
     };
index 7b2d1d4a3d53f6c61c7b1178722e62fd387a4e09..12dabd2a31da18b94d541d7c9b27a41482049d2a 100644 (file)
@@ -58,7 +58,6 @@
 use syntax::ext::base::SyntaxExtension;
 use syntax::ext::base::Determinacy::{self, Determined, Undetermined};
 use syntax::ext::base::MacroKind;
-use syntax::feature_gate::{emit_feature_err, GateIssue};
 use syntax::symbol::{Symbol, keywords};
 use syntax::util::lev_distance::find_best_match_for_name;
 
@@ -1862,22 +1861,22 @@ pub fn new(session: &'a Session,
 
             primitive_type_table: PrimitiveTypeTable::new(),
 
-            def_map: NodeMap(),
-            import_map: NodeMap(),
-            freevars: NodeMap(),
-            freevars_seen: NodeMap(),
+            def_map: Default::default(),
+            import_map: Default::default(),
+            freevars: Default::default(),
+            freevars_seen: Default::default(),
             export_map: FxHashMap::default(),
-            trait_map: NodeMap(),
+            trait_map: Default::default(),
             module_map,
-            block_map: NodeMap(),
+            block_map: Default::default(),
             extern_module_map: FxHashMap::default(),
             binding_parent_modules: FxHashMap::default(),
 
             make_glob_map: make_glob_map == MakeGlobMap::Yes,
-            glob_map: NodeMap(),
+            glob_map: Default::default(),
 
             used_imports: FxHashSet::default(),
-            maybe_unused_trait_imports: NodeSet(),
+            maybe_unused_trait_imports: Default::default(),
             maybe_unused_extern_crates: Vec::new(),
 
             unused_labels: FxHashMap::default(),
@@ -1907,7 +1906,7 @@ pub fn new(session: &'a Session,
             name_already_seen: FxHashMap::default(),
             whitelisted_legacy_custom_derives: Vec::new(),
             potentially_unused_imports: Vec::new(),
-            struct_constructors: DefIdMap(),
+            struct_constructors: Default::default(),
             found_unresolved_macro: false,
             unused_macros: FxHashSet::default(),
             current_type_ascription: Vec::new(),
@@ -2115,7 +2114,7 @@ fn resolve_ident_in_lexical_scope(&mut self,
 
         if !module.no_implicit_prelude {
             if ns == TypeNS {
-                if let Some(binding) = self.extern_prelude_get(ident, !record_used, false) {
+                if let Some(binding) = self.extern_prelude_get(ident, !record_used) {
                     return Some(LexicalScopeBinding::Item(binding));
                 }
             }
@@ -5022,7 +5021,7 @@ fn report_conflict<'b>(&mut self,
         self.name_already_seen.insert(name, span);
     }
 
-    fn extern_prelude_get(&mut self, ident: Ident, speculative: bool, skip_feature_gate: bool)
+    fn extern_prelude_get(&mut self, ident: Ident, speculative: bool)
                           -> Option<&'a NameBinding<'a>> {
         if ident.is_path_segment_keyword() {
             // Make sure `self`, `super` etc produce an error when passed to here.
@@ -5030,13 +5029,6 @@ fn extern_prelude_get(&mut self, ident: Ident, speculative: bool, skip_feature_g
         }
         self.extern_prelude.get(&ident.modern()).cloned().and_then(|entry| {
             if let Some(binding) = entry.extern_crate_item {
-                if !speculative && !skip_feature_gate && entry.introduced_by_item &&
-                   !self.session.features_untracked().extern_crate_item_prelude {
-                    emit_feature_err(&self.session.parse_sess, "extern_crate_item_prelude",
-                                     ident.span, GateIssue::Language,
-                                     "use of extern prelude names introduced \
-                                      with `extern crate` items is unstable");
-                }
                 Some(binding)
             } else {
                 let crate_id = if !speculative {
index 921f7568b5201ff99ff3d76d6cf717e14bf34802..581756dc6bf0b32b250a5203e2e6f92690aab78d 100644 (file)
@@ -738,8 +738,7 @@ struct Flags: u8 {
                 }
                 WhereToResolve::ExternPrelude => {
                     if use_prelude {
-                        match self.extern_prelude_get(ident, !record_used,
-                                                      innermost_result.is_some()) {
+                        match self.extern_prelude_get(ident, !record_used) {
                             Some(binding) => Ok((binding, Flags::PRELUDE)),
                             None => Err(Determinacy::determined(
                                 self.graph_root.unresolved_invocations.borrow().is_empty()
@@ -906,7 +905,7 @@ struct Flags: u8 {
                 // but its `Def` should coincide with a crate passed with `--extern`
                 // (otherwise there would be ambiguity) and we can skip feature error in this case.
                 if ns != TypeNS || !use_prelude ||
-                   self.extern_prelude_get(ident, true, false).is_none() {
+                   self.extern_prelude_get(ident, true).is_none() {
                     let msg = "imports can only refer to extern crate names \
                                passed with `--extern` on stable channel";
                     let mut err = feature_err(&self.session.parse_sess, "uniform_paths",
index 9e5036b6e500e25d43b0fd51926247596f2adf77..616cc9d2fc51b992d4c97adb2d7373395e99827d 100644 (file)
@@ -166,8 +166,7 @@ fn resolution(&self, module: Module<'a>, ident: Ident, ns: Namespace)
                 assert!(!restricted_shadowing);
                 match uniform_root_kind {
                     UniformRootKind::ExternPrelude => {
-                        return if let Some(binding) =
-                                self.extern_prelude_get(ident, !record_used, false) {
+                        return if let Some(binding) = self.extern_prelude_get(ident, !record_used) {
                             Ok(binding)
                         } else if !self.graph_root.unresolved_invocations.borrow().is_empty() {
                             // Macro-expanded `extern crate` items can add names to extern prelude.
@@ -843,12 +842,14 @@ fn finalize_import(
                 module
             }
             PathResult::Failed(span, msg, false) => {
-                assert!(directive.imported_module.get().is_none());
+                assert!(!self.ambiguity_errors.is_empty() ||
+                        directive.imported_module.get().is_none());
                 resolve_error(self, span, ResolutionError::FailedToResolve(&msg));
                 return None;
             }
             PathResult::Failed(span, msg, true) => {
-                assert!(directive.imported_module.get().is_none());
+                assert!(!self.ambiguity_errors.is_empty() ||
+                        directive.imported_module.get().is_none());
                 return if let Some((suggested_path, note)) = self.make_path_suggestion(
                     span, directive.module_path.clone(), &directive.parent_scope
                 ) {
@@ -1164,7 +1165,10 @@ fn finalize_resolutions_in(&mut self, module: Module<'b>) {
                 None => continue,
             };
 
-            if binding.is_import() || binding.is_macro_def() {
+            // Filter away "empty import canaries".
+            let is_non_canary_import =
+                binding.is_import() && binding.vis != ty::Visibility::Invisible;
+            if is_non_canary_import || binding.is_macro_def() {
                 let def = binding.def();
                 if def != Def::Err {
                     if let Some(def_id) = def.opt_def_id() {
index f67152ee90b7a0abcd9cd31b6291fd8fe4ad4f89..75ba4d9bd1105dbe6a2f1dd0a10cc9d6a80cdf7c 100644 (file)
@@ -414,6 +414,8 @@ fn $module() {
     ("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf),
 
     ("aarch64-unknown-none", aarch64_unknown_none),
+
+    ("x86_64-fortanix-unknown-sgx", x86_64_fortanix_unknown_sgx),
 }
 
 /// Everything `rustc` knows about how to compile for a specific target.
@@ -685,6 +687,10 @@ pub struct TargetOptions {
     /// target features. This is `true` by default, and `false` for targets like
     /// wasm32 where the whole program either has simd or not.
     pub simd_types_indirect: bool,
+
+    /// If set, have the linker export exactly these symbols, instead of using
+    /// the usual logic to figure this out from the crate itself.
+    pub override_export_symbols: Option<Vec<String>>
 }
 
 impl Default for TargetOptions {
@@ -765,6 +771,7 @@ fn default() -> TargetOptions {
             emit_debug_gdb_scripts: true,
             requires_uwtable: false,
             simd_types_indirect: true,
+            override_export_symbols: None,
         }
     }
 }
@@ -900,6 +907,14 @@ macro_rules! key {
                         )
                     );
             } );
+            ($key_name:ident, opt_list) => ( {
+                let name = (stringify!($key_name)).replace("_", "-");
+                obj.find(&name[..]).map(|o| o.as_array()
+                    .map(|v| base.options.$key_name = Some(v.iter()
+                        .map(|a| a.as_string().unwrap().to_string()).collect())
+                        )
+                    );
+            } );
             ($key_name:ident, optional) => ( {
                 let name = (stringify!($key_name)).replace("_", "-");
                 if let Some(o) = obj.find(&name[..]) {
@@ -1046,6 +1061,7 @@ macro_rules! key {
         key!(emit_debug_gdb_scripts, bool);
         key!(requires_uwtable, bool);
         key!(simd_types_indirect, bool);
+        key!(override_export_symbols, opt_list);
 
         if let Some(array) = obj.find("abi-blacklist").and_then(Json::as_array) {
             for name in array.iter().filter_map(|abi| abi.as_string()) {
@@ -1255,6 +1271,7 @@ macro_rules! target_option_val {
         target_option_val!(emit_debug_gdb_scripts);
         target_option_val!(requires_uwtable);
         target_option_val!(simd_types_indirect);
+        target_option_val!(override_export_symbols);
 
         if default.abi_blacklist != self.options.abi_blacklist {
             d.insert("abi-blacklist".to_string(), self.options.abi_blacklist.iter()
diff --git a/src/librustc_target/spec/x86_64_fortanix_unknown_sgx.rs b/src/librustc_target/spec/x86_64_fortanix_unknown_sgx.rs
new file mode 100644 (file)
index 0000000..07383b3
--- /dev/null
@@ -0,0 +1,72 @@
+// 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.
+
+use std::iter;
+
+use super::{LinkerFlavor, Target, TargetOptions, PanicStrategy};
+
+pub fn target() -> Result<Target, String> {
+    const PRE_LINK_ARGS: &[&str] = &[
+        "-Wl,--as-needed",
+        "-Wl,-z,noexecstack",
+        "-m64",
+         "-fuse-ld=gold",
+         "-nostdlib",
+         "-shared",
+         "-Wl,-e,sgx_entry",
+         "-Wl,-Bstatic",
+         "-Wl,--gc-sections",
+         "-Wl,-z,text",
+         "-Wl,-z,norelro",
+         "-Wl,--rosegment",
+         "-Wl,--no-undefined",
+         "-Wl,--error-unresolved-symbols",
+         "-Wl,--no-undefined-version",
+         "-Wl,-Bsymbolic",
+         "-Wl,--export-dynamic",
+    ];
+    const EXPORT_SYMBOLS: &[&str] = &[
+        "sgx_entry",
+        "HEAP_BASE",
+        "HEAP_SIZE",
+        "RELA",
+        "RELACOUNT",
+        "ENCLAVE_SIZE",
+        "CFGDATA_BASE",
+        "DEBUG",
+    ];
+    let opts = TargetOptions {
+        dynamic_linking: false,
+        executables: true,
+        linker_is_gnu: true,
+        max_atomic_width: Some(64),
+        panic_strategy: PanicStrategy::Abort,
+        cpu: "x86-64".into(),
+        position_independent_executables: true,
+        pre_link_args: iter::once(
+                (LinkerFlavor::Gcc, PRE_LINK_ARGS.iter().cloned().map(String::from).collect())
+        ).collect(),
+        override_export_symbols: Some(EXPORT_SYMBOLS.iter().cloned().map(String::from).collect()),
+        ..Default::default()
+    };
+    Ok(Target {
+        llvm_target: "x86_64-unknown-linux-gnu".into(),
+        target_endian: "little".into(),
+        target_pointer_width: "64".into(),
+        target_c_int_width: "32".into(),
+        target_os: "unknown".into(),
+        target_env: "sgx".into(),
+        target_vendor: "fortanix".into(),
+        data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".into(),
+        arch: "x86_64".into(),
+        linker_flavor: LinkerFlavor::Gcc,
+        options: opts,
+    })
+}
index eed5d909063bd9dd7af8fc32594cf48b73dfc7e7..aabef5c323483855fa2d9b327b8a5173f9d0addc 100644 (file)
@@ -643,11 +643,11 @@ fn new(infcx: InferCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> Self {
             },
             infcx,
             fulfillment_cx: RefCell::new(TraitEngine::new(tcx)),
-            locals: RefCell::new(NodeMap()),
-            deferred_call_resolutions: RefCell::new(DefIdMap()),
+            locals: RefCell::new(Default::default()),
+            deferred_call_resolutions: RefCell::new(Default::default()),
             deferred_cast_checks: RefCell::new(Vec::new()),
             deferred_generator_interiors: RefCell::new(Vec::new()),
-            opaque_types: RefCell::new(DefIdMap()),
+            opaque_types: RefCell::new(Default::default()),
             implicit_region_bound,
             body_id,
         }
@@ -1986,7 +1986,7 @@ pub fn new(inh: &'a Inherited<'a, 'gcx, 'tcx>,
             has_errors: Cell::new(false),
             enclosing_breakables: RefCell::new(EnclosingBreakables {
                 stack: Vec::new(),
-                by_id: NodeMap(),
+                by_id: Default::default(),
             }),
             inh,
         }
index 4460d5f64ce26283e7d93e99dd29622b8a7fa941..50f54bba3fd208a75f3be6314ccb84c8098dce84 100644 (file)
@@ -56,7 +56,7 @@ pub fn resolve_type_vars_in_body(&self, body: &'gcx hir::Body) -> &'gcx ty::Type
 
         let used_trait_imports = mem::replace(
             &mut self.tables.borrow_mut().used_trait_imports,
-            Lrc::new(DefIdSet()),
+            Lrc::new(DefIdSet::default()),
         );
         debug!(
             "used_trait_imports({:?}) = {:?}",
index 9d785dfb58ac18a59beb095990707b0ec258713a..22a96d4e908cae6f4e4a9e781d8e3364ad942b40 100644 (file)
@@ -24,7 +24,7 @@
 use rustc_data_structures::fx::FxHashMap;
 
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    let mut used_trait_imports = DefIdSet();
+    let mut used_trait_imports = DefIdSet::default();
     for &body_id in tcx.hir.krate().bodies.keys() {
         let item_def_id = tcx.hir.body_owner_def_id(body_id);
         let imports = tcx.used_trait_imports(item_def_id);
index 370f8857f1400926a45775992fbf01dee13826e2..d9dff1441296d210d4b0a9bbb0990085fb53a772 100644 (file)
@@ -22,7 +22,6 @@
 use rustc::hir;
 use rustc::hir::itemlikevisit::ItemLikeVisitor;
 use rustc::ty::{self, CrateInherentImpls, TyCtxt};
-use rustc::util::nodemap::DefIdMap;
 
 use rustc_data_structures::sync::Lrc;
 use syntax::ast;
@@ -37,9 +36,7 @@ pub fn crate_inherent_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     let krate = tcx.hir.krate();
     let mut collect = InherentCollect {
         tcx,
-        impls_map: CrateInherentImpls {
-            inherent_impls: DefIdMap()
-        }
+        impls_map: Default::default(),
     };
     krate.visit_all_item_likes(&mut collect);
     Lrc::new(collect.impls_map)
index 0aec31609b060dbd88d4d6de291c25853dbfbec6..087d53b92d4965d12f72586f86cd204ff15c2d2a 100644 (file)
@@ -81,7 +81,7 @@ pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>
     let mut terms_cx = TermsContext {
         tcx,
         arena,
-        inferred_starts: NodeMap(),
+        inferred_starts: Default::default(),
         inferred_terms: vec![],
 
         lang_items: lang_items(tcx),
index 0bd6f6bf8a2f42495640ebfee3ad3676a1783a26..aac0f9f94e32933ee7dafb0e97c05f594d2e0b2d 100644 (file)
@@ -351,13 +351,15 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
     let warnings_lint_name = lint::builtin::WARNINGS.name;
     let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
     let missing_doc_example = rustc_lint::builtin::MISSING_DOC_CODE_EXAMPLES.name;
+    let private_doc_tests = rustc_lint::builtin::PRIVATE_DOC_TESTS.name;
 
     // In addition to those specific lints, we also need to whitelist those given through
     // command line, otherwise they'll get ignored and we don't want that.
     let mut whitelisted_lints = vec![warnings_lint_name.to_owned(),
                                      intra_link_resolution_failure_name.to_owned(),
                                      missing_docs.to_owned(),
-                                     missing_doc_example.to_owned()];
+                                     missing_doc_example.to_owned(),
+                                     private_doc_tests.to_owned()];
 
     whitelisted_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned());
 
index f5056cead567e3acb59d50f69ff40d050f84723a..7183cfe5711929e19c594124f08b4624f07d5f70 100644 (file)
@@ -24,9 +24,9 @@
 
 use core::DocContext;
 use fold::DocFolder;
-use html::markdown::{find_testable_code, markdown_links, ErrorCodes, LangString};
+use html::markdown::markdown_links;
 
-use passes::Pass;
+use passes::{look_for_tests, Pass};
 
 pub const COLLECT_INTRA_DOC_LINKS: Pass =
     Pass::early("collect-intra-doc-links", collect_intra_doc_links,
@@ -214,43 +214,6 @@ fn resolve(&self,
     }
 }
 
-fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx>(
-    cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
-    dox: &str,
-    item: &Item,
-) {
-    if (item.is_mod() && cx.tcx.hir.as_local_node_id(item.def_id).is_none()) ||
-       cx.as_local_node_id(item.def_id).is_none() {
-        // If non-local, no need to check anything.
-        return;
-    }
-
-    struct Tests {
-        found_tests: usize,
-    }
-
-    impl ::test::Tester for Tests {
-        fn add_test(&mut self, _: String, _: LangString, _: usize) {
-            self.found_tests += 1;
-        }
-    }
-
-    let mut tests = Tests {
-        found_tests: 0,
-    };
-
-    if find_testable_code(&dox, &mut tests, ErrorCodes::No).is_ok() {
-        if tests.found_tests == 0 {
-            let mut diag = cx.tcx.struct_span_lint_node(
-                lint::builtin::MISSING_DOC_CODE_EXAMPLES,
-                NodeId::from_u32(0),
-                span_of_attrs(&item.attrs),
-                "Missing code example in this documentation");
-            diag.emit();
-        }
-    }
-}
-
 impl<'a, 'tcx, 'rcx, 'cstore> DocFolder for LinkCollector<'a, 'tcx, 'rcx, 'cstore> {
     fn fold_item(&mut self, mut item: Item) -> Option<Item> {
         let item_node_id = if item.is_mod() {
@@ -313,7 +276,7 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
         let cx = self.cx;
         let dox = item.attrs.collapsed_doc_value().unwrap_or_else(String::new);
 
-        look_for_tests(&cx, &dox, &item);
+        look_for_tests(&cx, &dox, &item, true);
 
         if !self.is_nightly_build {
             return None;
@@ -488,7 +451,7 @@ fn macro_resolve(cx: &DocContext, path_str: &str) -> Option<Def> {
     None
 }
 
-fn span_of_attrs(attrs: &Attributes) -> syntax_pos::Span {
+pub fn span_of_attrs(attrs: &Attributes) -> syntax_pos::Span {
     if attrs.doc_strings.is_empty() {
         return DUMMY_SP;
     }
index d00eb3257d43c6a5aacb537390c24361fcceb10d..eee7278e4f0a910e2819a16a3a920d54dfa9cd4f 100644 (file)
 //! process.
 
 use rustc::hir::def_id::DefId;
+use rustc::lint as lint;
 use rustc::middle::privacy::AccessLevels;
 use rustc::util::nodemap::DefIdSet;
 use std::mem;
 use std::fmt;
+use syntax::ast::NodeId;
 
 use clean::{self, GetDefId, Item};
-use core::DocContext;
+use core::{DocContext, DocAccessLevels};
 use fold;
 use fold::StripItem;
 
+use html::markdown::{find_testable_code, ErrorCodes, LangString};
+
+use self::collect_intra_doc_links::span_of_attrs;
+
 mod collapse_docs;
 pub use self::collapse_docs::COLLAPSE_DOCS;
 
@@ -43,6 +49,9 @@
 mod collect_intra_doc_links;
 pub use self::collect_intra_doc_links::COLLECT_INTRA_DOC_LINKS;
 
+mod private_items_doc_tests;
+pub use self::private_items_doc_tests::CHECK_PRIVATE_ITEMS_DOC_TESTS;
+
 mod collect_trait_impls;
 pub use self::collect_trait_impls::COLLECT_TRAIT_IMPLS;
 
@@ -128,6 +137,7 @@ pub fn late_fn(self) -> Option<fn(clean::Crate) -> clean::Crate> {
 
 /// The full list of passes.
 pub const PASSES: &'static [Pass] = &[
+    CHECK_PRIVATE_ITEMS_DOC_TESTS,
     STRIP_HIDDEN,
     UNINDENT_COMMENTS,
     COLLAPSE_DOCS,
@@ -141,6 +151,7 @@ pub fn late_fn(self) -> Option<fn(clean::Crate) -> clean::Crate> {
 /// The list of passes run by default.
 pub const DEFAULT_PASSES: &'static [&'static str] = &[
     "collect-trait-impls",
+    "check-private-items-doc-tests",
     "strip-hidden",
     "strip-private",
     "collect-intra-doc-links",
@@ -152,6 +163,7 @@ pub fn late_fn(self) -> Option<fn(clean::Crate) -> clean::Crate> {
 /// The list of default passes run with `--document-private-items` is passed to rustdoc.
 pub const DEFAULT_PRIVATE_PASSES: &'static [&'static str] = &[
     "collect-trait-impls",
+    "check-private-items-doc-tests",
     "strip-priv-imports",
     "collect-intra-doc-links",
     "collapse-docs",
@@ -348,3 +360,49 @@ fn fold_item(&mut self, i: Item) -> Option<Item> {
         }
     }
 }
+
+pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx>(
+    cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
+    dox: &str,
+    item: &Item,
+    check_missing_code: bool,
+) {
+    if cx.as_local_node_id(item.def_id).is_none() {
+        // If non-local, no need to check anything.
+        return;
+    }
+
+    struct Tests {
+        found_tests: usize,
+    }
+
+    impl ::test::Tester for Tests {
+        fn add_test(&mut self, _: String, _: LangString, _: usize) {
+            self.found_tests += 1;
+        }
+    }
+
+    let mut tests = Tests {
+        found_tests: 0,
+    };
+
+    if find_testable_code(&dox, &mut tests, ErrorCodes::No).is_ok() {
+        if check_missing_code == true && tests.found_tests == 0 {
+            let mut diag = cx.tcx.struct_span_lint_node(
+                lint::builtin::MISSING_DOC_CODE_EXAMPLES,
+                NodeId::from_u32(0),
+                span_of_attrs(&item.attrs),
+                "Missing code example in this documentation");
+            diag.emit();
+        } else if check_missing_code == false &&
+                  tests.found_tests > 0 &&
+                  !cx.renderinfo.borrow().access_levels.is_doc_reachable(item.def_id) {
+            let mut diag = cx.tcx.struct_span_lint_node(
+                lint::builtin::PRIVATE_DOC_TESTS,
+                NodeId::from_u32(0),
+                span_of_attrs(&item.attrs),
+                "Documentation test in private item");
+            diag.emit();
+        }
+    }
+}
diff --git a/src/librustdoc/passes/private_items_doc_tests.rs b/src/librustdoc/passes/private_items_doc_tests.rs
new file mode 100644 (file)
index 0000000..7c5ce88
--- /dev/null
@@ -0,0 +1,49 @@
+// 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.
+
+use clean::*;
+
+use core::DocContext;
+use fold::DocFolder;
+
+use passes::{look_for_tests, Pass};
+
+pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass =
+    Pass::early("check-private-items-doc-tests", check_private_items_doc_tests,
+                "check private items doc tests");
+
+struct PrivateItemDocTestLinter<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
+    cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
+}
+
+impl<'a, 'tcx, 'rcx, 'cstore> PrivateItemDocTestLinter<'a, 'tcx, 'rcx, 'cstore> {
+    fn new(cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
+        PrivateItemDocTestLinter {
+            cx,
+        }
+    }
+}
+
+pub fn check_private_items_doc_tests(krate: Crate, cx: &DocContext) -> Crate {
+    let mut coll = PrivateItemDocTestLinter::new(cx);
+
+    coll.fold_crate(krate)
+}
+
+impl<'a, 'tcx, 'rcx, 'cstore> DocFolder for PrivateItemDocTestLinter<'a, 'tcx, 'rcx, 'cstore> {
+    fn fold_item(&mut self, item: Item) -> Option<Item> {
+        let cx = self.cx;
+        let dox = item.attrs.collapsed_doc_value().unwrap_or_else(String::new);
+
+        look_for_tests(&cx, &dox, &item, false);
+
+        self.fold_item_recur(item)
+    }
+}
index 24dd4cc13bfe88b782e3232c61bb03eda691a5a9..946c5c5fa9bc2de4ce0e4c31cd3f6ba7cafb8662 100644 (file)
@@ -25,7 +25,7 @@
 
 /// Strip items marked `#[doc(hidden)]`
 pub fn strip_hidden(krate: clean::Crate, _: &DocContext) -> clean::Crate {
-    let mut retained = DefIdSet();
+    let mut retained = DefIdSet::default();
 
     // strip all #[doc(hidden)] items
     let krate = {
index 46d0034497e28b39f811ee394158b42477ebaae0..e9d927398e44bd90bca4cb34fabcde852e2c57d1 100644 (file)
@@ -24,7 +24,7 @@
 /// crate, specified by the `xcrate` flag.
 pub fn strip_private(mut krate: clean::Crate, cx: &DocContext) -> clean::Crate {
     // This stripper collects all *retained* nodes.
-    let mut retained = DefIdSet();
+    let mut retained = DefIdSet::default();
     let access_levels = cx.renderinfo.borrow().access_levels.clone();
 
     // strip all private items
index bb2f152edc63d8190aa873bf10f573a8e41fa7b5..d4650bd68d637de38bd3994601ec5a7b3db0d585 100644 (file)
@@ -2026,12 +2026,12 @@ impl<'a, K, V, S> RawEntryMut<'a, K, V, S> {
     /// use std::collections::HashMap;
     ///
     /// let mut map: HashMap<&str, u32> = HashMap::new();
-    /// map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 12);
     ///
-    /// assert_eq!(map["poneyland"], 12);
+    /// map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 3);
+    /// assert_eq!(map["poneyland"], 3);
     ///
-    /// *map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 12).1 += 10;
-    /// assert_eq!(map["poneyland"], 22);
+    /// *map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 10).1 *= 2;
+    /// assert_eq!(map["poneyland"], 6);
     /// ```
     #[unstable(feature = "hash_raw_entry", issue = "54043")]
     pub fn or_insert(self, default_key: K, default_val: V) -> (&'a mut K, &'a mut V)
@@ -2648,12 +2648,12 @@ impl<'a, K, V> Entry<'a, K, V> {
     /// use std::collections::HashMap;
     ///
     /// let mut map: HashMap<&str, u32> = HashMap::new();
-    /// map.entry("poneyland").or_insert(12);
     ///
-    /// assert_eq!(map["poneyland"], 12);
+    /// map.entry("poneyland").or_insert(3);
+    /// assert_eq!(map["poneyland"], 3);
     ///
-    /// *map.entry("poneyland").or_insert(12) += 10;
-    /// assert_eq!(map["poneyland"], 22);
+    /// *map.entry("poneyland").or_insert(10) *= 2;
+    /// assert_eq!(map["poneyland"], 6);
     /// ```
     pub fn or_insert(self, default: V) -> &'a mut V {
         match self {
index f460d109c894a50b4f12ff30c27982c90a80891d..575903d576a23552b09d592fbb0301e6ffac1917 100644 (file)
 //! [slice]: primitive.slice.html
 //! [`atomic`]: sync/atomic/index.html
 //! [`collections`]: collections/index.html
-//! [`for`]: ../book/first-edition/loops.html#for
+//! [`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
 //! [`format!`]: macro.format.html
 //! [`fs`]: fs/index.html
 //! [`io`]: io/index.html
 //! [`sync`]: sync/index.html
 //! [`thread`]: thread/index.html
 //! [`use std::env`]: env/index.html
-//! [`use`]: ../book/first-edition/crates-and-modules.html#importing-modules-with-use
-//! [crate root]: ../book/first-edition/crates-and-modules.html#basic-terminology-crates-and-modules
+//! [`use`]: ../book/ch07-02-modules-and-use-to-control-scope-and-privacy.html#the-use-keyword-to-bring-paths-into-a-scope
+//! [crate root]: ../book/ch07-01-packages-and-crates-for-making-libraries-and-executables.html
 //! [crates.io]: https://crates.io
-//! [deref-coercions]: ../book/second-edition/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods
+//! [deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods
 //! [files]: fs/struct.File.html
 //! [multithreading]: thread/index.html
 //! [other]: #what-is-in-the-standard-library-documentation
-//! [primitive types]: ../book/first-edition/primitive-types.html
+//! [primitive types]: ../book/ch03-02-data-types.html
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
index 15fbb10592133f38112e8a022deaae6fff760a40..0995ab3c373ca19fc84b82db8b2950de194e78b2 100644 (file)
@@ -32,7 +32,7 @@
 ///
 /// [`Result`] enum is often a better solution for recovering from errors than
 /// using the `panic!` macro.  This macro should be used to avoid proceeding using
-/// incorrect values, such as from external sources.  Detailed information about
+/// incorrect values, such as from external sources. Detailed information about
 /// error handling is found in the [book].
 ///
 /// The multi-argument form of this macro panics with a string and has the
@@ -45,7 +45,7 @@
 /// [`Result`]: ../std/result/enum.Result.html
 /// [`format!`]: ../std/macro.format.html
 /// [`compile_error!`]: ../std/macro.compile_error.html
-/// [book]: ../book/second-edition/ch09-01-unrecoverable-errors-with-panic.html
+/// [book]: ../book/ch09-00-error-handling.html
 ///
 /// # Current implementation
 ///
@@ -839,8 +839,8 @@ macro_rules! module_path { () => ({ /* compiler built-in */ }) }
     /// boolean expression evaluation of configuration flags. This frequently
     /// leads to less duplicated code.
     ///
-    /// The syntax given to this macro is the same syntax as [the `cfg`
-    /// attribute](../book/first-edition/conditional-compilation.html).
+    /// The syntax given to this macro is the same syntax as the `cfg`
+    /// attribute.
     ///
     /// # Examples
     ///
@@ -915,7 +915,7 @@ macro_rules! include {
     /// Unsafe code relies on `assert!` to enforce run-time invariants that, if
     /// violated could lead to unsafety.
     ///
-    /// Other use-cases of `assert!` include [testing] and enforcing run-time
+    /// Other use-cases of `assert!` include testing and enforcing run-time
     /// invariants in safe code (whose violation cannot result in unsafety).
     ///
     /// # Custom Messages
@@ -926,7 +926,6 @@ macro_rules! include {
     ///
     /// [`panic!`]: macro.panic.html
     /// [`debug_assert!`]: macro.debug_assert.html
-    /// [testing]: ../book/second-edition/ch11-01-writing-tests.html#checking-results-with-the-assert-macro
     /// [`std::fmt`]: ../std/fmt/index.html
     ///
     /// # Examples
index c2a16122a0dd1a2bb3383d351f8081b9276b2522..48acc1096a6811494b721d3931e0cfd857fda393 100644 (file)
@@ -22,7 +22,7 @@
 /// `bool` implements various traits, such as [`BitAnd`], [`BitOr`], [`Not`], etc.,
 /// which allow us to perform boolean operations using `&`, `|` and `!`.
 ///
-/// [`if`] always demands a `bool` value. [`assert!`], being an important macro in testing,
+/// `if` always demands a `bool` value. [`assert!`], being an important macro in testing,
 /// checks whether an expression returns `true`.
 ///
 /// ```
@@ -31,7 +31,6 @@
 /// ```
 ///
 /// [`assert!`]: macro.assert.html
-/// [`if`]: ../book/first-edition/if.html
 /// [`BitAnd`]: ops/trait.BitAnd.html
 /// [`BitOr`]: ops/trait.BitOr.html
 /// [`Not`]: ops/trait.Not.html
@@ -695,7 +694,7 @@ mod prim_str { }
 /// assert_eq!(tuple.2, 'c');
 /// ```
 ///
-/// For more about tuples, see [the book](../book/first-edition/primitive-types.html#tuples).
+/// For more about tuples, see [the book](../book/ch03-02-data-types.html#the-tuple-type).
 ///
 /// # Trait implementations
 ///
index 55652c481bd3f07478d90588229b6c3ae755825a..2f5db9bd0815535b2eb6850a7076cf4786010ad8 100644 (file)
@@ -499,9 +499,6 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     // Allows `const _: TYPE = VALUE`
     (active, underscore_const_names, "1.31.0", Some(54912), None),
 
-    // `extern crate foo as bar;` puts `bar` into extern prelude.
-    (active, extern_crate_item_prelude, "1.31.0", Some(55599), None),
-
     // `reason = ` in lint attributes and `expect` lint attribute
     (active, lint_reasons, "1.31.0", Some(54503), None),
 );
@@ -691,6 +688,8 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     // impl<I:Iterator> Iterator for &mut Iterator
     // impl Debug for Foo<'_>
     (accepted, impl_header_lifetime_elision, "1.31.0", Some(15872), None),
+    // `extern crate foo as bar;` puts `bar` into extern prelude.
+    (accepted, extern_crate_item_prelude, "1.31.0", Some(55599), None),
 );
 
 // If you change this, please modify src/doc/unstable-book as well. You must
@@ -1583,6 +1582,7 @@ fn visit_item(&mut self, i: &'a ast::Item) {
                 }
             }
 
+            ast::ItemKind::Static(..) |
             ast::ItemKind::Const(_,_) => {
                 if i.ident.name == "_" {
                     gate_feature_post!(&self, underscore_const_names, i.span,
index b4fc9c2c6fc7ca568c9e62eb832433371f7d745b..e2f09affd4fea5cd823b6a9d3552aee36b1a06f9 100644 (file)
@@ -1824,6 +1824,14 @@ fn eat_incorrect_doc_comment(&mut self, applied_to: &str) {
     fn parse_arg_general(&mut self, require_name: bool) -> PResult<'a, Arg> {
         maybe_whole!(self, NtArg, |x| x);
 
+        if let Ok(Some(_)) = self.parse_self_arg() {
+            let mut err = self.struct_span_err(self.prev_span,
+                "unexpected `self` argument in function");
+            err.span_label(self.prev_span,
+                "`self` is only valid as the first argument of an associated function");
+            return Err(err);
+        }
+
         let (pat, ty) = if require_name || self.is_named_argument() {
             debug!("parse_arg_general parse_pat (require_name:{})",
                    require_name);
@@ -5385,11 +5393,12 @@ fn parse_where_clause(&mut self) -> PResult<'a, WhereClause> {
 
     fn parse_fn_args(&mut self, named_args: bool, allow_variadic: bool)
                      -> PResult<'a, (Vec<Arg> , bool)> {
+        self.expect(&token::OpenDelim(token::Paren))?;
+
         let sp = self.span;
         let mut variadic = false;
         let args: Vec<Option<Arg>> =
-            self.parse_unspanned_seq(
-                &token::OpenDelim(token::Paren),
+            self.parse_seq_to_before_end(
                 &token::CloseDelim(token::Paren),
                 SeqSep::trailing_allowed(token::Comma),
                 |p| {
@@ -5436,6 +5445,8 @@ fn parse_fn_args(&mut self, named_args: bool, allow_variadic: bool)
                 }
             )?;
 
+        self.eat(&token::CloseDelim(token::Paren));
+
         let args: Vec<_> = args.into_iter().filter_map(|x| x).collect();
 
         if variadic && args.is_empty() {
index 1c6fc1ac1853f1c3007baae3493d7e7343de22d1..46fc6454d1c3bf453eb266549ca27698d29a815d 100644 (file)
@@ -570,8 +570,9 @@ pub fn interpolated_to_tokenstream(&self, sess: &ParseSess, span: Span)
         //
         // Instead the "probably equal" check here is "does each token
         // recursively have the same discriminant?" We basically don't look at
-        // the token values here and assume that such fine grained modifications
-        // of token streams doesn't happen.
+        // the token values here and assume that such fine grained token stream
+        // modifications, including adding/removing typically non-semantic
+        // tokens such as extra braces and commas, don't happen.
         if let Some(tokens) = tokens {
             if tokens.probably_equal_for_proc_macro(&tokens_for_real) {
                 return tokens
index cfdd4340a19fe7712de1ada27fa5f1ff9d910679..242299f1b1f6fed8174f60aab9382e4e03aa4bd2 100644 (file)
@@ -26,7 +26,7 @@
 use ext::base;
 use ext::tt::{macro_parser, quoted};
 use parse::Directory;
-use parse::token::{self, Token};
+use parse::token::{self, DelimToken, Token};
 use print::pprust;
 use serialize::{Decoder, Decodable, Encoder, Encodable};
 use util::RcVec;
@@ -38,7 +38,7 @@
 #[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
 pub struct Delimited {
     /// The type of delimiter
-    pub delim: token::DelimToken,
+    pub delim: DelimToken,
     /// The delimited sequence of token trees
     pub tts: ThinTokenStream,
 }
@@ -368,8 +368,30 @@ pub fn eq_unspanned(&self, other: &TokenStream) -> bool {
     // This is otherwise the same as `eq_unspanned`, only recursing with a
     // different method.
     pub fn probably_equal_for_proc_macro(&self, other: &TokenStream) -> bool {
-        let mut t1 = self.trees();
-        let mut t2 = other.trees();
+        // When checking for `probably_eq`, we ignore certain tokens that aren't
+        // preserved in the AST. Because they are not preserved, the pretty
+        // printer arbitrarily adds or removes them when printing as token
+        // streams, making a comparison between a token stream generated from an
+        // AST and a token stream which was parsed into an AST more reliable.
+        fn semantic_tree(tree: &TokenTree) -> bool {
+            match tree {
+                // The pretty printer tends to add trailing commas to
+                // everything, and in particular, after struct fields.
+                | TokenTree::Token(_, Token::Comma)
+                // The pretty printer emits `NoDelim` as whitespace.
+                | TokenTree::Token(_, Token::OpenDelim(DelimToken::NoDelim))
+                | TokenTree::Token(_, Token::CloseDelim(DelimToken::NoDelim))
+                // The pretty printer collapses many semicolons into one.
+                | TokenTree::Token(_, Token::Semi)
+                // The pretty printer collapses whitespace arbitrarily and can
+                // introduce whitespace from `NoDelim`.
+                | TokenTree::Token(_, Token::Whitespace) => false,
+                _ => true
+            }
+        }
+
+        let mut t1 = self.trees().filter(semantic_tree);
+        let mut t2 = other.trees().filter(semantic_tree);
         for (t1, t2) in t1.by_ref().zip(t2.by_ref()) {
             if !t1.probably_equal_for_proc_macro(&t2) {
                 return false;
index 8e37a884b34bbe24171fee585e1b98f1e8a394c3..0d3f4b90f23ed82e34dc2b6dc6bda4f6d8fd94ff 100644 (file)
@@ -28,6 +28,9 @@
 // gdb-command: print vec_deque
 // gdb-check:$3 = VecDeque<i32>(len: 3, cap: 8) = {5, 3, 7}
 
+// gdb-command: print vec_deque2
+// gdb-check:$4 = VecDeque<i32>(len: 7, cap: 8) = {2, 3, 4, 5, 6, 7, 8}
+
 #![allow(unused_variables)]
 use std::collections::BTreeSet;
 use std::collections::BTreeMap;
@@ -54,6 +57,14 @@ fn main() {
     vec_deque.push_back(3);
     vec_deque.push_back(7);
 
+    // VecDeque where an element was popped.
+    let mut vec_deque2 = VecDeque::new();
+    for i in 1..8 {
+        vec_deque2.push_back(i)
+    }
+    vec_deque2.pop_front();
+    vec_deque2.push_back(8);
+
     zzz(); // #break
 }
 
diff --git a/src/test/rustdoc-ui/private-item-doc-test.rs b/src/test/rustdoc-ui/private-item-doc-test.rs
new file mode 100644 (file)
index 0000000..5a13fe3
--- /dev/null
@@ -0,0 +1,20 @@
+// 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.
+
+#![deny(private_doc_tests)]
+
+mod foo {
+    /// private doc test
+    ///
+    /// ```
+    /// assert!(false);
+    /// ```
+    fn bar() {}
+}
diff --git a/src/test/rustdoc-ui/private-item-doc-test.stderr b/src/test/rustdoc-ui/private-item-doc-test.stderr
new file mode 100644 (file)
index 0000000..b43add7
--- /dev/null
@@ -0,0 +1,16 @@
+error: Documentation test in private item
+  --> $DIR/private-item-doc-test.rs:14:5
+   |
+LL | /     /// private doc test
+LL | |     ///
+LL | |     /// ```
+LL | |     /// assert!(false);
+LL | |     /// ```
+   | |___________^
+   |
+note: lint level defined here
+  --> $DIR/private-item-doc-test.rs:11:9
+   |
+LL | #![deny(private_doc_tests)]
+   |         ^^^^^^^^^^^^^^^^^
+
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/span-preservation.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/span-preservation.rs
new file mode 100644 (file)
index 0000000..65ed9cf
--- /dev/null
@@ -0,0 +1,12 @@
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn foo(_: TokenStream, input: TokenStream) -> TokenStream {
+    input.into_iter().collect()
+}
index e320ad9713542961e4acd73c72741b555e626a72..25a2a37614778e4f4c62b843659154bf79123c61 100644 (file)
@@ -1,8 +1,6 @@
 // compile-pass
 // edition:2018
 
-#![feature(extern_crate_item_prelude)]
-
 extern crate proc_macro;
 use proc_macro::TokenStream; // OK
 
diff --git a/src/test/ui-fulldeps/proc-macro/span-preservation.rs b/src/test/ui-fulldeps/proc-macro/span-preservation.rs
new file mode 100644 (file)
index 0000000..adcb42a
--- /dev/null
@@ -0,0 +1,51 @@
+// aux-build:span-preservation.rs
+
+// For each of these, we should get the appropriate type mismatch error message,
+// and the function should be echoed.
+
+extern crate span_preservation as foo;
+
+use foo::foo;
+
+#[foo]
+fn a() {
+    let x: usize = "hello";;;;;
+}
+
+#[foo]
+fn b(x: Option<isize>) -> usize {
+    match x {
+        Some(x) => { return x },
+        None => 10
+    }
+}
+
+#[foo]
+fn c() {
+    struct Foo {
+        a: usize
+    }
+
+    struct Bar {
+        a: usize,
+        b: usize
+    }
+
+    let x = Foo { a: 10isize };
+    let y = Foo { a: 10, b: 10isize };
+}
+
+// FIXME: This doesn't work at the moment. See the one below. The pretty-printer
+// injects a "C" between `extern` and `fn` which causes a "probably_eq"
+// `TokenStream` mismatch. The lack of `"C"` should be preserved in the AST.
+#[foo]
+extern fn bar() {
+    0
+}
+
+#[foo]
+extern "C" fn baz() {
+    0
+}
+
+fn main() {}
diff --git a/src/test/ui-fulldeps/proc-macro/span-preservation.stderr b/src/test/ui-fulldeps/proc-macro/span-preservation.stderr
new file mode 100644 (file)
index 0000000..f33245a
--- /dev/null
@@ -0,0 +1,49 @@
+error[E0308]: mismatched types
+   |
+   = note: expected type `()`
+              found type `{integer}`
+
+error[E0308]: mismatched types
+  --> $DIR/span-preservation.rs:12:20
+   |
+LL |     let x: usize = "hello";;;;;
+   |                    ^^^^^^^ expected usize, found reference
+   |
+   = note: expected type `usize`
+              found type `&'static str`
+
+error[E0308]: mismatched types
+  --> $DIR/span-preservation.rs:18:29
+   |
+LL |         Some(x) => { return x },
+   |                             ^ expected usize, found isize
+
+error[E0308]: mismatched types
+  --> $DIR/span-preservation.rs:34:22
+   |
+LL |     let x = Foo { a: 10isize };
+   |                      ^^^^^^^ expected usize, found isize
+
+error[E0560]: struct `c::Foo` has no field named `b`
+  --> $DIR/span-preservation.rs:35:26
+   |
+LL |     let y = Foo { a: 10, b: 10isize };
+   |                          ^ `c::Foo` does not have this field
+   |
+   = note: available fields are: `a`
+
+error[E0308]: mismatched types
+  --> $DIR/span-preservation.rs:48:5
+   |
+LL | extern "C" fn baz() {
+   |                     - possibly return type missing here?
+LL |     0
+   |     ^ expected (), found integral variable
+   |
+   = note: expected type `()`
+              found type `{integer}`
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0308, E0560.
+For more information about an error, try `rustc --explain E0308`.
index 0bbc254453cff6b20b91bc50e7be15ea7247c1f8..129177e9a1ae92b550c3f3e87e791797ef3a378e 100644 (file)
@@ -16,7 +16,7 @@ union Foo {
 
 enum Bar {
     Boo = [unsafe { Foo { b: () }.a }; 4][3],
-    //~^ ERROR evaluation of constant value failed
+    //~^ ERROR it is undefined behavior to use this value
 }
 
 fn main() {
index bb50f38062ee995349ad340781c69f73f408eac3..38a8f75a5c20853b75e7ecd7546c5758cb89a80e 100644 (file)
@@ -1,8 +1,10 @@
-error[E0080]: evaluation of constant value failed
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-err4.rs:18:11
    |
 LL |     Boo = [unsafe { Foo { b: () }.a }; 4][3],
-   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
+   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
+   |
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error: aborting due to previous error
 
index 23e1ab013ef3e991f773940cfb1908fd44ec51c3..cc5ddb4401644b8f7ad407070d43a9b4fea07d83 100644 (file)
@@ -37,7 +37,7 @@ fn main() {
     //~^ ERROR it is undefined behavior to use this value
 
     const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
-    //~^ ERROR any use of this value will cause an error
+    //~^ ERROR it is undefined behavior to use this value
 
     const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
     //~^ ERROR any use of this value will cause an error
@@ -52,7 +52,7 @@ fn main() {
     //~^ ERROR it is undefined behavior to use this value
 
     const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
-    //~^ ERROR any use of this value will cause an error
+    //~^ ERROR it is undefined behavior to use this value
 
     const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
     //~^ ERROR any use of this value will cause an error
index 0126743eedecba9ced796711dfebdbad95645730..786338222e3ba8c36149776b5e24251343bb88b7 100644 (file)
@@ -40,11 +40,13 @@ LL |     const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uin
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error: any use of this value will cause an error
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-pointer-values-in-various-types.rs:39:5
    |
 LL |     const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
+   |
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:42:5
@@ -78,11 +80,13 @@ LL |     const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error: any use of this value will cause an error
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-pointer-values-in-various-types.rs:54:5
    |
 LL |     const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
+   |
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:57:5
index 89b449464419e9a3f04295b012f3caf22c6372db..2bf85e25a21a1d6f7419fcb2ce683609de9e4301 100644 (file)
@@ -16,12 +16,12 @@ enum Enum {
     A = 0,
 }
 union TransmuteEnum {
-    a: &'static u8,
-    out: Enum,
+    in1: &'static u8,
+    out1: Enum,
 }
 
 // A pointer is guaranteed non-null
-const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.out };
+const BAD_ENUM: Enum = unsafe { TransmuteEnum { in1: &1 }.out1 };
 //~^ ERROR is undefined behavior
 
 // (Potentially) invalid enum discriminant
@@ -48,8 +48,8 @@ union TransmuteEnum2 {
 const BAD_ENUM4: Wrap<Enum2> = unsafe { TransmuteEnum2 { in2: &0 }.out2 };
 //~^ ERROR is undefined behavior
 
-// Undef enum discriminant. In an arry to avoid `Scalar` layout.
-const BAD_ENUM_UNDEF: [Enum2; 2] = [unsafe { TransmuteEnum2 { in3: () }.out1 }; 2];
+// Undef enum discriminant.
+const BAD_ENUM_UNDEF : Enum2 = unsafe { TransmuteEnum2 { in3: () }.out1 };
 //~^ ERROR is undefined behavior
 
 // Pointer value in an enum with a niche that is not just 0.
index 5aae3a2f35110528693dc8df9eef56917b3c1865..509faaa46f811aa4f0d517ba6b2895120059e3b6 100644 (file)
@@ -1,8 +1,8 @@
 error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-enum.rs:24:1
    |
-LL | const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.out };
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant
+LL | const BAD_ENUM: Enum = unsafe { TransmuteEnum { in1: &1 }.out1 };
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
@@ -33,8 +33,8 @@ LL | const BAD_ENUM4: Wrap<Enum2> = unsafe { TransmuteEnum2 { in2: &0 }.out2 };
 error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-enum.rs:52:1
    |
-LL | const BAD_ENUM_UNDEF: [Enum2; 2] = [unsafe { TransmuteEnum2 { in3: () }.out1 }; 2];
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes at [0], but expected a valid enum discriminant
+LL | const BAD_ENUM_UNDEF : Enum2 = unsafe { TransmuteEnum2 { in3: () }.out1 };
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid enum discriminant
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
index c0bfbc17629fc3cfcb0f6a665e0c7078446b26a2..2bdad3af889dcf0f3a1bb409c959dc5d1e382b33 100644 (file)
@@ -34,7 +34,8 @@ const fn read_field2() -> Field2 {
 }
 
 const fn read_field3() -> Field3 {
-    const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR any use of this value
+    const FIELD3: Field3 = unsafe { UNION.field3 };
+    //~^ ERROR it is undefined behavior to use this value
     FIELD3
 }
 
index 565cd916ffcb110244724ffd24d96b31e5dbd1e0..ca7cf2b028ce7e9c21e4c59a8b1d82b0dec5ad06 100644 (file)
@@ -1,10 +1,11 @@
-error: any use of this value will cause an error
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/union-const-eval-field.rs:37:5
    |
-LL |     const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR any use of this value
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
+LL |     const FIELD3: Field3 = unsafe { UNION.field3 };
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
    |
-   = note: #[deny(const_err)] on by default
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0080`.
index 0e4f1e09171de97213808d5929a62416d84a205e..6bd63472b212a287805c5426772825c2c8f21c70 100644 (file)
@@ -20,7 +20,7 @@ union DummyUnion {
 
 const UNION: DummyUnion = DummyUnion { field1: 1065353216 };
 
-const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR will cause an error
+const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR it is undefined behavior to use this value
 
 const FIELD_PATH: Struct = Struct { //~ ERROR it is undefined behavior to use this value
     a: 42,
index 98c2c1472aae016c6005ee0760b8167e1ad82e0b..7cadef246177a557892fee0bc3c7cf6009d3dd06 100644 (file)
@@ -1,10 +1,10 @@
-error: any use of this value will cause an error
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/union-ice.rs:23:1
    |
-LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR will cause an error
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
+LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR it is undefined behavior to use this value
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
    |
-   = note: #[deny(const_err)] on by default
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
   --> $DIR/union-ice.rs:25:1
diff --git a/src/test/ui/consts/min_const_fn/loop_ice.rs b/src/test/ui/consts/min_const_fn/loop_ice.rs
new file mode 100644 (file)
index 0000000..4278a8e
--- /dev/null
@@ -0,0 +1,5 @@
+const fn foo() {
+    loop {} //~ ERROR loops are not allowed in const fn
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/loop_ice.stderr b/src/test/ui/consts/min_const_fn/loop_ice.stderr
new file mode 100644 (file)
index 0000000..1424cea
--- /dev/null
@@ -0,0 +1,8 @@
+error: loops are not allowed in const fn
+  --> $DIR/loop_ice.rs:2:5
+   |
+LL |     loop {} //~ ERROR loops are not allowed in const fn
+   |     ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.rs b/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.rs
deleted file mode 100644 (file)
index 27b9a34..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-// edition:2018
-
-#![feature(alloc, underscore_imports)]
-
-extern crate alloc;
-
-mod in_scope {
-    fn check() {
-        let v = alloc::vec![0];
-        //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
-        type A = alloc::boxed::Box<u8>;
-        //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
-    }
-}
-
-mod absolute {
-    fn check() {
-        let v = ::alloc::vec![0];
-        //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
-        type A = ::alloc::boxed::Box<u8>;
-        //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
-    }
-}
-
-mod import_in_scope {
-    use alloc as _;
-    //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
-    use alloc::boxed;
-    //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
-}
-
-mod import_absolute {
-    use ::alloc;
-    //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
-    use ::alloc::boxed;
-    //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
-}
-
-extern crate alloc as core;
-
-mod unrelated_crate_renamed {
-    type A = core::boxed::Box<u8>;
-    //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
-}
-
-fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr b/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr
deleted file mode 100644 (file)
index 103ab79..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
-  --> $DIR/feature-gate-extern_crate_item_prelude.rs:26:9
-   |
-LL |     use alloc as _;
-   |         ^^^^^
-   |
-   = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
-
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
-  --> $DIR/feature-gate-extern_crate_item_prelude.rs:28:9
-   |
-LL |     use alloc::boxed;
-   |         ^^^^^
-   |
-   = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
-
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
-  --> $DIR/feature-gate-extern_crate_item_prelude.rs:33:11
-   |
-LL |     use ::alloc;
-   |           ^^^^^
-   |
-   = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
-
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
-  --> $DIR/feature-gate-extern_crate_item_prelude.rs:35:11
-   |
-LL |     use ::alloc::boxed;
-   |           ^^^^^
-   |
-   = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
-
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
-  --> $DIR/feature-gate-extern_crate_item_prelude.rs:9:17
-   |
-LL |         let v = alloc::vec![0];
-   |                 ^^^^^
-   |
-   = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
-
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
-  --> $DIR/feature-gate-extern_crate_item_prelude.rs:11:18
-   |
-LL |         type A = alloc::boxed::Box<u8>;
-   |                  ^^^^^
-   |
-   = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
-
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
-  --> $DIR/feature-gate-extern_crate_item_prelude.rs:18:19
-   |
-LL |         let v = ::alloc::vec![0];
-   |                   ^^^^^
-   |
-   = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
-
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
-  --> $DIR/feature-gate-extern_crate_item_prelude.rs:20:20
-   |
-LL |         type A = ::alloc::boxed::Box<u8>;
-   |                    ^^^^^
-   |
-   = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
-
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
-  --> $DIR/feature-gate-extern_crate_item_prelude.rs:42:14
-   |
-LL |     type A = core::boxed::Box<u8>;
-   |              ^^^^
-   |
-   = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
-
-error: aborting due to 9 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/imports/auxiliary/issue-55811.rs b/src/test/ui/imports/auxiliary/issue-55811.rs
new file mode 100644 (file)
index 0000000..877e4cd
--- /dev/null
@@ -0,0 +1,5 @@
+mod m {}
+
+// These two imports should not conflict when this crate is loaded from some other crate.
+use m::{};
+use m::{};
diff --git a/src/test/ui/imports/auxiliary/issue-56125.rs b/src/test/ui/imports/auxiliary/issue-56125.rs
new file mode 100644 (file)
index 0000000..0ff4077
--- /dev/null
@@ -0,0 +1,9 @@
+pub mod last_segment {
+    pub mod issue_56125 {}
+}
+
+pub mod non_last_segment {
+    pub mod non_last_segment {
+        pub mod issue_56125 {}
+    }
+}
index b1154f2076b802adc1e304566fca88f857331a46..cf91a9714ade089255f619b758e72234694856fc 100644 (file)
@@ -1,8 +1,6 @@
 // compile-pass
 // edition:2018
 
-#![feature(extern_crate_item_prelude)]
-
 macro_rules! define_iso { () => {
     extern crate std as iso;
 }}
index c48a65798b6c13bdc71345a6c291101206813a31..6117e5f6f3cd76681303d344f7805e49190b4af2 100644 (file)
@@ -1,7 +1,6 @@
 // compile-pass
 // compile-flags:--cfg my_feature
 
-#![feature(extern_crate_item_prelude)]
 #![no_std]
 
 #[cfg(my_feature)]
index 8c147dfd04a3c7b6173393f9234760550a17b42b..bb4cf6ca99c752e87e87d5911a6c4ea272e45101 100644 (file)
@@ -1,8 +1,6 @@
 // compile-pass
 // aux-build:two_macros.rs
 
-#![feature(extern_crate_item_prelude)]
-
 extern crate two_macros;
 
 mod m {
index 732f1c4de2fb351aab488b7d157786a376a03368..6ff3ab73639c0bec32db8ef41797a66fa84beb8e 100644 (file)
@@ -1,7 +1,5 @@
 // aux-build:two_macros.rs
 
-#![feature(extern_crate_item_prelude)]
-
 macro_rules! define_vec {
     () => {
         extern crate std as Vec;
@@ -16,4 +14,13 @@ fn check() {
     }
 }
 
+macro_rules! define_other_core {
+    () => {
+        extern crate std as core;
+        //~^ ERROR macro-expanded `extern crate` items cannot shadow names passed with `--extern`
+    }
+}
+
+define_other_core!();
+
 fn main() {}
index 218dfb796f77ad3964915b2a834875a4c48b00bf..795e1761ccdb3e097ca9b11542f28953e45c0443 100644 (file)
@@ -1,12 +1,21 @@
+error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
+  --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:19:9
+   |
+LL |         extern crate std as core;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | define_other_core!();
+   | --------------------- in this macro invocation
+
 error[E0659]: `Vec` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
-  --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:15:9
+  --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:13:9
    |
 LL |         Vec::panic!(); //~ ERROR `Vec` is ambiguous
    |         ^^^ ambiguous name
    |
    = note: `Vec` could refer to a struct from prelude
 note: `Vec` could also refer to the extern crate imported here
-  --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:7:9
+  --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:5:9
    |
 LL |         extern crate std as Vec;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -14,6 +23,6 @@ LL |         extern crate std as Vec;
 LL | define_vec!();
    | -------------- in this macro invocation
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0659`.
diff --git a/src/test/ui/imports/extern-prelude-extern-crate-shadowing.rs b/src/test/ui/imports/extern-prelude-extern-crate-shadowing.rs
new file mode 100644 (file)
index 0000000..c5adeaf
--- /dev/null
@@ -0,0 +1,12 @@
+// compile-pass
+// aux-build:two_macros.rs
+
+extern crate two_macros as core;
+
+mod m {
+    fn check() {
+        core::m!(); // OK
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/imports/issue-55811.rs b/src/test/ui/imports/issue-55811.rs
new file mode 100644 (file)
index 0000000..9531677
--- /dev/null
@@ -0,0 +1,6 @@
+// compile-pass
+// aux-build:issue-55811.rs
+
+extern crate issue_55811;
+
+fn main() {}
diff --git a/src/test/ui/imports/issue-56125.rs b/src/test/ui/imports/issue-56125.rs
new file mode 100644 (file)
index 0000000..4baeb8a
--- /dev/null
@@ -0,0 +1,12 @@
+// edition:2018
+// compile-flags:--extern issue_56125
+// aux-build:issue-56125.rs
+
+use issue_56125::last_segment::*;
+//~^ ERROR `issue_56125` is ambiguous
+//~| ERROR unresolved import `issue_56125::last_segment`
+use issue_56125::non_last_segment::non_last_segment::*;
+//~^ ERROR `issue_56125` is ambiguous
+//~| ERROR failed to resolve: could not find `non_last_segment` in `issue_56125`
+
+fn main() {}
diff --git a/src/test/ui/imports/issue-56125.stderr b/src/test/ui/imports/issue-56125.stderr
new file mode 100644 (file)
index 0000000..096d5be
--- /dev/null
@@ -0,0 +1,46 @@
+error[E0433]: failed to resolve: could not find `non_last_segment` in `issue_56125`
+  --> $DIR/issue-56125.rs:8:18
+   |
+LL | use issue_56125::non_last_segment::non_last_segment::*;
+   |                  ^^^^^^^^^^^^^^^^ could not find `non_last_segment` in `issue_56125`
+
+error[E0432]: unresolved import `issue_56125::last_segment`
+  --> $DIR/issue-56125.rs:5:18
+   |
+LL | use issue_56125::last_segment::*;
+   |                  ^^^^^^^^^^^^ could not find `last_segment` in `issue_56125`
+
+error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution)
+  --> $DIR/issue-56125.rs:5:5
+   |
+LL | use issue_56125::last_segment::*;
+   |     ^^^^^^^^^^^ ambiguous name
+   |
+   = note: `issue_56125` could refer to an extern crate passed with `--extern`
+   = help: use `::issue_56125` to refer to this extern crate unambiguously
+note: `issue_56125` could also refer to the module imported here
+  --> $DIR/issue-56125.rs:5:5
+   |
+LL | use issue_56125::last_segment::*;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = help: use `self::issue_56125` to refer to this module unambiguously
+
+error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution)
+  --> $DIR/issue-56125.rs:8:5
+   |
+LL | use issue_56125::non_last_segment::non_last_segment::*;
+   |     ^^^^^^^^^^^ ambiguous name
+   |
+   = note: `issue_56125` could refer to an extern crate passed with `--extern`
+   = help: use `::issue_56125` to refer to this extern crate unambiguously
+note: `issue_56125` could also refer to the module imported here
+  --> $DIR/issue-56125.rs:5:5
+   |
+LL | use issue_56125::last_segment::*;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = help: use `self::issue_56125` to refer to this module unambiguously
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0432, E0433, E0659.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/src/test/ui/invalid-self-argument/bare-fn-start.rs b/src/test/ui/invalid-self-argument/bare-fn-start.rs
new file mode 100644 (file)
index 0000000..741ba5f
--- /dev/null
@@ -0,0 +1,5 @@
+fn a(&self) { }
+//~^ ERROR unexpected `self` argument in function
+//~| NOTE `self` is only valid as the first argument of an associated function
+
+fn main() { }
diff --git a/src/test/ui/invalid-self-argument/bare-fn-start.stderr b/src/test/ui/invalid-self-argument/bare-fn-start.stderr
new file mode 100644 (file)
index 0000000..6a878b6
--- /dev/null
@@ -0,0 +1,8 @@
+error: unexpected `self` argument in function
+  --> $DIR/bare-fn-start.rs:1:7
+   |
+LL | fn a(&self) { }
+   |       ^^^^ `self` is only valid as the first argument of an associated function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/invalid-self-argument/bare-fn.rs b/src/test/ui/invalid-self-argument/bare-fn.rs
new file mode 100644 (file)
index 0000000..704fa99
--- /dev/null
@@ -0,0 +1,5 @@
+fn b(foo: u32, &mut self) { }
+//~^ ERROR unexpected `self` argument in function
+//~| NOTE `self` is only valid as the first argument of an associated function
+
+fn main() { }
diff --git a/src/test/ui/invalid-self-argument/bare-fn.stderr b/src/test/ui/invalid-self-argument/bare-fn.stderr
new file mode 100644 (file)
index 0000000..b13f746
--- /dev/null
@@ -0,0 +1,8 @@
+error: unexpected `self` argument in function
+  --> $DIR/bare-fn.rs:1:21
+   |
+LL | fn b(foo: u32, &mut self) { }
+   |                     ^^^^ `self` is only valid as the first argument of an associated function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/invalid-self-argument/trait-fn.rs b/src/test/ui/invalid-self-argument/trait-fn.rs
new file mode 100644 (file)
index 0000000..31e867b
--- /dev/null
@@ -0,0 +1,11 @@
+struct Foo {}
+
+impl Foo {
+    fn c(foo: u32, self) {}
+    //~^ ERROR unexpected `self` argument in function
+    //~| NOTE `self` is only valid as the first argument of an associated function
+
+    fn good(&mut self, foo: u32) {}
+}
+
+fn main() { }
diff --git a/src/test/ui/invalid-self-argument/trait-fn.stderr b/src/test/ui/invalid-self-argument/trait-fn.stderr
new file mode 100644 (file)
index 0000000..b3c2cc5
--- /dev/null
@@ -0,0 +1,8 @@
+error: unexpected `self` argument in function
+  --> $DIR/trait-fn.rs:4:20
+   |
+LL |     fn c(foo: u32, self) {}
+   |                    ^^^^ `self` is only valid as the first argument of an associated function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lint/must_use-trait.rs b/src/test/ui/lint/must_use-trait.rs
new file mode 100644 (file)
index 0000000..23df4fa
--- /dev/null
@@ -0,0 +1,22 @@
+#![deny(unused_must_use)]
+
+#[must_use]
+trait Critical {}
+
+trait NotSoCritical {}
+
+trait DecidedlyUnimportant {}
+
+struct Anon;
+
+impl Critical for Anon {}
+impl NotSoCritical for Anon {}
+impl DecidedlyUnimportant for Anon {}
+
+fn get_critical() -> impl NotSoCritical + Critical + DecidedlyUnimportant {
+    Anon {}
+}
+
+fn main() {
+    get_critical(); //~ ERROR unused implementer of `Critical` that must be used
+}
diff --git a/src/test/ui/lint/must_use-trait.stderr b/src/test/ui/lint/must_use-trait.stderr
new file mode 100644 (file)
index 0000000..94f5f4f
--- /dev/null
@@ -0,0 +1,14 @@
+error: unused implementer of `Critical` that must be used
+  --> $DIR/must_use-trait.rs:21:5
+   |
+LL |     get_critical(); //~ ERROR unused implementer of `Critical` that must be used
+   |     ^^^^^^^^^^^^^^^
+   |
+note: lint level defined here
+  --> $DIR/must_use-trait.rs:1:9
+   |
+LL | #![deny(unused_must_use)]
+   |         ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
index 9eb11148a8bcef45200484c0163c2371927fe782..2dcc7a25c84014f35b0e4757b5adac09b60712d2 100644 (file)
@@ -22,6 +22,8 @@ fn main() {
     //~^ ERROR closure is expected to take
     f(|| panic!());
     //~^ ERROR closure is expected to take
+    f(  move    || panic!());
+    //~^ ERROR closure is expected to take
 
     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
     //~^ ERROR closure is expected to take
index 057cf6efa1dea415fa4e72d11c48419496b4a1eb..eeadf07262c3ee6f6f816d0e9e2ed561220d068d 100644 (file)
@@ -60,8 +60,26 @@ help: consider changing the closure to take and ignore the expected argument
 LL |     f(|_| panic!());
    |       ^^^
 
+error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
+  --> $DIR/closure-arg-count.rs:25:5
+   |
+LL |     f(  move    || panic!());
+   |     ^   ---------- takes 0 arguments
+   |     |
+   |     expected closure that takes 1 argument
+   |
+note: required by `f`
+  --> $DIR/closure-arg-count.rs:13:1
+   |
+LL | fn f<F: Fn<usize>>(_: F) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+help: consider changing the closure to take and ignore the expected argument
+   |
+LL |     f(  move    |_| panic!());
+   |                 ^^^
+
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
-  --> $DIR/closure-arg-count.rs:26:53
+  --> $DIR/closure-arg-count.rs:28:53
    |
 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
    |                                                     ^^^ ------ takes 2 distinct arguments
@@ -73,7 +91,7 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
    |                                                         ^^^^^^^^
 
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
-  --> $DIR/closure-arg-count.rs:28:53
+  --> $DIR/closure-arg-count.rs:30:53
    |
 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
    |                                                     ^^^ ------------- takes 2 distinct arguments
@@ -85,7 +103,7 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
    |                                                         ^^^^^^^^
 
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
-  --> $DIR/closure-arg-count.rs:30:53
+  --> $DIR/closure-arg-count.rs:32:53
    |
 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
    |                                                     ^^^ --------- takes 3 distinct arguments
@@ -93,7 +111,7 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
    |                                                     expected closure that takes a single 2-tuple as argument
 
 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments
-  --> $DIR/closure-arg-count.rs:32:53
+  --> $DIR/closure-arg-count.rs:34:53
    |
 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
    |                                                     ^^^ expected function that takes a single 2-tuple as argument
@@ -102,7 +120,7 @@ LL | fn foo() {}
    | -------- takes 0 arguments
 
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
-  --> $DIR/closure-arg-count.rs:35:53
+  --> $DIR/closure-arg-count.rs:37:53
    |
 LL |     let bar = |i, x, y| i;
    |               --------- takes 3 distinct arguments
@@ -110,7 +128,7 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
    |                                                     ^^^ expected closure that takes a single 2-tuple as argument
 
 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
-  --> $DIR/closure-arg-count.rs:37:53
+  --> $DIR/closure-arg-count.rs:39:53
    |
 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
    |                                                     ^^^ expected function that takes a single 2-tuple as argument
@@ -119,13 +137,13 @@ LL | fn qux(x: usize, y: usize) {}
    | -------------------------- takes 2 distinct arguments
 
 error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
-  --> $DIR/closure-arg-count.rs:40:41
+  --> $DIR/closure-arg-count.rs:42:41
    |
 LL |     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
    |                                         ^^^ expected function that takes 1 argument
 
 error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
-  --> $DIR/closure-arg-count.rs:43:5
+  --> $DIR/closure-arg-count.rs:45:5
    |
 LL |     call(Foo);
    |     ^^^^ expected function that takes 0 arguments
@@ -134,11 +152,11 @@ LL | struct Foo(u8);
    | --------------- takes 1 argument
    |
 note: required by `call`
-  --> $DIR/closure-arg-count.rs:50:1
+  --> $DIR/closure-arg-count.rs:52:1
    |
 LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 13 previous errors
+error: aborting due to 14 previous errors
 
 For more information about this error, try `rustc --explain E0593`.
diff --git a/src/test/ui/underscore_const_names_feature_gate.rs b/src/test/ui/underscore_const_names_feature_gate.rs
new file mode 100644 (file)
index 0000000..b217403
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2012-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.
+
+const _: () = (); //~ ERROR is unstable
+static _: () = (); //~ ERROR is unstable
+
+fn main() {}
diff --git a/src/test/ui/underscore_const_names_feature_gate.stderr b/src/test/ui/underscore_const_names_feature_gate.stderr
new file mode 100644 (file)
index 0000000..c97b3f8
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0658]: naming constants with `_` is unstable (see issue #54912)
+  --> $DIR/underscore_const_names_feature_gate.rs:11:1
+   |
+LL | const _: () = (); //~ ERROR is unstable
+   | ^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(underscore_const_names)] to the crate attributes to enable
+
+error[E0658]: naming constants with `_` is unstable (see issue #54912)
+  --> $DIR/underscore_const_names_feature_gate.rs:12:1
+   |
+LL | static _: () = (); //~ ERROR is unstable
+   | ^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(underscore_const_names)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
index 8781542ae044a0286b70e5dada4ee53e479be191..bf95b31ae3ca4345985b70e76eea897b933fb5e0 100644 (file)
@@ -355,6 +355,8 @@ fn build_manifest(&mut self) -> Manifest {
         self.package("lldb-preview", &mut manifest.pkg, TARGETS);
 
         manifest.renames.insert("rls".to_owned(), Rename { to: "rls-preview".to_owned() });
+        manifest.renames.insert("rustfmt".to_owned(), Rename { to: "rustfmt-preview".to_owned() });
+        manifest.renames.insert("clippy".to_owned(), Rename { to: "clippy-preview".to_owned() });
 
         let mut pkg = Package {
             version: self.cached_version("rust")
index 1c755efed6ee265c762f4d3fec73de8a989637a5..daa138ce7f222559e9a339600b44a715101a3f4d 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 1c755efed6ee265c762f4d3fec73de8a989637a5
+Subproject commit daa138ce7f222559e9a339600b44a715101a3f4d
index 750b25261380b776de2518fd6863fe63f98d2722..1cc61cfc2b29ae3f29a924b4c8feb1bcb09aa5fc 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 750b25261380b776de2518fd6863fe63f98d2722
+Subproject commit 1cc61cfc2b29ae3f29a924b4c8feb1bcb09aa5fc