]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #39459 - phungleson:fix-short-hand-struct-doc, r=steveklabnik
authorCorey Farwell <coreyf@rwell.org>
Wed, 8 Feb 2017 03:54:26 +0000 (22:54 -0500)
committerGitHub <noreply@github.com>
Wed, 8 Feb 2017 03:54:26 +0000 (22:54 -0500)
Fix short hand struct doc

Don't want to discredit @hngiang effort on this issue.

I just want to lend a hand to fix this issue #38830, it is a very nice feature and is seemingly completed.

Fixes #39096

r? @steveklabnik

611 files changed:
.gitmodules
.mailmap
.travis.yml
CONTRIBUTING.md
Makefile.in [deleted file]
RELEASES.md
appveyor.yml
configure
mk/cfg/aarch64-apple-ios.mk [deleted file]
mk/cfg/aarch64-linux-android.mk [deleted file]
mk/cfg/aarch64-unknown-freebsd.mk [new file with mode: 0644]
mk/cfg/aarch64-unknown-fuchsia.mk [deleted file]
mk/cfg/aarch64-unknown-linux-gnu.mk [deleted file]
mk/cfg/arm-linux-androideabi.mk [deleted file]
mk/cfg/arm-unknown-linux-gnueabi.mk [deleted file]
mk/cfg/arm-unknown-linux-gnueabihf.mk [deleted file]
mk/cfg/arm-unknown-linux-musleabi.mk [deleted file]
mk/cfg/arm-unknown-linux-musleabihf.mk [deleted file]
mk/cfg/armv5te-unknown-linux-gnueabi.mk [deleted file]
mk/cfg/armv7-apple-ios.mk [deleted file]
mk/cfg/armv7-linux-androideabi.mk [deleted file]
mk/cfg/armv7-unknown-linux-gnueabihf.mk [deleted file]
mk/cfg/armv7-unknown-linux-musleabihf.mk [deleted file]
mk/cfg/armv7s-apple-ios.mk [deleted file]
mk/cfg/asmjs-unknown-emscripten.mk [deleted file]
mk/cfg/i386-apple-ios.mk [deleted file]
mk/cfg/i586-pc-windows-msvc.mk [deleted file]
mk/cfg/i586-unknown-linux-gnu.mk [deleted file]
mk/cfg/i686-apple-darwin.mk [deleted file]
mk/cfg/i686-linux-android.mk [deleted file]
mk/cfg/i686-pc-windows-gnu.mk [deleted file]
mk/cfg/i686-pc-windows-msvc.mk [deleted file]
mk/cfg/i686-unknown-freebsd.mk [deleted file]
mk/cfg/i686-unknown-haiku.mk [deleted file]
mk/cfg/i686-unknown-linux-gnu.mk [deleted file]
mk/cfg/i686-unknown-linux-musl.mk [deleted file]
mk/cfg/i686-unknown-netbsd.mk [new file with mode: 0644]
mk/cfg/i686-unknown-openbsd.mk [deleted file]
mk/cfg/le32-unknown-nacl.mk [deleted file]
mk/cfg/mips-unknown-linux-gnu.mk [deleted file]
mk/cfg/mips-unknown-linux-musl.mk [deleted file]
mk/cfg/mips-unknown-linux-uclibc.mk [deleted file]
mk/cfg/mips64-unknown-linux-gnuabi64.mk [deleted file]
mk/cfg/mips64el-unknown-linux-gnuabi64.mk [deleted file]
mk/cfg/mipsel-unknown-linux-gnu.mk [deleted file]
mk/cfg/mipsel-unknown-linux-musl.mk [deleted file]
mk/cfg/mipsel-unknown-linux-uclibc.mk [deleted file]
mk/cfg/powerpc-unknown-linux-gnu.mk [deleted file]
mk/cfg/powerpc64-unknown-linux-gnu.mk [deleted file]
mk/cfg/powerpc64le-unknown-linux-gnu.mk [deleted file]
mk/cfg/s390x-unknown-linux-gnu.mk [deleted file]
mk/cfg/sparc64-unknown-linux-gnu.mk [deleted file]
mk/cfg/sparc64-unknown-netbsd.mk [deleted file]
mk/cfg/wasm32-unknown-emscripten.mk [deleted file]
mk/cfg/x86_64-apple-darwin.mk [deleted file]
mk/cfg/x86_64-apple-ios.mk [deleted file]
mk/cfg/x86_64-pc-windows-gnu.mk [deleted file]
mk/cfg/x86_64-pc-windows-msvc.mk [deleted file]
mk/cfg/x86_64-rumprun-netbsd.mk [deleted file]
mk/cfg/x86_64-sun-solaris.mk [deleted file]
mk/cfg/x86_64-unknown-bitrig.mk [deleted file]
mk/cfg/x86_64-unknown-dragonfly.mk [deleted file]
mk/cfg/x86_64-unknown-freebsd.mk [deleted file]
mk/cfg/x86_64-unknown-fuchsia.mk [deleted file]
mk/cfg/x86_64-unknown-haiku.mk [deleted file]
mk/cfg/x86_64-unknown-linux-gnu.mk [deleted file]
mk/cfg/x86_64-unknown-linux-musl.mk [deleted file]
mk/cfg/x86_64-unknown-netbsd.mk [deleted file]
mk/cfg/x86_64-unknown-openbsd.mk [deleted file]
mk/cfg/x86_64-unknown-redox.mk [deleted file]
mk/clean.mk [deleted file]
mk/crates.mk [deleted file]
mk/ctags.mk [deleted file]
mk/debuggers.mk [deleted file]
mk/dist.mk [deleted file]
mk/docs.mk [deleted file]
mk/grammar.mk [deleted file]
mk/host.mk [deleted file]
mk/install.mk [deleted file]
mk/llvm.mk [deleted file]
mk/main.mk [deleted file]
mk/platform.mk [deleted file]
mk/prepare.mk [deleted file]
mk/reconfig.mk [deleted file]
mk/rt.mk [deleted file]
mk/rustllvm.mk [deleted file]
mk/stage0.mk [deleted file]
mk/target.mk [deleted file]
mk/tests.mk [deleted file]
mk/util.mk [deleted file]
src/Cargo.lock
src/Cargo.toml
src/bootstrap/bin/main.rs
src/bootstrap/bootstrap.py
src/bootstrap/channel.rs
src/bootstrap/check.rs
src/bootstrap/compile.rs
src/bootstrap/config.rs
src/bootstrap/dist.rs
src/bootstrap/doc.rs
src/bootstrap/lib.rs
src/bootstrap/mk/Makefile.in
src/bootstrap/native.rs
src/bootstrap/step.rs
src/bootstrap/util.rs
src/build_helper/Cargo.toml
src/build_helper/lib.rs
src/ci/docker/armhf-gnu/Dockerfile [new file with mode: 0644]
src/ci/docker/armhf-gnu/addentropy.c [new file with mode: 0644]
src/ci/docker/armhf-gnu/rcS [new file with mode: 0644]
src/ci/docker/armhf-gnu/vexpress_config [new file with mode: 0644]
src/ci/docker/x86_64-gnu-make/Dockerfile [deleted file]
src/ci/run.sh
src/doc/book/choosing-your-guarantees.md
src/doc/book/documentation.md
src/doc/book/if-let.md
src/doc/book/testing.md
src/doc/book/using-rust-without-the-standard-library.md
src/doc/nomicon/dropck.md
src/doc/reference.md
src/etc/Dockerfile [deleted file]
src/etc/apple-darwin.supp [deleted file]
src/etc/check-sanitycheck.py [deleted file]
src/etc/check-summary.py [deleted file]
src/etc/get-stage0.py [deleted file]
src/etc/local_stage0.sh [deleted file]
src/etc/mklldeps.py [deleted file]
src/etc/x86.supp [deleted file]
src/liballoc/boxed.rs
src/liballoc/heap.rs
src/liballoc/rc.rs
src/liballoc_jemalloc/build.rs
src/liballoc_jemalloc/lib.rs
src/libbacktrace/pecoff.c
src/libcollections/binary_heap.rs
src/libcollections/btree/map.rs
src/libcollections/btree/set.rs
src/libcollections/enum_set.rs
src/libcollections/fmt.rs
src/libcollections/lib.rs
src/libcollections/linked_list.rs
src/libcollections/slice.rs
src/libcollections/str.rs
src/libcollections/string.rs
src/libcollections/vec.rs
src/libcollections/vec_deque.rs
src/libcollectionstest/slice.rs
src/libcompiler_builtins/build.rs
src/libcompiler_builtins/lib.rs
src/libcore/Cargo.toml
src/libcore/bench/any.rs [new file with mode: 0644]
src/libcore/bench/hash/mod.rs [new file with mode: 0644]
src/libcore/bench/hash/sip.rs [new file with mode: 0644]
src/libcore/bench/iter.rs [new file with mode: 0644]
src/libcore/bench/lib.rs [new file with mode: 0644]
src/libcore/bench/mem.rs [new file with mode: 0644]
src/libcore/bench/num/dec2flt/mod.rs [new file with mode: 0644]
src/libcore/bench/num/flt2dec/mod.rs [new file with mode: 0644]
src/libcore/bench/num/flt2dec/strategy/dragon.rs [new file with mode: 0644]
src/libcore/bench/num/flt2dec/strategy/grisu.rs [new file with mode: 0644]
src/libcore/bench/num/mod.rs [new file with mode: 0644]
src/libcore/bench/ops.rs [new file with mode: 0644]
src/libcore/cell.rs
src/libcore/char.rs
src/libcore/clone.rs
src/libcore/cmp.rs
src/libcore/convert.rs
src/libcore/default.rs
src/libcore/fmt/mod.rs
src/libcore/fmt/num.rs
src/libcore/hash/mod.rs
src/libcore/internal_macros.rs
src/libcore/iter/mod.rs
src/libcore/iter/range.rs
src/libcore/iter/traits.rs
src/libcore/lib.rs
src/libcore/nonzero.rs
src/libcore/num/int_macros.rs
src/libcore/num/mod.rs
src/libcore/num/uint_macros.rs
src/libcore/num/wrapping.rs
src/libcore/ops.rs
src/libcore/option.rs
src/libcore/slice.rs
src/libcoretest/any.rs
src/libcoretest/cell.rs
src/libcoretest/fmt/mod.rs
src/libcoretest/hash/mod.rs
src/libcoretest/hash/sip.rs
src/libcoretest/iter.rs
src/libcoretest/lib.rs
src/libcoretest/mem.rs
src/libcoretest/num/dec2flt/mod.rs
src/libcoretest/num/flt2dec/strategy/dragon.rs
src/libcoretest/num/flt2dec/strategy/grisu.rs
src/libcoretest/num/mod.rs
src/libcoretest/ops.rs
src/libflate/build.rs
src/libflate/lib.rs
src/liblibc
src/libpanic_unwind/gcc.rs
src/librustc/Cargo.toml
src/librustc/dep_graph/dep_node.rs
src/librustc/dep_graph/dep_tracking_map.rs
src/librustc/diagnostics.rs
src/librustc/hir/intravisit.rs
src/librustc/infer/error_reporting.rs
src/librustc/infer/higher_ranked/mod.rs
src/librustc/infer/mod.rs
src/librustc/lib.rs
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/librustc/lint/mod.rs
src/librustc/lint/table.rs [new file with mode: 0644]
src/librustc/middle/cstore.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/mir/tcx.rs
src/librustc/session/config.rs
src/librustc/session/mod.rs
src/librustc/traits/error_reporting.rs
src/librustc/traits/select.rs
src/librustc/traits/util.rs
src/librustc/ty/contents.rs
src/librustc/ty/context.rs
src/librustc/ty/error.rs
src/librustc/ty/fast_reject.rs
src/librustc/ty/flags.rs
src/librustc/ty/inhabitedness/mod.rs
src/librustc/ty/item_path.rs
src/librustc/ty/layout.rs
src/librustc/ty/maps.rs
src/librustc/ty/mod.rs
src/librustc/ty/relate.rs
src/librustc/ty/structural_impls.rs
src/librustc/ty/sty.rs
src/librustc/ty/util.rs
src/librustc/ty/walk.rs
src/librustc/ty/wf.rs
src/librustc/util/fs.rs
src/librustc/util/num.rs [deleted file]
src/librustc/util/ppaux.rs
src/librustc_back/target/aarch64_unknown_freebsd.rs [new file with mode: 0644]
src/librustc_back/target/asmjs_unknown_emscripten.rs
src/librustc_back/target/i686_unknown_netbsd.rs [new file with mode: 0644]
src/librustc_back/target/mod.rs
src/librustc_back/target/wasm32_unknown_emscripten.rs
src/librustc_borrowck/borrowck/fragments.rs
src/librustc_borrowck/borrowck/mir/elaborate_drops.rs
src/librustc_const_eval/Cargo.toml
src/librustc_const_eval/_match.rs
src/librustc_const_eval/check_match.rs
src/librustc_const_eval/eval.rs
src/librustc_const_eval/lib.rs
src/librustc_const_eval/pattern.rs
src/librustc_const_math/Cargo.toml
src/librustc_const_math/int.rs
src/librustc_const_math/is.rs
src/librustc_const_math/lib.rs
src/librustc_const_math/us.rs
src/librustc_data_structures/Cargo.toml
src/librustc_data_structures/lib.rs
src/librustc_data_structures/stable_hasher.rs
src/librustc_driver/driver.rs
src/librustc_driver/test.rs
src/librustc_errors/Cargo.toml
src/librustc_errors/diagnostic.rs
src/librustc_errors/lib.rs
src/librustc_errors/snippet.rs
src/librustc_i128/Cargo.toml [deleted file]
src/librustc_i128/lib.rs [deleted file]
src/librustc_incremental/lib.rs
src/librustc_incremental/persist/data.rs
src/librustc_incremental/persist/dirty_clean.rs
src/librustc_incremental/persist/load.rs
src/librustc_incremental/persist/preds.rs [deleted file]
src/librustc_incremental/persist/preds/compress/README.md [new file with mode: 0644]
src/librustc_incremental/persist/preds/compress/classify/mod.rs [new file with mode: 0644]
src/librustc_incremental/persist/preds/compress/classify/test.rs [new file with mode: 0644]
src/librustc_incremental/persist/preds/compress/construct.rs [new file with mode: 0644]
src/librustc_incremental/persist/preds/compress/dag_id.rs [new file with mode: 0644]
src/librustc_incremental/persist/preds/compress/mod.rs [new file with mode: 0644]
src/librustc_incremental/persist/preds/compress/test.rs [new file with mode: 0644]
src/librustc_incremental/persist/preds/compress/test_macro.rs [new file with mode: 0644]
src/librustc_incremental/persist/preds/mod.rs [new file with mode: 0644]
src/librustc_incremental/persist/save.rs
src/librustc_lint/Cargo.toml
src/librustc_lint/lib.rs
src/librustc_lint/types.rs
src/librustc_lint/unused.rs
src/librustc_llvm/build.rs
src/librustc_llvm/ffi.rs
src/librustc_llvm/lib.rs
src/librustc_metadata/Cargo.toml
src/librustc_metadata/creader.rs
src/librustc_metadata/cstore.rs
src/librustc_metadata/decoder.rs
src/librustc_metadata/encoder.rs
src/librustc_metadata/lib.rs
src/librustc_metadata/schema.rs
src/librustc_mir/Cargo.toml
src/librustc_mir/build/block.rs
src/librustc_mir/build/expr/as_rvalue.rs
src/librustc_mir/build/expr/into.rs
src/librustc_mir/lib.rs
src/librustc_mir/mir_map.rs
src/librustc_mir/transform/type_check.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/macros.rs
src/librustc_resolve/resolve_imports.rs
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/lib.rs
src/librustc_trans/Cargo.toml
src/librustc_trans/abi.rs
src/librustc_trans/adt.rs
src/librustc_trans/back/link.rs
src/librustc_trans/back/linker.rs
src/librustc_trans/builder.rs
src/librustc_trans/callee.rs
src/librustc_trans/collector.rs
src/librustc_trans/common.rs
src/librustc_trans/debuginfo/metadata.rs
src/librustc_trans/debuginfo/mod.rs
src/librustc_trans/debuginfo/type_names.rs
src/librustc_trans/debuginfo/utils.rs
src/librustc_trans/glue.rs
src/librustc_trans/intrinsic.rs
src/librustc_trans/lib.rs
src/librustc_trans/mir/block.rs
src/librustc_trans/mir/constant.rs
src/librustc_trans/mir/mod.rs
src/librustc_trans/mir/rvalue.rs
src/librustc_trans/trans_item.rs
src/librustc_trans/type_of.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/cast.rs
src/librustc_typeck/check/closure.rs
src/librustc_typeck/check/dropck.rs
src/librustc_typeck/check/intrinsic.rs
src/librustc_typeck/check/method/mod.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/check_unused.rs
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/diagnostics.rs
src/librustc_typeck/lib.rs
src/librustc_typeck/variance/constraints.rs
src/librustc_typeck/variance/solve.rs
src/librustc_typeck/variance/terms.rs
src/librustdoc/build.rs
src/librustdoc/clean/mod.rs
src/librustdoc/html/markdown.rs
src/librustdoc/html/render.rs
src/librustdoc/lib.rs
src/librustdoc/markdown.rs
src/librustdoc/test.rs
src/libserialize/Cargo.toml
src/libserialize/json.rs
src/libserialize/leb128.rs
src/libserialize/lib.rs
src/libserialize/opaque.rs
src/libserialize/serialize.rs
src/libstd/ascii.rs
src/libstd/build.rs
src/libstd/collections/hash/map.rs
src/libstd/collections/hash/set.rs
src/libstd/env.rs
src/libstd/fs.rs
src/libstd/io/mod.rs
src/libstd/io/stdio.rs
src/libstd/io/util.rs
src/libstd/lib.rs
src/libstd/net/addr.rs
src/libstd/net/ip.rs
src/libstd/net/mod.rs
src/libstd/net/tcp.rs
src/libstd/net/udp.rs
src/libstd/os/raw.rs
src/libstd/panic.rs
src/libstd/panicking.rs
src/libstd/path.rs
src/libstd/process.rs
src/libstd/rtdeps.rs [deleted file]
src/libstd/sync/barrier.rs
src/libstd/sync/condvar.rs
src/libstd/sync/mutex.rs
src/libstd/sync/once.rs
src/libstd/sync/rwlock.rs
src/libstd/sys/redox/ext/fs.rs
src/libstd/sys/unix/args.rs
src/libstd/sys/unix/ext/process.rs
src/libstd/sys/unix/fd.rs
src/libstd/sys/unix/mod.rs
src/libstd/sys/unix/net.rs
src/libstd/sys/unix/pipe.rs
src/libstd/sys/unix/process/process_common.rs
src/libstd/sys/unix/rand.rs
src/libstd/sys/windows/c.rs
src/libstd/sys/windows/fs.rs
src/libstd/sys/windows/net.rs
src/libstd/sys_common/gnu/libbacktrace.rs
src/libstd/sys_common/mod.rs
src/libstd/sys_common/net.rs
src/libstd/thread/local.rs
src/libstd/thread/mod.rs
src/libstd_unicode/char.rs
src/libsyntax/Cargo.toml
src/libsyntax/ast.rs
src/libsyntax/attr.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/derive.rs [new file with mode: 0644]
src/libsyntax/ext/expand.rs
src/libsyntax/ext/quote.rs
src/libsyntax/feature_gate.rs
src/libsyntax/lib.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/libsyntax/std_inject.rs
src/libsyntax/test.rs
src/libsyntax_ext/deriving/custom.rs
src/libsyntax_ext/deriving/decodable.rs
src/libsyntax_ext/deriving/encodable.rs
src/libsyntax_ext/deriving/mod.rs
src/libsyntax_ext/lib.rs
src/libsyntax_ext/proc_macro_registrar.rs
src/libsyntax_pos/lib.rs
src/libunwind/build.rs
src/libunwind/libunwind.rs
src/rt/hoedown
src/rustc/std_shim/Cargo.toml
src/rustc/test_shim/Cargo.toml
src/rustllvm/RustWrapper.cpp
src/stage0.txt
src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs
src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs
src/test/compile-fail-fulldeps/proc-macro/load-panic.rs
src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs
src/test/compile-fail/E0582.rs [new file with mode: 0644]
src/test/compile-fail/associated-types/bound-lifetime-constrained.rs
src/test/compile-fail/associated-types/bound-lifetime-in-binding-only.rs
src/test/compile-fail/associated-types/bound-lifetime-in-return-only.rs
src/test/compile-fail/associated-types/cache/wasm-issue-32330.rs [deleted file]
src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs
src/test/compile-fail/cross-borrow-trait.rs
src/test/compile-fail/defaulted-unit-warning.rs [new file with mode: 0644]
src/test/compile-fail/deriving-meta-unknown-trait.rs
src/test/compile-fail/deriving-primitive.rs
src/test/compile-fail/dst-bad-assign-2.rs
src/test/compile-fail/dst-bad-assign.rs
src/test/compile-fail/feature-gate-static-nobundle.rs [new file with mode: 0644]
src/test/compile-fail/imports/rfc-1560-warning-cycle.rs
src/test/compile-fail/issue-10291.rs
src/test/compile-fail/issue-11515.rs
src/test/compile-fail/issue-12187-1.rs
src/test/compile-fail/issue-12187-2.rs
src/test/compile-fail/issue-16966.rs
src/test/compile-fail/issue-17441.rs
src/test/compile-fail/issue-17551.rs
src/test/compile-fail/issue-17651.rs
src/test/compile-fail/issue-18159.rs
src/test/compile-fail/issue-18783.rs
src/test/compile-fail/issue-23041.rs
src/test/compile-fail/issue-23046.rs
src/test/compile-fail/issue-24013.rs
src/test/compile-fail/issue-30730.rs
src/test/compile-fail/issue-3763.rs
src/test/compile-fail/issue-4335.rs
src/test/compile-fail/issue-5062.rs
src/test/compile-fail/issue-6458-2.rs
src/test/compile-fail/issue-6458-3.rs
src/test/compile-fail/issue-6458.rs
src/test/compile-fail/issue-7813.rs
src/test/compile-fail/lint-group-style.rs [deleted file]
src/test/compile-fail/lint-output-format-2.rs
src/test/compile-fail/macro-error.rs
src/test/compile-fail/macros-nonfatal-errors.rs
src/test/compile-fail/map-types.rs
src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs
src/test/compile-fail/missing-block-hint.rs
src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
src/test/compile-fail/no-link.rs
src/test/compile-fail/region-object-lifetime-in-coercion.rs
src/test/compile-fail/regions-close-associated-type-into-object.rs
src/test/compile-fail/regions-close-param-into-object.rs
src/test/compile-fail/regions-fn-subtyping-return-static.rs
src/test/compile-fail/regions-nested-fns.rs
src/test/compile-fail/regions-proc-bound-capture.rs
src/test/compile-fail/regions-steal-closure.rs
src/test/compile-fail/trait-coercion-generic-bad.rs
src/test/compile-fail/trait-coercion-generic-regions.rs
src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs
src/test/compile-fail/unboxed-closure-illegal-move.rs
src/test/compile-fail/unconstrained-none.rs
src/test/compile-fail/unconstrained-ref.rs
src/test/compile-fail/uninhabited-patterns.rs
src/test/compile-fail/unique-pinned-nocopy.rs
src/test/compile-fail/vector-no-ann.rs
src/test/debuginfo/borrowed-enum.rs
src/test/debuginfo/generic-struct-style-enum.rs
src/test/debuginfo/generic-tuple-style-enum.rs
src/test/debuginfo/packed-struct.rs
src/test/debuginfo/recursive-struct.rs
src/test/debuginfo/struct-in-enum.rs
src/test/debuginfo/struct-style-enum.rs
src/test/debuginfo/tuple-style-enum.rs
src/test/debuginfo/union-smoke.rs
src/test/debuginfo/unique-enum.rs
src/test/incremental/hashes/inherent_impls.rs
src/test/incremental/hashes/trait_defs.rs
src/test/incremental/hashes/trait_impls.rs
src/test/incremental/unchecked_dirty_clean.rs [new file with mode: 0644]
src/test/incremental/unchecked_dirty_clean_metadata.rs [new file with mode: 0644]
src/test/parse-fail/tuple-float-index.rs
src/test/pretty/attr-derive.rs [new file with mode: 0644]
src/test/pretty/attr-variant-data.rs [deleted file]
src/test/pretty/auxiliary/derive-foo.rs [new file with mode: 0644]
src/test/run-make/issue-22131/Makefile
src/test/run-make/static-nobundle/Makefile [new file with mode: 0644]
src/test/run-make/static-nobundle/aaa.c [new file with mode: 0644]
src/test/run-make/static-nobundle/bbb.rs [new file with mode: 0644]
src/test/run-make/static-nobundle/ccc.rs [new file with mode: 0644]
src/test/run-make/static-nobundle/ddd.rs [new file with mode: 0644]
src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs
src/test/run-pass-fulldeps/auxiliary/plugin_args.rs
src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs
src/test/run-pass-valgrind/dst-dtor-1.rs
src/test/run-pass-valgrind/dst-dtor-2.rs
src/test/run-pass/associated-types-doubleendediterator-object.rs
src/test/run-pass/coerce-expect-unsized.rs
src/test/run-pass/deriving-default-box.rs
src/test/run-pass/deriving-eq-ord-boxed-slice.rs
src/test/run-pass/dst-deref-mut.rs
src/test/run-pass/dst-deref.rs
src/test/run-pass/dst-struct.rs
src/test/run-pass/dst-trait.rs
src/test/run-pass/empty-allocation-non-null.rs
src/test/run-pass/fds-are-cloexec.rs
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/hrtb-precedence-of-plus.rs
src/test/run-pass/i128-ffi.rs
src/test/run-pass/i128.rs
src/test/run-pass/issue-11205.rs
src/test/run-pass/issue-11677.rs
src/test/run-pass/issue-12744.rs
src/test/run-pass/issue-13808.rs
src/test/run-pass/issue-14589.rs
src/test/run-pass/issue-14919.rs
src/test/run-pass/issue-16668.rs
src/test/run-pass/issue-17734.rs
src/test/run-pass/issue-20575.rs
src/test/run-pass/issue-3052.rs
src/test/run-pass/issue-3609.rs
src/test/run-pass/issue-38987.rs
src/test/run-pass/match-arm-statics.rs
src/test/run-pass/newlambdas-ret-infer.rs
src/test/run-pass/newlambdas-ret-infer2.rs
src/test/run-pass/path-lookahead.rs
src/test/run-pass/regions-fn-subtyping.rs
src/test/run-pass/regions-relate-bound-regions-on-closures-to-inference-variables.rs
src/test/run-pass/show-boxed-slice.rs
src/test/run-pass/trait-bounds-in-arc.rs
src/test/run-pass/trait-coercion-generic.rs
src/test/run-pass/trait-coercion.rs
src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs
src/test/run-pass/unboxed-closures-call-sugar-object.rs
src/test/rustdoc/issue-38129.rs [new file with mode: 0644]
src/test/rustdoc/test_option_check/test.rs [new file with mode: 0644]
src/test/ui/codemap_tests/issue-38812-2.rs [new file with mode: 0644]
src/test/ui/codemap_tests/issue-38812-2.stderr [new file with mode: 0644]
src/test/ui/codemap_tests/issue-38812.rs [new file with mode: 0644]
src/test/ui/codemap_tests/issue-38812.stderr [new file with mode: 0644]
src/test/ui/codemap_tests/repair_span_std_macros.rs [deleted file]
src/test/ui/codemap_tests/repair_span_std_macros.stderr [deleted file]
src/test/ui/compare-method/proj-outlives-region.stderr
src/test/ui/compare-method/region-unrelated.stderr
src/test/ui/custom-derive/issue-36935.stderr
src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs [new file with mode: 0644]
src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr [new file with mode: 0644]
src/test/ui/lint/command-line-lint-group-allow.rs [new file with mode: 0644]
src/test/ui/lint/command-line-lint-group-deny.rs [new file with mode: 0644]
src/test/ui/lint/command-line-lint-group-deny.stderr [new file with mode: 0644]
src/test/ui/lint/command-line-lint-group-forbid.rs [new file with mode: 0644]
src/test/ui/lint/command-line-lint-group-forbid.stderr [new file with mode: 0644]
src/test/ui/lint/command-line-lint-group-warn.rs [new file with mode: 0644]
src/test/ui/lint/command-line-lint-group-warn.stderr [new file with mode: 0644]
src/test/ui/lint/lint-group-style.rs [new file with mode: 0644]
src/test/ui/lint/lint-group-style.stderr [new file with mode: 0644]
src/test/ui/missing-items/missing-type-parameter.rs
src/test/ui/missing-items/missing-type-parameter.stderr
src/test/ui/regions-fn-subtyping-return-static.rs [new file with mode: 0644]
src/test/ui/regions-fn-subtyping-return-static.stderr [new file with mode: 0644]
src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs
src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
src/test/ui/span/issue-24690.stderr
src/test/ui/span/multispan-import-lint.stderr
src/tools/cargotest/main.rs
src/tools/compiletest/Cargo.toml
src/tools/compiletest/build.rs [deleted file]
src/tools/compiletest/src/common.rs
src/tools/compiletest/src/header.rs
src/tools/compiletest/src/main.rs
src/tools/compiletest/src/runtest.rs
src/tools/qemu-test-client/Cargo.toml [new file with mode: 0644]
src/tools/qemu-test-client/src/main.rs [new file with mode: 0644]
src/tools/qemu-test-server/Cargo.toml [new file with mode: 0644]
src/tools/qemu-test-server/src/main.rs [new file with mode: 0644]

index 39288a7ae490753fa30c690b314e730c8ca6f582..86c5c780c5eb2b7f9a8a9c57ee9b9cdaa302653e 100644 (file)
@@ -8,6 +8,7 @@
 [submodule "src/rt/hoedown"]
        path = src/rt/hoedown
        url = https://github.com/rust-lang/hoedown.git
+       branch = rust-2015-09-21-do-not-delete
 [submodule "src/jemalloc"]
        path = src/jemalloc
        url = https://github.com/rust-lang/jemalloc.git
index c44c486831accadcc6f1facdadbcffd5f2b38001..1ae0aae2d01baeb9664f244ececb7a3815145716 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -167,6 +167,7 @@ Ožbolt Menegatti <ozbolt.menegatti@gmail.com> gareins <ozbolt.menegatti@gmail.c
 Paul Faria <paul_faria@ultimatesoftware.com> Paul Faria <Nashenas88@gmail.com>
 Peer Aramillo Irizar <peer.aramillo.irizar@gmail.com> parir <peer.aramillo.irizar@gmail.com>
 Peter Elmers <peter.elmers@yahoo.com> <peter.elmers@rice.edu>
+Peter Liniker <peter.liniker+github@gmail.com>
 Peter Zotov <whitequark@whitequark.org>
 Phil Dawes <phil@phildawes.net> Phil Dawes <pdawes@drw.com>
 Philipp Brüschweiler <blei42@gmail.com> <blei42@gmail.com>
index f138b0bed2b0282a94b69e73a41689d0e4a58578..a776f1b1e1041f1973bcedc2ea311dfc9ec38d03 100644 (file)
@@ -13,6 +13,7 @@ matrix:
   include:
     # Linux builders, all docker images
     - env: IMAGE=android DEPLOY=1
+    - env: IMAGE=armhf-gnu
     - env: IMAGE=cross DEPLOY=1
     - env: IMAGE=linux-tested-targets DEPLOY=1
     - env: IMAGE=dist-arm-linux DEPLOY=1
@@ -32,7 +33,6 @@ matrix:
     - env: IMAGE=x86_64-gnu-aux
     - env: IMAGE=x86_64-gnu-debug
     - env: IMAGE=x86_64-gnu-nopt
-    - env: IMAGE=x86_64-gnu-make
     - env: IMAGE=x86_64-gnu-llvm-3.7 ALLOW_PR=1 RUST_BACKTRACE=1
     - env: IMAGE=x86_64-gnu-distcheck
     - env: IMAGE=x86_64-gnu-incremental
@@ -56,13 +56,6 @@ matrix:
       os: osx
       osx_image: xcode8.2
       install: *osx_install_sccache
-    - env: >
-        RUST_CHECK_TARGET=check
-        RUST_CONFIGURE_ARGS=--build=x86_64-apple-darwin --disable-rustbuild
-        SRC=.
-      os: osx
-      osx_image: xcode8.2
-      install: *osx_install_sccache
     - env: >
         RUST_CHECK_TARGET=dist
         RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended"
@@ -109,11 +102,12 @@ cache:
 
 before_deploy:
   - mkdir -p deploy/$TRAVIS_COMMIT
-  - rm -rf build/dist/doc
   - >
       if [ "$TRAVIS_OS_NAME" == "osx" ]; then
+          rm -rf build/dist/doc &&
           cp -r build/dist/* deploy/$TRAVIS_COMMIT;
       else
+          rm -rf obj/build/dist/doc &&
           cp -r obj/build/dist/* deploy/$TRAVIS_COMMIT;
       fi
 
index cdbabeaddfba8a17ee886aff226ac3461328186a..429996126f92b6dd7d13fcfd1b0ce5d224842e98 100644 (file)
@@ -93,11 +93,6 @@ system internals, try asking in [`#rust-internals`][pound-rust-internals].
 
 [bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap/
 
-> **Note**: the build system was recently rewritten from a jungle of makefiles
-> to the current incarnation you'll see in `src/bootstrap`. If you experience
-> bugs you can temporarily revert back to the makefiles with
-> `--disable-rustbuild` passed to `./configure`.
-
 ### Configuration
 
 Before you can start building the compiler you need to configure the build for
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644 (file)
index 8dbe242..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-# Copyright 2012 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.
-
-# <help> \(^o^)/
-#
-# Greetings, adventurer! The Rust Build System is at your service.
-#
-# Whether you want a genuine copy of `rustc`, access to the latest and
-# most authoritative Rust documentation, or even to investigate the
-# most intimate workings of the compiler itself, you've come to the
-# right place. Let's see what's on the menu.
-#
-# Please note that most of these options only work if configure was
-# run with --disable-rustbuild. For documentation on the new build
-# system, see CONTRIBUTING.md.
-#
-# First, start with one of these build targets:
-#
-#   * all - The default. Build a complete, bootstrapped compiler.
-#           `rustc` will be in `${target-triple}/stage2/bin/`. Run it
-#           directly from the build directory if you like. This also
-#           comes with docs in `doc/`.
-#
-#   * check - Run the complete test suite
-#
-#   * clean - Clean the build repository. It is advised to run this
-#             command if you want to build Rust again, after an update
-#             of the git repository.
-#
-#   * install - Install Rust. Note that installation is not necessary
-#               to use the compiler.
-#
-#   * uninstall - Uninstall the binaries
-#
-# For tips on working with The Rust Build System, just:
-#
-#     run `make tips`
-#
-# Otherwise
-#
-#     run `make`
-#
-# </help>
-#
-# <tips>
-#
-# # The Rust Build System Tip Line
-#
-# There are a bazillion different targets you might want to build. Here
-# are a few ideas.
-#
-#   * docs - Build gobs of HTML documentation and put it into `doc/`
-#   * check-$(crate) - Test a crate, e.g. `check-std`
-#   * check-ref - Run the language reference tests
-#   * check-docs - Test the documentation examples
-#   * check-stage$(stage)-$(crate) - Test a crate in a specific stage
-#   * check-stage$(stage)-{rpass,rfail,cfail,rmake,...} - Run tests in src/test/
-#   * check-stage1-T-$(target)-H-$(host) - Run cross-compiled-tests
-#   * tidy - Basic style check, show highest rustc error code and
-#     the status of language and lib features
-#   * rustc-stage$(stage) - Only build up to a specific stage
-#   * $host/stage1/bin/rustc - Only build stage1 rustc, not libstd. For further
-#     information see "Rust recipes for build system success" below.
-#
-# Then mix in some of these environment variables to harness the
-# ultimate power of The Rust Build System.
-#
-#   * `VERBOSE=1` - Print all commands. Use this to see what's going on.
-#   * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations
-#   * `JEMALLOC_FLAGS=...` - Pass flags to jemalloc's configure script
-#
-#   * `TESTNAME=...` - Specify the name of tests to run
-#   * `CHECK_IGNORED=1` - Run normally-ignored tests
-#   * `PLEASE_BENCH=1` - Run crate benchmarks (enable `--bench` flag)
-#
-#   * `CFG_ENABLE_VALGRIND=1` - Run tests under valgrind
-#   * `VALGRIND_COMPILE=1` - Run the compiler itself under valgrind
-#                            (requires `CFG_ENABLE_VALGRIND`)
-#
-#   * `NO_REBUILD=1` - Don't rebootstrap when testing std
-#                      (and possibly other crates)
-#   * `NO_MKFILE_DEPS=1` - Don't rebuild for modified .mk files
-#
-#   * `SAVE_TEMPS=1` - Use `--save-temps` flag on all `rustc` invocations
-#   * `ASM_COMMENTS=1` - Use `-Z asm-comments`
-#   * `TIME_PASSES=1` - Use `-Z time-passes`
-#   * `TIME_LLVM_PASSES=1` - Use `-Z time-llvm-passes`
-#   * `TRACE=1` - Use `-Z trace`
-#
-# # Rust recipes for build system success
-#
-#     // Modifying libstd? Use this command to run unit tests just on your change
-#     make check-stage1-std NO_REBUILD=1 NO_BENCH=1
-#
-#     // Modifying just rustc?
-#     // Compile rustc+libstd once
-#     make rustc-stage1
-#     // From now on use this command to rebuild just rustc and reuse the previously built libstd
-#     // $host is a target triple, eg. x86_64-unknown-linux-gnu
-#     // The resulting binary is located at $host/stage1/bin/rustc.
-#     // If there are any issues with libstd recompile it with the command above.
-#     make $host/stage1/bin/rustc
-#
-#     // Added a run-pass test? Use this to test running your test
-#     make check-stage1-rpass TESTNAME=my-shiny-new-test
-#
-#     // Having trouble figuring out which test is failing? Turn off parallel tests
-#     make check-stage1-std RUST_TEST_THREADS=1
-#
-#     // To make debug!() and other logging calls visible, reconfigure:
-#     ./configure --enable-debug-assertions
-#     make ....
-#
-# If you really feel like getting your hands dirty, then:
-#
-#     run `make nitty-gritty`
-#
-# # Make command examples
-#
-# ## Docs linked commands
-#
-# * make check-stage1-rustdocck: Builds rustdoc. It has the advantage to compile
-#                                quite quickly since we're only using stage1
-#                                executables.
-# * make doc/error-index.md: Gets all doc blocks from doc comments and error
-#                            explanations to put them in a markdown file. You
-#                            can then test them by running
-#                            "rustdoc --test error-index.md".
-#
-# And of course, the wonderfully useful 'make tidy'! Always run it before opening a pull request to rust!
-#
-# </tips>
-#
-# <nitty-gritty>
-#
-# # The Rust Build System
-#
-# Gosh I wish there was something useful here (TODO).
-#
-# # An (old) explanation of how the build is structured:
-#
-# *Note: Hey, like, this is probably inaccurate, and is definitely
-# an outdated and insufficient explanation of the remarkable
-# Rust Build System.*
-#
-# There are multiple build stages (0-3) needed to verify that the
-# compiler is properly self-hosting. Each stage is divided between
-# 'host' artifacts and 'target' artifacts, where the stageN host
-# compiler builds artifacts for 1 or more stageN target architectures.
-# Once the stageN target compiler has been built for the host
-# architecture it is promoted (copied) to a stageN+1 host artifact.
-#
-# The stage3 host compiler is a compiler that successfully builds
-# itself and should (in theory) be bitwise identical to the stage2
-# host compiler. The process is bootstrapped using a stage0 host
-# compiler downloaded from a previous snapshot.
-#
-# At no time should stageN artifacts be interacting with artifacts
-# from other stages. For consistency, we use the 'promotion' logic
-# for all artifacts, even those that don't make sense on non-host
-# architectures.
-#
-# The directory layout for a stage is intended to match the layout
-# of the installed compiler, and looks like the following:
-#
-# stageN - this is the system root, corresponding to, e.g. /usr
-#   bin - binaries compiled for the host
-#   lib - libraries used by the host compiler
-#     rustlib - rustc's own place to organize libraries
-#       $(target) - target-specific artifacts
-#         bin - binaries for target architectures
-#         lib - libraries for target architectures
-#
-# A note about host libraries:
-#
-# The only libraries that get promoted to stageN/lib are those needed
-# by rustc. In general, rust programs, even those compiled for the
-# host architecture will use libraries from the target
-# directories. This gives rust some freedom to experiment with how
-# libraries are managed and versioned without polluting the common
-# areas of the filesystem.
-#
-# General rust binaries may still live in the host bin directory; they
-# will just link against the libraries in the target lib directory.
-#
-# Admittedly this is a little convoluted.
-#
-# If you find yourself working on the make infrastructure itself, and trying to
-# find the value of a given variable after expansion, you can use:
-#
-# make print-VARIABLE_NAME
-#
-# To extract it
-#
-# </nitty-gritty>
-#
-
-######################################################################
-# Primary rules
-######################################################################
-
-# Issue #9531: If you change the order of any of the following (or add
-# new definitions), make sure definitions always precede their uses,
-# especially for the dependency lists of recipes.
-
-# First, load the variables exported by the configure script
-include config.mk
-
-# Just a few macros used everywhere
-include $(CFG_SRC_DIR)mk/util.mk
-# Reconfiguring when the makefiles or submodules change
-include $(CFG_SRC_DIR)mk/reconfig.mk
-# All crates and their dependencies
-include $(CFG_SRC_DIR)mk/crates.mk
-# Various bits of setup, common macros, and top-level rules
-include $(CFG_SRC_DIR)mk/main.mk
-# C and assembly components that are not LLVM
-include $(CFG_SRC_DIR)mk/rt.mk
-# Rules for crates in the target directories
-include $(CFG_SRC_DIR)mk/target.mk
-# Rules for crates in the host directories
-include $(CFG_SRC_DIR)mk/host.mk
-# Special rules for bootstrapping stage0
-include $(CFG_SRC_DIR)mk/stage0.mk
-# Rust-specific LLVM extensions
-include $(CFG_SRC_DIR)mk/rustllvm.mk
-# Documentation
-include $(CFG_SRC_DIR)mk/docs.mk
-# LLVM
-include $(CFG_SRC_DIR)mk/llvm.mk
-# Rules for installing debugger scripts
-include $(CFG_SRC_DIR)mk/debuggers.mk
-
-######################################################################
-# Secondary makefiles, conditionalized for speed
-######################################################################
-
-# The test suite
-ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
-               $(findstring test,$(MAKECMDGOALS))  \
-               $(findstring tidy,$(MAKECMDGOALS))),)
-  CFG_INFO := $(info cfg: including test rules)
-  include $(CFG_SRC_DIR)mk/tests.mk
-  include $(CFG_SRC_DIR)mk/grammar.mk
-endif
-
-# Copy all the distributables to another directory for binary install
-ifneq ($(strip $(findstring prepare,$(MAKECMDGOALS)) \
-               $(findstring dist,$(MAKECMDGOALS)) \
-               $(findstring install,$(MAKECMDGOALS))),)
-  CFG_INFO := $(info cfg: including prepare rules)
-  include $(CFG_SRC_DIR)mk/prepare.mk
-endif
-
-# Source and binary distribution artifacts
-ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \
-               $(findstring install,$(MAKECMDGOALS)) \
-               $(findstring clean,$(MAKECMDGOALS))),)
-  CFG_INFO := $(info cfg: including dist rules)
-  include $(CFG_SRC_DIR)mk/dist.mk
-endif
-
-# (Unix) Installation from the build directory
-ifneq ($(findstring install,$(MAKECMDGOALS)),)
-  CFG_INFO := $(info cfg: including install rules)
-  include $(CFG_SRC_DIR)mk/install.mk
-endif
-
-# Cleaning
-ifneq ($(findstring clean,$(MAKECMDGOALS)),)
-  CFG_INFO := $(info cfg: including clean rules)
-  include $(CFG_SRC_DIR)mk/clean.mk
-endif
-
-# CTAGS building
-ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \
-               $(findstring TAGS.vi,$(MAKECMDGOALS)) \
-               $(findstring TAGS.rustc.emacs,$(MAKECMDGOALS)) \
-               $(findstring TAGS.rustc.vi,$(MAKECMDGOALS))),)
-  CFG_INFO := $(info cfg: including ctags rules)
-  include $(CFG_SRC_DIR)mk/ctags.mk
-endif
-
-.DEFAULT:
-       @echo
-       @echo "======================================================"
-       @echo "== If you need help, run 'make help' or 'make tips' =="
-       @echo "======================================================"
-       @echo
-       exit 1
index 99d6b7709ede989bb5b478f4972cd85b299b1772..f26c0b6b6116194cd1fbc74fb64fa4d384b08239 100644 (file)
@@ -1,3 +1,11 @@
+Version 1.15.1 (2017-02-07)
+===========================
+
+* [Fix IntoIter::as_mut_slice's signature][39466]
+
+[39466]: https://github.com/rust-lang/rust/pull/39466
+
+
 Version 1.15.0 (2017-02-02)
 ===========================
 
index c617ac8a4e342d061e97209403d25d582952f6aa..2183d8da95f89bb40946449ca4d7f3c92fa0fa62 100644 (file)
@@ -15,11 +15,6 @@ environment:
     SCRIPT: python x.py test --host i686-pc-windows-msvc --target i686-pc-windows-msvc && python x.py dist
     DEPLOY: 1
 
-  # MSVC makefiles
-  - MSYS_BITS: 64
-    RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --disable-rustbuild
-    RUST_CHECK_TARGET: check
-
   # MSVC cargotest
   - MSYS_BITS: 64
     NO_VENDOR: 1
@@ -58,13 +53,6 @@ environment:
     MINGW_DIR: mingw32
     DEPLOY: 1
 
-  - MSYS_BITS: 32
-    RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --disable-rustbuild
-    RUST_CHECK_TARGET: check
-    MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
-    MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
-    MINGW_DIR: mingw32
-
   - MSYS_BITS: 64
     SCRIPT: python x.py test && python x.py dist
     RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended
index 505767cede5529083892bcb746e821433009acdf..597f007633640fbb079bde04d002ba4f733e0816 100755 (executable)
--- a/configure
+++ b/configure
@@ -517,7 +517,7 @@ case $CFG_CPUTYPE in
         CFG_OSTYPE="${CFG_OSTYPE}eabihf"
         ;;
 
-    aarch64)
+    aarch64 | arm64)
         CFG_CPUTYPE=aarch64
         ;;
 
@@ -684,6 +684,7 @@ valopt musl-root-arm "" "arm-unknown-linux-musleabi install directory"
 valopt musl-root-armhf "" "arm-unknown-linux-musleabihf install directory"
 valopt musl-root-armv7 "" "armv7-unknown-linux-musleabihf install directory"
 valopt extra-filename "" "Additional data that is hashed and passed to the -C extra-filename flag"
+valopt qemu-armhf-rootfs "" "rootfs in qemu testing, you probably don't want to use this"
 
 if [ -e ${CFG_SRC_DIR}.git ]
 then
@@ -993,191 +994,12 @@ then
     putvar CFG_LOCAL_RUST_ROOT
 fi
 
-# Force bitrig to build with clang; gcc doesn't like us there
-if [ $CFG_OSTYPE = unknown-bitrig ]
-then
-    step_msg "on Bitrig, forcing use of clang"
-    CFG_ENABLE_CLANG=1
-fi
-
-# default gcc version under OpenBSD maybe too old, try using egcc, which is a
-# gcc version from ports
-if [ $CFG_OSTYPE = unknown-openbsd ]
-then
-    if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then
-        step_msg "older GCC found, try with egcc instead"
-
-        # probe again but using egcc
-        probe CFG_GCC egcc
-
-        # and use egcc/eg++ for CC/CXX too if it was found
-        # (but user setting has priority)
-        if [ -n "$CFG_GCC" ]; then
-            CC="${CC:-egcc}"
-            CXX="${CXX:-eg++}"
-        fi
-    fi
-fi
-
-# OS X 10.9, gcc is actually clang. This can cause some confusion in the build
-# system, so if we find that gcc is clang, we should just use clang directly.
-if [ $CFG_OSTYPE = apple-darwin -a -z "$CFG_ENABLE_CLANG" ]
-then
-    CFG_OSX_GCC_VERSION=$("$CFG_GCC" --version 2>&1 | grep "Apple LLVM version")
-    if [ $? -eq 0 ]
-    then
-        step_msg "on OS X >=10.9, forcing use of clang"
-        CFG_ENABLE_CLANG=1
-    else
-        if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then
-            step_msg "older GCC found, using clang instead"
-            CFG_ENABLE_CLANG=1
-        else
-            # on OS X, with xcode 5 and newer, certain developers may have
-            # cc, gcc and g++ point to a  mixture of clang and gcc
-            # if so, this will create very strange build errors
-            # this last stanza is to detect some such problems and save the future rust
-            # contributor some time solving that issue.
-            # this detection could be generalized to other OSes aside from OS X
-            # but the issue seems most likely to happen on OS X
-
-            chk_cc () {
-                $1 --version 2> /dev/null | grep -q $2
-            }
-            # check that gcc, cc and g++ all point to the same compiler.
-            # note that for xcode 5, g++ points to clang, not clang++
-            if !((chk_cc gcc clang  && chk_cc g++ clang) ||
-                (chk_cc gcc gcc  &&( chk_cc g++ g++ || chk g++ gcc))); then
-                err "the gcc and g++ in your path point to different compilers.
-    Check which versions are in your path with gcc --version and g++ --version.
-    To resolve this problem, either fix your PATH  or run configure with --enable-clang"
-            fi
-
-        fi
-    fi
-fi
-
-# If the clang isn't already enabled, check for GCC, and if it is missing, turn
-# on clang as a backup.
-if [ -z "$CFG_ENABLE_CLANG" ]
-then
-  CFG_GCC_VERSION=$("$CFG_GCC" --version 2>&1)
-  if [ $? -ne 0 ]
-  then
-    step_msg "GCC not installed, will try using Clang"
-    CFG_ENABLE_CLANG=1
-  fi
-fi
-
-# Okay, at this point, we have made up our minds about whether we are
-# going to force CFG_ENABLE_CLANG or not; save the setting if so.
-if [ -n "$CFG_ENABLE_CLANG" ]
-then
-    putvar CFG_ENABLE_CLANG
-fi
-
-if [ -z "$CFG_DISABLE_LIBCPP" -a -n "$CFG_ENABLE_CLANG" ]
-then
-    CFG_USING_LIBCPP="1"
-else
-    CFG_USING_LIBCPP="0"
-fi
-
 # Same with jemalloc.  save the setting here.
 if [ -n "$CFG_DISABLE_JEMALLOC" ]
 then
     putvar CFG_DISABLE_JEMALLOC
 fi
 
-if [ -n "$CFG_LLVM_ROOT" -a -z "$CFG_DISABLE_LLVM_VERSION_CHECK" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ]
-then
-    step_msg "using custom LLVM at $CFG_LLVM_ROOT"
-
-    LLVM_CONFIG="$CFG_LLVM_ROOT/bin/llvm-config"
-    LLVM_VERSION=$($LLVM_CONFIG --version)
-
-    case $LLVM_VERSION in
-        (3.[7-9]*)
-            msg "found ok version of LLVM: $LLVM_VERSION"
-            ;;
-        (*)
-            err "bad LLVM version: $LLVM_VERSION, need >=3.7"
-            ;;
-    esac
-
-    if "$CFG_LLVM_ROOT/bin/llvm-mc" -help | grep -- "-relocation-model"; then
-        msg "found older llvm-mc"
-        CFG_LLVM_MC_HAS_RELOCATION_MODEL=1
-        putvar CFG_LLVM_MC_HAS_RELOCATION_MODEL
-    fi
-fi
-
-# Even when the user overrides the choice of CC, still try to detect
-# clang to disable some clang-specific warnings.  We here draw a
-# distinction between:
-#
-#  CFG_ENABLE_CLANG : passed --enable-clang, or host "requires" clang,
-#  CFG_USING_CLANG : compiler (clang / gcc / $CC) looks like clang.
-#
-# This distinction is important because there are some safeguards we
-# would prefer to skip when merely CFG_USING_CLANG is set; but when
-# CFG_ENABLE_CLANG is set, that indicates that we are opting into
-# running such safeguards.
-
-if [ -n "$CC" ]
-then
-    msg "skipping compiler inference steps; using provided CC=$CC"
-    CFG_CC="$CC"
-
-    CFG_OSX_CC_VERSION=$("$CFG_CC" --version 2>&1 | grep "clang")
-    if [ $? -eq 0 ]
-    then
-        step_msg "note, user-provided CC looks like clang; CC=$CC."
-        CFG_USING_CLANG=1
-        putvar CFG_USING_CLANG
-    fi
-else
-    if [ -n "$CFG_ENABLE_CLANG" ]
-    then
-        if [ -z "$CFG_CLANG" ]
-        then
-            err "clang requested but not found"
-        fi
-        CFG_CC="$CFG_CLANG"
-        CFG_USING_CLANG=1
-        putvar CFG_USING_CLANG
-    else
-        CFG_CC="gcc"
-    fi
-fi
-
-if [ -n "$CFG_ENABLE_CLANG" ]
-then
-    case "$CC" in
-        (''|*clang)
-        if [ -z "$CC" ]
-        then
-            CFG_CC="clang"
-            CFG_CXX="clang++"
-        fi
-    esac
-fi
-
-if [ -n "$CFG_ENABLE_CCACHE" ]
-then
-    if [ -z "$CFG_CCACHE" ]
-    then
-        err "ccache requested but not found"
-    fi
-
-    CFG_CC="ccache $CFG_CC"
-fi
-
-if [ -z "$CC" -a -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
-then
-    err "either clang or gcc is required"
-fi
-
 # All safeguards based on $CFG_ENABLE_CLANG should occur before this
 # point in the script; after this point, script logic should inspect
 # $CFG_USING_CLANG rather than $CFG_ENABLE_CLANG.
@@ -1190,12 +1012,6 @@ envopt CFLAGS
 envopt CXXFLAGS
 envopt LDFLAGS
 
-# stdc++ name in use
-# used to manage non-standard name (on OpenBSD for example)
-program_transform_name=$($CFG_CC -v 2>&1 | sed -n "s/.*--program-transform-name='\([^']*\)'.*/\1/p")
-CFG_STDCPP_NAME=$(echo "stdc++" | sed "${program_transform_name}")
-putvar CFG_STDCPP_NAME
-
 # a little post-processing of various config values
 CFG_PREFIX=${CFG_PREFIX%/}
 CFG_MANDIR=${CFG_MANDIR%/}
@@ -1223,651 +1039,6 @@ do
 done
 CFG_TARGET=$V_TEMP
 
-# check target-specific tool-chains
-for i in $CFG_TARGET
-do
-    L_CHECK=false
-    for j in $CFG_SUPPORTED_TARGET
-    do
-        if [ $i = $j ]
-        then
-            L_CHECK=true
-        fi
-    done
-
-    if [ $L_CHECK = false ]
-    then
-        err "unsupported target triples \"$i\" found"
-    fi
-
-    case $i in
-        *android*)
-            case $i in
-                armv7-linux-androideabi)
-                    cmd_prefix="arm-linux-androideabi"
-                    ;;
-                *)
-                    cmd_prefix=$i
-                    ;;
-            esac
-
-            upper_snake_target=$(echo "$i" | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
-            eval ndk=\$"CFG_${upper_snake_target}_NDK"
-            if [ -z "$ndk" ]
-            then
-                ndk=$CFG_ANDROID_CROSS_PATH
-                eval "CFG_${upper_snake_target}_NDK"=$CFG_ANDROID_CROSS_PATH
-                warn "generic/default Android NDK option is deprecated (use --$i-ndk option instead)"
-            fi
-
-            # Perform a basic sanity check of the NDK
-            for android_ndk_tool in "$ndk/bin/$cmd_prefix-gcc" "$ndk/bin/$cmd_prefix-g++" "$ndk/bin/$cmd_prefix-ar"
-            do
-                if [ ! -f $android_ndk_tool ]
-                then
-                    err "NDK tool $android_ndk_tool not found (bad or missing --$i-ndk option?)"
-                fi
-            done
-            ;;
-        *-unknown-nacl)
-           if [ -z "$CFG_NACL_CROSS_PATH" ]
-           then
-               err "I need the NaCl SDK path! (use --nacl-cross-path)"
-           fi
-           ;;
-        arm-apple-darwin)
-            if [ $CFG_OSTYPE != apple-darwin ]
-            then
-                err "The iOS target is only supported on Mac OS X"
-            fi
-            ;;
-
-        *-msvc)
-            # There are three builds of cmake on windows: MSVC, MinGW and Cygwin
-            # The Cygwin build does not have generators for Visual Studio, so
-            # detect that here and error.
-            if ! "$CFG_CMAKE" --help | sed -n '/^Generators/,$p' | grep 'Visual Studio' > /dev/null
-            then
-                err "
-
-cmake does not support Visual Studio generators.
-
-This is likely due to it being an msys/cygwin build of cmake, \
-rather than the required windows version, built using MinGW \
-or Visual Studio.
-
-If you are building under msys2 try installing the mingw-w64-x86_64-cmake \
-package instead of cmake:
-
-$ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
-"
-            fi
-
-            # Use the REG program to figure out where VS is installed
-            # We need to figure out where cl.exe and link.exe are, so we do some
-            # munging and some probing here. We also look for the default
-            # INCLUDE and LIB variables for MSVC so we can set those in the
-            # build system as well.
-            install=$(cmd //c reg QUERY \
-                       'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0' \
-                       -v InstallDir)
-            if [ -z "$install" ]; then
-              install=$(cmd //c reg QUERY \
-                         'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0' \
-                         -v InstallDir)
-            fi
-            need_ok "couldn't find visual studio install root"
-            CFG_MSVC_ROOT=$(echo "$install" | grep InstallDir | sed 's/.*REG_SZ[ ]*//')
-            CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
-            CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
-            putvar CFG_MSVC_ROOT
-
-            case $i in
-                x86_64-*)
-                    bits=x86_64
-                    msvc_part=amd64
-                    ;;
-                i*86-*)
-                    bits=i386
-                    msvc_part=
-                    ;;
-                *)
-                    err "can only target x86 targets for MSVC"
-                    ;;
-            esac
-            bindir="${CFG_MSVC_ROOT}/VC/bin"
-            if [ -n "$msvc_part" ]; then
-                bindir="$bindir/$msvc_part"
-            fi
-            eval CFG_MSVC_BINDIR_$bits="\"$bindir\""
-            eval CFG_MSVC_CL_$bits="\"$bindir/cl.exe\""
-            eval CFG_MSVC_LIB_$bits="\"$bindir/lib.exe\""
-            eval CFG_MSVC_LINK_$bits="\"$bindir/link.exe\""
-
-            vcvarsall="${CFG_MSVC_ROOT}/VC/vcvarsall.bat"
-            include_path=$(cmd //V:ON //c "$vcvarsall" $msvc_part \& echo !INCLUDE!)
-            need_ok "failed to learn about MSVC's INCLUDE"
-            lib_path=$(cmd //V:ON //c "$vcvarsall" $msvc_part \& echo !LIB!)
-            need_ok "failed to learn about MSVC's LIB"
-
-            eval CFG_MSVC_INCLUDE_PATH_${bits}="\"$include_path\""
-            eval CFG_MSVC_LIB_PATH_${bits}="\"$lib_path\""
-
-            putvar CFG_MSVC_BINDIR_${bits}
-            putvar CFG_MSVC_CL_${bits}
-            putvar CFG_MSVC_LIB_${bits}
-            putvar CFG_MSVC_LINK_${bits}
-            putvar CFG_MSVC_INCLUDE_PATH_${bits}
-            putvar CFG_MSVC_LIB_PATH_${bits}
-            ;;
-
-        *)
-            ;;
-    esac
-done
-
-if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ]
-then
-    # There are some MSYS python builds which will auto-translate
-    # windows-style paths to MSYS-style paths in Python itself.
-    # Unfortunately this breaks LLVM's build system as somewhere along
-    # the line LLVM prints a path into a file from Python and then CMake
-    # later tries to interpret that path. If Python prints a MSYS path
-    # and CMake tries to use it as a Windows path, you're gonna have a
-    # Bad Time.
-    #
-    # Consequently here we try to detect when that happens and print an
-    # error if it does.
-    if $CFG_PYTHON -c 'import sys; print sys.argv[1]' `pwd` | grep '^/' > /dev/null
-    then
-        err "
-
-python is silently translating windows paths to MSYS paths \
-and the build will fail if this python is used.
-
-Either an official python install must be used or an \
-alternative python package in MinGW must be used.
-
-If you are building under msys2 try installing the mingw-w64-x86_64-python2 \
-package instead of python2:
-
-$ pacman -S mingw-w64-x86_64-python2
-"
-    fi
-fi
-
-if [ -n "$CFG_PERF" ]
-then
-    HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'`
-    if [ -z "$HAVE_PERF_LOGFD" ];
-    then
-        CFG_PERF_WITH_LOGFD=1
-        putvar CFG_PERF_WITH_LOGFD
-    fi
-fi
-
-if [ -n "$CFG_DISABLE_RUSTBUILD" ]; then
-
-  step_msg "making directories"
-
-  for i in \
-      doc doc/std doc/extra \
-      dl tmp dist
-  do
-      make_dir $i
-  done
-
-  for t in $CFG_HOST
-  do
-      make_dir $t/llvm
-  done
-
-  for t in $CFG_HOST
-  do
-      make_dir $t/rustllvm
-  done
-
-  for t in $CFG_TARGET
-  do
-    make_dir $t/rt
-    for s in 0 1 2 3
-    do
-      make_dir $t/rt/stage$s
-      make_dir $t/rt/jemalloc
-      make_dir $t/rt/compiler-rt
-      for i in                                          \
-        isaac sync test \
-        arch/i386 arch/x86_64 arch/arm arch/aarch64 arch/mips arch/powerpc
-      do
-        make_dir $t/rt/stage$s/$i
-      done
-    done
-  done
-
-  for h in $CFG_HOST
-  do
-      for t in $CFG_TARGET
-      do
-          # host bin dir stage0
-          make_dir $h/stage0/bin
-
-          # host lib dir stage0
-          make_dir $h/stage0/lib
-
-          # host test dir stage0
-          make_dir $h/stage0/test
-
-          # target bin dir stage0
-          make_dir $h/stage0/lib/rustlib/$t/bin
-
-          # target lib dir stage0
-          make_dir $h/stage0/lib/rustlib/$t/lib
-
-          for i in 1 2 3
-          do
-              # host bin dir
-              make_dir $h/stage$i/bin
-
-              # host lib dir
-              make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE
-
-              # host test dir
-              make_dir $h/stage$i/test
-
-              # target bin dir
-              make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/bin
-
-              # target lib dir
-              make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/lib
-          done
-      done
-
-      make_dir $h/test/run-pass
-      make_dir $h/test/run-pass-valgrind
-      make_dir $h/test/run-pass-fulldeps
-      make_dir $h/test/run-fail
-      make_dir $h/test/run-fail-fulldeps
-      make_dir $h/test/compile-fail
-      make_dir $h/test/parse-fail
-      make_dir $h/test/compile-fail-fulldeps
-      make_dir $h/test/bench
-      make_dir $h/test/perf
-      make_dir $h/test/pretty
-      make_dir $h/test/debuginfo-gdb
-      make_dir $h/test/debuginfo-lldb
-      make_dir $h/test/codegen
-      make_dir $h/test/codegen-units
-      make_dir $h/test/rustdoc
-  done
-
-fi
-
-# Configure submodules
-step_msg "configuring submodules"
-
-# Have to be in the top of src directory for this
-if [ -z "$CFG_DISABLE_MANAGE_SUBMODULES" ] && [ -n "$CFG_DISABLE_RUSTBUILD" ]
-then
-    cd ${CFG_SRC_DIR}
-
-    msg "git: submodule sync"
-    "${CFG_GIT}" submodule sync
-
-    msg "git: submodule init"
-    "${CFG_GIT}" submodule init
-
-    # Disable submodules that we're not using
-    if [ -n "${CFG_LLVM_ROOT}" ]; then
-        msg "git: submodule deinit src/llvm"
-        "${CFG_GIT}" submodule deinit src/llvm
-    fi
-    if [ -n "${CFG_JEMALLOC_ROOT}" ]; then
-        msg "git: submodule deinit src/jemalloc"
-        "${CFG_GIT}" submodule deinit src/jemalloc
-    fi
-
-    msg "git: submodule update"
-    "${CFG_GIT}" submodule update
-    need_ok "git failed"
-
-    msg "git: submodule foreach sync"
-    "${CFG_GIT}" submodule foreach --recursive 'if test -e .gitmodules; then git submodule sync; fi'
-    need_ok "git failed"
-
-    msg "git: submodule foreach update"
-    "${CFG_GIT}" submodule update --recursive
-    need_ok "git failed"
-
-    # NB: this is just for the sake of getting the submodule SHA1 values
-    # and status written into the build log.
-    msg "git: submodule status"
-    "${CFG_GIT}" submodule status --recursive
-
-    msg "git: submodule clobber"
-    "${CFG_GIT}" submodule foreach --recursive git clean -dxf
-    need_ok "git failed"
-    "${CFG_GIT}" submodule foreach --recursive git checkout .
-    need_ok "git failed"
-
-    cd ${CFG_BUILD_DIR}
-fi
-
-# Do a sanity check that the submodule source exists. Because GitHub
-# automatically publishes broken tarballs that can't be disabled, and
-# people download them and try to use them.
-if [ ! -e "${CFG_SRC_DIR}/src/liblibc" ]; then
-    err "some submodules are missing. Is this a broken tarball?
-
-If you downloaded this tarball from the GitHub release pages at
-https://github.com/rust-lang/rust/releases,
-then please delete it and instead download the source from
-https://www.rust-lang.org/downloads.html"
-
-fi
-
-# Configure llvm, only if necessary
-step_msg "looking at LLVM"
-CFG_LLVM_SRC_DIR=${CFG_SRC_DIR}src/llvm/
-for t in $CFG_HOST
-do
-    do_reconfigure=1
-    is_msvc=0
-    case "$t" in
-        (*-msvc)
-        is_msvc=1
-        ;;
-    esac
-
-    if [ -z "$CFG_DISABLE_RUSTBUILD" ]
-    then
-        msg "not configuring LLVM, rustbuild in use"
-        do_reconfigure=0
-    elif [ -z "$CFG_LLVM_ROOT" ]
-    then
-        LLVM_BUILD_DIR=${CFG_BUILD_DIR}$t/llvm
-        LLVM_INST_DIR=$LLVM_BUILD_DIR
-        # For some weird reason the MSVC output dir is different than Unix
-        if [ ${is_msvc} -ne 0 ]; then
-            if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]
-            then
-                # Just use LLVM straight from its build directory to
-                # avoid 'make install' time
-                LLVM_INST_DIR=$LLVM_BUILD_DIR/Debug
-            else
-                LLVM_INST_DIR=$LLVM_BUILD_DIR/Release
-            fi
-        fi
-    else
-        msg "not reconfiguring LLVM, external LLVM root"
-        # The user is using their own LLVM
-        LLVM_BUILD_DIR=
-        LLVM_INST_DIR=$CFG_LLVM_ROOT
-        do_reconfigure=0
-        # Check that LLVm FileCheck is available. Needed for the tests
-        if [ -z "$CFG_DISABLE_CODEGEN_TESTS" ]; then
-            need_cmd $LLVM_INST_DIR/bin/FileCheck
-        fi
-    fi
-
-    if [ ${do_reconfigure} -ne 0 ]
-    then
-    # because git is hilarious, it might have put the module index
-    # in a couple places.
-        index1="${CFG_SRC_DIR}.git/modules/src/llvm/index"
-        index2="${CFG_SRC_DIR}src/llvm/.git/index"
-        for index in ${index1} ${index2}
-        do
-            config_status="${LLVM_BUILD_DIR}/config.status"
-            if test -e ${index} -a \
-                    -e ${config_status} -a \
-                    ${config_status} -nt ${index}
-            then
-                msg "not reconfiguring LLVM, config.status is fresh"
-                do_reconfigure=0
-            fi
-        done
-    fi
-
-    # We need the generator later on for compiler-rt even if LLVM's not built
-    if [ -n "$CFG_NINJA" ]
-    then
-        generator="Ninja"
-    elif [ ${is_msvc} -ne 0 ]
-    then
-        case "$CFG_MSVC_ROOT" in
-            *14.0*)
-                generator="Visual Studio 14 2015"
-                ;;
-            *12.0*)
-                generator="Visual Studio 12 2013"
-                ;;
-            *)
-                err "can't determine generator for LLVM cmake"
-                ;;
-        esac
-        case "$t" in
-            x86_64-*)
-                generator="$generator Win64"
-                ;;
-            i686-*)
-                ;;
-            *)
-                err "can only build LLVM for x86 platforms"
-                ;;
-        esac
-    else
-        generator="Unix Makefiles"
-    fi
-    CFG_CMAKE_GENERATOR=$generator
-    putvar CFG_CMAKE_GENERATOR
-
-    msg "configuring LLVM for $t"
-
-    LLVM_CFLAGS_32=""
-    LLVM_CXXFLAGS_32=""
-    LLVM_LDFLAGS_32=""
-    LLVM_CFLAGS_64=""
-    LLVM_CXXFLAGS_64=""
-    LLVM_LDFLAGS_64=""
-
-    case "$CFG_CC" in
-        ("ccache clang")
-            LLVM_CXX_32="ccache"
-            LLVM_CC_32="ccache"
-            LLVM_CXX_32_ARG1="clang++"
-            LLVM_CC_32_ARG1="clang"
-            LLVM_CFLAGS_32="-Qunused-arguments"
-            LLVM_CXXFLAGS_32="-Qunused-arguments"
-
-            LLVM_CXX_64="ccache"
-            LLVM_CC_64="ccache"
-            LLVM_CXX_64_ARG1="clang++"
-            LLVM_CC_64_ARG1="clang"
-            LLVM_CFLAGS_64="-Qunused-arguments"
-            LLVM_CXXFLAGS_64="-Qunused-arguments"
-            ;;
-        ("clang")
-            LLVM_CXX_32="clang++"
-            LLVM_CC_32="clang"
-            LLVM_CFLAGS_32="-Qunused-arguments"
-            LLVM_CXXFLAGS_32="-Qunused-arguments"
-
-            LLVM_CXX_64="clang++"
-            LLVM_CC_64="clang"
-            LLVM_CFLAGS_64="-Qunused-arguments"
-            LLVM_CXXFLAGS_64="-Qunused-arguments"
-            ;;
-        ("ccache gcc")
-            LLVM_CXX_32="ccache"
-            LLVM_CC_32="ccache"
-            LLVM_CXX_32_ARG1="g++"
-            LLVM_CC_32_ARG1="gcc"
-
-            LLVM_CXX_64="ccache"
-            LLVM_CC_64="ccache"
-            LLVM_CXX_64_ARG1="g++"
-            LLVM_CC_64_ARG1="gcc"
-            ;;
-        ("gcc")
-            if [ -z "$CFG_ENABLE_SCCACHE" ]; then
-                LLVM_CXX_32="g++"
-                LLVM_CC_32="gcc"
-
-                LLVM_CXX_64="g++"
-                LLVM_CC_64="gcc"
-            else
-                LLVM_CXX_32="sccache"
-                LLVM_CC_32="sccache"
-                LLVM_CXX_32_ARG1="g++"
-                LLVM_CC_32_ARG1="gcc"
-
-                LLVM_CXX_64="sccache"
-                LLVM_CC_64="sccache"
-                LLVM_CXX_64_ARG1="g++"
-                LLVM_CC_64_ARG1="gcc"
-            fi
-            ;;
-
-        (*)
-            msg "inferring LLVM_CXX/CC from CXX/CC = $CXX/$CC"
-            if [ -n "$CFG_ENABLE_CCACHE" ]
-            then
-                if [ -z "$CFG_CCACHE" ]
-                then
-                    err "ccache requested but not found"
-                fi
-
-                LLVM_CXX_32="ccache"
-                LLVM_CC_32="ccache"
-                LLVM_CXX_32_ARG1="$CXX"
-                LLVM_CC_32_ARG1="$CC"
-
-                LLVM_CXX_64="ccache"
-                LLVM_CC_64="ccache"
-                LLVM_CXX_64_ARG1="$CXX"
-                LLVM_CC_64_ARG1="$CC"
-            else
-                LLVM_CXX_32="$CXX"
-                LLVM_CC_32="$CC"
-
-                LLVM_CXX_64="$CXX"
-                LLVM_CC_64="$CC"
-            fi
-
-            ;;
-    esac
-
-    case "$CFG_CPUTYPE" in
-        (x86*)
-            LLVM_CFLAGS_32="$LLVM_CFLAGS_32 -m32"
-            LLVM_CXXFLAGS_32="$LLVM_CXXFLAGS_32 -m32"
-            LLVM_LDFLAGS_32="$LLVM_LDFLAGS_32 -m32"
-            ;;
-    esac
-
-    if echo $t | grep -q x86_64
-    then
-        LLVM_CXX=$LLVM_CXX_64
-        LLVM_CC=$LLVM_CC_64
-        LLVM_CXX_ARG1=$LLVM_CXX_64_ARG1
-        LLVM_CC_ARG1=$LLVM_CC_64_ARG1
-        LLVM_CFLAGS=$LLVM_CFLAGS_64
-        LLVM_CXXFLAGS=$LLVM_CXXFLAGS_64
-        LLVM_LDFLAGS=$LLVM_LDFLAGS_64
-    else
-        LLVM_CXX=$LLVM_CXX_32
-        LLVM_CC=$LLVM_CC_32
-        LLVM_CXX_ARG1=$LLVM_CXX_32_ARG1
-        LLVM_CC_ARG1=$LLVM_CC_32_ARG1
-        LLVM_CFLAGS=$LLVM_CFLAGS_32
-        LLVM_CXXFLAGS=$LLVM_CXXFLAGS_32
-        LLVM_LDFLAGS=$LLVM_LDFLAGS_32
-    fi
-
-    if [ "$CFG_USING_LIBCPP" != "0" ]; then
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_LIBCXX=ON"
-    fi
-
-    # Turn off things we don't need
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_TESTS=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_EXAMPLES=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_DOCS=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ZLIB=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DWITH_POLY=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_TERMINFO=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_LIBEDIT=OFF"
-
-    arch="$(echo "$t" | cut -d - -f 1)"
-
-    if [ "$arch" = i686 ]; then
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_BUILD_32_BITS=ON"
-    fi
-
-    if [ "$t" != "$CFG_BUILD" ]; then
-        # see http://llvm.org/docs/HowToCrossCompileLLVM.html
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CROSSCOMPILING=True"
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TARGET_ARCH=$arch"
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TABLEGEN=$CFG_BUILD_DIR/$CFG_BUILD/llvm/bin/llvm-tblgen"
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=$t"
-    fi
-
-    # MSVC handles compiler business itself
-    if [ ${is_msvc} -eq 0 ]; then
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER=$LLVM_CC"
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER=$LLVM_CXX"
-        CMAKE_ARGS="$CMAKE_ARGS '-DCMAKE_C_FLAGS=$LLVM_CFLAGS'"
-        CMAKE_ARGS="$CMAKE_ARGS '-DCMAKE_CXX_FLAGS=$LLVM_CXXFLAGS'"
-        if [ -n "$LLVM_CC_ARG1" ]; then
-            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER_ARG1=$LLVM_CC_ARG1"
-        fi
-        if [ -n "$LLVM_CXX_ARG1" ]; then
-            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER_ARG1=$LLVM_CXX_ARG1"
-        fi
-        # FIXME: What about LDFLAGS?
-    fi
-
-    if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug"
-    elif [ -n "$CFG_ENABLE_LLVM_RELEASE_DEBUGINFO" ]; then
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=RelWithDebInfo"
-    else
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release"
-    fi
-    if [ -z "$CFG_ENABLE_LLVM_ASSERTIONS" ]
-    then
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=OFF"
-    else
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=ON"
-    fi
-
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TARGETS_TO_BUILD='X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc'"
-    CMAKE_ARGS="$CMAKE_ARGS -G '$CFG_CMAKE_GENERATOR'"
-    CMAKE_ARGS="$CMAKE_ARGS $CFG_LLVM_SRC_DIR"
-
-    if [ ${do_reconfigure} -ne 0 ]
-    then
-        msg "configuring LLVM for $t with cmake"
-
-        msg "configuring LLVM with:"
-        msg "$CMAKE_ARGS"
-
-        (cd $LLVM_BUILD_DIR && eval "\"$CFG_CMAKE\"" $CMAKE_ARGS)
-        need_ok "LLVM cmake configure failed"
-    fi
-
-    # Construct variables for LLVM build and install directories for
-    # each target. These will be named
-    # CFG_LLVM_BUILD_DIR_${target_triple} but all the hyphens in
-    # target_triple will be converted to underscore, because bash
-    # variables can't contain hyphens. The makefile will then have to
-    # convert back.
-    CFG_LLVM_BUILD_DIR=$(echo CFG_LLVM_BUILD_DIR_${t} | tr - _)
-    CFG_LLVM_INST_DIR=$(echo CFG_LLVM_INST_DIR_${t} | tr - _)
-    eval ${CFG_LLVM_BUILD_DIR}="'$LLVM_BUILD_DIR'"
-    eval ${CFG_LLVM_INST_DIR}="'$LLVM_INST_DIR'"
-done
-
-
 step_msg "writing configuration"
 
 putvar CFG_SRC_DIR
@@ -1915,15 +1086,8 @@ do
     putvar $CFG_LLVM_INST_DIR
 done
 
-if [ -z "$CFG_DISABLE_RUSTBUILD" ]
-then
-    INPUT_MAKEFILE=src/bootstrap/mk/Makefile.in
-else
-    INPUT_MAKEFILE=Makefile.in
-fi
-
 msg
-copy_if_changed ${CFG_SRC_DIR}${INPUT_MAKEFILE} ./Makefile
+copy_if_changed ${CFG_SRC_DIR}src/bootstrap/mk/Makefile.in ./Makefile
 move_if_changed config.tmp config.mk
 rm -f config.tmp
 touch config.stamp
@@ -1940,22 +1104,5 @@ else
     X_PY=${CFG_SRC_DIR_RELATIVE}x.py
 fi
 
-if [ -z "$CFG_DISABLE_RUSTBUILD" ]; then
-    msg "NOTE you have now configured rust to use a rewritten build system"
-    msg "     called rustbuild, and as a result this may have bugs that "
-    msg "     you did not see before. If you experience any issues you can"
-    msg "     go back to the old build system with --disable-rustbuild and"
-    msg "     please feel free to report any bugs!"
-    msg ""
-    msg "run \`python ${X_PY} --help\`"
-else
-    warn "the makefile-based build system is deprecated in favor of rustbuild"
-    msg ""
-    msg "It is recommended you avoid passing --disable-rustbuild to get your"
-    msg "build working as the makefiles will be deleted on 2017-02-02. If you"
-    msg "encounter bugs with rustbuild please file issues against rust-lang/rust"
-    msg ""
-    msg "run \`make help\`"
-fi
-
+msg "run \`python ${X_PY} --help\`"
 msg
diff --git a/mk/cfg/aarch64-apple-ios.mk b/mk/cfg/aarch64-apple-ios.mk
deleted file mode 100644 (file)
index 5d822f1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# aarch64-apple-ios configuration
-CFG_SDK_NAME_aarch64-apple-ios := iphoneos
-CFG_SDK_ARCHS_aarch64-apple-ios := arm64
-ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
-CFG_IOS_SDK_aarch64-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
-CFG_IOS_SDK_FLAGS_aarch64-apple-ios := -target aarch64-apple-darwin -isysroot $(CFG_IOS_SDK_aarch64-apple-ios) -mios-version-min=7.0 -arch arm64
-CC_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
-LINK_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
-CXX_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-CPP_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-AR_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
-endif
-CFG_LIB_NAME_aarch64-apple-ios = lib$(1).a
-CFG_LIB_GLOB_aarch64-apple-ios = lib$(1)-*.a
-CFG_INSTALL_ONLY_RLIB_aarch64-apple-ios = 1
-CFG_STATIC_LIB_NAME_aarch64-apple-ios=lib$(1).a
-CFG_LIB_DSYM_GLOB_aarch64-apple-ios = lib$(1)-*.a.dSYM
-CFG_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios)
-CFG_JEMALLOC_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios)
-CFG_GCCISH_CFLAGS_aarch64-apple-ios :=  -fPIC $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios)
-CFG_GCCISH_CXXFLAGS_aarch64-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) -I$(CFG_IOS_SDK_aarch64-apple-ios)/usr/include/c++/4.2.1
-CFG_GCCISH_LINK_FLAGS_aarch64-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_aarch64-apple-ios) -Wl,-no_compact_unwind
-CFG_GCCISH_DEF_FLAG_aarch64-apple-ios := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_aarch64-apple-ios := -mattr=+neon,+cyclone,+fp-armv8
-CFG_INSTALL_NAME_aarch64-apple-ios = -Wl,-install_name,@rpath/$(1)
-CFG_LIBUV_LINK_FLAGS_aarch64-apple-ios =
-CFG_EXE_SUFFIX_aarch64-apple-ios :=
-CFG_WINDOWSY_aarch64-apple-ios :=
-CFG_UNIXY_aarch64-apple-ios := 1
-CFG_LDPATH_aarch64-apple-ios :=
-CFG_RUN_aarch64-apple-ios = $(2)
-CFG_RUN_TARG_aarch64-apple-ios = $(call CFG_RUN_aarch64-apple-ios,,$(2))
-CFG_GNU_TRIPLE_aarch64-apple-ios := aarch64-apple-ios
diff --git a/mk/cfg/aarch64-linux-android.mk b/mk/cfg/aarch64-linux-android.mk
deleted file mode 100644 (file)
index 274f738..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# aarch64-linux-android configuration
-# CROSS_PREFIX_aarch64-linux-android-
-CC_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-gcc
-CXX_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-g++
-CPP_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-gcc -E
-AR_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-ar
-CFG_LIB_NAME_aarch64-linux-android=lib$(1).so
-CFG_STATIC_LIB_NAME_aarch64-linux-android=lib$(1).a
-CFG_LIB_GLOB_aarch64-linux-android=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_aarch64-linux-android=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_aarch64-linux-android := -D__aarch64__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CFLAGS_aarch64-linux-android := -Wall -g -fPIC -D__aarch64__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_aarch64-linux-android := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_aarch64-linux-android := -shared -fPIC -ldl -g -lm -lsupc++
-CFG_GCCISH_DEF_FLAG_aarch64-linux-android := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_aarch64-linux-android :=
-CFG_INSTALL_NAME_aarch64-linux-android =
-CFG_EXE_SUFFIX_aarch64-linux-android :=
-CFG_WINDOWSY_aarch64-linux-android :=
-CFG_UNIXY_aarch64-linux-android := 1
-CFG_LDPATH_aarch64-linux-android :=
-CFG_RUN_aarch64-linux-android=
-CFG_RUN_TARG_aarch64-linux-android=
-RUSTC_FLAGS_aarch64-linux-android :=
-RUSTC_CROSS_FLAGS_aarch64-linux-android :=
-CFG_GNU_TRIPLE_aarch64-linux-android := aarch64-linux-android
diff --git a/mk/cfg/aarch64-unknown-freebsd.mk b/mk/cfg/aarch64-unknown-freebsd.mk
new file mode 100644 (file)
index 0000000..34aee77
--- /dev/null
@@ -0,0 +1 @@
+# rustbuild-only target
diff --git a/mk/cfg/aarch64-unknown-fuchsia.mk b/mk/cfg/aarch64-unknown-fuchsia.mk
deleted file mode 100644 (file)
index 34aee77..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/aarch64-unknown-linux-gnu.mk b/mk/cfg/aarch64-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index 6637423..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# aarch64-unknown-linux-gnu configuration
-CROSS_PREFIX_aarch64-unknown-linux-gnu=aarch64-linux-gnu-
-CC_aarch64-unknown-linux-gnu=gcc
-CXX_aarch64-unknown-linux-gnu=g++
-CPP_aarch64-unknown-linux-gnu=gcc -E
-AR_aarch64-unknown-linux-gnu=ar
-CFG_LIB_NAME_aarch64-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_aarch64-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_aarch64-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_aarch64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_aarch64-unknown-linux-gnu := -D__aarch64__ $(CFLAGS)
-CFG_GCCISH_CFLAGS_aarch64-unknown-linux-gnu := -Wall -g -fPIC -D__aarch64__ $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_aarch64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_aarch64-unknown-linux-gnu := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_aarch64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_aarch64-unknown-linux-gnu :=
-CFG_INSTALL_NAME_aarch64-unknown-linux-gnu =
-CFG_EXE_SUFFIX_aarch64-unknown-linux-gnu :=
-CFG_WINDOWSY_aarch64-unknown-linux-gnu :=
-CFG_UNIXY_aarch64-unknown-linux-gnu := 1
-CFG_LDPATH_aarch64-unknown-linux-gnu :=
-CFG_RUN_aarch64-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_aarch64-unknown-linux-gnu=$(call CFG_RUN_aarch64-unknown-linux-gnu,,$(2))
-RUSTC_FLAGS_aarch64-unknown-linux-gnu :=
-RUSTC_CROSS_FLAGS_aarch64-unknown-linux-gnu :=
-CFG_GNU_TRIPLE_aarch64-unknown-linux-gnu := aarch64-unknown-linux-gnu
diff --git a/mk/cfg/arm-linux-androideabi.mk b/mk/cfg/arm-linux-androideabi.mk
deleted file mode 100644 (file)
index c084954..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# arm-linux-androideabi configuration
-CC_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc
-CXX_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-g++
-CPP_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc -E
-AR_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-ar
-CFG_LIB_NAME_arm-linux-androideabi=lib$(1).so
-CFG_STATIC_LIB_NAME_arm-linux-androideabi=lib$(1).a
-CFG_LIB_GLOB_arm-linux-androideabi=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_arm-linux-androideabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_arm-linux-androideabi := -D__arm__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CFLAGS_arm-linux-androideabi := -Wall -g -fPIC -D__arm__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_arm-linux-androideabi := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_arm-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++
-CFG_GCCISH_DEF_FLAG_arm-linux-androideabi := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_arm-linux-androideabi :=
-CFG_INSTALL_NAME_arm-linux-androideabi =
-CFG_EXE_SUFFIX_arm-linux-androideabi :=
-CFG_WINDOWSY_arm-linux-androideabi :=
-CFG_UNIXY_arm-linux-androideabi := 1
-CFG_LDPATH_arm-linux-androideabi :=
-CFG_RUN_arm-linux-androideabi=
-CFG_RUN_TARG_arm-linux-androideabi=
-RUSTC_FLAGS_arm-linux-androideabi :=
-RUSTC_CROSS_FLAGS_arm-linux-androideabi :=
-CFG_GNU_TRIPLE_arm-linux-androideabi := arm-linux-androideabi
diff --git a/mk/cfg/arm-unknown-linux-gnueabi.mk b/mk/cfg/arm-unknown-linux-gnueabi.mk
deleted file mode 100644 (file)
index f66ad04..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# arm-unknown-linux-gnueabi configuration
-CROSS_PREFIX_arm-unknown-linux-gnueabi=arm-linux-gnueabi-
-CC_arm-unknown-linux-gnueabi=gcc
-CXX_arm-unknown-linux-gnueabi=g++
-CPP_arm-unknown-linux-gnueabi=gcc -E
-AR_arm-unknown-linux-gnueabi=ar
-CFG_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).so
-CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).a
-CFG_LIB_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabi := -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabi := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabi := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_arm-unknown-linux-gnueabi :=
-CFG_INSTALL_NAME_arm-unknown-linux-gnueabi =
-CFG_EXE_SUFFIX_arm-unknown-linux-gnueabi :=
-CFG_WINDOWSY_arm-unknown-linux-gnueabi :=
-CFG_UNIXY_arm-unknown-linux-gnueabi := 1
-CFG_LDPATH_arm-unknown-linux-gnueabi :=
-CFG_RUN_arm-unknown-linux-gnueabi=$(2)
-CFG_RUN_TARG_arm-unknown-linux-gnueabi=$(call CFG_RUN_arm-unknown-linux-gnueabi,,$(2))
-RUSTC_FLAGS_arm-unknown-linux-gnueabi :=
-RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabi :=
-CFG_GNU_TRIPLE_arm-unknown-linux-gnueabi := arm-unknown-linux-gnueabi
diff --git a/mk/cfg/arm-unknown-linux-gnueabihf.mk b/mk/cfg/arm-unknown-linux-gnueabihf.mk
deleted file mode 100644 (file)
index defe0dc..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# arm-unknown-linux-gnueabihf configuration
-CROSS_PREFIX_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-
-CC_arm-unknown-linux-gnueabihf=gcc
-CXX_arm-unknown-linux-gnueabihf=g++
-CPP_arm-unknown-linux-gnueabihf=gcc -E
-AR_arm-unknown-linux-gnueabihf=ar
-CFG_LIB_NAME_arm-unknown-linux-gnueabihf=lib$(1).so
-CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabihf=lib$(1).a
-CFG_LIB_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabihf := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_arm-unknown-linux-gnueabihf :=
-CFG_INSTALL_NAME_ar,-unknown-linux-gnueabihf =
-CFG_EXE_SUFFIX_arm-unknown-linux-gnueabihf :=
-CFG_WINDOWSY_arm-unknown-linux-gnueabihf :=
-CFG_UNIXY_arm-unknown-linux-gnueabihf := 1
-CFG_LDPATH_arm-unknown-linux-gnueabihf :=
-CFG_RUN_arm-unknown-linux-gnueabihf=$(2)
-CFG_RUN_TARG_arm-unknown-linux-gnueabihf=$(call CFG_RUN_arm-unknown-linux-gnueabihf,,$(2))
-RUSTC_FLAGS_arm-unknown-linux-gnueabihf := -C target-feature=+v6,+vfp2
-RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabihf :=
-CFG_GNU_TRIPLE_arm-unknown-linux-gnueabihf := arm-unknown-linux-gnueabihf
diff --git a/mk/cfg/arm-unknown-linux-musleabi.mk b/mk/cfg/arm-unknown-linux-musleabi.mk
deleted file mode 100644 (file)
index 4d1438d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# arm-unknown-linux-musleabi configuration
-CROSS_PREFIX_arm-unknown-linux-musleabi=arm-linux-musleabi-
-CC_arm-unknown-linux-musleabi=gcc
-CXX_arm-unknown-linux-musleabi=g++
-CPP_arm-unknown-linux-musleabi=gcc -E
-AR_arm-unknown-linux-musleabi=ar
-CFG_LIB_NAME_arm-unknown-linux-musleabi=lib$(1).so
-CFG_STATIC_LIB_NAME_arm-unknown-linux-musleabi=lib$(1).a
-CFG_LIB_GLOB_arm-unknown-linux-musleabi=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_arm-unknown-linux-musleabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_arm-unknown-linux-musleabi := -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CFLAGS_arm-unknown-linux-musleabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CXXFLAGS_arm-unknown-linux-musleabi := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-musleabi := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_arm-unknown-linux-musleabi := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_arm-unknown-linux-musleabi :=
-CFG_INSTALL_NAME_arm-unknown-linux-musleabi =
-CFG_EXE_SUFFIX_arm-unknown-linux-musleabi :=
-CFG_WINDOWSY_arm-unknown-linux-musleabi :=
-CFG_UNIXY_arm-unknown-linux-musleabi := 1
-CFG_LDPATH_arm-unknown-linux-musleabi :=
-CFG_RUN_arm-unknown-linux-musleabi=$(2)
-CFG_RUN_TARG_arm-unknown-linux-musleabi=$(call CFG_RUN_arm-unknown-linux-musleabi,,$(2))
-RUSTC_FLAGS_arm-unknown-linux-musleabi :=
-RUSTC_CROSS_FLAGS_arm-unknown-linux-musleabi :=
-CFG_GNU_TRIPLE_arm-unknown-linux-musleabi := arm-unknown-linux-musleabi
diff --git a/mk/cfg/arm-unknown-linux-musleabihf.mk b/mk/cfg/arm-unknown-linux-musleabihf.mk
deleted file mode 100644 (file)
index 8120250..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# This file is intentially left empty to indicate that, while this target is
-# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
-# instead.
\ No newline at end of file
diff --git a/mk/cfg/armv5te-unknown-linux-gnueabi.mk b/mk/cfg/armv5te-unknown-linux-gnueabi.mk
deleted file mode 100644 (file)
index 98567a0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# armv5-unknown-linux-gnueabi configuration
-CROSS_PREFIX_armv5te-unknown-linux-gnueabi=arm-linux-gnueabi-
-CC_armv5te-unknown-linux-gnueabi=gcc
-CXX_armv5te-unknown-linux-gnueabi=g++
-CPP_armv5te-unknown-linux-gnueabi=gcc -E
-AR_armv5te-unknown-linux-gnueabi=ar
-CFG_LIB_NAME_armv5te-unknown-linux-gnueabi=lib$(1).so
-CFG_STATIC_LIB_NAME_armv5te-unknown-linux-gnueabi=lib$(1).a
-CFG_LIB_GLOB_armv5te-unknown-linux-gnueabi=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_armv5te-unknown-linux-gnueabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_armv5te-unknown-linux-gnueabi := -D__arm__ -mfloat-abi=soft  $(CFLAGS) -march=armv5te -marm
-CFG_GCCISH_CFLAGS_armv5te-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv5te -marm
-CFG_GCCISH_CXXFLAGS_armv5te-unknown-linux-gnueabi := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_armv5te-unknown-linux-gnueabi := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_armv5te-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_armv5te-unknown-linux-gnueabi :=
-CFG_INSTALL_NAME_ar,-unknown-linux-gnueabi =
-CFG_EXE_SUFFIX_armv5te-unknown-linux-gnueabi :=
-CFG_WINDOWSY_armv5te-unknown-linux-gnueabi :=
-CFG_UNIXY_armv5te-unknown-linux-gnueabi := 1
-CFG_LDPATH_armv5te-unknown-linux-gnueabi :=
-CFG_RUN_armv5te-unknown-linux-gnueabi=$(2)
-CFG_RUN_TARG_armv5te-unknown-linux-gnueabi=$(call CFG_RUN_armv5te-unknown-linux-gnueabi,,$(2))
-RUSTC_FLAGS_armv5te-unknown-linux-gnueabi :=
-RUSTC_CROSS_FLAGS_armv5te-unknown-linux-gnueabi :=
-CFG_GNU_TRIPLE_armv5te-unknown-linux-gnueabi := armv5te-unknown-linux-gnueabi
diff --git a/mk/cfg/armv7-apple-ios.mk b/mk/cfg/armv7-apple-ios.mk
deleted file mode 100644 (file)
index 34ca4de..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# armv7-apple-ios configuration
-CFG_SDK_NAME_armv7-apple-ios := iphoneos
-CFG_SDK_ARCHS_armv7-apple-ios := armv7
-ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
-CFG_IOS_SDK_armv7-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
-CFG_IOS_SDK_FLAGS_armv7-apple-ios := -target armv7-apple-ios -isysroot $(CFG_IOS_SDK_armv7-apple-ios) -mios-version-min=7.0
-CC_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
-CXX_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-CPP_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-AR_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
-endif
-CFG_LIB_NAME_armv7-apple-ios = lib$(1).a
-CFG_LIB_GLOB_armv7-apple-ios = lib$(1)-*.a
-CFG_INSTALL_ONLY_RLIB_armv7-apple-ios = 1
-CFG_STATIC_LIB_NAME_armv7-apple-ios=lib$(1).a
-CFG_LIB_DSYM_GLOB_armv7-apple-ios = lib$(1)-*.a.dSYM
-CFG_JEMALLOC_CFLAGS_armv7-apple-ios := -arch armv7 -mfpu=vfp3 $(CFG_IOS_SDK_FLAGS_armv7-apple-ios)
-CFG_GCCISH_CFLAGS_armv7-apple-ios :=  -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -mfpu=vfp3 -arch armv7
-CFG_GCCISH_CXXFLAGS_armv7-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -I$(CFG_IOS_SDK_armv7-apple-ios)/usr/include/c++/4.2.1
-CFG_GCCISH_LINK_FLAGS_armv7-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7-apple-ios) -Wl,-no_compact_unwind
-CFG_GCCISH_DEF_FLAG_armv7-apple-ios := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_armv7-apple-ios := -mattr=+vfp3,+v7,+neon -march=arm
-CFG_INSTALL_NAME_armv7-apple-ios = -Wl,-install_name,@rpath/$(1)
-CFG_EXE_SUFFIX_armv7-apple-ios :=
-CFG_WINDOWSY_armv7-apple-ios :=
-CFG_UNIXY_armv7-apple-ios := 1
-CFG_LDPATH_armv7-apple-ios :=
-CFG_RUN_armv7-apple-ios = $(2)
-CFG_RUN_TARG_armv7-apple-ios = $(call CFG_RUN_armv7-apple-ios,,$(2))
-CFG_GNU_TRIPLE_armv7-apple-ios := armv7-apple-ios
diff --git a/mk/cfg/armv7-linux-androideabi.mk b/mk/cfg/armv7-linux-androideabi.mk
deleted file mode 100644 (file)
index e5bf2e4..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# armv7-linux-androideabi configuration
-CC_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc
-CXX_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-g++
-CPP_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc -E
-AR_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-ar
-CFG_LIB_NAME_armv7-linux-androideabi=lib$(1).so
-CFG_STATIC_LIB_NAME_armv7-linux-androideabi=lib$(1).a
-CFG_LIB_GLOB_armv7-linux-androideabi=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_armv7-linux-androideabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_armv7-linux-androideabi := -D__arm__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CFLAGS_armv7-linux-androideabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=softfp -march=armv7-a -mfpu=vfpv3-d16 -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_armv7-linux-androideabi := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_armv7-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++
-CFG_GCCISH_DEF_FLAG_armv7-linux-androideabi := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_armv7-linux-androideabi :=
-CFG_INSTALL_NAME_armv7-linux-androideabi =
-CFG_EXE_SUFFIX_armv7-linux-androideabi :=
-CFG_WINDOWSY_armv7-linux-androideabi :=
-CFG_UNIXY_armv7-linux-androideabi := 1
-CFG_LDPATH_armv7-linux-androideabi :=
-CFG_RUN_armv7-linux-androideabi=
-CFG_RUN_TARG_armv7-linux-androideabi=
-RUSTC_FLAGS_armv7-linux-androideabi :=
-RUSTC_CROSS_FLAGS_armv7-linux-androideabi :=
-CFG_GNU_TRIPLE_armv7-linux-androideabi := arm-linux-androideabi
diff --git a/mk/cfg/armv7-unknown-linux-gnueabihf.mk b/mk/cfg/armv7-unknown-linux-gnueabihf.mk
deleted file mode 100644 (file)
index a8e3966..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# armv7-unknown-linux-gnueabihf configuration
-CROSS_PREFIX_armv7-unknown-linux-gnueabihf=arm-linux-gnueabihf-
-CC_armv7-unknown-linux-gnueabihf=gcc
-CXX_armv7-unknown-linux-gnueabihf=g++
-CPP_armv7-unknown-linux-gnueabihf=gcc -E
-AR_armv7-unknown-linux-gnueabihf=ar
-CFG_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).so
-CFG_STATIC_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).a
-CFG_LIB_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv7-a
-CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv7-a
-CFG_GCCISH_CXXFLAGS_armv7-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_armv7-unknown-linux-gnueabihf := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_armv7-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_armv7-unknown-linux-gnueabihf :=
-CFG_INSTALL_NAME_ar,-unknown-linux-gnueabihf =
-CFG_EXE_SUFFIX_armv7-unknown-linux-gnueabihf :=
-CFG_WINDOWSY_armv7-unknown-linux-gnueabihf :=
-CFG_UNIXY_armv7-unknown-linux-gnueabihf := 1
-CFG_LDPATH_armv7-unknown-linux-gnueabihf :=
-CFG_RUN_armv7-unknown-linux-gnueabihf=$(2)
-CFG_RUN_TARG_armv7-unknown-linux-gnueabihf=$(call CFG_RUN_armv7-unknown-linux-gnueabihf,,$(2))
-RUSTC_FLAGS_armv7-unknown-linux-gnueabihf :=
-RUSTC_CROSS_FLAGS_armv7-unknown-linux-gnueabihf :=
-CFG_GNU_TRIPLE_armv7-unknown-linux-gnueabihf := armv7-unknown-linux-gnueabihf
diff --git a/mk/cfg/armv7-unknown-linux-musleabihf.mk b/mk/cfg/armv7-unknown-linux-musleabihf.mk
deleted file mode 100644 (file)
index 8120250..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# This file is intentially left empty to indicate that, while this target is
-# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
-# instead.
\ No newline at end of file
diff --git a/mk/cfg/armv7s-apple-ios.mk b/mk/cfg/armv7s-apple-ios.mk
deleted file mode 100644 (file)
index 6da7905..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# armv7s-apple-ios configuration
-CFG_SDK_NAME_armv7s-apple-ios := iphoneos
-CFG_SDK_ARCHS_armv7s-apple-ios := armv7s
-ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
-CFG_IOS_SDK_armv7s-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
-CFG_IOS_SDK_FLAGS_armv7s-apple-ios := -target armv7s-apple-ios -isysroot $(CFG_IOS_SDK_armv7s-apple-ios) -mios-version-min=7.0
-CC_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
-CXX_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-CPP_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-AR_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
-endif
-CFG_LIB_NAME_armv7s-apple-ios = lib$(1).a
-CFG_LIB_GLOB_armv7s-apple-ios = lib$(1)-*.a
-CFG_INSTALL_ONLY_RLIB_armv7s-apple-ios = 1
-CFG_STATIC_LIB_NAME_armv7s-apple-ios=lib$(1).a
-CFG_LIB_DSYM_GLOB_armv7s-apple-ios = lib$(1)-*.a.dSYM
-CFG_JEMALLOC_CFLAGS_armv7s-apple-ios := -arch armv7s $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios)
-CFG_GCCISH_CFLAGS_armv7s-apple-ios :=  -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -arch armv7s
-CFG_GCCISH_CXXFLAGS_armv7s-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -I$(CFG_IOS_SDK_armv7s-apple-ios)/usr/include/c++/4.2.1
-CFG_GCCISH_LINK_FLAGS_armv7s-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7s-apple-ios) -Wl,-no_compact_unwind
-CFG_GCCISH_DEF_FLAG_armv7s-apple-ios := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_armv7s-apple-ios := -mattr=+vfp4,+v7,+neon
-CFG_INSTALL_NAME_armv7s-apple-ios = -Wl,-install_name,@rpath/$(1)
-CFG_EXE_SUFFIX_armv7s-apple-ios :=
-CFG_WINDOWSY_armv7s-apple-ios :=
-CFG_UNIXY_armv7s-apple-ios := 1
-CFG_LDPATH_armv7s-apple-ios :=
-CFG_RUN_armv7s-apple-ios = $(2)
-CFG_RUN_TARG_armv7s-apple-ios = $(call CFG_RUN_armv7s-apple-ios,,$(2))
-CFG_GNU_TRIPLE_armv7s-apple-ios := armv7s-apple-ios
diff --git a/mk/cfg/asmjs-unknown-emscripten.mk b/mk/cfg/asmjs-unknown-emscripten.mk
deleted file mode 100644 (file)
index a98a51b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# asmjs-unknown-emscripten configuration
-CC_asmjs-unknown-emscripten=emcc
-CXX_asmjs-unknown-emscripten=em++
-CPP_asmjs-unknown-emscripten=$(CPP)
-AR_asmjs-unknown-emscripten=emar
-CFG_LIB_NAME_asmjs-unknown-emscripten=lib$(1).so
-CFG_STATIC_LIB_NAME_asmjs-unknown-emscripten=lib$(1).a
-CFG_LIB_GLOB_asmjs-unknown-emscripten=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_asmjs-unknown-emscripten=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_asmjs-unknown-emscripten := -m32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_asmjs-unknown-emscripten :=  -g -fPIC -m32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_asmjs-unknown-emscripten := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_asmjs-unknown-emscripten := -shared -fPIC -ldl -pthread  -lrt -g -m32
-CFG_GCCISH_DEF_FLAG_asmjs-unknown-emscripten := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_asmjs-unknown-emscripten :=
-CFG_INSTALL_NAME_asmjs-unknown-emscripten =
-CFG_EXE_SUFFIX_asmjs-unknown-emscripten =
-CFG_WINDOWSY_asmjs-unknown-emscripten :=
-CFG_UNIXY_asmjs-unknown-emscripten := 1
-CFG_LDPATH_asmjs-unknown-emscripten :=
-CFG_RUN_asmjs-unknown-emscripten=$(2)
-CFG_RUN_TARG_asmjs-unknown-emscripten=$(call CFG_RUN_asmjs-unknown-emscripten,,$(2))
-CFG_GNU_TRIPLE_asmjs-unknown-emscripten := asmjs-unknown-emscripten
-CFG_DISABLE_JEMALLOC_asmjs-unknown-emscripten := 1
diff --git a/mk/cfg/i386-apple-ios.mk b/mk/cfg/i386-apple-ios.mk
deleted file mode 100644 (file)
index bfb7fa2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# i386-apple-ios configuration
-CFG_SDK_NAME_i386-apple-ios := iphonesimulator
-CFG_SDK_ARCHS_i386-apple-ios := i386
-ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
-CFG_IOSSIM_SDK_i386-apple-ios := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null)
-CFG_IOSSIM_FLAGS_i386-apple-ios := -m32 -target i386-apple-ios -isysroot $(CFG_IOSSIM_SDK_i386-apple-ios) -mios-simulator-version-min=7.0
-CC_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang)
-CXX_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
-CPP_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
-AR_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar)
-endif
-CFG_LIB_NAME_i386-apple-ios = lib$(1).a
-CFG_LIB_GLOB_i386-apple-ios = lib$(1)-*.dylib
-CFG_INSTALL_ONLY_RLIB_i386-apple-ios = 1
-CFG_STATIC_LIB_NAME_i386-apple-ios=lib$(1).a
-CFG_LIB_DSYM_GLOB_i386-apple-ios = lib$(1)-*.dylib.dSYM
-CFG_GCCISH_CFLAGS_i386-apple-ios :=  -g -fPIC -m32 $(CFG_IOSSIM_FLAGS_i386-apple-ios)
-CFG_GCCISH_CXXFLAGS_i386-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_i386-apple-ios) -I$(CFG_IOSSIM_SDK_i386-apple-ios)/usr/include/c++/4.2.1
-CFG_GCCISH_LINK_FLAGS_i386-apple-ios := -lpthread -m32 -Wl,-no_compact_unwind -m32 -Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios)
-CFG_GCCISH_DEF_FLAG_i386-apple-ios := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_i386-apple-ios =
-CFG_INSTALL_NAME_i386-apple-ios = -Wl,-install_name,@rpath/$(1)
-CFG_EXE_SUFFIX_i386-apple-ios :=
-CFG_WINDOWSY_i386-apple-ios :=
-CFG_UNIXY_i386-apple-ios := 1
-CFG_LDPATH_i386-apple-ios =
-CFG_RUN_i386-apple-ios = $(2)
-CFG_RUN_TARG_i386-apple-ios = $(call CFG_RUN_i386-apple-ios,,$(2))
-CFG_JEMALLOC_CFLAGS_i386-apple-ios = $(CFG_IOSSIM_FLAGS_i386-apple-ios) -target i386-apple-ios #-Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios) -Wl,-no_compact_unwind
-CFG_GNU_TRIPLE_i386-apple-ios := i386-apple-ios
diff --git a/mk/cfg/i586-pc-windows-msvc.mk b/mk/cfg/i586-pc-windows-msvc.mk
deleted file mode 100644 (file)
index 48f1ece..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# i586-pc-windows-msvc configuration
-CC_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-LINK_i586-pc-windows-msvc=$(CFG_MSVC_LINK_i386)
-CXX_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-CPP_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-AR_i586-pc-windows-msvc=$(CFG_MSVC_LIB_i386)
-CFG_LIB_NAME_i586-pc-windows-msvc=$(1).dll
-CFG_STATIC_LIB_NAME_i586-pc-windows-msvc=$(1).lib
-CFG_LIB_GLOB_i586-pc-windows-msvc=$(1)-*.{dll,lib}
-CFG_LIB_DSYM_GLOB_i586-pc-windows-msvc=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i586-pc-windows-msvc :=
-CFG_GCCISH_CFLAGS_i586-pc-windows-msvc := -MD -arch:IA32 -nologo
-CFG_GCCISH_CXXFLAGS_i586-pc-windows-msvc := -MD -arch:IA32 -nologo
-CFG_GCCISH_LINK_FLAGS_i586-pc-windows-msvc :=
-CFG_GCCISH_DEF_FLAG_i586-pc-windows-msvc :=
-CFG_LLC_FLAGS_i586-pc-windows-msvc :=
-CFG_INSTALL_NAME_i586-pc-windows-msvc =
-CFG_EXE_SUFFIX_i586-pc-windows-msvc := .exe
-CFG_WINDOWSY_i586-pc-windows-msvc := 1
-CFG_UNIXY_i586-pc-windows-msvc :=
-CFG_LDPATH_i586-pc-windows-msvc :=
-CFG_RUN_i586-pc-windows-msvc=$(2)
-CFG_RUN_TARG_i586-pc-windows-msvc=$(call CFG_RUN_i586-pc-windows-msvc,,$(2))
-CFG_GNU_TRIPLE_i586-pc-windows-msvc := i586-pc-win32
-
-# Currently the build system is not configured to build jemalloc
-# with MSVC, so we omit this optional dependency.
-CFG_DISABLE_JEMALLOC_i586-pc-windows-msvc := 1
diff --git a/mk/cfg/i586-unknown-linux-gnu.mk b/mk/cfg/i586-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index fa29091..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# i586-unknown-linux-gnu configuration
-CC_i586-unknown-linux-gnu=$(CC)
-CXX_i586-unknown-linux-gnu=$(CXX)
-CPP_i586-unknown-linux-gnu=$(CPP)
-AR_i586-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_i586-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_i586-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_i586-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i586-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i586-unknown-linux-gnu := -m32 $(CFLAGS) -march=pentium -Wa,-mrelax-relocations=no
-CFG_GCCISH_CFLAGS_i586-unknown-linux-gnu :=  -g -fPIC -m32 $(CFLAGS) -march=pentium -Wa,-mrelax-relocations=no
-CFG_GCCISH_CXXFLAGS_i586-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -march=pentium
-CFG_GCCISH_LINK_FLAGS_i586-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m32
-CFG_GCCISH_DEF_FLAG_i586-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_i586-unknown-linux-gnu :=
-CFG_INSTALL_NAME_i586-unknown-linux-gnu =
-CFG_EXE_SUFFIX_i586-unknown-linux-gnu =
-CFG_WINDOWSY_i586-unknown-linux-gnu :=
-CFG_UNIXY_i586-unknown-linux-gnu := 1
-CFG_LDPATH_i586-unknown-linux-gnu :=
-CFG_RUN_i586-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_i586-unknown-linux-gnu=$(call CFG_RUN_i586-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_i586-unknown-linux-gnu := i586-unknown-linux-gnu
diff --git a/mk/cfg/i686-apple-darwin.mk b/mk/cfg/i686-apple-darwin.mk
deleted file mode 100644 (file)
index e4b3431..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# i686-apple-darwin configuration
-CC_i686-apple-darwin=$(CC)
-CXX_i686-apple-darwin=$(CXX)
-CPP_i686-apple-darwin=$(CPP)
-AR_i686-apple-darwin=$(AR)
-CFG_LIB_NAME_i686-apple-darwin=lib$(1).dylib
-CFG_STATIC_LIB_NAME_i686-apple-darwin=lib$(1).a
-CFG_LIB_GLOB_i686-apple-darwin=lib$(1)-*.dylib
-CFG_LIB_DSYM_GLOB_i686-apple-darwin=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-apple-darwin := -m32 -arch i386 $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-apple-darwin :=  -g -fPIC -m32 -arch i386 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_i686-apple-darwin := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-apple-darwin := -dynamiclib -pthread  -framework CoreServices -m32
-CFG_GCCISH_DEF_FLAG_i686-apple-darwin := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_i686-apple-darwin :=
-CFG_INSTALL_NAME_i686-apple-darwin = -Wl,-install_name,@rpath/$(1)
-CFG_EXE_SUFFIX_i686-apple-darwin :=
-CFG_WINDOWSY_i686-apple-darwin :=
-CFG_UNIXY_i686-apple-darwin := 1
-CFG_LDPATH_i686-apple-darwin :=
-CFG_RUN_i686-apple-darwin=$(2)
-CFG_RUN_TARG_i686-apple-darwin=$(call CFG_RUN_i686-apple-darwin,,$(2))
-CFG_GNU_TRIPLE_i686-apple-darwin := i686-apple-darwin
diff --git a/mk/cfg/i686-linux-android.mk b/mk/cfg/i686-linux-android.mk
deleted file mode 100644 (file)
index 2843a8e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# i686-linux-android configuration
-CC_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-gcc
-CXX_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-g++
-CPP_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-gcc -E
-AR_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-ar
-CFG_LIB_NAME_i686-linux-android=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-linux-android=lib$(1).a
-CFG_LIB_GLOB_i686-linux-android=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i686-linux-android=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-linux-android := -D__i686__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-linux-android := -Wall -g -fPIC -D__i686__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_i686-linux-android := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-linux-android := -shared -fPIC -ldl -g -lm -lsupc++
-CFG_GCCISH_DEF_FLAG_i686-linux-android := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_i686-linux-android :=
-CFG_INSTALL_NAME_i686-linux-android =
-CFG_EXE_SUFFIX_i686-linux-android :=
-CFG_WINDOWSY_i686-linux-android :=
-CFG_UNIXY_i686-linux-android := 1
-CFG_LDPATH_i686-linux-android :=
-CFG_RUN_i686-linux-android=
-CFG_RUN_TARG_i686-linux-android=
-RUSTC_FLAGS_i686-linux-android :=
-RUSTC_CROSS_FLAGS_i686-linux-android :=
-CFG_GNU_TRIPLE_i686-linux-android := i686-linux-android
diff --git a/mk/cfg/i686-pc-windows-gnu.mk b/mk/cfg/i686-pc-windows-gnu.mk
deleted file mode 100644 (file)
index 50c2b8c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# i686-pc-windows-gnu configuration
-CROSS_PREFIX_i686-pc-windows-gnu=i686-w64-mingw32-
-CC_i686-pc-windows-gnu=gcc
-CXX_i686-pc-windows-gnu=g++
-CPP_i686-pc-windows-gnu=gcc -E
-AR_i686-pc-windows-gnu=ar
-CFG_LIB_NAME_i686-pc-windows-gnu=$(1).dll
-CFG_STATIC_LIB_NAME_i686-pc-windows-gnu=$(1).lib
-CFG_LIB_GLOB_i686-pc-windows-gnu=$(1)-*.dll
-CFG_LIB_DSYM_GLOB_i686-pc-windows-gnu=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-pc-windows-gnu := -march=i686 -m32 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-pc-windows-gnu :=  -g -m32 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_i686-pc-windows-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-pc-windows-gnu := -shared -g -m32
-CFG_GCCISH_DEF_FLAG_i686-pc-windows-gnu :=
-CFG_LLC_FLAGS_i686-pc-windows-gnu :=
-CFG_INSTALL_NAME_i686-pc-windows-gnu =
-CFG_EXE_SUFFIX_i686-pc-windows-gnu := .exe
-CFG_WINDOWSY_i686-pc-windows-gnu := 1
-CFG_UNIXY_i686-pc-windows-gnu :=
-CFG_LDPATH_i686-pc-windows-gnu :=
-CFG_RUN_i686-pc-windows-gnu=$(2)
-CFG_RUN_TARG_i686-pc-windows-gnu=$(call CFG_RUN_i686-pc-windows-gnu,,$(2))
-CFG_GNU_TRIPLE_i686-pc-windows-gnu := i686-w64-mingw32
-CFG_THIRD_PARTY_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o
-CFG_INSTALLED_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
-CFG_RUSTRT_HAS_STARTUP_OBJS_i686-pc-windows-gnu := 1
diff --git a/mk/cfg/i686-pc-windows-msvc.mk b/mk/cfg/i686-pc-windows-msvc.mk
deleted file mode 100644 (file)
index b0289b9..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# i686-pc-windows-msvc configuration
-CC_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-LINK_i686-pc-windows-msvc=$(CFG_MSVC_LINK_i386)
-CXX_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-CPP_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-AR_i686-pc-windows-msvc=$(CFG_MSVC_LIB_i386)
-CFG_LIB_NAME_i686-pc-windows-msvc=$(1).dll
-CFG_STATIC_LIB_NAME_i686-pc-windows-msvc=$(1).lib
-CFG_LIB_GLOB_i686-pc-windows-msvc=$(1)-*.{dll,lib}
-CFG_LIB_DSYM_GLOB_i686-pc-windows-msvc=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-pc-windows-msvc :=
-CFG_GCCISH_CFLAGS_i686-pc-windows-msvc := -MD -nologo
-CFG_GCCISH_CXXFLAGS_i686-pc-windows-msvc := -MD -nologo
-CFG_GCCISH_LINK_FLAGS_i686-pc-windows-msvc :=
-CFG_GCCISH_DEF_FLAG_i686-pc-windows-msvc :=
-CFG_LLC_FLAGS_i686-pc-windows-msvc :=
-CFG_INSTALL_NAME_i686-pc-windows-msvc =
-CFG_EXE_SUFFIX_i686-pc-windows-msvc := .exe
-CFG_WINDOWSY_i686-pc-windows-msvc := 1
-CFG_UNIXY_i686-pc-windows-msvc :=
-CFG_LDPATH_i686-pc-windows-msvc :=
-CFG_RUN_i686-pc-windows-msvc=$(2)
-CFG_RUN_TARG_i686-pc-windows-msvc=$(call CFG_RUN_i686-pc-windows-msvc,,$(2))
-CFG_GNU_TRIPLE_i686-pc-windows-msvc := i686-pc-win32
-
-# Currently the build system is not configured to build jemalloc
-# with MSVC, so we omit this optional dependency.
-CFG_DISABLE_JEMALLOC_i686-pc-windows-msvc := 1
diff --git a/mk/cfg/i686-unknown-freebsd.mk b/mk/cfg/i686-unknown-freebsd.mk
deleted file mode 100644 (file)
index a9d4446..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# i686-unknown-freebsd configuration
-CC_i686-unknown-freebsd=$(CC)
-CXX_i686-unknown-freebsd=$(CXX)
-CPP_i686-unknown-freebsd=$(CPP)
-AR_i686-unknown-freebsd=$(AR)
-CFG_LIB_NAME_i686-unknown-freebsd=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-unknown-freebsd=lib$(1).a
-CFG_LIB_GLOB_i686-unknown-freebsd=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i686-unknown-freebsd=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-unknown-freebsd := -m32 -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-unknown-freebsd :=  -g -fPIC -m32 -arch i386 -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-unknown-freebsd := -m32 -shared -fPIC -g -pthread -lrt
-CFG_GCCISH_DEF_FLAG_i686-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_i686-unknown-freebsd :=
-CFG_INSTALL_NAME_i686-unknown-freebsd =
-CFG_EXE_SUFFIX_i686-unknown-freebsd :=
-CFG_WINDOWSY_i686-unknown-freebsd :=
-CFG_UNIXY_i686-unknown-freebsd := 1
-CFG_LDPATH_i686-unknown-freebsd :=
-CFG_RUN_i686-unknown-freebsd=$(2)
-CFG_RUN_TARG_i686-unknown-freebsd=$(call CFG_RUN_i686-unknown-freebsd,,$(2))
-CFG_GNU_TRIPLE_i686-unknown-freebsd := i686-unknown-freebsd
diff --git a/mk/cfg/i686-unknown-haiku.mk b/mk/cfg/i686-unknown-haiku.mk
deleted file mode 100644 (file)
index cbacbff..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# i686-unknown-haiku configuration
-CROSS_PREFIX_i686-unknown-haiku=i586-pc-haiku-
-CC_i686-unknown-haiku=$(CC)
-CXX_i686-unknown-haiku=$(CXX)
-CPP_i686-unknown-haiku=$(CPP)
-AR_i686-unknown-haiku=$(AR)
-CFG_LIB_NAME_i686-unknown-haiku=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-unknown-haiku=lib$(1).a
-CFG_LIB_GLOB_i686-unknown-haiku=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i686-unknown-haiku=lib$(1)-*.dylib.dSYM
-CFG_CFLAGS_i686-unknown-haiku := -m32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-unknown-haiku := -Wall -Werror -g -fPIC -m32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_i686-unknown-haiku := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-unknown-haiku := -shared -fPIC -ldl -pthread  -lrt -g -m32
-CFG_GCCISH_PRE_LIB_FLAGS_i686-unknown-haiku := -Wl,-whole-archive
-CFG_GCCISH_POST_LIB_FLAGS_i686-unknown-haiku := -Wl,-no-whole-archive
-CFG_DEF_SUFFIX_i686-unknown-haiku := .linux.def
-CFG_LLC_FLAGS_i686-unknown-haiku :=
-CFG_INSTALL_NAME_i686-unknown-haiku =
-CFG_EXE_SUFFIX_i686-unknown-haiku =
-CFG_WINDOWSY_i686-unknown-haiku :=
-CFG_UNIXY_i686-unknown-haiku := 1
-CFG_PATH_MUNGE_i686-unknown-haiku := true
-CFG_LDPATH_i686-unknown-haiku :=
-CFG_RUN_i686-unknown-haiku=$(2)
-CFG_RUN_TARG_i686-unknown-haiku=$(call CFG_RUN_i686-unknown-haiku,,$(2))
-CFG_GNU_TRIPLE_i686-unknown-haiku := i686-unknown-haiku
diff --git a/mk/cfg/i686-unknown-linux-gnu.mk b/mk/cfg/i686-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index 9e23120..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# i686-unknown-linux-gnu configuration
-CC_i686-unknown-linux-gnu=$(CC)
-CXX_i686-unknown-linux-gnu=$(CXX)
-CPP_i686-unknown-linux-gnu=$(CPP)
-AR_i686-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_i686-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_i686-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i686-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-unknown-linux-gnu := -m32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-unknown-linux-gnu :=  -g -fPIC -m32 $(CFLAGS) -march=i686
-CFG_GCCISH_CXXFLAGS_i686-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m32
-CFG_GCCISH_DEF_FLAG_i686-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_i686-unknown-linux-gnu :=
-CFG_INSTALL_NAME_i686-unknown-linux-gnu =
-CFG_EXE_SUFFIX_i686-unknown-linux-gnu =
-CFG_WINDOWSY_i686-unknown-linux-gnu :=
-CFG_UNIXY_i686-unknown-linux-gnu := 1
-CFG_LDPATH_i686-unknown-linux-gnu :=
-CFG_RUN_i686-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_i686-unknown-linux-gnu=$(call CFG_RUN_i686-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_i686-unknown-linux-gnu := i686-unknown-linux-gnu
diff --git a/mk/cfg/i686-unknown-linux-musl.mk b/mk/cfg/i686-unknown-linux-musl.mk
deleted file mode 100644 (file)
index d6c1ce8..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# i686-unknown-linux-musl configuration
-CC_i686-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc
-CXX_i686-unknown-linux-musl=$(CXX)
-CPP_i686-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc -E
-AR_i686-unknown-linux-musl=$(AR)
-CFG_INSTALL_ONLY_RLIB_i686-unknown-linux-musl = 1
-CFG_LIB_NAME_i686-unknown-linux-musl=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-unknown-linux-musl=lib$(1).a
-CFG_LIB_GLOB_i686-unknown-linux-musl=lib$(1)-*.so
-CFG_JEMALLOC_CFLAGS_i686-unknown-linux-musl := -m32 -Wl,-melf_i386 -Wa,-mrelax-relocations=no
-CFG_GCCISH_CFLAGS_i686-unknown-linux-musl :=  -g -fPIC -m32 -Wl,-melf_i386 -Wa,-mrelax-relocations=no
-CFG_GCCISH_CXXFLAGS_i686-unknown-linux-musl :=
-CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-musl :=
-CFG_GCCISH_DEF_FLAG_i686-unknown-linux-musl :=
-CFG_LLC_FLAGS_i686-unknown-linux-musl :=
-CFG_INSTALL_NAME_i686-unknown-linux-musl =
-CFG_EXE_SUFFIX_i686-unknown-linux-musl =
-CFG_WINDOWSY_i686-unknown-linux-musl :=
-CFG_UNIXY_i686-unknown-linux-musl := 1
-CFG_LDPATH_i686-unknown-linux-musl :=
-CFG_RUN_i686-unknown-linux-musl=$(2)
-CFG_RUN_TARG_i686-unknown-linux-musl=$(call CFG_RUN_i686-unknown-linux-musl,,$(2))
-CFG_GNU_TRIPLE_i686-unknown-linux-musl := i686-unknown-linux-musl
-CFG_THIRD_PARTY_OBJECTS_i686-unknown-linux-musl := crt1.o crti.o crtn.o
-CFG_INSTALLED_OBJECTS_i686-unknown-linux-musl := crt1.o crti.o crtn.o
-
-NATIVE_DEPS_libc_T_i686-unknown-linux-musl += libc.a
-NATIVE_DEPS_std_T_i686-unknown-linux-musl += crt1.o crti.o crtn.o
-NATIVE_DEPS_unwind_T_i686-unknown-linux-musl += libunwind.a
diff --git a/mk/cfg/i686-unknown-netbsd.mk b/mk/cfg/i686-unknown-netbsd.mk
new file mode 100644 (file)
index 0000000..34aee77
--- /dev/null
@@ -0,0 +1 @@
+# rustbuild-only target
diff --git a/mk/cfg/i686-unknown-openbsd.mk b/mk/cfg/i686-unknown-openbsd.mk
deleted file mode 100644 (file)
index b839937..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# i686-unknown-openbsd configuration
-CC_i686-unknown-openbsd=$(CC)
-CXX_i686-unknown-openbsd=$(CXX)
-CPP_i686-unknown-openbsd=$(CPP)
-AR_i686-unknown-openbsd=$(AR)
-CFG_LIB_NAME_i686-unknown-openbsd=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-unknown-openbsd=lib$(1).a
-CFG_LIB_GLOB_i686-unknown-openbsd=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i686-unknown-openbsd=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-unknown-openbsd := -m32 -I/usr/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-unknown-openbsd :=  -g -fPIC -m32 -I/usr/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-unknown-openbsd := -shared -fPIC -g -pthread -m32
-CFG_GCCISH_DEF_FLAG_i686-unknown-openbsd := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_i686-unknown-openbsd :=
-CFG_INSTALL_NAME_i686-unknown-openbsd =
-CFG_EXE_SUFFIX_i686-unknown-openbsd :=
-CFG_WINDOWSY_i686-unknown-openbsd :=
-CFG_UNIXY_i686-unknown-openbsd := 1
-CFG_LDPATH_i686-unknown-openbsd :=
-CFG_RUN_i686-unknown-openbsd=$(2)
-CFG_RUN_TARG_i686-unknown-openbsd=$(call CFG_RUN_i686-unknown-openbsd,,$(2))
-CFG_GNU_TRIPLE_i686-unknown-openbsd := i686-unknown-openbsd
-RUSTC_FLAGS_i686-unknown-openbsd=-C linker=$(call FIND_COMPILER,$(CC))
-CFG_DISABLE_JEMALLOC_i686-unknown-openbsd := 1
diff --git a/mk/cfg/le32-unknown-nacl.mk b/mk/cfg/le32-unknown-nacl.mk
deleted file mode 100644 (file)
index a733672..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# le32-unknown-nacl (portable, PNaCl)
-ifneq ($(CFG_NACL_CROSS_PATH),)
-
-CC_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool cc)
-CXX_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool c++)
-CPP_le32-unknown-nacl=$(CXX_le32-unknown-nacl) -E
-AR_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool ar)
-
-CFG_PNACL_TOOLCHAIN := $(abspath $(dir $(AR_le32-unknown-nacl)/../))
-
-# Note: pso's aren't supported by PNaCl.
-CFG_LIB_NAME_le32-unknown-nacl=lib$(1).pso
-CFG_STATIC_LIB_NAME_le32-unknown-nacl=lib$(1).a
-CFG_LIB_GLOB_le32-unknown-nacl=lib$(1)-*.pso
-CFG_LIB_DSYM_GLOB_le32-unknown-nacl=lib$(1)-*.dylib.dSYM
-CFG_GCCISH_CFLAGS_le32-unknown-nacl := -Wall -Wno-unused-variable -Wno-unused-value $(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --cflags) -D_YUGA_LITTLE_ENDIAN=1 -D_YUGA_BIG_ENDIAN=0
-CFG_GCCISH_CXXFLAGS_le32-unknown-nacl := -stdlib=libc++ $(CFG_GCCISH_CFLAGS_le32-unknown-nacl)
-CFG_GCCISH_LINK_FLAGS_le32-unknown-nacl := -static -pthread -lm
-CFG_GCCISH_DEF_FLAG_le32-unknown-nacl := -Wl,--export-dynamic,--dynamic-list=
-CFG_GCCISH_PRE_LIB_FLAGS_le32-unknown-nacl := -Wl,-no-whole-archive
-CFG_GCCISH_POST_LIB_FLAGS_le32-unknown-nacl :=
-CFG_DEF_SUFFIX_le32-unknown-nacl := .le32.nacl.def
-CFG_INSTALL_NAME_le32-unknown-nacl =
-CFG_EXE_SUFFIX_le32-unknown-nacl = .pexe
-CFG_WINDOWSY_le32-unknown-nacl :=
-CFG_UNIXY_le32-unknown-nacl := 1
-CFG_NACLY_le32-unknown-nacl := 1
-CFG_PATH_MUNGE_le32-unknown-nacl := true
-CFG_LDPATH_le32-unknown-nacl :=
-CFG_RUN_le32-unknown-nacl=$(2)
-CFG_RUN_TARG_le32-unknown-nacl=$(call CFG_RUN_le32-unknown-nacl,,$(2))
-RUSTC_FLAGS_le32-unknown-nacl:=
-RUSTC_CROSS_FLAGS_le32-unknown-nacl=-L $(CFG_NACL_CROSS_PATH)/lib/pnacl/Release -L $(CFG_PNACL_TOOLCHAIN)/lib/clang/3.7.0/lib/le32-nacl -L $(CFG_PNACL_TOOLCHAIN)/le32-nacl/usr/lib -L $(CFG_PNACL_TOOLCHAIN)/le32-nacl/lib
-CFG_GNU_TRIPLE_le32-unknown-nacl := le32-unknown-nacl
-
-# strdup isn't defined unless -std=gnu++11 is used :/
-LLVM_FILTER_CXXFLAGS_le32-unknown-nacl := -std=c++11
-LLVM_EXTRA_CXXFLAGS_le32-unknown-nacl := -std=gnu++11
-
-endif
diff --git a/mk/cfg/mips-unknown-linux-gnu.mk b/mk/cfg/mips-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index 0783a4c..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# mips-unknown-linux-gnu configuration
-CC_mips-unknown-linux-gnu=mips-linux-gnu-gcc
-CXX_mips-unknown-linux-gnu=mips-linux-gnu-g++
-CPP_mips-unknown-linux-gnu=mips-linux-gnu-gcc -E
-AR_mips-unknown-linux-gnu=mips-linux-gnu-ar
-CFG_LIB_NAME_mips-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_mips-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_mips-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_mips-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_mips-unknown-linux-gnu := -mips32r2 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_mips-unknown-linux-gnu := -Wall -g -fPIC -mips32r2 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_mips-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_mips-unknown-linux-gnu := -shared -fPIC -g -mips32r2 -mabi=32
-CFG_GCCISH_DEF_FLAG_mips-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_mips-unknown-linux-gnu :=
-CFG_INSTALL_NAME_mips-unknown-linux-gnu =
-CFG_EXE_SUFFIX_mips-unknown-linux-gnu :=
-CFG_WINDOWSY_mips-unknown-linux-gnu :=
-CFG_UNIXY_mips-unknown-linux-gnu := 1
-CFG_LDPATH_mips-unknown-linux-gnu :=
-CFG_RUN_mips-unknown-linux-gnu=
-CFG_RUN_TARG_mips-unknown-linux-gnu=
-RUSTC_FLAGS_mips-unknown-linux-gnu :=
-CFG_GNU_TRIPLE_mips-unknown-linux-gnu := mips-unknown-linux-gnu
diff --git a/mk/cfg/mips-unknown-linux-musl.mk b/mk/cfg/mips-unknown-linux-musl.mk
deleted file mode 100644 (file)
index 33528b9..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# mips-unknown-linux-musl configuration
-CC_mips-unknown-linux-musl=mips-linux-musl-gcc
-CXX_mips-unknown-linux-musl=mips-linux-musl-g++
-CPP_mips-unknown-linux-musl=mips-linux-musl-gcc -E
-AR_mips-unknown-linux-musl=mips-linux-musl-ar
-CFG_LIB_NAME_mips-unknown-linux-musl=lib$(1).so
-CFG_STATIC_LIB_NAME_mips-unknown-linux-musl=lib$(1).a
-CFG_LIB_GLOB_mips-unknown-linux-musl=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_mips-unknown-linux-musl=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_mips-unknown-linux-musl := -mips32r2 -msoft-float -mabi=32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_mips-unknown-linux-musl := -Wall -g -fPIC -mips32r2 -msoft-float -mabi=32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_mips-unknown-linux-musl := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_mips-unknown-linux-musl := -shared -fPIC -g -mips32r2 -msoft-float -mabi=32
-CFG_GCCISH_DEF_FLAG_mips-unknown-linux-musl := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_mips-unknown-linux-musl :=
-CFG_INSTALL_NAME_mips-unknown-linux-musl =
-CFG_EXE_SUFFIX_mips-unknown-linux-musl =
-CFG_WINDOWSY_mips-unknown-linux-musl :=
-CFG_UNIXY_mips-unknown-linux-musl := 1
-CFG_LDPATH_mips-unknown-linux-musl :=
-CFG_RUN_mips-unknown-linux-musl=
-CFG_RUN_TARG_mips-unknown-linux-musl=
-RUSTC_FLAGS_mips-unknown-linux-musl :=
-CFG_GNU_TRIPLE_mips-unknown-linux-musl := mips-unknown-linux-musl
diff --git a/mk/cfg/mips-unknown-linux-uclibc.mk b/mk/cfg/mips-unknown-linux-uclibc.mk
deleted file mode 100644 (file)
index 34aee77..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/mips64-unknown-linux-gnuabi64.mk b/mk/cfg/mips64-unknown-linux-gnuabi64.mk
deleted file mode 100644 (file)
index 34aee77..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/mips64el-unknown-linux-gnuabi64.mk b/mk/cfg/mips64el-unknown-linux-gnuabi64.mk
deleted file mode 100644 (file)
index 34aee77..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/mipsel-unknown-linux-gnu.mk b/mk/cfg/mipsel-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index f15a086..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# mipsel-unknown-linux-gnu configuration
-CC_mipsel-unknown-linux-gnu=mipsel-linux-gnu-gcc
-CXX_mipsel-unknown-linux-gnu=mipsel-linux-gnu-g++
-CPP_mipsel-unknown-linux-gnu=mipsel-linux-gnu-gcc
-AR_mipsel-unknown-linux-gnu=mipsel-linux-gnu-ar
-CFG_LIB_NAME_mipsel-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_mipsel-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_mipsel-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_mipsel-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_mipsel-unknown-linux-gnu := -mips32 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_mipsel-unknown-linux-gnu := -Wall -g -fPIC -mips32 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_mipsel-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_mipsel-unknown-linux-gnu := -shared -fPIC -g -mips32
-CFG_GCCISH_DEF_FLAG_mipsel-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_mipsel-unknown-linux-gnu :=
-CFG_INSTALL_NAME_mipsel-unknown-linux-gnu =
-CFG_EXE_SUFFIX_mipsel-unknown-linux-gnu :=
-CFG_WINDOWSY_mipsel-unknown-linux-gnu :=
-CFG_UNIXY_mipsel-unknown-linux-gnu := 1
-CFG_LDPATH_mipsel-unknown-linux-gnu :=
-CFG_RUN_mipsel-unknown-linux-gnu=
-CFG_RUN_TARG_mipsel-unknown-linux-gnu=
-RUSTC_FLAGS_mipsel-unknown-linux-gnu :=
-CFG_GNU_TRIPLE_mipsel-unknown-linux-gnu := mipsel-unknown-linux-gnu
diff --git a/mk/cfg/mipsel-unknown-linux-musl.mk b/mk/cfg/mipsel-unknown-linux-musl.mk
deleted file mode 100644 (file)
index db836b8..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# mipsel-unknown-linux-musl configuration
-CC_mipsel-unknown-linux-musl=mipsel-linux-musl-gcc
-CXX_mipsel-unknown-linux-musl=mipsel-linux-musl-g++
-CPP_mipsel-unknown-linux-musl=mipsel-linux-musl-gcc
-AR_mipsel-unknown-linux-musl=mipsel-linux-musl-ar
-CFG_LIB_NAME_mipsel-unknown-linux-musl=lib$(1).so
-CFG_STATIC_LIB_NAME_mipsel-unknown-linux-musl=lib$(1).a
-CFG_LIB_GLOB_mipsel-unknown-linux-musl=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_mipsel-unknown-linux-musl=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_mipsel-unknown-linux-musl := -mips32 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_mipsel-unknown-linux-musl := -Wall -g -fPIC -mips32 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_mipsel-unknown-linux-musl := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_mipsel-unknown-linux-musl := -shared -fPIC -g -mips32
-CFG_GCCISH_DEF_FLAG_mipsel-unknown-linux-musl := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_mipsel-unknown-linux-musl :=
-CFG_INSTALL_NAME_mipsel-unknown-linux-musl =
-CFG_EXE_SUFFIX_mipsel-unknown-linux-musl :=
-CFG_WINDOWSY_mipsel-unknown-linux-musl :=
-CFG_UNIXY_mipsel-unknown-linux-musl := 1
-CFG_LDPATH_mipsel-unknown-linux-musl :=
-CFG_RUN_mipsel-unknown-linux-musl=
-CFG_RUN_TARG_mipsel-unknown-linux-musl=
-RUSTC_FLAGS_mipsel-unknown-linux-musl :=
-CFG_GNU_TRIPLE_mipsel-unknown-linux-musl := mipsel-unknown-linux-musl
diff --git a/mk/cfg/mipsel-unknown-linux-uclibc.mk b/mk/cfg/mipsel-unknown-linux-uclibc.mk
deleted file mode 100644 (file)
index 34aee77..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/powerpc-unknown-linux-gnu.mk b/mk/cfg/powerpc-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index 9c5720d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# powerpc-unknown-linux-gnu configuration
-CROSS_PREFIX_powerpc-unknown-linux-gnu=powerpc-linux-gnu-
-CC_powerpc-unknown-linux-gnu=$(CC)
-CXX_powerpc-unknown-linux-gnu=$(CXX)
-CPP_powerpc-unknown-linux-gnu=$(CPP)
-AR_powerpc-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_powerpc-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_powerpc-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_powerpc-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_powerpc-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_CFLAGS_powerpc-unknown-linux-gnu := -m32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_powerpc-unknown-linux-gnu :=  -g -fPIC -m32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_powerpc-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_powerpc-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m32
-CFG_GCCISH_DEF_FLAG_powerpc-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_powerpc-unknown-linux-gnu :=
-CFG_INSTALL_NAME_powerpc-unknown-linux-gnu =
-CFG_EXE_SUFFIX_powerpc-unknown-linux-gnu =
-CFG_WINDOWSY_powerpc-unknown-linux-gnu :=
-CFG_UNIXY_powerpc-unknown-linux-gnu := 1
-CFG_LDPATH_powerpc-unknown-linux-gnu :=
-CFG_RUN_powerpc-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_powerpc-unknown-linux-gnu=$(call CFG_RUN_powerpc-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_powerpc-unknown-linux-gnu := powerpc-unknown-linux-gnu
diff --git a/mk/cfg/powerpc64-unknown-linux-gnu.mk b/mk/cfg/powerpc64-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index 389bb6f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# powerpc64-unknown-linux-gnu configuration
-CROSS_PREFIX_powerpc64-unknown-linux-gnu=powerpc-linux-gnu-
-CC_powerpc64-unknown-linux-gnu=$(CC)
-CXX_powerpc64-unknown-linux-gnu=$(CXX)
-CPP_powerpc64-unknown-linux-gnu=$(CPP)
-AR_powerpc64-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_powerpc64-unknown-linux-gnu := -m64
-CFG_CFLAGS_powerpc64-unknown-linux-gnu := -m64 $(CFLAGS)
-CFG_GCCISH_CFLAGS_powerpc64-unknown-linux-gnu :=  -g -fPIC -m64 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_powerpc64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_powerpc64-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m64
-CFG_GCCISH_DEF_FLAG_powerpc64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_powerpc64-unknown-linux-gnu :=
-CFG_INSTALL_NAME_powerpc64-unknown-linux-gnu =
-CFG_EXE_SUFFIX_powerpc64-unknown-linux-gnu =
-CFG_WINDOWSY_powerpc64-unknown-linux-gnu :=
-CFG_UNIXY_powerpc64-unknown-linux-gnu := 1
-CFG_LDPATH_powerpc64-unknown-linux-gnu :=
-CFG_RUN_powerpc64-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_powerpc64-unknown-linux-gnu=$(call CFG_RUN_powerpc64-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_powerpc64-unknown-linux-gnu := powerpc64-unknown-linux-gnu
diff --git a/mk/cfg/powerpc64le-unknown-linux-gnu.mk b/mk/cfg/powerpc64le-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index 6884fa1..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# powerpc64le-unknown-linux-gnu configuration
-CROSS_PREFIX_powerpc64le-unknown-linux-gnu=powerpc64le-linux-gnu-
-CC_powerpc64le-unknown-linux-gnu=$(CC)
-CXX_powerpc64le-unknown-linux-gnu=$(CXX)
-CPP_powerpc64le-unknown-linux-gnu=$(CPP)
-AR_powerpc64le-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_CFLAGS_powerpc64le-unknown-linux-gnu := -m64 $(CFLAGS)
-CFG_GCCISH_CFLAGS_powerpc64le-unknown-linux-gnu :=  -g -fPIC -m64 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_powerpc64le-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_powerpc64le-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m64
-CFG_GCCISH_DEF_FLAG_powerpc64le-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_powerpc64le-unknown-linux-gnu :=
-CFG_INSTALL_NAME_powerpc64le-unknown-linux-gnu =
-CFG_EXE_SUFFIX_powerpc64le-unknown-linux-gnu =
-CFG_WINDOWSY_powerpc64le-unknown-linux-gnu :=
-CFG_UNIXY_powerpc64le-unknown-linux-gnu := 1
-CFG_LDPATH_powerpc64le-unknown-linux-gnu :=
-CFG_RUN_powerpc64le-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_powerpc64le-unknown-linux-gnu=$(call CFG_RUN_powerpc64le-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_powerpc64le-unknown-linux-gnu := powerpc64le-unknown-linux-gnu
diff --git a/mk/cfg/s390x-unknown-linux-gnu.mk b/mk/cfg/s390x-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index eb1cb23..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# s390x-unknown-linux-gnu configuration
-CROSS_PREFIX_s390x-unknown-linux-gnu=s390x-linux-gnu-
-CC_s390x-unknown-linux-gnu=$(CC)
-CXX_s390x-unknown-linux-gnu=$(CXX)
-CPP_s390x-unknown-linux-gnu=$(CPP)
-AR_s390x-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_s390x-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_s390x-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_s390x-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_s390x-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_CFLAGS_s390x-unknown-linux-gnu := -m64 $(CFLAGS)
-CFG_GCCISH_CFLAGS_s390x-unknown-linux-gnu :=  -g -fPIC -m64 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_s390x-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_s390x-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m64
-CFG_GCCISH_DEF_FLAG_s390x-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_s390x-unknown-linux-gnu :=
-CFG_INSTALL_NAME_s390x-unknown-linux-gnu =
-CFG_EXE_SUFFIX_s390x-unknown-linux-gnu =
-CFG_WINDOWSY_s390x-unknown-linux-gnu :=
-CFG_UNIXY_s390x-unknown-linux-gnu := 1
-CFG_LDPATH_s390x-unknown-linux-gnu :=
-CFG_RUN_s390x-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_s390x-unknown-linux-gnu=$(call CFG_RUN_s390x-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_s390x-unknown-linux-gnu := s390x-unknown-linux-gnu
diff --git a/mk/cfg/sparc64-unknown-linux-gnu.mk b/mk/cfg/sparc64-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index 34aee77..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/sparc64-unknown-netbsd.mk b/mk/cfg/sparc64-unknown-netbsd.mk
deleted file mode 100644 (file)
index a2b01ba..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# This file is intentially left empty to indicate that, while this target is
-# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
-# instead.
diff --git a/mk/cfg/wasm32-unknown-emscripten.mk b/mk/cfg/wasm32-unknown-emscripten.mk
deleted file mode 100644 (file)
index 997bdfb..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# wasm32-unknown-emscripten configuration
-CC_wasm32-unknown-emscripten=emcc
-CXX_wasm32-unknown-emscripten=em++
-CPP_wasm32-unknown-emscripten=$(CPP)
-AR_wasm32-unknown-emscripten=emar
-CFG_LIB_NAME_wasm32-unknown-emscripten=lib$(1).so
-CFG_STATIC_LIB_NAME_wasm32-unknown-emscripten=lib$(1).a
-CFG_LIB_GLOB_wasm32-unknown-emscripten=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_wasm32-unknown-emscripten=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_wasm32-unknown-emscripten := -m32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_wasm32-unknown-emscripten :=  -g -fPIC -m32 -s BINARYEN=1 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_wasm32-unknown-emscripten := -fno-rtti -s BINARYEN=1 $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_wasm32-unknown-emscripten := -shared -fPIC -ldl -pthread  -lrt -g -m32 -s BINARYEN=1
-CFG_GCCISH_DEF_FLAG_wasm32-unknown-emscripten := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_wasm32-unknown-emscripten :=
-CFG_INSTALL_NAME_wasm32-unknown-emscripten =
-CFG_EXE_SUFFIX_wasm32-unknown-emscripten =
-CFG_WINDOWSY_wasm32-unknown-emscripten :=
-CFG_UNIXY_wasm32-unknown-emscripten := 1
-CFG_LDPATH_wasm32-unknown-emscripten :=
-CFG_RUN_wasm32-unknown-emscripten=$(2)
-CFG_RUN_TARG_wasm32-unknown-emscripten=$(call CFG_RUN_wasm32-unknown-emscripten,,$(2))
-CFG_GNU_TRIPLE_wasm32-unknown-emscripten := wasm32-unknown-emscripten
-CFG_DISABLE_JEMALLOC_wasm32-unknown-emscripten := 1
diff --git a/mk/cfg/x86_64-apple-darwin.mk b/mk/cfg/x86_64-apple-darwin.mk
deleted file mode 100644 (file)
index 8af47b6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# x86_64-apple-darwin configuration
-CC_x86_64-apple-darwin=$(CC)
-CXX_x86_64-apple-darwin=$(CXX)
-CPP_x86_64-apple-darwin=$(CPP)
-AR_x86_64-apple-darwin=$(AR)
-CFG_LIB_NAME_x86_64-apple-darwin=lib$(1).dylib
-CFG_STATIC_LIB_NAME_x86_64-apple-darwin=lib$(1).a
-CFG_LIB_GLOB_x86_64-apple-darwin=lib$(1)-*.dylib
-CFG_LIB_DSYM_GLOB_x86_64-apple-darwin=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-apple-darwin := -m64 -arch x86_64 $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-apple-darwin :=  -g -fPIC -m64 -arch x86_64 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_x86_64-apple-darwin := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-apple-darwin := -dynamiclib -pthread  -framework CoreServices -m64
-CFG_GCCISH_DEF_FLAG_x86_64-apple-darwin := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_x86_64-apple-darwin :=
-CFG_INSTALL_NAME_x86_64-apple-darwin = -Wl,-install_name,@rpath/$(1)
-CFG_EXE_SUFFIX_x86_64-apple-darwin :=
-CFG_WINDOWSY_x86_64-apple-darwin :=
-CFG_UNIXY_x86_64-apple-darwin := 1
-CFG_LDPATH_x86_64-apple-darwin :=
-CFG_RUN_x86_64-apple-darwin=$(2)
-CFG_RUN_TARG_x86_64-apple-darwin=$(call CFG_RUN_x86_64-apple-darwin,,$(2))
-CFG_GNU_TRIPLE_x86_64-apple-darwin := x86_64-apple-darwin
diff --git a/mk/cfg/x86_64-apple-ios.mk b/mk/cfg/x86_64-apple-ios.mk
deleted file mode 100644 (file)
index 764cdc1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# x86_64-apple-ios configuration
-CFG_SDK_NAME_x86_64-apple-ios := iphonesimulator
-CFG_SDK_ARCHS_x86_64-apple-ios := x86_64
-ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
-CFG_IOSSIM_SDK_x86_64-apple-ios := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null)
-CFG_IOSSIM_FLAGS_x86_64-apple-ios := -m64 -target x86_64-apple-ios -isysroot $(CFG_IOSSIM_SDK_x86_64-apple-ios) -mios-simulator-version-min=7.0
-CC_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang)
-CXX_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
-CPP_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
-AR_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar)
-endif
-CFG_LIB_NAME_x86_64-apple-ios = lib$(1).a
-CFG_LIB_GLOB_x86_64-apple-ios = lib$(1)-*.a
-CFG_INSTALL_ONLY_RLIB_x86_64-apple-ios = 1
-CFG_STATIC_LIB_NAME_x86_64-apple-ios=lib$(1).a
-CFG_LIB_DSYM_GLOB_x86_64-apple-ios = lib$(1)-*.a.dSYM
-CFG_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios)
-CFG_JEMALLOC_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios)
-CFG_GCCISH_CFLAGS_x86_64-apple-ios :=  -fPIC $(CFG_IOSSIM_FLAGS_x86_64-apple-ios)
-CFG_GCCISH_CXXFLAGS_x86_64-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) -I$(CFG_IOSSIM_SDK_x86_64-apple-ios)/usr/include/c++/4.2.1
-CFG_GCCISH_LINK_FLAGS_x86_64-apple-ios := -lpthread -Wl,-no_compact_unwind -m64 -Wl,-syslibroot $(CFG_IOSSIM_SDK_x86_64-apple-ios)
-CFG_GCCISH_DEF_FLAG_x86_64-apple-ios := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_x86_64-apple-ios :=
-CFG_INSTALL_NAME_x86_64-apple-ios = -Wl,-install_name,@rpath/$(1)
-CFG_LIBUV_LINK_FLAGS_x86_64-apple-ios :=
-CFG_EXE_SUFFIX_x86_64-apple-ios :=
-CFG_WINDOWSY_x86_64-apple-ios :=
-CFG_UNIXY_x86_64-apple-ios := 1
-CFG_LDPATH_x86_64-apple-ios :=
-CFG_RUN_x86_64-apple-ios = $(2)
-CFG_RUN_TARG_x86_64-apple-ios = $(call CFG_RUN_x86_64-apple-ios,,$(2))
-CFG_GNU_TRIPLE_i386-apple-ios := x86_64-apple-ios
diff --git a/mk/cfg/x86_64-pc-windows-gnu.mk b/mk/cfg/x86_64-pc-windows-gnu.mk
deleted file mode 100644 (file)
index 82e7b23..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# x86_64-pc-windows-gnu configuration
-CROSS_PREFIX_x86_64-pc-windows-gnu=x86_64-w64-mingw32-
-CC_x86_64-pc-windows-gnu=gcc
-CXX_x86_64-pc-windows-gnu=g++
-CPP_x86_64-pc-windows-gnu=gcc -E
-AR_x86_64-pc-windows-gnu=ar
-CFG_LIB_NAME_x86_64-pc-windows-gnu=$(1).dll
-CFG_STATIC_LIB_NAME_x86_64-pc-windows-gnu=$(1).lib
-CFG_LIB_GLOB_x86_64-pc-windows-gnu=$(1)-*.dll
-CFG_LIB_DSYM_GLOB_x86_64-pc-windows-gnu=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-gnu := -m64 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-pc-windows-gnu :=  -g -m64 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-gnu := -shared -g -m64
-CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-gnu :=
-CFG_LLC_FLAGS_x86_64-pc-windows-gnu :=
-CFG_INSTALL_NAME_x86_64-pc-windows-gnu =
-CFG_EXE_SUFFIX_x86_64-pc-windows-gnu := .exe
-CFG_WINDOWSY_x86_64-pc-windows-gnu := 1
-CFG_UNIXY_x86_64-pc-windows-gnu :=
-CFG_LDPATH_x86_64-pc-windows-gnu :=
-CFG_RUN_x86_64-pc-windows-gnu=$(2)
-CFG_RUN_TARG_x86_64-pc-windows-gnu=$(call CFG_RUN_x86_64-pc-windows-gnu,,$(2))
-CFG_GNU_TRIPLE_x86_64-pc-windows-gnu := x86_64-w64-mingw32
-CFG_THIRD_PARTY_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o
-CFG_INSTALLED_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
-CFG_RUSTRT_HAS_STARTUP_OBJS_x86_64-pc-windows-gnu := 1
diff --git a/mk/cfg/x86_64-pc-windows-msvc.mk b/mk/cfg/x86_64-pc-windows-msvc.mk
deleted file mode 100644 (file)
index 30e996a..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# x86_64-pc-windows-msvc configuration
-CC_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64)
-LINK_x86_64-pc-windows-msvc=$(CFG_MSVC_LINK_x86_64)
-CXX_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64)
-CPP_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64)
-AR_x86_64-pc-windows-msvc=$(CFG_MSVC_LIB_x86_64)
-CFG_LIB_NAME_x86_64-pc-windows-msvc=$(1).dll
-CFG_STATIC_LIB_NAME_x86_64-pc-windows-msvc=$(1).lib
-CFG_LIB_GLOB_x86_64-pc-windows-msvc=$(1)-*.{dll,lib}
-CFG_LIB_DSYM_GLOB_x86_64-pc-windows-msvc=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-msvc :=
-CFG_GCCISH_CFLAGS_x86_64-pc-windows-msvc := -MD -nologo
-CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-msvc := -MD -nologo
-CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-msvc :=
-CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-msvc :=
-CFG_LLC_FLAGS_x86_64-pc-windows-msvc :=
-CFG_INSTALL_NAME_x86_64-pc-windows-msvc =
-CFG_EXE_SUFFIX_x86_64-pc-windows-msvc := .exe
-CFG_WINDOWSY_x86_64-pc-windows-msvc := 1
-CFG_UNIXY_x86_64-pc-windows-msvc :=
-CFG_LDPATH_x86_64-pc-windows-msvc :=
-CFG_RUN_x86_64-pc-windows-msvc=$(2)
-CFG_RUN_TARG_x86_64-pc-windows-msvc=$(call CFG_RUN_x86_64-pc-windows-msvc,,$(2))
-CFG_GNU_TRIPLE_x86_64-pc-windows-msvc := x86_64-pc-win32
-
-# Currently the build system is not configured to build jemalloc
-# with MSVC, so we omit this optional dependency.
-CFG_DISABLE_JEMALLOC_x86_64-pc-windows-msvc := 1
diff --git a/mk/cfg/x86_64-rumprun-netbsd.mk b/mk/cfg/x86_64-rumprun-netbsd.mk
deleted file mode 100644 (file)
index 53d58b9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# x86_64-rumprun-netbsd configuration
-CROSS_PREFIX_x86_64-rumprun-netbsd=x86_64-rumprun-netbsd-
-CC_x86_64-rumprun-netbsd=gcc
-CXX_x86_64-rumprun-netbsd=g++
-CPP_x86_64-rumprun-netbsd=gcc -E
-AR_x86_64-rumprun-netbsd=ar
-CFG_INSTALL_ONLY_RLIB_x86_64-rumprun-netbsd = 1
-CFG_LIB_NAME_x86_64-rumprun-netbsd=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-rumprun-netbsd=lib$(1).a
-CFG_LIB_GLOB_x86_64-rumprun-netbsd=lib$(1)-*.so
-CFG_JEMALLOC_CFLAGS_x86_64-rumprun-netbsd := -m64
-CFG_GCCISH_CFLAGS_x86_64-rumprun-netbsd :=  -g -fPIC -m64
-CFG_GCCISH_CXXFLAGS_x86_64-rumprun-netbsd :=
-CFG_GCCISH_LINK_FLAGS_x86_64-rumprun-netbsd :=
-CFG_GCCISH_DEF_FLAG_x86_64-rumprun-netbsd :=
-CFG_LLC_FLAGS_x86_64-rumprun-netbsd :=
-CFG_INSTALL_NAME_x86_64-rumprun-netbsd =
-CFG_EXE_SUFFIX_x86_64-rumprun-netbsd =
-CFG_WINDOWSY_x86_64-rumprun-netbsd :=
-CFG_UNIXY_x86_64-rumprun-netbsd := 1
-CFG_LDPATH_x86_64-rumprun-netbsd :=
-CFG_RUN_x86_64-rumprun-netbsd=$(2)
-CFG_RUN_TARG_x86_64-rumprun-netbsd=$(call CFG_RUN_x86_64-rumprun-netbsd,,$(2))
-CFG_GNU_TRIPLE_x86_64-rumprun-netbsd := x86_64-rumprun-netbsd
-CFG_DISABLE_JEMALLOC_x86_64-rumprun-netbsd := 1
diff --git a/mk/cfg/x86_64-sun-solaris.mk b/mk/cfg/x86_64-sun-solaris.mk
deleted file mode 100644 (file)
index 7fc323b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# x86_64-sun-solaris configuration
-CROSS_PREFIX_x86_64-sun-solaris=x86_64-sun-solaris2.11-
-CC_x86_64-sun-solaris=$(CC)
-CXX_x86_64-sun-solaris=$(CXX)
-CPP_x86_64-sun-solaris=$(CPP)
-AR_x86_64-sun-solaris=$(AR)
-CFG_LIB_NAME_x86_64-sun-solaris=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-sun-solaris=lib$(1).a
-CFG_LIB_GLOB_x86_64-sun-solaris=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-sun-solaris=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-sun-solaris := -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-sun-solaris :=  -g -D_POSIX_PTHREAD_SEMANTICS -fPIC -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-sun-solaris := -shared -fPIC -g -pthread  -lrt
-CFG_GCCISH_DEF_FLAG_x86_64-sun-solaris := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-sun-solaris :=
-CFG_INSTALL_NAME_x86_64-sun-solaris =
-CFG_EXE_SUFFIX_x86_64-sun-solaris :=
-CFG_WINDOWSY_x86_64-sun-solaris :=
-CFG_UNIXY_x86_64-sun-solaris := 1
-CFG_LDPATH_x86_64-sun-solaris :=
-CFG_RUN_x86_64-sun-solaris=$(2)
-CFG_RUN_TARG_x86_64-sun-solaris=$(call CFG_RUN_x86_64-sun-solaris,,$(2))
-CFG_GNU_TRIPLE_x86_64-sun-solaris := x86_64-sun-solaris
diff --git a/mk/cfg/x86_64-unknown-bitrig.mk b/mk/cfg/x86_64-unknown-bitrig.mk
deleted file mode 100644 (file)
index 8ac31c1..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# x86_64-unknown-bitrig-elf configuration
-CC_x86_64-unknown-bitrig=$(CC)
-CXX_x86_64-unknown-bitrig=$(CXX)
-CPP_x86_64-unknown-bitrig=$(CPP)
-AR_x86_64-unknown-bitrig=$(AR)
-CFG_LIB_NAME_x86_64-unknown-bitrig=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-bitrig=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-bitrig=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-bitrig=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-bitrig := -m64 -I/usr/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-bitrig :=  -fPIE -fPIC -m64 -I/usr/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-bitrig := -shared -pic -pthread -m64 $(LDFLAGS)
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-bitrig := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-bitrig :=
-CFG_INSTALL_NAME_x86_64-unknown-bitrig =
-CFG_EXE_SUFFIX_x86_64-unknown-bitrig :=
-CFG_WINDOWSY_x86_64-unknown-bitrig :=
-CFG_UNIXY_x86_64-unknown-bitrig := 1
-CFG_LDPATH_x86_64-unknown-bitrig :=
-CFG_RUN_x86_64-unknown-bitrig=$(2)
-CFG_RUN_TARG_x86_64-unknown-bitrig=$(call CFG_RUN_x86_64-unknown-bitrig,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-bitrig := x86_64-unknown-bitrig
-CFG_DISABLE_JEMALLOC_x86_64-unknown-bitrig := 1
diff --git a/mk/cfg/x86_64-unknown-dragonfly.mk b/mk/cfg/x86_64-unknown-dragonfly.mk
deleted file mode 100644 (file)
index 579a9a8..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# x86_64-pc-dragonfly-elf configuration
-CC_x86_64-unknown-dragonfly=$(CC)
-CXX_x86_64-unknown-dragonfly=$(CXX)
-CPP_x86_64-unknown-dragonfly=$(CPP)
-AR_x86_64-unknown-dragonfly=$(AR)
-CFG_LIB_NAME_x86_64-unknown-dragonfly=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-dragonfly=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-dragonfly=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-dragonfly=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-dragonfly := -m64 -I/usr/include -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-dragonfly :=  -g -fPIC -m64 -I/usr/include -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-dragonfly := -shared -fPIC -g -pthread  -lrt -m64
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-dragonfly := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-dragonfly :=
-CFG_INSTALL_NAME_x86_64-unknown-dragonfly =
-CFG_EXE_SUFFIX_x86_64-unknown-dragonfly :=
-CFG_WINDOWSY_x86_64-unknown-dragonfly :=
-CFG_UNIXY_x86_64-unknown-dragonfly := 1
-CFG_LDPATH_x86_64-unknown-dragonfly :=
-CFG_RUN_x86_64-unknown-dragonfly=$(2)
-CFG_RUN_TARG_x86_64-unknown-dragonfly=$(call CFG_RUN_x86_64-unknown-dragonfly,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-dragonfly := x86_64-unknown-dragonfly
diff --git a/mk/cfg/x86_64-unknown-freebsd.mk b/mk/cfg/x86_64-unknown-freebsd.mk
deleted file mode 100644 (file)
index c700601..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# x86_64-unknown-freebsd configuration
-CC_x86_64-unknown-freebsd=$(CC)
-CXX_x86_64-unknown-freebsd=$(CXX)
-CPP_x86_64-unknown-freebsd=$(CPP)
-AR_x86_64-unknown-freebsd=$(AR)
-CFG_LIB_NAME_x86_64-unknown-freebsd=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-freebsd=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-freebsd=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-freebsd=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-freebsd := -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-freebsd :=  -g -fPIC -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-freebsd := -shared -fPIC -g -pthread  -lrt
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-freebsd :=
-CFG_INSTALL_NAME_x86_64-unknown-freebsd =
-CFG_EXE_SUFFIX_x86_64-unknown-freebsd :=
-CFG_WINDOWSY_x86_64-unknown-freebsd :=
-CFG_UNIXY_x86_64-unknown-freebsd := 1
-CFG_LDPATH_x86_64-unknown-freebsd :=
-CFG_RUN_x86_64-unknown-freebsd=$(2)
-CFG_RUN_TARG_x86_64-unknown-freebsd=$(call CFG_RUN_x86_64-unknown-freebsd,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-freebsd := x86_64-unknown-freebsd
diff --git a/mk/cfg/x86_64-unknown-fuchsia.mk b/mk/cfg/x86_64-unknown-fuchsia.mk
deleted file mode 100644 (file)
index 34aee77..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/x86_64-unknown-haiku.mk b/mk/cfg/x86_64-unknown-haiku.mk
deleted file mode 100644 (file)
index 4c2d888..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# x86_64-unknown-haiku configuration
-CROSS_PREFIX_x86_64-unknown-haiku=x86_64-unknown-haiku-
-CC_x86_64-unknown-haiku=$(CC)
-CXX_x86_64-unknown-haiku=$(CXX)
-CPP_x86_64-unknown-haiku=$(CPP)
-AR_x86_64-unknown-haiku=$(AR)
-CFG_LIB_NAME_x86_64-unknown-haiku=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-haiku=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-haiku=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-haiku=lib$(1)-*.dylib.dSYM
-CFG_CFLAGS_x86_64-unknown-haiku := -m64 $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-haiku := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_x86_64-unknown-haiku := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-haiku := -shared -fPIC -ldl -pthread -lrt -g -m64
-CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-haiku := -Wl,-whole-archive
-CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-haiku := -Wl,-no-whole-archive
-CFG_DEF_SUFFIX_x86_64-unknown-haiku := .linux.def
-CFG_LLC_FLAGS_x86_64-unknown-haiku :=
-CFG_INSTALL_NAME_x86_64-unknown-haiku =
-CFG_EXE_SUFFIX_x86_64-unknown-haiku =
-CFG_WINDOWSY_x86_64-unknown-haiku :=
-CFG_UNIXY_x86_64-unknown-haiku := 1
-CFG_PATH_MUNGE_x86_64-unknown-haiku := true
-CFG_LDPATH_x86_64-unknown-haiku :=
-CFG_RUN_x86_64-unknown-haiku=$(2)
-CFG_RUN_TARG_x86_64-unknown-haiku=$(call CFG_RUN_x86_64-unknown-haiku,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-haiku := x86_64-unknown-haiku
diff --git a/mk/cfg/x86_64-unknown-linux-gnu.mk b/mk/cfg/x86_64-unknown-linux-gnu.mk
deleted file mode 100644 (file)
index 817ce22..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# x86_64-unknown-linux-gnu configuration
-CC_x86_64-unknown-linux-gnu=$(CC)
-CXX_x86_64-unknown-linux-gnu=$(CXX)
-CPP_x86_64-unknown-linux-gnu=$(CPP)
-AR_x86_64-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_x86_64-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-linux-gnu := -m64
-CFG_GCCISH_CFLAGS_x86_64-unknown-linux-gnu :=  -g -fPIC -m64
-CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-gnu := -fno-rtti
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m64
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-linux-gnu :=
-CFG_INSTALL_NAME_x86_64-unknown-linux-gnu =
-CFG_EXE_SUFFIX_x86_64-unknown-linux-gnu =
-CFG_WINDOWSY_x86_64-unknown-linux-gnu :=
-CFG_UNIXY_x86_64-unknown-linux-gnu := 1
-CFG_LDPATH_x86_64-unknown-linux-gnu :=
-CFG_RUN_x86_64-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_x86_64-unknown-linux-gnu=$(call CFG_RUN_x86_64-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-linux-gnu := x86_64-unknown-linux-gnu
diff --git a/mk/cfg/x86_64-unknown-linux-musl.mk b/mk/cfg/x86_64-unknown-linux-musl.mk
deleted file mode 100644 (file)
index 6f707ac..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# x86_64-unknown-linux-musl configuration
-CC_x86_64-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc
-CXX_x86_64-unknown-linux-musl=$(CXX)
-CPP_x86_64-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc -E
-AR_x86_64-unknown-linux-musl=$(AR)
-CFG_INSTALL_ONLY_RLIB_x86_64-unknown-linux-musl = 1
-CFG_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-linux-musl=lib$(1)-*.so
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-linux-musl := -m64 -Wa,-mrelax-relocations=no
-CFG_GCCISH_CFLAGS_x86_64-unknown-linux-musl :=  -g -fPIC -m64 -Wa,-mrelax-relocations=no
-CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-musl :=
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-musl :=
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-musl :=
-CFG_LLC_FLAGS_x86_64-unknown-linux-musl :=
-CFG_INSTALL_NAME_x86_64-unknown-linux-musl =
-CFG_EXE_SUFFIX_x86_64-unknown-linux-musl =
-CFG_WINDOWSY_x86_64-unknown-linux-musl :=
-CFG_UNIXY_x86_64-unknown-linux-musl := 1
-CFG_LDPATH_x86_64-unknown-linux-musl :=
-CFG_RUN_x86_64-unknown-linux-musl=$(2)
-CFG_RUN_TARG_x86_64-unknown-linux-musl=$(call CFG_RUN_x86_64-unknown-linux-musl,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-linux-musl := x86_64-unknown-linux-musl
-CFG_THIRD_PARTY_OBJECTS_x86_64-unknown-linux-musl := crt1.o crti.o crtn.o
-CFG_INSTALLED_OBJECTS_x86_64-unknown-linux-musl := crt1.o crti.o crtn.o
-
-NATIVE_DEPS_libc_T_x86_64-unknown-linux-musl += libc.a
-NATIVE_DEPS_std_T_x86_64-unknown-linux-musl += crt1.o crti.o crtn.o
-NATIVE_DEPS_unwind_T_x86_64-unknown-linux-musl += libunwind.a
diff --git a/mk/cfg/x86_64-unknown-netbsd.mk b/mk/cfg/x86_64-unknown-netbsd.mk
deleted file mode 100644 (file)
index 93bb2d6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# x86_64-unknown-netbsd configuration
-CROSS_PREFIX_x86_64-unknown-netbsd=x86_64-unknown-netbsd-
-CC_x86_64-unknown-netbsd=$(CC)
-CXX_x86_64-unknown-netbsd=$(CXX)
-CPP_x86_64-unknown-netbsd=$(CPP)
-AR_x86_64-unknown-netbsd=$(AR)
-CFG_LIB_NAME_x86_64-unknown-netbsd=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-netbsd=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-netbsd=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-netbsd=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-netbsd := -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-netbsd :=  -g -fPIC -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-netbsd := -shared -fPIC -g -pthread  -lrt
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-netbsd := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-netbsd :=
-CFG_INSTALL_NAME_x86_64-unknown-netbsd =
-CFG_EXE_SUFFIX_x86_64-unknown-netbsd :=
-CFG_WINDOWSY_x86_64-unknown-netbsd :=
-CFG_UNIXY_x86_64-unknown-netbsd := 1
-CFG_LDPATH_x86_64-unknown-netbsd :=
-CFG_RUN_x86_64-unknown-netbsd=$(2)
-CFG_RUN_TARG_x86_64-unknown-netbsd=$(call CFG_RUN_x86_64-unknown-netbsd,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-netbsd := x86_64-unknown-netbsd
diff --git a/mk/cfg/x86_64-unknown-openbsd.mk b/mk/cfg/x86_64-unknown-openbsd.mk
deleted file mode 100644 (file)
index 7cca1f7..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# x86_64-pc-openbsd-elf configuration
-CC_x86_64-unknown-openbsd=$(CC)
-CXX_x86_64-unknown-openbsd=$(CXX)
-CPP_x86_64-unknown-openbsd=$(CPP)
-AR_x86_64-unknown-openbsd=$(AR)
-CFG_LIB_NAME_x86_64-unknown-openbsd=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-openbsd=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-openbsd=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-openbsd=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-openbsd := -m64 -I/usr/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-openbsd :=  -g -fPIC -m64 -I/usr/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-openbsd := -shared -fPIC -g -pthread -m64
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-openbsd := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-openbsd :=
-CFG_INSTALL_NAME_x86_64-unknown-openbsd =
-CFG_EXE_SUFFIX_x86_64-unknown-openbsd :=
-CFG_WINDOWSY_x86_64-unknown-openbsd :=
-CFG_UNIXY_x86_64-unknown-openbsd := 1
-CFG_LDPATH_x86_64-unknown-openbsd :=
-CFG_RUN_x86_64-unknown-openbsd=$(2)
-CFG_RUN_TARG_x86_64-unknown-openbsd=$(call CFG_RUN_x86_64-unknown-openbsd,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-openbsd := x86_64-unknown-openbsd
-RUSTC_FLAGS_x86_64-unknown-openbsd=-C linker=$(call FIND_COMPILER,$(CC))
-CFG_DISABLE_JEMALLOC_x86_64-unknown-openbsd := 1
diff --git a/mk/cfg/x86_64-unknown-redox.mk b/mk/cfg/x86_64-unknown-redox.mk
deleted file mode 100644 (file)
index 34aee77..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/clean.mk b/mk/clean.mk
deleted file mode 100644 (file)
index 7013d9f..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-# Copyright 2012 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.
-
-######################################################################
-# Cleanup
-######################################################################
-
-CLEAN_STAGE_RULES := \
- $(foreach stage, $(STAGES), \
-  $(foreach host, $(CFG_HOST), \
-   clean$(stage)_H_$(host) \
-   $(foreach target, $(CFG_TARGET), \
-    clean$(stage)_T_$(target)_H_$(host))))
-
-CLEAN_STAGE_RULES := $(CLEAN_STAGE_RULES) \
-    $(foreach host, $(CFG_HOST), clean-generic-H-$(host))
-
-CLEAN_STAGE_RULES := $(CLEAN_STAGE_RULES) \
-    $(foreach host, $(CFG_TARGET), clean-generic-T-$(host))
-
-CLEAN_LLVM_RULES = \
- $(foreach target, $(CFG_HOST), \
-  clean-llvm$(target))
-
-.PHONY: clean clean-all clean-misc clean-llvm
-
-clean-all: clean clean-llvm
-
-clean-llvm: $(CLEAN_LLVM_RULES)
-
-clean: clean-misc clean-grammar $(CLEAN_STAGE_RULES)
-
-clean-misc:
-       @$(call E, cleaning)
-       $(Q)rm -f $(RUNTIME_OBJS) $(RUNTIME_DEF)
-       $(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF)
-       $(Q)rm -Rf $(GENERATED)
-       $(Q)rm -Rf tmp/*
-       $(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz $(PKG_NAME)-*.exe
-       $(Q)rm -Rf dist/*
-       $(Q)rm -Rf doc
-
-clean-grammar:
-       @$(call E, cleaning grammar verification)
-       $(Q)rm -Rf grammar
-define CLEAN_GENERIC
-
-clean-generic-$(2)-$(1):
-       $(Q)find $(1)/rustllvm \
-                $(1)/rt \
-                $(1)/test \
-                $(1)/stage* \
-                -type f \( \
-         -name '*.[odasS]' -o \
-         -name '*.so' -o \
-         -name '*.dylib' -o \
-         -name '*.rlib' -o \
-         -name 'stamp.*' -o \
-         -name '*.lib' -o \
-         -name '*.dll' -o \
-         -name '*.def' -o \
-         -name '*.py' -o \
-         -name '*.pyc' -o \
-         -name '*.bc' -o \
-         -name '*.rs' \
-         \) \
-         | xargs rm -f
-       $(Q)find $(1) \
-         -name '*.dSYM' \
-         | xargs rm -Rf
-endef
-
-$(foreach host, $(CFG_HOST), $(eval $(call CLEAN_GENERIC,$(host),H)))
-$(foreach targ, $(CFG_TARGET), $(eval $(call CLEAN_GENERIC,$(targ),T)))
-
-define CLEAN_HOST_STAGE_N
-
-clean$(1)_H_$(2): \
-           $$(foreach crate,$$(CRATES),clean$(1)_H_$(2)-lib-$$(crate)) \
-           $$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_H_$(2)-tool-$$(tool))
-       $$(Q)rm -fr $(2)/rt/libbacktrace
-
-clean$(1)_H_$(2)-tool-%:
-       $$(Q)rm -f $$(HBIN$(1)_H_$(2))/$$*$$(X_$(2))
-
-clean$(1)_H_$(2)-lib-%:
-       $$(Q)rm -f $$(HLIB$(1)_H_$(2))/$$(call CFG_LIB_GLOB_$(2),$$*)
-       $$(Q)rm -f $$(HLIB$(1)_H_$(2))/$$(call CFG_RLIB_GLOB,$$*)
-
-endef
-
-$(foreach host, $(CFG_HOST), \
- $(eval $(foreach stage, $(STAGES), \
-  $(eval $(call CLEAN_HOST_STAGE_N,$(stage),$(host))))))
-
-define CLEAN_TARGET_STAGE_N
-
-clean$(1)_T_$(2)_H_$(3): \
-           $$(foreach crate,$$(CRATES),clean$(1)_T_$(2)_H_$(3)-lib-$$(crate)) \
-           $$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool))
-       $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix
-       $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/run_pass_stage* # For windows
-
-clean$(1)_T_$(2)_H_$(3)-tool-%:
-       $$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/$$*$$(X_$(2))
-
-clean$(1)_T_$(2)_H_$(3)-lib-%:
-       $$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$$(call CFG_LIB_GLOB_$(2),$$*)
-       $$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$$(call CFG_RLIB_GLOB,$$*)
-endef
-
-$(foreach host, $(CFG_HOST), \
- $(eval $(foreach target, $(CFG_TARGET), \
-  $(eval $(foreach stage, 0 1 2 3, \
-   $(eval $(call CLEAN_TARGET_STAGE_N,$(stage),$(target),$(host))))))))
diff --git a/mk/crates.mk b/mk/crates.mk
deleted file mode 100644 (file)
index f801605..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-################################################################################
-# Rust's standard distribution of crates and tools
-#
-# The crates outlined below are the standard distribution of libraries provided
-# in a rust installation. These rules are meant to abstract over the
-# dependencies (both native and rust) of crates and basically generate all the
-# necessary makefile rules necessary to build everything.
-#
-# Here's an explanation of the variables below
-#
-#   TARGET_CRATES
-#      This list of crates will be built for all targets, including
-#      cross-compiled targets
-#
-#   HOST_CRATES
-#      This list of crates will be compiled for only host targets. Note that
-#      this set is explicitly *not* a subset of TARGET_CRATES, but rather it is
-#      a disjoint set. Nothing in the TARGET_CRATES set can depend on crates in
-#      the HOST_CRATES set, but the HOST_CRATES set can depend on target
-#      crates.
-#
-#   TOOLS
-#      A list of all tools which will be built as part of the compilation
-#      process. It is currently assumed that most tools are built through
-#      src/driver/driver.rs with a particular configuration (there's a
-#      corresponding library providing the implementation)
-#
-#   DEPS_<crate>
-#      These lists are the dependencies of the <crate> that is to be built.
-#      Rust dependencies are listed bare (i.e. std) and native
-#      dependencies have a "native:" prefix (i.e. native:hoedown). All deps
-#      will be built before the crate itself is built.
-#
-#   TOOL_DEPS_<tool>/TOOL_SOURCE_<tool>
-#      Similar to the DEPS variable, this is the library crate dependencies
-#      list for tool as well as the source file for the specified tool
-#
-# You shouldn't need to modify much other than these variables. Crates are
-# automatically generated for all stage/host/target combinations.
-################################################################################
-
-TARGET_CRATES := libc std term \
-                 getopts collections test rand \
-                 compiler_builtins core alloc \
-                 std_unicode rustc_bitflags \
-                alloc_system alloc_jemalloc \
-                panic_abort panic_unwind unwind rustc_i128
-RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \
-                rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
-                rustc_data_structures rustc_platform_intrinsics rustc_errors \
-                rustc_plugin rustc_metadata rustc_passes rustc_save_analysis \
-                rustc_const_eval rustc_const_math rustc_incremental proc_macro
-HOST_CRATES := syntax syntax_ext proc_macro_plugin syntax_pos $(RUSTC_CRATES) \
-               rustdoc fmt_macros flate arena graphviz log serialize
-TOOLS := compiletest rustdoc rustc rustbook error_index_generator
-
-DEPS_core :=
-DEPS_compiler_builtins := core native:compiler-rt
-DEPS_alloc := core libc alloc_system
-DEPS_alloc_system := core libc
-DEPS_alloc_jemalloc := core libc native:jemalloc
-DEPS_collections := core alloc std_unicode
-DEPS_libc := core
-DEPS_rand := core
-DEPS_rustc_bitflags := core
-DEPS_std_unicode := core
-DEPS_panic_abort := libc alloc
-DEPS_panic_unwind := libc alloc unwind
-DEPS_unwind := libc
-
-RUSTFLAGS_compiler_builtins := -lstatic=compiler-rt
-RUSTFLAGS_panic_abort := -C panic=abort
-
-DEPS_std := core libc rand alloc collections compiler_builtins std_unicode \
-       native:backtrace \
-       alloc_system panic_abort panic_unwind unwind
-DEPS_arena := std
-DEPS_glob := std
-DEPS_flate := std native:miniz
-DEPS_fmt_macros = std
-DEPS_getopts := std
-DEPS_graphviz := std
-DEPS_log := std
-DEPS_num := std
-DEPS_serialize := std log rustc_i128
-DEPS_term := std
-DEPS_test := std getopts term native:rust_test_helpers
-DEPS_rustc_i128 = std
-
-DEPS_syntax := std term serialize log arena libc rustc_bitflags std_unicode rustc_errors \
-                       syntax_pos rustc_data_structures rustc_i128
-DEPS_syntax_ext := syntax syntax_pos rustc_errors fmt_macros proc_macro
-DEPS_proc_macro := syntax syntax_pos rustc_plugin log
-DEPS_syntax_pos := serialize
-DEPS_proc_macro_plugin := syntax syntax_pos rustc_plugin
-
-DEPS_rustc_const_math := std syntax log serialize rustc_i128
-DEPS_rustc_const_eval := rustc_const_math rustc syntax log serialize \
-                            rustc_back graphviz syntax_pos rustc_i128
-
-DEPS_rustc := syntax fmt_macros flate arena serialize getopts \
-              log graphviz rustc_llvm rustc_back rustc_data_structures\
-             rustc_const_math syntax_pos rustc_errors rustc_i128
-DEPS_rustc_back := std syntax flate log libc
-DEPS_rustc_borrowck := rustc log graphviz syntax syntax_pos rustc_errors rustc_mir
-DEPS_rustc_data_structures := std log serialize libc
-DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
-                     rustc_typeck rustc_mir rustc_resolve log syntax serialize rustc_llvm \
-                     rustc_trans rustc_privacy rustc_lint rustc_plugin \
-                     rustc_metadata syntax_ext proc_macro_plugin \
-                     rustc_passes rustc_save_analysis rustc_const_eval \
-                     rustc_incremental syntax_pos rustc_errors proc_macro rustc_data_structures
-DEPS_rustc_errors := log libc serialize syntax_pos
-DEPS_rustc_lint := rustc log syntax syntax_pos rustc_const_eval rustc_i128
-DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
-DEPS_proc_macro := std syntax
-DEPS_rustc_metadata := rustc syntax syntax_pos rustc_errors rustc_const_math \
-                       proc_macro syntax_ext rustc_i128
-DEPS_rustc_passes := syntax syntax_pos rustc core rustc_const_eval rustc_errors
-DEPS_rustc_mir := rustc syntax syntax_pos rustc_const_math rustc_const_eval rustc_bitflags \
-                                       rustc_i128
-DEPS_rustc_resolve := arena rustc log syntax syntax_pos rustc_errors
-DEPS_rustc_platform_intrinsics := std
-DEPS_rustc_plugin := rustc rustc_metadata syntax syntax_pos rustc_errors
-DEPS_rustc_privacy := rustc log syntax syntax_pos
-DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
-                    log syntax serialize rustc_llvm rustc_platform_intrinsics rustc_i128 \
-                    rustc_const_math rustc_const_eval rustc_incremental rustc_errors syntax_pos
-DEPS_rustc_incremental := rustc syntax_pos serialize rustc_data_structures
-DEPS_rustc_save_analysis := rustc log syntax syntax_pos serialize
-DEPS_rustc_typeck := rustc syntax syntax_pos rustc_platform_intrinsics rustc_const_math \
-                     rustc_const_eval rustc_errors rustc_data_structures
-
-DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts test \
-                rustc_lint rustc_const_eval syntax_pos rustc_data_structures
-
-TOOL_DEPS_compiletest := test getopts log serialize
-TOOL_DEPS_rustdoc := rustdoc
-TOOL_DEPS_rustc := rustc_driver
-TOOL_DEPS_rustbook := std rustdoc
-TOOL_DEPS_error_index_generator := rustdoc syntax serialize
-TOOL_SOURCE_compiletest := $(S)src/tools/compiletest/src/main.rs
-TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
-TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
-TOOL_SOURCE_rustbook := $(S)src/tools/rustbook/main.rs
-TOOL_SOURCE_error_index_generator := $(S)src/tools/error_index_generator/main.rs
-
-ONLY_RLIB_compiler_builtins := 1
-ONLY_RLIB_core := 1
-ONLY_RLIB_libc := 1
-ONLY_RLIB_alloc := 1
-ONLY_RLIB_rand := 1
-ONLY_RLIB_collections := 1
-ONLY_RLIB_std_unicode := 1
-ONLY_RLIB_rustc_i128 := 1
-ONLY_RLIB_rustc_bitflags := 1
-ONLY_RLIB_alloc_system := 1
-ONLY_RLIB_alloc_jemalloc := 1
-ONLY_RLIB_panic_unwind := 1
-ONLY_RLIB_panic_abort := 1
-ONLY_RLIB_unwind := 1
-
-TARGET_SPECIFIC_alloc_jemalloc := 1
-
-# Documented-by-default crates
-DOC_CRATES := std alloc collections core libc std_unicode
-
-ifeq ($(CFG_DISABLE_JEMALLOC),)
-RUSTFLAGS_rustc_back := --cfg 'feature="jemalloc"'
-endif
-
-################################################################################
-# You should not need to edit below this line
-################################################################################
-
-CRATES := $(TARGET_CRATES) $(HOST_CRATES)
-
-# This macro creates some simple definitions for each crate being built, just
-# some munging of all of the parameters above.
-#
-# $(1) is the crate to generate variables for
-define RUST_CRATE
-CRATEFILE_$(1) := $$(SREL)src/lib$(1)/lib.rs
-RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs)
-NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1))))
-endef
-
-$(foreach crate,$(CRATES),$(eval $(call RUST_CRATE,$(crate))))
-
-# $(1) - crate
-# $(2) - target
-define RUST_CRATE_DEPS
-RUST_DEPS_$(1)_T_$(2) := $$(filter-out native:%,$$(DEPS_$(1)))
-endef
-
-$(foreach target,$(CFG_TARGET),\
- $(foreach crate,$(CRATES),$(eval $(call RUST_CRATE_DEPS,$(crate),$(target)))))
-
-# $(1) - target
-# $(2) - crate
-define DEFINE_TARGET_CRATES
-ifndef TARGET_SPECIFIC_$(2)
-TARGET_CRATES_$(1) += $(2)
-endif
-endef
-
-$(foreach target,$(CFG_TARGET),\
- $(foreach crate,$(TARGET_CRATES),\
-  $(eval $(call DEFINE_TARGET_CRATES,$(target),$(crate)))))
-
-# Similar to the macro above for crates, this macro is for tools
-#
-# $(1) is the crate to generate variables for
-define RUST_TOOL
-TOOL_INPUTS_$(1) := $$(call rwildcard,$$(dir $$(TOOL_SOURCE_$(1))),*.rs)
-endef
-
-$(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))
-
-CRATEFILE_libc := $(SREL)src/liblibc/src/lib.rs
-RUSTFLAGS_libc := --cfg stdbuild
diff --git a/mk/ctags.mk b/mk/ctags.mk
deleted file mode 100644 (file)
index 1fcb0bb..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2012 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.
-
-######################################################################
-# TAGS file creation.  No dependency tracking, just do it on demand.
-# Requires Exuberant Ctags: http://ctags.sourceforge.net/index.html
-######################################################################
-
-.PHONY: TAGS.emacs TAGS.vi
-
-CTAGS_RUSTC_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/lib%test,, \
-                               $(wildcard ${CFG_SRC_DIR}src/lib*)) ${CFG_SRC_DIR}src/libtest
-CTAGS_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/librust%,, \
-                $(patsubst ${CFG_SRC_DIR}src/lib%test,, \
-                               $(wildcard ${CFG_SRC_DIR}src/lib*))) ${CFG_SRC_DIR}src/libtest
-CTAGS_OPTS=--options="${CFG_SRC_DIR}src/etc/ctags.rust" --languages=Rust --recurse
-
-TAGS.rustc.emacs:
-       ctags -e -f $@ ${CTAGS_OPTS} ${CTAGS_RUSTC_LOCATIONS}
-
-TAGS.emacs:
-       ctags -e -f $@ ${CTAGS_OPTS} ${CTAGS_LOCATIONS}
-
-TAGS.rustc.vi:
-       ctags -f $@ ${CTAGS_OPTS} ${CTAGS_RUSTC_LOCATIONS}
-
-TAGS.vi:
-       ctags -f $@ ${CTAGS_OPTS} ${CTAGS_LOCATIONS}
diff --git a/mk/debuggers.mk b/mk/debuggers.mk
deleted file mode 100644 (file)
index fbf32dc..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-######################################################################
-# Copy debugger related scripts
-######################################################################
-
-
-## GDB ##
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB=gdb_load_rust_pretty_printers.py \
-                                 gdb_rust_pretty_printing.py \
-                                 debugger_pretty_printers_common.py
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS=\
-    $(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB), \
-        $(CFG_SRC_DIR)src/etc/$(script))
-
-DEBUGGER_BIN_SCRIPTS_GDB=rust-gdb
-DEBUGGER_BIN_SCRIPTS_GDB_ABS=\
-    $(foreach script,$(DEBUGGER_BIN_SCRIPTS_GDB), \
-        $(CFG_SRC_DIR)src/etc/$(script))
-
-
-## LLDB ##
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB=lldb_rust_formatters.py \
-                                  debugger_pretty_printers_common.py
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS=\
-    $(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB), \
-        $(CFG_SRC_DIR)src/etc/$(script))
-
-DEBUGGER_BIN_SCRIPTS_LLDB=rust-lldb
-DEBUGGER_BIN_SCRIPTS_LLDB_ABS=\
-    $(foreach script,$(DEBUGGER_BIN_SCRIPTS_LLDB), \
-        $(CFG_SRC_DIR)src/etc/$(script))
-
-
-## ALL ##
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL=gdb_load_rust_pretty_printers.py \
-                                 gdb_rust_pretty_printing.py \
-                                 lldb_rust_formatters.py \
-                                 debugger_pretty_printers_common.py
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS=\
-    $(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL), \
-        $(CFG_SRC_DIR)src/etc/$(script))
-DEBUGGER_BIN_SCRIPTS_ALL=$(DEBUGGER_BIN_SCRIPTS_GDB) \
-                         $(DEBUGGER_BIN_SCRIPTS_LLDB)
-DEBUGGER_BIN_SCRIPTS_ALL_ABS=$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) \
-                             $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
-
-
-# $(1) - the stage to copy to
-# $(2) - the host triple
-define DEF_INSTALL_DEBUGGER_SCRIPTS_HOST
-
-tmp/install-debugger-scripts$(1)_H_$(2)-gdb.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
-       $(Q)touch $$@.start_time
-       $(Q)mkdir -p $$(HBIN$(1)_H_$(2))
-       $(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
-       $(Q)install $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(HBIN$(1)_H_$(2))
-       $(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
-       $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_H_$(2)-lldb.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
-       $(Q)touch $$@.start_time
-       $(Q)mkdir -p $$(HBIN$(1)_H_$(2))
-       $(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
-       $(Q)install $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(HBIN$(1)_H_$(2))
-       $(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
-       $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_H_$(2)-all.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
-       $(Q)touch $$@.start_time
-       $(Q)mkdir -p $$(HBIN$(1)_H_$(2))
-       $(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
-       $(Q)install $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(HBIN$(1)_H_$(2))
-       $(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
-       $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_H_$(2)-none.done:
-       $(Q)touch $$@
-
-endef
-
-# Expand host make-targets for all stages
-$(foreach stage,$(STAGES), \
-  $(foreach host,$(CFG_HOST), \
-    $(eval $(call DEF_INSTALL_DEBUGGER_SCRIPTS_HOST,$(stage),$(host)))))
-
-# $(1) is the stage number
-# $(2) is the target triple
-# $(3) is the host triple
-define DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET
-
-tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-gdb.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
-       $(Q)touch $$@.start_time
-       $(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
-       $(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-       $(Q)install $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
-       $(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-       $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-lldb.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
-       $(Q)touch $$@.start_time
-       $(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
-       $(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-       $(Q)install $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
-       $(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-       $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-all.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
-       $(Q)touch $$@.start_time
-       $(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
-       $(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-       $(Q)install $(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
-       $(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-       $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-none.done:
-       $(Q)touch $$@
-
-endef
-
-# Expand target make-targets for all stages
-$(foreach stage,$(STAGES), \
-  $(foreach target,$(CFG_TARGET), \
-    $(foreach host,$(CFG_HOST), \
-      $(eval $(call DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET,$(stage),$(target),$(host))))))
diff --git a/mk/dist.mk b/mk/dist.mk
deleted file mode 100644 (file)
index 238ba8a..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-######################################################################
-# Distribution
-######################################################################
-
-# Primary targets:
-#
-# * dist - make all distribution artifacts
-# * distcheck - sanity check dist artifacts
-# * dist-tar-src - source tarballs
-# * dist-tar-bins - Ad-hoc Unix binary installers
-# * dist-docs - Stage docs for upload
-
-PKG_NAME := $(CFG_PACKAGE_NAME)
-STD_PKG_NAME := rust-std-$(CFG_PACKAGE_VERS)
-DOC_PKG_NAME := rust-docs-$(CFG_PACKAGE_VERS)
-MINGW_PKG_NAME := rust-mingw-$(CFG_PACKAGE_VERS)
-SRC_PKG_NAME := rust-src-$(CFG_PACKAGE_VERS)
-
-# License suitable for displaying in a popup
-LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT
-       cat $^ > $@
-
-
-######################################################################
-# Source tarball
-######################################################################
-
-PKG_TAR = dist/$(PKG_NAME)-src.tar.gz
-
-PKG_GITMODULES := $(S)src/llvm $(S)src/compiler-rt \
-                 $(S)src/rt/hoedown $(S)src/jemalloc
-PKG_FILES := \
-    $(S)COPYRIGHT                              \
-    $(S)LICENSE-APACHE                         \
-    $(S)LICENSE-MIT                            \
-    $(S)CONTRIBUTING.md                        \
-    $(S)README.md                              \
-    $(S)RELEASES.md                            \
-    $(S)configure $(S)Makefile.in              \
-    $(S)man                                    \
-    $(addprefix $(S)src/,                      \
-      bootstrap                                \
-      build_helper                             \
-      doc                                      \
-      driver                                   \
-      etc                                      \
-      $(foreach crate,$(CRATES),lib$(crate))   \
-      libcollectionstest                       \
-      libcoretest                              \
-      libbacktrace                             \
-      rt                                       \
-      rtstartup                                \
-      rustllvm                                 \
-      rustc                                    \
-      stage0.txt                               \
-      rust-installer                           \
-      tools                                    \
-      test                                     \
-      vendor)                                  \
-    $(PKG_GITMODULES)                          \
-    $(filter-out config.stamp, \
-                 $(MKFILES_FOR_TARBALL))
-
-UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES))
-
-tmp/dist/$$(SRC_PKG_NAME)-image: $(PKG_FILES)
-       @$(call E, making src image)
-       $(Q)rm -Rf tmp/dist/$(SRC_PKG_NAME)-image
-       $(Q)mkdir -p tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src/rust
-       $(Q)echo "$(CFG_VERSION)" > tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src/rust/version
-       $(Q)tar \
-         -C $(S) \
-         -f - \
-         --exclude-vcs \
-         --exclude=*~ \
-         --exclude=*.pyc \
-         --exclude=*/llvm/test/*/*.ll \
-         --exclude=*/llvm/test/*/*.td \
-         --exclude=*/llvm/test/*/*.s \
-         --exclude=*/llvm/test/*/*/*.ll \
-         --exclude=*/llvm/test/*/*/*.td \
-         --exclude=*/llvm/test/*/*/*.s \
-         -c $(UNROOTED_PKG_FILES) | tar -x -f - -C tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src/rust
-
-$(PKG_TAR): tmp/dist/$$(SRC_PKG_NAME)-image
-       @$(call E, making $@)
-       $(Q)tar -czf $(PKG_TAR) -C tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src rust --transform 's,^rust,$(PKG_NAME),S'
-
-dist-tar-src: $(PKG_TAR)
-
-distcheck-tar-src: dist-tar-src
-       $(Q)rm -Rf tmp/distcheck/$(PKG_NAME)
-       $(Q)rm -Rf tmp/distcheck/srccheck
-       $(Q)mkdir -p tmp/distcheck
-       @$(call E, unpacking $(PKG_TAR) in tmp/distcheck/$(PKG_NAME))
-       $(Q)cd tmp/distcheck && tar -xzf ../../$(PKG_TAR)
-       @$(call E, configuring in tmp/distcheck/srccheck)
-       $(Q)mkdir -p tmp/distcheck/srccheck
-       $(Q)cd tmp/distcheck/srccheck && ../$(PKG_NAME)/configure
-       @$(call E, making 'check' in tmp/distcheck/srccheck)
-       $(Q)+make -C tmp/distcheck/srccheck check
-       @$(call E, making 'clean' in tmp/distcheck/srccheck)
-       $(Q)+make -C tmp/distcheck/srccheck clean
-       $(Q)rm -Rf tmp/distcheck/$(PKG_NAME)
-       $(Q)rm -Rf tmp/distcheck/srccheck
-
-
-######################################################################
-# Unix binary installer tarballs
-######################################################################
-
-define DEF_START_INSTALLER
-dist-install-dir-$(1)-%: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
-dist-install-dir-$(1)-%: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
-dist-install-dir-$(1)-%: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
-dist-install-dir-$(1)-%: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
-dist-install-dir-$(1)-%: PREPARE_CLEAN=true
-
-$$(eval $$(call DEF_PREPARE,dir-$(1)))
-endef
-
-$(foreach target,$(CFG_TARGET),\
-  $(eval $(call DEF_START_INSTALLER,$(target))))
-
-define DEF_INSTALLER
-
-dist-install-dir-$(1)-host: PREPARE_HOST=$(1)
-dist-install-dir-$(1)-host: PREPARE_TARGETS=$(2)
-dist-install-dir-$(1)-host: PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)-image
-dist-install-dir-$(1)-host: prepare-base-dir-$(1)-host docs
-       $$(Q)mkdir -p $$(PREPARE_DEST_DIR)/share/doc/rust
-       $$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)/share/doc/rust
-       $$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)/share/doc/rust
-       $$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)/share/doc/rust
-       $$(Q)$$(PREPARE_MAN_CMD) $$(S)README.md $$(PREPARE_DEST_DIR)/share/doc/rust
-
-prepare-overlay-$(1):
-       $$(Q)rm -Rf tmp/dist/$$(PKG_NAME)-$(1)-overlay
-       $$(Q)mkdir -p tmp/dist/$$(PKG_NAME)-$(1)-overlay
-       $$(Q)cp $$(S)COPYRIGHT tmp/dist/$$(PKG_NAME)-$(1)-overlay/
-       $$(Q)cp $$(S)LICENSE-APACHE tmp/dist/$$(PKG_NAME)-$(1)-overlay/
-       $$(Q)cp $$(S)LICENSE-MIT tmp/dist/$$(PKG_NAME)-$(1)-overlay/
-       $$(Q)cp $$(S)README.md tmp/dist/$$(PKG_NAME)-$(1)-overlay/
-# This tiny morsel of metadata is used by rust-packaging
-       $$(Q)echo "$(CFG_VERSION)" > tmp/dist/$$(PKG_NAME)-$(1)-overlay/version
-
-dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1)-host prepare-overlay-$(1)
-       @$(call E, build: $$@)
-# On a MinGW target we've got a few runtime DLL dependencies that we need
-# to include. THe first argument to `make-win-dist` is where to put these DLLs
-# (the image we're creating) and the second argument is a junk directory to
-# ignore all the other MinGW stuff the script creates.
-ifeq ($$(findstring pc-windows-gnu,$(1)),pc-windows-gnu)
-       $$(Q)rm -Rf tmp/dist/win-rust-gcc-$(1)
-       $$(Q)$$(CFG_PYTHON) $$(S)src/etc/make-win-dist.py \
-               tmp/dist/$$(PKG_NAME)-$(1)-image \
-               tmp/dist/win-rust-gcc-$(1) $(1)
-endif
-# On 32-bit MinGW we're always including a DLL which needs some extra licenses
-# to distribute. On 64-bit MinGW we don't actually distribute anything requiring
-# us to distribute a license but it's likely that the install will *also*
-# include the rust-mingw package down below, which also need licenses, so to be
-# safe we just inlude it here in all MinGW packages.
-ifdef CFG_WINDOWSY_$(1)
-ifeq ($$(findstring $(1),gnu),gnu)
-       $$(Q)cp -r $$(S)src/etc/third-party \
-               tmp/dist/$$(PKG_NAME)-$(1)-image/share/doc/
-endif
-endif
-       $$(Q)$$(S)src/rust-installer/gen-installer.sh \
-               --product-name=Rust \
-               --rel-manifest-dir=rustlib \
-               --success-message=Rust-is-ready-to-roll. \
-               --image-dir=tmp/dist/$$(PKG_NAME)-$(1)-image \
-               --work-dir=tmp/dist \
-               --output-dir=dist \
-               --non-installed-overlay=tmp/dist/$$(PKG_NAME)-$(1)-overlay \
-               --package-name=$$(PKG_NAME)-$(1) \
-               --component-name=rustc \
-               --legacy-manifest-dirs=rustlib,cargo
-       $$(Q)rm -R tmp/dist/$$(PKG_NAME)-$(1)-image
-
-dist-doc-install-dir-$(1): docs
-       $$(Q)mkdir -p tmp/dist/$$(DOC_PKG_NAME)-$(1)-image/share/doc/rust
-       $$(Q)cp -r doc tmp/dist/$$(DOC_PKG_NAME)-$(1)-image/share/doc/rust/html
-
-dist/$$(DOC_PKG_NAME)-$(1).tar.gz: dist-doc-install-dir-$(1)
-       @$(call E, build: $$@)
-       $$(Q)$$(S)src/rust-installer/gen-installer.sh \
-               --product-name=Rust-Documentation \
-               --rel-manifest-dir=rustlib \
-               --success-message=Rust-documentation-is-installed. \
-               --image-dir=tmp/dist/$$(DOC_PKG_NAME)-$(1)-image \
-               --work-dir=tmp/dist \
-               --output-dir=dist \
-               --package-name=$$(DOC_PKG_NAME)-$(1) \
-               --component-name=rust-docs \
-               --legacy-manifest-dirs=rustlib,cargo \
-               --bulk-dirs=share/doc/rust/html
-       $$(Q)rm -R tmp/dist/$$(DOC_PKG_NAME)-$(1)-image
-
-# Creates the rust-mingw package, and the first argument to make-win-dist is a
-# "temporary directory" which is just thrown away (this contains the runtime
-# DLLs included in the rustc package above) and the second argument is where to
-# place all the MinGW components (which is what we want).
-dist-mingw-install-dir-$(1):
-       $$(Q)mkdir -p tmp/dist/rust-mingw-tmp-$(1)-image
-       $$(Q)rm -Rf tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image
-       $$(Q)$$(CFG_PYTHON) $$(S)src/etc/make-win-dist.py \
-               tmp/dist/rust-mingw-tmp-$(1)-image \
-               tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image $(1)
-
-dist/$$(MINGW_PKG_NAME)-$(1).tar.gz: dist-mingw-install-dir-$(1)
-       @$(call E, build: $$@)
-       $$(Q)$$(S)src/rust-installer/gen-installer.sh \
-               --product-name=Rust-MinGW \
-               --rel-manifest-dir=rustlib \
-               --success-message=Rust-MinGW-is-installed. \
-               --image-dir=tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image \
-               --work-dir=tmp/dist \
-               --output-dir=dist \
-               --package-name=$$(MINGW_PKG_NAME)-$(1) \
-               --component-name=rust-mingw \
-               --legacy-manifest-dirs=rustlib,cargo
-       $$(Q)rm -R tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image
-
-endef
-
-# $(1) - host
-# $(2) - target
-define DEF_INSTALLER_TARGETS
-
-dist-install-dir-$(2)-target: PREPARE_HOST=$(1)
-dist-install-dir-$(2)-target: PREPARE_TARGETS=$(2)
-dist-install-dir-$(2)-target: PREPARE_DEST_DIR=tmp/dist/$$(STD_PKG_NAME)-$(2)-image
-dist-install-dir-$(2)-target: prepare-base-dir-$(2)-target
-
-dist/$$(STD_PKG_NAME)-$(2).tar.gz: dist-install-dir-$(2)-target
-       @$$(call E, build: $$@)
-       $$(Q)$$(S)src/rust-installer/gen-installer.sh \
-               --product-name=Rust \
-               --rel-manifest-dir=rustlib \
-               --success-message=std-is-standing-at-the-ready. \
-               --image-dir=tmp/dist/$$(STD_PKG_NAME)-$(2)-image \
-               --work-dir=tmp/dist \
-               --output-dir=dist \
-               --package-name=$$(STD_PKG_NAME)-$(2) \
-               --component-name=rust-std-$(2) \
-               --legacy-manifest-dirs=rustlib,cargo
-       $$(Q)rm -R tmp/dist/$$(STD_PKG_NAME)-$(2)-image
-endef
-
-$(foreach host,$(CFG_HOST),\
-  $(eval $(call DEF_INSTALLER,$(host))))
-
-dist/$(SRC_PKG_NAME).tar.gz: tmp/dist/$(SRC_PKG_NAME)-image
-       @$(call E, build: $@)
-       $(Q)$(S)src/rust-installer/gen-installer.sh \
-               --product-name=Rust \
-               --rel-manifest-dir=rustlib \
-               --success-message=Awesome-Source. \
-               --image-dir=tmp/dist/$(SRC_PKG_NAME)-image \
-               --work-dir=tmp/dist \
-               --output-dir=dist \
-               --package-name=$(SRC_PKG_NAME) \
-               --component-name=rust-src \
-               --legacy-manifest-dirs=rustlib,cargo
-
-# When generating packages for the standard library, we've actually got a lot of
-# artifacts to choose from. Each of the CFG_HOST compilers will have a copy of
-# the standard library for each CFG_TARGET, but we only want to generate one
-# standard library package. As a result, for each entry in CFG_TARGET we need to
-# pick a CFG_HOST to get the standard library from.
-#
-# In theory it doesn't actually matter what host we choose as it should be the
-# case that all hosts produce the same set of libraries for a target (regardless
-# of the host itself). Currently there is a bug in the compiler, however, which
-# means this is not the case (see #29228 and #29235). To solve the first of
-# those bugs, we prefer to select a standard library from the host it was
-# generated from, allowing plugins to work in more situations.
-#
-# For all CFG_TARGET entries in CFG_HOST, however, we just pick CFG_BUILD as the
-# host we slurp up a standard library from.
-$(foreach host,$(CFG_HOST),\
-  $(eval $(call DEF_INSTALLER_TARGETS,$(host),$(host))))
-$(foreach target,$(filter-out $(CFG_HOST),$(CFG_TARGET)),\
-  $(eval $(call DEF_INSTALLER_TARGETS,$(CFG_BUILD),$(target))))
-
-ifdef CFG_WINDOWSY_$(CFG_BUILD)
-define BUILD_MINGW_TARBALL
-ifeq ($$(findstring gnu,$(1)),gnu)
-MAYBE_MINGW_TARBALLS += dist/$(MINGW_PKG_NAME)-$(1).tar.gz
-endif
-endef
-
-$(foreach host,$(CFG_HOST),\
-  $(eval $(call BUILD_MINGW_TARBALL,$(host))))
-endif
-
-ifeq ($(CFG_DISABLE_DOCS),)
-MAYBE_DOC_TARBALLS=$(foreach host,$(CFG_HOST),dist/$(DOC_PKG_NAME)-$(host).tar.gz)
-endif
-
-dist-tar-bins: \
-       $(foreach host,$(CFG_HOST),dist/$(PKG_NAME)-$(host).tar.gz) \
-       $(foreach target,$(CFG_TARGET),dist/$(STD_PKG_NAME)-$(target).tar.gz) \
-       $(MAYBE_DOC_TARBALLS) $(MAYBE_MINGW_TARBALLS)
-
-# Just try to run the compiler for the build host
-distcheck-tar-bins: dist-tar-bins
-       @$(call E, checking binary tarball)
-       $(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)
-       $(Q)rm -Rf tmp/distcheck/tarbininstall
-       $(Q)mkdir -p tmp/distcheck
-       $(Q)cd tmp/distcheck && tar -xzf ../../dist/$(PKG_NAME)-$(CFG_BUILD).tar.gz
-       $(Q)mkdir -p tmp/distcheck/tarbininstall
-       $(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall
-       $(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall --uninstall
-       $(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)
-       $(Q)rm -Rf tmp/distcheck/tarbininstall
-
-######################################################################
-# Docs
-######################################################################
-
-# Just copy the docs to a folder under dist with the appropriate name
-# for uploading to S3
-dist-docs: docs
-       $(Q) rm -Rf dist/doc
-       $(Q) mkdir -p dist/doc/
-       $(Q) cp -r doc dist/doc/$(CFG_PACKAGE_VERS)
-
-distcheck-docs: dist-docs
-
-######################################################################
-# Primary targets (dist, distcheck)
-######################################################################
-
-MAYBE_DIST_TAR_SRC=dist-tar-src dist/$(SRC_PKG_NAME).tar.gz
-MAYBE_DISTCHECK_TAR_SRC=distcheck-tar-src dist/$(SRC_PKG_NAME).tar.gz
-
-# FIXME #13224: On OS X don't produce tarballs simply because --exclude-vcs don't work.
-# This is a huge hack because I just don't have time to figure out another solution.
-ifeq ($(CFG_OSTYPE), apple-darwin)
-MAYBE_DIST_TAR_SRC=
-MAYBE_DISTCHECK_TAR_SRC=
-endif
-
-# Don't bother with source tarballs on windows just because we historically haven't.
-ifeq ($(CFG_OSTYPE), pc-windows-gnu)
-MAYBE_DIST_TAR_SRC=
-MAYBE_DISTCHECK_TAR_SRC=
-endif
-
-ifneq ($(CFG_DISABLE_DOCS),)
-MAYBE_DIST_DOCS=
-MAYBE_DISTCHECK_DOCS=
-else
-MAYBE_DIST_DOCS=dist-docs
-MAYBE_DISTCHECK_DOCS=distcheck-docs
-endif
-
-dist: $(MAYBE_DIST_TAR_SRC) dist-tar-bins $(MAYBE_DIST_DOCS)
-
-distcheck: $(MAYBE_DISTCHECK_TAR_SRC) distcheck-tar-bins $(MAYBE_DISTCHECK_DOCS)
-       $(Q)rm -Rf tmp/distcheck
-       @echo
-       @echo -----------------------------------------------
-       @echo "Rust ready for distribution (see ./dist)"
-       @echo -----------------------------------------------
-
-.PHONY: dist distcheck
diff --git a/mk/docs.mk b/mk/docs.mk
deleted file mode 100644 (file)
index 6c0be65..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-# Copyright 2012-2013 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.
-
-######################################################################
-# The various pieces of standalone documentation.
-#
-# The DOCS variable is their names (with no file extension).
-#
-# RUSTDOC_FLAGS_xyz variables are extra arguments to pass to the
-# rustdoc invocation for xyz.
-#
-# RUSTDOC_DEPS_xyz are extra dependencies for the rustdoc invocation
-# on xyz.
-#
-# L10N_LANGS are the languages for which the docs have been
-# translated.
-######################################################################
-DOCS := index \
-    complement-lang-faq complement-design-faq complement-project-faq \
-    rustdoc reference grammar
-
-# Legacy guides, preserved for a while to reduce the number of 404s
-DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \
-    guide-ownership guide-plugins guide-pointers guide-strings guide-tasks \
-    guide-testing tutorial intro
-
-
-RUSTDOC_DEPS_reference := doc/full-toc.inc
-RUSTDOC_FLAGS_reference := --html-in-header=doc/full-toc.inc
-
-L10N_LANGS := ja
-
-# Generally no need to edit below here.
-
-# The options are passed to the documentation generators.
-RUSTDOC_HTML_OPTS_NO_CSS = --html-before-content=doc/version_info.html \
-       --html-in-header=doc/favicon.inc \
-       --html-after-content=doc/footer.inc \
-       --markdown-playground-url='https://play.rust-lang.org/'
-
-RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css rust.css
-
-# The rustdoc executable...
-RUSTDOC_EXE = $(HBIN2_H_$(CFG_BUILD))/rustdoc$(X_$(CFG_BUILD))
-# ...with rpath included in case --disable-rpath was provided to
-# ./configure
-RUSTDOC = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTDOC_EXE)
-
-# The rustbook executable...
-RUSTBOOK_EXE = $(HBIN2_H_$(CFG_BUILD))/rustbook$(X_$(CFG_BUILD))
-# ...with rpath included in case --disable-rpath was provided to
-# ./configure
-RUSTBOOK = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTBOOK_EXE)
-
-# The error_index_generator executable...
-ERR_IDX_GEN_EXE = $(HBIN2_H_$(CFG_BUILD))/error_index_generator$(X_$(CFG_BUILD))
-ERR_IDX_GEN = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE)
-ERR_IDX_GEN_MD = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE) markdown
-
-D := $(S)src/doc
-
-DOC_TARGETS := book nomicon error-index
-COMPILER_DOC_TARGETS :=
-DOC_L10N_TARGETS :=
-
-# If NO_REBUILD is set then break the dependencies on rustdoc so we
-# build the documentation without having to rebuild rustdoc.
-ifeq ($(NO_REBUILD),)
-HTML_DEPS := $(RUSTDOC_EXE)
-else
-HTML_DEPS :=
-endif
-
-######################################################################
-# Rust version
-######################################################################
-
-HTML_DEPS += doc/version_info.html
-doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
-                       $(wildcard $(D)/*.*) | doc/
-       @$(call E, version-info: $@)
-       $(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; \
-                s/SHORT_HASH/$(CFG_SHORT_VER_HASH)/; \
-                s/STAMP/$(CFG_VER_HASH)/;" $< >$@
-
-GENERATED += doc/version_info.html
-
-######################################################################
-# Docs from rustdoc
-######################################################################
-
-doc/:
-       @mkdir -p $@
-
-HTML_DEPS += doc/rust.css
-doc/rust.css: $(D)/rust.css | doc/
-       @$(call E, cp: $@)
-       $(Q)cp -PRp $< $@ 2> /dev/null
-
-HTML_DEPS += doc/favicon.inc
-doc/favicon.inc: $(D)/favicon.inc | doc/
-       @$(call E, cp: $@)
-       $(Q)cp -PRp $< $@ 2> /dev/null
-
-doc/full-toc.inc: $(D)/full-toc.inc | doc/
-       @$(call E, cp: $@)
-       $(Q)cp -PRp $< $@ 2> /dev/null
-
-HTML_DEPS += doc/footer.inc
-doc/footer.inc: $(D)/footer.inc | doc/
-       @$(call E, cp: $@)
-       $(Q)cp -PRp $< $@ 2> /dev/null
-
-# The (english) documentation for each doc item.
-DOC_TARGETS += doc/not_found.html
-doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
-       @$(call E, rustdoc: $@)
-       $(Q)$(RUSTDOC) $(RUSTDOC_HTML_OPTS_NO_CSS) \
-               --markdown-no-toc \
-               --markdown-css https://doc.rust-lang.org/rust.css $<
-
-define DEF_DOC
-
-# HTML (rustdoc)
-DOC_TARGETS += doc/$(1).html
-doc/$(1).html: $$(D)/$(1).md $$(HTML_DEPS) $$(RUSTDOC_DEPS_$(1)) | doc/
-       @$$(call E, rustdoc: $$@)
-       $$(Q)$$(RUSTDOC) $$(RUSTDOC_HTML_OPTS) $$(RUSTDOC_FLAGS_$(1)) $$<
-
-endef
-
-$(foreach docname,$(DOCS),$(eval $(call DEF_DOC,$(docname))))
-
-
-######################################################################
-# Rustdoc (libstd/extra)
-######################################################################
-
-
-# The library documenting macro
-#
-# $(1) - The crate name (std/extra)
-#
-# Passes --cfg stage2 to rustdoc because it uses the stage2 librustc.
-define DEF_LIB_DOC
-
-# If NO_REBUILD is set then break the dependencies on rustdoc so we
-# build crate documentation without having to rebuild rustdoc.
-ifeq ($(NO_REBUILD),)
-LIB_DOC_DEP_$(1) = \
-       $$(CRATEFILE_$(1)) \
-       $$(RSINPUTS_$(1)) \
-       $$(RUSTDOC_EXE) \
-       $$(foreach dep,$$(RUST_DEPS_$(1)_T_$(CFG_BUILD)), \
-               $$(TLIB2_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.$$(dep)) \
-       $$(foreach dep,$$(filter $$(DOC_CRATES), $$(RUST_DEPS_$(1)_T_$(CFG_BUILD))), \
-               doc/$$(dep)/)
-else
-LIB_DOC_DEP_$(1) = $$(CRATEFILE_$(1)) $$(RSINPUTS_$(1))
-endif
-
-doc/$(1)/:
-       $$(Q)mkdir -p $$@
-
-doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET)
-doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) doc/$(1)/
-       @$$(call E, rustdoc: $$@)
-       $$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(CFG_BUILD)) \
-               $$(RUSTDOC) --cfg dox --cfg stage2 $$(RUSTFLAGS_$(1)) $$<
-endef
-
-$(foreach crate,$(CRATES),$(eval $(call DEF_LIB_DOC,$(crate))))
-
-COMPILER_DOC_TARGETS := $(CRATES:%=doc/%/index.html)
-ifdef CFG_ENABLE_COMPILER_DOCS
-  DOC_TARGETS += $(COMPILER_DOC_TARGETS)
-else
-  DOC_TARGETS += $(DOC_CRATES:%=doc/%/index.html)
-endif
-
-ifdef CFG_DISABLE_DOCS
-  $(info cfg: disabling doc build (CFG_DISABLE_DOCS))
-  DOC_TARGETS :=
-  COMPILER_DOC_TARGETS :=
-endif
-
-docs: $(DOC_TARGETS)
-doc: docs
-compiler-docs: $(COMPILER_DOC_TARGETS)
-
-book: doc/book/index.html
-
-doc/book/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/book/*.md) | doc/
-       @$(call E, rustbook: $@)
-       $(Q)rm -rf doc/book
-       $(Q)$(RUSTBOOK) build $(S)src/doc/book doc/book
-
-nomicon: doc/nomicon/index.html
-
-doc/nomicon/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/nomicon/*.md) | doc/
-       @$(call E, rustbook: $@)
-       $(Q)rm -rf doc/nomicon
-       $(Q)$(RUSTBOOK) build $(S)src/doc/nomicon doc/nomicon
-
-error-index: doc/error-index.html
-
-# Metadata used to generate the index is created as a side effect of
-# the build so this depends on every crate being up to date.
-doc/error-index.html: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/
-       $(Q)$(call E, error_index_generator: $@)
-       $(Q)$(ERR_IDX_GEN)
-
-doc/error-index.md: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/
-       $(Q)$(call E, error_index_generator: $@)
-       $(Q)$(ERR_IDX_GEN_MD)
diff --git a/mk/grammar.mk b/mk/grammar.mk
deleted file mode 100644 (file)
index 1bd042a..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-BG = $(CFG_BUILD_DIR)/grammar/
-SG = $(S)src/grammar/
-B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/
-L = $(B)lib/rustlib/$(CFG_BUILD)/lib
-LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/
-RUSTC = $(STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD))
-ifeq ($(CFG_OSTYPE),apple-darwin)
-       FLEX_LDFLAGS=-ll
-else
-       FLEX_LDFLAGS=-lfl
-endif
-
-# Run the reference lexer against libsyntax and compare the tokens and spans.
-# If "// ignore-lexer-test" is present in the file, it will be ignored.
-#
-# $(1) is the file to test.
-define LEXER_TEST
-grep "// ignore-lexer-test" $(1) ; \
-  if [ $$? -eq 1 ]; then \
-   CLASSPATH=$(B)grammar $(CFG_GRUN) RustLexer tokens -tokens < $(1) \
-   | $(B)grammar/verify $(1) ; \
-  fi
-endef
-
-$(BG):
-       $(Q)mkdir -p $(BG)
-
-$(BG)RustLexer.class: $(BG) $(SG)RustLexer.g4
-       $(Q)$(CFG_ANTLR4) -o $(BG) $(SG)RustLexer.g4
-       $(Q)$(CFG_JAVAC) -d $(BG) -classpath $(CFG_ANTLR4_JAR) $(BG)RustLexer.java
-
-check-build-lexer-verifier: $(BG)verify
-
-ifeq ($(NO_REBUILD),)
-VERIFY_DEPS :=  rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.rustc
-else
-VERIFY_DEPS :=
-endif
-
-$(BG)verify: $(BG) $(SG)verify.rs $(VERIFY_DEPS)
-       $(Q)$(RUSTC) --out-dir $(BG) -L $(L) $(SG)verify.rs
-
-ifdef CFG_JAVAC
-ifdef CFG_ANTLR4
-ifdef CFG_GRUN
-check-lexer: $(BG) $(BG)RustLexer.class check-build-lexer-verifier
-       $(info Verifying libsyntax against the reference lexer ...)
-       $(Q)$(SG)check.sh $(S) "$(BG)" \
-               "$(CFG_GRUN)" "$(BG)verify" "$(BG)RustLexer.tokens"
-else
-$(info cfg: lexer tooling not available, skipping lexer test...)
-check-lexer:
-
-endif
-else
-$(info cfg: lexer tooling not available, skipping lexer test...)
-check-lexer:
-
-endif
-else
-$(info cfg: lexer tooling not available, skipping lexer test...)
-check-lexer:
-
-endif
-
-$(BG)lex.yy.c: $(SG)lexer.l $(BG)
-       @$(call E, flex: $@)
-       $(Q)$(CFG_FLEX) -o $@ $<
-
-$(BG)lexer-lalr.o: $(BG)lex.yy.c $(BG)parser-lalr.tab.h
-       @$(call E, cc: $@)
-       $(Q)$(CFG_CC) -include $(BG)parser-lalr.tab.h -c -o $@ $<
-
-$(BG)parser-lalr.tab.c $(BG)parser-lalr.tab.h: $(SG)parser-lalr.y
-       @$(call E, bison: $@)
-       $(Q)$(CFG_BISON) $< --output=$(BG)parser-lalr.tab.c --defines=$(BG)parser-lalr.tab.h \
-               --name-prefix=rs --warnings=error=all
-
-$(BG)parser-lalr.o: $(BG)parser-lalr.tab.c
-       @$(call E, cc: $@)
-       $(Q)$(CFG_CC) -c -o $@ $<
-
-$(BG)parser-lalr-main.o: $(SG)parser-lalr-main.c
-       @$(call E, cc: $@)
-       $(Q)$(CFG_CC) -std=c99 -c -o $@ $<
-
-$(BG)parser-lalr: $(BG)parser-lalr.o $(BG)parser-lalr-main.o $(BG)lexer-lalr.o
-       @$(call E, cc: $@)
-       $(Q)$(CFG_CC) -o $@ $^ $(FLEX_LDFLAGS)
-
-
-ifdef CFG_FLEX
-ifdef CFG_BISON
-check-grammar: $(BG) $(BG)parser-lalr
-       $(info Verifying grammar ...)
-       $(SG)testparser.py -p $(BG)parser-lalr -s $(S)src
-
-else
-$(info cfg: bison not available, skipping parser test...)
-check-grammar:
-
-endif
-else
-$(info cfg: flex not available, skipping parser test...)
-check-grammar:
-
-endif
diff --git a/mk/host.mk b/mk/host.mk
deleted file mode 100644 (file)
index d17479b..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright 2012 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.
-
-# Generic rule for copying any target crate to a host crate. This rule will also
-# promote any dependent rust crates up to their host locations as well
-#
-# $(1) - the stage to copy from
-# $(2) - the stage to copy to
-# $(3) - the host triple
-# $(4) - the target triple (same as $(3))
-# $(5) - the name of the crate being processed
-define CP_HOST_STAGE_N_CRATE
-
-ifeq ($$(ONLY_RLIB_$(5)),)
-$$(HLIB$(2)_H_$(4))/stamp.$(5): \
-       $$(TLIB$(1)_T_$(3)_H_$(4))/stamp.$(5) \
-       $$(RUST_DEPS_$(5)_T_$(3):%=$$(HLIB$(2)_H_$(4))/stamp.%) \
-       | $$(HLIB$(2)_H_$(4))/
-       @$$(call E, cp: $$(@D)/lib$(5))
-       $$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
-           $$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5)))
-       $$(Q)cp $$< $$@
-       $$(Q)cp -R $$(TLIB$(1)_T_$(3)_H_$(4))/$$(call CFG_LIB_GLOB_$(3),$(5)) \
-               $$(HLIB$(2)_H_$(4))
-       $$(call LIST_ALL_OLD_GLOB_MATCHES, \
-           $$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5)))
-else
-$$(HLIB$(2)_H_$(4))/stamp.$(5):
-       $$(Q)touch $$@
-endif
-
-endef
-
-# Same as the above macro, but for tools instead of crates
-define CP_HOST_STAGE_N_TOOL
-
-$$(HBIN$(2)_H_$(4))/$(5)$$(X_$(3)): \
-       $$(TBIN$(1)_T_$(3)_H_$(4))/$(5)$$(X_$(3)) \
-       $$(TOOL_DEPS_$(5):%=$$(HLIB$(2)_H_$(4))/stamp.%) \
-       | $$(HBIN$(2)_H_$(4))/
-       @$$(call E, cp: $$@)
-       $$(Q)cp $$< $$@
-
-endef
-
-
-# Miscellaneous rules for just making a few directories.
-#
-# $(1) - the stage to copy from
-# $(2) - the stage to copy to
-# $(3) - the target triple
-# $(4) - the host triple (same as $(3))
-define CP_HOST_STAGE_N
-
-ifneq ($(CFG_LIBDIR_RELATIVE),bin)
-$$(HLIB$(2)_H_$(4))/:
-       @mkdir -p $$@
-endif
-
-endef
-
-$(foreach t,$(CFG_HOST), \
-       $(eval $(call CP_HOST_STAGE_N,0,1,$(t),$(t))) \
-       $(eval $(call CP_HOST_STAGE_N,1,2,$(t),$(t))) \
-       $(eval $(call CP_HOST_STAGE_N,2,3,$(t),$(t))))
-
-$(foreach crate,$(CRATES), \
- $(foreach t,$(CFG_HOST), \
-  $(eval $(call CP_HOST_STAGE_N_CRATE,0,1,$(t),$(t),$(crate))) \
-  $(eval $(call CP_HOST_STAGE_N_CRATE,1,2,$(t),$(t),$(crate))) \
-  $(eval $(call CP_HOST_STAGE_N_CRATE,2,3,$(t),$(t),$(crate)))))
-
-$(foreach tool,$(TOOLS), \
- $(foreach t,$(CFG_HOST), \
-  $(eval $(call CP_HOST_STAGE_N_TOOL,0,1,$(t),$(t),$(tool))) \
-  $(eval $(call CP_HOST_STAGE_N_TOOL,1,2,$(t),$(t),$(tool))) \
-  $(eval $(call CP_HOST_STAGE_N_TOOL,2,3,$(t),$(t),$(tool)))))
diff --git a/mk/install.mk b/mk/install.mk
deleted file mode 100644 (file)
index be21286..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-# Copyright 2012 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.
-
-RUN_INSTALLER = cd tmp/empty_dir && \
-       sh ../../tmp/dist/$(1)/install.sh \
-               --prefix="$(DESTDIR)$(CFG_PREFIX)" \
-               --libdir="$(DESTDIR)$(CFG_LIBDIR)" \
-               --mandir="$(DESTDIR)$(CFG_MANDIR)" \
-               --docdir="$(DESTDIR)$(CFG_DOCDIR)"
-
-install:
-ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
-# Build the dist as the original user
-       $(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_install
-else
-       $(Q)$(MAKE) prepare_install
-endif
-ifeq ($(CFG_DISABLE_DOCS),)
-       $(Q)$(call RUN_INSTALLER,$(DOC_PKG_NAME)-$(CFG_BUILD)) --disable-ldconfig
-endif
-       $(Q)$(foreach target,$(CFG_TARGET),\
-         ($(call RUN_INSTALLER,$(STD_PKG_NAME)-$(target)) --disable-ldconfig);)
-       $(Q)$(call RUN_INSTALLER,$(PKG_NAME)-$(CFG_BUILD))
-# Remove tmp files because it's a decent amount of disk space
-       $(Q)rm -R tmp/dist
-
-prepare_install: dist-tar-bins | tmp/empty_dir
-
-uninstall:
-ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
-# Build the dist as the original user
-       $(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_uninstall
-else
-       $(Q)$(MAKE) prepare_uninstall
-endif
-ifeq ($(CFG_DISABLE_DOCS),)
-       $(Q)$(call RUN_INSTALLER,$(DOC_PKG_NAME)-$(CFG_BUILD)) --uninstall
-endif
-       $(Q)$(call RUN_INSTALLER,$(PKG_NAME)-$(CFG_BUILD)) --uninstall
-       $(Q)$(foreach target,$(CFG_TARGET),\
-         ($(call RUN_INSTALLER,$(STD_PKG_NAME)-$(target)) --uninstall);)
-# Remove tmp files because it's a decent amount of disk space
-       $(Q)rm -R tmp/dist
-
-prepare_uninstall: dist-tar-bins | tmp/empty_dir
-
-.PHONY: install prepare_install uninstall prepare_uninstall
-
-tmp/empty_dir:
-       mkdir -p $@
-
-######################################################################
-# Android remote installation
-######################################################################
-
-# Android runtime setup
-# FIXME: This probably belongs somewhere else
-
-# target platform specific variables for android
-define DEF_ADB_DEVICE_STATUS
-CFG_ADB_DEVICE_STATUS=$(1)
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(if $(findstring android, $(target)), \
-    $(if $(findstring adb,$(CFG_ADB)), \
-      $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
-        $(info install: install-runtime-target for $(target) enabled \
-          $(info install: android device attached) \
-          $(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
-        $(info install: install-runtime-target for $(target) disabled \
-          $(info install: android device not attached) \
-          $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
-      ), \
-      $(info install: install-runtime-target for $(target) disabled \
-        $(info install: adb not found) \
-        $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
-    ), \
-  ) \
-)
-
-ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
-$(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
-L_TOKEN := $(word 2,$(MAKECMDGOALS))
-ifeq ($(L_TOKEN),)
-CFG_RUNTIME_PUSH_DIR=/system/lib
-else
-CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
-endif
-
-ifeq ($(CFG_ADB_DEVICE_STATUS),true)
-ifdef VERBOSE
- ADB = adb $(1)
- ADB_PUSH = adb push $(1) $(2)
- ADB_SHELL = adb shell $(1) $(2)
-else
- ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
- ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
- ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
-endif
-
-define INSTALL_RUNTIME_TARGET_N
-install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
-       $$(Q)$$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
-       $$(Q)$$(foreach crate,$$(TARGET_CRATES_$(1)), \
-           $$(call ADB_PUSH,$$(TL$(1)$(2))/$$(call CFG_LIB_GLOB_$(1),$$(crate)), \
-                       $$(CFG_RUNTIME_PUSH_DIR));)
-endef
-
-define INSTALL_RUNTIME_TARGET_CLEANUP_N
-install-runtime-target-$(1)-cleanup:
-       $$(Q)$$(call ADB,remount)
-       $$(Q)$$(foreach crate,$$(TARGET_CRATES_$(1)), \
-           $$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));)
-endef
-
-$(foreach target,$(CFG_TARGET), \
- $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
-  $(eval $(call INSTALL_RUNTIME_TARGET_N,$(taget),$(CFG_BUILD))) \
-  $(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,$(target))) \
-  ))
-
-install-runtime-target: \
-       install-runtime-target-arm-linux-androideabi-cleanup \
-       install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD)
-else
-install-runtime-target:
-       @echo "No device to install runtime library"
-       @echo
-endif
-endif
diff --git a/mk/llvm.mk b/mk/llvm.mk
deleted file mode 100644 (file)
index 76367e6..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright 2012 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.
-
-
-ifdef CFG_ENABLE_FAST_MAKE
-LLVM_DEPS := $(S)/.gitmodules
-else
-
-# This is just a rough approximation of LLVM deps
-LLVM_DEPS_SRC=$(call rwildcard,$(CFG_LLVM_SRC_DIR)lib,*cpp *hpp)
-LLVM_DEPS_INC=$(call rwildcard,$(CFG_LLVM_SRC_DIR)include,*cpp *hpp)
-LLVM_DEPS=$(LLVM_DEPS_SRC) $(LLVM_DEPS_INC)
-endif
-
-ifdef CFG_DISABLE_OPTIMIZE_LLVM
-LLVM_BUILD_CONFIG_MODE := Debug
-else ifdef CFG_ENABLE_LLVM_RELEASE_DEBUGINFO
-LLVM_BUILD_CONFIG_MODE := RelWithDebInfo
-else
-LLVM_BUILD_CONFIG_MODE := Release
-endif
-
-define DEF_LLVM_RULES
-
-ifeq ($(1),$$(CFG_BUILD))
-LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS)
-else
-LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS) $$(LLVM_CONFIG_$$(CFG_BUILD))
-endif
-
-# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
-ifeq ($(CFG_LLVM_ROOT),)
-
-LLVM_STAMP_$(1) = $(S)src/rustllvm/llvm-auto-clean-trigger
-LLVM_DONE_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-finished-building
-
-$$(LLVM_CONFIG_$(1)): $$(LLVM_DONE_$(1))
-
-ifneq ($$(CFG_NINJA),)
-BUILD_LLVM_$(1) := $$(CFG_NINJA) -C $$(CFG_LLVM_BUILD_DIR_$(1))
-else ifeq ($$(findstring msvc,$(1)),msvc)
-BUILD_LLVM_$(1) := $$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
-                       --config $$(LLVM_BUILD_CONFIG_MODE)
-else
-BUILD_LLVM_$(1) := $$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1))
-endif
-
-$$(LLVM_DONE_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
-       @$$(call E, cmake: llvm)
-       $$(Q)if ! cmp $$(LLVM_STAMP_$(1)) $$(LLVM_DONE_$(1)); then \
-               $$(MAKE) clean-llvm$(1); \
-               $$(BUILD_LLVM_$(1)); \
-       fi
-       $$(Q)cp $$(LLVM_STAMP_$(1)) $$@
-
-ifneq ($$(CFG_NINJA),)
-clean-llvm$(1):
-       @$$(call E, clean: llvm)
-       $$(Q)$$(CFG_NINJA) -C $$(CFG_LLVM_BUILD_DIR_$(1)) -t clean
-else ifeq ($$(findstring msvc,$(1)),msvc)
-clean-llvm$(1):
-       @$$(call E, clean: llvm)
-       $$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
-               --config $$(LLVM_BUILD_CONFIG_MODE) \
-               --target clean
-else
-clean-llvm$(1):
-       @$$(call E, clean: llvm)
-       $$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) clean
-endif
-
-else
-clean-llvm$(1):
-endif
-
-$$(LLVM_AR_$(1)): $$(LLVM_CONFIG_$(1))
-
-ifeq ($$(CFG_ENABLE_LLVM_STATIC_STDCPP),1)
-LLVM_STDCPP_RUSTFLAGS_$(1) = -L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
-                                       -print-file-name=lib$(CFG_STDCPP_NAME).a))"
-else
-LLVM_STDCPP_RUSTFLAGS_$(1) =
-endif
-
-
-# LLVM linkage:
-# Note: Filter with llvm-config so that optional targets which aren't present
-# don't cause errors (ie PNaCl's target is only present within PNaCl's LLVM
-# fork).
-LLVM_LINKAGE_PATH_$(1):=$$(abspath $$(RT_OUTPUT_DIR_$(1))/llvmdeps.rs)
-$$(LLVM_LINKAGE_PATH_$(1)): $(S)src/etc/mklldeps.py $$(LLVM_CONFIG_$(1))
-       $(Q)$(CFG_PYTHON) "$$<" "$$@" "$$(filter $$(shell \
-                               $$(LLVM_CONFIG_$(1)) --components), \
-                        $(LLVM_OPTIONAL_COMPONENTS)) $(LLVM_REQUIRED_COMPONENTS)" \
-               "$$(CFG_ENABLE_LLVM_STATIC_STDCPP)" $$(LLVM_CONFIG_$(1)) \
-               "$(CFG_STDCPP_NAME)" "$$(CFG_USING_LIBCPP)"
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(call DEF_LLVM_RULES,$(host))))
-
-$(foreach host,$(CFG_HOST), \
- $(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))
-
-# This can't be done in target.mk because it's included before this file.
-define LLVM_LINKAGE_DEPS
-$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustc_llvm: $$(LLVM_LINKAGE_PATH_$(2))
-RUSTFLAGS$(1)_rustc_llvm_T_$(2) += $$(shell echo $$(LLVM_ALL_COMPONENTS_$(2)) | tr '-' '_' |\
-       sed -e 's/^ //;s/\([^ ]*\)/\-\-cfg "llvm_component=\\"\1\\""/g')
-endef
-
-$(foreach source,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(eval $(call LLVM_LINKAGE_DEPS,0,$(target),$(source))) \
-  $(eval $(call LLVM_LINKAGE_DEPS,1,$(target),$(source))) \
-  $(eval $(call LLVM_LINKAGE_DEPS,2,$(target),$(source))) \
-  $(eval $(call LLVM_LINKAGE_DEPS,3,$(target),$(source)))))
diff --git a/mk/main.mk b/mk/main.mk
deleted file mode 100644 (file)
index 9cd30be..0000000
+++ /dev/null
@@ -1,641 +0,0 @@
-# Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-######################################################################
-# Version numbers and strings
-######################################################################
-
-# The version number
-CFG_RELEASE_NUM=1.16.0
-
-# An optional number to put after the label, e.g. '.2' -> '-beta.2'
-# NB Make sure it starts with a dot to conform to semver pre-release
-# versions (section 9)
-CFG_PRERELEASE_VERSION=.1
-
-ifeq ($(CFG_RELEASE_CHANNEL),stable)
-# This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"
-CFG_RELEASE=$(CFG_RELEASE_NUM)
-# This is the string used in dist artifact file names, e.g. "0.12.0", "nightly"
-CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)
-CFG_DISABLE_UNSTABLE_FEATURES=1
-endif
-ifeq ($(CFG_RELEASE_CHANNEL),beta)
-CFG_RELEASE=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
-# When building beta distributables just reuse the same "beta" name
-# so when we upload we'll always override the previous beta. This
-# doesn't actually impact the version reported by rustc - it's just
-# for file naming.
-CFG_PACKAGE_VERS=beta
-CFG_DISABLE_UNSTABLE_FEATURES=1
-endif
-ifeq ($(CFG_RELEASE_CHANNEL),nightly)
-CFG_RELEASE=$(CFG_RELEASE_NUM)-nightly
-# When building nightly distributables just reuse the same "nightly" name
-# so when we upload we'll always override the previous nighly. This
-# doesn't actually impact the version reported by rustc - it's just
-# for file naming.
-CFG_PACKAGE_VERS=nightly
-endif
-ifeq ($(CFG_RELEASE_CHANNEL),dev)
-CFG_RELEASE=$(CFG_RELEASE_NUM)-dev
-CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-dev
-endif
-
-# Append a version-dependent hash to each library, so we can install different
-# versions in the same place
-CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(CFG_HASH_COMMAND))
-
-# If local-rust is the same major.minor as the current version, then force a local-rebuild
-ifdef CFG_ENABLE_LOCAL_RUST
-SEMVER_PREFIX=$(shell echo $(CFG_RELEASE_NUM) | grep -E -o '^[[:digit:]]+\.[[:digit:]]+')
-LOCAL_RELEASE=$(shell $(S)src/etc/local_stage0.sh --print-rustc-release $(CFG_LOCAL_RUST_ROOT))
-ifneq (,$(filter $(SEMVER_PREFIX).%,$(LOCAL_RELEASE)))
-    CFG_INFO := $(info cfg: auto-detected local-rebuild using $(LOCAL_RELEASE))
-    CFG_ENABLE_LOCAL_REBUILD = 1
-endif
-endif
-
-# The name of the package to use for creating tarballs, installers etc.
-CFG_PACKAGE_NAME=rustc-$(CFG_PACKAGE_VERS)
-
-# The version string plus commit information - this is what rustc reports
-CFG_VERSION = $(CFG_RELEASE)
-CFG_GIT_DIR := $(CFG_SRC_DIR).git
-# since $(CFG_GIT) may contain spaces (especially on Windows),
-# we need to escape them. (" " to r"\ ")
-# Note that $(subst ...) ignores space after `subst`,
-# so we use a hack: define $(SPACE) which contains space character.
-SPACE :=
-SPACE +=
-ifneq ($(CFG_GIT),)
-ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
-    CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --date=short --pretty=format:'%cd')
-    CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
-    CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short=9 HEAD)
-    CFG_VERSION += ($(CFG_SHORT_VER_HASH) $(CFG_VER_DATE))
-endif
-endif
-
-# Windows exe's need numeric versions - don't use anything but
-# numbers and dots here
-CFG_VERSION_WIN = $(CFG_RELEASE_NUM)
-
-CFG_INFO := $(info cfg: version $(CFG_VERSION))
-
-######################################################################
-# More configuration
-######################################################################
-
-MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
-MKFILES_FOR_TARBALL:=$(MKFILE_DEPS)
-ifneq ($(NO_MKFILE_DEPS),)
-MKFILE_DEPS :=
-endif
-NON_BUILD_HOST = $(filter-out $(CFG_BUILD),$(CFG_HOST))
-NON_BUILD_TARGET = $(filter-out $(CFG_BUILD),$(CFG_TARGET))
-
-ifneq ($(MAKE_RESTARTS),)
-CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS))
-endif
-
-CFG_INFO := $(info cfg: build triple $(CFG_BUILD))
-CFG_INFO := $(info cfg: host triples $(CFG_HOST))
-CFG_INFO := $(info cfg: target triples $(CFG_TARGET))
-
-ifneq ($(wildcard $(NON_BUILD_HOST)),)
-CFG_INFO := $(info cfg: non-build host triples $(NON_BUILD_HOST))
-endif
-ifneq ($(wildcard $(NON_BUILD_TARGET)),)
-CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET))
-endif
-
-CFG_RUSTC_FLAGS := $(RUSTFLAGS)
-CFG_GCCISH_CFLAGS :=
-CFG_GCCISH_LINK_FLAGS :=
-
-CFG_JEMALLOC_FLAGS :=
-
-ifdef CFG_DISABLE_OPTIMIZE
-  $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
-  CFG_RUSTC_FLAGS +=
-  CFG_JEMALLOC_FLAGS += --enable-debug
-else
-  # The rtopt cfg turns off runtime sanity checks
-  CFG_RUSTC_FLAGS += -O --cfg rtopt
-endif
-
-CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
-
-ifdef CFG_ENABLE_DEBUG_ASSERTIONS
-  $(info cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS))
-  CFG_RUSTC_FLAGS += -C debug-assertions=on
-endif
-
-ifdef CFG_ENABLE_DEBUGINFO
-  $(info cfg: enabling debuginfo (CFG_ENABLE_DEBUGINFO))
-  CFG_RUSTC_FLAGS += -g
-else ifdef CFG_ENABLE_DEBUGINFO_LINES
-  $(info cfg: enabling line number debuginfo (CFG_ENABLE_DEBUGINFO_LINES))
-  CFG_RUSTC_FLAGS += -Cdebuginfo=1
-endif
-
-ifdef SAVE_TEMPS
-  CFG_RUSTC_FLAGS += -C save-temps
-endif
-ifdef ASM_COMMENTS
-  CFG_RUSTC_FLAGS += -Z asm-comments
-endif
-ifdef TIME_PASSES
-  CFG_RUSTC_FLAGS += -Z time-passes
-endif
-ifdef TIME_LLVM_PASSES
-  CFG_RUSTC_FLAGS += -Z time-llvm-passes
-endif
-ifdef TRACE
-  CFG_RUSTC_FLAGS += -Z trace
-endif
-ifndef CFG_DISABLE_RPATH
-CFG_RUSTC_FLAGS += -C rpath
-endif
-
-# The executables crated during this compilation process have no need to include
-# static copies of libstd and libextra. We also generate dynamic versions of all
-# libraries, so in the interest of space, prefer dynamic linking throughout the
-# compilation process.
-#
-# Note though that these flags are omitted for the *bins* in stage2+. This means
-# that the snapshot will be generated with a statically linked rustc so we only
-# have to worry about the distribution of one file (with its native dynamic
-# dependencies)
-RUSTFLAGS_STAGE0 += -C prefer-dynamic
-RUSTFLAGS_STAGE1 += -C prefer-dynamic
-RUST_LIB_FLAGS_ST2 += -C prefer-dynamic
-RUST_LIB_FLAGS_ST3 += -C prefer-dynamic
-
-# Landing pads require a lot of codegen. We can get through bootstrapping faster
-# by not emitting them.
-
-ifdef CFG_DISABLE_STAGE0_LANDING_PADS
-  RUSTFLAGS_STAGE0 += -Z no-landing-pads
-endif
-
-# platform-specific auto-configuration
-include $(CFG_SRC_DIR)mk/platform.mk
-
-# Run the stage1/2 compilers under valgrind
-ifdef VALGRIND_COMPILE
-  CFG_VALGRIND_COMPILE := $(CFG_VALGRIND)
-else
-  CFG_VALGRIND_COMPILE :=
-endif
-
-
-ifndef CFG_DISABLE_VALGRIND_RPASS
-  $(info cfg: enabling valgrind run-pass tests (CFG_ENABLE_VALGRIND_RPASS))
-  $(info cfg: valgrind-rpass command set to $(CFG_VALGRIND))
-  CFG_VALGRIND_RPASS :=$(CFG_VALGRIND)
-else
-  $(info cfg: disabling valgrind run-pass tests)
-  CFG_VALGRIND_RPASS :=
-endif
-
-
-ifdef CFG_ENABLE_VALGRIND
-  $(info cfg: enabling valgrind (CFG_ENABLE_VALGRIND))
-  CFG_JEMALLOC_FLAGS += --enable-valgrind
-else
-  CFG_VALGRIND :=
-endif
-
-######################################################################
-# Target-and-rule "utility variables"
-######################################################################
-
-define DEF_FOR_TARGET
-X_$(1) := $(CFG_EXE_SUFFIX_$(1))
-ifndef CFG_LLVM_TARGET_$(1)
-CFG_LLVM_TARGET_$(1) := $(1)
-endif
-endef
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call DEF_FOR_TARGET,$(target))))
-
-# "Source" files we generate in builddir along the way.
-GENERATED :=
-
-# Delete the built-in rules.
-.SUFFIXES:
-%:: %,v
-%:: RCS/%,v
-%:: RCS/%
-%:: s.%
-%:: SCCS/s.%
-
-
-######################################################################
-# Cleaning out old crates
-######################################################################
-
-# $(1) is the path for directory to match against
-# $(2) is the glob to use in the match
-#
-# Note that a common bug is to accidentally construct the glob denoted
-# by $(2) with a space character prefix, which invalidates the
-# construction $(1)$(2).
-define CHECK_FOR_OLD_GLOB_MATCHES
-  $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(notdir $(2))\' "libraries:" $$MATCHES; fi
-endef
-
-# Same interface as above, but deletes rather than just listing the files.
-ifdef VERBOSE
-define REMOVE_ALL_OLD_GLOB_MATCHES
-  $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(notdir $(1))\' "libraries:" $$MATCHES; rm $$MATCHES ; fi
-endef
-else
-define REMOVE_ALL_OLD_GLOB_MATCHES
-  $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi
-endef
-endif
-
-# We use a different strategy for LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
-# than in the macros above because it needs the result of running the
-# `ls` command after other rules in the command list have run; the
-# macro-expander for $(wildcard ...) would deliver its results too
-# soon. (This is in contrast to the macros above, which are meant to
-# be run at the outset of a command list in a rule.)
-ifdef VERBOSE
-define LIST_ALL_OLD_GLOB_MATCHES
-  @echo "info: now are following matches for" '$(notdir $(1))' "libraries:"
-  @( ls $(1) 2>/dev/null || true )
-endef
-else
-define LIST_ALL_OLD_GLOB_MATCHES
-endef
-endif
-
-######################################################################
-# LLVM macros
-######################################################################
-
-LLVM_OPTIONAL_COMPONENTS=x86 arm aarch64 mips powerpc pnacl systemz jsbackend msp430 sparc
-LLVM_REQUIRED_COMPONENTS=ipo bitreader bitwriter linker asmparser mcjit \
-                interpreter instrumentation
-
-ifneq ($(CFG_LLVM_ROOT),)
-# Ensure we only try to link targets that the installed LLVM actually has:
-LLVM_COMPONENTS := $(filter $(shell $(CFG_LLVM_ROOT)/bin/llvm-config$(X_$(CFG_BUILD)) --components),\
-                       $(LLVM_OPTIONAL_COMPONENTS)) $(LLVM_REQUIRED_COMPONENTS)
-else
-LLVM_COMPONENTS := $(LLVM_OPTIONAL_COMPONENTS) $(LLVM_REQUIRED_COMPONENTS)
-endif
-
-# Only build these LLVM tools
-LLVM_TOOLS=bugpoint llc llvm-ar llvm-as llvm-dis llvm-mc opt llvm-extract
-
-define DEF_LLVM_VARS
-# The configure script defines these variables with the target triples
-# separated by Z. This defines new ones with the expected format.
-ifeq ($$(CFG_LLVM_ROOT),)
-CFG_LLVM_BUILD_DIR_$(1):=$$(CFG_LLVM_BUILD_DIR_$(subst -,_,$(1)))
-CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_INST_DIR_$(subst -,_,$(1)))
-else
-CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_ROOT)
-endif
-
-# Any rules that depend on LLVM should depend on LLVM_CONFIG
-LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X_$(1))
-LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X_$(1))
-LLVM_AR_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-ar$$(X_$(1))
-LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
-LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
-LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
-LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
-LLVM_LIBDIR_RUSTFLAGS_$(1)=-L native="$$(LLVM_LIBDIR_$(1))"
-LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
-ifeq ($$(findstring freebsd,$(1)),freebsd)
-# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),
-# so we replace -I with -iquote to ensure that it searches bundled LLVM first.
-LLVM_CXXFLAGS_$(1)=$$(subst -I, -iquote , $$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags))
-else
-LLVM_CXXFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags)
-endif
-LLVM_HOST_TRIPLE_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --host-target)
-
-LLVM_AS_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-as$$(X_$(1))
-LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X_$(1))
-
-LLVM_ALL_COMPONENTS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --components)
-LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(call DEF_LLVM_VARS,$(host))))
-
-######################################################################
-# Exports for sub-utilities
-######################################################################
-
-# Note that any variable that re-configure should pick up needs to be
-# exported
-
-export CFG_SRC_DIR
-export CFG_SRC_DIR_RELATIVE
-export CFG_BUILD_DIR
-ifdef CFG_VER_DATE
-export CFG_VER_DATE
-endif
-ifdef CFG_VER_HASH
-export CFG_VER_HASH
-endif
-export CFG_VERSION
-export CFG_VERSION_WIN
-export CFG_RELEASE
-export CFG_PACKAGE_NAME
-export CFG_BUILD
-export CFG_RELEASE_CHANNEL
-export CFG_LLVM_ROOT
-export CFG_PREFIX
-export CFG_LIBDIR
-export CFG_LIBDIR_RELATIVE
-export CFG_DISABLE_INJECT_STD_VERSION
-ifdef CFG_DISABLE_UNSTABLE_FEATURES
-CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES))
-# Turn on feature-staging
-export CFG_DISABLE_UNSTABLE_FEATURES
-# Subvert unstable feature lints to do the self-build
-endif
-ifdef CFG_MUSL_ROOT
-export CFG_MUSL_ROOT
-endif
-
-export RUSTC_BOOTSTRAP := 1
-
-######################################################################
-# Per-stage targets and runner
-######################################################################
-
-# Valid setting-strings are 'all', 'none', 'gdb', 'lldb'
-# This 'function' will determine which debugger scripts to copy based on a
-# target triple. See debuggers.mk for more information.
-TRIPLE_TO_DEBUGGER_SCRIPT_SETTING=\
- $(if $(findstring windows-msvc,$(1)),none,all)
-
-STAGES = 0 1 2 3
-
-define SREQ
-# $(1) is the stage number
-# $(2) is the target triple
-# $(3) is the host triple
-
-# Destinations of artifacts for the host compiler
-HROOT$(1)_H_$(3) = $(3)/stage$(1)
-HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
-
-ifeq ($$(CFG_WINDOWSY_$(3)),1)
-# On Windows we always store host runtime libraries in the 'bin' directory because
-# there's no rpath. Target libraries go under $CFG_LIBDIR_RELATIVE (usually 'lib').
-HLIB_RELATIVE$(1)_H_$(3) = bin
-TROOT$(1)_T_$(2)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)/rustlib/$(2)
-# Remove the next 3 lines after a snapshot
-ifeq ($(1),0)
-RUSTFLAGS_STAGE0 += -L $$(TROOT$(1)_T_$(2)_H_$(3))/lib
-endif
-
-else
-
-ifeq ($(1),0)
-HLIB_RELATIVE$(1)_H_$(3) = lib
-else
-HLIB_RELATIVE$(1)_H_$(3) = $$(CFG_LIBDIR_RELATIVE)
-endif
-TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
-
-endif
-HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(HLIB_RELATIVE$(1)_H_$(3))
-
-# Destinations of artifacts for target architectures
-TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
-TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
-
-# Preqrequisites for using the stageN compiler
-ifeq ($(1),0)
-HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
-else
-HSREQ$(1)_H_$(3) = \
-       $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
-       $$(MKFILE_DEPS) \
-       tmp/install-debugger-scripts$(1)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(3)).done
-endif
-
-# Prerequisites for using the stageN compiler to build target artifacts
-TSREQ$(1)_T_$(2)_H_$(3) = \
-       $$(HSREQ$(1)_H_$(3)) \
-       $$(foreach obj,$$(REQUIRED_OBJECTS_$(2)),\
-               $$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj))
-
-# Prerequisites for a working stageN compiler and libraries, for a specific
-# target
-SREQ$(1)_T_$(2)_H_$(3) = \
-       $$(TSREQ$(1)_T_$(2)_H_$(3)) \
-       $$(foreach dep,$$(TARGET_CRATES_$(2)), \
-           $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
-       tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(2)).done
-
-# Prerequisites for a working stageN compiler and complete set of target
-# libraries
-CSREQ$(1)_T_$(2)_H_$(3) = \
-       $$(TSREQ$(1)_T_$(2)_H_$(3)) \
-       $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
-       $$(foreach dep,$$(HOST_CRATES),$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep))
-
-ifeq ($(1),0)
-# Don't run the stage0 compiler under valgrind - that ship has sailed
-CFG_VALGRIND_COMPILE$(1) =
-else
-CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE)
-endif
-
-# Add RUSTFLAGS_STAGEN values to the build command
-EXTRAFLAGS_STAGE$(1) = $$(RUSTFLAGS_STAGE$(1))
-
-CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1)
-
-endef
-
-# Same macro/variables as above, but defined in a separate loop so it can use
-# all the variables above for all archs. The RPATH_VAR setup sometimes needs to
-# reach across triples to get things in order.
-#
-# Defines (with the standard $(1)_T_$(2)_H_$(3) suffix):
-# * `LD_LIBRARY_PATH_ENV_NAME`: the name for the key to use in the OS
-#   environment to access or extend the lookup path for dynamic
-#   libraries.  Note on Windows, that key is `$PATH`, and thus not
-#   only conflates programs with dynamic libraries, but also often
-#   contains spaces which confuse make.
-# * `LD_LIBRARY_PATH_ENV_HOSTDIR`: the entry to add to lookup path for the host
-# * `LD_LIBRARY_PATH_ENV_TARGETDIR`: the entry to add to lookup path for target
-#
-# Below that, HOST_RPATH_VAR and TARGET_RPATH_VAR are defined in terms of the
-# above settings.
-#
-define SREQ_CMDS
-
-ifeq ($$(OSTYPE_$(3)),apple-darwin)
-  LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := DYLD_LIBRARY_PATH
-else
-ifeq ($$(CFG_WINDOWSY_$(3)),1)
-  LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := PATH
-else
-ifeq ($$(OSTYPE_$(3)),unknown-haiku)
-  LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LIBRARY_PATH
-else
-  LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LD_LIBRARY_PATH
-endif
-endif
-endif
-
-LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
-    $$(CURDIR)/$$(HLIB$(1)_H_$(3)):$$(CFG_LLVM_INST_DIR_$(3))/lib
-LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \
-    $$(CURDIR)/$$(TLIB$(1)_T_$(2)_H_$(3))
-
-HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
-  $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))
-TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
-  $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))
-
-RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(HOST_RPATH_VAR$(1)_T_$(2)_H_$(3))
-
-# Pass --cfg stage0 only for the build->host part of stage0;
-# if you're building a cross config, the host->* parts are
-# effectively stage1, since it uses the just-built stage0.
-#
-# Also be sure to use the right rpath because we're loading libraries from the
-# CFG_BUILD's stage1 directory for our target, so switch this one instance of
-# `RPATH_VAR` to get the bootstrap working.
-ifeq ($(1),0)
-ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
-CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
-
-RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR1_T_$(2)_H_$$(CFG_BUILD))
-else
-ifdef CFG_ENABLE_LOCAL_REBUILD
-# Assume the local-rebuild rustc already has stage1 features too.
-CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
-endif
-endif
-endif
-
-STAGE$(1)_T_$(2)_H_$(3) := \
-       $$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \
-               $$(call CFG_RUN_TARG_$(3),$(1), \
-               $$(CFG_VALGRIND_COMPILE$(1)) \
-               $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
-               --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
-               $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
-                $$(RUSTC_FLAGS_$(2))
-
-endef
-
-$(foreach build,$(CFG_HOST), \
- $(eval $(foreach target,$(CFG_TARGET), \
-  $(eval $(foreach stage,$(STAGES), \
-   $(eval $(call SREQ,$(stage),$(target),$(build))))))))
-
-$(foreach build,$(CFG_HOST), \
- $(eval $(foreach target,$(CFG_TARGET), \
-  $(eval $(foreach stage,$(STAGES), \
-   $(eval $(call SREQ_CMDS,$(stage),$(target),$(build))))))))
-
-######################################################################
-# rustc-H-targets
-#
-# Builds a functional Rustc for the given host.
-######################################################################
-
-define DEF_RUSTC_STAGE_TARGET
-# $(1) == architecture
-# $(2) == stage
-
-rustc-stage$(2)-H-$(1): \
-       $$(foreach target,$$(CFG_TARGET),$$(SREQ$(2)_T_$$(target)_H_$(1)))
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(foreach stage,1 2 3, \
-  $(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage))))))
-
-rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
-rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
-rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
-
-define DEF_RUSTC_TARGET
-# $(1) == architecture
-
-rustc-H-$(1): rustc-stage2-H-$(1)
-endef
-
-$(foreach host,$(CFG_TARGET), \
- $(eval $(call DEF_RUSTC_TARGET,$(host))))
-
-rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
-rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
-rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
-rustc: rustc-H-$(CFG_BUILD)
-
-rustc-H-all: $(foreach host,$(CFG_HOST),rustc-H-$(host))
-
-######################################################################
-# Entrypoint rule
-######################################################################
-
-.DEFAULT_GOAL := all
-
-define ALL_TARGET_N
-ifneq ($$(findstring $(1),$$(CFG_HOST)),)
-# This is a host
-all-target-$(1)-host-$(2): $$(CSREQ2_T_$(1)_H_$(2))
-else
-# This is a target only
-all-target-$(1)-host-$(2): $$(SREQ2_T_$(1)_H_$(2))
-endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
- $(foreach host,$(CFG_HOST), \
- $(eval $(call ALL_TARGET_N,$(target),$(host)))))
-
-ALL_TARGET_RULES = $(foreach target,$(CFG_TARGET), \
-       $(foreach host,$(CFG_HOST), \
- all-target-$(target)-host-$(host)))
-
-all-no-docs: $(ALL_TARGET_RULES) $(GENERATED)
-all: all-no-docs docs
-
-######################################################################
-# Build system documentation
-######################################################################
-
-# $(1) is the name of the doc <section> in Makefile.in
-# pick everything between tags | remove first line | remove last line
-# | remove extra (?) line | strip leading `#` from lines
-SHOW_DOCS = $(Q)awk '/<$(1)>/,/<\/$(1)>/' $(S)/Makefile.in | sed '1d' | sed '$$d' | sed 's/^\# \?//'
-
-help:
-       $(call SHOW_DOCS,help)
-
-tips:
-       $(call SHOW_DOCS,tips)
-
-nitty-gritty:
-       $(call SHOW_DOCS,nitty-gritty)
diff --git a/mk/platform.mk b/mk/platform.mk
deleted file mode 100644 (file)
index 6a7a20c..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-# Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-
-# Create variables HOST_<triple> containing the host part
-# of each target triple.  For example, the triple i686-darwin-macos
-# would create a variable HOST_i686-darwin-macos with the value
-# i386.
-define DEF_HOST_VAR
-  HOST_$(1) = $(patsubst i%86,i386,$(word 1,$(subst -, ,$(1))))
-endef
-$(foreach t,$(CFG_TARGET),$(eval $(call DEF_HOST_VAR,$(t))))
-$(foreach t,$(CFG_TARGET),$(info cfg: host for $(t) is $(HOST_$(t))))
-
-# Ditto for OSTYPE
-define DEF_OSTYPE_VAR
-  OSTYPE_$(1) = $(subst $(firstword $(subst -, ,$(1)))-,,$(1))
-endef
-$(foreach t,$(CFG_TARGET),$(eval $(call DEF_OSTYPE_VAR,$(t))))
-$(foreach t,$(CFG_TARGET),$(info cfg: os for $(t) is $(OSTYPE_$(t))))
-
-# On Darwin, we need to run dsymutil so the debugging information ends
-# up in the right place.  On other platforms, it automatically gets
-# embedded into the executable, so use a no-op command.
-CFG_DSYMUTIL := true
-
-# Hack: not sure how to test if a file exists in make other than this
-OS_SUPP = $(patsubst %,--suppressions=%, \
-      $(wildcard $(CFG_SRC_DIR)src/etc/$(CFG_OSTYPE).supp*))
-
-ifdef CFG_DISABLE_OPTIMIZE_CXX
-  $(info cfg: disabling C++ optimization (CFG_DISABLE_OPTIMIZE_CXX))
-  CFG_GCCISH_CFLAGS += -O0
-else
-  CFG_GCCISH_CFLAGS += -O2
-endif
-
-# The soname thing is for supporting a statically linked jemalloc.
-# see https://blog.mozilla.org/jseward/2012/06/05/valgrind-now-supports-jemalloc-builds-directly/
-ifdef CFG_VALGRIND
-  CFG_VALGRIND += --error-exitcode=100 \
-                  --fair-sched=try \
-                  --quiet \
-                  --soname-synonyms=somalloc=NONE \
-                  --suppressions=$(CFG_SRC_DIR)src/etc/x86.supp \
-                  $(OS_SUPP)
-  ifdef CFG_ENABLE_HELGRIND
-    CFG_VALGRIND += --tool=helgrind
-  else
-    CFG_VALGRIND += --tool=memcheck \
-                    --leak-check=full
-  endif
-endif
-
-# If we actually want to run Valgrind on a given platform, set this variable
-define DEF_GOOD_VALGRIND
-  ifeq ($(OSTYPE_$(1)),unknown-linux-gnu)
-    GOOD_VALGRIND_$(1) = 1
-  endif
-  ifneq (,$(filter $(OSTYPE_$(1)),apple-darwin freebsd))
-    ifeq ($(HOST_$(1)),x86_64)
-      GOOD_VALGRIND_$(1) = 1
-    endif
-  endif
-  ifdef GOOD_VALGRIND_$(t)
-    $$(info cfg: have good valgrind for $(t))
-  else
-    $$(info cfg: no good valgrind for $(t))
-  endif
-endef
-$(foreach t,$(CFG_TARGET),$(eval $(call DEF_GOOD_VALGRIND,$(t))))
-
-AR := ar
-
-define SET_FROM_CFG
-  ifdef CFG_$(1)
-    ifeq ($(origin $(1)),undefined)
-      $$(info cfg: using $(1)=$(CFG_$(1)) (CFG_$(1)))
-      $(1)=$(CFG_$(1))
-    endif
-    ifeq ($(origin $(1)),default)
-      $$(info cfg: using $(1)=$(CFG_$(1)) (CFG_$(1)))
-      $(1)=$(CFG_$(1))
-    endif
-  endif
-endef
-
-$(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS, \
-  $(eval $(call SET_FROM_CFG,$(cvar))))
-
-CFG_RLIB_GLOB=lib$(1)-*.rlib
-
-include $(wildcard $(CFG_SRC_DIR)mk/cfg/*.mk)
-
-define ADD_INSTALLED_OBJECTS
-  INSTALLED_OBJECTS_$(1) += $$(CFG_INSTALLED_OBJECTS_$(1))
-  REQUIRED_OBJECTS_$(1) += $$(CFG_THIRD_PARTY_OBJECTS_$(1))
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call ADD_INSTALLED_OBJECTS,$(target))))
-
-define DEFINE_LINKER
-  ifndef LINK_$(1)
-    LINK_$(1) := $$(CC_$(1))
-  endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call DEFINE_LINKER,$(target))))
-
-define ADD_JEMALLOC_DEP
-  ifndef CFG_DISABLE_JEMALLOC_$(1)
-    ifndef CFG_DISABLE_JEMALLOC
-      RUST_DEPS_std_T_$(1) += alloc_jemalloc
-      TARGET_CRATES_$(1) += alloc_jemalloc
-    endif
-  endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call ADD_JEMALLOC_DEP,$(target))))
-
-# The -Qunused-arguments sidesteps spurious warnings from clang
-define FILTER_FLAGS
-  ifeq ($$(CFG_USING_CLANG),1)
-    ifneq ($(findstring clang,$$(shell $(CC_$(1)) -v)),)
-      CFG_GCCISH_CFLAGS_$(1) += -Qunused-arguments
-      CFG_GCCISH_CXXFLAGS_$(1) += -Qunused-arguments
-    endif
-  endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call FILTER_FLAGS,$(target))))
-
-# Configure various macros to pass gcc or cl.exe style arguments
-define CC_MACROS
-  CFG_CC_INCLUDE_$(1)=-I $$(1)
-  ifeq ($$(findstring msvc,$(1)),msvc)
-    CFG_CC_OUTPUT_$(1)=-Fo:$$(1)
-    CFG_CREATE_ARCHIVE_$(1)='$$(AR_$(1))' -OUT:$$(1)
-  else
-    CFG_CC_OUTPUT_$(1)=-o $$(1)
-    CFG_CREATE_ARCHIVE_$(1)=$$(AR_$(1)) crus $$(1)
-  endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call CC_MACROS,$(target))))
-
-
-ifeq ($(CFG_CCACHE_CPP2),1)
-  CCACHE_CPP2=1
-  export CCACHE_CPP
-endif
-
-ifdef CFG_CCACHE_BASEDIR
-  CCACHE_BASEDIR=$(CFG_CCACHE_BASEDIR)
-  export CCACHE_BASEDIR
-endif
-
-FIND_COMPILER = $(strip $(1:ccache=))
-
-define CFG_MAKE_TOOLCHAIN
-  # Prepend the tools with their prefix if cross compiling
-  ifneq ($(CFG_BUILD),$(1))
-    ifneq ($$(findstring msvc,$(1)),msvc)
-       CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1))
-       CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1))
-       CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1))
-       AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
-       LINK_$(1)=$(CROSS_PREFIX_$(1))$(LINK_$(1))
-       RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(LINK_$(1))) \
-           -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
-
-       RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
-    endif
-  endif
-
-  CFG_COMPILE_C_$(1) = '$$(call FIND_COMPILER,$$(CC_$(1)))' \
-        $$(CFLAGS) \
-        $$(CFG_GCCISH_CFLAGS) \
-        $$(CFG_GCCISH_CFLAGS_$(1)) \
-        -c $$(call CFG_CC_OUTPUT_$(1),$$(1)) $$(2)
-  CFG_LINK_C_$(1) = $$(CC_$(1)) \
-        $$(LDFLAGS) \
-        $$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
-        $$(CFG_GCCISH_LINK_FLAGS_$(1)) \
-        $$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
-        $$(call CFG_INSTALL_NAME_$(1),$$(4))
-  CFG_COMPILE_CXX_$(1) = '$$(call FIND_COMPILER,$$(CXX_$(1)))' \
-        $$(CXXFLAGS) \
-        $$(CFG_GCCISH_CFLAGS) \
-        $$(CFG_GCCISH_CXXFLAGS) \
-        $$(CFG_GCCISH_CFLAGS_$(1)) \
-        $$(CFG_GCCISH_CXXFLAGS_$(1)) \
-        -c $$(call CFG_CC_OUTPUT_$(1),$$(1)) $$(2)
-  CFG_LINK_CXX_$(1) = $$(CXX_$(1)) \
-        $$(LDFLAGS) \
-        $$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
-        $$(CFG_GCCISH_LINK_FLAGS_$(1)) \
-        $$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
-        $$(call CFG_INSTALL_NAME_$(1),$$(4))
-
-  ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
-
-  # On Bitrig, we need the relocation model to be PIC for everything
-  ifeq (,$(filter $(OSTYPE_$(1)),bitrig))
-    LLVM_MC_RELOCATION_MODEL="pic"
-  else
-    LLVM_MC_RELOCATION_MODEL="default"
-  endif
-
-  # LLVM changed this flag in 3.9
-  ifdef CFG_LLVM_MC_HAS_RELOCATION_MODEL
-    LLVM_MC_RELOC_FLAG := -relocation-model=$$(LLVM_MC_RELOCATION_MODEL)
-  else
-    LLVM_MC_RELOC_FLAG := -position-independent
-  endif
-
-  # We're using llvm-mc as our assembler because it supports
-  # .cfi pseudo-ops on mac
-  CFG_ASSEMBLE_$(1)=$$(CPP_$(1)) -E $$(2) | \
-                    $$(LLVM_MC_$$(CFG_BUILD)) \
-                    -assemble \
-                    $$(LLVM_MC_RELOC_FLAG) \
-                    -filetype=obj \
-                    -triple=$(1) \
-                    -o=$$(1)
-  else
-
-  # For the ARM, AARCH64, MIPS and POWER crosses, use the toolchain assembler
-  # FIXME: We should be able to use the LLVM assembler
-  CFG_ASSEMBLE_$(1)=$$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
-                   $$(2) -c -o $$(1)
-
-  endif
-
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call CFG_MAKE_TOOLCHAIN,$(target))))
diff --git a/mk/prepare.mk b/mk/prepare.mk
deleted file mode 100644 (file)
index 20e20e9..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-# Basic support for producing installation images.
-#
-# The 'prepare' build target copies all release artifacts from the build
-# directory to some other location, placing all binaries, libraries, and
-# docs in their final locations relative to each other.
-#
-# It requires the following variables to be set:
-#
-#   PREPARE_HOST - the host triple
-#   PREPARE_TARGETS - the target triples, space separated
-#   PREPARE_DEST_DIR - the directory to put the image
-
-PREPARE_STAGE=2
-
-DEFAULT_PREPARE_DIR_CMD = umask 022 && mkdir -p
-DEFAULT_PREPARE_BIN_CMD = install -m755
-DEFAULT_PREPARE_LIB_CMD = install -m644
-DEFAULT_PREPARE_MAN_CMD = install -m644
-
-# Create a directory
-# $(1) is the directory
-#
-# XXX: These defines are called to generate make steps.
-# Adding blank lines means two steps from different defines will not end up on
-# the same line.
-define PREPARE_DIR
-
-       @$(call E, prepare: $(1))
-       $(Q)$(PREPARE_DIR_CMD) $(1)
-
-endef
-
-# Copy an executable
-# $(1) is the filename/libname-glob
-#
-# See above for an explanation on the surrounding blank lines
-define PREPARE_BIN
-
-       @$(call E, prepare: $(PREPARE_DEST_BIN_DIR)/$(1))
-       $(Q)$(PREPARE_BIN_CMD) $(PREPARE_SOURCE_BIN_DIR)/$(1) $(PREPARE_DEST_BIN_DIR)/$(1)
-
-endef
-
-# Copy a dylib or rlib
-# $(1) is the filename/libname-glob
-#
-# See above for an explanation on the surrounding blank lines
-define PREPARE_LIB
-
-       @$(call E, prepare: $(PREPARE_WORKING_DEST_LIB_DIR)/$(1))
-       $(Q)LIB_NAME="$(notdir $(lastword $(wildcard $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1))))"; \
-       MATCHES="$(filter-out %$(notdir $(lastword $(wildcard $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1)))), \
-                        $(wildcard $(PREPARE_WORKING_DEST_LIB_DIR)/$(1)))"; \
-       if [ -n "$$MATCHES" ]; then \
-         echo "warning: one or libraries matching Rust library '$(1)'" && \
-         echo "  (other than '$$LIB_NAME' itself) already present"     && \
-         echo "  at destination $(PREPARE_WORKING_DEST_LIB_DIR):"      && \
-         echo $$MATCHES ; \
-       fi
-       $(Q)$(PREPARE_LIB_CMD) `ls -drt1 $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1)` $(PREPARE_WORKING_DEST_LIB_DIR)/
-
-endef
-
-# Copy a man page
-# $(1) - source dir
-#
-# See above for an explanation on the surrounding blank lines
-define PREPARE_MAN
-
-       @$(call E, prepare: $(PREPARE_DEST_MAN_DIR)/$(1))
-       $(Q)$(PREPARE_MAN_CMD) $(PREPARE_SOURCE_MAN_DIR)/$(1) $(PREPARE_DEST_MAN_DIR)/$(1)
-
-endef
-
-PREPARE_TOOLS = $(filter-out compiletest rustbook error_index_generator, $(TOOLS))
-
-
-# $(1) is tool
-# $(2) is stage
-# $(3) is host
-# $(4) tag
-define DEF_PREPARE_HOST_TOOL
-prepare-host-tool-$(1)-$(2)-$(3)-$(4): \
-       PREPARE_SOURCE_BIN_DIR=$$(HBIN$(2)_H_$(3))
-prepare-host-tool-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
-                                  $$(foreach dep,$$(TOOL_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
-                                  $$(HBIN$(2)_H_$(3))/$(1)$$(X_$(3)) \
-                                  prepare-host-dirs-$(4)
-       $$(if $$(findstring $(2), $$(PREPARE_STAGE)), \
-      $$(if $$(findstring $(3), $$(PREPARE_HOST)), \
-        $$(call PREPARE_BIN,$(1)$$(X_$$(PREPARE_HOST))),),)
-       $$(if $$(findstring $(2), $$(PREPARE_STAGE)), \
-      $$(if $$(findstring $(3), $$(PREPARE_HOST)), \
-        $$(call PREPARE_MAN,$(1).1),),)
-endef
-
-# Libraries are compiled using the --libdir provided to configure, but
-# we store them in the tarball using just "lib" so that the install
-# script can then rewrite them back to the correct path.
-PREPARE_TAR_LIB_DIR = $(patsubst $(CFG_LIBDIR_RELATIVE)%,lib%,$(1))
-
-# For host libraries only install dylibs, not rlibs since the host libs are only
-# used to support rustc and rustc uses dynamic linking
-#
-# $(1) is tool
-# $(2) is stage
-# $(3) is host
-# $(4) tag
-define DEF_PREPARE_HOST_LIB
-prepare-host-lib-$(1)-$(2)-$(3)-$(4): \
-       PREPARE_WORKING_SOURCE_LIB_DIR=$$(HLIB$(2)_H_$(3))
-prepare-host-lib-$(1)-$(2)-$(3)-$(4): \
-       PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(HLIB_RELATIVE$(2)_H_$(3)))
-prepare-host-lib-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
-                                 $$(foreach dep,$$(RUST_DEPS_$(1)_T_$(3)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
-                                 $$(HLIB$(2)_H_$(3))/stamp.$(1) \
-                                 prepare-host-dirs-$(4)
-       $$(if $$(findstring $(2), $$(PREPARE_STAGE)), \
-      $$(if $$(findstring $(3), $$(PREPARE_HOST)), \
-        $$(if $$(findstring 1,$$(ONLY_RLIB_$(1))),, \
-          $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$$(PREPARE_HOST),$(1)))),),)
-endef
-
-
-# $(1) is stage
-# $(2) is target
-# $(3) is host
-# $(4) tag
-define DEF_PREPARE_TARGET_N
-# Rebind PREPARE_*_LIB_DIR to point to rustlib, then install the libs for the targets
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
-       PREPARE_WORKING_SOURCE_LIB_DIR=$$(TLIB$(1)_T_$(2)_H_$(3))
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
-       PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
-       PREPARE_SOURCE_BIN_DIR=$$(TBIN$(1)_T_$(2)_H_$(3))
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
-       PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(3)/bin
-prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
-        $$(foreach crate,$$(TARGET_CRATES_$(2)), \
-          $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
-        $$(if $$(findstring $(2),$$(CFG_HOST)), \
-          $$(foreach crate,$$(HOST_CRATES), \
-            $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)),)
-# Only install if this host and target combo is being prepared. Also be sure to
-# *not* install the rlibs for host crates because there's no need to statically
-# link against most of them. They just produce a large amount of extra size
-# bloat.
-       $$(if $$(findstring $(1), $$(PREPARE_STAGE)), \
-      $$(if $$(findstring $(2), $$(PREPARE_TARGETS)), \
-        $$(if $$(findstring $(3), $$(PREPARE_HOST)), \
-          $$(call PREPARE_DIR,$$(PREPARE_WORKING_DEST_LIB_DIR)) \
-          $$(call PREPARE_DIR,$$(PREPARE_DEST_BIN_DIR)) \
-          $$(foreach crate,$$(TARGET_CRATES_$(2)), \
-           $$(if $$(or $$(findstring 1, $$(ONLY_RLIB_$$(crate))),$$(findstring 1,$$(CFG_INSTALL_ONLY_RLIB_$(2)))),, \
-              $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))) \
-            $$(call PREPARE_LIB,$$(call CFG_RLIB_GLOB,$$(crate)))) \
-          $$(if $$(findstring $(2),$$(CFG_HOST)), \
-            $$(foreach crate,$$(HOST_CRATES), \
-              $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))),) \
-         $$(foreach object,$$(INSTALLED_OBJECTS_$(2)),\
-           $$(call PREPARE_LIB,$$(object))) \
-         $$(foreach bin,$$(INSTALLED_BINS_$(3)),\
-           $$(call PREPARE_BIN,$$(bin))) \
-       ,),),)
-endef
-
-define INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS
-       $(Q)$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $(PREPARE_DEST_BIN_DIR)
-       $(Q)$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $(PREPARE_DEST_LIB_DIR)/rustlib/etc
-endef
-
-define INSTALL_LLDB_DEBUGGER_SCRIPTS_COMMANDS
-       $(Q)$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $(PREPARE_DEST_BIN_DIR)
-       $(Q)$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $(PREPARE_DEST_LIB_DIR)/rustlib/etc
-endef
-
-define INSTALL_NO_DEBUGGER_SCRIPTS_COMMANDS
-       $(Q)echo "No debugger scripts will be installed for host $(PREPARE_HOST)"
-endef
-
-# $(1) is PREPARE_HOST
-INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\
-                                   $(INSTALL_NO_DEBUGGER_SCRIPTS_COMMANDS),\
-                                   $(if $(findstring darwin,$(1)),\
-                                     $(INSTALL_LLDB_DEBUGGER_SCRIPTS_COMMANDS),\
-                                     $(INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS)))
-
-define DEF_PREPARE
-
-prepare-base-$(1)-%: PREPARE_SOURCE_MAN_DIR=$$(S)/man
-prepare-base-$(1)-%: PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/bin
-prepare-base-$(1)-%: PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(CFG_LIBDIR_RELATIVE))
-prepare-base-$(1)-%: PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1
-
-prepare-base-$(1)-target: prepare-target-$(1)
-prepare-base-$(1)-host: prepare-host-$(1) prepare-debugger-scripts-$(1)
-
-prepare-host-$(1): prepare-host-tools-$(1)
-
-prepare-host-tools-$(1): \
-        $$(foreach tool, $$(PREPARE_TOOLS), \
-          $$(foreach host,$$(CFG_HOST), \
-            prepare-host-tool-$$(tool)-$$(PREPARE_STAGE)-$$(host)-$(1)))
-
-prepare-host-dirs-$(1): prepare-maybe-clean-$(1)
-       $$(call PREPARE_DIR,$$(PREPARE_DEST_BIN_DIR))
-       $$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR))
-       $$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR)/rustlib/etc)
-       $$(call PREPARE_DIR,$$(PREPARE_DEST_MAN_DIR))
-
-prepare-debugger-scripts-$(1): prepare-host-dirs-$(1) \
-                               $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) \
-                               $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS)
-       $$(call INSTALL_DEBUGGER_SCRIPT_COMMANDS,$$(PREPARE_HOST))
-
-$$(foreach tool,$$(PREPARE_TOOLS), \
-  $$(foreach host,$$(CFG_HOST), \
-      $$(eval $$(call DEF_PREPARE_HOST_TOOL,$$(tool),$$(PREPARE_STAGE),$$(host),$(1)))))
-
-$$(foreach lib,$$(CRATES), \
-  $$(foreach host,$$(CFG_HOST), \
-    $$(eval $$(call DEF_PREPARE_HOST_LIB,$$(lib),$$(PREPARE_STAGE),$$(host),$(1)))))
-
-prepare-target-$(1): \
-        $$(foreach host,$$(CFG_HOST), \
-           $$(foreach target,$$(CFG_TARGET), \
-             prepare-target-$$(target)-host-$$(host)-$$(PREPARE_STAGE)-$(1)))
-
-$$(foreach host,$$(CFG_HOST), \
-  $$(foreach target,$$(CFG_TARGET), \
-    $$(eval $$(call DEF_PREPARE_TARGET_N,$$(PREPARE_STAGE),$$(target),$$(host),$(1)))))
-
-prepare-maybe-clean-$(1):
-       $$(if $$(findstring true,$$(PREPARE_CLEAN)), \
-      @$$(call E, cleaning destination $$(PREPARE_DEST_DIR)),)
-       $$(if $$(findstring true,$$(PREPARE_CLEAN)), \
-      $$(Q)rm -rf $$(PREPARE_DEST_DIR),)
-
-
-endef
diff --git a/mk/reconfig.mk b/mk/reconfig.mk
deleted file mode 100644 (file)
index b8f5109..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-# Recursive wildcard function
-# http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
-rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
-  $(filter $(subst *,%,$2),$d))
-
-ifndef CFG_DISABLE_MANAGE_SUBMODULES
-# This is a pretty expensive operation but I don't see any way to avoid it
-# NB: This only looks for '+' status (wrong commit checked out), not '-' status
-# (nothing checked out at all).  `./configure --{llvm,jemalloc}-root`
-# will explicitly deinitialize the corresponding submodules, and we don't
-# want to force constant rebuilds in that case.
-NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && $(CFG_GIT) submodule status | grep -c '^+')
-else
-NEED_GIT_RECONFIG=0
-endif
-
-ifeq ($(NEED_GIT_RECONFIG),0)
-else
-# If the submodules have changed then always execute config.mk
-.PHONY: config.stamp
-endif
-
-Makefile config.mk: config.stamp
-
-ifeq ($(SREL),)
-SREL_ROOT := ./
-else
-SREL_ROOT := $(SREL)
-endif
-
-config.stamp: $(S)configure $(S)Makefile.in $(S)src/stage0.txt
-       @$(call E, cfg: reconfiguring)
-       $(SREL_ROOT)configure $(CFG_CONFIGURE_ARGS)
diff --git a/mk/rt.mk b/mk/rt.mk
deleted file mode 100644 (file)
index a67bded..0000000
--- a/mk/rt.mk
+++ /dev/null
@@ -1,719 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-################################################################################
-# Native libraries built as part of the rust build process
-#
-# This portion of the rust build system is meant to keep track of native
-# dependencies and how to build them. It is currently required that all native
-# dependencies are built as static libraries, as slinging around dynamic
-# libraries isn't exactly the most fun thing to do.
-#
-# This section should need minimal modification to add new libraries. The
-# relevant variables are:
-#
-#   NATIVE_LIBS
-#      This is a list of all native libraries which are built as part of the
-#      build process. It will build all libraries into RT_OUTPUT_DIR with the
-#      appropriate name of static library as dictated by the target platform
-#
-#   NATIVE_DEPS_<lib>
-#      This is a list of files relative to the src/rt directory which are
-#      needed to build the native library. Each file will be compiled to an
-#      object file, and then all the object files will be assembled into an
-#      archive (static library). The list contains files of any extension
-#
-# If adding a new library, you should update the NATIVE_LIBS list, and then list
-# the required files below it. The list of required files is a list of files
-# that's per-target so you're allowed to conditionally add files based on the
-# target.
-################################################################################
-NATIVE_LIBS := hoedown miniz rust_test_helpers
-
-# A macro to add a generic implementation of intrinsics iff a arch optimized implementation is not
-# already in the list.
-# $(1) is the target
-# $(2) is the intrinsic
-define ADD_INTRINSIC
-  ifeq ($$(findstring X,$$(foreach intrinsic,$$(COMPRT_OBJS_$(1)),$$(if $$(findstring $(2),$$(intrinsic)),X,))),)
-    COMPRT_OBJS_$(1) += $(2)
-  endif
-endef
-
-# $(1) is the target triple
-define NATIVE_LIBRARIES
-
-NATIVE_DEPS_hoedown_$(1) := hoedown/src/autolink.c \
-                       hoedown/src/buffer.c \
-                       hoedown/src/document.c \
-                       hoedown/src/escape.c \
-                       hoedown/src/html.c \
-                       hoedown/src/html_blocks.c \
-                       hoedown/src/html_smartypants.c \
-                       hoedown/src/stack.c \
-                       hoedown/src/version.c
-NATIVE_DEPS_miniz_$(1) = miniz.c
-NATIVE_DEPS_rust_test_helpers_$(1) := rust_test_helpers.c
-
-################################################################################
-# You shouldn't find it that necessary to edit anything below this line.
-################################################################################
-
-# While we're defining the native libraries for each target, we define some
-# common rules used to build files for various targets.
-
-RT_OUTPUT_DIR_$(1) := $(1)/rt
-
-$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.c $$(MKFILE_DEPS)
-       @mkdir -p $$(@D)
-       @$$(call E, compile: $$@)
-       $$(Q)$$(call CFG_COMPILE_C_$(1), $$@, \
-               $$(call CFG_CC_INCLUDE_$(1),$$(S)src/rt/hoedown/src) \
-               $$(call CFG_CC_INCLUDE_$(1),$$(S)src/rt) \
-                 $$(RUNTIME_CFLAGS_$(1))) $$<
-
-$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.S $$(MKFILE_DEPS) \
-           $$(LLVM_CONFIG_$$(CFG_BUILD))
-       @mkdir -p $$(@D)
-       @$$(call E, compile: $$@)
-       $$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
-
-# On MSVC targets the compiler's default include path (e.g. where to find system
-# headers) is specified by the INCLUDE environment variable. This may not be set
-# so the ./configure script scraped the relevant values and this is the location
-# that we put them into cl.exe's environment.
-ifeq ($$(findstring msvc,$(1)),msvc)
-$$(RT_OUTPUT_DIR_$(1))/%.o: \
-       export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1)))
-$(1)/rustllvm/%.o: \
-       export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1)))
-endif
-endef
-
-$(foreach target,$(CFG_TARGET),$(eval $(call NATIVE_LIBRARIES,$(target))))
-
-# A macro for devining how to build third party libraries listed above (based
-# on their dependencies).
-#
-# $(1) is the target
-# $(2) is the lib name
-define THIRD_PARTY_LIB
-
-OBJS_$(2)_$(1) := $$(NATIVE_DEPS_$(2)_$(1):%=$$(RT_OUTPUT_DIR_$(1))/%)
-OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.c=.o)
-OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.cpp=.o)
-OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.S=.o)
-NATIVE_$(2)_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),$(2))
-$$(RT_OUTPUT_DIR_$(1))/$$(NATIVE_$(2)_$(1)): $$(OBJS_$(2)_$(1))
-       @$$(call E, link: $$@)
-       $$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^
-
-endef
-
-$(foreach target,$(CFG_TARGET), \
- $(eval $(call RUNTIME_RULES,$(target))))
-$(foreach lib,$(NATIVE_LIBS), \
- $(foreach target,$(CFG_TARGET), \
-  $(eval $(call THIRD_PARTY_LIB,$(target),$(lib)))))
-
-
-################################################################################
-# Building third-party targets with external build systems
-#
-# This location is meant for dependencies which have external build systems. It
-# is still assumed that the output of each of these steps is a static library
-# in the correct location.
-################################################################################
-
-define DEF_THIRD_PARTY_TARGETS
-
-# $(1) is the target triple
-
-ifeq ($$(CFG_WINDOWSY_$(1)),1)
-  # A bit of history here, this used to be --enable-lazy-lock added in #14006
-  # which was filed with jemalloc in jemalloc/jemalloc#83 which was also
-  # reported to MinGW: http://sourceforge.net/p/mingw-w64/bugs/395/
-  #
-  # When updating jemalloc to 4.0, however, it was found that binaries would
-  # exit with the status code STATUS_RESOURCE_NOT_OWNED indicating that a thread
-  # was unlocking a mutex it never locked. Disabling this "lazy lock" option
-  # seems to fix the issue, but it was enabled by default for MinGW targets in
-  # 13473c7 for jemalloc.
-  #
-  # As a result of all that, force disabling lazy lock on Windows, and after
-  # reading some code it at least *appears* that the initialization of mutexes
-  # is otherwise ok in jemalloc, so shouldn't cause problems hopefully...
-  #
-  # tl;dr: make windows behave like other platforms by disabling lazy locking,
-  #        but requires passing an option due to a historical default with
-  #        jemalloc.
-  JEMALLOC_ARGS_$(1) := --disable-lazy-lock
-else ifeq ($(OSTYPE_$(1)), apple-ios)
-  JEMALLOC_ARGS_$(1) := --disable-tls
-else ifeq ($(findstring android, $(OSTYPE_$(1))), android)
-  # We force android to have prefixed symbols because apparently replacement of
-  # the libc allocator doesn't quite work. When this was tested (unprefixed
-  # symbols), it was found that the `realpath` function in libc would allocate
-  # with libc malloc (not jemalloc malloc), and then the standard library would
-  # free with jemalloc free, causing a segfault.
-  #
-  # If the test suite passes, however, without symbol prefixes then we should be
-  # good to go!
-  JEMALLOC_ARGS_$(1) := --disable-tls --with-jemalloc-prefix=je_
-else ifeq ($(findstring dragonfly, $(OSTYPE_$(1))), dragonfly)
-  JEMALLOC_ARGS_$(1) := --with-jemalloc-prefix=je_
-endif
-
-ifdef CFG_ENABLE_DEBUG_JEMALLOC
-  JEMALLOC_ARGS_$(1) += --enable-debug --enable-fill
-endif
-
-################################################################################
-# jemalloc
-################################################################################
-
-ifdef CFG_ENABLE_FAST_MAKE
-JEMALLOC_DEPS := $(S)/.gitmodules
-else
-JEMALLOC_DEPS := $(wildcard \
-                  $(S)src/jemalloc/* \
-                  $(S)src/jemalloc/*/* \
-                  $(S)src/jemalloc/*/*/* \
-                  $(S)src/jemalloc/*/*/*/*)
-endif
-
-# See #17183 for details, this file is touched during the build process so we
-# don't want to consider it as a dependency.
-JEMALLOC_DEPS := $(filter-out $(S)src/jemalloc/VERSION,$(JEMALLOC_DEPS))
-
-JEMALLOC_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc)
-ifeq ($$(CFG_WINDOWSY_$(1)),1)
-  JEMALLOC_REAL_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc_s)
-else
-  JEMALLOC_REAL_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc_pic)
-endif
-JEMALLOC_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(JEMALLOC_NAME_$(1))
-JEMALLOC_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/jemalloc
-JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1))
-
-$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
-       @$$(call E, make: jemalloc)
-       cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \
-               $$(JEMALLOC_ARGS_$(1)) $(CFG_JEMALLOC_FLAGS) \
-               --build=$$(CFG_GNU_TRIPLE_$(CFG_BUILD)) --host=$$(CFG_GNU_TRIPLE_$(1)) \
-               CC="$$(CC_$(1)) $$(CFG_JEMALLOC_CFLAGS_$(1))" \
-               AR="$$(AR_$(1))" \
-               RANLIB="$$(AR_$(1)) s" \
-               CPPFLAGS="-I $(S)src/rt/" \
-               EXTRA_CFLAGS="-g1 -ffunction-sections -fdata-sections"
-       $$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static
-
-ifeq ($(1),$$(CFG_BUILD))
-ifneq ($$(CFG_JEMALLOC_ROOT),)
-$$(JEMALLOC_LIB_$(1)): $$(CFG_JEMALLOC_ROOT)/libjemalloc_pic.a
-       @$$(call E, copy: jemalloc)
-       $$(Q)cp $$< $$@
-else
-$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1))
-       $$(Q)cp $$< $$@
-endif
-else
-$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1))
-       $$(Q)cp $$< $$@
-endif
-
-################################################################################
-# compiler-rt
-################################################################################
-
-# Everything below is a manual compilation of compiler-rt, disregarding its
-# build system. See comments in `src/bootstrap/native.rs` for more information.
-
-COMPRT_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
-COMPRT_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(COMPRT_NAME_$(1))
-COMPRT_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/compiler-rt
-
-# We must avoid compiling both a generic implementation (e.g. `floatdidf.c) and an arch optimized
-# implementation (e.g. `x86_64/floatdidf.S) of the same symbol (e.g. `floatdidf) because that causes
-# linker errors. To avoid that, we first add all the arch optimized implementations and then add the
-# generic implementations if and only if its arch optimized version is not already in the list. This
-# last part is handled by the ADD_INTRINSIC macro.
-
-COMPRT_OBJS_$(1) :=
-
-ifeq ($$(findstring msvc,$(1)),)
-ifeq ($$(findstring x86_64,$(1)),x86_64)
-COMPRT_OBJS_$(1) += \
-      x86_64/chkstk.o \
-      x86_64/chkstk2.o \
-      x86_64/floatdidf.o \
-      x86_64/floatdisf.o \
-      x86_64/floatdixf.o \
-      x86_64/floatundidf.o \
-      x86_64/floatundisf.o \
-      x86_64/floatundixf.o
-endif
-
-ifeq ($$(findstring i686,$$(patsubts i%86,i686,$(1))),i686)
-COMPRT_OBJS_$(1) += \
-      i386/ashldi3.o \
-      i386/ashrdi3.o \
-      i386/chkstk.o \
-      i386/chkstk2.o \
-      i386/divdi3.o \
-      i386/floatdidf.o \
-      i386/floatdisf.o \
-      i386/floatdixf.o \
-      i386/floatundidf.o \
-      i386/floatundisf.o \
-      i386/floatundixf.o \
-      i386/lshrdi3.o \
-      i386/moddi3.o \
-      i386/muldi3.o \
-      i386/udivdi3.o \
-      i386/umoddi3.o
-endif
-
-else
-
-ifeq ($$(findstring x86_64,$(1)),x86_64)
-COMPRT_OBJS_$(1) += \
-      x86_64/floatdidf.o \
-      x86_64/floatdisf.o \
-      x86_64/floatdixf.o
-endif
-
-endif
-
-# Generic ARM sources, nothing compiles on iOS though
-ifeq ($$(findstring arm,$(1)),arm)
-ifeq ($$(findstring ios,$(1)),)
-COMPRT_OBJS_$(1) += \
-  arm/aeabi_cdcmp.o \
-  arm/aeabi_cdcmpeq_check_nan.o \
-  arm/aeabi_cfcmp.o \
-  arm/aeabi_cfcmpeq_check_nan.o \
-  arm/aeabi_dcmp.o \
-  arm/aeabi_div0.o \
-  arm/aeabi_drsub.o \
-  arm/aeabi_fcmp.o \
-  arm/aeabi_frsub.o \
-  arm/aeabi_idivmod.o \
-  arm/aeabi_ldivmod.o \
-  arm/aeabi_memcmp.o \
-  arm/aeabi_memcpy.o \
-  arm/aeabi_memmove.o \
-  arm/aeabi_memset.o \
-  arm/aeabi_uidivmod.o \
-  arm/aeabi_uldivmod.o \
-  arm/bswapdi2.o \
-  arm/bswapsi2.o \
-  arm/clzdi2.o \
-  arm/clzsi2.o \
-  arm/comparesf2.o \
-  arm/divmodsi4.o \
-  arm/divsi3.o \
-  arm/modsi3.o \
-  arm/switch16.o \
-  arm/switch32.o \
-  arm/switch8.o \
-  arm/switchu8.o \
-  arm/sync_synchronize.o \
-  arm/udivmodsi4.o \
-  arm/udivsi3.o \
-  arm/umodsi3.o
-endif
-endif
-
-# Thumb sources
-ifeq ($$(findstring armv7,$(1)),armv7)
-COMPRT_OBJS_$(1) += \
-  arm/sync_fetch_and_add_4.o \
-  arm/sync_fetch_and_add_8.o \
-  arm/sync_fetch_and_and_4.o \
-  arm/sync_fetch_and_and_8.o \
-  arm/sync_fetch_and_max_4.o \
-  arm/sync_fetch_and_max_8.o \
-  arm/sync_fetch_and_min_4.o \
-  arm/sync_fetch_and_min_8.o \
-  arm/sync_fetch_and_nand_4.o \
-  arm/sync_fetch_and_nand_8.o \
-  arm/sync_fetch_and_or_4.o \
-  arm/sync_fetch_and_or_8.o \
-  arm/sync_fetch_and_sub_4.o \
-  arm/sync_fetch_and_sub_8.o \
-  arm/sync_fetch_and_umax_4.o \
-  arm/sync_fetch_and_umax_8.o \
-  arm/sync_fetch_and_umin_4.o \
-  arm/sync_fetch_and_umin_8.o \
-  arm/sync_fetch_and_xor_4.o \
-  arm/sync_fetch_and_xor_8.o
-endif
-
-# VFP sources
-ifeq ($$(findstring eabihf,$(1)),eabihf)
-COMPRT_OBJS_$(1) += \
-  arm/adddf3vfp.o \
-  arm/addsf3vfp.o \
-  arm/divdf3vfp.o \
-  arm/divsf3vfp.o \
-  arm/eqdf2vfp.o \
-  arm/eqsf2vfp.o \
-  arm/extendsfdf2vfp.o \
-  arm/fixdfsivfp.o \
-  arm/fixsfsivfp.o \
-  arm/fixunsdfsivfp.o \
-  arm/fixunssfsivfp.o \
-  arm/floatsidfvfp.o \
-  arm/floatsisfvfp.o \
-  arm/floatunssidfvfp.o \
-  arm/floatunssisfvfp.o \
-  arm/gedf2vfp.o \
-  arm/gesf2vfp.o \
-  arm/gtdf2vfp.o \
-  arm/gtsf2vfp.o \
-  arm/ledf2vfp.o \
-  arm/lesf2vfp.o \
-  arm/ltdf2vfp.o \
-  arm/ltsf2vfp.o \
-  arm/muldf3vfp.o \
-  arm/mulsf3vfp.o \
-  arm/negdf2vfp.o \
-  arm/negsf2vfp.o \
-  arm/nedf2vfp.o \
-  arm/nesf2vfp.o \
-  arm/restore_vfp_d8_d15_regs.o \
-  arm/save_vfp_d8_d15_regs.o \
-  arm/subdf3vfp.o \
-  arm/subsf3vfp.o \
-  arm/truncdfsf2vfp.o \
-  arm/unorddf2vfp.o \
-  arm/unordsf2vfp.o
-endif
-
-$(foreach intrinsic,absvdi2.o \
-  absvsi2.o \
-  adddf3.o \
-  addsf3.o \
-  addvdi3.o \
-  addvsi3.o \
-  apple_versioning.o \
-  ashldi3.o \
-  ashrdi3.o \
-  clear_cache.o \
-  clzdi2.o \
-  clzsi2.o \
-  cmpdi2.o \
-  comparedf2.o \
-  comparesf2.o \
-  ctzdi2.o \
-  ctzsi2.o \
-  divdc3.o \
-  divdf3.o \
-  divdi3.o \
-  divmoddi4.o \
-  divmodsi4.o \
-  divsc3.o \
-  divsf3.o \
-  divsi3.o \
-  divxc3.o \
-  extendsfdf2.o \
-  extendhfsf2.o \
-  ffsdi2.o \
-  fixdfdi.o \
-  fixdfsi.o \
-  fixsfdi.o \
-  fixsfsi.o \
-  fixunsdfdi.o \
-  fixunsdfsi.o \
-  fixunssfdi.o \
-  fixunssfsi.o \
-  fixunsxfdi.o \
-  fixunsxfsi.o \
-  fixxfdi.o \
-  floatdidf.o \
-  floatdisf.o \
-  floatdixf.o \
-  floatsidf.o \
-  floatsisf.o \
-  floatundidf.o \
-  floatundisf.o \
-  floatundixf.o \
-  floatunsidf.o \
-  floatunsisf.o \
-  int_util.o \
-  lshrdi3.o \
-  moddi3.o \
-  modsi3.o \
-  muldc3.o \
-  muldf3.o \
-  muldi3.o \
-  mulodi4.o \
-  mulosi4.o \
-  muloti4.o \
-  mulsc3.o \
-  mulsf3.o \
-  mulvdi3.o \
-  mulvsi3.o \
-  mulxc3.o \
-  negdf2.o \
-  negdi2.o \
-  negsf2.o \
-  negvdi2.o \
-  negvsi2.o \
-  paritydi2.o \
-  paritysi2.o \
-  popcountdi2.o \
-  popcountsi2.o \
-  powidf2.o \
-  powisf2.o \
-  powixf2.o \
-  subdf3.o \
-  subsf3.o \
-  subvdi3.o \
-  subvsi3.o \
-  truncdfhf2.o \
-  truncdfsf2.o \
-  truncsfhf2.o \
-  ucmpdi2.o \
-  udivdi3.o \
-  udivmoddi4.o \
-  udivmodsi4.o \
-  udivsi3.o \
-  umoddi3.o \
-  umodsi3.o,
-  $(call ADD_INTRINSIC,$(1),$(intrinsic)))
-
-ifeq ($$(findstring ios,$(1)),)
-$(foreach intrinsic,absvti2.o \
-  addtf3.o \
-  addvti3.o \
-  ashlti3.o \
-  ashrti3.o \
-  clzti2.o \
-  cmpti2.o \
-  ctzti2.o \
-  divtf3.o \
-  divti3.o \
-  ffsti2.o \
-  fixdfti.o \
-  fixsfti.o \
-  fixunsdfti.o \
-  fixunssfti.o \
-  fixunsxfti.o \
-  fixxfti.o \
-  floattidf.o \
-  floattisf.o \
-  floattixf.o \
-  floatuntidf.o \
-  floatuntisf.o \
-  floatuntixf.o \
-  lshrti3.o \
-  modti3.o \
-  multf3.o \
-  multi3.o \
-  mulvti3.o \
-  negti2.o \
-  negvti2.o \
-  parityti2.o \
-  popcountti2.o \
-  powitf2.o \
-  subtf3.o \
-  subvti3.o \
-  trampoline_setup.o \
-  ucmpti2.o \
-  udivmodti4.o \
-  udivti3.o \
-  umodti3.o,
-  $(call ADD_INTRINSIC,$(1),$(intrinsic)))
-endif
-
-ifeq ($$(findstring apple,$(1)),apple)
-$(foreach intrinsic,atomic_flag_clear.o \
-  atomic_flag_clear_explicit.o \
-  atomic_flag_test_and_set.o \
-  atomic_flag_test_and_set_explicit.o \
-  atomic_signal_fence.o \
-  atomic_thread_fence.o,
-  $(call ADD_INTRINSIC,$(1),$(intrinsic)))
-endif
-
-ifeq ($$(findstring windows,$(1)),)
-$(call ADD_INTRINSIC,$(1),emutls.o)
-endif
-
-ifeq ($$(findstring msvc,$(1)),)
-
-ifeq ($$(findstring freebsd,$(1)),)
-$(call ADD_INTRINSIC,$(1),gcc_personality_v0.o)
-endif
-endif
-
-ifeq ($$(findstring aarch64,$(1)),aarch64)
-$(foreach intrinsic,comparetf2.o \
-  extenddftf2.o \
-  extendsftf2.o \
-  fixtfdi.o \
-  fixtfsi.o \
-  fixtfti.o \
-  fixunstfdi.o \
-  fixunstfsi.o \
-  fixunstfti.o \
-  floatditf.o \
-  floatsitf.o \
-  floatunditf.o \
-  floatunsitf.o \
-  multc3.o \
-  trunctfdf2.o \
-  trunctfsf2.o,
-  $(call ADD_INTRINSIC,$(1),$(intrinsic)))
-endif
-
-ifeq ($$(findstring msvc,$(1)),msvc)
-$$(COMPRT_BUILD_DIR_$(1))/%.o: CFLAGS += -Zl -D__func__=__FUNCTION__
-else
-$$(COMPRT_BUILD_DIR_$(1))/%.o: CFLAGS += -fno-builtin -fvisibility=hidden \
-       -fomit-frame-pointer -ffreestanding
-endif
-
-COMPRT_OBJS_$(1) := $$(COMPRT_OBJS_$(1):%=$$(COMPRT_BUILD_DIR_$(1))/%)
-
-$$(COMPRT_BUILD_DIR_$(1))/%.o: $(S)src/compiler-rt/lib/builtins/%.c
-       @mkdir -p $$(@D)
-       @$$(call E, compile: $$@)
-       $$(Q)$$(call CFG_COMPILE_C_$(1),$$@,$$<)
-
-$$(COMPRT_BUILD_DIR_$(1))/%.o: $(S)src/compiler-rt/lib/builtins/%.S \
-           $$(LLVM_CONFIG_$$(CFG_BUILD))
-       @mkdir -p $$(@D)
-       @$$(call E, compile: $$@)
-       $$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
-
-ifeq ($$(findstring msvc,$(1)),msvc)
-$$(COMPRT_BUILD_DIR_$(1))/%.o: \
-       export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1)))
-endif
-
-ifeq ($$(findstring emscripten,$(1)),emscripten)
-# FIXME: emscripten doesn't use compiler-rt and can't build it without
-# further hacks
-COMPRT_OBJS_$(1) :=
-endif
-
-$$(COMPRT_LIB_$(1)): $$(COMPRT_OBJS_$(1))
-       @$$(call E, link: $$@)
-       $$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^
-
-################################################################################
-# libbacktrace
-#
-# We use libbacktrace on linux to get symbols in backtraces, but only on linux.
-# Elsewhere we use other system utilities, so this library is only built on
-# linux.
-################################################################################
-
-BACKTRACE_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),backtrace)
-BACKTRACE_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(BACKTRACE_NAME_$(1))
-BACKTRACE_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/libbacktrace
-
-# We don't use this on platforms that aren't linux-based (with the exception of
-# msys2/mingw builds on windows, which use it to read the dwarf debug
-# information) so just make the file available, the compilation of libstd won't
-# actually build it.
-ifeq ($$(findstring darwin,$$(OSTYPE_$(1))),darwin)
-# See comment above
-$$(BACKTRACE_LIB_$(1)):
-       touch $$@
-
-else ifeq ($$(findstring ios,$$(OSTYPE_$(1))),ios)
-# See comment above
-$$(BACKTRACE_LIB_$(1)):
-       touch $$@
-else ifeq ($$(findstring msvc,$(1)),msvc)
-# See comment above
-$$(BACKTRACE_LIB_$(1)):
-       touch $$@
-else ifeq ($$(findstring emscripten,$(1)),emscripten)
-# FIXME: libbacktrace doesn't understand the emscripten triple
-$$(BACKTRACE_LIB_$(1)):
-       touch $$@
-else
-
-ifdef CFG_ENABLE_FAST_MAKE
-BACKTRACE_DEPS := $(S)/.gitmodules
-else
-BACKTRACE_DEPS := $(wildcard $(S)src/libbacktrace/*)
-endif
-
-# We need to export CFLAGS because otherwise it doesn't pick up cross compile
-# builds. If libbacktrace doesn't realize this, it will attempt to read 64-bit
-# elf headers when compiled for a 32-bit system, yielding blank backtraces.
-#
-# This also removes the -Werror flag specifically to prevent errors during
-# configuration.
-#
-# Down below you'll also see echos into the config.h generated by the
-# ./configure script. This is done to force libbacktrace to *not* use the
-# atomic/sync functionality because it pulls in unnecessary dependencies and we
-# never use it anyway.
-#
-# We also use `env PWD=` to clear the PWD environment variable, and then
-# execute the command in a new shell. This is necessary to workaround a
-# buildbot/msys2 bug: the shell is launched with PWD set to a windows-style path,
-# which results in all further uses of `pwd` also printing a windows-style path,
-# which breaks libbacktrace's configure script. Clearing PWD within the same
-# shell is not sufficient.
-
-$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: $$(BACKTRACE_DEPS) $$(MKFILE_DEPS)
-       @$$(call E, configure: libbacktrace for $(1))
-       $$(Q)rm -rf $$(BACKTRACE_BUILD_DIR_$(1))
-       $$(Q)mkdir -p $$(BACKTRACE_BUILD_DIR_$(1))
-       $$(Q)(cd $$(BACKTRACE_BUILD_DIR_$(1)) && env \
-             PWD= \
-             CC="$$(CC_$(1))" \
-             AR="$$(AR_$(1))" \
-             RANLIB="$$(AR_$(1)) s" \
-             CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1)) -Wno-error -fno-stack-protector" \
-             $(S)src/libbacktrace/configure --build=$(CFG_GNU_TRIPLE_$(CFG_BUILD)) --host=$(CFG_GNU_TRIPLE_$(1)))
-       $$(Q)echo '#undef HAVE_ATOMIC_FUNCTIONS' >> \
-             $$(BACKTRACE_BUILD_DIR_$(1))/config.h
-       $$(Q)echo '#undef HAVE_SYNC_FUNCTIONS' >> \
-             $$(BACKTRACE_BUILD_DIR_$(1))/config.h
-
-$$(BACKTRACE_LIB_$(1)): $$(BACKTRACE_BUILD_DIR_$(1))/Makefile $$(MKFILE_DEPS)
-       @$$(call E, make: libbacktrace)
-       $$(Q)$$(MAKE) -C $$(BACKTRACE_BUILD_DIR_$(1)) \
-               INCDIR=$(S)src/libbacktrace
-       $$(Q)cp $$(BACKTRACE_BUILD_DIR_$(1))/.libs/libbacktrace.a $$@
-
-endif
-
-################################################################################
-# libc/libunwind for musl
-#
-# When we're building a musl-like target we're going to link libc/libunwind
-# statically into the standard library and liblibc, so we need to make sure
-# they're in a location that we can find
-################################################################################
-
-ifeq ($$(findstring musl,$(1)),musl)
-$$(RT_OUTPUT_DIR_$(1))/%: $$(CFG_MUSL_ROOT)/lib/%
-       cp $$^ $$@
-else
-# Ask gcc where it is
-$$(RT_OUTPUT_DIR_$(1))/%:
-       cp $$(shell $$(CC_$(1)) -print-file-name=$$(@F)) $$@
-endif
-
-endef
-
-# Instantiate template for all stages/targets
-$(foreach target,$(CFG_TARGET), \
-     $(eval $(call DEF_THIRD_PARTY_TARGETS,$(target))))
diff --git a/mk/rustllvm.mk b/mk/rustllvm.mk
deleted file mode 100644 (file)
index 2d63f69..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2012 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.
-
-######################################################################
-# rustc LLVM-extensions (C++) library variables and rules
-######################################################################
-
-define DEF_RUSTLLVM_TARGETS
-
-# FIXME: Lately, on windows, llvm-config --includedir is not enough
-# to find the llvm includes (probably because we're not actually installing
-# llvm, but using it straight out of the build directory)
-ifdef CFG_WINDOWSY_$(1)
-LLVM_EXTRA_INCDIRS_$(1)= $$(call CFG_CC_INCLUDE_$(1),$(S)src/llvm/include) \
-                         $$(call CFG_CC_INCLUDE_$(1),\
-                          $$(CFG_LLVM_BUILD_DIR_$(1))/include)
-endif
-
-RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, \
-       RustWrapper.cpp PassWrapper.cpp \
-       ArchiveWrapper.cpp)
-
-RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
-                     $$(call CFG_CC_INCLUDE_$(1),$$(LLVM_INCDIR_$(1))) \
-                     $$(call CFG_CC_INCLUDE_$(1),$$(S)src/rustllvm/include)
-RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
-
-# Flag that we are building with Rust's llvm fork
-ifeq ($(CFG_LLVM_ROOT),)
-RUSTLLVM_CXXFLAGS_$(1) := -DLLVM_RUSTLLVM
-endif
-
-# Note that we appease `cl.exe` and its need for some sort of exception
-# handling flag with the `EHsc` argument here as well.
-ifeq ($$(findstring msvc,$(1)),msvc)
-EXTRA_RUSTLLVM_CXXFLAGS_$(1) := //EHsc
-endif
-
-$$(RT_OUTPUT_DIR_$(1))/$$(call CFG_STATIC_LIB_NAME_$(1),rustllvm): \
-           $$(RUSTLLVM_OBJS_OBJS_$(1))
-       @$$(call E, link: $$@)
-       $$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^
-
-RUSTLLVM_COMPONENTS_$(1) = $$(shell echo $$(LLVM_ALL_COMPONENTS_$(1)) |\
-       tr 'a-z-' 'A-Z_'| sed -e 's/^ //;s/\([^ ]*\)/\-DLLVM_COMPONENT_\1/g')
-
-# On MSVC we need to double-escape arguments that llvm-config printed which
-# start with a '/'. The shell we're running in will auto-translate the argument
-# `/foo` to `C:/msys64/foo` but we really want it to be passed through as `/foo`
-# so the argument passed to our shell must be `//foo`.
-$(1)/rustllvm/%.o: $(S)src/rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
-       @$$(call E, compile: $$@)
-       $$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@,) \
-               $$(subst  /,//,$$(LLVM_CXXFLAGS_$(1))) \
-               $$(RUSTLLVM_COMPONENTS_$(1)) \
-               $$(RUSTLLVM_CXXFLAGS_$(1)) \
-               $$(EXTRA_RUSTLLVM_CXXFLAGS_$(1)) \
-               $$(RUSTLLVM_INCS_$(1)) \
-               $$<
-endef
-
-# Instantiate template for all stages
-$(foreach host,$(CFG_HOST), \
- $(eval $(call DEF_RUSTLLVM_TARGETS,$(host))))
diff --git a/mk/stage0.mk b/mk/stage0.mk
deleted file mode 100644 (file)
index 8a2bf2e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# Extract the snapshot host compiler
-
-$(HBIN0_H_$(CFG_BUILD))/:
-       mkdir -p $@
-
-# On windows these two are the same, so cause a redifinition warning
-ifneq ($(HBIN0_H_$(CFG_BUILD)),$(HLIB0_H_$(CFG_BUILD)))
-$(HLIB0_H_$(CFG_BUILD))/:
-       mkdir -p $@
-endif
-
-$(SNAPSHOT_RUSTC_POST_CLEANUP): \
-               $(S)src/stage0.txt \
-               $(S)src/etc/local_stage0.sh \
-               $(S)src/etc/get-stage0.py $(MKFILE_DEPS) \
-               | $(HBIN0_H_$(CFG_BUILD))/
-       @$(call E, fetch: $@)
-ifdef CFG_ENABLE_LOCAL_RUST
-       $(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) rustlib
-else
-       $(Q)$(CFG_PYTHON) $(S)src/etc/get-stage0.py $(CFG_BUILD)
-endif
-       $(Q)if [ -e "$@" ]; then touch "$@"; else echo "ERROR: snapshot $@ not found"; exit 1; fi
-
-# For other targets, let the host build the target:
-
-define BOOTSTRAP_STAGE0
-  # $(1) target to bootstrap
-  # $(2) stage to bootstrap from
-  # $(3) target to bootstrap from
-
-$(HBIN0_H_$(1))/:
-       mkdir -p $@
-
-$(HLIB0_H_$(1))/:
-       mkdir -p $@
-
-$$(HBIN0_H_$(1))/rustc$$(X_$(1)): \
-               $$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X_$(1)) \
-               | $(HBIN0_H_$(1))/
-       @$$(call E, cp: $$@)
-       $$(Q)cp $$< $$@
-
-endef
-
-# Use stage1 to build other architectures: then you don't have to wait
-# for stage2, but you get the latest updates to the compiler source.
-$(foreach t,$(NON_BUILD_HOST), \
- $(eval $(call BOOTSTRAP_STAGE0,$(t),1,$(CFG_BUILD))))
diff --git a/mk/target.mk b/mk/target.mk
deleted file mode 100644 (file)
index 1b13990..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-# This is the compile-time target-triple for the compiler. For the compiler at
-# runtime, this should be considered the host-triple. More explanation for why
-# this exists can be found on issue #2400
-export CFG_COMPILER_HOST_TRIPLE
-
-# Used as defaults for the runtime ar and cc tools
-export CFG_DEFAULT_LINKER
-export CFG_DEFAULT_AR
-
-# Macro that generates the full list of dependencies for a crate at a particular
-# stage/target/host tuple.
-#
-# $(1) - stage
-# $(2) - target
-# $(3) - host
-# $(4) crate
-define RUST_CRATE_FULLDEPS
-CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4) := \
-               $$(CRATEFILE_$(4)) \
-               $$(RSINPUTS_$(4)) \
-               $$(foreach dep,$$(RUST_DEPS_$(4)_T_$(2)), \
-                 $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
-               $$(foreach dep,$$(NATIVE_DEPS_$(4)), \
-                 $$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),$$(dep))) \
-               $$(foreach dep,$$(NATIVE_DEPS_$(4)_T_$(2)), \
-                 $$(RT_OUTPUT_DIR_$(2))/$$(dep))
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach crate,$(CRATES), \
-    $(eval $(call RUST_CRATE_FULLDEPS,$(stage),$(target),$(host),$(crate)))))))
-
-# RUST_TARGET_STAGE_N template: This defines how target artifacts are built
-# for all stage/target architecture combinations. This is one giant rule which
-# works as follows:
-#
-#   1. The immediate dependencies are the rust source files
-#   2. Each rust crate dependency is listed (based on their stamp files),
-#      as well as all native dependencies (listed in RT_OUTPUT_DIR)
-#   3. The stage (n-1) compiler is required through the TSREQ dependency
-#   4. When actually executing the rule, the first thing we do is to clean out
-#      old libs and rlibs via the REMOVE_ALL_OLD_GLOB_MATCHES macro
-#   5. Finally, we get around to building the actual crate. It's just one
-#      "small" invocation of the previous stage rustc. We use -L to
-#      RT_OUTPUT_DIR so all the native dependencies are picked up.
-#      Additionally, we pass in the llvm dir so rustc can link against it.
-#   6. Some cleanup is done (listing what was just built) if verbose is turned
-#      on.
-#
-# $(1) is the stage
-# $(2) is the target triple
-# $(3) is the host triple
-# $(4) is the crate name
-define RUST_TARGET_STAGE_N
-
-$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER_HOST_TRIPLE = $(2)
-$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
-               $$(CRATEFILE_$(4)) \
-               $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
-               $$(LLVM_CONFIG_$(2)) \
-               $$(TSREQ$(1)_T_$(2)_H_$(3)) \
-               | $$(TLIB$(1)_T_$(2)_H_$(3))/
-       @$$(call E, rustc: $$(@D)/lib$(4))
-       @touch $$@.start_time
-       $$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
-           $$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4)))
-       $$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
-           $$(dir $$@)$$(call CFG_RLIB_GLOB,$(4)))
-       $(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
-           $$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) \
-               $$(RUST_LIB_FLAGS_ST$(1)) \
-               -L "$$(RT_OUTPUT_DIR_$(2))" \
-               $$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
-               $$(LLVM_STDCPP_RUSTFLAGS_$(2)) \
-               $$(RUSTFLAGS_$(4)) \
-               $$(RUSTFLAGS$(1)_$(4)) \
-               $$(RUSTFLAGS$(1)_$(4)_T_$(2)) \
-               --out-dir $$(@D) \
-               -C extra-filename=-$$(CFG_FILENAME_EXTRA) \
-               -C metadata=$$(CFG_FILENAME_EXTRA) \
-               $$<
-       @touch -r $$@.start_time $$@ && rm $$@.start_time
-       $$(call LIST_ALL_OLD_GLOB_MATCHES, \
-           $$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4)))
-       $$(call LIST_ALL_OLD_GLOB_MATCHES, \
-           $$(dir $$@)$$(call CFG_RLIB_GLOB,$(4)))
-
-endef
-
-# Macro for building any tool as part of the rust compilation process. Each
-# tool is defined in crates.mk with a list of library dependencies as well as
-# the source file for the tool. Building each tool will also be passed '--cfg
-# <tool>' for usage in driver.rs
-#
-# This build rule is similar to the one found above, just tweaked for
-# locations and things.
-#
-# $(1) - stage
-# $(2) - target triple
-# $(3) - host triple
-# $(4) - name of the tool being built
-define TARGET_TOOL
-
-$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
-               $$(TOOL_SOURCE_$(4)) \
-               $$(TOOL_INPUTS_$(4)) \
-               $$(foreach dep,$$(TOOL_DEPS_$(4)), \
-                   $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
-               $$(TSREQ$(1)_T_$(2)_H_$(3)) \
-               | $$(TBIN$(1)_T_$(2)_H_$(3))/
-       @$$(call E, rustc: $$@)
-       $$(STAGE$(1)_T_$(2)_H_$(3)) \
-               $$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
-               -o $$@ $$< --cfg $(4)
-
-endef
-
-# Macro for building runtime startup/shutdown object files;
-# these are Rust's equivalent of crti.o, crtn.o
-#
-# $(1) - stage
-# $(2) - target triple
-# $(3) - host triple
-# $(4) - object basename
-define TARGET_RUSTRT_STARTUP_OBJ
-
-$$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o: \
-               $(S)src/rtstartup/$(4).rs \
-               $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.core \
-               $$(HSREQ$(1)_T_$(2)_H_$(3)) \
-               | $$(TBIN$(1)_T_$(2)_H_$(3))/
-       @$$(call E, rustc: $$@)
-       $$(STAGE$(1)_T_$(2)_H_$(3)) --emit=obj -o $$@ $$<
-
-ifeq ($$(CFG_RUSTRT_HAS_STARTUP_OBJS_$(2)), 1)
-# Add dependencies on Rust startup objects to all crates that depend on core.
-# This ensures that they are built after core (since they depend on it),
-# but before everything else (since they are needed for linking dylib crates).
-$$(foreach crate, $$(TARGET_CRATES_$(2)), \
-       $$(if $$(findstring core,$$(DEPS_$$(crate))), \
-               $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate))) : $$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o
-endif
-
-endef
-
-# Every recipe in RUST_TARGET_STAGE_N outputs to $$(TLIB$(1)_T_$(2)_H_$(3),
-# a directory that can be cleaned out during the middle of a run of
-# the get-snapshot.py script.  Therefore, every recipe needs to have
-# an order-only dependency either on $(SNAPSHOT_RUSTC_POST_CLEANUP) or
-# on $$(TSREQ$(1)_T_$(2)_H_$(3)), to ensure that no products will be
-# put into the target area until after the get-snapshot.py script has
-# had its chance to clean it out; otherwise the other products will be
-# inadvertently included in the clean out.
-SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))
-
-define TARGET_HOST_RULES
-
-$$(TLIB$(1)_T_$(2)_H_$(3))/: $$(SNAPSHOT_RUSTC_POST_CLEANUP)
-       mkdir -p $$@
-
-$$(TBIN$(1)_T_$(2)_H_$(3))/: $$(SNAPSHOT_RUSTC_POST_CLEANUP)
-       mkdir -p $$@
-
-$$(TLIB$(1)_T_$(2)_H_$(3))/%: $$(RT_OUTPUT_DIR_$(2))/% \
-           $$(SNAPSHOT_RUSTC_POST_CLEANUP) \
-           | $$(TLIB$(1)_T_$(2)_H_$(3))/
-       @$$(call E, cp: $$@)
-       $$(Q)cp $$< $$@
-endef
-
-$(foreach source,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(eval $(call TARGET_HOST_RULES,0,$(target),$(source))) \
-  $(eval $(call TARGET_HOST_RULES,1,$(target),$(source))) \
-  $(eval $(call TARGET_HOST_RULES,2,$(target),$(source))) \
-  $(eval $(call TARGET_HOST_RULES,3,$(target),$(source)))))
-
-# In principle, each host can build each target for both libs and tools
-$(foreach crate,$(CRATES), \
- $(foreach source,$(CFG_HOST), \
-  $(foreach target,$(CFG_TARGET), \
-   $(eval $(call RUST_TARGET_STAGE_N,0,$(target),$(source),$(crate))) \
-   $(eval $(call RUST_TARGET_STAGE_N,1,$(target),$(source),$(crate))) \
-   $(eval $(call RUST_TARGET_STAGE_N,2,$(target),$(source),$(crate))) \
-   $(eval $(call RUST_TARGET_STAGE_N,3,$(target),$(source),$(crate))))))
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach tool,$(TOOLS), \
-    $(eval $(call TARGET_TOOL,$(stage),$(target),$(host),$(tool)))))))
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach obj,rsbegin rsend, \
-    $(eval $(call TARGET_RUSTRT_STARTUP_OBJ,$(stage),$(target),$(host),$(obj)))))))
diff --git a/mk/tests.mk b/mk/tests.mk
deleted file mode 100644 (file)
index 3317688..0000000
+++ /dev/null
@@ -1,1057 +0,0 @@
-# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-
-######################################################################
-# Test variables
-######################################################################
-
-# The names of crates that must be tested
-
-# libcore/libstd_unicode tests are in a separate crate
-DEPS_coretest :=
-$(eval $(call RUST_CRATE,coretest))
-
-DEPS_collectionstest :=
-$(eval $(call RUST_CRATE,collectionstest))
-
-TEST_TARGET_CRATES = $(filter-out core std_unicode alloc_system libc \
-                                 alloc_jemalloc panic_unwind \
-                                 panic_abort,$(TARGET_CRATES)) \
-                       collectionstest coretest
-TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \
-                log rand serialize syntax term test
-TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
-                               rustc_trans rustc_lint,\
-                     $(HOST_CRATES))
-TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
-
-######################################################################
-# Environment configuration
-######################################################################
-
-# The arguments to all test runners
-ifdef TESTNAME
-  TESTARGS += $(TESTNAME)
-endif
-
-ifdef CHECK_IGNORED
-  TESTARGS += --ignored
-endif
-
-# Arguments to the cfail/rfail/rpass tests
-ifdef CFG_VALGRIND
-  CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
-endif
-
-CTEST_TESTARGS := $(TESTARGS)
-
-# --bench is only relevant for crate tests, not for the compile tests
-ifdef PLEASE_BENCH
-  TESTARGS += --bench
-endif
-
-ifdef VERBOSE
-  CTEST_TESTARGS += --verbose
-endif
-
-# Setting locale ensures that gdb's output remains consistent.
-# This prevents tests from failing with some locales (fixes #17423).
-export LC_ALL=C
-
-TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
-TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok
-
-define DEF_TARGET_COMMANDS
-
-ifdef CFG_UNIXY_$(1)
-  CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \
-         $$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
-endif
-
-ifdef CFG_WINDOWSY_$(1)
-  CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \
-   $$(if $$(findstring stage0,$$(1)), \
-       stage0/$$(CFG_LIBDIR_RELATIVE), \
-      $$(if $$(findstring stage1,$$(1)), \
-           stage1/$$(CFG_LIBDIR_RELATIVE), \
-          $$(if $$(findstring stage2,$$(1)), \
-               stage2/$$(CFG_LIBDIR_RELATIVE), \
-               $$(if $$(findstring stage3,$$(1)), \
-                    stage3/$$(CFG_LIBDIR_RELATIVE), \
-               )))))/rustlib/$$(CFG_BUILD)/lib
-  CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \
-         $$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(4)),$$(1))
-endif
-
-# Run the compiletest runner itself under valgrind
-ifdef CTEST_VALGRIND
-CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
-      $$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(3),$$(4))
-else
-CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
-      $$(call CFG_RUN_$$(CFG_BUILD),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
-endif
-
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call DEF_TARGET_COMMANDS,$(target))))
-
-# Target platform specific variables for android
-define DEF_ADB_DEVICE_STATUS
-CFG_ADB_DEVICE_STATUS=$(1)
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(if $(findstring android, $(target)), \
-    $(if $(findstring adb,$(CFG_ADB)), \
-      $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \
-        $(info check: android device attached) \
-        $(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
-        $(info check: android device not attached) \
-        $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
-      ), \
-      $(info check: adb not found) \
-      $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
-    ), \
-  ) \
-)
-
-ifeq ($(CFG_ADB_DEVICE_STATUS),true)
-CFG_ADB_TEST_DIR=/data/tmp
-
-$(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
- $(shell $(CFG_ADB) remount 1>/dev/null) \
- $(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \
- $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \
- $(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
- $(foreach target,$(CFG_TARGET), \
-  $(if $(findstring android, $(target)), \
-   $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/$(target)) \
-   $(foreach crate,$(TARGET_CRATES_$(target)), \
-    $(shell $(CFG_ADB) push $(TLIB2_T_$(target)_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_$(target),$(crate)) \
-                    $(CFG_ADB_TEST_DIR)/$(target))), \
- )))
-else
-CFG_ADB_TEST_DIR=
-endif
-
-# $(1) - name of doc test
-# $(2) - file of the test
-define DOCTEST
-DOC_NAMES := $$(DOC_NAMES) $(1)
-DOCFILE_$(1) := $(2)
-endef
-
-$(foreach doc,$(DOCS), \
-  $(eval $(call DOCTEST,md-$(doc),$(S)src/doc/$(doc).md)))
-$(foreach file,$(wildcard $(S)src/doc/book/*.md), \
-  $(eval $(call DOCTEST,$(file:$(S)src/doc/book/%.md=book-%),$(file))))
-$(foreach file,$(wildcard $(S)src/doc/nomicon/*.md), \
-  $(eval $(call DOCTEST,$(file:$(S)src/doc/nomicon/%.md=nomicon-%),$(file))))
-######################################################################
-# Main test targets
-######################################################################
-
-# The main testing target. Tests lots of stuff.
-check: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2 tidy
-       $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-# As above but don't bother running tidy.
-check-notidy: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2
-       $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-# A slightly smaller set of tests for smoke testing.
-check-lite: check-sanitycheck cleantestlibs cleantmptestlogs \
-       $(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \
-       check-stage2-rpass check-stage2-rpass-valgrind \
-       check-stage2-rfail check-stage2-cfail check-stage2-pfail check-stage2-rmake
-       $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-# Only check the 'reference' tests: rpass/cfail/rfail/rmake.
-check-ref: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-rpass \
-       check-stage2-rpass-valgrind check-stage2-rfail check-stage2-cfail check-stage2-pfail \
-       check-stage2-rmake
-       $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-# Only check the docs.
-check-docs: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-docs
-       $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-# Some less critical tests that are not prone to breakage.
-# Not run as part of the normal test suite, but tested by bors on checkin.
-check-secondary: check-build-compiletest check-build-lexer-verifier check-lexer check-pretty
-
-.PHONY: check-sanitycheck
-
-check-sanitycheck:
-       $(Q)$(CFG_PYTHON) $(S)src/etc/check-sanitycheck.py
-
-# check + check-secondary.
-#
-# Issue #17883: build check-secondary first so hidden dependencies in
-# e.g. building compiletest are exercised (resolve those by adding
-# deps to rules that need them; not by putting `check` first here).
-check-all: check-secondary check
-
-# Pretty-printing tests.
-check-pretty: check-stage2-T-$(CFG_BUILD)-H-$(CFG_BUILD)-pretty-exec
-
-define DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE
-check-stage$(1)-build-compiletest:     $$(HBIN$(1)_H_$(CFG_BUILD))/compiletest$$(X_$(CFG_BUILD))
-endef
-
-$(foreach stage,$(STAGES), \
- $(eval $(call DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE,$(stage))))
-
-check-build-compiletest: \
-       check-stage1-build-compiletest \
-       check-stage2-build-compiletest
-
-.PHONY: cleantmptestlogs cleantestlibs
-
-cleantmptestlogs:
-       $(Q)rm -f tmp/*.log
-
-cleantestlibs:
-       $(Q)find $(CFG_BUILD)/test \
-         -name '*.[odasS]' -o \
-         -name '*.so' -o \
-         -name '*.dylib' -o \
-         -name '*.dll' -o \
-         -name '*.def' -o \
-         -name '*.bc' -o \
-         -name '*.dSYM' -o \
-         -name '*.libaux' -o \
-         -name '*.out' -o \
-         -name '*.err' -o \
-        -name '*.debugger.script' \
-         | xargs rm -rf
-
-
-######################################################################
-# Tidy
-######################################################################
-
-.PHONY: tidy
-tidy: $(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)) \
-               $(SNAPSHOT_RUSTC_POST_CLEANUP)
-       $(TARGET_RPATH_VAR0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $< $(S)src
-
-$(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)): \
-               $(TSREQ0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
-               $(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.std \
-               $(call rwildcard,$(S)src/tools/tidy/src,*.rs) \
-               $(SNAPSHOT_RUSTC_POST_CLEANUP) | \
-               $(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD))
-       $(STAGE0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(S)src/tools/tidy/src/main.rs \
-               --out-dir $(@D) --crate-name tidy
-
-######################################################################
-# Sets of tests
-######################################################################
-
-define DEF_TEST_SETS
-
-check-stage$(1)-T-$(2)-H-$(3)-exec: \
-       check-stage$(1)-T-$(2)-H-$(3)-rpass-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-pfail-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-rustdocck-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-incremental-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-ui-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-doc-error-index-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-pretty-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-mir-opt-exec
-
-ifndef CFG_DISABLE_CODEGEN_TESTS
-check-stage$(1)-T-$(2)-H-$(3)-exec: \
-       check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-codegen-units-exec
-endif
-
-# Only test the compiler-dependent crates when the target is
-# able to build a compiler (when the target triple is in the set of host triples)
-ifneq ($$(findstring $(2),$$(CFG_HOST)),)
-
-check-stage$(1)-T-$(2)-H-$(3)-exec: \
-       check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-rfail-full-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec
-
-check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
-       check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-full-exec
-
-check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
-       $$(foreach crate,$$(TEST_CRATES), \
-           check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
-
-else
-
-check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
-       $$(foreach crate,$$(TEST_TARGET_CRATES), \
-           check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
-
-endif
-
-check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec: \
-        $$(foreach crate,$$(TEST_DOC_CRATES), \
-           check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$$(crate)-exec)
-
-check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \
-        $$(foreach docname,$$(DOC_NAMES), \
-           check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec) \
-
-check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
-       check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-exec \
-    check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-valgrind-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \
-       check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-    $(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
-
-
-######################################################################
-# Crate testing
-######################################################################
-
-define TEST_RUNNER
-
-# If NO_REBUILD is set then break the dependencies on everything but
-# the source files so we can test crates without rebuilding any of the
-# parent crates.
-ifeq ($(NO_REBUILD),)
-TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
-                           $$(foreach crate,$$(TARGET_CRATES_$(2)), \
-                               $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
-                               $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
-
-else
-TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
-endif
-
-$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
-$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
-               $$(CRATEFILE_$(4)) \
-               $$(TESTDEP_$(1)_$(2)_$(3)_$(4))
-       @$$(call E, rustc: $$@)
-       $(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
-           $$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) -o $$@ $$< --test \
-               -Cmetadata="test-crate" -L "$$(RT_OUTPUT_DIR_$(2))" \
-               $$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
-               $$(RUSTFLAGS_$(4))
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(foreach target,$(CFG_TARGET), \
-  $(eval $(foreach stage,$(STAGES), \
-   $(eval $(foreach crate,$(TEST_CRATES), \
-    $(eval $(call TEST_RUNNER,$(stage),$(target),$(host),$(crate))))))))))
-
-define DEF_TEST_CRATE_RULES
-check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
-
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-               $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
-       @$$(call E, run: $$<)
-       $$(Q)touch $$@.start_time
-       $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(1),$(2),$(3)) $$(TESTARGS) \
-           --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
-           $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
-           && touch -r $$@.start_time $$@ && rm $$@.start_time
-endef
-
-define DEF_TEST_CRATE_RULES_android
-check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
-
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-               $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
-       @$$(call E, run: $$< via adb)
-       $$(Q)touch $$@.start_time
-       $$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
-       $$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=./$(2) \
-               ./$$(notdir $$<) \
-               --logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
-               $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \
-               > tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
-       $$(Q)cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
-       $$(Q)touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
-       $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
-       $$(Q)$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
-       @if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
-       then \
-               rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
-               touch -r $$@.start_time $$@ && rm $$@.start_time; \
-       else \
-               rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
-               exit 101; \
-       fi
-endef
-
-define DEF_TEST_CRATE_RULES_null
-check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
-
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-               $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
-       @$$(call E, failing: no device for $$< )
-       false
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach crate, $(TEST_CRATES), \
-    $(if $(findstring $(target),$(CFG_BUILD)), \
-     $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
-     $(if $(findstring android, $(target)), \
-      $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
-       $(eval $(call DEF_TEST_CRATE_RULES_android,$(stage),$(target),$(host),$(crate))), \
-       $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
-      ), \
-      $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
-     ))))))
-
-######################################################################
-# Rules for the compiletest tests (rpass, rfail, etc.)
-######################################################################
-
-RPASS_RS := $(call rwildcard,$(S)src/test/run-pass/,*.rs)
-RPASS_VALGRIND_RS := $(call rwildcard,$(S)src/test/run-pass-valgrind/,*.rs)
-RPASS_FULL_RS := $(call rwildcard,$(S)src/test/run-pass-fulldeps/,*.rs)
-RFAIL_FULL_RS := $(call rwildcard,$(S)src/test/run-fail-fulldeps/,*.rs)
-CFAIL_FULL_RS := $(call rwildcard,$(S)src/test/compile-fail-fulldeps/,*.rs)
-RFAIL_RS := $(call rwildcard,$(S)src/test/run-fail/,*.rs)
-RFAIL_RS := $(call rwildcard,$(S)src/test/run-fail/,*.rs)
-CFAIL_RS := $(call rwildcard,$(S)src/test/compile-fail/,*.rs)
-PFAIL_RS := $(call rwildcard,$(S)src/test/parse-fail/,*.rs)
-PRETTY_RS := $(call rwildcard,$(S)src/test/pretty/,*.rs)
-DEBUGINFO_GDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs)
-DEBUGINFO_LLDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs)
-CODEGEN_RS := $(call rwildcard,$(S)src/test/codegen/,*.rs)
-CODEGEN_CC := $(call rwildcard,$(S)src/test/codegen/,*.cc)
-CODEGEN_UNITS_RS := $(call rwildcard,$(S)src/test/codegen-units/,*.rs)
-INCREMENTAL_RS := $(call rwildcard,$(S)src/test/incremental/,*.rs)
-RMAKE_RS := $(wildcard $(S)src/test/run-make/*/Makefile)
-UI_RS := $(call rwildcard,$(S)src/test/ui/,*.rs) \
-         $(call rwildcard,$(S)src/test/ui/,*.stdout) \
-         $(call rwildcard,$(S)src/test/ui/,*.stderr)
-RUSTDOCCK_RS := $(call rwildcard,$(S)src/test/rustdoc/,*.rs)
-MIR_OPT_RS := $(call rwildcard,$(S)src/test/mir-opt/,*.rs)
-
-RPASS_TESTS := $(RPASS_RS)
-RPASS_VALGRIND_TESTS := $(RPASS_VALGRIND_RS)
-RPASS_FULL_TESTS := $(RPASS_FULL_RS)
-RFAIL_FULL_TESTS := $(RFAIL_FULL_RS)
-CFAIL_FULL_TESTS := $(CFAIL_FULL_RS)
-RFAIL_TESTS := $(RFAIL_RS)
-CFAIL_TESTS := $(CFAIL_RS)
-PFAIL_TESTS := $(PFAIL_RS)
-PRETTY_TESTS := $(PRETTY_RS)
-DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS)
-DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
-CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
-CODEGEN_UNITS_TESTS := $(CODEGEN_UNITS_RS)
-INCREMENTAL_TESTS := $(INCREMENTAL_RS)
-RMAKE_TESTS := $(RMAKE_RS)
-UI_TESTS := $(UI_RS)
-MIR_OPT_TESTS := $(MIR_OPT_RS)
-RUSTDOCCK_TESTS := $(RUSTDOCCK_RS)
-
-CTEST_SRC_BASE_rpass = run-pass
-CTEST_BUILD_BASE_rpass = run-pass
-CTEST_MODE_rpass = run-pass
-CTEST_RUNTOOL_rpass = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rpass-valgrind = run-pass-valgrind
-CTEST_BUILD_BASE_rpass-valgrind = run-pass-valgrind
-CTEST_MODE_rpass-valgrind = run-pass-valgrind
-CTEST_RUNTOOL_rpass-valgrind = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rpass-full = run-pass-fulldeps
-CTEST_BUILD_BASE_rpass-full = run-pass-fulldeps
-CTEST_MODE_rpass-full = run-pass
-CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rfail-full = run-fail-fulldeps
-CTEST_BUILD_BASE_rfail-full = run-fail-fulldeps
-CTEST_MODE_rfail-full = run-fail
-CTEST_RUNTOOL_rfail-full = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_cfail-full = compile-fail-fulldeps
-CTEST_BUILD_BASE_cfail-full = compile-fail-fulldeps
-CTEST_MODE_cfail-full = compile-fail
-CTEST_RUNTOOL_cfail-full = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rfail = run-fail
-CTEST_BUILD_BASE_rfail = run-fail
-CTEST_MODE_rfail = run-fail
-CTEST_RUNTOOL_rfail = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_cfail = compile-fail
-CTEST_BUILD_BASE_cfail = compile-fail
-CTEST_MODE_cfail = compile-fail
-CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_pfail = parse-fail
-CTEST_BUILD_BASE_pfail = parse-fail
-CTEST_MODE_pfail = parse-fail
-CTEST_RUNTOOL_pfail = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_debuginfo-gdb = debuginfo
-CTEST_BUILD_BASE_debuginfo-gdb = debuginfo-gdb
-CTEST_MODE_debuginfo-gdb = debuginfo-gdb
-CTEST_RUNTOOL_debuginfo-gdb = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_debuginfo-lldb = debuginfo
-CTEST_BUILD_BASE_debuginfo-lldb = debuginfo-lldb
-CTEST_MODE_debuginfo-lldb = debuginfo-lldb
-CTEST_RUNTOOL_debuginfo-lldb = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_codegen = codegen
-CTEST_BUILD_BASE_codegen = codegen
-CTEST_MODE_codegen = codegen
-CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_codegen-units = codegen-units
-CTEST_BUILD_BASE_codegen-units = codegen-units
-CTEST_MODE_codegen-units = codegen-units
-CTEST_RUNTOOL_codegen-units = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_incremental = incremental
-CTEST_BUILD_BASE_incremental = incremental
-CTEST_MODE_incremental = incremental
-CTEST_RUNTOOL_incremental = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rmake = run-make
-CTEST_BUILD_BASE_rmake = run-make
-CTEST_MODE_rmake = run-make
-CTEST_RUNTOOL_rmake = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_ui = ui
-CTEST_BUILD_BASE_ui = ui
-CTEST_MODE_ui = ui
-CTEST_RUNTOOL_ui = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_mir-opt = mir-opt
-CTEST_BUILD_BASE_mir-opt = mir-opt
-CTEST_MODE_mir-opt = mir-opt
-CTEST_RUNTOOL_mir-opt = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rustdocck = rustdoc
-CTEST_BUILD_BASE_rustdocck = rustdoc
-CTEST_MODE_rustdocck = rustdoc
-CTEST_RUNTOOL_rustdocck = $(CTEST_RUNTOOL)
-
-# CTEST_DISABLE_$(TEST_GROUP), if set, will cause the test group to be
-# disabled and the associated message to be printed as a warning
-# during attempts to run those tests.
-
-ifeq ($(CFG_GDB),)
-CTEST_DISABLE_debuginfo-gdb = "no gdb found"
-endif
-
-ifeq ($(CFG_LLDB),)
-CTEST_DISABLE_debuginfo-lldb = "no lldb found"
-endif
-
-ifneq ($(CFG_OSTYPE),apple-darwin)
-CTEST_DISABLE_debuginfo-lldb = "lldb tests are only run on darwin"
-endif
-
-ifeq ($(CFG_OSTYPE),apple-darwin)
-CTEST_DISABLE_debuginfo-gdb = "gdb on darwin needs root"
-endif
-
-ifeq ($(findstring android, $(CFG_TARGET)), android)
-CTEST_DISABLE_debuginfo-gdb =
-CTEST_DISABLE_debuginfo-lldb = "lldb tests are disabled on android"
-endif
-
-ifeq ($(findstring msvc,$(CFG_TARGET)),msvc)
-CTEST_DISABLE_debuginfo-gdb = "gdb tests are disabled on MSVC"
-endif
-
-# CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
-# test group to be disabled *unless* the target is able to build a
-# compiler (i.e. when the target triple is in the set of host
-# triples).  The associated message will be printed as a warning
-# during attempts to run those tests.
-
-define DEF_CTEST_VARS
-
-# All the per-stage build rules you might want to call from the
-# command line.
-#
-# $(1) is the stage number
-# $(2) is the target triple to test
-# $(3) is the host triple to test
-
-# Prerequisites for compiletest tests
-TEST_SREQ$(1)_T_$(2)_H_$(3) = \
-       $$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
-       $$(SREQ$(1)_T_$(2)_H_$(3))
-
-# Rules for the cfail/rfail/rpass test runner
-
-# The tests select when to use debug configuration on their own;
-# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
-CTEST_RUSTC_FLAGS := $$(subst -C debug-assertions,,$$(subst -C debug-assertions=on,,$$(CFG_RUSTC_FLAGS)))
-
-# The tests cannot be optimized while the rest of the compiler is optimized, so
-# filter out the optimization (if any) from rustc and then figure out if we need
-# to be optimized
-CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
-ifndef CFG_DISABLE_OPTIMIZE_TESTS
-CTEST_RUSTC_FLAGS += -O
-endif
-
-# Analogously to the above, whether to pass `-g` when compiling tests
-# is a separate choice from whether to pass `-g` when building the
-# compiler and standard library themselves.
-CTEST_RUSTC_FLAGS := $$(subst -g,,$$(CTEST_RUSTC_FLAGS))
-CTEST_RUSTC_FLAGS := $$(subst -Cdebuginfo=1,,$$(CTEST_RUSTC_FLAGS))
-ifdef CFG_ENABLE_DEBUGINFO_TESTS
-CTEST_RUSTC_FLAGS += -g
-endif
-
-CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) = \
-               --compile-lib-path $$(HLIB$(1)_H_$(3)) \
-        --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
-        --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
-        --rustdoc-path $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
-        --llvm-filecheck $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin/FileCheck \
-        --stage-id stage$(1)-$(2) \
-        --target $(2) \
-        --host $(3) \
-       --docck-python $$(CFG_PYTHON) \
-       --lldb-python $$(CFG_LLDB_PYTHON) \
-        --gdb="$(CFG_GDB)" \
-        --lldb-version="$(CFG_LLDB_VERSION)" \
-        --llvm-version="$$(LLVM_VERSION_$(3))" \
-        --android-cross-path=$(CFG_ARM_LINUX_ANDROIDEABI_NDK) \
-        --adb-path=$(CFG_ADB) \
-        --adb-test-dir=$(CFG_ADB_TEST_DIR) \
-        --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
-        --lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \
-        --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
-       --cc '$$(call FIND_COMPILER,$$(CC_$(2)))' \
-       --cxx '$$(call FIND_COMPILER,$$(CXX_$(2)))' \
-       --cflags "$$(CFG_GCCISH_CFLAGS_$(2))" \
-       --llvm-components "$$(LLVM_ALL_COMPONENTS_$(2))" \
-       --llvm-cxxflags "$$(LLVM_CXXFLAGS_$(2))" \
-        $$(CTEST_TESTARGS)
-
-ifdef CFG_VALGRIND_RPASS
-ifdef GOOD_VALGRIND_$(2)
-CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --valgrind-path "$(CFG_VALGRIND_RPASS)"
-endif
-endif
-
-ifndef CFG_DISABLE_VALGRIND_RPASS
-ifdef GOOD_VALGRIND_$(2)
-CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --force-valgrind
-endif
-endif
-
-CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
-CTEST_DEPS_rpass-valgrind_$(1)-T-$(2)-H-$(3) = $$(RPASS_VALGRIND_TESTS)
-CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
-CTEST_DEPS_rfail-full_$(1)-T-$(2)-H-$(3) = $$(RFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
-CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
-CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
-CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
-CTEST_DEPS_pfail_$(1)-T-$(2)-H-$(3) = $$(PFAIL_TESTS)
-CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS)
-CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \
-                                               $(S)src/etc/lldb_batchmode.py \
-                                               $(S)src/etc/lldb_rust_formatters.py
-CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
-CTEST_DEPS_codegen-units_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_UNITS_TESTS)
-CTEST_DEPS_incremental_$(1)-T-$(2)-H-$(3) = $$(INCREMENTAL_TESTS)
-CTEST_DEPS_rmake_$(1)-T-$(2)-H-$(3) = $$(RMAKE_TESTS) \
-       $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
-CTEST_DEPS_ui_$(1)-T-$(2)-H-$(3) = $$(UI_TESTS)
-CTEST_DEPS_mir-opt_$(1)-T-$(2)-H-$(3) = $$(MIR_OPT_TESTS)
-CTEST_DEPS_rustdocck_$(1)-T-$(2)-H-$(3) = $$(RUSTDOCCK_TESTS) \
-               $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
-               $$(CSREQ$(1)_T_$(3)_H_$(3)) \
-               $$(SREQ$(1)_T_$(3)_H_$(3)) \
-               $(S)src/etc/htmldocck.py
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(foreach target,$(CFG_TARGET), \
-  $(eval $(foreach stage,$(STAGES), \
-   $(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host))))))))
-
-define DEF_RUN_COMPILETEST
-
-CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) = \
-        $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
-        --src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
-        --build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
-        --mode $$(CTEST_MODE_$(4)) \
-       $$(CTEST_RUNTOOL_$(4))
-
-check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
-
-# CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)
-# Goal: leave this variable as empty string if we should run the test.
-# Otherwise, set it to the reason we are not running the test.
-# (Encoded as a separate variable because GNU make does not have a
-# good way to express OR on ifeq commands)
-
-ifneq ($$(CTEST_DISABLE_$(4)),)
-# Test suite is disabled for all configured targets.
-CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4))
-else
-# else, check if non-self-hosted target (i.e. target not-in hosts) ...
-ifeq ($$(findstring $(2),$$(CFG_HOST)),)
-# ... if so, then check if this test suite is disabled for non-selfhosts.
-ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4)),)
-# Test suite is disabled for this target.
-CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4))
-endif
-endif
-# Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test.
-endif
-
-ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),)
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-       export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(3)))
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-       export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3)))
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-               $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
-                $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
-       @$$(call E, run $(4) [$(2)]: $$<)
-       $$(Q)touch $$@.start_time
-       $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
-               $$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
-               --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
-                && touch -r $$@.start_time $$@ && rm $$@.start_time
-
-else
-
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)):
-       @$$(call E, run $(4) [$(2)]: $$<)
-       @$$(call E, warning: tests disabled: $$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)))
-       touch $$@
-
-endif
-
-endef
-
-CTEST_NAMES = rpass rpass-valgrind rpass-full rfail-full cfail-full rfail cfail pfail \
-       debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck incremental \
-       rmake ui mir-opt
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(foreach target,$(CFG_TARGET), \
-  $(eval $(foreach stage,$(STAGES), \
-   $(eval $(foreach name,$(CTEST_NAMES), \
-   $(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name))))))))))
-
-PRETTY_NAMES = pretty-rpass pretty-rpass-valgrind pretty-rpass-full pretty-rfail-full pretty-rfail \
-    pretty-pretty
-PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS)
-PRETTY_DEPS_pretty-rpass-valgrind = $(RPASS_VALGRIND_TESTS)
-PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS)
-PRETTY_DEPS_pretty-rfail-full = $(RFAIL_FULL_TESTS)
-PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS)
-PRETTY_DEPS_pretty-pretty = $(PRETTY_TESTS)
-PRETTY_DIRNAME_pretty-rpass = run-pass
-PRETTY_DIRNAME_pretty-rpass-valgrind = run-pass-valgrind
-PRETTY_DIRNAME_pretty-rpass-full = run-pass-fulldeps
-PRETTY_DIRNAME_pretty-rfail-full = run-fail-fulldeps
-PRETTY_DIRNAME_pretty-rfail = run-fail
-PRETTY_DIRNAME_pretty-pretty = pretty
-
-define DEF_PRETTY_FULLDEPS
-PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rpass-full = $$(CSREQ$(1)_T_$(3)_H_$(3))
-PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rfail-full = $$(CSREQ$(1)_T_$(3)_H_$(3))
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(eval $(call DEF_PRETTY_FULLDEPS,$(stage),$(target),$(host))))))
-
-define DEF_RUN_PRETTY_TEST
-
-PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) = \
-               $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
-        --src-base $$(S)src/test/$$(PRETTY_DIRNAME_$(4))/ \
-        --build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \
-        --mode pretty
-
-check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
-
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-               $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
-               $$(PRETTY_DEPS_$(4)) \
-               $$(PRETTY_DEPS$(1)_T_$(2)_H_$(3)_$(4))
-       @$$(call E, run pretty-rpass [$(2)]: $$<)
-       $$(Q)touch $$@.start_time
-       $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
-               $$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
-               --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
-                && touch -r $$@.start_time $$@ && rm $$@.start_time
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach pretty-name,$(PRETTY_NAMES), \
-    $(eval $(call DEF_RUN_PRETTY_TEST,$(stage),$(target),$(host),$(pretty-name)))))))
-
-
-######################################################################
-# Crate & freestanding documentation tests
-######################################################################
-
-define DEF_RUSTDOC
-RUSTDOC_EXE_$(1)_T_$(2)_H_$(3) := $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
-RUSTDOC_$(1)_T_$(2)_H_$(3) := $$(RPATH_VAR$(1)_T_$(2)_H_$(3)) $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(eval $(call DEF_RUSTDOC,$(stage),$(target),$(host))))))
-
-# Freestanding
-
-define DEF_DOC_TEST
-
-check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
-
-# If NO_REBUILD is set then break the dependencies on everything but
-# the source files so we can test documentation without rebuilding
-# rustdoc etc.
-ifeq ($(NO_REBUILD),)
-DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
-       $$(DOCFILE_$(4)) \
-       $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
-       $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
-else
-DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(DOCFILE_$(4))
-endif
-
-ifeq ($(2),$$(CFG_BUILD))
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
-       @$$(call E, run doc-$(4) [$(2)])
-       $$(Q)touch $$@.start_time
-       $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --cfg dox --test $$< \
-               --test-args "$$(TESTARGS)" && \
-               touch -r $$@.start_time $$@ && rm $$@.start_time
-else
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
-       touch $$@
-endif
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach docname,$(DOC_NAMES), \
-    $(eval $(call DEF_DOC_TEST,$(stage),$(target),$(host),$(docname)))))))
-
-# Crates
-
-define DEF_CRATE_DOC_TEST
-
-# If NO_REBUILD is set then break the dependencies on everything but
-# the source files so we can test crate documentation without
-# rebuilding any of the parent crates.
-ifeq ($(NO_REBUILD),)
-CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
-       $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
-       $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
-       $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
-else
-CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
-endif
-
-check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
-       $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
-
-ifeq ($(2),$$(CFG_BUILD))
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
-       @$$(call E, run doc-crate-$(4) [$(2)])
-       $$(Q)touch $$@.start_time
-       $$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
-           $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \
-               $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && \
-               touch -r $$@.start_time $$@ && rm $$@.start_time
-else
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):
-       touch $$@
-endif
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach crate,$(TEST_DOC_CRATES), \
-    $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate)))))))
-
-define DEF_DOC_TEST_ERROR_INDEX
-
-check-stage$(1)-T-$(2)-H-$(3)-doc-error-index-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index)
-
-ifeq ($(2),$$(CFG_BUILD))
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index): \
-               $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
-               doc/error-index.md
-       $$(Q)touch $$@.start_time
-       $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test doc/error-index.md
-       $$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-else
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index):
-       $$(Q)touch $$@
-endif
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(eval $(call DEF_DOC_TEST_ERROR_INDEX,$(stage),$(target),$(host))))))
-
-######################################################################
-# Shortcut rules
-######################################################################
-
-TEST_GROUPS = \
-       crates \
-       $(foreach crate,$(TEST_CRATES),$(crate)) \
-       $(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \
-       rpass \
-       rpass-valgrind \
-       rpass-full \
-       rfail-full \
-       cfail-full \
-       rfail \
-       cfail \
-       pfail \
-       rmake \
-       rustdocck \
-       debuginfo-gdb \
-       debuginfo-lldb \
-       codegen \
-       codegen-units \
-       incremental \
-       ui \
-       doc \
-       $(foreach docname,$(DOC_NAMES),doc-$(docname)) \
-       pretty \
-       pretty-rpass \
-       pretty-rpass-valgrind \
-       pretty-rpass-full \
-       pretty-rfail-full \
-       pretty-rfail \
-       pretty-pretty \
-       mir-opt \
-       $(NULL)
-
-define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST
-check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec
-endef
-
-$(foreach stage,$(STAGES), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach host,$(CFG_HOST), \
-   $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
-
-define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP
-check-stage$(1)-T-$(2)-H-$(3)-$(4): check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec
-endef
-
-$(foreach stage,$(STAGES), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach host,$(CFG_HOST), \
-   $(foreach group,$(TEST_GROUPS), \
-    $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group)))))))
-
-define DEF_CHECK_FOR_STAGE
-check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD)
-check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET), \
-                           check-stage$(1)-H-$$(target))
-endef
-
-$(foreach stage,$(STAGES), \
- $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
-
-define DEF_CHECK_FOR_STAGE_AND_GROUP
-check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD)-$(2)
-check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET), \
-                               check-stage$(1)-H-$$(target)-$(2))
-endef
-
-$(foreach stage,$(STAGES), \
- $(foreach group,$(TEST_GROUPS), \
-  $(eval $(call DEF_CHECK_FOR_STAGE_AND_GROUP,$(stage),$(group)))))
-
-
-define DEF_CHECK_FOR_STAGE_AND_HOSTS
-check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET), \
-                           check-stage$(1)-T-$$(target)-H-$(2))
-endef
-
-$(foreach stage,$(STAGES), \
- $(foreach host,$(CFG_HOST), \
-  $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host)))))
-
-define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP
-check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET), \
-                                check-stage$(1)-T-$$(target)-H-$(2)-$(3))
-endef
-
-$(foreach stage,$(STAGES), \
- $(foreach host,$(CFG_HOST), \
-  $(foreach group,$(TEST_GROUPS), \
-   $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group))))))
-
-define DEF_CHECK_DOC_FOR_STAGE
-check-stage$(1)-docs: $$(foreach docname,$$(DOC_NAMES), \
-                       check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-$$(docname)) \
-                     $$(foreach crate,$$(TEST_DOC_CRATES), \
-                       check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate)) \
-                     check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-error-index-exec
-endef
-
-$(foreach stage,$(STAGES), \
- $(eval $(call DEF_CHECK_DOC_FOR_STAGE,$(stage))))
-
-define DEF_CHECK_CRATE
-check-$(1): check-stage2-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-$(1)-exec
-endef
-
-$(foreach crate,$(TEST_CRATES), \
- $(eval $(call DEF_CHECK_CRATE,$(crate))))
diff --git a/mk/util.mk b/mk/util.mk
deleted file mode 100644 (file)
index 918484a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-ifdef VERBOSE
-  Q :=
-  E =
-else
-  Q := @
-  E = echo $(1)
-endif
-
-print-%:
-       @echo $*=$($*)
-
-S := $(CFG_SRC_DIR)
-SREL := $(CFG_SRC_DIR_RELATIVE)
index 93bbf0f227b1ba691d6500180fbdaa8e72151315..6d814619eb6083f096bebaa2d76600cec099179b 100644 (file)
@@ -61,6 +61,9 @@ dependencies = [
 [[package]]
 name = "build_helper"
 version = "0.1.0"
+dependencies = [
+ "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
+]
 
 [[package]]
 name = "cargotest"
@@ -96,6 +99,7 @@ name = "compiletest"
 version = "0.0.0"
 dependencies = [
  "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -221,6 +225,14 @@ dependencies = [
  "syntax_pos 0.0.0",
 ]
 
+[[package]]
+name = "qemu-test-client"
+version = "0.1.0"
+
+[[package]]
+name = "qemu-test-server"
+version = "0.1.0"
+
 [[package]]
 name = "rand"
 version = "0.0.0"
@@ -245,7 +257,6 @@ dependencies = [
  "rustc_const_math 0.0.0",
  "rustc_data_structures 0.0.0",
  "rustc_errors 0.0.0",
- "rustc_i128 0.0.0",
  "rustc_llvm 0.0.0",
  "serialize 0.0.0",
  "syntax 0.0.0",
@@ -305,7 +316,6 @@ dependencies = [
  "rustc_const_math 0.0.0",
  "rustc_data_structures 0.0.0",
  "rustc_errors 0.0.0",
- "rustc_i128 0.0.0",
  "syntax 0.0.0",
  "syntax_pos 0.0.0",
 ]
@@ -314,7 +324,6 @@ dependencies = [
 name = "rustc_const_math"
 version = "0.0.0"
 dependencies = [
- "rustc_i128 0.0.0",
  "serialize 0.0.0",
  "syntax 0.0.0",
 ]
@@ -324,7 +333,6 @@ name = "rustc_data_structures"
 version = "0.0.0"
 dependencies = [
  "log 0.0.0",
- "rustc_i128 0.0.0",
  "serialize 0.0.0",
 ]
 
@@ -364,13 +372,10 @@ dependencies = [
 name = "rustc_errors"
 version = "0.0.0"
 dependencies = [
+ "serialize 0.0.0",
  "syntax_pos 0.0.0",
 ]
 
-[[package]]
-name = "rustc_i128"
-version = "0.0.0"
-
 [[package]]
 name = "rustc_incremental"
 version = "0.0.0"
@@ -392,7 +397,6 @@ dependencies = [
  "rustc 0.0.0",
  "rustc_back 0.0.0",
  "rustc_const_eval 0.0.0",
- "rustc_i128 0.0.0",
  "syntax 0.0.0",
  "syntax_pos 0.0.0",
 ]
@@ -418,7 +422,6 @@ dependencies = [
  "rustc_const_math 0.0.0",
  "rustc_data_structures 0.0.0",
  "rustc_errors 0.0.0",
- "rustc_i128 0.0.0",
  "rustc_llvm 0.0.0",
  "serialize 0.0.0",
  "syntax 0.0.0",
@@ -437,7 +440,6 @@ dependencies = [
  "rustc_const_eval 0.0.0",
  "rustc_const_math 0.0.0",
  "rustc_data_structures 0.0.0",
- "rustc_i128 0.0.0",
  "syntax 0.0.0",
  "syntax_pos 0.0.0",
 ]
@@ -516,7 +518,6 @@ dependencies = [
  "rustc_const_math 0.0.0",
  "rustc_data_structures 0.0.0",
  "rustc_errors 0.0.0",
- "rustc_i128 0.0.0",
  "rustc_incremental 0.0.0",
  "rustc_llvm 0.0.0",
  "rustc_platform_intrinsics 0.0.0",
@@ -568,9 +569,6 @@ dependencies = [
 [[package]]
 name = "serialize"
 version = "0.0.0"
-dependencies = [
- "rustc_i128 0.0.0",
-]
 
 [[package]]
 name = "std"
@@ -594,7 +592,7 @@ dependencies = [
 
 [[package]]
 name = "std_shim"
-version = "0.1.0"
+version = "0.0.0"
 dependencies = [
  "core 0.0.0",
  "std 0.0.0",
@@ -615,7 +613,6 @@ dependencies = [
  "rustc_bitflags 0.0.0",
  "rustc_data_structures 0.0.0",
  "rustc_errors 0.0.0",
- "rustc_i128 0.0.0",
  "serialize 0.0.0",
  "syntax_pos 0.0.0",
 ]
@@ -653,7 +650,7 @@ dependencies = [
 
 [[package]]
 name = "test_shim"
-version = "0.1.0"
+version = "0.0.0"
 dependencies = [
  "test 0.0.0",
 ]
index 0db26ea5ae021ae7219884994b9dbc0a025c8853..d8dedd11f357d3ad9c164a6668399ded8c7a324a 100644 (file)
@@ -11,6 +11,8 @@ members = [
   "tools/rustbook",
   "tools/tidy",
   "tools/build-manifest",
+  "tools/qemu-test-client",
+  "tools/qemu-test-server",
 ]
 
 # Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit
index c47f4fd8ec64b8f288855ae6638e56a3142bd68b..5ca5ce1648f2fc80ee0735f723dc5523333a2e26 100644 (file)
@@ -11,8 +11,8 @@
 //! rustbuild, the Rust build system
 //!
 //! This is the entry point for the build system used to compile the `rustc`
-//! compiler. Lots of documentation can be found in the `README.md` file next to
-//! this file, and otherwise documentation can be found throughout the `build`
+//! compiler. Lots of documentation can be found in the `README.md` file in the
+//! parent directory, and otherwise documentation can be found throughout the `build`
 //! directory in each respective module.
 
 #![deny(warnings)]
index 85e8dbce1a955000d839be8289a27069d4180dbf..27255b691009395eea81d67a3b9b217abea7b20f 100644 (file)
@@ -379,6 +379,8 @@ class RustBuild(object):
             ostype += 'eabihf'
         elif cputype == 'aarch64':
             cputype = 'aarch64'
+        elif cputype == 'arm64':
+            cputype = 'aarch64'
         elif cputype == 'mips':
             if sys.byteorder == 'big':
                 cputype = 'mips'
@@ -438,14 +440,14 @@ def main():
     rb.use_vendored_sources = '\nvendor = true' in rb.config_toml or \
                               'CFG_ENABLE_VENDOR' in rb.config_mk
 
-    if 'SUDO_USER' in os.environ:
-        if os.environ['USER'] != os.environ['SUDO_USER']:
+    if 'SUDO_USER' in os.environ and not rb.use_vendored_sources:
+        if os.environ.get('USER') != os.environ['SUDO_USER']:
             rb.use_vendored_sources = True
             print('info: looks like you are running this command under `sudo`')
             print('      and so in order to preserve your $HOME this will now')
             print('      use vendored sources by default. Note that if this')
             print('      does not work you should run a normal build first')
-            print('      before running a command like `sudo make intall`')
+            print('      before running a command like `sudo make install`')
 
     if rb.use_vendored_sources:
         if not os.path.exists('.cargo'):
index 585d9f51b92a8e10673059830af8a211d9662381..81e745bc76c9e7a1cdcf19be62f849297822b049 100644 (file)
 //! `package_vers`, and otherwise indicating to the compiler what it should
 //! print out as part of its version information.
 
-use std::fs::File;
-use std::io::prelude::*;
 use std::process::Command;
 
 use build_helper::output;
 
 use Build;
 
-pub fn collect(build: &mut Build) {
-    // Currently the canonical source for the release number (e.g. 1.10.0) and
-    // the prerelease version (e.g. `.1`) is in `mk/main.mk`. We "parse" that
-    // here to learn about those numbers.
-    let mut main_mk = String::new();
-    t!(t!(File::open(build.src.join("mk/main.mk"))).read_to_string(&mut main_mk));
-    let mut release_num = "";
-    let mut prerelease_version = "";
-    for line in main_mk.lines() {
-        if line.starts_with("CFG_RELEASE_NUM") {
-            release_num = line.split('=').skip(1).next().unwrap().trim();
-        }
-        if line.starts_with("CFG_PRERELEASE_VERSION") {
-            prerelease_version = line.split('=').skip(1).next().unwrap().trim();
-        }
-    }
+// The version number
+const CFG_RELEASE_NUM: &'static str = "1.17.0";
+
+// An optional number to put after the label, e.g. '.2' -> '-beta.2'
+// Be sure to make this starts with a dot to conform to semver pre-release
+// versions (section 9)
+const CFG_PRERELEASE_VERSION: &'static str = ".1";
 
-    build.release_num = release_num.to_string();
-    build.prerelease_version = release_num.to_string();
+pub fn collect(build: &mut Build) {
+    build.release_num = CFG_RELEASE_NUM.to_string();
+    build.prerelease_version = CFG_RELEASE_NUM.to_string();
 
     // Depending on the channel, passed in `./configure --release-channel`,
     // determine various properties of the build.
     match &build.config.channel[..] {
         "stable" => {
-            build.release = release_num.to_string();
+            build.release = CFG_RELEASE_NUM.to_string();
             build.package_vers = build.release.clone();
             build.unstable_features = false;
         }
         "beta" => {
-            build.release = format!("{}-beta{}", release_num,
-                                   prerelease_version);
+            build.release = format!("{}-beta{}", CFG_RELEASE_NUM,
+                                   CFG_PRERELEASE_VERSION);
             build.package_vers = "beta".to_string();
             build.unstable_features = false;
         }
         "nightly" => {
-            build.release = format!("{}-nightly", release_num);
+            build.release = format!("{}-nightly", CFG_RELEASE_NUM);
             build.package_vers = "nightly".to_string();
             build.unstable_features = true;
         }
         _ => {
-            build.release = format!("{}-dev", release_num);
+            build.release = format!("{}-dev", CFG_RELEASE_NUM);
             build.package_vers = build.release.clone();
             build.unstable_features = true;
         }
index 4aca843558fd01275f7297c9f351b6bead67a895..0ebd10551329002068d6beb736140465b7c27337 100644 (file)
@@ -26,7 +26,7 @@
 
 use {Build, Compiler, Mode};
 use dist;
-use util::{self, dylib_path, dylib_path_var};
+use util::{self, dylib_path, dylib_path_var, exe};
 
 const ADB_TEST_DIR: &'static str = "/data/tmp";
 
@@ -221,6 +221,12 @@ pub fn compiletest(build: &Build,
            .arg("--llvm-cxxflags").arg("");
     }
 
+    if build.qemu_rootfs(target).is_some() {
+        cmd.arg("--qemu-test-client")
+           .arg(build.tool(&Compiler::new(0, &build.config.build),
+                           "qemu-test-client"));
+    }
+
     // Running a C compiler on MSVC requires a few env vars to be set, to be
     // sure to set them here.
     //
@@ -383,7 +389,7 @@ pub fn krate(build: &Build,
                 // helper crate, not tested. If it leaks through then it ends up
                 // messing with various mtime calculations and such.
                 if !name.contains("jemalloc") && name != "build_helper" {
-                    cargo.arg("-p").arg(name);
+                    cargo.arg("-p").arg(&format!("{}:0.0.0", name));
                 }
                 for dep in build.crates[name].deps.iter() {
                     if visited.insert(dep) {
@@ -403,9 +409,9 @@ pub fn krate(build: &Build,
     dylib_path.insert(0, build.sysroot_libdir(&compiler, target));
     cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
 
-    if target.contains("android") {
-        cargo.arg("--no-run");
-    } else if target.contains("emscripten") {
+    if target.contains("android") ||
+       target.contains("emscripten") ||
+       build.qemu_rootfs(target).is_some() {
         cargo.arg("--no-run");
     }
 
@@ -423,6 +429,9 @@ pub fn krate(build: &Build,
     } else if target.contains("emscripten") {
         build.run(&mut cargo);
         krate_emscripten(build, &compiler, target, mode);
+    } else if build.qemu_rootfs(target).is_some() {
+        build.run(&mut cargo);
+        krate_qemu(build, &compiler, target, mode);
     } else {
         cargo.args(&build.flags.cmd.test_args());
         build.run(&mut cargo);
@@ -480,23 +489,46 @@ fn krate_emscripten(build: &Build,
                     compiler: &Compiler,
                     target: &str,
                     mode: Mode) {
-     let mut tests = Vec::new();
-     let out_dir = build.cargo_out(compiler, mode, target);
-     find_tests(&out_dir, target, &mut tests);
-     find_tests(&out_dir.join("deps"), target, &mut tests);
-
-     for test in tests {
-         let test_file_name = test.to_string_lossy().into_owned();
-         println!("running {}", test_file_name);
-         let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured");
-         let mut cmd = Command::new(nodejs);
-         cmd.arg(&test_file_name);
-         if build.config.quiet_tests {
-             cmd.arg("--quiet");
-         }
-         build.run(&mut cmd);
-     }
- }
+    let mut tests = Vec::new();
+    let out_dir = build.cargo_out(compiler, mode, target);
+    find_tests(&out_dir, target, &mut tests);
+    find_tests(&out_dir.join("deps"), target, &mut tests);
+
+    for test in tests {
+        let test_file_name = test.to_string_lossy().into_owned();
+        println!("running {}", test_file_name);
+        let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured");
+        let mut cmd = Command::new(nodejs);
+        cmd.arg(&test_file_name);
+        if build.config.quiet_tests {
+            cmd.arg("--quiet");
+        }
+        build.run(&mut cmd);
+    }
+}
+
+fn krate_qemu(build: &Build,
+              compiler: &Compiler,
+              target: &str,
+              mode: Mode) {
+    let mut tests = Vec::new();
+    let out_dir = build.cargo_out(compiler, mode, target);
+    find_tests(&out_dir, target, &mut tests);
+    find_tests(&out_dir.join("deps"), target, &mut tests);
+
+    let tool = build.tool(&Compiler::new(0, &build.config.build),
+                          "qemu-test-client");
+    for test in tests {
+        let mut cmd = Command::new(&tool);
+        cmd.arg("run")
+           .arg(&test);
+        if build.config.quiet_tests {
+            cmd.arg("--quiet");
+        }
+        cmd.args(&build.flags.cmd.test_args());
+        build.run(&mut cmd);
+    }
+}
 
 
 fn find_tests(dir: &Path,
@@ -516,13 +548,15 @@ fn find_tests(dir: &Path,
     }
 }
 
-pub fn android_copy_libs(build: &Build,
-                         compiler: &Compiler,
-                         target: &str) {
-    if !target.contains("android") {
-        return
+pub fn emulator_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
+    if target.contains("android") {
+        android_copy_libs(build, compiler, target)
+    } else if let Some(s) = build.qemu_rootfs(target) {
+        qemu_copy_libs(build, compiler, target, s)
     }
+}
 
+fn android_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
     println!("Android copy libs to emulator ({})", target);
     build.run(Command::new("adb").arg("wait-for-device"));
     build.run(Command::new("adb").arg("remount"));
@@ -548,6 +582,39 @@ pub fn android_copy_libs(build: &Build,
     }
 }
 
+fn qemu_copy_libs(build: &Build,
+                  compiler: &Compiler,
+                  target: &str,
+                  rootfs: &Path) {
+    println!("QEMU copy libs to emulator ({})", target);
+    assert!(target.starts_with("arm"), "only works with arm for now");
+    t!(fs::create_dir_all(build.out.join("tmp")));
+
+    // Copy our freshly compiled test server over to the rootfs
+    let server = build.cargo_out(compiler, Mode::Tool, target)
+                      .join(exe("qemu-test-server", target));
+    t!(fs::copy(&server, rootfs.join("testd")));
+
+    // Spawn the emulator and wait for it to come online
+    let tool = build.tool(&Compiler::new(0, &build.config.build),
+                          "qemu-test-client");
+    build.run(Command::new(&tool)
+                      .arg("spawn-emulator")
+                      .arg(rootfs)
+                      .arg(build.out.join("tmp")));
+
+    // Push all our dylibs to the emulator
+    for f in t!(build.sysroot_libdir(compiler, target).read_dir()) {
+        let f = t!(f);
+        let name = f.file_name().into_string().unwrap();
+        if util::is_dylib(&name) {
+            build.run(Command::new(&tool)
+                              .arg("push")
+                              .arg(f.path()));
+        }
+    }
+}
+
 /// Run "distcheck", a 'make check' from a tarball
 pub fn distcheck(build: &Build) {
     if build.config.build != "x86_64-unknown-linux-gnu" {
index 7c35151a6d274ea236e4316dbf9424cb8715f387..81dd42a1e906a04f4578adf8ba8168ad0b691911 100644 (file)
 use std::path::{Path, PathBuf};
 use std::process::Command;
 
-use build_helper::output;
+use build_helper::{output, mtime};
 use filetime::FileTime;
 
-use util::{exe, libdir, mtime, is_dylib, copy};
+use util::{exe, libdir, is_dylib, copy};
 use {Build, Compiler, Mode};
 
 /// Build the standard library.
@@ -382,10 +382,10 @@ fn add_to_sysroot(out_dir: &Path, sysroot_dst: &Path) {
 ///
 /// This will build the specified tool with the specified `host` compiler in
 /// `stage` into the normal cargo output directory.
-pub fn tool(build: &Build, stage: u32, host: &str, tool: &str) {
-    println!("Building stage{} tool {} ({})", stage, tool, host);
+pub fn tool(build: &Build, stage: u32, target: &str, tool: &str) {
+    println!("Building stage{} tool {} ({})", stage, tool, target);
 
-    let compiler = Compiler::new(stage, host);
+    let compiler = Compiler::new(stage, &build.config.build);
 
     // FIXME: need to clear out previous tool and ideally deps, may require
     //        isolating output directories or require a pseudo shim step to
@@ -396,7 +396,7 @@ pub fn tool(build: &Build, stage: u32, host: &str, tool: &str) {
     // let out_dir = build.cargo_out(stage, &host, Mode::Librustc, target);
     // build.clear_if_dirty(&out_dir, &libstd_stamp(build, stage, &host, target));
 
-    let mut cargo = build.cargo(&compiler, Mode::Tool, host, "build");
+    let mut cargo = build.cargo(&compiler, Mode::Tool, target, "build");
     cargo.arg("--manifest-path")
          .arg(build.src.join(format!("src/tools/{}/Cargo.toml", tool)));
 
index 6e077691b3a058fe7c91c0162dd738cfd516676a..4e67a14345b9e3af4f995560effb187b04a5e11f 100644 (file)
@@ -114,6 +114,7 @@ pub struct Target {
     pub cxx: Option<PathBuf>,
     pub ndk: Option<PathBuf>,
     pub musl_root: Option<PathBuf>,
+    pub qemu_rootfs: Option<PathBuf>,
 }
 
 /// Structure of the `config.toml` file that configuration is read from.
@@ -222,6 +223,7 @@ struct TomlTarget {
     cxx: Option<String>,
     android_ndk: Option<String>,
     musl_root: Option<String>,
+    qemu_rootfs: Option<String>,
 }
 
 impl Config {
@@ -360,6 +362,7 @@ pub fn parse(build: &str, file: Option<PathBuf>) -> Config {
                 target.cxx = cfg.cxx.clone().map(PathBuf::from);
                 target.cc = cfg.cc.clone().map(PathBuf::from);
                 target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
+                target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
 
                 config.target_config.insert(triple.clone(), target);
             }
@@ -562,6 +565,12 @@ macro_rules! check {
                                                .map(|s| s.to_string())
                                                .collect();
                 }
+                "CFG_QEMU_ARMHF_ROOTFS" if value.len() > 0 => {
+                    let target = "arm-unknown-linux-gnueabihf".to_string();
+                    let target = self.target_config.entry(target)
+                                     .or_insert(Target::default());
+                    target.qemu_rootfs = Some(parse_configure_path(value));
+                }
                 _ => {}
             }
         }
index 5fac142f777ff2b71893a93e3b8f8ce7fad95b81..1c3901bf2a14349619d1fdc379fb57bfd7b33970 100644 (file)
@@ -381,12 +381,11 @@ pub fn rust_src(build: &Build) {
         "README.md",
         "RELEASES.md",
         "configure",
-        "Makefile.in"
+        "x.py",
     ];
     let src_dirs = [
         "man",
         "src",
-        "mk"
     ];
 
     let filter_fn = move |path: &Path| {
index d1c9918a73373f95a01dd5e631b9372510a3294b..3dc9b8375550c1b8021d4489183fea2109b8e9c6 100644 (file)
@@ -22,7 +22,8 @@
 use std::process::Command;
 
 use {Build, Compiler, Mode};
-use util::{up_to_date, cp_r};
+use util::cp_r;
+use build_helper::up_to_date;
 
 /// Invoke `rustbook` as compiled in `stage` for `target` for the doc book
 /// `name` into the `out` path.
index db2fe2db813a65e1d9c510db1b17edb7dfb2809a..e58dcc9fce92f5c2c6bb038c5f241d10d585460b 100644 (file)
@@ -66,6 +66,7 @@
 
 #![deny(warnings)]
 
+#[macro_use]
 extern crate build_helper;
 extern crate cmake;
 extern crate filetime;
 use std::path::{Component, PathBuf, Path};
 use std::process::Command;
 
-use build_helper::{run_silent, output};
+use build_helper::{run_silent, output, mtime};
 
-use util::{exe, mtime, libdir, add_lib_path};
-
-/// A helper macro to `unwrap` a result except also print out details like:
-///
-/// * The file/line of the panic
-/// * The expression that failed
-/// * The error itself
-///
-/// This is currently used judiciously throughout the build system rather than
-/// using a `Result` with `try!`, but this may change one day...
-macro_rules! t {
-    ($e:expr) => (match $e {
-        Ok(e) => e,
-        Err(e) => panic!("{} failed with {}", stringify!($e), e),
-    })
-}
+use util::{exe, libdir, add_lib_path};
 
 mod cc;
 mod channel;
@@ -482,7 +468,8 @@ fn cargo(&self,
         //
         // These variables are primarily all read by
         // src/bootstrap/bin/{rustc.rs,rustdoc.rs}
-        cargo.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
+        cargo.env("RUSTBUILD_NATIVE_DIR", self.native_dir(target))
+             .env("RUSTC", self.out.join("bootstrap/debug/rustc"))
              .env("RUSTC_REAL", self.compiler_path(compiler))
              .env("RUSTC_STAGE", stage.to_string())
              .env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
@@ -746,10 +733,15 @@ fn llvm_filecheck(&self, target: &str) -> PathBuf {
         }
     }
 
+    /// Directory for libraries built from C/C++ code and shared between stages.
+    fn native_dir(&self, target: &str) -> PathBuf {
+        self.out.join(target).join("native")
+    }
+
     /// Root output directory for rust_test_helpers library compiled for
     /// `target`
     fn test_helpers_out(&self, target: &str) -> PathBuf {
-        self.out.join(target).join("rust-test-helpers")
+        self.native_dir(target).join("rust-test-helpers")
     }
 
     /// Adds the compiler's directory of dynamic libraries to `cmd`'s dynamic
@@ -886,6 +878,17 @@ fn musl_root(&self, target: &str) -> Option<&Path> {
             .map(|p| &**p)
     }
 
+    /// Returns the root of the "rootfs" image that this target will be using,
+    /// if one was configured.
+    ///
+    /// If `Some` is returned then that means that tests for this target are
+    /// emulated with QEMU and binaries will need to be shipped to the emulator.
+    fn qemu_rootfs(&self, target: &str) -> Option<&Path> {
+        self.config.target_config.get(target)
+            .and_then(|t| t.qemu_rootfs.as_ref())
+            .map(|p| &**p)
+    }
+
     /// Path to the python interpreter to use
     fn python(&self) -> &Path {
         self.config.python.as_ref().unwrap()
index d6f6a7772c9d98fee667753b77a486d8a8473d78..536095503e0daed170d0d0e6dcf4fbdc50bcca56 100644 (file)
@@ -9,11 +9,12 @@
 # except according to those terms.
 
 include config.mk
-include $(CFG_SRC_DIR)mk/util.mk
 
 ifdef VERBOSE
+Q :=
 BOOTSTRAP_ARGS := -v
 else
+Q := @
 BOOTSTRAP_ARGS :=
 endif
 
index 4b6fef8edc17f9e4465bbc549cb4ccacfafc9037..21fc61cc81484da74ba0eafa9b76ed8ba2e14be8 100644 (file)
@@ -28,7 +28,8 @@
 use gcc;
 
 use Build;
-use util::{self, up_to_date};
+use util;
+use build_helper::up_to_date;
 
 /// Compile LLVM for `target`.
 pub fn llvm(build: &Build, target: &str) {
index 3932a7cf8c56376c32af9a2a6938abcf9a31cc75..ee5b61062fed86dc4fd32eeb998958ed7d2a74d8 100644 (file)
@@ -295,7 +295,7 @@ fn crate_rule<'a, 'b>(build: &'a Build,
                  .dep(|s| s.name("libtest"))
                  .dep(|s| s.name("tool-compiletest").target(s.host).stage(0))
                  .dep(|s| s.name("test-helpers"))
-                 .dep(|s| s.name("android-copy-libs"))
+                 .dep(|s| s.name("emulator-copy-libs"))
                  .default(mode != "pretty") // pretty tests don't run everywhere
                  .run(move |s| {
                      check::compiletest(build, &s.compiler(), s.target, mode, dir)
@@ -333,7 +333,7 @@ fn crate_rule<'a, 'b>(build: &'a Build,
              .dep(|s| s.name("tool-compiletest").target(s.host).stage(0))
              .dep(|s| s.name("test-helpers"))
              .dep(|s| s.name("debugger-scripts"))
-             .dep(|s| s.name("android-copy-libs"))
+             .dep(|s| s.name("emulator-copy-libs"))
              .run(move |s| check::compiletest(build, &s.compiler(), s.target,
                                          "debuginfo-gdb", "debuginfo"));
         let mut rule = rules.test("check-debuginfo", "src/test/debuginfo");
@@ -387,14 +387,14 @@ fn crate_rule<'a, 'b>(build: &'a Build,
     for (krate, path, _default) in krates("std_shim") {
         rules.test(&krate.test_step, path)
              .dep(|s| s.name("libtest"))
-             .dep(|s| s.name("android-copy-libs"))
+             .dep(|s| s.name("emulator-copy-libs"))
              .run(move |s| check::krate(build, &s.compiler(), s.target,
                                         Mode::Libstd, TestKind::Test,
                                         Some(&krate.name)));
     }
     rules.test("check-std-all", "path/to/nowhere")
          .dep(|s| s.name("libtest"))
-         .dep(|s| s.name("android-copy-libs"))
+         .dep(|s| s.name("emulator-copy-libs"))
          .default(true)
          .run(move |s| check::krate(build, &s.compiler(), s.target,
                                     Mode::Libstd, TestKind::Test, None));
@@ -403,14 +403,14 @@ fn crate_rule<'a, 'b>(build: &'a Build,
     for (krate, path, _default) in krates("std_shim") {
         rules.bench(&krate.bench_step, path)
              .dep(|s| s.name("libtest"))
-             .dep(|s| s.name("android-copy-libs"))
+             .dep(|s| s.name("emulator-copy-libs"))
              .run(move |s| check::krate(build, &s.compiler(), s.target,
                                         Mode::Libstd, TestKind::Bench,
                                         Some(&krate.name)));
     }
     rules.bench("bench-std-all", "path/to/nowhere")
          .dep(|s| s.name("libtest"))
-         .dep(|s| s.name("android-copy-libs"))
+         .dep(|s| s.name("emulator-copy-libs"))
          .default(true)
          .run(move |s| check::krate(build, &s.compiler(), s.target,
                                     Mode::Libstd, TestKind::Bench, None));
@@ -418,21 +418,21 @@ fn crate_rule<'a, 'b>(build: &'a Build,
     for (krate, path, _default) in krates("test_shim") {
         rules.test(&krate.test_step, path)
              .dep(|s| s.name("libtest"))
-             .dep(|s| s.name("android-copy-libs"))
+             .dep(|s| s.name("emulator-copy-libs"))
              .run(move |s| check::krate(build, &s.compiler(), s.target,
                                         Mode::Libtest, TestKind::Test,
                                         Some(&krate.name)));
     }
     rules.test("check-test-all", "path/to/nowhere")
          .dep(|s| s.name("libtest"))
-         .dep(|s| s.name("android-copy-libs"))
+         .dep(|s| s.name("emulator-copy-libs"))
          .default(true)
          .run(move |s| check::krate(build, &s.compiler(), s.target,
                                     Mode::Libtest, TestKind::Test, None));
     for (krate, path, _default) in krates("rustc-main") {
         rules.test(&krate.test_step, path)
              .dep(|s| s.name("librustc"))
-             .dep(|s| s.name("android-copy-libs"))
+             .dep(|s| s.name("emulator-copy-libs"))
              .host(true)
              .run(move |s| check::krate(build, &s.compiler(), s.target,
                                         Mode::Librustc, TestKind::Test,
@@ -440,7 +440,7 @@ fn crate_rule<'a, 'b>(build: &'a Build,
     }
     rules.test("check-rustc-all", "path/to/nowhere")
          .dep(|s| s.name("librustc"))
-         .dep(|s| s.name("android-copy-libs"))
+         .dep(|s| s.name("emulator-copy-libs"))
          .default(true)
          .host(true)
          .run(move |s| check::krate(build, &s.compiler(), s.target,
@@ -481,9 +481,34 @@ fn crate_rule<'a, 'b>(build: &'a Build,
 
     rules.build("test-helpers", "src/rt/rust_test_helpers.c")
          .run(move |s| native::test_helpers(build, s.target));
-    rules.test("android-copy-libs", "path/to/nowhere")
+
+    // Some test suites are run inside emulators, and most of our test binaries
+    // are linked dynamically which means we need to ship the standard library
+    // and such to the emulator ahead of time. This step represents this and is
+    // a dependency of all test suites.
+    //
+    // Most of the time this step is a noop (the `check::emulator_copy_libs`
+    // only does work if necessary). For some steps such as shipping data to
+    // QEMU we have to build our own tools so we've got conditional dependencies
+    // on those programs as well. Note that the QEMU client is built for the
+    // build target (us) and the server is built for the target.
+    rules.test("emulator-copy-libs", "path/to/nowhere")
          .dep(|s| s.name("libtest"))
-         .run(move |s| check::android_copy_libs(build, &s.compiler(), s.target));
+         .dep(move |s| {
+             if build.qemu_rootfs(s.target).is_some() {
+                s.name("tool-qemu-test-client").target(s.host).stage(0)
+             } else {
+                 Step::noop()
+             }
+         })
+         .dep(move |s| {
+             if build.qemu_rootfs(s.target).is_some() {
+                s.name("tool-qemu-test-server")
+             } else {
+                 Step::noop()
+             }
+         })
+         .run(move |s| check::emulator_copy_libs(build, &s.compiler(), s.target));
 
     rules.test("check-bootstrap", "src/bootstrap")
          .default(true)
@@ -516,6 +541,12 @@ fn crate_rule<'a, 'b>(build: &'a Build,
     rules.build("tool-build-manifest", "src/tools/build-manifest")
          .dep(|s| s.name("libstd"))
          .run(move |s| compile::tool(build, s.stage, s.target, "build-manifest"));
+    rules.build("tool-qemu-test-server", "src/tools/qemu-test-server")
+         .dep(|s| s.name("libstd"))
+         .run(move |s| compile::tool(build, s.stage, s.target, "qemu-test-server"));
+    rules.build("tool-qemu-test-client", "src/tools/qemu-test-client")
+         .dep(|s| s.name("libstd"))
+         .run(move |s| compile::tool(build, s.stage, s.target, "qemu-test-client"));
 
     // ========================================================================
     // Documentation targets
index 2ab3776ada0966061561d00ba983b30011863a08..520514f5fc95a77871ad6db413d9b30e5ad56fd8 100644 (file)
@@ -20,8 +20,6 @@
 use std::process::Command;
 use std::time::Instant;
 
-use filetime::FileTime;
-
 /// Returns the `name` as the filename of a static library for `target`.
 pub fn staticlib(name: &str, target: &str) -> String {
     if target.contains("windows") {
@@ -31,13 +29,6 @@ pub fn staticlib(name: &str, target: &str) -> String {
     }
 }
 
-/// Returns the last-modified time for `path`, or zero if it doesn't exist.
-pub fn mtime(path: &Path) -> FileTime {
-    fs::metadata(path).map(|f| {
-        FileTime::from_last_modification_time(&f)
-    }).unwrap_or(FileTime::zero())
-}
-
 /// Copies a file from `src` to `dst`, attempting to use hard links and then
 /// falling back to an actually filesystem copy if necessary.
 pub fn copy(src: &Path, dst: &Path) {
@@ -132,34 +123,6 @@ pub fn add_lib_path(path: Vec<PathBuf>, cmd: &mut Command) {
     cmd.env(dylib_path_var(), t!(env::join_paths(list)));
 }
 
-/// Returns whether `dst` is up to date given that the file or files in `src`
-/// are used to generate it.
-///
-/// Uses last-modified time checks to verify this.
-pub fn up_to_date(src: &Path, dst: &Path) -> bool {
-    let threshold = mtime(dst);
-    let meta = match fs::metadata(src) {
-        Ok(meta) => meta,
-        Err(e) => panic!("source {:?} failed to get metadata: {}", src, e),
-    };
-    if meta.is_dir() {
-        dir_up_to_date(src, &threshold)
-    } else {
-        FileTime::from_last_modification_time(&meta) <= threshold
-    }
-}
-
-fn dir_up_to_date(src: &Path, threshold: &FileTime) -> bool {
-    t!(fs::read_dir(src)).map(|e| t!(e)).all(|e| {
-        let meta = t!(e.metadata());
-        if meta.is_dir() {
-            dir_up_to_date(&e.path(), threshold)
-        } else {
-            FileTime::from_last_modification_time(&meta) < *threshold
-        }
-    })
-}
-
 /// Returns the environment variable which the dynamic library lookup path
 /// resides in for this platform.
 pub fn dylib_path_var() -> &'static str {
index 01d704f816bbc8fc00813d2636f3fe44a847db35..f8ade0616a577a44f7bb0c970d855a99f3b58937 100644 (file)
@@ -6,3 +6,6 @@ authors = ["The Rust Project Developers"]
 [lib]
 name = "build_helper"
 path = "lib.rs"
+
+[dependencies]
+filetime = "0.1"
index d0d588f46a7549a9402f404b395aebe0a2868dde..3dfd29380828669ec75eb22b563baf3b6c91f5e6 100644 (file)
 
 #![deny(warnings)]
 
+extern crate filetime;
+
+use std::fs;
 use std::process::{Command, Stdio};
 use std::path::{Path, PathBuf};
 
+use filetime::FileTime;
+
+/// A helper macro to `unwrap` a result except also print out details like:
+///
+/// * The file/line of the panic
+/// * The expression that failed
+/// * The error itself
+///
+/// This is currently used judiciously throughout the build system rather than
+/// using a `Result` with `try!`, but this may change one day...
+#[macro_export]
+macro_rules! t {
+    ($e:expr) => (match $e {
+        Ok(e) => e,
+        Err(e) => panic!("{} failed with {}", stringify!($e), e),
+    })
+}
+
 pub fn run(cmd: &mut Command) {
     println!("running: {:?}", cmd);
     run_silent(cmd);
@@ -88,6 +109,56 @@ pub fn output(cmd: &mut Command) -> String {
     String::from_utf8(output.stdout).unwrap()
 }
 
+pub fn rerun_if_changed_anything_in_dir(dir: &Path) {
+    let mut stack = dir.read_dir().unwrap()
+                       .map(|e| e.unwrap())
+                       .filter(|e| &*e.file_name() != ".git")
+                       .collect::<Vec<_>>();
+    while let Some(entry) = stack.pop() {
+        let path = entry.path();
+        if entry.file_type().unwrap().is_dir() {
+            stack.extend(path.read_dir().unwrap().map(|e| e.unwrap()));
+        } else {
+            println!("cargo:rerun-if-changed={}", path.display());
+        }
+    }
+}
+
+/// Returns the last-modified time for `path`, or zero if it doesn't exist.
+pub fn mtime(path: &Path) -> FileTime {
+    fs::metadata(path).map(|f| {
+        FileTime::from_last_modification_time(&f)
+    }).unwrap_or(FileTime::zero())
+}
+
+/// Returns whether `dst` is up to date given that the file or files in `src`
+/// are used to generate it.
+///
+/// Uses last-modified time checks to verify this.
+pub fn up_to_date(src: &Path, dst: &Path) -> bool {
+    let threshold = mtime(dst);
+    let meta = match fs::metadata(src) {
+        Ok(meta) => meta,
+        Err(e) => panic!("source {:?} failed to get metadata: {}", src, e),
+    };
+    if meta.is_dir() {
+        dir_up_to_date(src, &threshold)
+    } else {
+        FileTime::from_last_modification_time(&meta) <= threshold
+    }
+}
+
+fn dir_up_to_date(src: &Path, threshold: &FileTime) -> bool {
+    t!(fs::read_dir(src)).map(|e| t!(e)).all(|e| {
+        let meta = t!(e.metadata());
+        if meta.is_dir() {
+            dir_up_to_date(&e.path(), threshold)
+        } else {
+            FileTime::from_last_modification_time(&meta) < *threshold
+        }
+    })
+}
+
 fn fail(s: &str) -> ! {
     println!("\n\n{}\n\n", s);
     std::process::exit(1);
diff --git a/src/ci/docker/armhf-gnu/Dockerfile b/src/ci/docker/armhf-gnu/Dockerfile
new file mode 100644 (file)
index 0000000..e64f654
--- /dev/null
@@ -0,0 +1,90 @@
+FROM ubuntu:16.04
+
+RUN apt-get update -y && apt-get install -y --no-install-recommends \
+      bc \
+      bzip2 \
+      ca-certificates \
+      cmake \
+      cpio \
+      curl \
+      file \
+      g++ \
+      gcc-arm-linux-gnueabihf \
+      git \
+      libc6-dev \
+      libc6-dev-armhf-cross \
+      make \
+      python2.7 \
+      qemu-system-arm \
+      xz-utils
+
+ENV ARCH=arm \
+    CROSS_COMPILE=arm-linux-gnueabihf-
+
+WORKDIR /build
+
+# Compile the kernel that we're going to run and be emulating with. This is
+# basically just done to be compatible with the QEMU target that we're going
+# to be using when running tests. If any other kernel works or if any
+# other QEMU target works with some other stock kernel, we can use that too!
+#
+# The `vexpress_config` config file was a previously generated config file for
+# the kernel. This file was generated by running `make vexpress_defconfig`
+# followed by `make menuconfig` and then enabling the IPv6 protocol page.
+COPY vexpress_config /build/.config
+RUN curl https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.42.tar.xz | \
+      tar xJf - && \
+      cd /build/linux-4.4.42 && \
+      cp /build/.config . && \
+      make -j$(nproc) all && \
+      cp arch/arm/boot/zImage /tmp && \
+      cd /build &&  \
+      rm -rf linux-4.4.42
+
+# Compile an instance of busybox as this provides a lightweight system and init
+# binary which we will boot into. Only trick here is configuring busybox to
+# build static binaries.
+RUN curl https://www.busybox.net/downloads/busybox-1.21.1.tar.bz2 | tar xjf - && \
+      cd busybox-1.21.1 && \
+      make defconfig && \
+      sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \
+      make -j$(nproc) && \
+      make install && \
+      mv _install /tmp/rootfs && \
+      cd /build && \
+      rm -rf busybox-1.12.1
+
+# Download the ubuntu rootfs, which we'll use as a chroot for all our tests.
+WORKDIR /tmp
+RUN mkdir rootfs/ubuntu
+RUN curl http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04-core-armhf.tar.gz | \
+      tar xzf - -C rootfs/ubuntu && \
+      cd rootfs && mkdir proc sys dev etc etc/init.d
+
+# Copy over our init script, which starts up our test server and also a few
+# other misc tasks.
+COPY rcS rootfs/etc/init.d/rcS
+RUN chmod +x rootfs/etc/init.d/rcS
+
+# Helper to quickly fill the entropy pool in the kernel.
+COPY addentropy.c /tmp/
+RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static
+
+# TODO: What is this?!
+RUN curl -O http://ftp.nl.debian.org/debian/dists/jessie/main/installer-armhf/current/images/device-tree/vexpress-v2p-ca15-tc1.dtb
+
+ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783
+RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \
+      tar xJf - -C /usr/local/bin --strip-components=1
+
+RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
+    dpkg -i dumb-init_*.deb && \
+    rm dumb-init_*.deb
+ENTRYPOINT ["/usr/bin/dumb-init", "--"]
+
+ENV RUST_CONFIGURE_ARGS \
+      --target=arm-unknown-linux-gnueabihf \
+      --qemu-armhf-rootfs=/tmp/rootfs
+ENV SCRIPT python2.7 ../x.py test --target arm-unknown-linux-gnueabihf
+
+ENV NO_CHANGE_USER=1
diff --git a/src/ci/docker/armhf-gnu/addentropy.c b/src/ci/docker/armhf-gnu/addentropy.c
new file mode 100644 (file)
index 0000000..8975739
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#include <assert.h>
+#include <stdint.h>
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <linux/random.h>
+
+#define N 2048
+
+struct entropy {
+  int ent_count;
+  int size;
+  unsigned char data[N];
+};
+
+int main() {
+  struct entropy buf;
+  ssize_t n;
+
+  int random_fd = open("/dev/random", O_RDWR);
+  assert(random_fd >= 0);
+
+  while ((n = read(0, &buf.data, N)) > 0) {
+    buf.ent_count = n * 8;
+    buf.size = n;
+    if (ioctl(random_fd, RNDADDENTROPY, &buf) != 0) {
+      perror("failed to add entropy");
+    }
+  }
+
+  return 0;
+}
diff --git a/src/ci/docker/armhf-gnu/rcS b/src/ci/docker/armhf-gnu/rcS
new file mode 100644 (file)
index 0000000..3c29bed
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+mount -t proc none /proc
+mount -t sysfs none /sys
+/sbin/mdev -s
+
+# fill up our entropy pool, if we don't do this then anything with a hash map
+# will likely block forever as the kernel is pretty unlikely to have enough
+# entropy.
+/addentropy < /addentropy
+cat /dev/urandom | head -n 2048 | /addentropy
+
+# Set up IP that qemu expects. This confgures eth0 with the public IP that QEMU
+# will communicate to as well as the loopback 127.0.0.1 address.
+ifconfig eth0 10.0.2.15
+ifconfig lo up
+
+# Configure DNS resolution of 'localhost' to work
+echo 'hosts:      files dns' >> /ubuntu/etc/nsswitch.conf
+echo '127.0.0.1    localhost' >> /ubuntu/etc/hosts
+
+# prepare the chroot
+mount -t proc proc /ubuntu/proc/
+mount --rbind /sys /ubuntu/sys/
+mount --rbind /dev /ubuntu/dev/
+
+# Execute our `testd` inside the ubuntu chroot
+cp /testd /ubuntu/testd
+chroot /ubuntu /testd &
diff --git a/src/ci/docker/armhf-gnu/vexpress_config b/src/ci/docker/armhf-gnu/vexpress_config
new file mode 100644 (file)
index 0000000..35835cf
--- /dev/null
@@ -0,0 +1,2910 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux/arm 4.4.42 Kernel Configuration
+#
+CONFIG_ARM=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_MIGHT_HAVE_PCI=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_NO_IOPORT_MAP=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_FIX_EARLYCON_MEM=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_ARCH_SUPPORTS_UPROBES=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+CONFIG_GENERIC_BUG=y
+CONFIG_PGTABLE_LEVELS=2
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_IRQ_WORK=y
+CONFIG_BUILDTIME_EXTABLE_SORT=y
+
+#
+# General setup
+#
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
+# CONFIG_COMPILE_TEST is not set
+CONFIG_LOCALVERSION=""
+# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_XZ=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_HAVE_KERNEL_LZ4=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_XZ is not set
+# CONFIG_KERNEL_LZO is not set
+# CONFIG_KERNEL_LZ4 is not set
+CONFIG_DEFAULT_HOSTNAME="(none)"
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+CONFIG_CROSS_MEMORY_ATTACH=y
+# CONFIG_FHANDLE is not set
+CONFIG_USELIB=y
+# CONFIG_AUDIT is not set
+CONFIG_HAVE_ARCH_AUDITSYSCALL=y
+
+#
+# IRQ subsystem
+#
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_IRQ_DOMAIN=y
+CONFIG_IRQ_DOMAIN_HIERARCHY=y
+CONFIG_HANDLE_DOMAIN_IRQ=y
+# CONFIG_IRQ_DOMAIN_DEBUG is not set
+CONFIG_IRQ_FORCED_THREADING=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_ARCH_HAS_TICK_BROADCAST=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+
+#
+# Timers subsystem
+#
+CONFIG_HZ_PERIODIC=y
+# CONFIG_NO_HZ_IDLE is not set
+# CONFIG_NO_HZ_FULL is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+
+#
+# CPU/Task time and stats accounting
+#
+CONFIG_TICK_CPU_ACCOUNTING=y
+# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
+# CONFIG_IRQ_TIME_ACCOUNTING is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_RCU_EXPERT is not set
+CONFIG_SRCU=y
+# CONFIG_TASKS_RCU is not set
+CONFIG_RCU_STALL_COMMON=y
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_RCU_EXPEDITE_BOOT is not set
+CONFIG_BUILD_BIN2C=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
+CONFIG_GENERIC_SCHED_CLOCK=y
+CONFIG_CGROUPS=y
+# CONFIG_CGROUP_DEBUG is not set
+# CONFIG_CGROUP_FREEZER is not set
+# CONFIG_CGROUP_PIDS is not set
+# CONFIG_CGROUP_DEVICE is not set
+CONFIG_CPUSETS=y
+CONFIG_PROC_PID_CPUSET=y
+# CONFIG_CGROUP_CPUACCT is not set
+# CONFIG_MEMCG is not set
+# CONFIG_CGROUP_PERF is not set
+# CONFIG_CGROUP_SCHED is not set
+# CONFIG_BLK_CGROUP is not set
+# CONFIG_CHECKPOINT_RESTORE is not set
+CONFIG_NAMESPACES=y
+# CONFIG_UTS_NS is not set
+# CONFIG_IPC_NS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_NET_NS is not set
+# CONFIG_SCHED_AUTOGROUP is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+CONFIG_RD_BZIP2=y
+CONFIG_RD_LZMA=y
+CONFIG_RD_XZ=y
+CONFIG_RD_LZO=y
+CONFIG_RD_LZ4=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_HAVE_UID16=y
+CONFIG_BPF=y
+# CONFIG_EXPERT is not set
+CONFIG_UID16=y
+CONFIG_MULTIUSER=y
+# CONFIG_SGETMASK_SYSCALL is not set
+CONFIG_SYSFS_SYSCALL=y
+# CONFIG_SYSCTL_SYSCALL is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+# CONFIG_BPF_SYSCALL is not set
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+CONFIG_ADVISE_SYSCALLS=y
+# CONFIG_USERFAULTFD is not set
+CONFIG_MEMBARRIER=y
+# CONFIG_EMBEDDED is not set
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+CONFIG_SLUB_CPU_PARTIAL=y
+# CONFIG_SYSTEM_DATA_VERIFICATION is not set
+CONFIG_PROFILING=y
+CONFIG_OPROFILE=y
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+# CONFIG_JUMP_LABEL is not set
+# CONFIG_UPROBES is not set
+# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_ARCH_USE_BUILTIN_BSWAP=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_OPTPROBES=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_CONTIGUOUS=y
+CONFIG_GENERIC_SMP_IDLE_THREAD=y
+CONFIG_GENERIC_IDLE_POLL_SETUP=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_HW_BREAKPOINT=y
+CONFIG_HAVE_PERF_REGS=y
+CONFIG_HAVE_PERF_USER_STACK_DUMP=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
+CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
+CONFIG_HAVE_CC_STACKPROTECTOR=y
+# CONFIG_CC_STACKPROTECTOR is not set
+CONFIG_CC_STACKPROTECTOR_NONE=y
+# CONFIG_CC_STACKPROTECTOR_REGULAR is not set
+# CONFIG_CC_STACKPROTECTOR_STRONG is not set
+CONFIG_HAVE_CONTEXT_TRACKING=y
+CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
+CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
+CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
+CONFIG_MODULES_USE_ELF_REL=y
+CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_OLD_SIGSUSPEND3=y
+CONFIG_OLD_SIGACTION=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+# CONFIG_MODULE_SIG is not set
+# CONFIG_MODULE_COMPRESS is not set
+CONFIG_MODULES_TREE_LOOKUP=y
+CONFIG_BLOCK=y
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_BSGLIB is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+# CONFIG_BLK_CMDLINE_PARSER is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+CONFIG_EFI_PARTITION=y
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+CONFIG_INLINE_READ_UNLOCK=y
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+CONFIG_INLINE_WRITE_UNLOCK=y
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
+CONFIG_MUTEX_SPIN_ON_OWNER=y
+CONFIG_RWSEM_SPIN_ON_OWNER=y
+CONFIG_LOCK_SPIN_ON_OWNER=y
+CONFIG_FREEZER=y
+
+#
+# System Type
+#
+CONFIG_MMU=y
+CONFIG_ARCH_MULTIPLATFORM=y
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_GEMINI is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_DOVE is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_MMP is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_W90X900 is not set
+# CONFIG_ARCH_LPC32XX is not set
+# CONFIG_ARCH_PXA is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C24XX is not set
+# CONFIG_ARCH_S3C64XX is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP1 is not set
+
+#
+# Multiple platform selection
+#
+
+#
+# CPU Core family selection
+#
+# CONFIG_ARCH_MULTI_V6 is not set
+CONFIG_ARCH_MULTI_V7=y
+CONFIG_ARCH_MULTI_V6_V7=y
+# CONFIG_ARCH_MULTI_CPU_AUTO is not set
+# CONFIG_ARCH_VIRT is not set
+# CONFIG_ARCH_MVEBU is not set
+# CONFIG_ARCH_ALPINE is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_BCM is not set
+# CONFIG_ARCH_BERLIN is not set
+# CONFIG_ARCH_DIGICOLOR is not set
+# CONFIG_ARCH_HIGHBANK is not set
+# CONFIG_ARCH_HISI is not set
+# CONFIG_ARCH_KEYSTONE is not set
+# CONFIG_ARCH_MESON is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_MEDIATEK is not set
+
+#
+# TI OMAP/AM/DM/DRA Family
+#
+# CONFIG_ARCH_OMAP3 is not set
+# CONFIG_ARCH_OMAP4 is not set
+# CONFIG_SOC_OMAP5 is not set
+# CONFIG_SOC_AM33XX is not set
+# CONFIG_SOC_AM43XX is not set
+# CONFIG_SOC_DRA7XX is not set
+# CONFIG_ARCH_QCOM is not set
+# CONFIG_ARCH_ROCKCHIP is not set
+# CONFIG_ARCH_SOCFPGA is not set
+# CONFIG_PLAT_SPEAR is not set
+# CONFIG_ARCH_STI is not set
+# CONFIG_ARCH_S5PV210 is not set
+# CONFIG_ARCH_EXYNOS is not set
+# CONFIG_ARCH_SHMOBILE_MULTI is not set
+# CONFIG_ARCH_SUNXI is not set
+# CONFIG_ARCH_SIRF is not set
+# CONFIG_ARCH_TEGRA is not set
+# CONFIG_ARCH_UNIPHIER is not set
+# CONFIG_ARCH_U8500 is not set
+CONFIG_ARCH_VEXPRESS=y
+CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA=y
+CONFIG_ARCH_VEXPRESS_DCSCB=y
+CONFIG_ARCH_VEXPRESS_SPC=y
+CONFIG_ARCH_VEXPRESS_TC2_PM=y
+# CONFIG_ARCH_WM8850 is not set
+# CONFIG_ARCH_ZX is not set
+# CONFIG_ARCH_ZYNQ is not set
+CONFIG_PLAT_VERSATILE=y
+
+#
+# Processor Type
+#
+CONFIG_CPU_V7=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_HAS_ASID=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+# CONFIG_ARM_LPAE is not set
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARM_THUMB=y
+# CONFIG_ARM_THUMBEE is not set
+CONFIG_ARM_VIRT_EXT=y
+CONFIG_SWP_EMULATE=y
+# CONFIG_CPU_BIG_ENDIAN is not set
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+CONFIG_KUSER_HELPERS=y
+CONFIG_VDSO=y
+CONFIG_OUTER_CACHE=y
+CONFIG_OUTER_CACHE_SYNC=y
+CONFIG_MIGHT_HAVE_CACHE_L2X0=y
+CONFIG_CACHE_L2X0=y
+# CONFIG_PL310_ERRATA_588369 is not set
+# CONFIG_PL310_ERRATA_727915 is not set
+CONFIG_PL310_ERRATA_753970=y
+# CONFIG_PL310_ERRATA_769419 is not set
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_DMA_MEM_BUFFERABLE=y
+CONFIG_ARM_HEAVY_MB=y
+CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
+# CONFIG_ARM_KERNMEM_PERMS is not set
+CONFIG_MULTI_IRQ_HANDLER=y
+# CONFIG_ARM_ERRATA_430973 is not set
+CONFIG_ARM_ERRATA_643719=y
+CONFIG_ARM_ERRATA_720789=y
+# CONFIG_ARM_ERRATA_754322 is not set
+# CONFIG_ARM_ERRATA_754327 is not set
+# CONFIG_ARM_ERRATA_764369 is not set
+# CONFIG_ARM_ERRATA_775420 is not set
+# CONFIG_ARM_ERRATA_798181 is not set
+# CONFIG_ARM_ERRATA_773022 is not set
+CONFIG_ICST=y
+
+#
+# Bus support
+#
+# CONFIG_PCI is not set
+# CONFIG_PCI_DOMAINS_GENERIC is not set
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+CONFIG_HAVE_SMP=y
+CONFIG_SMP=y
+CONFIG_SMP_ON_UP=y
+CONFIG_ARM_CPU_TOPOLOGY=y
+# CONFIG_SCHED_MC is not set
+# CONFIG_SCHED_SMT is not set
+CONFIG_HAVE_ARM_SCU=y
+CONFIG_HAVE_ARM_ARCH_TIMER=y
+CONFIG_HAVE_ARM_TWD=y
+CONFIG_MCPM=y
+# CONFIG_BIG_LITTLE is not set
+# CONFIG_VMSPLIT_3G is not set
+# CONFIG_VMSPLIT_3G_OPT is not set
+CONFIG_VMSPLIT_2G=y
+# CONFIG_VMSPLIT_1G is not set
+CONFIG_PAGE_OFFSET=0x80000000
+CONFIG_NR_CPUS=8
+CONFIG_HOTPLUG_CPU=y
+CONFIG_ARM_PSCI=y
+CONFIG_ARCH_NR_GPIO=0
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_HZ_FIXED=0
+CONFIG_HZ_100=y
+# CONFIG_HZ_200 is not set
+# CONFIG_HZ_250 is not set
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_500 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=100
+# CONFIG_SCHED_HRTICK is not set
+# CONFIG_THUMB2_KERNEL is not set
+CONFIG_AEABI=y
+# CONFIG_OABI_COMPAT is not set
+# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
+# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
+CONFIG_HAVE_ARCH_PFN_VALID=y
+# CONFIG_HIGHMEM is not set
+CONFIG_CPU_SW_DOMAIN_PAN=y
+CONFIG_HW_PERF_EVENTS=y
+CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
+# CONFIG_ARM_MODULE_PLTS is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_NO_BOOTMEM=y
+CONFIG_MEMORY_ISOLATION=y
+# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
+CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_MEMORY_BALLOON=y
+CONFIG_BALLOON_COMPACTION=y
+CONFIG_COMPACTION=y
+CONFIG_MIGRATION=y
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+# CONFIG_CLEANCACHE is not set
+# CONFIG_FRONTSWAP is not set
+CONFIG_CMA=y
+# CONFIG_CMA_DEBUG is not set
+# CONFIG_CMA_DEBUGFS is not set
+CONFIG_CMA_AREAS=7
+# CONFIG_ZPOOL is not set
+# CONFIG_ZBUD is not set
+# CONFIG_ZSMALLOC is not set
+# CONFIG_IDLE_PAGE_TRACKING is not set
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_UACCESS_WITH_MEMCPY is not set
+# CONFIG_SECCOMP is not set
+CONFIG_SWIOTLB=y
+CONFIG_IOMMU_HELPER=y
+# CONFIG_XEN is not set
+
+#
+# Boot options
+#
+CONFIG_USE_OF=y
+CONFIG_ATAGS=y
+# CONFIG_DEPRECATED_PARAM_STRUCT is not set
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+# CONFIG_ARM_APPENDED_DTB is not set
+CONFIG_CMDLINE="console=ttyAMA0"
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
+# CONFIG_CMDLINE_EXTEND is not set
+# CONFIG_CMDLINE_FORCE is not set
+# CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
+CONFIG_AUTO_ZRELADDR=y
+
+#
+# CPU Power Management
+#
+
+#
+# CPU Frequency scaling
+#
+# CONFIG_CPU_FREQ is not set
+
+#
+# CPU Idle
+#
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+
+#
+# ARM CPU Idle Drivers
+#
+# CONFIG_ARM_CPUIDLE is not set
+# CONFIG_ARM_BIG_LITTLE_CPUIDLE is not set
+# CONFIG_ARM_HIGHBANK_CPUIDLE is not set
+# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+CONFIG_VFP=y
+CONFIG_VFPv3=y
+CONFIG_NEON=y
+# CONFIG_KERNEL_MODE_NEON is not set
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+CONFIG_BINFMT_SCRIPT=y
+# CONFIG_HAVE_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+CONFIG_COREDUMP=y
+
+#
+# Power management options
+#
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+# CONFIG_HIBERNATION is not set
+CONFIG_PM_SLEEP=y
+CONFIG_PM_SLEEP_SMP=y
+# CONFIG_PM_AUTOSLEEP is not set
+# CONFIG_PM_WAKELOCKS is not set
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_OPP=y
+CONFIG_PM_CLK=y
+# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
+CONFIG_CPU_PM=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_DIAG is not set
+CONFIG_UNIX=y
+# CONFIG_UNIX_DIAG is not set
+CONFIG_XFRM=y
+# CONFIG_XFRM_USER is not set
+# CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE_DEMUX is not set
+CONFIG_NET_IP_TUNNEL=m
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_NET_IPVTI is not set
+# CONFIG_NET_UDP_TUNNEL is not set
+# CONFIG_NET_FOU is not set
+# CONFIG_NET_FOU_IP_TUNNELS is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+CONFIG_INET_TUNNEL=m
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+CONFIG_INET_XFRM_MODE_BEET=y
+# CONFIG_INET_LRO is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_UDP_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+CONFIG_IPV6=y
+# CONFIG_IPV6_ROUTER_PREF is not set
+# CONFIG_IPV6_OPTIMISTIC_DAD is not set
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
+# CONFIG_INET6_IPCOMP is not set
+# CONFIG_IPV6_MIP6 is not set
+# CONFIG_IPV6_ILA is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+CONFIG_INET6_XFRM_MODE_TRANSPORT=m
+CONFIG_INET6_XFRM_MODE_TUNNEL=m
+CONFIG_INET6_XFRM_MODE_BEET=m
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+# CONFIG_IPV6_VTI is not set
+CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
+CONFIG_IPV6_NDISC_NODETYPE=y
+# CONFIG_IPV6_TUNNEL is not set
+# CONFIG_IPV6_GRE is not set
+# CONFIG_IPV6_MULTIPLE_TABLES is not set
+# CONFIG_IPV6_MROUTE is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NET_PTP_CLASSIFY is not set
+# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_L2TP is not set
+# CONFIG_BRIDGE is not set
+CONFIG_HAVE_NET_DSA=y
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_PHONET is not set
+# CONFIG_6LOWPAN is not set
+# CONFIG_IEEE802154 is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_OPENVSWITCH is not set
+# CONFIG_VSOCKETS is not set
+# CONFIG_NETLINK_MMAP is not set
+# CONFIG_NETLINK_DIAG is not set
+# CONFIG_MPLS is not set
+# CONFIG_HSR is not set
+# CONFIG_NET_SWITCHDEV is not set
+# CONFIG_NET_L3_MASTER_DEV is not set
+CONFIG_RPS=y
+CONFIG_RFS_ACCEL=y
+CONFIG_XPS=y
+# CONFIG_CGROUP_NET_PRIO is not set
+# CONFIG_CGROUP_NET_CLASSID is not set
+CONFIG_NET_RX_BUSY_POLL=y
+CONFIG_BQL=y
+# CONFIG_BPF_JIT is not set
+CONFIG_NET_FLOW_LIMIT=y
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_RFKILL_REGULATOR is not set
+CONFIG_NET_9P=y
+CONFIG_NET_9P_VIRTIO=y
+# CONFIG_NET_9P_DEBUG is not set
+# CONFIG_CAIF is not set
+# CONFIG_CEPH_LIB is not set
+# CONFIG_NFC is not set
+# CONFIG_LWTUNNEL is not set
+CONFIG_HAVE_BPF_JIT=y
+
+#
+# Device Drivers
+#
+CONFIG_ARM_AMBA=y
+# CONFIG_TEGRA_AHB is not set
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER=y
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_DEVTMPFS=y
+# CONFIG_DEVTMPFS_MOUNT is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set
+CONFIG_ALLOW_DEV_COREDUMP=y
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_REGMAP=y
+CONFIG_REGMAP_MMIO=y
+# CONFIG_DMA_SHARED_BUFFER is not set
+# CONFIG_DMA_CMA is not set
+
+#
+# Bus devices
+#
+CONFIG_ARM_CCI=y
+CONFIG_ARM_CCI400_COMMON=y
+# CONFIG_ARM_CCI400_PMU is not set
+CONFIG_ARM_CCI400_PORT_CTRL=y
+# CONFIG_ARM_CCI500_PMU is not set
+# CONFIG_ARM_CCN is not set
+# CONFIG_BRCMSTB_GISB_ARB is not set
+CONFIG_VEXPRESS_CONFIG=y
+# CONFIG_CONNECTOR is not set
+CONFIG_MTD=y
+# CONFIG_MTD_TESTS is not set
+# CONFIG_MTD_REDBOOT_PARTS is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+# CONFIG_MTD_AFS_PARTS is not set
+CONFIG_MTD_OF_PARTS=y
+# CONFIG_MTD_AR7_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+# CONFIG_SM_FTL is not set
+# CONFIG_MTD_OOPS is not set
+# CONFIG_MTD_SWAP is not set
+# CONFIG_MTD_PARTITIONED_MASTER is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+CONFIG_MTD_CFI_INTELEXT=y
+CONFIG_MTD_CFI_AMDSTD=y
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+CONFIG_MTD_RAM=y
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
+CONFIG_MTD_PHYSMAP_OF=y
+CONFIG_MTD_PLATRAM=y
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOCG3 is not set
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# LPDDR & LPDDR2 PCM memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+# CONFIG_MTD_LPDDR2_NVM is not set
+# CONFIG_MTD_SPI_NOR is not set
+CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_WL_THRESHOLD=4096
+CONFIG_MTD_UBI_BEB_LIMIT=20
+# CONFIG_MTD_UBI_FASTMAP is not set
+# CONFIG_MTD_UBI_GLUEBI is not set
+# CONFIG_MTD_UBI_BLOCK is not set
+CONFIG_DTC=y
+CONFIG_OF=y
+# CONFIG_OF_UNITTEST is not set
+CONFIG_OF_FLATTREE=y
+CONFIG_OF_EARLY_FLATTREE=y
+CONFIG_OF_ADDRESS=y
+CONFIG_OF_IRQ=y
+CONFIG_OF_NET=y
+CONFIG_OF_MDIO=y
+CONFIG_OF_MTD=y
+CONFIG_OF_RESERVED_MEM=y
+# CONFIG_OF_OVERLAY is not set
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_NULL_BLK is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+# CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_MG_DISK is not set
+CONFIG_VIRTIO_BLK=y
+# CONFIG_BLK_DEV_RBD is not set
+
+#
+# Misc devices
+#
+# CONFIG_SENSORS_LIS3LV02D is not set
+# CONFIG_AD525X_DPOT is not set
+# CONFIG_DUMMY_IRQ is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_APDS9802ALS is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_ISL29020 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_SENSORS_BH1780 is not set
+# CONFIG_SENSORS_BH1770 is not set
+# CONFIG_SENSORS_APDS990X is not set
+# CONFIG_HMC6352 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_ARM_CHARLCD is not set
+# CONFIG_BMP085_I2C is not set
+# CONFIG_USB_SWITCH_FSA9480 is not set
+# CONFIG_SRAM is not set
+CONFIG_VEXPRESS_SYSCFG=y
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+
+#
+# Texas Instruments shared transport line discipline
+#
+# CONFIG_TI_ST is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+
+#
+# Altera FPGA firmware download module
+#
+# CONFIG_ALTERA_STAPL is not set
+
+#
+# Intel MIC Bus Driver
+#
+
+#
+# SCIF Bus Driver
+#
+
+#
+# Intel MIC Host Driver
+#
+
+#
+# Intel MIC Card Driver
+#
+
+#
+# SCIF Driver
+#
+
+#
+# Intel MIC Coprocessor State Management (COSM) Drivers
+#
+# CONFIG_ECHO is not set
+# CONFIG_CXL_BASE is not set
+# CONFIG_CXL_KERNEL_API is not set
+# CONFIG_CXL_EEH is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI_MOD=y
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_SCSI_MQ_DEFAULT is not set
+# CONFIG_SCSI_PROC_FS is not set
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+# CONFIG_CHR_DEV_SG is not set
+# CONFIG_CHR_DEV_SCH is not set
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+# CONFIG_SCSI_SCAN_ASYNC is not set
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_ISCSI_BOOT_SYSFS is not set
+# CONFIG_SCSI_UFSHCD is not set
+# CONFIG_SCSI_DEBUG is not set
+CONFIG_SCSI_VIRTIO=y
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+CONFIG_HAVE_PATA_PLATFORM=y
+CONFIG_ATA=y
+# CONFIG_ATA_NONSTANDARD is not set
+CONFIG_ATA_VERBOSE_ERROR=y
+# CONFIG_SATA_PMP is not set
+
+#
+# Controllers with non-SFF native interface
+#
+# CONFIG_SATA_AHCI_PLATFORM is not set
+# CONFIG_AHCI_CEVA is not set
+# CONFIG_AHCI_QORIQ is not set
+CONFIG_ATA_SFF=y
+
+#
+# SFF controllers with custom DMA interface
+#
+CONFIG_ATA_BMDMA=y
+
+#
+# SATA SFF controllers with BMDMA
+#
+
+#
+# PATA SFF controllers with BMDMA
+#
+
+#
+# PIO-only SFF controllers
+#
+# CONFIG_PATA_PLATFORM is not set
+
+#
+# Generic fallback / legacy drivers
+#
+# CONFIG_MD is not set
+# CONFIG_TARGET_CORE is not set
+CONFIG_NETDEVICES=y
+CONFIG_MII=y
+CONFIG_NET_CORE=y
+# CONFIG_BONDING is not set
+# CONFIG_DUMMY is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_NET_TEAM is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_IPVLAN is not set
+# CONFIG_VXLAN is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_TUN is not set
+# CONFIG_TUN_VNET_CROSS_LE is not set
+# CONFIG_VETH is not set
+CONFIG_VIRTIO_NET=y
+# CONFIG_NLMON is not set
+
+#
+# CAIF transport drivers
+#
+
+#
+# Distributed Switch Architecture drivers
+#
+# CONFIG_NET_DSA_MV88E6XXX is not set
+# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set
+CONFIG_ETHERNET=y
+# CONFIG_ALTERA_TSE is not set
+CONFIG_NET_VENDOR_ARC=y
+# CONFIG_ARC_EMAC is not set
+# CONFIG_EMAC_ROCKCHIP is not set
+# CONFIG_NET_VENDOR_AURORA is not set
+CONFIG_NET_CADENCE=y
+# CONFIG_MACB is not set
+CONFIG_NET_VENDOR_BROADCOM=y
+# CONFIG_B44 is not set
+# CONFIG_BCMGENET is not set
+# CONFIG_SYSTEMPORT is not set
+CONFIG_NET_VENDOR_CIRRUS=y
+# CONFIG_CS89x0 is not set
+# CONFIG_DM9000 is not set
+# CONFIG_DNET is not set
+CONFIG_NET_VENDOR_EZCHIP=y
+# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set
+CONFIG_NET_VENDOR_FARADAY=y
+# CONFIG_FTMAC100 is not set
+# CONFIG_FTGMAC100 is not set
+CONFIG_NET_VENDOR_HISILICON=y
+# CONFIG_HIX5HD2_GMAC is not set
+# CONFIG_HIP04_ETH is not set
+# CONFIG_HNS is not set
+# CONFIG_HNS_DSAF is not set
+# CONFIG_HNS_ENET is not set
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_NET_VENDOR_I825XX=y
+CONFIG_NET_VENDOR_MARVELL=y
+# CONFIG_MVMDIO is not set
+CONFIG_NET_VENDOR_MICREL=y
+# CONFIG_KS8851_MLL is not set
+CONFIG_NET_VENDOR_NATSEMI=y
+CONFIG_NET_VENDOR_8390=y
+# CONFIG_AX88796 is not set
+# CONFIG_ETHOC is not set
+CONFIG_NET_VENDOR_QUALCOMM=y
+CONFIG_NET_VENDOR_RENESAS=y
+CONFIG_NET_VENDOR_ROCKER=y
+CONFIG_NET_VENDOR_SAMSUNG=y
+# CONFIG_SXGBE_ETH is not set
+CONFIG_NET_VENDOR_SEEQ=y
+CONFIG_NET_VENDOR_SMSC=y
+CONFIG_SMC91X=y
+# CONFIG_SMC911X is not set
+CONFIG_SMSC911X=y
+# CONFIG_SMSC911X_ARCH_HOOKS is not set
+CONFIG_NET_VENDOR_STMICRO=y
+# CONFIG_STMMAC_ETH is not set
+CONFIG_NET_VENDOR_SYNOPSYS=y
+# CONFIG_SYNOPSYS_DWC_ETH_QOS is not set
+CONFIG_NET_VENDOR_VIA=y
+# CONFIG_VIA_RHINE is not set
+# CONFIG_VIA_VELOCITY is not set
+CONFIG_NET_VENDOR_WIZNET=y
+# CONFIG_WIZNET_W5100 is not set
+# CONFIG_WIZNET_W5300 is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_AQUANTIA_PHY is not set
+# CONFIG_AT803X_PHY is not set
+# CONFIG_AMD_PHY is not set
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_TERANETICS_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_BCM7XXX_PHY is not set
+# CONFIG_BCM87XX_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_MICREL_PHY is not set
+# CONFIG_DP83848_PHY is not set
+# CONFIG_DP83867_PHY is not set
+# CONFIG_MICROCHIP_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+# CONFIG_MDIO_BUS_MUX_GPIO is not set
+# CONFIG_MDIO_BUS_MUX_MMIOREG is not set
+# CONFIG_MDIO_BCM_UNIMAC is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+CONFIG_USB_NET_DRIVERS=y
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_RTL8152 is not set
+# CONFIG_USB_LAN78XX is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_USB_IPHETH is not set
+# CONFIG_WLAN is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_ISDN is not set
+# CONFIG_NVM is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+CONFIG_INPUT_LEDS=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
+# CONFIG_INPUT_MATRIXKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+# CONFIG_KEYBOARD_ADP5589 is not set
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_QT1070 is not set
+# CONFIG_KEYBOARD_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_GPIO is not set
+# CONFIG_KEYBOARD_GPIO_POLLED is not set
+# CONFIG_KEYBOARD_TCA6416 is not set
+# CONFIG_KEYBOARD_TCA8418 is not set
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_LM8323 is not set
+# CONFIG_KEYBOARD_LM8333 is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_MCS is not set
+# CONFIG_KEYBOARD_MPR121 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+# CONFIG_KEYBOARD_SAMSUNG is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_OMAP4 is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_CAP11XX is not set
+# CONFIG_KEYBOARD_BCM is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_CYPRESS=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+CONFIG_MOUSE_PS2_FOCALTECH=y
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_APPLETOUCH is not set
+# CONFIG_MOUSE_BCM5974 is not set
+# CONFIG_MOUSE_CYAPA is not set
+# CONFIG_MOUSE_ELAN_I2C is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_GPIO is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
+# CONFIG_MOUSE_SYNAPTICS_USB is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+# CONFIG_SERIO_SERPORT is not set
+CONFIG_SERIO_AMBAKMI=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_SERIO_PS2MULT is not set
+# CONFIG_SERIO_ARC_PS2 is not set
+# CONFIG_SERIO_APBPS2 is not set
+# CONFIG_USERIO is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_TTY=y
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_VT_CONSOLE_SLEEP=y
+CONFIG_HW_CONSOLE=y
+CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=16
+# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
+# CONFIG_TRACE_SINK is not set
+CONFIG_DEVMEM=y
+CONFIG_DEVKMEM=y
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_EARLYCON=y
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_AMBA_PL010 is not set
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set
+# CONFIG_SERIAL_UARTLITE is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+# CONFIG_SERIAL_SCCNXP is not set
+# CONFIG_SERIAL_SC16IS7XX is not set
+# CONFIG_SERIAL_BCM63XX is not set
+# CONFIG_SERIAL_ALTERA_JTAGUART is not set
+# CONFIG_SERIAL_ALTERA_UART is not set
+# CONFIG_SERIAL_XILINX_PS_UART is not set
+# CONFIG_SERIAL_ARC is not set
+# CONFIG_SERIAL_FSL_LPUART is not set
+# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set
+# CONFIG_SERIAL_ST_ASC is not set
+# CONFIG_SERIAL_STM32 is not set
+CONFIG_HVC_DRIVER=y
+# CONFIG_HVC_DCC is not set
+CONFIG_VIRTIO_CONSOLE=y
+# CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_HW_RANDOM_TIMERIOMEM is not set
+CONFIG_HW_RANDOM_VIRTIO=y
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_XILLYBUS is not set
+
+#
+# I2C support
+#
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+# CONFIG_I2C_CHARDEV is not set
+# CONFIG_I2C_MUX is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_CBUS_GPIO is not set
+# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
+# CONFIG_I2C_EMEV2 is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_NOMADIK is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_PXA_PCI is not set
+# CONFIG_I2C_RK3X is not set
+# CONFIG_I2C_SIMTEC is not set
+CONFIG_I2C_VERSATILE=y
+# CONFIG_I2C_XILINX is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_DIOLAN_U2C is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_ROBOTFUZZ_OSIF is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_SLAVE is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_SPI is not set
+# CONFIG_SPMI is not set
+# CONFIG_HSI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+
+#
+# PPS generators support
+#
+
+#
+# PTP clock support
+#
+# CONFIG_PTP_1588_CLOCK is not set
+
+#
+# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks.
+#
+CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_DEVRES=y
+CONFIG_OF_GPIO=y
+# CONFIG_DEBUG_GPIO is not set
+# CONFIG_GPIO_SYSFS is not set
+CONFIG_GPIO_GENERIC=y
+
+#
+# Memory mapped GPIO drivers
+#
+# CONFIG_GPIO_74XX_MMIO is not set
+# CONFIG_GPIO_ALTERA is not set
+# CONFIG_GPIO_DWAPB is not set
+# CONFIG_GPIO_EM is not set
+CONFIG_GPIO_GENERIC_PLATFORM=y
+# CONFIG_GPIO_GRGPIO is not set
+# CONFIG_GPIO_PL061 is not set
+# CONFIG_GPIO_SYSCON is not set
+# CONFIG_GPIO_XILINX is not set
+# CONFIG_GPIO_ZEVIO is not set
+# CONFIG_GPIO_ZX is not set
+
+#
+# I2C GPIO expanders
+#
+# CONFIG_GPIO_ADP5588 is not set
+# CONFIG_GPIO_ADNP is not set
+# CONFIG_GPIO_MAX7300 is not set
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCA953X is not set
+# CONFIG_GPIO_PCF857X is not set
+# CONFIG_GPIO_SX150X is not set
+
+#
+# MFD GPIO expanders
+#
+
+#
+# SPI or I2C GPIO expanders
+#
+# CONFIG_GPIO_MCP23S08 is not set
+
+#
+# USB GPIO expanders
+#
+# CONFIG_W1 is not set
+CONFIG_POWER_SUPPLY=y
+# CONFIG_POWER_SUPPLY_DEBUG is not set
+# CONFIG_PDA_POWER is not set
+# CONFIG_TEST_POWER is not set
+# CONFIG_BATTERY_DS2780 is not set
+# CONFIG_BATTERY_DS2781 is not set
+# CONFIG_BATTERY_DS2782 is not set
+# CONFIG_BATTERY_SBS is not set
+# CONFIG_BATTERY_BQ27XXX is not set
+# CONFIG_BATTERY_MAX17040 is not set
+# CONFIG_BATTERY_MAX17042 is not set
+# CONFIG_CHARGER_MAX8903 is not set
+# CONFIG_CHARGER_LP8727 is not set
+# CONFIG_CHARGER_GPIO is not set
+# CONFIG_CHARGER_MANAGER is not set
+# CONFIG_CHARGER_BQ2415X is not set
+# CONFIG_CHARGER_BQ24190 is not set
+# CONFIG_CHARGER_BQ24735 is not set
+# CONFIG_CHARGER_BQ25890 is not set
+# CONFIG_CHARGER_SMB347 is not set
+# CONFIG_BATTERY_GAUGE_LTC2941 is not set
+# CONFIG_CHARGER_RT9455 is not set
+CONFIG_POWER_RESET=y
+# CONFIG_POWER_RESET_BRCMSTB is not set
+# CONFIG_POWER_RESET_GPIO is not set
+# CONFIG_POWER_RESET_GPIO_RESTART is not set
+# CONFIG_POWER_RESET_LTC2952 is not set
+# CONFIG_POWER_RESET_RESTART is not set
+# CONFIG_POWER_RESET_VERSATILE is not set
+CONFIG_POWER_RESET_VEXPRESS=y
+# CONFIG_POWER_RESET_SYSCON is not set
+# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set
+# CONFIG_POWER_AVS is not set
+CONFIG_HWMON=y
+# CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
+# CONFIG_SENSORS_AD7414 is not set
+# CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7410 is not set
+# CONFIG_SENSORS_ADT7411 is not set
+# CONFIG_SENSORS_ADT7462 is not set
+# CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7475 is not set
+# CONFIG_SENSORS_ASC7621 is not set
+# CONFIG_SENSORS_ATXP1 is not set
+# CONFIG_SENSORS_DS620 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_F75375S is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_GL520SM is not set
+# CONFIG_SENSORS_G760A is not set
+# CONFIG_SENSORS_G762 is not set
+# CONFIG_SENSORS_GPIO_FAN is not set
+# CONFIG_SENSORS_HIH6130 is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_JC42 is not set
+# CONFIG_SENSORS_POWR1220 is not set
+# CONFIG_SENSORS_LINEAGE is not set
+# CONFIG_SENSORS_LTC2945 is not set
+# CONFIG_SENSORS_LTC4151 is not set
+# CONFIG_SENSORS_LTC4215 is not set
+# CONFIG_SENSORS_LTC4222 is not set
+# CONFIG_SENSORS_LTC4245 is not set
+# CONFIG_SENSORS_LTC4260 is not set
+# CONFIG_SENSORS_LTC4261 is not set
+# CONFIG_SENSORS_MAX16065 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX1668 is not set
+# CONFIG_SENSORS_MAX197 is not set
+# CONFIG_SENSORS_MAX6639 is not set
+# CONFIG_SENSORS_MAX6642 is not set
+# CONFIG_SENSORS_MAX6650 is not set
+# CONFIG_SENSORS_MAX6697 is not set
+# CONFIG_SENSORS_MAX31790 is not set
+# CONFIG_SENSORS_HTU21 is not set
+# CONFIG_SENSORS_MCP3021 is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_LM92 is not set
+# CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_LM95234 is not set
+# CONFIG_SENSORS_LM95241 is not set
+# CONFIG_SENSORS_LM95245 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_NTC_THERMISTOR is not set
+# CONFIG_SENSORS_NCT6683 is not set
+# CONFIG_SENSORS_NCT6775 is not set
+# CONFIG_SENSORS_NCT7802 is not set
+# CONFIG_SENSORS_NCT7904 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_PMBUS is not set
+# CONFIG_SENSORS_SHT15 is not set
+# CONFIG_SENSORS_SHT21 is not set
+# CONFIG_SENSORS_SHTC1 is not set
+# CONFIG_SENSORS_DME1737 is not set
+# CONFIG_SENSORS_EMC1403 is not set
+# CONFIG_SENSORS_EMC2103 is not set
+# CONFIG_SENSORS_EMC6W201 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47M192 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_SCH56XX_COMMON is not set
+# CONFIG_SENSORS_SMM665 is not set
+# CONFIG_SENSORS_ADC128D818 is not set
+# CONFIG_SENSORS_ADS1015 is not set
+# CONFIG_SENSORS_ADS7828 is not set
+# CONFIG_SENSORS_AMC6821 is not set
+# CONFIG_SENSORS_INA209 is not set
+# CONFIG_SENSORS_INA2XX is not set
+# CONFIG_SENSORS_TC74 is not set
+# CONFIG_SENSORS_THMC50 is not set
+# CONFIG_SENSORS_TMP102 is not set
+# CONFIG_SENSORS_TMP103 is not set
+# CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
+CONFIG_SENSORS_VEXPRESS=y
+# CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83791D is not set
+# CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
+# CONFIG_SENSORS_W83795 is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
+# CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+CONFIG_BCMA_POSSIBLE=y
+
+#
+# Broadcom specific AMBA
+#
+# CONFIG_BCMA is not set
+
+#
+# Multifunction device drivers
+#
+CONFIG_MFD_CORE=y
+# CONFIG_MFD_AS3711 is not set
+# CONFIG_MFD_AS3722 is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_AAT2870_CORE is not set
+# CONFIG_MFD_ATMEL_FLEXCOM is not set
+# CONFIG_MFD_ATMEL_HLCDC is not set
+# CONFIG_MFD_BCM590XX is not set
+# CONFIG_MFD_AXP20X is not set
+# CONFIG_MFD_CROS_EC is not set
+# CONFIG_MFD_ASIC3 is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_DA9052_I2C is not set
+# CONFIG_MFD_DA9055 is not set
+# CONFIG_MFD_DA9062 is not set
+# CONFIG_MFD_DA9063 is not set
+# CONFIG_MFD_DA9150 is not set
+# CONFIG_MFD_DLN2 is not set
+# CONFIG_MFD_MC13XXX_I2C is not set
+# CONFIG_MFD_HI6421_PMIC is not set
+# CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_HTC_I2CPLD is not set
+# CONFIG_INTEL_SOC_PMIC is not set
+# CONFIG_MFD_KEMPLD is not set
+# CONFIG_MFD_88PM800 is not set
+# CONFIG_MFD_88PM805 is not set
+# CONFIG_MFD_88PM860X is not set
+# CONFIG_MFD_MAX14577 is not set
+# CONFIG_MFD_MAX77686 is not set
+# CONFIG_MFD_MAX77693 is not set
+# CONFIG_MFD_MAX77843 is not set
+# CONFIG_MFD_MAX8907 is not set
+# CONFIG_MFD_MAX8925 is not set
+# CONFIG_MFD_MAX8997 is not set
+# CONFIG_MFD_MAX8998 is not set
+# CONFIG_MFD_MT6397 is not set
+# CONFIG_MFD_MENF21BMC is not set
+# CONFIG_MFD_VIPERBOARD is not set
+# CONFIG_MFD_RETU is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_UCB1400_CORE is not set
+# CONFIG_MFD_PM8921_CORE is not set
+# CONFIG_MFD_RT5033 is not set
+# CONFIG_MFD_RTSX_USB is not set
+# CONFIG_MFD_RC5T583 is not set
+# CONFIG_MFD_RK808 is not set
+# CONFIG_MFD_RN5T618 is not set
+# CONFIG_MFD_SEC_CORE is not set
+# CONFIG_MFD_SI476X_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_SKY81452 is not set
+# CONFIG_MFD_SMSC is not set
+# CONFIG_ABX500_CORE is not set
+# CONFIG_MFD_STMPE is not set
+CONFIG_MFD_SYSCON=y
+# CONFIG_MFD_TI_AM335X_TSCADC is not set
+# CONFIG_MFD_LP3943 is not set
+# CONFIG_MFD_LP8788 is not set
+# CONFIG_MFD_PALMAS is not set
+# CONFIG_TPS6105X is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_TPS6507X is not set
+# CONFIG_MFD_TPS65090 is not set
+# CONFIG_MFD_TPS65217 is not set
+# CONFIG_MFD_TPS65218 is not set
+# CONFIG_MFD_TPS6586X is not set
+# CONFIG_MFD_TPS65910 is not set
+# CONFIG_MFD_TPS65912 is not set
+# CONFIG_MFD_TPS65912_I2C is not set
+# CONFIG_MFD_TPS80031 is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_TWL6040_CORE is not set
+# CONFIG_MFD_WL1273_CORE is not set
+# CONFIG_MFD_LM3533 is not set
+# CONFIG_MFD_TC3589X is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_T7L66XB is not set
+# CONFIG_MFD_TC6387XB is not set
+# CONFIG_MFD_TC6393XB is not set
+# CONFIG_MFD_ARIZONA_I2C is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X_I2C is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_WM8994 is not set
+CONFIG_MFD_VEXPRESS_SYSREG=y
+CONFIG_REGULATOR=y
+# CONFIG_REGULATOR_DEBUG is not set
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
+# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
+# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
+# CONFIG_REGULATOR_ACT8865 is not set
+# CONFIG_REGULATOR_AD5398 is not set
+# CONFIG_REGULATOR_ANATOP is not set
+# CONFIG_REGULATOR_DA9210 is not set
+# CONFIG_REGULATOR_DA9211 is not set
+# CONFIG_REGULATOR_FAN53555 is not set
+# CONFIG_REGULATOR_GPIO is not set
+# CONFIG_REGULATOR_ISL9305 is not set
+# CONFIG_REGULATOR_ISL6271A is not set
+# CONFIG_REGULATOR_LP3971 is not set
+# CONFIG_REGULATOR_LP3972 is not set
+# CONFIG_REGULATOR_LP872X is not set
+# CONFIG_REGULATOR_LP8755 is not set
+# CONFIG_REGULATOR_LTC3589 is not set
+# CONFIG_REGULATOR_MAX1586 is not set
+# CONFIG_REGULATOR_MAX8649 is not set
+# CONFIG_REGULATOR_MAX8660 is not set
+# CONFIG_REGULATOR_MAX8952 is not set
+# CONFIG_REGULATOR_MAX8973 is not set
+# CONFIG_REGULATOR_MT6311 is not set
+# CONFIG_REGULATOR_PFUZE100 is not set
+# CONFIG_REGULATOR_TPS51632 is not set
+# CONFIG_REGULATOR_TPS62360 is not set
+# CONFIG_REGULATOR_TPS65023 is not set
+# CONFIG_REGULATOR_TPS6507X is not set
+CONFIG_REGULATOR_VEXPRESS=y
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+# CONFIG_DRM is not set
+
+#
+# Frame buffer Devices
+#
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+CONFIG_FB_CMDLINE=y
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+CONFIG_FB_MODE_HELPERS=y
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+CONFIG_FB_ARMCLCD=y
+CONFIG_PLAT_VERSATILE_CLCD=y
+# CONFIG_FB_OPENCORES is not set
+# CONFIG_FB_S1D13XXX is not set
+# CONFIG_FB_SMSCUFX is not set
+# CONFIG_FB_UDL is not set
+# CONFIG_FB_IBM_GXT4500 is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_BROADSHEET is not set
+# CONFIG_FB_AUO_K190X is not set
+# CONFIG_FB_SIMPLE is not set
+# CONFIG_FB_SSD1307 is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+# CONFIG_VGASTATE is not set
+CONFIG_VIDEOMODE_HELPERS=y
+
+#
+# Console display driver support
+#
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+# CONFIG_LOGO_LINUX_VGA16 is not set
+CONFIG_LOGO_LINUX_CLUT224=y
+CONFIG_SOUND=y
+CONFIG_SOUND_OSS_CORE=y
+CONFIG_SOUND_OSS_CORE_PRECLAIM=y
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+# CONFIG_SND_SEQUENCER is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=y
+CONFIG_SND_PCM_OSS=y
+CONFIG_SND_PCM_OSS_PLUGINS=y
+CONFIG_SND_PCM_TIMER=y
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_PROC_FS=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+CONFIG_SND_VMASTER=y
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_AC97_CODEC=y
+# CONFIG_SND_DRIVERS is not set
+
+#
+# HD-Audio
+#
+CONFIG_SND_HDA_PREALLOC_SIZE=64
+CONFIG_SND_ARM=y
+CONFIG_SND_ARMAACI=y
+CONFIG_SND_USB=y
+# CONFIG_SND_USB_AUDIO is not set
+# CONFIG_SND_USB_UA101 is not set
+# CONFIG_SND_USB_CAIAQ is not set
+# CONFIG_SND_USB_6FIRE is not set
+# CONFIG_SND_USB_HIFACE is not set
+# CONFIG_SND_BCD2000 is not set
+# CONFIG_SND_USB_POD is not set
+# CONFIG_SND_USB_PODHD is not set
+# CONFIG_SND_USB_TONEPORT is not set
+# CONFIG_SND_USB_VARIAX is not set
+# CONFIG_SND_SOC is not set
+# CONFIG_SOUND_PRIME is not set
+CONFIG_AC97_BUS=y
+
+#
+# HID support
+#
+CONFIG_HID=y
+# CONFIG_HID_BATTERY_STRENGTH is not set
+# CONFIG_HIDRAW is not set
+# CONFIG_UHID is not set
+CONFIG_HID_GENERIC=y
+
+#
+# Special HID drivers
+#
+CONFIG_HID_A4TECH=y
+# CONFIG_HID_ACRUX is not set
+CONFIG_HID_APPLE=y
+# CONFIG_HID_APPLEIR is not set
+# CONFIG_HID_AUREAL is not set
+CONFIG_HID_BELKIN=y
+# CONFIG_HID_BETOP_FF is not set
+CONFIG_HID_CHERRY=y
+CONFIG_HID_CHICONY=y
+# CONFIG_HID_CORSAIR is not set
+# CONFIG_HID_PRODIKEYS is not set
+# CONFIG_HID_CP2112 is not set
+CONFIG_HID_CYPRESS=y
+CONFIG_HID_DRAGONRISE=y
+# CONFIG_DRAGONRISE_FF is not set
+# CONFIG_HID_EMS_FF is not set
+# CONFIG_HID_ELECOM is not set
+# CONFIG_HID_ELO is not set
+CONFIG_HID_EZKEY=y
+# CONFIG_HID_GEMBIRD is not set
+# CONFIG_HID_GFRM is not set
+# CONFIG_HID_HOLTEK is not set
+# CONFIG_HID_GT683R is not set
+# CONFIG_HID_KEYTOUCH is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_UCLOGIC is not set
+# CONFIG_HID_WALTOP is not set
+CONFIG_HID_GYRATION=y
+# CONFIG_HID_ICADE is not set
+CONFIG_HID_TWINHAN=y
+CONFIG_HID_KENSINGTON=y
+# CONFIG_HID_LCPOWER is not set
+# CONFIG_HID_LENOVO is not set
+CONFIG_HID_LOGITECH=y
+# CONFIG_HID_LOGITECH_HIDPP is not set
+# CONFIG_LOGITECH_FF is not set
+# CONFIG_LOGIRUMBLEPAD2_FF is not set
+# CONFIG_LOGIG940_FF is not set
+# CONFIG_LOGIWHEELS_FF is not set
+# CONFIG_HID_MAGICMOUSE is not set
+CONFIG_HID_MICROSOFT=y
+CONFIG_HID_MONTEREY=y
+# CONFIG_HID_MULTITOUCH is not set
+CONFIG_HID_NTRIG=y
+# CONFIG_HID_ORTEK is not set
+CONFIG_HID_PANTHERLORD=y
+# CONFIG_PANTHERLORD_FF is not set
+# CONFIG_HID_PENMOUNT is not set
+CONFIG_HID_PETALYNX=y
+# CONFIG_HID_PICOLCD is not set
+# CONFIG_HID_PLANTRONICS is not set
+# CONFIG_HID_PRIMAX is not set
+# CONFIG_HID_ROCCAT is not set
+# CONFIG_HID_SAITEK is not set
+CONFIG_HID_SAMSUNG=y
+CONFIG_HID_SONY=y
+# CONFIG_SONY_FF is not set
+# CONFIG_HID_SPEEDLINK is not set
+# CONFIG_HID_STEELSERIES is not set
+CONFIG_HID_SUNPLUS=y
+# CONFIG_HID_RMI is not set
+CONFIG_HID_GREENASIA=y
+# CONFIG_GREENASIA_FF is not set
+CONFIG_HID_SMARTJOYPLUS=y
+# CONFIG_SMARTJOYPLUS_FF is not set
+# CONFIG_HID_TIVO is not set
+CONFIG_HID_TOPSEED=y
+# CONFIG_HID_THINGM is not set
+CONFIG_HID_THRUSTMASTER=y
+# CONFIG_THRUSTMASTER_FF is not set
+# CONFIG_HID_WACOM is not set
+# CONFIG_HID_WIIMOTE is not set
+# CONFIG_HID_XINMO is not set
+CONFIG_HID_ZEROPLUS=y
+# CONFIG_ZEROPLUS_FF is not set
+# CONFIG_HID_ZYDACRON is not set
+# CONFIG_HID_SENSOR_HUB is not set
+
+#
+# USB HID support
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+# CONFIG_USB_HIDDEV is not set
+
+#
+# I2C HID support
+#
+# CONFIG_I2C_HID is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_COMMON=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+
+#
+# Miscellaneous USB options
+#
+CONFIG_USB_DEFAULT_PERSIST=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_ULPI_BUS is not set
+CONFIG_USB_MON=y
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_XHCI_HCD is not set
+# CONFIG_USB_EHCI_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+# CONFIG_USB_FOTG210_HCD is not set
+# CONFIG_USB_OHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_HCD_TEST_MODE is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+CONFIG_USB_STORAGE=y
+# CONFIG_USB_STORAGE_DEBUG is not set
+# CONFIG_USB_STORAGE_REALTEK is not set
+# CONFIG_USB_STORAGE_DATAFAB is not set
+# CONFIG_USB_STORAGE_FREECOM is not set
+# CONFIG_USB_STORAGE_ISD200 is not set
+# CONFIG_USB_STORAGE_USBAT is not set
+# CONFIG_USB_STORAGE_SDDR09 is not set
+# CONFIG_USB_STORAGE_SDDR55 is not set
+# CONFIG_USB_STORAGE_JUMPSHOT is not set
+# CONFIG_USB_STORAGE_ALAUDA is not set
+# CONFIG_USB_STORAGE_ONETOUCH is not set
+# CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
+# CONFIG_USB_STORAGE_ENE_UB6250 is not set
+# CONFIG_USB_UAS is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+# CONFIG_USBIP_CORE is not set
+# CONFIG_USB_MUSB_HDRC is not set
+# CONFIG_USB_DWC3 is not set
+# CONFIG_USB_DWC2 is not set
+CONFIG_USB_ISP1760=y
+CONFIG_USB_ISP1760_HCD=y
+CONFIG_USB_ISP1760_HOST_ROLE=y
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_EHSET_TEST_FIXTURE is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_YUREX is not set
+# CONFIG_USB_EZUSB_FX2 is not set
+# CONFIG_USB_HSIC_USB3503 is not set
+# CONFIG_USB_LINK_LAYER_TEST is not set
+# CONFIG_USB_CHAOSKEY is not set
+
+#
+# USB Physical Layer drivers
+#
+# CONFIG_USB_PHY is not set
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_AM335X_PHY_USB is not set
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_USB_ISP1301 is not set
+# CONFIG_USB_ULPI is not set
+# CONFIG_USB_GADGET is not set
+# CONFIG_USB_LED_TRIG is not set
+# CONFIG_UWB is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=8
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+CONFIG_MMC_ARMMMCI=y
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_DW is not set
+# CONFIG_MMC_VUB300 is not set
+# CONFIG_MMC_USHC is not set
+# CONFIG_MMC_USDHI6ROL0 is not set
+# CONFIG_MMC_MTK is not set
+# CONFIG_MEMSTICK is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+# CONFIG_LEDS_CLASS_FLASH is not set
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_BCM6328 is not set
+# CONFIG_LEDS_BCM6358 is not set
+# CONFIG_LEDS_LM3530 is not set
+# CONFIG_LEDS_LM3642 is not set
+# CONFIG_LEDS_PCA9532 is not set
+CONFIG_LEDS_GPIO=y
+# CONFIG_LEDS_LP3944 is not set
+# CONFIG_LEDS_LP5521 is not set
+# CONFIG_LEDS_LP5523 is not set
+# CONFIG_LEDS_LP5562 is not set
+# CONFIG_LEDS_LP8501 is not set
+# CONFIG_LEDS_LP8860 is not set
+# CONFIG_LEDS_PCA955X is not set
+# CONFIG_LEDS_PCA963X is not set
+# CONFIG_LEDS_REGULATOR is not set
+# CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_LT3593 is not set
+# CONFIG_LEDS_TCA6507 is not set
+# CONFIG_LEDS_TLC591XX is not set
+# CONFIG_LEDS_LM355x is not set
+
+#
+# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM)
+#
+# CONFIG_LEDS_BLINKM is not set
+# CONFIG_LEDS_SYSCON is not set
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+# CONFIG_LEDS_TRIGGER_TIMER is not set
+# CONFIG_LEDS_TRIGGER_ONESHOT is not set
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
+CONFIG_LEDS_TRIGGER_CPU=y
+# CONFIG_LEDS_TRIGGER_GPIO is not set
+# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
+
+#
+# iptables trigger is under Netfilter config (LED target)
+#
+# CONFIG_LEDS_TRIGGER_TRANSIENT is not set
+# CONFIG_LEDS_TRIGGER_CAMERA is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_EDAC_ATOMIC_SCRUB=y
+CONFIG_EDAC_SUPPORT=y
+# CONFIG_EDAC is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+CONFIG_RTC_SYSTOHC=y
+CONFIG_RTC_SYSTOHC_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_ABB5ZES3 is not set
+# CONFIG_RTC_DRV_ABX80X is not set
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_DS3232 is not set
+# CONFIG_RTC_DRV_HYM8563 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_ISL12022 is not set
+# CONFIG_RTC_DRV_ISL12057 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF2127 is not set
+# CONFIG_RTC_DRV_PCF8523 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF85063 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+# CONFIG_RTC_DRV_EM3027 is not set
+# CONFIG_RTC_DRV_RV3029C2 is not set
+# CONFIG_RTC_DRV_RV8803 is not set
+
+#
+# SPI RTC drivers
+#
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1685_FAMILY is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_DS2404 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+# CONFIG_RTC_DRV_ZYNQMP is not set
+
+#
+# on-CPU RTC drivers
+#
+# CONFIG_RTC_DRV_PL030 is not set
+CONFIG_RTC_DRV_PL031=y
+# CONFIG_RTC_DRV_SNVS is not set
+
+#
+# HID Sensor RTC drivers
+#
+# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+# CONFIG_VIRT_DRIVERS is not set
+CONFIG_VIRTIO=y
+
+#
+# Virtio drivers
+#
+CONFIG_VIRTIO_BALLOON=y
+# CONFIG_VIRTIO_INPUT is not set
+CONFIG_VIRTIO_MMIO=y
+CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
+
+#
+# Microsoft Hyper-V guest support
+#
+# CONFIG_STAGING is not set
+# CONFIG_CHROME_PLATFORMS is not set
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_HAVE_CLK_PREPARE=y
+CONFIG_COMMON_CLK=y
+
+#
+# Common Clock Framework
+#
+CONFIG_COMMON_CLK_VERSATILE=y
+CONFIG_CLK_SP810=y
+CONFIG_CLK_VEXPRESS_OSC=y
+# CONFIG_COMMON_CLK_SI5351 is not set
+# CONFIG_COMMON_CLK_SI514 is not set
+# CONFIG_COMMON_CLK_SI570 is not set
+# CONFIG_COMMON_CLK_CDCE925 is not set
+# CONFIG_CLK_QORIQ is not set
+# CONFIG_COMMON_CLK_PXA is not set
+# CONFIG_COMMON_CLK_CDCE706 is not set
+
+#
+# Hardware Spinlock drivers
+#
+
+#
+# Clock Source drivers
+#
+CONFIG_CLKSRC_OF=y
+CONFIG_CLKSRC_PROBE=y
+CONFIG_CLKSRC_MMIO=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_GLOBAL_TIMER=y
+CONFIG_ARM_TIMER_SP804=y
+CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y
+# CONFIG_ATMEL_PIT is not set
+# CONFIG_SH_TIMER_CMT is not set
+# CONFIG_SH_TIMER_MTU2 is not set
+# CONFIG_SH_TIMER_TMU is not set
+# CONFIG_EM_TIMER_STI is not set
+CONFIG_CLKSRC_VERSATILE=y
+# CONFIG_MAILBOX is not set
+CONFIG_IOMMU_SUPPORT=y
+
+#
+# Generic IOMMU Pagetable Support
+#
+# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set
+# CONFIG_ARM_SMMU is not set
+
+#
+# Remoteproc drivers
+#
+# CONFIG_STE_MODEM_RPROC is not set
+
+#
+# Rpmsg drivers
+#
+
+#
+# SOC (System On Chip) specific Drivers
+#
+# CONFIG_SOC_BRCMSTB is not set
+# CONFIG_SUNXI_SRAM is not set
+# CONFIG_SOC_TI is not set
+# CONFIG_PM_DEVFREQ is not set
+# CONFIG_EXTCON is not set
+# CONFIG_MEMORY is not set
+# CONFIG_IIO is not set
+# CONFIG_PWM is not set
+CONFIG_IRQCHIP=y
+CONFIG_ARM_GIC=y
+# CONFIG_IPACK_BUS is not set
+# CONFIG_RESET_CONTROLLER is not set
+# CONFIG_FMC is not set
+
+#
+# PHY Subsystem
+#
+# CONFIG_GENERIC_PHY is not set
+# CONFIG_PHY_PXA_28NM_HSIC is not set
+# CONFIG_PHY_PXA_28NM_USB2 is not set
+# CONFIG_BCM_KONA_USB2_PHY is not set
+# CONFIG_POWERCAP is not set
+# CONFIG_MCB is not set
+
+#
+# Performance monitor support
+#
+CONFIG_ARM_PMU=y
+# CONFIG_RAS is not set
+
+#
+# Android
+#
+# CONFIG_ANDROID is not set
+# CONFIG_NVMEM is not set
+# CONFIG_STM is not set
+# CONFIG_STM_DUMMY is not set
+# CONFIG_STM_SOURCE_CONSOLE is not set
+# CONFIG_INTEL_TH is not set
+
+#
+# FPGA Configuration Support
+#
+# CONFIG_FPGA is not set
+
+#
+# Firmware Drivers
+#
+CONFIG_ARM_PSCI_FW=y
+# CONFIG_FIRMWARE_MEMMAP is not set
+
+#
+# File systems
+#
+CONFIG_DCACHE_WORD_ACCESS=y
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+CONFIG_EXT3_FS=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+CONFIG_EXT4_FS=y
+# CONFIG_EXT4_FS_POSIX_ACL is not set
+# CONFIG_EXT4_FS_SECURITY is not set
+# CONFIG_EXT4_ENCRYPTION is not set
+# CONFIG_EXT4_DEBUG is not set
+CONFIG_JBD2=y
+# CONFIG_JBD2_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+# CONFIG_F2FS_FS is not set
+# CONFIG_FS_POSIX_ACL is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_FANOTIFY is not set
+# CONFIG_QUOTA is not set
+# CONFIG_QUOTACTL is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+# CONFIG_OVERLAY_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+# CONFIG_MSDOS_FS is not set
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+# CONFIG_PROC_CHILDREN is not set
+CONFIG_KERNFS=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+# CONFIG_JFFS2_SUMMARY is not set
+# CONFIG_JFFS2_FS_XATTR is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+# CONFIG_JFFS2_LZO is not set
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
+CONFIG_UBIFS_FS=y
+# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
+CONFIG_UBIFS_FS_LZO=y
+CONFIG_UBIFS_FS_ZLIB=y
+# CONFIG_UBIFS_ATIME_SUPPORT is not set
+# CONFIG_LOGFS is not set
+CONFIG_CRAMFS=y
+CONFIG_SQUASHFS=y
+CONFIG_SQUASHFS_FILE_CACHE=y
+# CONFIG_SQUASHFS_FILE_DIRECT is not set
+CONFIG_SQUASHFS_DECOMP_SINGLE=y
+# CONFIG_SQUASHFS_DECOMP_MULTI is not set
+# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set
+# CONFIG_SQUASHFS_XATTR is not set
+CONFIG_SQUASHFS_ZLIB=y
+# CONFIG_SQUASHFS_LZ4 is not set
+CONFIG_SQUASHFS_LZO=y
+# CONFIG_SQUASHFS_XZ is not set
+# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_QNX6FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_PSTORE is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V2=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V3_ACL is not set
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_SWAP is not set
+CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
+CONFIG_GRACE_PERIOD=y
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+# CONFIG_SUNRPC_DEBUG is not set
+# CONFIG_CEPH_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+CONFIG_9P_FS=y
+# CONFIG_9P_FS_POSIX_ACL is not set
+# CONFIG_9P_FS_SECURITY is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+# CONFIG_NLS_ASCII is not set
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_MAC_ROMAN is not set
+# CONFIG_NLS_MAC_CELTIC is not set
+# CONFIG_NLS_MAC_CENTEURO is not set
+# CONFIG_NLS_MAC_CROATIAN is not set
+# CONFIG_NLS_MAC_CYRILLIC is not set
+# CONFIG_NLS_MAC_GAELIC is not set
+# CONFIG_NLS_MAC_GREEK is not set
+# CONFIG_NLS_MAC_ICELAND is not set
+# CONFIG_NLS_MAC_INUIT is not set
+# CONFIG_NLS_MAC_ROMANIAN is not set
+# CONFIG_NLS_MAC_TURKISH is not set
+# CONFIG_NLS_UTF8 is not set
+
+#
+# Kernel hacking
+#
+
+#
+# printk and dmesg options
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+
+#
+# Compile-time checks and compiler options
+#
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
+# CONFIG_DEBUG_INFO_SPLIT is not set
+# CONFIG_DEBUG_INFO_DWARF4 is not set
+# CONFIG_GDB_SCRIPTS is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_READABLE_ASM is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_PAGE_OWNER is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_SECTION_MISMATCH is not set
+CONFIG_SECTION_MISMATCH_WARN_ONLY=y
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+CONFIG_MAGIC_SYSRQ=y
+CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1
+CONFIG_DEBUG_KERNEL=y
+
+#
+# Memory Debugging
+#
+# CONFIG_PAGE_EXTENSION is not set
+# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+CONFIG_HAVE_DEBUG_KMEMLEAK=y
+# CONFIG_DEBUG_KMEMLEAK is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_VM is not set
+CONFIG_DEBUG_MEMORY_INIT=y
+# CONFIG_DEBUG_PER_CPU_MAPS is not set
+# CONFIG_DEBUG_SHIRQ is not set
+
+#
+# Debug Lockups and Hangs
+#
+# CONFIG_LOCKUP_DETECTOR is not set
+CONFIG_DETECT_HUNG_TASK=y
+CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
+# CONFIG_PANIC_ON_OOPS is not set
+CONFIG_PANIC_ON_OOPS_VALUE=0
+CONFIG_PANIC_TIMEOUT=0
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHED_INFO is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_SCHED_STACK_END_CHECK is not set
+# CONFIG_DEBUG_TIMEKEEPING is not set
+# CONFIG_TIMER_STATS is not set
+
+#
+# Lock Debugging (spinlocks, mutexes, etc...)
+#
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_ATOMIC_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_LOCK_TORTURE_TEST is not set
+# CONFIG_STACKTRACE is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_PI_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+
+#
+# RCU Debugging
+#
+# CONFIG_PROVE_RCU is not set
+# CONFIG_SPARSE_RCU_POINTER is not set
+# CONFIG_TORTURE_TEST is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+CONFIG_RCU_CPU_STALL_TIMEOUT=21
+# CONFIG_RCU_TRACE is not set
+# CONFIG_RCU_EQS_DEBUG is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_NOTIFIER_ERROR_INJECTION is not set
+# CONFIG_FAULT_INJECTION is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_TRACE_CLOCK=y
+CONFIG_RING_BUFFER=y
+CONFIG_RING_BUFFER_ALLOW_SWAP=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
+# CONFIG_FTRACE_SYSCALLS is not set
+# CONFIG_TRACER_SNAPSHOT is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_UPROBE_EVENT is not set
+# CONFIG_PROBE_EVENTS is not set
+# CONFIG_TRACEPOINT_BENCHMARK is not set
+# CONFIG_RING_BUFFER_BENCHMARK is not set
+# CONFIG_RING_BUFFER_STARTUP_TEST is not set
+CONFIG_TRACING_EVENTS_GPIO=y
+
+#
+# Runtime Testing
+#
+# CONFIG_LKDTM is not set
+# CONFIG_TEST_LIST_SORT is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_RBTREE_TEST is not set
+# CONFIG_INTERVAL_TREE_TEST is not set
+# CONFIG_PERCPU_TEST is not set
+# CONFIG_ATOMIC64_SELFTEST is not set
+# CONFIG_TEST_HEXDUMP is not set
+# CONFIG_TEST_STRING_HELPERS is not set
+# CONFIG_TEST_KSTRTOX is not set
+# CONFIG_TEST_PRINTF is not set
+# CONFIG_TEST_RHASHTABLE is not set
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_TEST_LKM is not set
+# CONFIG_TEST_USER_COPY is not set
+# CONFIG_TEST_BPF is not set
+# CONFIG_TEST_FIRMWARE is not set
+# CONFIG_TEST_UDELAY is not set
+# CONFIG_MEMTEST is not set
+# CONFIG_TEST_STATIC_KEYS is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_ARM_PTDUMP is not set
+# CONFIG_STRICT_DEVMEM is not set
+CONFIG_ARM_UNWIND=y
+CONFIG_DEBUG_USER=y
+# CONFIG_DEBUG_LL is not set
+CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
+# CONFIG_DEBUG_UART_8250 is not set
+CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
+# CONFIG_PID_IN_CONTEXTIDR is not set
+# CONFIG_DEBUG_SET_MODULE_RONX is not set
+# CONFIG_CORESIGHT is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY_DMESG_RESTRICT is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD=m
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG=m
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_RNG_DEFAULT=m
+CONFIG_CRYPTO_PCOMP2=y
+CONFIG_CRYPTO_AKCIPHER2=y
+# CONFIG_CRYPTO_RSA is not set
+CONFIG_CRYPTO_MANAGER=m
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_USER is not set
+CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+# CONFIG_CRYPTO_GF128MUL is not set
+CONFIG_CRYPTO_NULL=m
+CONFIG_CRYPTO_NULL2=y
+# CONFIG_CRYPTO_PCRYPT is not set
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_MCRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_CHACHA20POLY1305 is not set
+# CONFIG_CRYPTO_SEQIV is not set
+CONFIG_CRYPTO_ECHAINIV=m
+
+#
+# Block modes
+#
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+# CONFIG_CRYPTO_ECB is not set
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+# CONFIG_CRYPTO_KEYWRAP is not set
+
+#
+# Hash modes
+#
+# CONFIG_CRYPTO_CMAC is not set
+CONFIG_CRYPTO_HMAC=m
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_CRC32 is not set
+# CONFIG_CRYPTO_CRCT10DIF is not set
+# CONFIG_CRYPTO_GHASH is not set
+# CONFIG_CRYPTO_POLY1305 is not set
+# CONFIG_CRYPTO_MD4 is not set
+# CONFIG_CRYPTO_MD5 is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+CONFIG_CRYPTO_SHA256=m
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+CONFIG_CRYPTO_AES=y
+# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_CHACHA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+CONFIG_CRYPTO_DEFLATE=y
+# CONFIG_CRYPTO_ZLIB is not set
+CONFIG_CRYPTO_LZO=y
+# CONFIG_CRYPTO_842 is not set
+# CONFIG_CRYPTO_LZ4 is not set
+# CONFIG_CRYPTO_LZ4HC is not set
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+CONFIG_CRYPTO_DRBG_MENU=m
+CONFIG_CRYPTO_DRBG_HMAC=y
+# CONFIG_CRYPTO_DRBG_HASH is not set
+# CONFIG_CRYPTO_DRBG_CTR is not set
+CONFIG_CRYPTO_DRBG=m
+CONFIG_CRYPTO_JITTERENTROPY=m
+# CONFIG_CRYPTO_USER_API_HASH is not set
+# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
+# CONFIG_CRYPTO_USER_API_RNG is not set
+# CONFIG_CRYPTO_USER_API_AEAD is not set
+# CONFIG_CRYPTO_HW is not set
+
+#
+# Certificates for signature checking
+#
+# CONFIG_ARM_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_HAVE_ARCH_BITREVERSE=y
+CONFIG_RATIONAL=y
+CONFIG_GENERIC_STRNCPY_FROM_USER=y
+CONFIG_GENERIC_STRNLEN_USER=y
+CONFIG_GENERIC_NET_UTILS=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_IO=y
+CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
+# CONFIG_CRC_CCITT is not set
+CONFIG_CRC16=y
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC32_SELFTEST is not set
+CONFIG_CRC32_SLICEBY8=y
+# CONFIG_CRC32_SLICEBY4 is not set
+# CONFIG_CRC32_SARWATE is not set
+# CONFIG_CRC32_BIT is not set
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+# CONFIG_CRC8 is not set
+# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set
+# CONFIG_RANDOM32_SELFTEST is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+CONFIG_LZ4_DECOMPRESS=y
+CONFIG_XZ_DEC=y
+CONFIG_XZ_DEC_X86=y
+CONFIG_XZ_DEC_POWERPC=y
+CONFIG_XZ_DEC_IA64=y
+CONFIG_XZ_DEC_ARM=y
+CONFIG_XZ_DEC_ARMTHUMB=y
+CONFIG_XZ_DEC_SPARC=y
+CONFIG_XZ_DEC_BCJ=y
+# CONFIG_XZ_DEC_TEST is not set
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_DECOMPRESS_BZIP2=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_DECOMPRESS_XZ=y
+CONFIG_DECOMPRESS_LZO=y
+CONFIG_DECOMPRESS_LZ4=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_DMA=y
+CONFIG_CPU_RMAP=y
+CONFIG_DQL=y
+CONFIG_GLOB=y
+# CONFIG_GLOB_SELFTEST is not set
+CONFIG_NLATTR=y
+CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
+# CONFIG_CORDIC is not set
+# CONFIG_DDR is not set
+CONFIG_LIBFDT=y
+CONFIG_FONT_SUPPORT=y
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+# CONFIG_SG_SPLIT is not set
+CONFIG_ARCH_HAS_SG_CHAIN=y
+# CONFIG_VIRTUALIZATION is not set
diff --git a/src/ci/docker/x86_64-gnu-make/Dockerfile b/src/ci/docker/x86_64-gnu-make/Dockerfile
deleted file mode 100644 (file)
index c6071d7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-FROM ubuntu:16.04
-
-RUN apt-get update && apt-get install -y --no-install-recommends \
-  g++ \
-  make \
-  file \
-  curl \
-  ca-certificates \
-  python2.7 \
-  git \
-  cmake \
-  sudo \
-  gdb \
-  xz-utils
-
-ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783
-RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \
-      tar xJf - -C /usr/local/bin --strip-components=1
-
-RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
-    dpkg -i dumb-init_*.deb && \
-    rm dumb-init_*.deb
-ENTRYPOINT ["/usr/bin/dumb-init", "--"]
-
-ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --disable-rustbuild
-ENV RUST_CHECK_TARGET check
index 3a2cc47df79bf1cb5da742df04951ee221fd29b6..960acc4de7d87e2bcd5d297d057d41af05f3e446 100755 (executable)
 
 set -e
 
-if [ "$LOCAL_USER_ID" != "" ]; then
-  useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
-  export HOME=/home/user
-  unset LOCAL_USER_ID
-  exec su --preserve-environment -c "env PATH=$PATH \"$0\"" user
+if [ "$NO_CHANGE_USER" = "" ]; then
+  if [ "$LOCAL_USER_ID" != "" ]; then
+    useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
+    export HOME=/home/user
+    unset LOCAL_USER_ID
+    exec su --preserve-environment -c "env PATH=$PATH \"$0\"" user
+  fi
 fi
 
 RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-sccache"
index 9dca3479d35e846e02965d8c2dec8f43166f1675..17741cac10b78c88fd3cdabc30ef24b6fd9429b8 100644 (file)
@@ -118,7 +118,8 @@ These types are _generally_ found in struct fields, but they may be found elsewh
 
 ## `Cell<T>`
 
-[`Cell<T>`][cell] is a type that provides zero-cost interior mutability, but only for `Copy` types.
+[`Cell<T>`][cell] is a type that provides zero-cost interior mutability by moving data in and
+out of the cell.
 Since the compiler knows that all the data owned by the contained value is on the stack, there's
 no worry of leaking any data behind references (or worse!) by simply replacing the data.
 
@@ -160,7 +161,7 @@ This relaxes the &ldquo;no aliasing with mutability&rdquo; restriction in places
 unnecessary. However, this also relaxes the guarantees that the restriction provides; so if your
 invariants depend on data stored within `Cell`, you should be careful.
 
-This is useful for mutating primitives and other `Copy` types when there is no easy way of
+This is useful for mutating primitives and other types when there is no easy way of
 doing it in line with the static rules of `&` and `&mut`.
 
 `Cell` does not let you obtain interior references to the data, which makes it safe to freely
@@ -168,16 +169,17 @@ mutate.
 
 #### Cost
 
-There is no runtime cost to using `Cell<T>`, however if you are using it to wrap larger (`Copy`)
+There is no runtime cost to using `Cell<T>`, however if you are using it to wrap larger
 structs, it might be worthwhile to instead wrap individual fields in `Cell<T>` since each write is
 otherwise a full copy of the struct.
 
 
 ## `RefCell<T>`
 
-[`RefCell<T>`][refcell] also provides interior mutability, but isn't restricted to `Copy` types.
+[`RefCell<T>`][refcell] also provides interior mutability, but doesn't move data in and out of the
+cell.
 
-Instead, it has a runtime cost. `RefCell<T>` enforces the read-write lock pattern at runtime (it's
+However, it has a runtime cost. `RefCell<T>` enforces the read-write lock pattern at runtime (it's
 like a single-threaded mutex), unlike `&T`/`&mut T` which do so at compile time. This is done by the
 `borrow()` and `borrow_mut()` functions, which modify an internal reference count and return smart
 pointers which can be dereferenced immutably and mutably respectively. The refcount is restored when
index dafcffc39c802b0ff992fb4be06d8b9e5f86fcf2..d2402ddb2e957596c9edb506bbb42a06c4226d91 100644 (file)
@@ -601,7 +601,7 @@ is documented, especially when you are working on a library. Rust allows you to
 to generate warnings or errors, when an item is missing documentation.
 To generate warnings you use `warn`:
 
-```rust
+```rust,ignore
 #![warn(missing_docs)]
 ```
 
@@ -631,7 +631,7 @@ struct Hidden;
 You can control a few aspects of the HTML that `rustdoc` generates through the
 `#![doc]` version of the attribute:
 
-```rust
+```rust,ignore
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
        html_favicon_url = "https://www.rust-lang.org/favicon.ico",
        html_root_url = "https://doc.rust-lang.org/")]
index 9afe5fa826d29eb0fb2e345b59c8950816dc9ef7..e76149ad27050b1d4c762d78047074aa57accc79 100644 (file)
@@ -1,7 +1,8 @@
 % if let
 
-`if let` allows you to combine `if` and `let` together to reduce the overhead
-of certain kinds of pattern matches.
+`if let` permits [patterns][pattern] matching within the condition of an [if][if] statement.
+This allows us to reduce the overhead of certain kinds of [pattern][patterns] matches
+and express them in a more convenient way.  
 
 For example, let’s say we have some sort of `Option<T>`. We want to call a function
 on it if it’s `Some<T>`, but do nothing if it’s `None`. That looks like this:
@@ -80,3 +81,4 @@ while let Some(x) = v.pop() {
 ```
 
 [patterns]: patterns.html
+[if]: if.html
index 940367b39710030e80f7cdfb0275d7219994e855..ef19c0dc7cc5e16a1fbc85a2577783dc6c1447cf 100644 (file)
@@ -499,6 +499,10 @@ be imported in every test with `mod common;`
 That's all there is to the `tests` directory. The `tests` module isn't needed
 here, since the whole thing is focused on tests.
 
+Note, when building integration tests, cargo will not pass the `test` attribute
+to the compiler. It means that all parts in `cfg(test)` won't be included in
+the build used in your integration tests.
+
 Let's finally check out that third section: documentation tests.
 
 # Documentation tests
index 69958dd3e68a41c717527cc05347eb9d064705d1..e66e1d05fff73c7aea6f406280f88a2b3e66ff95 100644 (file)
@@ -13,7 +13,7 @@ don’t want to use the standard library via an attribute: `#![no_std]`.
 
 To use `#![no_std]`, add it to your crate root:
 
-```rust
+```rust,ignore
 #![no_std]
 
 fn plus_one(x: i32) -> i32 {
@@ -29,7 +29,7 @@ use its features without an explicit import. By the same token, when using
 prelude](../core/prelude/v1/index.html). This means that a lot of code will Just
 Work:
 
-```rust
+```rust,ignore
 #![no_std]
 
 fn may_fail(failure: bool) -> Result<(), &'static str> {
index f54933827b3305cff1b1864ce3bdac7c227beda3..6114006cbb341c068fd9936244616cb71fadfffd 100644 (file)
@@ -199,24 +199,42 @@ assert (unsafely) that a generic type's destructor is *guaranteed* to
 not access any expired data, even if its type gives it the capability
 to do so.
 
-That attribute is called `unsafe_destructor_blind_to_params`.
+That attribute is called `may_dangle` and was introduced in [RFC 1327]
+(https://github.com/rust-lang/rfcs/blob/master/text/1327-dropck-param-eyepatch.md).
 To deploy it on the Inspector example from above, we would write:
 
 ```rust,ignore
 struct Inspector<'a>(&'a u8, &'static str);
 
-impl<'a> Drop for Inspector<'a> {
-    #[unsafe_destructor_blind_to_params]
+unsafe impl<#[may_dangle] 'a> Drop for Inspector<'a> {
     fn drop(&mut self) {
         println!("Inspector(_, {}) knows when *not* to inspect.", self.1);
     }
 }
 ```
 
-This attribute has the word `unsafe` in it because the compiler is not
-checking the implicit assertion that no potentially expired data
+Use of this attribute requires the `Drop` impl to be marked `unsafe` because the
+compiler is not checking the implicit assertion that no potentially expired data
 (e.g. `self.0` above) is accessed.
 
+The attribute can be applied to any number of lifetime and type parameters. In
+the following example, we assert that we access no data behind a reference of
+lifetime `'b` and that the only uses of `T` will be moves or drops, but omit
+the attribute from `'a` and `U`, because we do access data with that lifetime
+and that type:
+
+```rust,ignore
+use std::fmt::Display;
+
+struct Inspector<'a, 'b, T, U: Display>(&'a u8, &'b u8, T, U);
+
+unsafe impl<'a, #[may_dangle] 'b, #[may_dangle] T, U: Display> Drop for Inspector<'a, 'b, T, U> {
+    fn drop(&mut self) {
+        println!("Inspector({}, _, _, {})", self.0, self.3);
+    }
+}
+```
+
 It is sometimes obvious that no such access can occur, like the case above.
 However, when dealing with a generic type parameter, such access can
 occur indirectly. Examples of such indirect access are:
@@ -263,7 +281,7 @@ some other method invoked by the destructor, rather than being written
 directly within it.
 
 In all of the above cases where the `&'a u8` is accessed in the
-destructor, adding the `#[unsafe_destructor_blind_to_params]`
+destructor, adding the `#[may_dangle]`
 attribute makes the type vulnerable to misuse that the borrower
 checker will not catch, inviting havoc. It is better to avoid adding
 the attribute.
index 8139a712bddb25e7c9cdd71adf8621f03df32e41..f9013490418f3da598ef9bfe112411d5b0a2e9d6 100644 (file)
@@ -2114,10 +2114,15 @@ Sometimes one wants to have different compiler outputs from the same code,
 depending on build target, such as targeted operating system, or to enable
 release builds.
 
-There are two kinds of configuration options, one that is either defined or not
-(`#[cfg(foo)]`), and the other that contains a string that can be checked
-against (`#[cfg(bar = "baz")]`). Currently, only compiler-defined configuration
-options can have the latter form.
+Configuration options are boolean (on or off) and are named either with a
+single identifier (e.g. `foo`) or an identifier and a string (e.g. `foo = "bar"`;
+the quotes are required and spaces around the `=` are unimportant). Note that
+similarly-named options, such as `foo`, `foo="bar"` and `foo="baz"` may each be set
+or unset independently.
+
+Configuration options are either provided by the compiler or passed in on the
+command line using `--cfg` (e.g. `rustc main.rs --cfg foo --cfg 'bar="baz"'`).
+Rust code then checks for their presence using the `#[cfg(...)]` attribute:
 
 ```
 // The function is only included in the build when compiling for OSX
@@ -2196,7 +2201,10 @@ You can also set another attribute based on a `cfg` variable with `cfg_attr`:
 #[cfg_attr(a, b)]
 ```
 
-Will be the same as `#[b]` if `a` is set by `cfg`, and nothing otherwise.
+This is the same as `#[b]` if `a` is set by `cfg`, and nothing otherwise.
+
+Lastly, configuration options can be used in expressions by invoking the `cfg!`
+macro: `cfg!(a)` evaluates to `true` if `a` is set, and `false` otherwise.
 
 ### Lint check attributes
 
diff --git a/src/etc/Dockerfile b/src/etc/Dockerfile
deleted file mode 100644 (file)
index 83d5478..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-FROM ubuntu:xenial
-
-# curl
-#   Download stage0, see src/bootstrap/bootstrap.py
-# g++
-#   Compile LLVM binding in src/rustllvm
-# gdb
-#   Used to run tests in src/test/debuginfo
-# git
-#   Get commit hash and commit date in version string
-# make
-#   Run build scripts in mk
-# libedit-dev zlib1g-dev
-#   LLVM dependencies as packaged in Ubuntu
-#   (They are optional, but Ubuntu package enables them)
-# llvm-3.7-dev (installed by llvm-3.7-tools)
-#   LLVM
-# llvm-3.7-tools
-#   FileCheck is used to run tests in src/test/codegen
-
-RUN apt-get update && apt-get -y install \
-    curl g++ gdb git make \
-    libedit-dev zlib1g-dev \
-    llvm-3.7-tools cmake
-
-RUN mkdir /build
-WORKDIR /build
diff --git a/src/etc/apple-darwin.supp b/src/etc/apple-darwin.supp
deleted file mode 100644 (file)
index 50e30ca..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-{
-   osx-frameworks.rs-fails-otherwise-1
-   Memcheck:Leak
-   match-leak-kinds: definite,possible
-   fun:malloc
-   ...
-   fun:__CFInitialize
-   ...
-}
-
-{
-   osx-frameworks.rs-fails-otherwise-2
-   Memcheck:Leak
-   match-leak-kinds: possible
-   fun:malloc_zone_calloc
-   ...
-   fun:__CFInitialize
-   fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE
-}
-
-{
-   osx-frameworks.rs-fails-otherwise-3
-   Memcheck:Leak
-   match-leak-kinds: possible
-   fun:realloc
-   ...
-   fun:_read_images
-   fun:map_images_nolock
-   ...
-   fun:_ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoE
-   fun:_ZN4dyld36registerImageStateBatchChangeHandlerE17dyld_image_statesPFPKcS0_jPK15dyld_image_infoE
-   fun:dyld_register_image_state_change_handler
-   fun:_objc_init
-   fun:_os_object_init
-}
-
-{
-   osx-frameworks.rs-fails-otherwise-4
-   Memcheck:Leak
-   match-leak-kinds: definite,possible
-   fun:calloc
-   ...
-   fun:__CFInitialize
-   fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE
-   fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE
-   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
-}
-
-{
-   osx-frameworks.rs-fails-otherwise-5
-   Memcheck:Leak
-   match-leak-kinds: definite,possible
-   fun:malloc_zone_malloc
-   ...
-   fun:__CFInitialize
-   ...
-}
-
-{
-   fails-since-xcode-7.2
-   Memcheck:Leak
-   match-leak-kinds: possible
-   fun:malloc_zone_malloc
-   fun:_objc_copyClassNamesForImage
-   fun:_ZL9protocolsv
-   fun:_Z9readClassP10objc_classbb
-   fun:gc_init
-   fun:_ZL33objc_initializeClassPair_internalP10objc_classPKcS0_S0_
-   fun:layout_string_create
-   fun:_ZL12realizeClassP10objc_class
-   fun:_ZL22copySwiftV1MangledNamePKcb
-   fun:_ZL22copySwiftV1MangledNamePKcb
-   fun:_ZL22copySwiftV1MangledNamePKcb
-   fun:_ZL22copySwiftV1MangledNamePKcb
-}
diff --git a/src/etc/check-sanitycheck.py b/src/etc/check-sanitycheck.py
deleted file mode 100644 (file)
index 0e103fb..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-import os
-import subprocess
-import sys
-import functools
-
-STATUS = 0
-
-def error_unless_permitted(env_var, message):
-    global STATUS
-    if not os.getenv(env_var):
-        sys.stderr.write(message)
-        STATUS = 1
-
-def only_on(platforms):
-    def decorator(func):
-        @functools.wraps(func)
-        def inner():
-            if any(map(lambda x: sys.platform.startswith(x), platforms)):
-                func()
-        return inner
-    return decorator
-
-@only_on(['linux', 'darwin', 'freebsd', 'openbsd'])
-def check_rlimit_core():
-    import resource
-    soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
-    if soft > 0:
-        error_unless_permitted('ALLOW_NONZERO_RLIMIT_CORE', """\
-RLIMIT_CORE is set to a nonzero value (%d). During debuginfo, the test suite
-will segfault many rustc's, creating many potentially large core files.
-set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning
-""" % (soft))
-
-@only_on(['win32'])
-def check_console_code_page():
-    if '65001' not in subprocess.check_output(['cmd', '/c', 'chcp']):
-        sys.stderr.write('Warning: the console output code page is not UTF-8, \
-some tests may fail. Use `cmd /c "chcp 65001"` to setup UTF-8 code page.\n')
-
-def main():
-    check_console_code_page()
-    check_rlimit_core()
-
-if __name__ == '__main__':
-    main()
-    sys.exit(STATUS)
diff --git a/src/etc/check-summary.py b/src/etc/check-summary.py
deleted file mode 100755 (executable)
index 9312b68..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-import glob
-import sys
-
-if __name__ == '__main__':
-    summaries = []
-
-    def summarise(fname):
-        summary = {}
-        with open(fname) as fd:
-            for line in fd:
-                splitline = line.strip().split(' ')
-                if len(splitline) == 1:
-                    continue
-                status = splitline[0]
-                test = splitline[-1]
-                # track bench runs
-                if splitline[1] == 'ns/iter':
-                    status = 'bench'
-                if status not in summary:
-                    summary[status] = []
-                summary[status].append(test)
-            summaries.append((fname, summary))
-
-    def count(t):
-        return sum(map(lambda f: len(f[1].get(t, [])), summaries))
-
-    logfiles = sys.argv[1:]
-    for files in map(glob.glob, logfiles):
-        map(summarise, files)
-    ok = count('ok')
-    failed = count('failed')
-    ignored = count('ignored')
-    measured = count('bench')
-    print("summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" %
-          (len(logfiles), ok, failed, ignored, measured))
-    print("")
-
-    if failed > 0:
-        print("failed tests:")
-        for f, s in summaries:
-            failures = s.get('failed', [])
-            if len(failures) > 0:
-                print("  %s:" % (f))
-            for test in failures:
-                print("    %s" % (test))
diff --git a/src/etc/get-stage0.py b/src/etc/get-stage0.py
deleted file mode 100644 (file)
index 127251c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-import os
-import sys
-
-path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../bootstrap"))
-sys.path.append(path)
-
-import bootstrap
-
-def main(triple):
-    src_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
-    data = bootstrap.stage0_data(src_root)
-
-    channel, date = data['rustc'].split('-', 1)
-
-    dl_dir = 'dl'
-    if not os.path.exists(dl_dir):
-        os.makedirs(dl_dir)
-
-    filename = 'rustc-{}-{}.tar.gz'.format(channel, triple)
-    url = 'https://static.rust-lang.org/dist/{}/{}'.format(date, filename)
-    dst = dl_dir + '/' + filename
-    bootstrap.get(url, dst)
-
-    stage0_dst = triple + '/stage0'
-    if os.path.exists(stage0_dst):
-        for root, _, files in os.walk(stage0_dst):
-            for f in files:
-                os.unlink(os.path.join(root, f))
-    else:
-        os.makedirs(stage0_dst)
-    bootstrap.unpack(dst, stage0_dst, match='rustc', verbose=True)
-
-if __name__ == '__main__':
-    main(sys.argv[1])
diff --git a/src/etc/local_stage0.sh b/src/etc/local_stage0.sh
deleted file mode 100755 (executable)
index ee77206..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-# Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-TARG_DIR=$1
-PREFIX=$2
-RUSTLIBDIR=$3
-
-LIB_DIR=lib
-LIB_PREFIX=lib
-
-OS=`uname -s`
-case $OS in
-    ("Linux"|"FreeBSD"|"DragonFly"|"Bitrig"|"OpenBSD"|"SunOS"|"Haiku")
-    BIN_SUF=
-    LIB_SUF=.so
-    ;;
-    ("Darwin")
-    BIN_SUF=
-    LIB_SUF=.dylib
-    ;;
-    (*)
-    BIN_SUF=.exe
-    LIB_SUF=.dll
-    LIB_DIR=bin
-    LIB_PREFIX=
-    ;;
-esac
-
-if [ -z $PREFIX ]; then
-    echo "No local rust specified."
-    exit 1
-fi
-
-if [ ! -e ${PREFIX}/bin/rustc${BIN_SUF} ]; then
-    echo "No local rust installed at ${PREFIX}"
-    exit 1
-fi
-
-if [ -z $TARG_DIR ]; then
-    echo "No target directory specified."
-    exit 1
-fi
-
-case "$TARG_DIR" in
---print-rustc-release)
-  # not actually copying to TARG_DIR, just print the local rustc version and exit
-  ${PREFIX}/bin/rustc${BIN_SUF} --version --verbose | sed -ne 's/^release: //p'
-;;
-*)
-
-cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/
-cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}arena*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}syntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}flate*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}fmt_macros*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}getopts*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}graphviz*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}log*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rbml*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}serialize*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}term*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}proc_macro*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-
-# do not fail if one of the above fails, as all we need is a working rustc!
-exit 0
-
-esac
diff --git a/src/etc/mklldeps.py b/src/etc/mklldeps.py
deleted file mode 100644 (file)
index 24b0075..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-# Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-import os
-import sys
-import subprocess
-
-f = open(sys.argv[1], 'wb')
-
-components = sys.argv[2].split() # splits on whitespace
-enable_static = sys.argv[3]
-llvm_config = sys.argv[4]
-stdcpp_name = sys.argv[5]
-use_libcpp = sys.argv[6]
-
-f.write("""// Copyright 2013 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.
-
-// WARNING: THIS IS A GENERATED FILE, DO NOT MODIFY
-//          take a look at src/etc/mklldeps.py if you're interested
-""")
-
-
-def run(args):
-    proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    out, err = proc.communicate()
-
-    if err:
-        print("failed to run llvm_config: args = `{}`".format(args))
-        print(err)
-        sys.exit(1)
-    return out
-
-def runErr(args):
-    proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    out, err = proc.communicate()
-
-    if err:
-        return False, out
-    else:
-        return True, out
-
-f.write("\n")
-
-args = [llvm_config, '--shared-mode']
-args.extend(components)
-llvm_shared, out = runErr(args)
-if llvm_shared:
-    llvm_shared = 'shared' in out
-
-# LLVM libs
-args = [llvm_config, '--libs', '--system-libs']
-args.extend(components)
-out = run(args)
-for lib in out.strip().replace("\n", ' ').split(' '):
-    if len(lib) == 0:
-        continue
-    # in some cases we get extra spaces in between libs so ignore those
-    if len(lib) == 1 and lib == ' ':
-        continue
-    # not all libs strictly follow -lfoo, on Bitrig, there is -pthread
-    if lib[0:2] == '-l':
-        lib = lib.strip()[2:]
-    elif lib[0] == '-':
-        lib = lib.strip()[1:]
-    # If this actually points at a literal file then we're on MSVC which now
-    # prints full paths, so get just the name of the library and strip off the
-    # trailing ".lib"
-    elif os.path.exists(lib):
-        lib = os.path.basename(lib)[:-4]
-    elif lib[-4:] == '.lib':
-        lib = lib[:-4]
-    f.write("#[link(name = \"" + lib + "\"")
-    if not llvm_shared and 'LLVM' in lib:
-        f.write(", kind = \"static\"")
-    f.write(")]\n")
-
-# LLVM ldflags
-out = run([llvm_config, '--ldflags'])
-for lib in out.strip().split(' '):
-    if lib[:2] == "-l":
-        f.write("#[link(name = \"" + lib[2:] + "\")]\n")
-
-# C++ runtime library
-out = run([llvm_config, '--cxxflags'])
-if enable_static == '1':
-    assert('stdlib=libc++' not in out)
-    f.write("#[link(name = \"" + stdcpp_name + "\", kind = \"static\")]\n")
-else:
-    # Note that we use `cfg_attr` here because on MSVC the C++ standard library
-    # is not c++ or stdc++, but rather the linker takes care of linking the
-    # right standard library.
-    if use_libcpp != "0" or 'stdlib=libc++' in out:
-        f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"c++\"))]\n")
-    else:
-        f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"" + stdcpp_name + "\"))]\n")
-
-# Attach everything to an extern block
-f.write("extern {}\n")
diff --git a/src/etc/x86.supp b/src/etc/x86.supp
deleted file mode 100644 (file)
index 6e409af..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-{
-   goddammit-llvm-why-u-no-valgrind
-   Memcheck:Cond
-   fun:*
-   ...
-}
-
-{
-   down-with-thread-dtors.rs-fails-otherwise-1
-   Memcheck:Addr1
-   ...
-   fun:tlv_finalize
-   fun:_pthread_tsd_cleanup
-   fun:_pthread_exit
-   ...
-   fun:_pthread_start
-   fun:thread_start
-}
-
-{
-   down-with-thread-dtors.rs-fails-otherwise-2
-   Memcheck:Addr2
-   ...
-   fun:tlv_finalize
-   fun:_pthread_tsd_cleanup
-   fun:_pthread_exit
-   ...
-   fun:_pthread_start
-   fun:thread_start
-}
-
-{
-   down-with-thread-dtors.rs-fails-otherwise-3
-   Memcheck:Addr4
-   ...
-   fun:tlv_finalize
-   fun:_pthread_tsd_cleanup
-   fun:_pthread_exit
-   ...
-   fun:_pthread_start
-   fun:thread_start
-}
-
-{
-   down-with-thread-dtors.rs-fails-otherwise-4
-   Memcheck:Addr8
-   ...
-   fun:tlv_finalize
-   fun:_pthread_tsd_cleanup
-   fun:_pthread_exit
-   ...
-   fun:_pthread_start
-   fun:thread_start
-}
-
-{
-   down-with-thread-dtors.rs-fails-otherwise-5
-   Memcheck:Leak
-   match-leak-kinds: definite
-   fun:malloc
-   fun:tlv_allocate_and_initialize_for_key
-   fun:tlv_get_addr
-   ...
-   fun:start
-}
index b6f490e09cddf645b9daaa00864b87e6b63e1bf9..82d361fb0e853064ffa317b66e582f36f87b6660 100644 (file)
@@ -293,7 +293,6 @@ pub fn into_raw(b: Box<T>) -> *mut T {
     }
 }
 
-#[cfg(not(stage0))]
 #[stable(feature = "rust1", since = "1.0.0")]
 unsafe impl<#[may_dangle] T: ?Sized> Drop for Box<T> {
     fn drop(&mut self) {
index 81ed4be7763e945d1c9338fb3f105696f98abe57..51e6f2f8bd7a6d16f359e19abd9afb95cdb71a58 100644 (file)
@@ -143,14 +143,6 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
     }
 }
 
-#[cfg(not(test))]
-#[cfg(stage0)]
-#[lang = "exchange_free"]
-#[inline]
-unsafe fn exchange_free(ptr: *mut u8, old_size: usize, align: usize) {
-    deallocate(ptr, old_size, align);
-}
-
 #[cfg(not(test))]
 #[lang = "box_free"]
 #[inline]
index 010e378ef2f48238ea3880be935b6e2f1f25e737..6108a06634bb88cfaefafda0e88a76f80aa12e2d 100644 (file)
 //! pointer to the same value in the heap. When the last [`Rc`] pointer to a
 //! given value is destroyed, the pointed-to value is also destroyed.
 //!
-//! Shared references in Rust disallow mutation by default, and `Rc` is no
-//! exception. If you need to mutate through an [`Rc`], use [`Cell`] or
-//! [`RefCell`].
+//! Shared references in Rust disallow mutation by default, and [`Rc`]
+//! is no exception: you cannot obtain a mutable reference to
+//! something inside an [`Rc`]. If you need mutability, put a [`Cell`]
+//! or [`RefCell`] inside the [`Rc`]; see [an example of mutability
+//! inside an Rc][mutability].
 //!
 //! [`Rc`] uses non-atomic reference counting. This means that overhead is very
 //! low, but an [`Rc`] cannot be sent between threads, and consequently [`Rc`]
 //! [upgrade]: struct.Weak.html#method.upgrade
 //! [`None`]: ../../std/option/enum.Option.html#variant.None
 //! [assoc]: ../../book/method-syntax.html#associated-functions
+//! [mutability]: ../../std/cell/index.html#introducing-mutability-inside-of-something-immutable
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
index 1143df0c6302d85e022ea634ed0e1812b55af838..a3402bf399427be5dcc61f95f0f6df3b1f98831e 100644 (file)
 
 #![deny(warnings)]
 
+#[macro_use]
 extern crate build_helper;
 extern crate gcc;
 
 use std::env;
-use std::path::PathBuf;
+use std::fs::{self, File};
+use std::path::{Path, PathBuf};
 use std::process::Command;
-use build_helper::run;
+use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date};
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
     println!("cargo:rerun-if-changed=build.rs");
 
-    let target = env::var("TARGET").expect("TARGET was not set");
-    let host = env::var("HOST").expect("HOST was not set");
-    let build_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
-    let src_dir = env::current_dir().unwrap();
-
     // FIXME: This is a hack to support building targets that don't
     // support jemalloc alongside hosts that do. The jemalloc build is
     // controlled by a feature of the std crate, and if that feature
@@ -35,6 +31,8 @@ fn main() {
     // that the feature set used by std is the same across all
     // targets, which means we have to build the alloc_jemalloc crate
     // for targets like emscripten, even if we don't use it.
+    let target = env::var("TARGET").expect("TARGET was not set");
+    let host = env::var("HOST").expect("HOST was not set");
     if target.contains("rumprun") || target.contains("bitrig") || target.contains("openbsd") ||
        target.contains("msvc") || target.contains("emscripten") || target.contains("fuchsia") ||
        target.contains("redox") {
@@ -42,6 +40,12 @@ fn main() {
         return;
     }
 
+    if target.contains("android") {
+        println!("cargo:rustc-link-lib=gcc");
+    } else if !target.contains("windows") && !target.contains("musl") {
+        println!("cargo:rustc-link-lib=pthread");
+    }
+
     if let Some(jemalloc) = env::var_os("JEMALLOC_OVERRIDE") {
         let jemalloc = PathBuf::from(jemalloc);
         println!("cargo:rustc-link-search=native={}",
@@ -57,6 +61,23 @@ fn main() {
         return;
     }
 
+    let build_dir = env::var_os("RUSTBUILD_NATIVE_DIR").unwrap_or(env::var_os("OUT_DIR").unwrap());
+    let build_dir = PathBuf::from(build_dir).join("jemalloc");
+    let _ = fs::create_dir_all(&build_dir);
+
+    if target.contains("windows") {
+        println!("cargo:rustc-link-lib=static=jemalloc");
+    } else {
+        println!("cargo:rustc-link-lib=static=jemalloc_pic");
+    }
+    println!("cargo:rustc-link-search=native={}/lib", build_dir.display());
+    let src_dir = env::current_dir().unwrap().join("../jemalloc");
+    rerun_if_changed_anything_in_dir(&src_dir);
+    let timestamp = build_dir.join("rustbuild.timestamp");
+    if up_to_date(&Path::new("build.rs"), &timestamp) && up_to_date(&src_dir, &timestamp) {
+        return
+    }
+
     let compiler = gcc::Config::new().get_compiler();
     // only msvc returns None for ar so unwrap is okay
     let ar = build_helper::cc2ar(compiler.path(), &target).unwrap();
@@ -66,23 +87,8 @@ fn main() {
         .collect::<Vec<_>>()
         .join(" ");
 
-    let mut stack = src_dir.join("../jemalloc")
-        .read_dir()
-        .unwrap()
-        .map(|e| e.unwrap())
-        .filter(|e| &*e.file_name() != ".git")
-        .collect::<Vec<_>>();
-    while let Some(entry) = stack.pop() {
-        let path = entry.path();
-        if entry.file_type().unwrap().is_dir() {
-            stack.extend(path.read_dir().unwrap().map(|e| e.unwrap()));
-        } else {
-            println!("cargo:rerun-if-changed={}", path.display());
-        }
-    }
-
     let mut cmd = Command::new("sh");
-    cmd.arg(src_dir.join("../jemalloc/configure")
+    cmd.arg(src_dir.join("configure")
                    .to_str()
                    .unwrap()
                    .replace("C:\\", "/c/")
@@ -158,6 +164,7 @@ fn main() {
     }
 
     run(&mut cmd);
+
     let mut make = Command::new(build_helper::make(&host));
     make.current_dir(&build_dir)
         .arg("build_lib_static");
@@ -170,18 +177,6 @@ fn main() {
 
     run(&mut make);
 
-    if target.contains("windows") {
-        println!("cargo:rustc-link-lib=static=jemalloc");
-    } else {
-        println!("cargo:rustc-link-lib=static=jemalloc_pic");
-    }
-    println!("cargo:rustc-link-search=native={}/lib", build_dir.display());
-    if target.contains("android") {
-        println!("cargo:rustc-link-lib=gcc");
-    } else if !target.contains("windows") && !target.contains("musl") {
-        println!("cargo:rustc-link-lib=pthread");
-    }
-
     // The pthread_atfork symbols is used by jemalloc on android but the really
     // old android we're building on doesn't have them defined, so just make
     // sure the symbols are available.
@@ -192,4 +187,6 @@ fn main() {
             .file("pthread_atfork_dummy.c")
             .compile("libpthread_atfork_dummy.a");
     }
+
+    t!(File::create(&timestamp));
 }
index fc8a5455d1d07406a8e4557fd260534f441c3859..8d81a09f5af0fbf947726145a61a7c8f42235e57 100644 (file)
 mod imp {
     use libc::{c_int, c_void, size_t};
 
-    // Linkage directives to pull in jemalloc and its dependencies.
-    //
-    // On some platforms we need to be sure to link in `pthread` which jemalloc
-    // depends on, and specifically on android we need to also link to libgcc.
-    // Currently jemalloc is compiled with gcc which will generate calls to
-    // intrinsics that are libgcc specific (e.g. those intrinsics aren't present in
-    // libcompiler-rt), so link that in to get that support.
-    #[link(name = "jemalloc", kind = "static")]
-    #[cfg_attr(target_os = "android", link(name = "gcc"))]
-    #[cfg_attr(all(not(windows),
-                   not(target_os = "android"),
-                   not(target_env = "musl")),
-               link(name = "pthread"))]
-    #[cfg(not(cargobuild))]
-    extern "C" {}
-
     // Note that the symbols here are prefixed by default on OSX and Windows (we
     // don't explicitly request it), and on Android and DragonFly we explicitly
     // request it as unprefixing cause segfaults (mismatches in allocators).
index 04e0bafb14981c49b19b158c75588a78935827e6..2d6a9877219dcacac0a2fe31f6c4fe83193804e1 100644 (file)
@@ -607,7 +607,9 @@ coff_add (struct backtrace_state *state, int descriptor,
   //       against the upstream libbacktrace, that's what's going on.
   uint32_t str_size;
   off_t str_off;
-  struct backtrace_view syms_view;
+  // NOTE: upstream doesn't have `{0}`, this is a fix for Rust issue #39468.
+  //       If syms_view is not initialized, then `free(syms_view.base)` may segfault later.
+  struct backtrace_view syms_view = {0};
   off_t syms_off;
   size_t syms_size;
   int syms_view_valid;
index b7c2a708baf492f91dfdc0976ac8d7dced7dbbbe..a5a2f70492dc97daaa05e5ef2ee1a770f32173dc 100644 (file)
@@ -228,6 +228,15 @@ pub struct PeekMut<'a, T: 'a + Ord> {
     sift: bool,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("PeekMut")
+         .field(&self.heap.data[0])
+         .finish()
+    }
+}
+
 #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
 impl<'a, T: Ord> Drop for PeekMut<'a, T> {
     fn drop(&mut self) {
@@ -968,6 +977,15 @@ pub struct Iter<'a, T: 'a> {
     iter: slice::Iter<'a, T>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Iter")
+         .field(&self.iter.as_slice())
+         .finish()
+    }
+}
+
 // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Clone for Iter<'a, T> {
@@ -1016,6 +1034,15 @@ pub struct IntoIter<T> {
     iter: vec::IntoIter<T>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("IntoIter")
+         .field(&self.iter.as_slice())
+         .finish()
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> Iterator for IntoIter<T> {
     type Item = T;
@@ -1051,6 +1078,7 @@ impl<T> FusedIterator for IntoIter<T> {}
 
 /// An iterator that drains a `BinaryHeap`.
 #[stable(feature = "drain", since = "1.6.0")]
+#[derive(Debug)]
 pub struct Drain<'a, T: 'a> {
     iter: vec::Drain<'a, T>,
 }
@@ -1088,7 +1116,7 @@ fn is_empty(&self) -> bool {
 #[unstable(feature = "fused", issue = "35602")]
 impl<'a, T: 'a> FusedIterator for Drain<'a, T> {}
 
-#[stable(feature = "rust1", since = "1.0.0")]
+#[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
 impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {
     fn from(vec: Vec<T>) -> BinaryHeap<T> {
         let mut heap = BinaryHeap { data: vec };
@@ -1097,7 +1125,7 @@ fn from(vec: Vec<T>) -> BinaryHeap<T> {
     }
 }
 
-#[stable(feature = "rust1", since = "1.0.0")]
+#[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
 impl<T> From<BinaryHeap<T>> for Vec<T> {
     fn from(heap: BinaryHeap<T>) -> Vec<T> {
         heap.data
@@ -1200,6 +1228,17 @@ pub struct BinaryHeapPlace<'a, T: 'a>
     place: vec::PlaceBack<'a, T>,
 }
 
+#[unstable(feature = "collection_placement",
+           reason = "placement protocol is subject to change",
+           issue = "30172")]
+impl<'a, T: Clone + Ord + fmt::Debug> fmt::Debug for BinaryHeapPlace<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("BinaryHeapPlace")
+         .field(&self.place)
+         .finish()
+    }
+}
+
 #[unstable(feature = "collection_placement",
            reason = "placement protocol is subject to change",
            issue = "30172")]
index 4755f8a4c55a43b3095acde1749916fc56215ccb..e1fabe2cc496b2fb18c63fcd6984aec9ddd8279b 100644 (file)
@@ -270,8 +270,16 @@ pub struct Iter<'a, K: 'a, V: 'a> {
     length: usize,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_list().entries(self.clone()).finish()
+    }
+}
+
 /// A mutable iterator over a BTreeMap's entries.
 #[stable(feature = "rust1", since = "1.0.0")]
+#[derive(Debug)]
 pub struct IterMut<'a, K: 'a, V: 'a> {
     range: RangeMut<'a, K, V>,
     length: usize,
@@ -285,20 +293,46 @@ pub struct IntoIter<K, V> {
     length: usize,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IntoIter<K, V> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let range = Range {
+            front: self.front.reborrow(),
+            back: self.back.reborrow(),
+        };
+        f.debug_list().entries(range).finish()
+    }
+}
+
 /// An iterator over a BTreeMap's keys.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Keys<'a, K: 'a, V: 'a> {
     inner: Iter<'a, K, V>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Keys<'a, K, V> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_list().entries(self.inner.clone()).finish()
+    }
+}
+
 /// An iterator over a BTreeMap's values.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Values<'a, K: 'a, V: 'a> {
     inner: Iter<'a, K, V>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_list().entries(self.inner.clone()).finish()
+    }
+}
+
 /// A mutable iterator over a BTreeMap's values.
 #[stable(feature = "map_values_mut", since = "1.10.0")]
+#[derive(Debug)]
 pub struct ValuesMut<'a, K: 'a, V: 'a> {
     inner: IterMut<'a, K, V>,
 }
@@ -309,6 +343,13 @@ pub struct Range<'a, K: 'a, V: 'a> {
     back: Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_list().entries(self.clone()).finish()
+    }
+}
+
 /// A mutable iterator over a sub-range of BTreeMap's entries.
 pub struct RangeMut<'a, K: 'a, V: 'a> {
     front: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>,
@@ -318,6 +359,17 @@ pub struct RangeMut<'a, K: 'a, V: 'a> {
     _marker: PhantomData<&'a mut (K, V)>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let range = Range {
+            front: self.front.reborrow(),
+            back: self.back.reborrow(),
+        };
+        f.debug_list().entries(range).finish()
+    }
+}
+
 /// A view into a single entry in a map, which may either be vacant or occupied.
 /// This enum is constructed from the [`entry`] method on [`BTreeMap`].
 ///
index f006ba95371611ecb402bbde92048c36217e4f77..bfffa0b8efa1cb074168f78c6217055e5371caed 100644 (file)
@@ -85,6 +85,15 @@ pub struct Iter<'a, T: 'a> {
     iter: Keys<'a, T, ()>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Iter")
+         .field(&self.iter.clone())
+         .finish()
+    }
+}
+
 /// An owning iterator over a `BTreeSet`'s items.
 ///
 /// This structure is created by the `into_iter` method on [`BTreeSet`]
@@ -92,6 +101,7 @@ pub struct Iter<'a, T: 'a> {
 ///
 /// [`BTreeSet`]: struct.BTreeSet.html
 #[stable(feature = "rust1", since = "1.0.0")]
+#[derive(Debug)]
 pub struct IntoIter<T> {
     iter: ::btree_map::IntoIter<T, ()>,
 }
@@ -102,6 +112,7 @@ pub struct IntoIter<T> {
 ///
 /// [`BTreeSet`]: struct.BTreeSet.html
 /// [`range`]: struct.BTreeSet.html#method.range
+#[derive(Debug)]
 pub struct Range<'a, T: 'a> {
     iter: ::btree_map::Range<'a, T, ()>,
 }
@@ -118,6 +129,15 @@ pub struct Difference<'a, T: 'a> {
     b: Peekable<Iter<'a, T>>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Difference")
+         .field(&self.clone())
+         .finish()
+    }
+}
+
 /// A lazy iterator producing elements in the set symmetric difference (in-order).
 ///
 /// This structure is created by the [`symmetric_difference`] method on
@@ -131,6 +151,15 @@ pub struct SymmetricDifference<'a, T: 'a> {
     b: Peekable<Iter<'a, T>>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("SymmetricDifference")
+         .field(&self.clone())
+         .finish()
+    }
+}
+
 /// A lazy iterator producing elements in the set intersection (in-order).
 ///
 /// This structure is created by the [`intersection`] method on [`BTreeSet`].
@@ -143,6 +172,15 @@ pub struct Intersection<'a, T: 'a> {
     b: Peekable<Iter<'a, T>>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Intersection")
+         .field(&self.clone())
+         .finish()
+    }
+}
+
 /// A lazy iterator producing elements in the set union (in-order).
 ///
 /// This structure is created by the [`union`] method on [`BTreeSet`].
@@ -155,6 +193,15 @@ pub struct Union<'a, T: 'a> {
     b: Peekable<Iter<'a, T>>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for Union<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Union")
+         .field(&self.clone())
+         .finish()
+    }
+}
+
 impl<T: Ord> BTreeSet<T> {
     /// Makes a new `BTreeSet` with a reasonable choice of B.
     ///
index 78b610797778190f398d75eafbadcb0f4b4a25a5..602e874aaeec0de2d0416b93f67e6733a3ed27a7 100644 (file)
@@ -222,6 +222,14 @@ pub struct Iter<E> {
     marker: marker::PhantomData<E>,
 }
 
+impl<E: fmt::Debug> fmt::Debug for Iter<E> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Iter")
+         .field(&self.clone())
+         .finish()
+    }
+}
+
 // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
 impl<E> Clone for Iter<E> {
     fn clone(&self) -> Iter<E> {
index 883417e9f4ec76c90bcc9f3e4dbc7dc32dafe1cb..bd74848a01d8362f150b23701c6af47359f10f8f 100644 (file)
 /// [format!]: ../macro.format.html
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn format(args: Arguments) -> string::String {
-    let mut output = string::String::new();
+    let capacity = args.estimated_capacity();
+    let mut output = string::String::with_capacity(capacity);
     let _ = output.write_fmt(args);
     output
 }
index 39de87c08407f5bcea0f9050c2557758e403e28d..53d5466e12bb0cdec2a72a79295df5dd15f6afe1 100644 (file)
@@ -28,6 +28,7 @@
 
 #![cfg_attr(test, allow(deprecated))] // rand
 #![deny(warnings)]
+#![deny(missing_debug_implementations)]
 
 #![feature(alloc)]
 #![feature(allow_internal_unstable)]
index 7f913d4afe476aeea2c8611f3e87062f9bbb76fd..d4f77d625b361d4633f2a538486d02d1fc3dd218 100644 (file)
@@ -65,6 +65,15 @@ pub struct Iter<'a, T: 'a> {
     marker: PhantomData<&'a Node<T>>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Iter")
+         .field(&self.clone())
+         .finish()
+    }
+}
+
 // FIXME #19839: deriving is too aggressive on the bounds (T doesn't need to be Clone).
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Clone for Iter<'a, T> {
@@ -82,6 +91,15 @@ pub struct IterMut<'a, T: 'a> {
     len: usize,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("IterMut")
+         .field(self.clone())
+         .finish()
+    }
+}
+
 /// An iterator over the elements of a `LinkedList`.
 #[derive(Clone)]
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -89,6 +107,15 @@ pub struct IntoIter<T> {
     list: LinkedList<T>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("IntoIter")
+         .field(self.clone())
+         .finish()
+    }
+}
+
 impl<T> Node<T> {
     fn new(element: T) -> Self {
         Node {
@@ -1077,6 +1104,17 @@ pub struct FrontPlace<'a, T: 'a> {
     node: IntermediateBox<Node<T>>,
 }
 
+#[unstable(feature = "collection_placement",
+           reason = "struct name and placement protocol are subject to change",
+           issue = "30172")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for FrontPlace<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("FrontPlace")
+         .field(self.clone())
+         .finish()
+    }
+}
+
 #[unstable(feature = "collection_placement",
            reason = "placement protocol is subject to change",
            issue = "30172")]
@@ -1121,6 +1159,17 @@ pub struct BackPlace<'a, T: 'a> {
     node: IntermediateBox<Node<T>>,
 }
 
+#[unstable(feature = "collection_placement",
+           reason = "struct name and placement protocol are subject to change",
+           issue = "30172")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for BackPlace<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("BackPlace")
+         .field(self.clone())
+         .finish()
+    }
+}
+
 #[unstable(feature = "collection_placement",
            reason = "placement protocol is subject to change",
            issue = "30172")]
index 11f513ed798e07edbb7509eddf14f96cab145d6d..2ea953df8735729b6d02dbecf7453d1a07615d9d 100644 (file)
@@ -98,7 +98,7 @@
 #![cfg_attr(test, allow(unused_imports, dead_code))]
 
 use alloc::boxed::Box;
-use core::cmp::Ordering::{self, Greater};
+use core::cmp::Ordering::{self, Less};
 use core::mem::size_of;
 use core::mem;
 use core::ptr;
@@ -1089,7 +1089,7 @@ pub fn binary_search_by_key<'a, B, F>(&'a self, b: &B, f: F) -> Result<usize, us
     pub fn sort(&mut self)
         where T: Ord
     {
-        self.sort_by(|a, b| a.cmp(b))
+        merge_sort(self, |a, b| a.lt(b));
     }
 
     /// Sorts the slice using `f` to extract a key to compare elements by.
@@ -1119,7 +1119,7 @@ pub fn sort(&mut self)
     pub fn sort_by_key<B, F>(&mut self, mut f: F)
         where F: FnMut(&T) -> B, B: Ord
     {
-        self.sort_by(|a, b| f(a).cmp(&f(b)))
+        merge_sort(self, |a, b| f(a).lt(&f(b)));
     }
 
     /// Sorts the slice using `compare` to compare elements.
@@ -1149,10 +1149,10 @@ pub fn sort_by_key<B, F>(&mut self, mut f: F)
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn sort_by<F>(&mut self, compare: F)
+    pub fn sort_by<F>(&mut self, mut compare: F)
         where F: FnMut(&T, &T) -> Ordering
     {
-        merge_sort(self, compare)
+        merge_sort(self, |a, b| compare(a, b) == Less);
     }
 
     /// Copies the elements from `src` into `self`.
@@ -1355,10 +1355,10 @@ fn to_owned(&self) -> Vec<T> {
 /// Inserts `v[0]` into pre-sorted sequence `v[1..]` so that whole `v[..]` becomes sorted.
 ///
 /// This is the integral subroutine of insertion sort.
-fn insert_head<T, F>(v: &mut [T], compare: &mut F)
-    where F: FnMut(&T, &T) -> Ordering
+fn insert_head<T, F>(v: &mut [T], is_less: &mut F)
+    where F: FnMut(&T, &T) -> bool
 {
-    if v.len() >= 2 && compare(&v[0], &v[1]) == Greater {
+    if v.len() >= 2 && is_less(&v[1], &v[0]) {
         unsafe {
             // There are three ways to implement insertion here:
             //
@@ -1381,12 +1381,12 @@ fn insert_head<T, F>(v: &mut [T], compare: &mut F)
 
             // Intermediate state of the insertion process is always tracked by `hole`, which
             // serves two purposes:
-            // 1. Protects integrity of `v` from panics in `compare`.
+            // 1. Protects integrity of `v` from panics in `is_less`.
             // 2. Fills the remaining hole in `v` in the end.
             //
             // Panic safety:
             //
-            // If `compare` panics at any point during the process, `hole` will get dropped and
+            // If `is_less` panics at any point during the process, `hole` will get dropped and
             // fill the hole in `v` with `tmp`, thus ensuring that `v` still holds every object it
             // initially held exactly once.
             let mut hole = InsertionHole {
@@ -1396,7 +1396,7 @@ fn insert_head<T, F>(v: &mut [T], compare: &mut F)
             ptr::copy_nonoverlapping(&v[1], &mut v[0], 1);
 
             for i in 2..v.len() {
-                if compare(&tmp.value, &v[i]) != Greater {
+                if !is_less(&v[i], &tmp.value) {
                     break;
                 }
                 ptr::copy_nonoverlapping(&v[i], &mut v[i - 1], 1);
@@ -1432,8 +1432,8 @@ fn drop(&mut self) {
 ///
 /// The two slices must be non-empty and `mid` must be in bounds. Buffer `buf` must be long enough
 /// to hold a copy of the shorter slice. Also, `T` must not be a zero-sized type.
-unsafe fn merge<T, F>(v: &mut [T], mid: usize, buf: *mut T, compare: &mut F)
-    where F: FnMut(&T, &T) -> Ordering
+unsafe fn merge<T, F>(v: &mut [T], mid: usize, buf: *mut T, is_less: &mut F)
+    where F: FnMut(&T, &T) -> bool
 {
     let len = v.len();
     let v = v.as_mut_ptr();
@@ -1449,12 +1449,12 @@ unsafe fn merge<T, F>(v: &mut [T], mid: usize, buf: *mut T, compare: &mut F)
     // hole in `v`.
     //
     // Intermediate state of the process is always tracked by `hole`, which serves two purposes:
-    // 1. Protects integrity of `v` from panics in `compare`.
+    // 1. Protects integrity of `v` from panics in `is_less`.
     // 2. Fills the remaining hole in `v` if the longer run gets consumed first.
     //
     // Panic safety:
     //
-    // If `compare` panics at any point during the process, `hole` will get dropped and fill the
+    // If `is_less` panics at any point during the process, `hole` will get dropped and fill the
     // hole in `v` with the unconsumed range in `buf`, thus ensuring that `v` still holds every
     // object it initially held exactly once.
     let mut hole;
@@ -1476,7 +1476,7 @@ unsafe fn merge<T, F>(v: &mut [T], mid: usize, buf: *mut T, compare: &mut F)
         while *left < hole.end && right < v_end {
             // Consume the lesser side.
             // If equal, prefer the left run to maintain stability.
-            let to_copy = if compare(&**left, &*right) == Greater {
+            let to_copy = if is_less(&*right, &**left) {
                 get_and_increment(&mut right)
             } else {
                 get_and_increment(left)
@@ -1500,7 +1500,7 @@ unsafe fn merge<T, F>(v: &mut [T], mid: usize, buf: *mut T, compare: &mut F)
         while v < *left && buf < *right {
             // Consume the greater side.
             // If equal, prefer the right run to maintain stability.
-            let to_copy = if compare(&*left.offset(-1), &*right.offset(-1)) == Greater {
+            let to_copy = if is_less(&*right.offset(-1), &*left.offset(-1)) {
                 decrement_and_get(left)
             } else {
                 decrement_and_get(right)
@@ -1550,8 +1550,8 @@ fn drop(&mut self) {
 /// 2. for every `i` in `2..runs.len()`: `runs[i - 2].len > runs[i - 1].len + runs[i].len`
 ///
 /// The invariants ensure that the total running time is `O(n log n)` worst-case.
-fn merge_sort<T, F>(v: &mut [T], mut compare: F)
-    where F: FnMut(&T, &T) -> Ordering
+fn merge_sort<T, F>(v: &mut [T], mut is_less: F)
+    where F: FnMut(&T, &T) -> bool
 {
     // Sorting has no meaningful behavior on zero-sized types.
     if size_of::<T>() == 0 {
@@ -1565,7 +1565,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F)
     //
     // Short runs are extended using insertion sort to span at least `min_run` elements, in order
     // to improve performance.
-    let (max_insertion, min_run) = if size_of::<T>() <= 16 {
+    let (max_insertion, min_run) = if size_of::<T>() <= 2 * mem::size_of::<usize>() {
         (64, 32)
     } else {
         (32, 16)
@@ -1577,7 +1577,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F)
     if len <= max_insertion {
         if len >= 2 {
             for i in (0..len-1).rev() {
-                insert_head(&mut v[i..], &mut compare);
+                insert_head(&mut v[i..], &mut is_less);
             }
         }
         return;
@@ -1585,7 +1585,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F)
 
     // Allocate a buffer to use as scratch memory. We keep the length 0 so we can keep in it
     // shallow copies of the contents of `v` without risking the dtors running on copies if
-    // `compare` panics. When merging two sorted runs, this buffer holds a copy of the shorter run,
+    // `is_less` panics. When merging two sorted runs, this buffer holds a copy of the shorter run,
     // which will always have length at most `len / 2`.
     let mut buf = Vec::with_capacity(len / 2);
 
@@ -1600,14 +1600,18 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F)
         let mut start = end - 1;
         if start > 0 {
             start -= 1;
-            if compare(&v[start], &v[start + 1]) == Greater {
-                while start > 0 && compare(&v[start - 1], &v[start]) == Greater {
-                    start -= 1;
-                }
-                v[start..end].reverse();
-            } else {
-                while start > 0 && compare(&v[start - 1], &v[start]) != Greater {
-                    start -= 1;
+            unsafe {
+                if is_less(v.get_unchecked(start + 1), v.get_unchecked(start)) {
+                    while start > 0 && is_less(v.get_unchecked(start),
+                                               v.get_unchecked(start - 1)) {
+                        start -= 1;
+                    }
+                    v[start..end].reverse();
+                } else {
+                    while start > 0 && !is_less(v.get_unchecked(start),
+                                                v.get_unchecked(start - 1)) {
+                        start -= 1;
+                    }
                 }
             }
         }
@@ -1616,7 +1620,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F)
         // merge sort on short sequences, so this significantly improves performance.
         while start > 0 && end - start < min_run {
             start -= 1;
-            insert_head(&mut v[start..end], &mut compare);
+            insert_head(&mut v[start..end], &mut is_less);
         }
 
         // Push this run onto the stack.
@@ -1632,7 +1636,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F)
             let right = runs[r];
             unsafe {
                 merge(&mut v[left.start .. right.start + right.len], left.len, buf.as_mut_ptr(),
-                      &mut compare);
+                      &mut is_less);
             }
             runs[r] = Run {
                 start: left.start,
index 458d5114829f459b404ddcb8e34debd5b553fd5b..87315fff0a07d915f8ac09aeb5d603e946730409 100644 (file)
@@ -19,6 +19,7 @@
 // It's cleaner to just turn off the unused_imports warning than to fix them.
 #![allow(unused_imports)]
 
+use core::fmt;
 use core::str as core_str;
 use core::str::pattern::Pattern;
 use core::str::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher};
@@ -122,6 +123,13 @@ pub struct EncodeUtf16<'a> {
     encoder: Utf16Encoder<Chars<'a>>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a> fmt::Debug for EncodeUtf16<'a> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.pad("EncodeUtf16 { .. }")
+    }
+}
+
 #[stable(feature = "encode_utf16", since = "1.8.0")]
 impl<'a> Iterator for EncodeUtf16<'a> {
     type Item = u16;
index b184a8603e6bd1be5fa4568e3a68ab46174d9e64..4c82e2e2e7e35ea15299172a20efaf543874e15a 100644 (file)
@@ -1866,6 +1866,22 @@ fn to_string(&self) -> String {
     }
 }
 
+#[stable(feature = "cow_str_to_string_specialization", since = "1.17.0")]
+impl<'a> ToString for Cow<'a, str> {
+    #[inline]
+    fn to_string(&self) -> String {
+        self[..].to_owned()
+    }
+}
+
+#[stable(feature = "string_to_string_specialization", since = "1.17.0")]
+impl ToString for String {
+    #[inline]
+    fn to_string(&self) -> String {
+        self.to_owned()
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl AsRef<str> for String {
     #[inline]
@@ -1974,6 +1990,13 @@ pub struct Drain<'a> {
     iter: Chars<'a>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a> fmt::Debug for Drain<'a> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.pad("Drain { .. }")
+    }
+}
+
 #[stable(feature = "drain", since = "1.6.0")]
 unsafe impl<'a> Sync for Drain<'a> {}
 #[stable(feature = "drain", since = "1.6.0")]
index 1f8fd32da9ab8829bbd5a1b2308ad07ce35c86ea..dc0f33d9bc3e00d82e0ca9a5d92d835050bc218a 100644 (file)
@@ -1958,7 +1958,7 @@ pub fn as_slice(&self) -> &[T] {
     /// assert_eq!(into_iter.next().unwrap(), 'z');
     /// ```
     #[stable(feature = "vec_into_iter_as_slice", since = "1.15.0")]
-    pub fn as_mut_slice(&self) -> &mut [T] {
+    pub fn as_mut_slice(&mut self) -> &mut [T] {
         unsafe {
             slice::from_raw_parts_mut(self.ptr as *mut T, self.len())
         }
@@ -2089,6 +2089,15 @@ pub struct Drain<'a, T: 'a> {
     vec: Shared<Vec<T>>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Drain")
+         .field(&self.iter.as_slice())
+         .finish()
+    }
+}
+
 #[stable(feature = "drain", since = "1.6.0")]
 unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {}
 #[stable(feature = "drain", since = "1.6.0")]
@@ -2155,6 +2164,7 @@ impl<'a, T> FusedIterator for Drain<'a, T> {}
 #[unstable(feature = "collection_placement",
            reason = "struct name and placement protocol are subject to change",
            issue = "30172")]
+#[derive(Debug)]
 pub struct PlaceBack<'a, T: 'a> {
     vec: &'a mut Vec<T>,
 }
index 5e1adb3d808ce1bb71cd0d38d7fdf618a9d5f589..8d42045ff16372cbaccdfc7b80124488d4c444b2 100644 (file)
@@ -1856,6 +1856,15 @@ pub struct Iter<'a, T: 'a> {
     head: usize,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Iter")
+         .field(&self.clone())
+         .finish()
+    }
+}
+
 // FIXME(#19839) Remove in favor of `#[derive(Clone)]`
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Clone for Iter<'a, T> {
@@ -1928,6 +1937,15 @@ pub struct IterMut<'a, T: 'a> {
     head: usize,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("IterMut")
+         .field(&self.clone())
+         .finish()
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Iterator for IterMut<'a, T> {
     type Item = &'a mut T;
@@ -1994,6 +2012,15 @@ pub struct IntoIter<T> {
     inner: VecDeque<T>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("IntoIter")
+         .field(&self.clone())
+         .finish()
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> Iterator for IntoIter<T> {
     type Item = T;
@@ -2037,6 +2064,15 @@ pub struct Drain<'a, T: 'a> {
     deque: Shared<VecDeque<T>>,
 }
 
+#[stable(feature = "collection_debug", since = "1.17.0")]
+impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Drain")
+         .field(&self.clone())
+         .finish()
+    }
+}
+
 #[stable(feature = "drain", since = "1.6.0")]
 unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {}
 #[stable(feature = "drain", since = "1.6.0")]
index 1b52214dee6aebd0c7cf31eca00f8573764eab2c..b9dec6be7b8853b9401c6089b6455e049bec145a 100644 (file)
@@ -1429,18 +1429,15 @@ fn $name(b: &mut Bencher) {
     fn sort_large_random_expensive(b: &mut Bencher) {
         let len = 10000;
         b.iter(|| {
+            let mut v = gen_random(len);
             let mut count = 0;
-            let cmp = move |a: &u64, b: &u64| {
+            v.sort_by(|a: &u64, b: &u64| {
                 count += 1;
                 if count % 1_000_000_000 == 0 {
                     panic!("should not happen");
                 }
                 (*a as f64).cos().partial_cmp(&(*b as f64).cos()).unwrap()
-            };
-
-            let mut v = gen_random(len);
-            v.sort_by(cmp);
-
+            });
             black_box(count);
         });
         b.bytes = len as u64 * mem::size_of::<u64>() as u64;
index b9421d779b590eba0d053bf264c174145f7c3784..5360bbdeacd6ad280b93535ed6a6fc5de949dd15 100644 (file)
@@ -240,7 +240,7 @@ fn main() {
             sources.extend(&["x86_64/floatdidf.c", "x86_64/floatdisf.c", "x86_64/floatdixf.c"]);
         }
     } else {
-        if !target.contains("freebsd") {
+        if !target.contains("freebsd") && !target.contains("netbsd") {
             sources.extend(&["gcc_personality_v0.c"]);
         }
 
index 662d7422f5f001651c9f6684a263ef32f629d747..482d70895ff89235307cc6e2cb858fef839e4b53 100644 (file)
@@ -20,7 +20,6 @@
 #![feature(staged_api, core_intrinsics, repr_simd,
            i128_type, core_float, abi_unadjusted, associated_consts)]
 #![allow(non_camel_case_types, unused_variables, unused_imports)]
-#![cfg_attr(stage0, allow(dead_code))]
 
 #[cfg(any(target_pointer_width="32", target_pointer_width="16", target_os="windows",
           target_arch="mips64"))]
@@ -32,17 +31,6 @@ pub mod reimpls {
     use core::intrinsics::unchecked_rem;
     use core::ptr;
 
-    // C API is expected to tolerate some amount of size mismatch in ABI. Hopefully the amount of
-    // handling is sufficient for bootstrapping.
-    #[cfg(stage0)]
-    type u128_ = u64;
-    #[cfg(stage0)]
-    type i128_ = i64;
-    #[cfg(not(stage0))]
-    type u128_ = u128;
-    #[cfg(not(stage0))]
-    type i128_ = i128;
-
     macro_rules! ashl {
         ($a:expr, $b:expr, $ty:ty) => {{
             let (a, b) = ($a, $b);
@@ -63,8 +51,8 @@ macro_rules! ashl {
     }
 
     #[export_name="__ashlti3"]
-    pub extern "C" fn shl(a: u128_, b: u128_) -> u128_ {
-        ashl!(a, b, u128_)
+    pub extern "C" fn shl(a: u128, b: u128) -> u128 {
+        ashl!(a, b, u128)
     }
 
     macro_rules! ashr {
@@ -88,8 +76,8 @@ macro_rules! ashr {
     }
 
     #[export_name="__ashrti3"]
-    pub extern "C" fn shr(a: i128_, b: i128_) -> i128_ {
-        ashr!(a, b, i128_)
+    pub extern "C" fn shr(a: i128, b: i128) -> i128 {
+        ashr!(a, b, i128)
     }
 
     macro_rules! lshr {
@@ -111,22 +99,11 @@ macro_rules! lshr {
 
 
     #[export_name="__lshrti3"]
-    pub extern "C" fn lshr(a: u128_, b: u128_) -> u128_ {
-        lshr!(a, b, u128_)
-    }
-
-    #[cfg(stage0)]
-    pub extern "C" fn u128_div_mod(n: u128_, d: u128_, rem: *mut u128_) -> u128_ {
-        unsafe {
-        if !rem.is_null() {
-            *rem = unchecked_rem(n, d);
-        }
-        unchecked_div(n, d)
-        }
+    pub extern "C" fn lshr(a: u128, b: u128) -> u128 {
+        lshr!(a, b, u128)
     }
 
-    #[cfg(not(stage0))]
-    pub extern "C" fn u128_div_mod(n: u128_, d: u128_, rem: *mut u128_) -> u128_ {
+    pub extern "C" fn u128_div_mod(n: u128, d: u128, rem: *mut u128) -> u128 {
         // Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide
         unsafe {
         // special cases, X is unknown, K != 0
@@ -291,36 +268,30 @@ pub extern "C" fn u128_div_mod(n: u128_, d: u128_, rem: *mut u128_) -> u128_ {
         }
     }
 
-    fn i128_mod(a: i128_, b: i128_) -> i128_ {
+    fn i128_mod(a: i128, b: i128) -> i128 {
         let b = b.uabs();
         let sa = a.signum();
         let a = a.uabs();
         unsafe {
             let mut r = ::core::mem::zeroed();
             u128_div_mod(a, b, &mut r);
-            if sa == -1 { (r as i128_).unchecked_neg() } else { r as i128_ }
+            if sa == -1 { (r as i128).unchecked_neg() } else { r as i128 }
         }
     }
 
-    fn i128_div(a: i128_, b: i128_) -> i128_ {
+    fn i128_div(a: i128, b: i128) -> i128 {
         let sa = a.signum();
         let sb = b.signum();
         let a = a.uabs();
         let b = b.uabs();
         let sr = sa.wrapping_mul(sb); // sign of quotient
         (if sr == -1 {
-            (u128_div_mod(a, b, ptr::null_mut()) as i128_).unchecked_neg()
+            (u128_div_mod(a, b, ptr::null_mut()) as i128).unchecked_neg()
         } else {
-            u128_div_mod(a, b, ptr::null_mut()) as i128_
+            u128_div_mod(a, b, ptr::null_mut()) as i128
         })
     }
 
-    #[cfg(stage0)]
-    #[export_name="__udivti3"]
-    pub extern "C" fn u128_div(a: u128_, b: u128_) -> u128_ {
-        (a / b)
-    }
-
     macro_rules! mulo {
         ($a:expr, $b:expr, $o: expr, $ty: ty) => {{
             let (a, b, overflow) = ($a, $b, $o);
@@ -367,35 +338,6 @@ pub trait LargeInt {
         fn high(self) -> Self::HighHalf;
         fn from_parts(low: Self::LowHalf, high: Self::HighHalf) -> Self;
     }
-    impl LargeInt for u64 {
-        type LowHalf = u32;
-        type HighHalf = u32;
-
-        fn low(self) -> u32 {
-            self as u32
-        }
-        fn high(self) -> u32 {
-            (self.wrapping_shr(32)) as u32
-        }
-        fn from_parts(low: u32, high: u32) -> u64 {
-            low as u64 | (high as u64).wrapping_shl(32)
-        }
-    }
-    impl LargeInt for i64 {
-        type LowHalf = u32;
-        type HighHalf = i32;
-
-        fn low(self) -> u32 {
-            self as u32
-        }
-        fn high(self) -> i32 {
-            self.wrapping_shr(32) as i32
-        }
-        fn from_parts(low: u32, high: i32) -> i64 {
-            u64::from_parts(low, high as u32) as i64
-        }
-    }
-    #[cfg(not(stage0))]
     impl LargeInt for u128 {
         type LowHalf = u64;
         type HighHalf = u64;
@@ -410,7 +352,6 @@ fn from_parts(low: u64, high: u64) -> u128 {
             (high as u128).wrapping_shl(64) | low as u128
         }
     }
-    #[cfg(not(stage0))]
     impl LargeInt for i128 {
         type LowHalf = u64;
         type HighHalf = i64;
@@ -455,47 +396,31 @@ macro_rules! mul {
         }}
     }
 
-    #[cfg(stage0)]
     #[export_name="__multi3"]
-    pub extern "C" fn u128_mul(a: i128_, b: i128_) -> i128_ {
-        ((a as i64).wrapping_mul(b as i64) as i128_)
-    }
-
-    #[cfg(not(stage0))]
-    #[export_name="__multi3"]
-    pub extern "C" fn u128_mul(a: i128_, b: i128_) -> i128_ {
-        mul!(a, b, i128_, i64)
+    pub extern "C" fn u128_mul(a: i128, b: i128) -> i128 {
+        mul!(a, b, i128, i64)
     }
 
     trait AbsExt: Sized {
-        fn uabs(self) -> u128_ {
-            self.iabs() as u128_
-        }
-        fn iabs(self) -> i128_;
-    }
-
-    #[cfg(stage0)]
-    impl AbsExt for i128_ {
-        fn iabs(self) -> i128_ {
-            let s = self >> 63;
-            ((self ^ s).wrapping_sub(s))
+        fn uabs(self) -> u128 {
+            self.iabs() as u128
         }
+        fn iabs(self) -> i128;
     }
 
-    #[cfg(not(stage0))]
-    impl AbsExt for i128_ {
-        fn iabs(self) -> i128_ {
+    impl AbsExt for i128 {
+        fn iabs(self) -> i128 {
             let s = self >> 127;
             ((self ^ s).wrapping_sub(s))
         }
     }
 
     trait NegExt: Sized {
-        fn unchecked_neg(self) -> i128_;
+        fn unchecked_neg(self) -> i128;
     }
 
-    impl NegExt for i128_ {
-        fn unchecked_neg(self) -> i128_ {
+    impl NegExt for i128 {
+        fn unchecked_neg(self) -> i128 {
             (!self).wrapping_add(1)
         }
     }
@@ -551,9 +476,9 @@ macro_rules! float_as_unsigned {
             let exponent = $from.get_exponent();
             let mantissa_fraction = repr & <$fromty as FloatStuff>::MANTISSA_MASK;
             let mantissa = mantissa_fraction | <$fromty as FloatStuff>::MANTISSA_LEAD_BIT;
-            if sign == -1.0 || exponent < 0 { return 0 as u128_; }
+            if sign == -1.0 || exponent < 0 { return 0 as u128; }
             if exponent > ::core::mem::size_of::<$outty>() as i32 * 8 {
-                return !(0 as u128_);
+                return !(0 as u128);
             }
             (if exponent < (<$fromty as FloatStuff>::MANTISSA_BITS) as i32 {
                 (mantissa as $outty)
@@ -576,7 +501,7 @@ macro_rules! float_as_signed {
             let mantissa_fraction = repr & <$fromty as FloatStuff>::MANTISSA_MASK;
             let mantissa = mantissa_fraction | <$fromty as FloatStuff>::MANTISSA_LEAD_BIT;
 
-            if exponent < 0 { return 0 as i128_; }
+            if exponent < 0 { return 0 as i128; }
             if exponent > ::core::mem::size_of::<$outty>() as i32 * 8 {
                 let ret = if sign > 0.0 { <$outty>::max_value() } else { <$outty>::min_value() };
                 return ret
@@ -595,7 +520,7 @@ macro_rules! float_as_signed {
     }
 
 
-    fn i128_as_f64(a: i128_) -> f64 {
+    fn i128_as_f64(a: i128) -> f64 {
         match a.signum() {
             1 => u128_as_f64(a.uabs()),
             0 => 0.0,
@@ -603,7 +528,7 @@ fn i128_as_f64(a: i128_) -> f64 {
         }
     }
 
-    fn i128_as_f32(a: i128_) -> f32 {
+    fn i128_as_f32(a: i128) -> f32 {
         match a.signum() {
             1 => u128_as_f32(a.uabs()),
             0 => 0.0,
@@ -611,7 +536,7 @@ fn i128_as_f32(a: i128_) -> f32 {
         }
     }
 
-    fn u128_as_f64(mut a: u128_) -> f64 {
+    fn u128_as_f64(mut a: u128) -> f64 {
         use ::core::f64::MANTISSA_DIGITS;
         if a == 0 { return 0.0; }
         let sd = 128u32.wrapping_sub(a.leading_zeros());
@@ -619,8 +544,7 @@ fn u128_as_f64(mut a: u128_) -> f64 {
         const MD1 : u32 = MANTISSA_DIGITS + 1;
         const MD2 : u32 = MANTISSA_DIGITS + 2;
 
-        // SNAP: replace this with !0u128
-        let negn :u128_ = !0;
+        let negn = !0u128;
 
         if sd > MANTISSA_DIGITS {
             a = match sd {
@@ -628,7 +552,7 @@ fn u128_as_f64(mut a: u128_) -> f64 {
                 MD2 => a,
                 _ => a.wrapping_shr(sd.wrapping_sub(MANTISSA_DIGITS + 2)) |
                      (if (a & (negn.wrapping_shr(128 + MANTISSA_DIGITS + 2)
-                                   .wrapping_sub(sd as u128_))) == 0 { 0 } else { 1 })
+                                   .wrapping_sub(sd as u128))) == 0 { 0 } else { 1 })
             };
             a |= if (a & 4) == 0 { 0 } else { 1 };
             a = a.wrapping_add(1);
@@ -646,7 +570,7 @@ fn u128_as_f64(mut a: u128_) -> f64 {
         }
     }
 
-    fn u128_as_f32(mut a: u128_) -> f32 {
+    fn u128_as_f32(mut a: u128) -> f32 {
         use ::core::f32::MANTISSA_DIGITS;
         if a == 0 { return 0.0; }
         let sd = 128u32.wrapping_sub(a.leading_zeros());
@@ -654,8 +578,7 @@ fn u128_as_f32(mut a: u128_) -> f32 {
         const MD1 : u32 = MANTISSA_DIGITS + 1;
         const MD2 : u32 = MANTISSA_DIGITS + 2;
 
-        // SNAP: replace this with !0u128
-        let negn :u128_ = !0;
+        let negn = !0u128;
 
         if sd > MANTISSA_DIGITS {
             a = match sd {
@@ -663,7 +586,7 @@ fn u128_as_f32(mut a: u128_) -> f32 {
                 MD2 => a,
                 _ => a.wrapping_shr(sd.wrapping_sub(MANTISSA_DIGITS + 2)) |
                      (if (a & (negn.wrapping_shr(128 + MANTISSA_DIGITS + 2)
-                                   .wrapping_sub(sd as u128_))) == 0 { 0 } else { 1 })
+                                   .wrapping_sub(sd as u128))) == 0 { 0 } else { 1 })
             };
             a |= if (a & 4) == 0 { 0 } else { 1 };
             a = a.wrapping_add(1);
@@ -684,7 +607,7 @@ fn u128_as_f32(mut a: u128_) -> f32 {
 
     macro_rules! why_are_abi_strings_checked_by_parser { ($cret:ty, $conv:expr, $unadj:tt) => {
     mod imp {
-        use super::{i128_, u128_, LargeInt, FloatStuff, NegExt, AbsExt};
+        use super::{LargeInt, FloatStuff, NegExt, AbsExt};
         use super::{i128_as_f64, i128_as_f32, u128_as_f64, u128_as_f32,
                     i128_div, i128_mod, u128_div_mod, unchecked_div, ptr};
         // For x64
@@ -692,8 +615,8 @@ mod imp {
         // aka.
         // define i128 @__muloti4(i128, i128, i32*)
         #[export_name="__muloti4"]
-        pub unsafe extern $unadj fn i128_mul_oflow(a: i128_, b: i128_, o: *mut i32) -> i128_ {
-            mulo!(a, b, o, i128_)
+        pub unsafe extern $unadj fn i128_mul_oflow(a: i128, b: i128, o: *mut i32) -> i128 {
+            mulo!(a, b, o, i128)
         }
 
         // For x64
@@ -701,19 +624,19 @@ mod imp {
         // aka.
         // define double @__muloti4(i128)
         #[export_name="__floattidf"]
-        pub extern $unadj fn i128_as_f64_(a: i128_) -> f64 {
+        pub extern $unadj fn i128_as_f64_(a: i128) -> f64 {
             i128_as_f64(a)
         }
         #[export_name="__floattisf"]
-        pub extern $unadj fn i128_as_f32_(a: i128_) -> f32 {
+        pub extern $unadj fn i128_as_f32_(a: i128) -> f32 {
             i128_as_f32(a)
         }
         #[export_name="__floatuntidf"]
-        pub extern $unadj fn u128_as_f64_(a: u128_) -> f64 {
+        pub extern $unadj fn u128_as_f64_(a: u128) -> f64 {
             u128_as_f64(a)
         }
         #[export_name="__floatuntisf"]
-        pub extern $unadj fn u128_as_f32_(a: u128_) -> f32 {
+        pub extern $unadj fn u128_as_f32_(a: u128) -> f32 {
             u128_as_f32(a)
         }
 
@@ -722,23 +645,23 @@ mod imp {
         // aka.
         // define i128 @stuff(double)
         #[export_name="__fixunsdfti"]
-        pub extern $unadj fn f64_as_u128(a: f64) -> u128_ {
-            float_as_unsigned!(a, f64, u128_)
+        pub extern $unadj fn f64_as_u128(a: f64) -> u128 {
+            float_as_unsigned!(a, f64, u128)
         }
 
         #[export_name="__fixunssfti"]
-        pub extern "unadjusted" fn f32_as_u128(a: f32) -> u128_ {
-            float_as_unsigned!(a, f32, u128_)
+        pub extern $unadj fn f32_as_u128(a: f32) -> u128 {
+            float_as_unsigned!(a, f32, u128)
         }
 
         #[export_name="__fixdfti"]
-        pub extern "unadjusted" fn f64_as_i128(a: f64) -> i128_ {
-            float_as_signed!(a, f64, i128_)
+        pub extern $unadj fn f64_as_i128(a: f64) -> i128 {
+            float_as_signed!(a, f64, i128)
         }
 
         #[export_name="__fixsfti"]
-        pub extern "unadjusted" fn f32_as_i128(a: f32) -> i128_ {
-            float_as_signed!(a, f32, i128_)
+        pub extern $unadj fn f32_as_i128(a: f32) -> i128 {
+            float_as_signed!(a, f32, i128)
         }
 
         #[repr(simd)]
@@ -751,19 +674,19 @@ pub extern "unadjusted" fn f32_as_i128(a: f32) -> i128_ {
         //
         // That almost matches the C ABI, so we simply use the C ABI
         #[export_name="__udivmodti4"]
-        pub extern "C" fn u128_div_mod_(n: u128_, d: u128_, rem: *mut u128_) -> $cret {
+        pub extern "C" fn u128_div_mod_(n: u128, d: u128, rem: *mut u128) -> $cret {
             let x = u128_div_mod(n, d, rem);
             ($conv)(x)
         }
 
         #[export_name="__udivti3"]
-        pub extern "C" fn u128_div_(a: u128_, b: u128_) -> $cret {
+        pub extern "C" fn u128_div_(a: u128, b: u128) -> $cret {
             let x = u128_div_mod(a, b, ptr::null_mut());
             ($conv)(x)
         }
 
         #[export_name="__umodti3"]
-        pub extern "C" fn u128_mod_(a: u128_, b: u128_) -> $cret {
+        pub extern "C" fn u128_mod_(a: u128, b: u128) -> $cret {
             unsafe {
                 let mut r = ::core::mem::zeroed();
                 u128_div_mod(a, b, &mut r);
@@ -772,30 +695,26 @@ pub extern "C" fn u128_mod_(a: u128_, b: u128_) -> $cret {
         }
 
         #[export_name="__divti3"]
-        pub extern "C" fn i128_div_(a: i128_, b: i128_) -> $cret {
+        pub extern "C" fn i128_div_(a: i128, b: i128) -> $cret {
             let x = i128_div(a, b);
-            ($conv)(x as u128_)
+            ($conv)(x as u128)
         }
 
         #[export_name="__modti3"]
-        pub extern "C" fn i128_mod_(a: i128_, b: i128_) -> $cret {
+        pub extern "C" fn i128_mod_(a: i128, b: i128) -> $cret {
             let x = i128_mod(a, b);
-            ($conv)(x as u128_)
+            ($conv)(x as u128)
         }
     }
     } }
 
     // LLVM expectations for ABI on windows x64 are pure madness.
-    #[cfg(not(stage0))]
     #[cfg(all(windows, target_pointer_width="64"))]
     why_are_abi_strings_checked_by_parser!(u64x2,
-                                           |i: u128_| u64x2(i.low(), i.high()),
+                                           |i: u128| u64x2(i.low(), i.high()),
                                            "unadjusted");
 
-    #[cfg(not(stage0))]
     #[cfg(not(all(windows, target_pointer_width="64")))]
-    why_are_abi_strings_checked_by_parser!(u128_, |i|{ i }, "C");
-
-    #[cfg(not(stage0))]
+    why_are_abi_strings_checked_by_parser!(u128, |i|{ i }, "C");
     pub use self::imp::*;
 }
index e0dbc096cd0d97f567da3f17d42b4f167dace0e0..4f7cd7b016d66ac7f8a38ab05e0516825a4e7210 100644 (file)
@@ -13,7 +13,6 @@ bench = false
 name = "coretest"
 path = "../libcoretest/lib.rs"
 
-# FIXME: need to extract benchmarks to a separate crate
-#[[bench]]
-#name = "coretest"
-#path = "../libcoretest/lib.rs"
+[[bench]]
+name = "corebench"
+path = "../libcore/bench/lib.rs"
diff --git a/src/libcore/bench/any.rs b/src/libcore/bench/any.rs
new file mode 100644 (file)
index 0000000..67e02cf
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use core::any::*;
+use test::{Bencher, black_box};
+
+#[bench]
+fn bench_downcast_ref(b: &mut Bencher) {
+    b.iter(|| {
+        let mut x = 0;
+        let mut y = &mut x as &mut Any;
+        black_box(&mut y);
+        black_box(y.downcast_ref::<isize>() == Some(&0));
+    });
+}
diff --git a/src/libcore/bench/hash/mod.rs b/src/libcore/bench/hash/mod.rs
new file mode 100644 (file)
index 0000000..55d9e3e
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod sip;
diff --git a/src/libcore/bench/hash/sip.rs b/src/libcore/bench/hash/sip.rs
new file mode 100644 (file)
index 0000000..3379c85
--- /dev/null
@@ -0,0 +1,151 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(deprecated)]
+
+use core::hash::*;
+use test::{Bencher, black_box};
+
+fn hash_bytes<H: Hasher>(mut s: H, x: &[u8]) -> u64 {
+    Hasher::write(&mut s, x);
+    s.finish()
+}
+
+fn hash_with<H: Hasher, T: Hash>(mut st: H, x: &T) -> u64 {
+    x.hash(&mut st);
+    st.finish()
+}
+
+fn hash<T: Hash>(x: &T) -> u64 {
+    hash_with(SipHasher::new(), x)
+}
+
+#[bench]
+fn bench_str_under_8_bytes(b: &mut Bencher) {
+    let s = "foo";
+    b.iter(|| {
+        assert_eq!(hash(&s), 16262950014981195938);
+    })
+}
+
+#[bench]
+fn bench_str_of_8_bytes(b: &mut Bencher) {
+    let s = "foobar78";
+    b.iter(|| {
+        assert_eq!(hash(&s), 4898293253460910787);
+    })
+}
+
+#[bench]
+fn bench_str_over_8_bytes(b: &mut Bencher) {
+    let s = "foobarbaz0";
+    b.iter(|| {
+        assert_eq!(hash(&s), 10581415515220175264);
+    })
+}
+
+#[bench]
+fn bench_long_str(b: &mut Bencher) {
+    let s = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor \
+incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \
+exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute \
+irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla \
+pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui \
+officia deserunt mollit anim id est laborum.";
+    b.iter(|| {
+        assert_eq!(hash(&s), 17717065544121360093);
+    })
+}
+
+#[bench]
+fn bench_u32(b: &mut Bencher) {
+    let u = 162629500u32;
+    let u = black_box(u);
+    b.iter(|| {
+        hash(&u)
+    });
+    b.bytes = 8;
+}
+
+#[bench]
+fn bench_u32_keyed(b: &mut Bencher) {
+    let u = 162629500u32;
+    let u = black_box(u);
+    let k1 = black_box(0x1);
+    let k2 = black_box(0x2);
+    b.iter(|| {
+        hash_with(SipHasher::new_with_keys(k1, k2), &u)
+    });
+    b.bytes = 8;
+}
+
+#[bench]
+fn bench_u64(b: &mut Bencher) {
+    let u = 16262950014981195938u64;
+    let u = black_box(u);
+    b.iter(|| {
+        hash(&u)
+    });
+    b.bytes = 8;
+}
+
+#[bench]
+fn bench_bytes_4(b: &mut Bencher) {
+    let data = black_box([b' '; 4]);
+    b.iter(|| {
+        hash_bytes(SipHasher::default(), &data)
+    });
+    b.bytes = 4;
+}
+
+#[bench]
+fn bench_bytes_7(b: &mut Bencher) {
+    let data = black_box([b' '; 7]);
+    b.iter(|| {
+        hash_bytes(SipHasher::default(), &data)
+    });
+    b.bytes = 7;
+}
+
+#[bench]
+fn bench_bytes_8(b: &mut Bencher) {
+    let data = black_box([b' '; 8]);
+    b.iter(|| {
+        hash_bytes(SipHasher::default(), &data)
+    });
+    b.bytes = 8;
+}
+
+#[bench]
+fn bench_bytes_a_16(b: &mut Bencher) {
+    let data = black_box([b' '; 16]);
+    b.iter(|| {
+        hash_bytes(SipHasher::default(), &data)
+    });
+    b.bytes = 16;
+}
+
+#[bench]
+fn bench_bytes_b_32(b: &mut Bencher) {
+    let data = black_box([b' '; 32]);
+    b.iter(|| {
+        hash_bytes(SipHasher::default(), &data)
+    });
+    b.bytes = 32;
+}
+
+#[bench]
+fn bench_bytes_c_128(b: &mut Bencher) {
+    let data = black_box([b' '; 128]);
+    b.iter(|| {
+        hash_bytes(SipHasher::default(), &data)
+    });
+    b.bytes = 128;
+}
diff --git a/src/libcore/bench/iter.rs b/src/libcore/bench/iter.rs
new file mode 100644 (file)
index 0000000..93d38a5
--- /dev/null
@@ -0,0 +1,101 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use core::iter::*;
+use test::{Bencher, black_box};
+
+#[bench]
+fn bench_rposition(b: &mut Bencher) {
+    let it: Vec<usize> = (0..300).collect();
+    b.iter(|| {
+        it.iter().rposition(|&x| x <= 150);
+    });
+}
+
+#[bench]
+fn bench_skip_while(b: &mut Bencher) {
+    b.iter(|| {
+        let it = 0..100;
+        let mut sum = 0;
+        it.skip_while(|&x| { sum += x; sum < 4000 }).all(|_| true);
+    });
+}
+
+#[bench]
+fn bench_multiple_take(b: &mut Bencher) {
+    let mut it = (0..42).cycle();
+    b.iter(|| {
+        let n = it.next().unwrap();
+        for _ in 0..n {
+            it.clone().take(it.next().unwrap()).all(|_| true);
+        }
+    });
+}
+
+fn scatter(x: i32) -> i32 { (x * 31) % 127 }
+
+#[bench]
+fn bench_max_by_key(b: &mut Bencher) {
+    b.iter(|| {
+        let it = 0..100;
+        it.max_by_key(|&x| scatter(x))
+    })
+}
+
+// http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
+#[bench]
+fn bench_max_by_key2(b: &mut Bencher) {
+    fn max_index_iter(array: &[i32]) -> usize {
+        array.iter().enumerate().max_by_key(|&(_, item)| item).unwrap().0
+    }
+
+    let mut data = vec![0; 1638];
+    data[514] = 9999;
+
+    b.iter(|| max_index_iter(&data));
+}
+
+#[bench]
+fn bench_max(b: &mut Bencher) {
+    b.iter(|| {
+        let it = 0..100;
+        it.map(scatter).max()
+    })
+}
+
+pub fn copy_zip(xs: &[u8], ys: &mut [u8]) {
+    for (a, b) in ys.iter_mut().zip(xs) {
+        *a = *b;
+    }
+}
+
+pub fn add_zip(xs: &[f32], ys: &mut [f32]) {
+    for (a, b) in ys.iter_mut().zip(xs) {
+        *a += *b;
+    }
+}
+
+#[bench]
+fn bench_zip_copy(b: &mut Bencher) {
+    let source = vec![0u8; 16 * 1024];
+    let mut dst = black_box(vec![0u8; 16 * 1024]);
+    b.iter(|| {
+        copy_zip(&source, &mut dst)
+    })
+}
+
+#[bench]
+fn bench_zip_add(b: &mut Bencher) {
+    let source = vec![1.; 16 * 1024];
+    let mut dst = vec![0.; 16 * 1024];
+    b.iter(|| {
+        add_zip(&source, &mut dst)
+    });
+}
diff --git a/src/libcore/bench/lib.rs b/src/libcore/bench/lib.rs
new file mode 100644 (file)
index 0000000..d2db329
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(warnings)]
+
+#![feature(flt2dec)]
+#![feature(slice_patterns)]
+#![feature(test)]
+
+extern crate core;
+extern crate test;
+
+mod any;
+mod hash;
+mod iter;
+mod mem;
+mod num;
+mod ops;
diff --git a/src/libcore/bench/mem.rs b/src/libcore/bench/mem.rs
new file mode 100644 (file)
index 0000000..8e541d9
--- /dev/null
@@ -0,0 +1,70 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use test::Bencher;
+
+// FIXME #13642 (these benchmarks should be in another place)
+// Completely miscellaneous language-construct benchmarks.
+// Static/dynamic method dispatch
+
+struct Struct {
+    field: isize
+}
+
+trait Trait {
+    fn method(&self) -> isize;
+}
+
+impl Trait for Struct {
+    fn method(&self) -> isize {
+        self.field
+    }
+}
+
+#[bench]
+fn trait_vtable_method_call(b: &mut Bencher) {
+    let s = Struct { field: 10 };
+    let t = &s as &Trait;
+    b.iter(|| {
+        t.method()
+    });
+}
+
+#[bench]
+fn trait_static_method_call(b: &mut Bencher) {
+    let s = Struct { field: 10 };
+    b.iter(|| {
+        s.method()
+    });
+}
+
+// Overhead of various match forms
+
+#[bench]
+fn match_option_some(b: &mut Bencher) {
+    let x = Some(10);
+    b.iter(|| {
+        match x {
+            Some(y) => y,
+            None => 11
+        }
+    });
+}
+
+#[bench]
+fn match_vec_pattern(b: &mut Bencher) {
+    let x = [1,2,3,4,5,6];
+    b.iter(|| {
+        match x {
+            [1,2,3,..] => 10,
+            _ => 11,
+        }
+    });
+}
diff --git a/src/libcore/bench/num/dec2flt/mod.rs b/src/libcore/bench/num/dec2flt/mod.rs
new file mode 100644 (file)
index 0000000..562866e
--- /dev/null
@@ -0,0 +1,68 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::f64;
+use test::Bencher;
+
+#[bench]
+fn bench_0(b: &mut Bencher) {
+    b.iter(|| "0.0".parse::<f64>());
+}
+
+#[bench]
+fn bench_42(b: &mut Bencher) {
+    b.iter(|| "42".parse::<f64>());
+}
+
+#[bench]
+fn bench_huge_int(b: &mut Bencher) {
+    // 2^128 - 1
+    b.iter(|| "170141183460469231731687303715884105727".parse::<f64>());
+}
+
+#[bench]
+fn bench_short_decimal(b: &mut Bencher) {
+    b.iter(|| "1234.5678".parse::<f64>());
+}
+
+#[bench]
+fn bench_pi_long(b: &mut Bencher) {
+    b.iter(|| "3.14159265358979323846264338327950288".parse::<f64>());
+}
+
+#[bench]
+fn bench_pi_short(b: &mut Bencher) {
+    b.iter(|| "3.141592653589793".parse::<f64>())
+}
+
+#[bench]
+fn bench_1e150(b: &mut Bencher) {
+    b.iter(|| "1e150".parse::<f64>());
+}
+
+#[bench]
+fn bench_long_decimal_and_exp(b: &mut Bencher) {
+    b.iter(|| "727501488517303786137132964064381141071e-123".parse::<f64>());
+}
+
+#[bench]
+fn bench_min_subnormal(b: &mut Bencher) {
+    b.iter(|| "5e-324".parse::<f64>());
+}
+
+#[bench]
+fn bench_min_normal(b: &mut Bencher) {
+    b.iter(|| "2.2250738585072014e-308".parse::<f64>());
+}
+
+#[bench]
+fn bench_max(b: &mut Bencher) {
+    b.iter(|| "1.7976931348623157e308".parse::<f64>());
+}
diff --git a/src/libcore/bench/num/flt2dec/mod.rs b/src/libcore/bench/num/flt2dec/mod.rs
new file mode 100644 (file)
index 0000000..1de2bf4
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod strategy {
+    mod dragon;
+    mod grisu;
+}
+
+use core::num::flt2dec::{decode, DecodableFloat, FullDecoded, Decoded};
+use core::num::flt2dec::MAX_SIG_DIGITS;
+
+pub fn decode_finite<T: DecodableFloat>(v: T) -> Decoded {
+    match decode(v).1 {
+        FullDecoded::Finite(decoded) => decoded,
+        full_decoded => panic!("expected finite, got {:?} instead", full_decoded)
+    }
+}
diff --git a/src/libcore/bench/num/flt2dec/strategy/dragon.rs b/src/libcore/bench/num/flt2dec/strategy/dragon.rs
new file mode 100644 (file)
index 0000000..6824cf4
--- /dev/null
@@ -0,0 +1,70 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::{i16, f64};
+use super::super::*;
+use core::num::flt2dec::strategy::dragon::*;
+use test::Bencher;
+
+#[bench]
+fn bench_small_shortest(b: &mut Bencher) {
+    let decoded = decode_finite(3.141592f64);
+    let mut buf = [0; MAX_SIG_DIGITS];
+    b.iter(|| format_shortest(&decoded, &mut buf));
+}
+
+#[bench]
+fn bench_big_shortest(b: &mut Bencher) {
+    let decoded = decode_finite(f64::MAX);
+    let mut buf = [0; MAX_SIG_DIGITS];
+    b.iter(|| format_shortest(&decoded, &mut buf));
+}
+
+#[bench]
+fn bench_small_exact_3(b: &mut Bencher) {
+    let decoded = decode_finite(3.141592f64);
+    let mut buf = [0; 3];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
+
+#[bench]
+fn bench_big_exact_3(b: &mut Bencher) {
+    let decoded = decode_finite(f64::MAX);
+    let mut buf = [0; 3];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
+
+#[bench]
+fn bench_small_exact_12(b: &mut Bencher) {
+    let decoded = decode_finite(3.141592f64);
+    let mut buf = [0; 12];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
+
+#[bench]
+fn bench_big_exact_12(b: &mut Bencher) {
+    let decoded = decode_finite(f64::MAX);
+    let mut buf = [0; 12];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
+
+#[bench]
+fn bench_small_exact_inf(b: &mut Bencher) {
+    let decoded = decode_finite(3.141592f64);
+    let mut buf = [0; 1024];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
+
+#[bench]
+fn bench_big_exact_inf(b: &mut Bencher) {
+    let decoded = decode_finite(f64::MAX);
+    let mut buf = [0; 1024];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
diff --git a/src/libcore/bench/num/flt2dec/strategy/grisu.rs b/src/libcore/bench/num/flt2dec/strategy/grisu.rs
new file mode 100644 (file)
index 0000000..82e1a85
--- /dev/null
@@ -0,0 +1,77 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::{i16, f64};
+use super::super::*;
+use core::num::flt2dec::strategy::grisu::*;
+use test::Bencher;
+
+pub fn decode_finite<T: DecodableFloat>(v: T) -> Decoded {
+    match decode(v).1 {
+        FullDecoded::Finite(decoded) => decoded,
+        full_decoded => panic!("expected finite, got {:?} instead", full_decoded)
+    }
+}
+
+#[bench]
+fn bench_small_shortest(b: &mut Bencher) {
+    let decoded = decode_finite(3.141592f64);
+    let mut buf = [0; MAX_SIG_DIGITS];
+    b.iter(|| format_shortest(&decoded, &mut buf));
+}
+
+#[bench]
+fn bench_big_shortest(b: &mut Bencher) {
+    let decoded = decode_finite(f64::MAX);
+    let mut buf = [0; MAX_SIG_DIGITS];
+    b.iter(|| format_shortest(&decoded, &mut buf));
+}
+
+#[bench]
+fn bench_small_exact_3(b: &mut Bencher) {
+    let decoded = decode_finite(3.141592f64);
+    let mut buf = [0; 3];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
+
+#[bench]
+fn bench_big_exact_3(b: &mut Bencher) {
+    let decoded = decode_finite(f64::MAX);
+    let mut buf = [0; 3];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
+
+#[bench]
+fn bench_small_exact_12(b: &mut Bencher) {
+    let decoded = decode_finite(3.141592f64);
+    let mut buf = [0; 12];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
+
+#[bench]
+fn bench_big_exact_12(b: &mut Bencher) {
+    let decoded = decode_finite(f64::MAX);
+    let mut buf = [0; 12];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
+
+#[bench]
+fn bench_small_exact_inf(b: &mut Bencher) {
+    let decoded = decode_finite(3.141592f64);
+    let mut buf = [0; 1024];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
+
+#[bench]
+fn bench_big_exact_inf(b: &mut Bencher) {
+    let decoded = decode_finite(f64::MAX);
+    let mut buf = [0; 1024];
+    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
+}
diff --git a/src/libcore/bench/num/mod.rs b/src/libcore/bench/num/mod.rs
new file mode 100644 (file)
index 0000000..55f0bdb
--- /dev/null
@@ -0,0 +1,12 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod flt2dec;
+mod dec2flt;
diff --git a/src/libcore/bench/ops.rs b/src/libcore/bench/ops.rs
new file mode 100644 (file)
index 0000000..7f36a4b
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use core::ops::*;
+use test::Bencher;
+
+// Overhead of dtors
+
+struct HasDtor {
+    _x: isize
+}
+
+impl Drop for HasDtor {
+    fn drop(&mut self) {
+    }
+}
+
+#[bench]
+fn alloc_obj_with_dtor(b: &mut Bencher) {
+    b.iter(|| {
+        HasDtor { _x : 10 };
+    })
+}
index c3f862e7c5418b5a8bb4d14ffe1a02fc87c9492f..ab44342ebf02fda0daf228f3f1abc524c9106c54 100644 (file)
 //! references. We say that `Cell<T>` and `RefCell<T>` provide 'interior mutability', in contrast
 //! with typical Rust types that exhibit 'inherited mutability'.
 //!
-//! Cell types come in two flavors: `Cell<T>` and `RefCell<T>`. `Cell<T>` provides `get` and `set`
-//! methods that change the interior value with a single method call. `Cell<T>` though is only
-//! compatible with types that implement `Copy`. For other types, one must use the `RefCell<T>`
-//! type, acquiring a write lock before mutating.
+//! Cell types come in two flavors: `Cell<T>` and `RefCell<T>`. `Cell<T>` implements interior
+//! mutability by moving values in and out of the `Cell<T>`. To use references instead of values,
+//! one must use the `RefCell<T>` type, acquiring a write lock before mutating. `Cell<T>` provides
+//! methods to retrieve and change the current interior value:
+//!
+//!  - For types that implement `Copy`, the `get` method retrieves the current interior value.
+//!  - For types that implement `Default`, the `take` method replaces the current interior value
+//!    with `Default::default()` and returns the replaced value.
+//!  - For all types, the `replace` method replaces the current interior value and returns the
+//!    replaced value and the `into_inner` method consumes the `Cell<T>` and returns the interior
+//!    value. Additionally, the `set` method replaces the interior value, dropping the replaced
+//!    value.
 //!
 //! `RefCell<T>` uses Rust's lifetimes to implement 'dynamic borrowing', a process whereby one can
 //! claim temporary, exclusive, mutable access to the inner value. Borrows for `RefCell<T>`s are
 use cmp::Ordering;
 use fmt::{self, Debug, Display};
 use marker::Unsize;
+use mem;
 use ops::{Deref, DerefMut, CoerceUnsized};
 
-/// A mutable memory location that admits only `Copy` data.
+/// A mutable memory location.
 ///
 /// See the [module-level documentation](index.html) for more.
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -187,23 +196,6 @@ pub struct Cell<T> {
 }
 
 impl<T:Copy> Cell<T> {
-    /// Creates a new `Cell` containing the given value.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// use std::cell::Cell;
-    ///
-    /// let c = Cell::new(5);
-    /// ```
-    #[stable(feature = "rust1", since = "1.0.0")]
-    #[inline]
-    pub const fn new(value: T) -> Cell<T> {
-        Cell {
-            value: UnsafeCell::new(value),
-        }
-    }
-
     /// Returns a copy of the contained value.
     ///
     /// # Examples
@@ -221,25 +213,6 @@ pub fn get(&self) -> T {
         unsafe{ *self.value.get() }
     }
 
-    /// Sets the contained value.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// use std::cell::Cell;
-    ///
-    /// let c = Cell::new(5);
-    ///
-    /// c.set(10);
-    /// ```
-    #[inline]
-    #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn set(&self, value: T) {
-        unsafe {
-            *self.value.get() = value;
-        }
-    }
-
     /// Returns a reference to the underlying `UnsafeCell`.
     ///
     /// # Examples
@@ -378,6 +351,100 @@ fn from(t: T) -> Cell<T> {
     }
 }
 
+impl<T> Cell<T> {
+    /// Creates a new `Cell` containing the given value.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::cell::Cell;
+    ///
+    /// let c = Cell::new(5);
+    /// ```
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[inline]
+    pub const fn new(value: T) -> Cell<T> {
+        Cell {
+            value: UnsafeCell::new(value),
+        }
+    }
+
+    /// Sets the contained value.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::cell::Cell;
+    ///
+    /// let c = Cell::new(5);
+    ///
+    /// c.set(10);
+    /// ```
+    #[inline]
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub fn set(&self, val: T) {
+        let old = self.replace(val);
+        drop(old);
+    }
+
+    /// Replaces the contained value.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(move_cell)]
+    /// use std::cell::Cell;
+    ///
+    /// let c = Cell::new(5);
+    /// let old = c.replace(10);
+    ///
+    /// assert_eq!(5, old);
+    /// ```
+    #[unstable(feature = "move_cell", issue = "39264")]
+    pub fn replace(&self, val: T) -> T {
+        mem::replace(unsafe { &mut *self.value.get() }, val)
+    }
+
+    /// Unwraps the value.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(move_cell)]
+    /// use std::cell::Cell;
+    ///
+    /// let c = Cell::new(5);
+    /// let five = c.into_inner();
+    ///
+    /// assert_eq!(five, 5);
+    /// ```
+    #[unstable(feature = "move_cell", issue = "39264")]
+    pub fn into_inner(self) -> T {
+        unsafe { self.value.into_inner() }
+    }
+}
+
+impl<T: Default> Cell<T> {
+    /// Takes the value of the cell, leaving `Default::default()` in its place.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(move_cell)]
+    /// use std::cell::Cell;
+    ///
+    /// let c = Cell::new(5);
+    /// let five = c.take();
+    ///
+    /// assert_eq!(five, 5);
+    /// assert_eq!(c.into_inner(), 0);
+    /// ```
+    #[unstable(feature = "move_cell", issue = "39264")]
+    pub fn take(&self) -> T {
+        self.replace(Default::default())
+    }
+}
+
 #[unstable(feature = "coerce_unsized", issue = "27732")]
 impl<T: CoerceUnsized<U>, U> CoerceUnsized<Cell<U>> for Cell<T> {}
 
index 367422f55364a997d5a83b85d7e94820b37bde69..78764091cf03275a3569dc30bae907ff275292d7 100644 (file)
@@ -588,7 +588,7 @@ fn len(&self) -> usize {
 #[unstable(feature = "fused", issue = "35602")]
 impl FusedIterator for EscapeUnicode {}
 
-#[stable(feature = "char_struct_display", since = "1.17.0")]
+#[stable(feature = "char_struct_display", since = "1.16.0")]
 impl fmt::Display for EscapeUnicode {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         for c in self.clone() {
@@ -701,7 +701,7 @@ fn len(&self) -> usize {
 #[unstable(feature = "fused", issue = "35602")]
 impl FusedIterator for EscapeDefault {}
 
-#[stable(feature = "char_struct_display", since = "1.17.0")]
+#[stable(feature = "char_struct_display", since = "1.16.0")]
 impl fmt::Display for EscapeDefault {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         for c in self.clone() {
@@ -735,7 +735,7 @@ impl ExactSizeIterator for EscapeDebug { }
 #[unstable(feature = "fused", issue = "35602")]
 impl FusedIterator for EscapeDebug {}
 
-#[stable(feature = "char_struct_display", since = "1.17.0")]
+#[unstable(feature = "char_escape_debug", issue = "35068")]
 impl fmt::Display for EscapeDebug {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         fmt::Display::fmt(&self.0, f)
index cd2e8f101814199224c64f1a663c145a96e77bbf..8dbbc5928f45ab9f56e3e3905b2e9e5d6606a35b 100644 (file)
@@ -153,7 +153,6 @@ fn clone(&self) -> $t { *self }
 clone_impl! { i16 }
 clone_impl! { i32 }
 clone_impl! { i64 }
-#[cfg(not(stage0))]
 clone_impl! { i128 }
 
 clone_impl! { usize }
@@ -161,7 +160,6 @@ fn clone(&self) -> $t { *self }
 clone_impl! { u16 }
 clone_impl! { u32 }
 clone_impl! { u64 }
-#[cfg(not(stage0))]
 clone_impl! { u128 }
 
 clone_impl! { f32 }
index a78d27ea3afc1ea251a73e202ee669ed5ffc0158..cc066099cf8b010167489451110c7fcb7feb6ab0 100644 (file)
@@ -679,10 +679,8 @@ fn ne(&self, _other: &()) -> bool { false }
     }
 
     partial_eq_impl! {
-        bool char usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64
+        bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64
     }
-    #[cfg(not(stage0))]
-    partial_eq_impl! { u128 i128 }
 
     macro_rules! eq_impl {
         ($($t:ty)*) => ($(
@@ -691,9 +689,7 @@ impl Eq for $t {}
         )*)
     }
 
-    eq_impl! { () bool char usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-    #[cfg(not(stage0))]
-    eq_impl! { u128 i128 }
+    eq_impl! { () bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
     macro_rules! partial_ord_impl {
         ($($t:ty)*) => ($(
@@ -782,9 +778,7 @@ fn cmp(&self, other: &bool) -> Ordering {
         }
     }
 
-    ord_impl! { char usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-    #[cfg(not(stage0))]
-    ord_impl! { u128 i128 }
+    ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
     #[unstable(feature = "never_type_impls", issue = "35121")]
     impl PartialEq for ! {
index abd686b15e22b5f90a4603991b771a26d7007992..4e170794c1d6e411d57443a56c91e2ff7339f93b 100644 (file)
@@ -225,7 +225,7 @@ pub trait TryFrom<T>: Sized {
     type Err;
 
     /// Performs the conversion.
-    fn try_from(T) -> Result<Self, Self::Err>;
+    fn try_from(value: T) -> Result<Self, Self::Err>;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
index ccd4343336f5ecde65dab99ea48a7eca99d361b3..0d7c1672fbcd29718109220e18075c08f99c7c11 100644 (file)
@@ -144,7 +144,6 @@ fn default() -> $t { $v }
 default_impl! { u16, 0 }
 default_impl! { u32, 0 }
 default_impl! { u64, 0 }
-#[cfg(not(stage0))]
 default_impl! { u128, 0 }
 
 default_impl! { isize, 0 }
@@ -152,7 +151,6 @@ fn default() -> $t { $v }
 default_impl! { i16, 0 }
 default_impl! { i32, 0 }
 default_impl! { i64, 0 }
-#[cfg(not(stage0))]
 default_impl! { i128, 0 }
 
 default_impl! { f32, 0.0f32 }
index 2ba7d6e8bd1ac4d885c9edc336762950f8fe1ff6..a989f914db616dbd6aedc179d37fa7cddca6c3b5 100644 (file)
@@ -265,6 +265,32 @@ pub fn new_v1_formatted(pieces: &'a [&'a str],
             args: args
         }
     }
+
+    /// Estimates the length of the formatted text.
+    ///
+    /// This is intended to be used for setting initial `String` capacity
+    /// when using `format!`. Note: this is neither the lower nor upper bound.
+    #[doc(hidden)] #[inline]
+    #[unstable(feature = "fmt_internals", reason = "internal to format_args!",
+               issue = "0")]
+    pub fn estimated_capacity(&self) -> usize {
+        let pieces_length: usize = self.pieces.iter()
+            .map(|x| x.len()).sum();
+
+        if self.args.is_empty() {
+            pieces_length
+        } else if self.pieces[0] == "" && pieces_length < 16 {
+            // If the format string starts with an argument,
+            // don't preallocate anything, unless length
+            // of pieces is significant.
+            0
+        } else {
+            // There are some arguments, so any additional push
+            // will reallocate the string. To avoid that,
+            // we're "pre-doubling" the capacity here.
+            pieces_length.checked_mul(2).unwrap_or(0)
+        }
+    }
 }
 
 /// This structure represents a safely precompiled version of a format string
index cd725392b665ffcd9ed583a90f6c9aff1cb89901..a324a4aed25766da158a71c31bbf098a75462791 100644 (file)
@@ -30,7 +30,6 @@ trait Int: Zero + PartialEq + PartialOrd + Div<Output=Self> + Rem<Output=Self> +
     fn to_u16(&self) -> u16;
     fn to_u32(&self) -> u32;
     fn to_u64(&self) -> u64;
-    #[cfg(not(stage0))]
     fn to_u128(&self) -> u128;
 }
 
@@ -41,13 +40,10 @@ fn to_u8(&self) -> u8 { *self as u8 }
         fn to_u16(&self) -> u16 { *self as u16 }
         fn to_u32(&self) -> u32 { *self as u32 }
         fn to_u64(&self) -> u64 { *self as u64 }
-        #[cfg(not(stage0))]
         fn to_u128(&self) -> u128 { *self as u128 }
     })*)
 }
-doit! { i8 i16 i32 i64 isize u8 u16 u32 u64 usize }
-#[cfg(not(stage0))]
-doit! { i128 u128 }
+doit! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize }
 
 /// A type that represents a specific radix
 #[doc(hidden)]
@@ -188,7 +184,6 @@ macro_rules! integer {
 integer! { i16, u16 }
 integer! { i32, u32 }
 integer! { i64, u64 }
-#[cfg(not(stage0))]
 integer! { i128, u128 }
 
 const DEC_DIGITS_LUT: &'static[u8] =
@@ -265,7 +260,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 impl_Display!(i8, u8, i16, u16, i32, u32: to_u32);
 impl_Display!(i64, u64: to_u64);
-#[cfg(not(stage0))]
 impl_Display!(i128, u128: to_u128);
 #[cfg(target_pointer_width = "16")]
 impl_Display!(isize, usize: to_u16);
index dd6edc7d39af0ca0afca1f2be4418cd9430099df..f0d8d1a321917a23a6d69bf21d659421f5a3bc8e 100644 (file)
@@ -186,7 +186,6 @@ fn write_u32(&mut self, i: u32) {
     fn write_u64(&mut self, i: u64) {
         self.write(&unsafe { mem::transmute::<_, [u8; 8]>(i) })
     }
-    #[cfg(not(stage0))]
     /// Writes a single `u128` into this hasher.
     #[inline]
     #[unstable(feature = "i128", issue = "35118")]
@@ -227,7 +226,6 @@ fn write_i32(&mut self, i: i32) {
     fn write_i64(&mut self, i: i64) {
         self.write_u64(i as u64)
     }
-    #[cfg(not(stage0))]
     /// Writes a single `i128` into this hasher.
     #[inline]
     #[unstable(feature = "i128", issue = "35118")]
@@ -376,9 +374,6 @@ fn hash_slice<H: Hasher>(data: &[$ty], state: &mut H) {
         (i32, write_i32),
         (i64, write_i64),
         (isize, write_isize),
-    }
-    #[cfg(not(stage0))]
-    impl_write! {
         (u128, write_u128),
         (i128, write_i128),
     }
index f2cdc9d6a98c540de1c55271509687c2f0a89b71..9a7914064fdd56bb176fe19d1d811a288ff6ba79 100644 (file)
 // based on "op T" where T is expected to be `Copy`able
 macro_rules! forward_ref_unop {
     (impl $imp:ident, $method:ident for $t:ty) => {
-        #[stable(feature = "rust1", since = "1.0.0")]
+        forward_ref_unop!(impl $imp, $method for $t,
+                #[stable(feature = "rust1", since = "1.0.0")]);
+    };
+    (impl $imp:ident, $method:ident for $t:ty, #[$attr:meta]) => {
+        #[$attr]
         impl<'a> $imp for &'a $t {
             type Output = <$t as $imp>::Output;
 
@@ -29,7 +33,11 @@ fn $method(self) -> <$t as $imp>::Output {
 // based on "T op U" where T and U are expected to be `Copy`able
 macro_rules! forward_ref_binop {
     (impl $imp:ident, $method:ident for $t:ty, $u:ty) => {
-        #[stable(feature = "rust1", since = "1.0.0")]
+        forward_ref_binop!(impl $imp, $method for $t, $u,
+                #[stable(feature = "rust1", since = "1.0.0")]);
+    };
+    (impl $imp:ident, $method:ident for $t:ty, $u:ty, #[$attr:meta]) => {
+        #[$attr]
         impl<'a> $imp<$u> for &'a $t {
             type Output = <$t as $imp<$u>>::Output;
 
@@ -39,7 +47,7 @@ fn $method(self, other: $u) -> <$t as $imp<$u>>::Output {
             }
         }
 
-        #[stable(feature = "rust1", since = "1.0.0")]
+        #[$attr]
         impl<'a> $imp<&'a $u> for $t {
             type Output = <$t as $imp<$u>>::Output;
 
@@ -49,7 +57,7 @@ fn $method(self, other: &'a $u) -> <$t as $imp<$u>>::Output {
             }
         }
 
-        #[stable(feature = "rust1", since = "1.0.0")]
+        #[$attr]
         impl<'a, 'b> $imp<&'a $u> for &'b $t {
             type Output = <$t as $imp<$u>>::Output;
 
index 3999db0d63c99ac8770076f537e8807d5a8e33cc..d9b8c5ea589fd57aa74a840b889ae5aad9deb4de 100644 (file)
@@ -1086,7 +1086,7 @@ impl<I: Iterator, P> Iterator for Filter<I, P> where P: FnMut(&I::Item) -> bool
 
     #[inline]
     fn next(&mut self) -> Option<I::Item> {
-        for x in self.iter.by_ref() {
+        for x in &mut self.iter {
             if (self.predicate)(&x) {
                 return Some(x);
             }
@@ -1099,6 +1099,26 @@ fn size_hint(&self) -> (usize, Option<usize>) {
         let (_, upper) = self.iter.size_hint();
         (0, upper) // can't know a lower bound, due to the predicate
     }
+
+    // this special case allows the compiler to make `.filter(_).count()`
+    // branchless. Barring perfect branch prediction (which is unattainable in
+    // the general case), this will be much faster in >90% of cases (containing
+    // virtually all real workloads) and only a tiny bit slower in the rest.
+    //
+    // Having this specialization thus allows us to write `.filter(p).count()`
+    // where we would otherwise write `.map(|x| p(x) as usize).sum()`, which is
+    // less readable and also less backwards-compatible to Rust before 1.10.
+    //
+    // Using the branchless version will also simplify the LLVM byte code, thus
+    // leaving more budget for LLVM optimizations.
+    #[inline]
+    fn count(mut self) -> usize {
+        let mut count = 0;
+        for x in &mut self.iter {
+            count += (self.predicate)(&x) as usize;
+        }
+        count
+    }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
index 9d22037882f214248c79e71f20e7d157caeb1ea1..687c477f19e4c744aff29905f0fd43973fd6cb3d 100644 (file)
@@ -242,7 +242,6 @@ fn steps_between_by_one(start: &Self, end: &Self) -> Option<usize> {
 // assume here that it is less than 64-bits.
 #[cfg(not(target_pointer_width = "64"))]
 step_impl_no_between!(u64 i64);
-#[cfg(not(stage0))]
 step_impl_no_between!(u128 i128);
 
 /// An adapter for stepping range iterators by a custom amount.
index 1e127148300678661582bb50771ca60ca275a98d..cb180110d3cc0116159b137a1201c744ba677264 100644 (file)
@@ -414,6 +414,64 @@ pub trait DoubleEndedIterator: Iterator {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn next_back(&mut self) -> Option<Self::Item>;
+
+    /// Searches for an element of an iterator from the right that satisfies a predicate.
+    ///
+    /// `rfind()` takes a closure that returns `true` or `false`. It applies
+    /// this closure to each element of the iterator, starting at the end, and if any
+    /// of them return `true`, then `rfind()` returns [`Some(element)`]. If they all return
+    /// `false`, it returns [`None`].
+    ///
+    /// `rfind()` is short-circuiting; in other words, it will stop processing
+    /// as soon as the closure returns `true`.
+    ///
+    /// Because `rfind()` takes a reference, and many iterators iterate over
+    /// references, this leads to a possibly confusing situation where the
+    /// argument is a double reference. You can see this effect in the
+    /// examples below, with `&&x`.
+    ///
+    /// [`Some(element)`]: ../../std/option/enum.Option.html#variant.Some
+    /// [`None`]: ../../std/option/enum.Option.html#variant.None
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// #![feature(iter_rfind)]
+    ///
+    /// let a = [1, 2, 3];
+    ///
+    /// assert_eq!(a.iter().rfind(|&&x| x == 2), Some(&2));
+    ///
+    /// assert_eq!(a.iter().rfind(|&&x| x == 5), None);
+    /// ```
+    ///
+    /// Stopping at the first `true`:
+    ///
+    /// ```
+    /// #![feature(iter_rfind)]
+    ///
+    /// let a = [1, 2, 3];
+    ///
+    /// let mut iter = a.iter();
+    ///
+    /// assert_eq!(iter.rfind(|&&x| x == 2), Some(&2));
+    ///
+    /// // we can still use `iter`, as there are more elements.
+    /// assert_eq!(iter.next_back(), Some(&1));
+    /// ```
+    #[inline]
+    #[unstable(feature = "iter_rfind", issue = "39480")]
+    fn rfind<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
+        Self: Sized,
+        P: FnMut(&Self::Item) -> bool
+    {
+        for x in self.by_ref().rev() {
+            if predicate(&x) { return Some(x) }
+        }
+        None
+    }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -603,29 +661,29 @@ pub trait Product<A = Self>: Sized {
 
 // NB: explicitly use Add and Mul here to inherit overflow checks
 macro_rules! integer_sum_product {
-    (@impls $zero:expr, $one:expr, $($a:ty)*) => ($(
-        #[stable(feature = "iter_arith_traits", since = "1.12.0")]
+    (@impls $zero:expr, $one:expr, #[$attr:meta], $($a:ty)*) => ($(
+        #[$attr]
         impl Sum for $a {
             fn sum<I: Iterator<Item=$a>>(iter: I) -> $a {
                 iter.fold($zero, Add::add)
             }
         }
 
-        #[stable(feature = "iter_arith_traits", since = "1.12.0")]
+        #[$attr]
         impl Product for $a {
             fn product<I: Iterator<Item=$a>>(iter: I) -> $a {
                 iter.fold($one, Mul::mul)
             }
         }
 
-        #[stable(feature = "iter_arith_traits", since = "1.12.0")]
+        #[$attr]
         impl<'a> Sum<&'a $a> for $a {
             fn sum<I: Iterator<Item=&'a $a>>(iter: I) -> $a {
                 iter.fold($zero, Add::add)
             }
         }
 
-        #[stable(feature = "iter_arith_traits", since = "1.12.0")]
+        #[$attr]
         impl<'a> Product<&'a $a> for $a {
             fn product<I: Iterator<Item=&'a $a>>(iter: I) -> $a {
                 iter.fold($one, Mul::mul)
@@ -633,8 +691,12 @@ fn product<I: Iterator<Item=&'a $a>>(iter: I) -> $a {
         }
     )*);
     ($($a:ty)*) => (
-        integer_sum_product!(@impls 0, 1, $($a)+);
-        integer_sum_product!(@impls Wrapping(0), Wrapping(1), $(Wrapping<$a>)+);
+        integer_sum_product!(@impls 0, 1,
+                #[stable(feature = "iter_arith_traits", since = "1.12.0")],
+                $($a)+);
+        integer_sum_product!(@impls Wrapping(0), Wrapping(1),
+                #[stable(feature = "wrapping_iter_arith", since = "1.14.0")],
+                $(Wrapping<$a>)+);
     );
 }
 
index 98871bd084e3ca8f609f5aed1ed8e96df24b2145..3d124a8aa8b75275cdc59844a945cc250576e5a6 100644 (file)
@@ -89,7 +89,7 @@
 #![feature(staged_api)]
 #![feature(unboxed_closures)]
 #![feature(never_type)]
-#![cfg_attr(not(stage0), feature(i128_type))]
+#![feature(i128_type)]
 #![feature(prelude_import)]
 
 #[prelude_import]
 #[path = "num/i16.rs"]   pub mod i16;
 #[path = "num/i32.rs"]   pub mod i32;
 #[path = "num/i64.rs"]   pub mod i64;
-
-// SNAP
-#[cfg(not(stage0))]
 #[path = "num/i128.rs"]   pub mod i128;
 
 #[path = "num/usize.rs"] pub mod usize;
 #[path = "num/u16.rs"]   pub mod u16;
 #[path = "num/u32.rs"]   pub mod u32;
 #[path = "num/u64.rs"]   pub mod u64;
-
-// SNAP
-#[cfg(not(stage0))]
 #[path = "num/u128.rs"]   pub mod u128;
 
 #[path = "num/f32.rs"]   pub mod f32;
index 539ad00bd30e039b2df991c346358452c8dd7f4b..d7382501bc325b4e8e6ed4465b5d78003db04c08 100644 (file)
@@ -30,9 +30,7 @@ unsafe impl Zeroable for i32 {}
 unsafe impl Zeroable for u32 {}
 unsafe impl Zeroable for i64 {}
 unsafe impl Zeroable for u64 {}
-#[cfg(not(stage0))]
 unsafe impl Zeroable for i128 {}
-#[cfg(not(stage0))]
 unsafe impl Zeroable for u128 {}
 
 /// A wrapper type for raw pointers and integers that will never be
index 04311d687ea92ad94e5f1a4bd9dcaa1f977e4fd1..3b1612a4ee29f8d051c0a8ec4b2cef9fa314c634 100644 (file)
 
 macro_rules! int_module {
     ($T:ident) => (int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]););
-    ($T:ident, $($attr: tt)*) => (
+    ($T:ident, #[$attr:meta]) => (
         /// The smallest value that can be represented by this integer type.
-        $($attr)*
+        #[$attr]
         pub const MIN: $T = $T::min_value();
         /// The largest value that can be represented by this integer type.
-        $($attr)*
+        #[$attr]
         pub const MAX: $T = $T::max_value();
     )
 }
index 61c687313dcb66e28277addff7edf755128305d8..97ea6bb347b54adcecb766ba32169583baccf75e 100644 (file)
@@ -144,9 +144,7 @@ fn one() -> Self { 1 }
         }
     )*)
 }
-zero_one_impl! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
-#[cfg(not(stage0))]
-zero_one_impl! { u128 i128 }
+zero_one_impl! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
 
 macro_rules! zero_one_impl_float {
     ($($t:ty)*) => ($(
@@ -1300,8 +1298,6 @@ impl i64 {
         intrinsics::mul_with_overflow }
 }
 
-// SNAP
-#[cfg(not(stage0))]
 #[lang = "i128"]
 impl i128 {
     int_impl! { i128, u128, 128,
@@ -2342,8 +2338,6 @@ impl u64 {
         intrinsics::mul_with_overflow }
 }
 
-// SNAP
-#[cfg(not(stage0))]
 #[lang = "u128"]
 impl u128 {
     uint_impl! { u128, 128,
@@ -2568,9 +2562,7 @@ fn from_str(src: &str) -> Result<Self, ParseIntError> {
         }
     )*}
 }
-from_str_radix_int_impl! { isize i8 i16 i32 i64 usize u8 u16 u32 u64 }
-#[cfg(not(stage0))]
-from_str_radix_int_impl! { u128 i128 }
+from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 }
 
 /// The error type returned when a checked integral type conversion fails.
 #[unstable(feature = "try_from", issue = "33417")]
@@ -2614,50 +2606,17 @@ fn try_from(u: $source) -> Result<$target, TryFromIntError> {
     )*}
 }
 
-#[cfg(stage0)]
-same_sign_try_from_int_impl!(u64, u8, u8, u16, u32, u64, usize);
-#[cfg(stage0)]
-same_sign_try_from_int_impl!(i64, i8, i8, i16, i32, i64, isize);
-#[cfg(stage0)]
-same_sign_try_from_int_impl!(u64, u16, u8, u16, u32, u64, usize);
-#[cfg(stage0)]
-same_sign_try_from_int_impl!(i64, i16, i8, i16, i32, i64, isize);
-#[cfg(stage0)]
-same_sign_try_from_int_impl!(u64, u32, u8, u16, u32, u64, usize);
-#[cfg(stage0)]
-same_sign_try_from_int_impl!(i64, i32, i8, i16, i32, i64, isize);
-#[cfg(stage0)]
-same_sign_try_from_int_impl!(u64, u64, u8, u16, u32, u64, usize);
-#[cfg(stage0)]
-same_sign_try_from_int_impl!(i64, i64, i8, i16, i32, i64, isize);
-#[cfg(stage0)]
-same_sign_try_from_int_impl!(u64, usize, u8, u16, u32, u64, usize);
-#[cfg(stage0)]
-same_sign_try_from_int_impl!(i64, isize, i8, i16, i32, i64, isize);
-
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(u128, u8, u8, u16, u32, u64, u128, usize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(i128, i8, i8, i16, i32, i64, i128, isize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(u128, u16, u8, u16, u32, u64, u128, usize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(i128, i16, i8, i16, i32, i64, i128, isize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(u128, u32, u8, u16, u32, u64, u128, usize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(i128, i32, i8, i16, i32, i64, i128, isize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(u128, u64, u8, u16, u32, u64, u128, usize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(i128, i64, i8, i16, i32, i64, i128, isize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(u128, u128, u8, u16, u32, u64, u128, usize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(i128, i128, i8, i16, i32, i64, i128, isize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(u128, usize, u8, u16, u32, u64, u128, usize);
-#[cfg(not(stage0))]
 same_sign_try_from_int_impl!(i128, isize, i8, i16, i32, i64, i128, isize);
 
 macro_rules! cross_sign_from_int_impl {
@@ -2667,8 +2626,8 @@ impl TryFrom<$unsigned> for $signed {
             type Err = TryFromIntError;
 
             fn try_from(u: $unsigned) -> Result<$signed, TryFromIntError> {
-                let max = <$signed as FromStrRadixHelper>::max_value() as u64;
-                if u as u64 > max {
+                let max = <$signed as FromStrRadixHelper>::max_value() as u128;
+                if u as u128 > max {
                     Err(TryFromIntError(()))
                 } else {
                     Ok(u as $signed)
@@ -2681,8 +2640,8 @@ impl TryFrom<$signed> for $unsigned {
             type Err = TryFromIntError;
 
             fn try_from(u: $signed) -> Result<$unsigned, TryFromIntError> {
-                let max = <$unsigned as FromStrRadixHelper>::max_value() as u64;
-                if u < 0 || u as u64 > max {
+                let max = <$unsigned as FromStrRadixHelper>::max_value() as u128;
+                if u < 0 || u as u128 > max {
                     Err(TryFromIntError(()))
                 } else {
                     Ok(u as $unsigned)
@@ -2692,28 +2651,11 @@ fn try_from(u: $signed) -> Result<$unsigned, TryFromIntError> {
     )*}
 }
 
-#[cfg(stage0)]
-cross_sign_from_int_impl!(u8, i8, i16, i32, i64, isize);
-#[cfg(stage0)]
-cross_sign_from_int_impl!(u16, i8, i16, i32, i64, isize);
-#[cfg(stage0)]
-cross_sign_from_int_impl!(u32, i8, i16, i32, i64, isize);
-#[cfg(stage0)]
-cross_sign_from_int_impl!(u64, i8, i16, i32, i64, isize);
-#[cfg(stage0)]
-cross_sign_from_int_impl!(usize, i8, i16, i32, i64, isize);
-
-#[cfg(not(stage0))]
 cross_sign_from_int_impl!(u8, i8, i16, i32, i64, i128, isize);
-#[cfg(not(stage0))]
 cross_sign_from_int_impl!(u16, i8, i16, i32, i64, i128, isize);
-#[cfg(not(stage0))]
 cross_sign_from_int_impl!(u32, i8, i16, i32, i64, i128, isize);
-#[cfg(not(stage0))]
 cross_sign_from_int_impl!(u64, i8, i16, i32, i64, i128, isize);
-#[cfg(not(stage0))]
 cross_sign_from_int_impl!(u128, i8, i16, i32, i64, i128, isize);
-#[cfg(not(stage0))]
 cross_sign_from_int_impl!(usize, i8, i16, i32, i64, i128, isize);
 
 #[doc(hidden)]
@@ -2742,9 +2684,7 @@ fn checked_add(&self, other: u32) -> Option<Self> {
         }
     })*)
 }
-doit! { i8 i16 i32 i64 isize u8 u16 u32 u64 usize }
-#[cfg(not(stage0))]
-doit! { i128 u128 }
+doit! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize }
 
 fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32) -> Result<T, ParseIntError> {
     use self::IntErrorKind::*;
@@ -2878,50 +2818,38 @@ fn from(small: $Small) -> $Large {
 impl_from! { u8, u16 }
 impl_from! { u8, u32 }
 impl_from! { u8, u64 }
-#[cfg(not(stage0))]
 impl_from! { u8, u128 }
 impl_from! { u8, usize }
 impl_from! { u16, u32 }
 impl_from! { u16, u64 }
-#[cfg(not(stage0))]
 impl_from! { u16, u128 }
 impl_from! { u32, u64 }
-#[cfg(not(stage0))]
 impl_from! { u32, u128 }
-#[cfg(not(stage0))]
 impl_from! { u64, u128 }
 
 // Signed -> Signed
 impl_from! { i8, i16 }
 impl_from! { i8, i32 }
 impl_from! { i8, i64 }
-#[cfg(not(stage0))]
 impl_from! { i8, i128 }
 impl_from! { i8, isize }
 impl_from! { i16, i32 }
 impl_from! { i16, i64 }
-#[cfg(not(stage0))]
 impl_from! { i16, i128 }
 impl_from! { i32, i64 }
-#[cfg(not(stage0))]
 impl_from! { i32, i128 }
-#[cfg(not(stage0))]
 impl_from! { i64, i128 }
 
 // Unsigned -> Signed
 impl_from! { u8, i16 }
 impl_from! { u8, i32 }
 impl_from! { u8, i64 }
-#[cfg(not(stage0))]
 impl_from! { u8, i128 }
 impl_from! { u16, i32 }
 impl_from! { u16, i64 }
-#[cfg(not(stage0))]
 impl_from! { u16, i128 }
 impl_from! { u32, i64 }
-#[cfg(not(stage0))]
 impl_from! { u32, i128 }
-#[cfg(not(stage0))]
 impl_from! { u64, i128 }
 
 // Note: integers can only be represented with full precision in a float if
index 2e59b39278ab6a9716b57b6bb21d3eba105ced19..f7e1f78d69ebf64396ae21e6cbff0323b4056b5b 100644 (file)
 
 macro_rules! uint_module {
     ($T:ident) => (uint_module!($T, #[stable(feature = "rust1", since = "1.0.0")]););
-    ($T:ident, $($attr: tt)*) => (
+    ($T:ident, #[$attr:meta]) => (
         /// The smallest value that can be represented by this integer type.
-        $($attr)*
+        #[$attr]
         pub const MIN: $T = $T::min_value();
         /// The largest value that can be represented by this integer type.
-        $($attr)*
+        #[$attr]
         pub const MAX: $T = $T::max_value();
     )
 }
index b3c2c25551e0d4b9d0b773b34445f388498872b5..013f02685bad117149951d86e56b9c3f662d6f71 100644 (file)
@@ -131,7 +131,8 @@ fn add(self, other: Wrapping<$t>) -> Wrapping<$t> {
                 Wrapping(self.0.wrapping_add(other.0))
             }
         }
-        forward_ref_binop! { impl Add, add for Wrapping<$t>, Wrapping<$t> }
+        forward_ref_binop! { impl Add, add for Wrapping<$t>, Wrapping<$t>,
+                #[stable(feature = "wrapping_ref", since = "1.14.0")] }
 
         #[stable(feature = "op_assign_traits", since = "1.8.0")]
         impl AddAssign for Wrapping<$t> {
@@ -150,7 +151,8 @@ fn sub(self, other: Wrapping<$t>) -> Wrapping<$t> {
                 Wrapping(self.0.wrapping_sub(other.0))
             }
         }
-        forward_ref_binop! { impl Sub, sub for Wrapping<$t>, Wrapping<$t> }
+        forward_ref_binop! { impl Sub, sub for Wrapping<$t>, Wrapping<$t>,
+                #[stable(feature = "wrapping_ref", since = "1.14.0")] }
 
         #[stable(feature = "op_assign_traits", since = "1.8.0")]
         impl SubAssign for Wrapping<$t> {
@@ -169,7 +171,8 @@ fn mul(self, other: Wrapping<$t>) -> Wrapping<$t> {
                 Wrapping(self.0.wrapping_mul(other.0))
             }
         }
-        forward_ref_binop! { impl Mul, mul for Wrapping<$t>, Wrapping<$t> }
+        forward_ref_binop! { impl Mul, mul for Wrapping<$t>, Wrapping<$t>,
+                #[stable(feature = "wrapping_ref", since = "1.14.0")] }
 
         #[stable(feature = "op_assign_traits", since = "1.8.0")]
         impl MulAssign for Wrapping<$t> {
@@ -188,7 +191,8 @@ fn div(self, other: Wrapping<$t>) -> Wrapping<$t> {
                 Wrapping(self.0.wrapping_div(other.0))
             }
         }
-        forward_ref_binop! { impl Div, div for Wrapping<$t>, Wrapping<$t> }
+        forward_ref_binop! { impl Div, div for Wrapping<$t>, Wrapping<$t>,
+                #[stable(feature = "wrapping_ref", since = "1.14.0")] }
 
         #[stable(feature = "op_assign_traits", since = "1.8.0")]
         impl DivAssign for Wrapping<$t> {
@@ -207,7 +211,8 @@ fn rem(self, other: Wrapping<$t>) -> Wrapping<$t> {
                 Wrapping(self.0.wrapping_rem(other.0))
             }
         }
-        forward_ref_binop! { impl Rem, rem for Wrapping<$t>, Wrapping<$t> }
+        forward_ref_binop! { impl Rem, rem for Wrapping<$t>, Wrapping<$t>,
+                #[stable(feature = "wrapping_ref", since = "1.14.0")] }
 
         #[stable(feature = "op_assign_traits", since = "1.8.0")]
         impl RemAssign for Wrapping<$t> {
@@ -226,7 +231,8 @@ fn not(self) -> Wrapping<$t> {
                 Wrapping(!self.0)
             }
         }
-        forward_ref_unop! { impl Not, not for Wrapping<$t> }
+        forward_ref_unop! { impl Not, not for Wrapping<$t>,
+                #[stable(feature = "wrapping_ref", since = "1.14.0")] }
 
         #[stable(feature = "rust1", since = "1.0.0")]
         impl BitXor for Wrapping<$t> {
@@ -237,7 +243,8 @@ fn bitxor(self, other: Wrapping<$t>) -> Wrapping<$t> {
                 Wrapping(self.0 ^ other.0)
             }
         }
-        forward_ref_binop! { impl BitXor, bitxor for Wrapping<$t>, Wrapping<$t> }
+        forward_ref_binop! { impl BitXor, bitxor for Wrapping<$t>, Wrapping<$t>,
+                #[stable(feature = "wrapping_ref", since = "1.14.0")] }
 
         #[stable(feature = "op_assign_traits", since = "1.8.0")]
         impl BitXorAssign for Wrapping<$t> {
@@ -256,7 +263,8 @@ fn bitor(self, other: Wrapping<$t>) -> Wrapping<$t> {
                 Wrapping(self.0 | other.0)
             }
         }
-        forward_ref_binop! { impl BitOr, bitor for Wrapping<$t>, Wrapping<$t> }
+        forward_ref_binop! { impl BitOr, bitor for Wrapping<$t>, Wrapping<$t>,
+                #[stable(feature = "wrapping_ref", since = "1.14.0")] }
 
         #[stable(feature = "op_assign_traits", since = "1.8.0")]
         impl BitOrAssign for Wrapping<$t> {
@@ -275,7 +283,8 @@ fn bitand(self, other: Wrapping<$t>) -> Wrapping<$t> {
                 Wrapping(self.0 & other.0)
             }
         }
-        forward_ref_binop! { impl BitAnd, bitand for Wrapping<$t>, Wrapping<$t> }
+        forward_ref_binop! { impl BitAnd, bitand for Wrapping<$t>, Wrapping<$t>,
+                #[stable(feature = "wrapping_ref", since = "1.14.0")] }
 
         #[stable(feature = "op_assign_traits", since = "1.8.0")]
         impl BitAndAssign for Wrapping<$t> {
@@ -293,13 +302,12 @@ fn neg(self) -> Self {
                 Wrapping(0) - self
             }
         }
-        forward_ref_unop! { impl Neg, neg for Wrapping<$t> }
+        forward_ref_unop! { impl Neg, neg for Wrapping<$t>,
+                #[stable(feature = "wrapping_ref", since = "1.14.0")] }
     )*)
 }
 
-wrapping_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-#[cfg(not(stage0))]
-wrapping_impl! { u128 i128 }
+wrapping_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
 mod shift_max {
     #![allow(non_upper_case_globals)]
index 9ff4725c9b36526809649c93a7a6c2731b2dd8ed..566fb89365a51ae3f42cca5dc13a24eca0f616c1 100644 (file)
@@ -267,9 +267,7 @@ fn add(self, other: $t) -> $t { self + other }
     )*)
 }
 
-add_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
-#[cfg(not(stage0))]
-add_impl! { u128 i128 }
+add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
 
 /// The `Sub` trait is used to specify the functionality of `-`.
 ///
@@ -342,9 +340,7 @@ fn sub(self, other: $t) -> $t { self - other }
     )*)
 }
 
-sub_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
-#[cfg(not(stage0))]
-sub_impl! { u128 i128 }
+sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
 
 /// The `Mul` trait is used to specify the functionality of `*`.
 ///
@@ -466,9 +462,7 @@ fn mul(self, other: $t) -> $t { self * other }
     )*)
 }
 
-mul_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
-#[cfg(not(stage0))]
-mul_impl! { u128 i128 }
+mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
 
 /// The `Div` trait is used to specify the functionality of `/`.
 ///
@@ -597,9 +591,7 @@ fn div(self, other: $t) -> $t { self / other }
     )*)
 }
 
-div_impl_integer! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-#[cfg(not(stage0))]
-div_impl_integer! { u128 i128 }
+div_impl_integer! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
 macro_rules! div_impl_float {
     ($($t:ty)*) => ($(
@@ -678,9 +670,7 @@ fn rem(self, other: $t) -> $t { self % other }
     )*)
 }
 
-rem_impl_integer! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-#[cfg(not(stage0))]
-rem_impl_integer! { u128 i128 }
+rem_impl_integer! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
 
 macro_rules! rem_impl_float {
@@ -776,9 +766,7 @@ macro_rules! neg_impl_unsigned {
 }
 
 // neg_impl_unsigned! { usize u8 u16 u32 u64 }
-neg_impl_numeric! { isize i8 i16 i32 i64 f32 f64 }
-#[cfg(not(stage0))]
-neg_impl_numeric! { i128 }
+neg_impl_numeric! { isize i8 i16 i32 i64 i128 f32 f64 }
 
 /// The `Not` trait is used to specify the functionality of unary `!`.
 ///
@@ -836,9 +824,7 @@ fn not(self) -> $t { !self }
     )*)
 }
 
-not_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-#[cfg(not(stage0))]
-not_impl! { u128 i128 }
+not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
 /// The `BitAnd` trait is used to specify the functionality of `&`.
 ///
@@ -921,9 +907,7 @@ fn bitand(self, rhs: $t) -> $t { self & rhs }
     )*)
 }
 
-bitand_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-#[cfg(not(stage0))]
-bitand_impl! { u128 i128 }
+bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
 /// The `BitOr` trait is used to specify the functionality of `|`.
 ///
@@ -1006,9 +990,7 @@ fn bitor(self, rhs: $t) -> $t { self | rhs }
     )*)
 }
 
-bitor_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-#[cfg(not(stage0))]
-bitor_impl! { u128 i128 }
+bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
 /// The `BitXor` trait is used to specify the functionality of `^`.
 ///
@@ -1094,9 +1076,7 @@ fn bitxor(self, other: $t) -> $t { self ^ other }
     )*)
 }
 
-bitxor_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-#[cfg(not(stage0))]
-bitxor_impl! { u128 i128 }
+bitxor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
 /// The `Shl` trait is used to specify the functionality of `<<`.
 ///
@@ -1187,7 +1167,6 @@ macro_rules! shl_impl_all {
         shl_impl! { $t, u16 }
         shl_impl! { $t, u32 }
         shl_impl! { $t, u64 }
-        #[cfg(not(stage0))]
         shl_impl! { $t, u128 }
         shl_impl! { $t, usize }
 
@@ -1195,15 +1174,12 @@ macro_rules! shl_impl_all {
         shl_impl! { $t, i16 }
         shl_impl! { $t, i32 }
         shl_impl! { $t, i64 }
-        #[cfg(not(stage0))]
         shl_impl! { $t, i128 }
         shl_impl! { $t, isize }
     )*)
 }
 
-shl_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
-#[cfg(not(stage0))]
-shl_impl_all! { u128 i128 }
+shl_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 }
 
 /// The `Shr` trait is used to specify the functionality of `>>`.
 ///
@@ -1294,7 +1270,6 @@ macro_rules! shr_impl_all {
         shr_impl! { $t, u16 }
         shr_impl! { $t, u32 }
         shr_impl! { $t, u64 }
-        #[cfg(not(stage0))]
         shr_impl! { $t, u128 }
         shr_impl! { $t, usize }
 
@@ -1302,15 +1277,12 @@ macro_rules! shr_impl_all {
         shr_impl! { $t, i16 }
         shr_impl! { $t, i32 }
         shr_impl! { $t, i64 }
-        #[cfg(not(stage0))]
         shr_impl! { $t, i128 }
         shr_impl! { $t, isize }
     )*)
 }
 
-shr_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
-#[cfg(not(stage0))]
-shr_impl_all! { u128 i128 }
+shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
 
 /// The `AddAssign` trait is used to specify the functionality of `+=`.
 ///
@@ -1366,9 +1338,7 @@ fn add_assign(&mut self, other: $t) { *self += other }
     )+)
 }
 
-add_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
-#[cfg(not(stage0))]
-add_assign_impl! { u128 i128 }
+add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
 
 /// The `SubAssign` trait is used to specify the functionality of `-=`.
 ///
@@ -1424,9 +1394,7 @@ fn sub_assign(&mut self, other: $t) { *self -= other }
     )+)
 }
 
-sub_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
-#[cfg(not(stage0))]
-sub_assign_impl! { u128 i128 }
+sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
 
 /// The `MulAssign` trait is used to specify the functionality of `*=`.
 ///
@@ -1471,9 +1439,7 @@ fn mul_assign(&mut self, other: $t) { *self *= other }
     )+)
 }
 
-mul_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
-#[cfg(not(stage0))]
-mul_assign_impl! { u128 i128 }
+mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
 
 /// The `DivAssign` trait is used to specify the functionality of `/=`.
 ///
@@ -1517,9 +1483,7 @@ fn div_assign(&mut self, other: $t) { *self /= other }
     )+)
 }
 
-div_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
-#[cfg(not(stage0))]
-div_assign_impl! { u128 i128 }
+div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
 
 /// The `RemAssign` trait is used to specify the functionality of `%=`.
 ///
@@ -1563,9 +1527,7 @@ fn rem_assign(&mut self, other: $t) { *self %= other }
     )+)
 }
 
-rem_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
-#[cfg(not(stage0))]
-rem_assign_impl! { u128 i128 }
+rem_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
 
 /// The `BitAndAssign` trait is used to specify the functionality of `&=`.
 ///
@@ -1651,9 +1613,7 @@ fn bitand_assign(&mut self, other: $t) { *self &= other }
     )+)
 }
 
-bitand_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-#[cfg(not(stage0))]
-bitand_assign_impl! { u128 i128 }
+bitand_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
 /// The `BitOrAssign` trait is used to specify the functionality of `|=`.
 ///
@@ -1697,9 +1657,7 @@ fn bitor_assign(&mut self, other: $t) { *self |= other }
     )+)
 }
 
-bitor_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-#[cfg(not(stage0))]
-bitor_assign_impl! { u128 i128 }
+bitor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
 /// The `BitXorAssign` trait is used to specify the functionality of `^=`.
 ///
@@ -1743,9 +1701,7 @@ fn bitxor_assign(&mut self, other: $t) { *self ^= other }
     )+)
 }
 
-bitxor_assign_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
-#[cfg(not(stage0))]
-bitxor_assign_impl! { u128 i128 }
+bitxor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
 /// The `ShlAssign` trait is used to specify the functionality of `<<=`.
 ///
@@ -1798,7 +1754,6 @@ macro_rules! shl_assign_impl_all {
         shl_assign_impl! { $t, u16 }
         shl_assign_impl! { $t, u32 }
         shl_assign_impl! { $t, u64 }
-        #[cfg(not(stage0))]
         shl_assign_impl! { $t, u128 }
         shl_assign_impl! { $t, usize }
 
@@ -1806,15 +1761,12 @@ macro_rules! shl_assign_impl_all {
         shl_assign_impl! { $t, i16 }
         shl_assign_impl! { $t, i32 }
         shl_assign_impl! { $t, i64 }
-        #[cfg(not(stage0))]
         shl_assign_impl! { $t, i128 }
         shl_assign_impl! { $t, isize }
     )*)
 }
 
-shl_assign_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
-#[cfg(not(stage0))]
-shl_assign_impl_all! { u128 i128 }
+shl_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
 
 /// The `ShrAssign` trait is used to specify the functionality of `>>=`.
 ///
@@ -1867,7 +1819,6 @@ macro_rules! shr_assign_impl_all {
         shr_assign_impl! { $t, u16 }
         shr_assign_impl! { $t, u32 }
         shr_assign_impl! { $t, u64 }
-        #[cfg(not(stage0))]
         shr_assign_impl! { $t, u128 }
         shr_assign_impl! { $t, usize }
 
@@ -1875,15 +1826,12 @@ macro_rules! shr_assign_impl_all {
         shr_assign_impl! { $t, i16 }
         shr_assign_impl! { $t, i32 }
         shr_assign_impl! { $t, i64 }
-        #[cfg(not(stage0))]
         shr_assign_impl! { $t, i128 }
         shr_assign_impl! { $t, isize }
     )*)
 }
 
-shr_assign_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
-#[cfg(not(stage0))]
-shr_assign_impl_all! { u128 i128 }
+shr_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
 
 /// The `Index` trait is used to specify the functionality of indexing operations
 /// like `container[index]` when used in an immutable context.
index c4d7b2dcf96fb258f38a88754387d2e4cda4ba9c..9df8350d90ffdc8cb864ed4899b57018e390139f 100644 (file)
@@ -632,6 +632,76 @@ pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> {
         }
     }
 
+    /////////////////////////////////////////////////////////////////////////
+    // Entry-like operations to insert if None and return a reference
+    /////////////////////////////////////////////////////////////////////////
+
+    /// Inserts `v` into the option if it is `None`, then
+    /// returns a mutable reference to the contained value.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(option_entry)]
+    ///
+    /// let mut x = None;
+    ///
+    /// {
+    ///     let y: &mut u32 = x.get_or_insert(5);
+    ///     assert_eq!(y, &5);
+    ///
+    ///     *y = 7;
+    /// }
+    ///
+    /// assert_eq!(x, Some(7));
+    /// ```
+    #[inline]
+    #[unstable(feature = "option_entry", issue = "39288")]
+    pub fn get_or_insert(&mut self, v: T) -> &mut T {
+        match *self {
+            None => *self = Some(v),
+            _ => (),
+        }
+
+        match *self {
+            Some(ref mut v) => v,
+            _ => unreachable!(),
+        }
+    }
+
+    /// Inserts a value computed from `f` into the option if it is `None`, then
+    /// returns a mutable reference to the contained value.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(option_entry)]
+    ///
+    /// let mut x = None;
+    ///
+    /// {
+    ///     let y: &mut u32 = x.get_or_insert_with(|| 5);
+    ///     assert_eq!(y, &5);
+    ///
+    ///     *y = 7;
+    /// }
+    ///
+    /// assert_eq!(x, Some(7));
+    /// ```
+    #[inline]
+    #[unstable(feature = "option_entry", issue = "39288")]
+    pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T {
+        match *self {
+            None => *self = Some(f()),
+            _ => (),
+        }
+
+        match *self {
+            Some(ref mut v) => v,
+            _ => unreachable!(),
+        }
+    }
+
     /////////////////////////////////////////////////////////////////////////
     // Misc
     /////////////////////////////////////////////////////////////////////////
index b942d85f9808bd8147b8dd5d79ecf36c3559bde4..1a482b75731c102fc36b1e92d772822f2e8a07fd 100644 (file)
@@ -616,7 +616,7 @@ pub trait SliceIndex<T> {
     fn index_mut(self, slice: &mut [T]) -> &mut Self::Output;
 }
 
-#[stable(feature = "slice-get-slice-impls", since = "1.13.0")]
+#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
 impl<T> SliceIndex<T> for usize {
     type Output = T;
 
@@ -665,7 +665,7 @@ fn index_mut(self, slice: &mut [T]) -> &mut T {
     }
 }
 
-#[stable(feature = "slice-get-slice-impls", since = "1.13.0")]
+#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
 impl<T> SliceIndex<T> for  ops::Range<usize> {
     type Output = [T];
 
@@ -726,7 +726,7 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] {
     }
 }
 
-#[stable(feature = "slice-get-slice-impls", since = "1.13.0")]
+#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
 impl<T> SliceIndex<T> for ops::RangeTo<usize> {
     type Output = [T];
 
@@ -761,7 +761,7 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] {
     }
 }
 
-#[stable(feature = "slice-get-slice-impls", since = "1.13.0")]
+#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
 impl<T> SliceIndex<T> for ops::RangeFrom<usize> {
     type Output = [T];
 
@@ -796,7 +796,7 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] {
     }
 }
 
-#[stable(feature = "slice-get-slice-impls", since = "1.13.0")]
+#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
 impl<T> SliceIndex<T> for ops::RangeFull {
     type Output = [T];
 
@@ -832,7 +832,7 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] {
 }
 
 
-#[stable(feature = "slice-get-slice-impls", since = "1.13.0")]
+#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
 impl<T> SliceIndex<T> for ops::RangeInclusive<usize> {
     type Output = [T];
 
@@ -895,7 +895,7 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] {
     }
 }
 
-#[stable(feature = "slice-get-slice-impls", since = "1.13.0")]
+#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
 impl<T> SliceIndex<T> for ops::RangeToInclusive<usize> {
     type Output = [T];
 
index a9fc8913182b37ddf18611f492a6fab730ac9d3e..2d3e81aa131ed4ceb5fc7d2696af966b9d9c660b 100644 (file)
@@ -7,9 +7,8 @@
 // <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 core::any::*;
-use test::Bencher;
-use test;
 
 #[derive(PartialEq, Debug)]
 struct Test;
@@ -124,13 +123,3 @@ fn any_unsized() {
     fn is_any<T: Any + ?Sized>() {}
     is_any::<[i32]>();
 }
-
-#[bench]
-fn bench_downcast_ref(b: &mut Bencher) {
-    b.iter(|| {
-        let mut x = 0;
-        let mut y = &mut x as &mut Any;
-        test::black_box(&mut y);
-        test::black_box(y.downcast_ref::<isize>() == Some(&0));
-    });
-}
index 724a312ea79e0a7427df2856805485c8cc146802..8585f2f08711332a3e5af0fa53145df9e1b657ec 100644 (file)
@@ -209,6 +209,37 @@ fn cell_default() {
     assert_eq!(0, cell.get());
 }
 
+#[test]
+fn cell_set() {
+    let cell = Cell::new(10);
+    cell.set(20);
+    assert_eq!(20, cell.get());
+
+    let cell = Cell::new("Hello".to_owned());
+    cell.set("World".to_owned());
+    assert_eq!("World".to_owned(), cell.into_inner());
+}
+
+#[test]
+fn cell_replace() {
+    let cell = Cell::new(10);
+    assert_eq!(10, cell.replace(20));
+    assert_eq!(20, cell.get());
+
+    let cell = Cell::new("Hello".to_owned());
+    assert_eq!("Hello".to_owned(), cell.replace("World".to_owned()));
+    assert_eq!("World".to_owned(), cell.into_inner());
+}
+
+#[test]
+fn cell_into_inner() {
+    let cell = Cell::new(10);
+    assert_eq!(10, cell.into_inner());
+
+    let cell = Cell::new("Hello world".to_owned());
+    assert_eq!("Hello world".to_owned(), cell.into_inner());
+}
+
 #[test]
 fn refcell_default() {
     let cell: RefCell<u64> = Default::default();
index ed33596e1c264562ab48e0c3d4ef3e11912172e6..5d204c7d523d681a937b5f3d540c889cb7920948 100644 (file)
@@ -28,3 +28,13 @@ fn test_pointer_formats_data_pointer() {
     assert_eq!(format!("{:p}", s), format!("{:p}", s.as_ptr()));
     assert_eq!(format!("{:p}", b), format!("{:p}", b.as_ptr()));
 }
+
+#[test]
+fn test_estimated_capacity() {
+    assert_eq!(format_args!("").estimated_capacity(), 0);
+    assert_eq!(format_args!("{}", "").estimated_capacity(), 0);
+    assert_eq!(format_args!("Hello").estimated_capacity(), 5);
+    assert_eq!(format_args!("Hello, {}!", "").estimated_capacity(), 16);
+    assert_eq!(format_args!("{}, hello!", "World").estimated_capacity(), 0);
+    assert_eq!(format_args!("{}. 16-bytes piece", "World").estimated_capacity(), 32);
+}
index 0d124338133430d3cbf27494895f98dd3407498b..53ac17c052f6af89a27831ba50f2f7d1686bb4ba 100644 (file)
@@ -66,7 +66,6 @@ fn hash<T: Hash>(t: &T) -> u64 {
     assert_eq!(hash(& s), 97 + 0xFF);
     let cs: &[u8] = &[1, 2, 3];
     assert_eq!(hash(& cs), 9);
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let cs: Box<[u8]> = Box::new([1, 2, 3]);
     assert_eq!(hash(& cs), 9);
 
index fa3bfdea42df8194734d8ccb3e80222f9b1d5636..4a9657e03404af4f6d02cf79a05c92e8a05c8ebb 100644 (file)
@@ -10,8 +10,6 @@
 
 #![allow(deprecated)]
 
-use test::{Bencher, black_box};
-
 use core::hash::{Hash, Hasher};
 use core::hash::{SipHasher, SipHasher13, SipHasher24};
 use core::{slice, mem};
@@ -58,11 +56,6 @@ fn hash<T: Hash>(x: &T) -> u64 {
     hash_with(SipHasher::new(), x)
 }
 
-fn hash_bytes<H: Hasher>(mut s: H, x: &[u8]) -> u64 {
-    Hasher::write(&mut s, x);
-    s.finish()
-}
-
 #[test]
 #[allow(unused_must_use)]
 fn test_siphash_1_3() {
@@ -347,126 +340,3 @@ fn test_write_short_works() {
     h2.write(&[0xFFu8, 0x01u8]);
     assert_eq!(h1.finish(), h2.finish());
 }
-
-#[bench]
-fn bench_str_under_8_bytes(b: &mut Bencher) {
-    let s = "foo";
-    b.iter(|| {
-        assert_eq!(hash(&s), 16262950014981195938);
-    })
-}
-
-#[bench]
-fn bench_str_of_8_bytes(b: &mut Bencher) {
-    let s = "foobar78";
-    b.iter(|| {
-        assert_eq!(hash(&s), 4898293253460910787);
-    })
-}
-
-#[bench]
-fn bench_str_over_8_bytes(b: &mut Bencher) {
-    let s = "foobarbaz0";
-    b.iter(|| {
-        assert_eq!(hash(&s), 10581415515220175264);
-    })
-}
-
-#[bench]
-fn bench_long_str(b: &mut Bencher) {
-    let s = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor \
-incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \
-exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute \
-irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla \
-pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui \
-officia deserunt mollit anim id est laborum.";
-    b.iter(|| {
-        assert_eq!(hash(&s), 17717065544121360093);
-    })
-}
-
-#[bench]
-fn bench_u32(b: &mut Bencher) {
-    let u = 162629500u32;
-    let u = black_box(u);
-    b.iter(|| {
-        hash(&u)
-    });
-    b.bytes = 8;
-}
-
-#[bench]
-fn bench_u32_keyed(b: &mut Bencher) {
-    let u = 162629500u32;
-    let u = black_box(u);
-    let k1 = black_box(0x1);
-    let k2 = black_box(0x2);
-    b.iter(|| {
-        hash_with(SipHasher::new_with_keys(k1, k2), &u)
-    });
-    b.bytes = 8;
-}
-
-#[bench]
-fn bench_u64(b: &mut Bencher) {
-    let u = 16262950014981195938u64;
-    let u = black_box(u);
-    b.iter(|| {
-        hash(&u)
-    });
-    b.bytes = 8;
-}
-
-#[bench]
-fn bench_bytes_4(b: &mut Bencher) {
-    let data = black_box([b' '; 4]);
-    b.iter(|| {
-        hash_bytes(SipHasher::default(), &data)
-    });
-    b.bytes = 4;
-}
-
-#[bench]
-fn bench_bytes_7(b: &mut Bencher) {
-    let data = black_box([b' '; 7]);
-    b.iter(|| {
-        hash_bytes(SipHasher::default(), &data)
-    });
-    b.bytes = 7;
-}
-
-#[bench]
-fn bench_bytes_8(b: &mut Bencher) {
-    let data = black_box([b' '; 8]);
-    b.iter(|| {
-        hash_bytes(SipHasher::default(), &data)
-    });
-    b.bytes = 8;
-}
-
-#[bench]
-fn bench_bytes_a_16(b: &mut Bencher) {
-    let data = black_box([b' '; 16]);
-    b.iter(|| {
-        hash_bytes(SipHasher::default(), &data)
-    });
-    b.bytes = 16;
-}
-
-#[bench]
-fn bench_bytes_b_32(b: &mut Bencher) {
-    let data = black_box([b' '; 32]);
-    b.iter(|| {
-        hash_bytes(SipHasher::default(), &data)
-    });
-    b.bytes = 32;
-}
-
-#[bench]
-fn bench_bytes_c_128(b: &mut Bencher) {
-    let data = black_box([b' '; 128]);
-    b.iter(|| {
-        hash_bytes(SipHasher::default(), &data)
-    });
-    b.bytes = 128;
-}
index 99d312930533f31ec482d683f6c2e4010014c5f3..08442f9bcbff522d498b826d3dda8d1faf1b011e 100644 (file)
@@ -12,9 +12,6 @@
 use core::{i8, i16, isize};
 use core::usize;
 
-use test::Bencher;
-use test::black_box;
-
 #[test]
 fn test_lt() {
     let empty: [isize; 0] = [];
@@ -191,6 +188,12 @@ fn test_iterator_enumerate_count() {
     assert_eq!(xs.iter().count(), 6);
 }
 
+#[test]
+fn test_iterator_filter_count() {
+    let xs = [0, 1, 2, 3, 4, 5, 6, 7, 8];
+    assert_eq!(xs.iter().filter(|&&x| x % 2 == 0).count(), 5);
+}
+
 #[test]
 fn test_iterator_peekable() {
     let xs = vec![0, 1, 2, 3, 4, 5];
@@ -700,7 +703,6 @@ fn test_collect() {
 
 #[test]
 fn test_all() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let v: Box<[isize]> = Box::new([1, 2, 3, 4, 5]);
     assert!(v.iter().all(|&x| x < 10));
     assert!(!v.iter().all(|&x| x % 2 == 0));
@@ -710,7 +712,6 @@ fn test_all() {
 
 #[test]
 fn test_any() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let v: Box<[isize]> = Box::new([1, 2, 3, 4, 5]);
     assert!(v.iter().any(|&x| x < 10));
     assert!(v.iter().any(|&x| x % 2 == 0));
@@ -1081,91 +1082,3 @@ fn test_chain_fold() {
     assert_eq!(&[2, 3, 1, 2, 0], &result[..]);
 }
 
-#[bench]
-fn bench_rposition(b: &mut Bencher) {
-    let it: Vec<usize> = (0..300).collect();
-    b.iter(|| {
-        it.iter().rposition(|&x| x <= 150);
-    });
-}
-
-#[bench]
-fn bench_skip_while(b: &mut Bencher) {
-    b.iter(|| {
-        let it = 0..100;
-        let mut sum = 0;
-        it.skip_while(|&x| { sum += x; sum < 4000 }).all(|_| true);
-    });
-}
-
-#[bench]
-fn bench_multiple_take(b: &mut Bencher) {
-    let mut it = (0..42).cycle();
-    b.iter(|| {
-        let n = it.next().unwrap();
-        for _ in 0..n {
-            it.clone().take(it.next().unwrap()).all(|_| true);
-        }
-    });
-}
-
-fn scatter(x: i32) -> i32 { (x * 31) % 127 }
-
-#[bench]
-fn bench_max_by_key(b: &mut Bencher) {
-    b.iter(|| {
-        let it = 0..100;
-        it.max_by_key(|&x| scatter(x))
-    })
-}
-
-// http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
-#[bench]
-fn bench_max_by_key2(b: &mut Bencher) {
-    fn max_index_iter(array: &[i32]) -> usize {
-        array.iter().enumerate().max_by_key(|&(_, item)| item).unwrap().0
-    }
-
-    let mut data = vec![0; 1638];
-    data[514] = 9999;
-
-    b.iter(|| max_index_iter(&data));
-}
-
-#[bench]
-fn bench_max(b: &mut Bencher) {
-    b.iter(|| {
-        let it = 0..100;
-        it.map(scatter).max()
-    })
-}
-
-pub fn copy_zip(xs: &[u8], ys: &mut [u8]) {
-    for (a, b) in ys.iter_mut().zip(xs) {
-        *a = *b;
-    }
-}
-
-pub fn add_zip(xs: &[f32], ys: &mut [f32]) {
-    for (a, b) in ys.iter_mut().zip(xs) {
-        *a += *b;
-    }
-}
-
-#[bench]
-fn bench_zip_copy(b: &mut Bencher) {
-    let source = vec![0u8; 16 * 1024];
-    let mut dst = black_box(vec![0u8; 16 * 1024]);
-    b.iter(|| {
-        copy_zip(&source, &mut dst)
-    })
-}
-
-#[bench]
-fn bench_zip_add(b: &mut Bencher) {
-    let source = vec![1.; 16 * 1024];
-    let mut dst = vec![0.; 16 * 1024];
-    b.iter(|| {
-        add_zip(&source, &mut dst)
-    });
-}
index 8e5893b5ecbed8de5b000b7b9333ae71be31b36c..e06b757691e5ac29462159f04ce7e57831676893 100644 (file)
@@ -33,6 +33,8 @@
 #![feature(unique)]
 #![feature(ordering_chaining)]
 #![feature(ptr_unaligned)]
+#![feature(move_cell)]
+#![feature(fmt_internals)]
 
 extern crate core;
 extern crate test;
index 01bafe49a7acd4820e4ca9bc657c9308d5d36670..86e59c736ba4a133b8d3257a2c56661c1fa07e33 100644 (file)
@@ -7,8 +7,8 @@
 // <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 core::mem::*;
-use test::Bencher;
 
 #[test]
 fn size_of_basic() {
@@ -121,61 +121,3 @@ impl Foo for isize {}
     }
 }
 
-// FIXME #13642 (these benchmarks should be in another place)
-/// Completely miscellaneous language-construct benchmarks.
-// Static/dynamic method dispatch
-
-struct Struct {
-    field: isize
-}
-
-trait Trait {
-    fn method(&self) -> isize;
-}
-
-impl Trait for Struct {
-    fn method(&self) -> isize {
-        self.field
-    }
-}
-
-#[bench]
-fn trait_vtable_method_call(b: &mut Bencher) {
-    let s = Struct { field: 10 };
-    let t = &s as &Trait;
-    b.iter(|| {
-        t.method()
-    });
-}
-
-#[bench]
-fn trait_static_method_call(b: &mut Bencher) {
-    let s = Struct { field: 10 };
-    b.iter(|| {
-        s.method()
-    });
-}
-
-// Overhead of various match forms
-
-#[bench]
-fn match_option_some(b: &mut Bencher) {
-    let x = Some(10);
-    b.iter(|| {
-        match x {
-            Some(y) => y,
-            None => 11
-        }
-    });
-}
-
-#[bench]
-fn match_vec_pattern(b: &mut Bencher) {
-    let x = [1,2,3,4,5,6];
-    b.iter(|| {
-        match x {
-            [1,2,3,..] => 10,
-            _ => 11,
-        }
-    });
-}
index fe6f52406fbc834406485e732d1583407f38f9ec..5d546c643e7ee5248ee42b42cc481d24a0d0bd3a 100644 (file)
@@ -11,7 +11,6 @@
 #![allow(overflowing_literals)]
 
 use std::{i64, f32, f64};
-use test;
 
 mod parse;
 mod rawfp;
@@ -144,59 +143,3 @@ fn borderline_overflow() {
     // It makes no sense to enshrine that in a test, the important part is that it doesn't panic.
     let _ = s.parse::<f64>();
 }
-
-#[bench]
-fn bench_0(b: &mut test::Bencher) {
-    b.iter(|| "0.0".parse::<f64>());
-}
-
-#[bench]
-fn bench_42(b: &mut test::Bencher) {
-    b.iter(|| "42".parse::<f64>());
-}
-
-#[bench]
-fn bench_huge_int(b: &mut test::Bencher) {
-    // 2^128 - 1
-    b.iter(|| "170141183460469231731687303715884105727".parse::<f64>());
-}
-
-#[bench]
-fn bench_short_decimal(b: &mut test::Bencher) {
-    b.iter(|| "1234.5678".parse::<f64>());
-}
-
-#[bench]
-fn bench_pi_long(b: &mut test::Bencher) {
-    b.iter(|| "3.14159265358979323846264338327950288".parse::<f64>());
-}
-
-#[bench]
-fn bench_pi_short(b: &mut test::Bencher) {
-    b.iter(|| "3.141592653589793".parse::<f64>())
-}
-
-#[bench]
-fn bench_1e150(b: &mut test::Bencher) {
-    b.iter(|| "1e150".parse::<f64>());
-}
-
-#[bench]
-fn bench_long_decimal_and_exp(b: &mut test::Bencher) {
-    b.iter(|| "727501488517303786137132964064381141071e-123".parse::<f64>());
-}
-
-#[bench]
-fn bench_min_subnormal(b: &mut test::Bencher) {
-    b.iter(|| "5e-324".parse::<f64>());
-}
-
-#[bench]
-fn bench_min_normal(b: &mut test::Bencher) {
-    b.iter(|| "2.2250738585072014e-308".parse::<f64>());
-}
-
-#[bench]
-fn bench_max(b: &mut test::Bencher) {
-    b.iter(|| "1.7976931348623157e308".parse::<f64>());
-}
index 08c2cd0a7326f27534db3fa5fe5d2c9e08700482..4edb0f3df60c44ea3d0b1aa7c76c379cb5d37de5 100644 (file)
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 use std::prelude::v1::*;
-use std::{i16, f64};
 use super::super::*;
 use core::num::bignum::Big32x40 as Big;
 use core::num::flt2dec::strategy::dragon::*;
@@ -53,62 +52,6 @@ fn exact_sanity_test() {
     f32_exact_sanity_test(format_exact);
 }
 
-#[bench]
-fn bench_small_shortest(b: &mut Bencher) {
-    let decoded = decode_finite(3.141592f64);
-    let mut buf = [0; MAX_SIG_DIGITS];
-    b.iter(|| format_shortest(&decoded, &mut buf));
-}
-
-#[bench]
-fn bench_big_shortest(b: &mut Bencher) {
-    let decoded = decode_finite(f64::MAX);
-    let mut buf = [0; MAX_SIG_DIGITS];
-    b.iter(|| format_shortest(&decoded, &mut buf));
-}
-
-#[bench]
-fn bench_small_exact_3(b: &mut Bencher) {
-    let decoded = decode_finite(3.141592f64);
-    let mut buf = [0; 3];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
-#[bench]
-fn bench_big_exact_3(b: &mut Bencher) {
-    let decoded = decode_finite(f64::MAX);
-    let mut buf = [0; 3];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
-#[bench]
-fn bench_small_exact_12(b: &mut Bencher) {
-    let decoded = decode_finite(3.141592f64);
-    let mut buf = [0; 12];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
-#[bench]
-fn bench_big_exact_12(b: &mut Bencher) {
-    let decoded = decode_finite(f64::MAX);
-    let mut buf = [0; 12];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
-#[bench]
-fn bench_small_exact_inf(b: &mut Bencher) {
-    let decoded = decode_finite(3.141592f64);
-    let mut buf = [0; 1024];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
-#[bench]
-fn bench_big_exact_inf(b: &mut Bencher) {
-    let decoded = decode_finite(f64::MAX);
-    let mut buf = [0; 1024];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
 #[test]
 fn test_to_shortest_str() {
     to_shortest_str_test(format_shortest);
index 311bd252353c770b4b7d7fab1a529f5f72908495..79e66ee669e146d13e9addfaf635d1eee5670db4 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::{i16, f64};
+use std::i16;
 use super::super::*;
 use core::num::flt2dec::strategy::grisu::*;
 
@@ -102,62 +102,6 @@ fn exact_f64_random_equivalence_test() {
     }
 }
 
-#[bench]
-fn bench_small_shortest(b: &mut Bencher) {
-    let decoded = decode_finite(3.141592f64);
-    let mut buf = [0; MAX_SIG_DIGITS];
-    b.iter(|| format_shortest(&decoded, &mut buf));
-}
-
-#[bench]
-fn bench_big_shortest(b: &mut Bencher) {
-    let decoded = decode_finite(f64::MAX);
-    let mut buf = [0; MAX_SIG_DIGITS];
-    b.iter(|| format_shortest(&decoded, &mut buf));
-}
-
-#[bench]
-fn bench_small_exact_3(b: &mut Bencher) {
-    let decoded = decode_finite(3.141592f64);
-    let mut buf = [0; 3];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
-#[bench]
-fn bench_big_exact_3(b: &mut Bencher) {
-    let decoded = decode_finite(f64::MAX);
-    let mut buf = [0; 3];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
-#[bench]
-fn bench_small_exact_12(b: &mut Bencher) {
-    let decoded = decode_finite(3.141592f64);
-    let mut buf = [0; 12];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
-#[bench]
-fn bench_big_exact_12(b: &mut Bencher) {
-    let decoded = decode_finite(f64::MAX);
-    let mut buf = [0; 12];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
-#[bench]
-fn bench_small_exact_inf(b: &mut Bencher) {
-    let decoded = decode_finite(3.141592f64);
-    let mut buf = [0; 1024];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
-#[bench]
-fn bench_big_exact_inf(b: &mut Bencher) {
-    let decoded = decode_finite(f64::MAX);
-    let mut buf = [0; 1024];
-    b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
-}
-
 #[test]
 fn test_to_shortest_str() {
     to_shortest_str_test(format_shortest);
index 4834c0e072c9e412ae0da21751c3b1a73deb4f6d..51737c9c3b485e42b74b47e3671ee5eecc53a90d 100644 (file)
@@ -366,3 +366,35 @@ fn $fn_name() {
 test_impl_try_from_same_sign_err! { test_try_i64i8, i64, i8 }
 test_impl_try_from_same_sign_err! { test_try_i64i16, i64, i16 }
 test_impl_try_from_same_sign_err! { test_try_i64i32, i64, i32 }
+
+macro_rules! test_impl_try_from_signed_to_unsigned_err {
+    ($fn_name:ident, $source:ty, $target:ty) => {
+        #[test]
+        fn $fn_name() {
+            let max = <$source>::max_value();
+            let min = <$source>::min_value();
+            let zero: $source = 0;
+            let t_max = <$target>::max_value();
+            let t_min = <$target>::min_value();
+            assert!(<$target as TryFrom<$source>>::try_from(max).is_err());
+            assert!(<$target as TryFrom<$source>>::try_from(min).is_err());
+            assert_eq!(<$target as TryFrom<$source>>::try_from(zero).unwrap(),
+                       zero as $target);
+            assert_eq!(<$target as TryFrom<$source>>::try_from(t_max as $source)
+                            .unwrap(),
+                       t_max as $target);
+            assert_eq!(<$target as TryFrom<$source>>::try_from(t_min as $source)
+                            .unwrap(),
+                       t_min as $target);
+        }
+    }
+}
+
+test_impl_try_from_signed_to_unsigned_err! { test_try_i16u8, i16, u8 }
+
+test_impl_try_from_signed_to_unsigned_err! { test_try_i32u8, i32, u8 }
+test_impl_try_from_signed_to_unsigned_err! { test_try_i32u16, i32, u16 }
+
+test_impl_try_from_signed_to_unsigned_err! { test_try_i64u8, i64, u8 }
+test_impl_try_from_signed_to_unsigned_err! { test_try_i64u16, i64, u16 }
+test_impl_try_from_signed_to_unsigned_err! { test_try_i64u32, i64, u32 }
index 33674a3abd870271fa26c15453367bbfa5ee24df..1c6c13b0d02e8b6e5417bbfbc900d4ca78f21f67 100644 (file)
@@ -8,27 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use test::Bencher;
 use core::ops::{Range, RangeFull, RangeFrom, RangeTo};
 
-// Overhead of dtors
-
-struct HasDtor {
-    _x: isize
-}
-
-impl Drop for HasDtor {
-    fn drop(&mut self) {
-    }
-}
-
-#[bench]
-fn alloc_obj_with_dtor(b: &mut Bencher) {
-    b.iter(|| {
-        HasDtor { _x : 10 };
-    })
-}
-
 // Test the Range structs without the syntactic sugar.
 
 #[test]
index 245c705dfcc2a41c657ec505d62107fdf94f30b6..12016980a2c656be8c5ace4d6ea27285865ca26a 100644 (file)
@@ -11,7 +11,6 @@
 extern crate gcc;
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
     gcc::Config::new()
         .file("../rt/miniz.c")
         .compile("libminiz.a");
index 8365e9db2a947c3e85199d92d751ee318440afef..dedec7b1609fadaea92cdaf9e1d970f42dfe4dd9 100644 (file)
@@ -74,10 +74,6 @@ fn drop(&mut self) {
     }
 }
 
-#[link(name = "miniz", kind = "static")]
-#[cfg(not(cargobuild))]
-extern "C" {}
-
 extern "C" {
     /// Raw miniz compression function.
     fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
index 7d57bdcdbb56540f37afe5a934ce12d33a6ca7fc..cb7f66732175e6171587ed69656b7aae7dd2e6ec 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 7d57bdcdbb56540f37afe5a934ce12d33a6ca7fc
+Subproject commit cb7f66732175e6171587ed69656b7aae7dd2e6ec
index e8b3a9a42c292033dc4889f7b5c6e562f687abea..84abc6bc4a5132e248470e31ad231cf1e12b8aa5 100644 (file)
@@ -301,10 +301,6 @@ unsafe fn find_eh_action(context: *mut uw::_Unwind_Context) -> EHAction {
 // with any GCC runtime.
 #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
 pub mod eh_frame_registry {
-    #[link(name = "gcc_eh")]
-    #[cfg(not(cargobuild))]
-    extern "C" {}
-
     extern "C" {
         fn __register_frame_info(eh_frame_begin: *const u8, object: *mut u8);
         fn __deregister_frame_info(eh_frame_begin: *const u8, object: *mut u8);
index 3c455eb05011eef2c0551348221b406cd8faaabc..5d53c60ad7fdc1072620abf156c939ae5dce7619 100644 (file)
@@ -19,7 +19,6 @@ rustc_const_math = { path = "../librustc_const_math" }
 rustc_data_structures = { path = "../librustc_data_structures" }
 rustc_errors = { path = "../librustc_errors" }
 rustc_llvm = { path = "../librustc_llvm" }
-rustc_i128 = { path = "../librustc_i128" }
 serialize = { path = "../libserialize" }
 syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
index df6db366df5b36bd6426bd9acbb65c2f5a52aeaf..006de1c06e2d9f9d36fdeb4f15799b83868f8a06 100644 (file)
@@ -113,6 +113,7 @@ pub enum DepNode<D: Clone + Debug> {
     AssociatedItemDefIds(D),
     InherentImpls(D),
     TypeckTables(D),
+    UsedTraitImports(D),
 
     // The set of impls for a given trait. Ultimately, it would be
     // nice to get more fine-grained here (e.g., to include a
@@ -162,6 +163,7 @@ macro_rules! check {
             AssociatedItemDefIds,
             InherentImpls,
             TypeckTables,
+            UsedTraitImports,
             TraitImpls,
             ReprHints,
         }
@@ -230,6 +232,7 @@ pub fn map_def<E, OP>(&self, mut op: OP) -> Option<DepNode<E>>
             AssociatedItemDefIds(ref d) => op(d).map(AssociatedItemDefIds),
             InherentImpls(ref d) => op(d).map(InherentImpls),
             TypeckTables(ref d) => op(d).map(TypeckTables),
+            UsedTraitImports(ref d) => op(d).map(UsedTraitImports),
             TraitImpls(ref d) => op(d).map(TraitImpls),
             TraitItems(ref d) => op(d).map(TraitItems),
             ReprHints(ref d) => op(d).map(ReprHints),
index 9660758220368c47270733b367da00600076f653..2ffc3951cc94db96466248f17345fd0fba378366 100644 (file)
@@ -61,15 +61,10 @@ pub fn get(&self, k: &M::Key) -> Option<&M::Value> {
         self.map.get(k)
     }
 
-    pub fn get_mut(&mut self, k: &M::Key) -> Option<&mut M::Value> {
-        self.read(k);
-        self.write(k);
-        self.map.get_mut(k)
-    }
-
-    pub fn insert(&mut self, k: M::Key, v: M::Value) -> Option<M::Value> {
+    pub fn insert(&mut self, k: M::Key, v: M::Value) {
         self.write(&k);
-        self.map.insert(k, v)
+        let old_value = self.map.insert(k, v);
+        assert!(old_value.is_none());
     }
 
     pub fn contains_key(&self, k: &M::Key) -> bool {
@@ -83,6 +78,10 @@ pub fn keys(&self) -> Vec<M::Key> {
 
     /// Append `elem` to the vector stored for `k`, creating a new vector if needed.
     /// This is considered a write to `k`.
+    ///
+    /// NOTE: Caution is required when using this method. You should
+    /// be sure that nobody is **reading from the vector** while you
+    /// are writing to it. Eventually, it'd be nice to remove this.
     pub fn push<E: Clone>(&mut self, k: M::Key, elem: E)
         where M: DepTrackingMapConfig<Value=Vec<E>>
     {
index b51a7d4104ab92865a5f76d3ba2c3f542a32f690..cf51dad5142eea278649b6da04897c03292744ce 100644 (file)
@@ -620,7 +620,7 @@ fn foo<T: MyTransmutableType>(x: Vec<T>) {
 You can build a free-standing crate by adding `#![no_std]` to the crate
 attributes:
 
-```
+```ignore
 #![no_std]
 ```
 
index 4b3e0d29101e4c33c42f57adee5a5fa339a50412..1df67615069935a364ca55a7e09d6050e352cca7 100644 (file)
@@ -914,6 +914,7 @@ pub fn walk_decl<'v, V: Visitor<'v>>(visitor: &mut V, declaration: &'v Decl) {
 
 pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
     visitor.visit_id(expression.id);
+    walk_list!(visitor, visit_attribute, expression.attrs.iter());
     match expression.node {
         ExprBox(ref subexpression) => {
             visitor.visit_expr(subexpression)
index 2489a6a6c7a6304e46d552a86112f2ce68d15a22..939f214407ef71606d58d90ec7af381e663e816f 100644 (file)
 use hir::map as hir_map;
 use hir;
 
-use lint;
 use hir::def_id::DefId;
 use infer;
 use middle::region;
 use traits::{ObligationCause, ObligationCauseCode};
 use ty::{self, TyCtxt, TypeFoldable};
-use ty::{Region, ReFree};
+use ty::{Region, ReFree, Issue32330};
 use ty::error::TypeError;
 
 use std::fmt;
@@ -610,6 +609,39 @@ pub fn note_type_err(&self,
         self.tcx.note_and_explain_type_err(diag, terr, span);
     }
 
+    pub fn note_issue_32330(&self,
+                            diag: &mut DiagnosticBuilder<'tcx>,
+                            terr: &TypeError<'tcx>)
+    {
+        debug!("note_issue_32330: terr={:?}", terr);
+        match *terr {
+            TypeError::RegionsInsufficientlyPolymorphic(_, &Region::ReVar(vid)) |
+            TypeError::RegionsOverlyPolymorphic(_, &Region::ReVar(vid)) => {
+                match self.region_vars.var_origin(vid) {
+                    RegionVariableOrigin::EarlyBoundRegion(_, _, Some(Issue32330 {
+                        fn_def_id,
+                        region_name
+                    })) => {
+                        diag.note(
+                            &format!("lifetime parameter `{0}` declared on fn `{1}` \
+                                      appears only in the return type, \
+                                      but here is required to be higher-ranked, \
+                                      which means that `{0}` must appear in both \
+                                      argument and return types",
+                                     region_name,
+                                     self.tcx.item_path_str(fn_def_id)));
+                        diag.note(
+                            &format!("this error is the result of a recent bug fix; \
+                                      for more information, see issue #33685 \
+                                      <https://github.com/rust-lang/rust/issues/33685>"));
+                    }
+                    _ => { }
+                }
+            }
+            _ => { }
+        }
+    }
+
     pub fn report_and_explain_type_error(&self,
                                          trace: TypeTrace<'tcx>,
                                          terr: &TypeError<'tcx>)
@@ -629,6 +661,7 @@ pub fn report_and_explain_type_error(&self,
             }
         };
         self.note_type_err(&mut diag, &trace.cause, None, Some(trace.values), terr);
+        self.note_issue_32330(&mut diag, terr);
         diag
     }
 
@@ -1053,27 +1086,6 @@ fn report_processed_errors(&self,
             err.emit();
         }
     }
-
-    pub fn issue_32330_warnings(&self, span: Span, issue32330s: &[ty::Issue32330]) {
-        for issue32330 in issue32330s {
-            match *issue32330 {
-                ty::Issue32330::WontChange => { }
-                ty::Issue32330::WillChange { fn_def_id, region_name } => {
-                    self.tcx.sess.add_lint(
-                        lint::builtin::HR_LIFETIME_IN_ASSOC_TYPE,
-                        ast::CRATE_NODE_ID,
-                        span,
-                        format!("lifetime parameter `{0}` declared on fn `{1}` \
-                                 appears only in the return type, \
-                                 but here is required to be higher-ranked, \
-                                 which means that `{0}` must appear in both \
-                                 argument and return types",
-                                region_name,
-                                self.tcx.item_path_str(fn_def_id)));
-                }
-            }
-        }
-    }
 }
 
 impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
@@ -1104,7 +1116,7 @@ fn report_inference_failure(&self,
                 format!(" for lifetime parameter {}in trait containing associated type `{}`",
                         br_string(br), type_name)
             }
-            infer::EarlyBoundRegion(_, name) => {
+            infer::EarlyBoundRegion(_, name, _) => {
                 format!(" for lifetime parameter `{}`",
                         name)
             }
index 08e522f5fd6ee4a39599f905b1f2874c74fa6575..e919f025409c510a717458b4ea4d073c5ea83e8e 100644 (file)
@@ -622,7 +622,7 @@ pub fn skolemize_late_bound_regions<T>(&self,
     /// hold. See `README.md` for more details.
     pub fn leak_check(&self,
                       overly_polymorphic: bool,
-                      span: Span,
+                      _span: Span,
                       skol_map: &SkolemizationMap<'tcx>,
                       snapshot: &CombinedSnapshot)
                       -> RelateResult<'tcx, ()>
@@ -630,43 +630,6 @@ pub fn leak_check(&self,
         debug!("leak_check: skol_map={:?}",
                skol_map);
 
-        // ## Issue #32330 warnings
-        //
-        // When Issue #32330 is fixed, a certain number of late-bound
-        // regions (LBR) will become early-bound. We wish to issue
-        // warnings when the result of `leak_check` relies on such LBR, as
-        // that means that compilation will likely start to fail.
-        //
-        // Recall that when we do a "HR subtype" check, we replace all
-        // late-bound regions (LBR) in the subtype with fresh variables,
-        // and skolemize the late-bound regions in the supertype. If those
-        // skolemized regions from the supertype wind up being
-        // super-regions (directly or indirectly) of either
-        //
-        // - another skolemized region; or,
-        // - some region that pre-exists the HR subtype check
-        //   - e.g., a region variable that is not one of those created
-        //     to represent bound regions in the subtype
-        //
-        // then leak-check (and hence the subtype check) fails.
-        //
-        // What will change when we fix #32330 is that some of the LBR in the
-        // subtype may become early-bound. In that case, they would no longer be in
-        // the "permitted set" of variables that can be related to a skolemized
-        // type.
-        //
-        // So the foundation for this warning is to collect variables that we found
-        // to be related to a skolemized type. For each of them, we have a
-        // `BoundRegion` which carries a `Issue32330` flag. We check whether any of
-        // those flags indicate that this variable was created from a lifetime
-        // that will change from late- to early-bound. If so, we issue a warning
-        // indicating that the results of compilation may change.
-        //
-        // This is imperfect, since there are other kinds of code that will not
-        // compile once #32330 is fixed. However, it fixes the errors observed in
-        // practice on crater runs.
-        let mut warnings = vec![];
-
         let new_vars = self.region_vars_confined_to_snapshot(snapshot);
         for (&skol_br, &skol) in skol_map {
             // The inputs to a skolemized variable can only
@@ -680,13 +643,6 @@ pub fn leak_check(&self,
                 match *tainted_region {
                     ty::ReVar(vid) => {
                         if new_vars.contains(&vid) {
-                            warnings.extend(
-                                match self.region_vars.var_origin(vid) {
-                                    LateBoundRegion(_,
-                                                    ty::BrNamed(.., wc),
-                                                    _) => Some(wc),
-                                    _ => None,
-                                });
                             continue;
                         }
                     }
@@ -712,8 +668,6 @@ pub fn leak_check(&self,
             }
         }
 
-        self.issue_32330_warnings(span, &warnings);
-
         Ok(())
     }
 
index ef93a10808bfdcb95a6520ac7a3e7f6f2c0736ba..c3a6a62764d0b56ce327ada6900b82cb57835ee8 100644 (file)
@@ -368,7 +368,7 @@ pub enum RegionVariableOrigin {
     Coercion(Span),
 
     // Region variables created as the values for early-bound regions
-    EarlyBoundRegion(Span, ast::Name),
+    EarlyBoundRegion(Span, ast::Name, Option<ty::Issue32330>),
 
     // Region variables created for bound regions
     // in a function or method that is called
@@ -1184,7 +1184,7 @@ pub fn region_var_for_def(&self,
                               span: Span,
                               def: &ty::RegionParameterDef)
                               -> &'tcx ty::Region {
-        self.next_region_var(EarlyBoundRegion(span, def.name))
+        self.next_region_var(EarlyBoundRegion(span, def.name, def.issue_32330))
     }
 
     /// Create a type inference variable for the given
@@ -1761,7 +1761,7 @@ pub fn span(&self) -> Span {
             AddrOfRegion(a) => a,
             Autoref(a) => a,
             Coercion(a) => a,
-            EarlyBoundRegion(a, _) => a,
+            EarlyBoundRegion(a, ..) => a,
             LateBoundRegion(a, ..) => a,
             BoundRegionInCoherence(_) => syntax_pos::DUMMY_SP,
             UpvarRegion(_, a) => a
index 0ff9626ae11a884ada089c11b03a01df8da554ba..5c0ec8de7ecd266d8eeb9b4469baa0be127cc1d8 100644 (file)
@@ -30,6 +30,7 @@
 #![feature(const_fn)]
 #![feature(core_intrinsics)]
 #![feature(field_init_shorthand)]
+#![feature(i128_type)]
 #![feature(libc)]
 #![feature(loop_break_value)]
 #![feature(nonzero)]
@@ -60,9 +61,6 @@
 
 extern crate serialize as rustc_serialize; // used by deriving
 
-// SNAP:
-extern crate rustc_i128;
-
 #[macro_use]
 mod macros;
 
@@ -109,7 +107,6 @@ pub mod util {
     pub mod common;
     pub mod ppaux;
     pub mod nodemap;
-    pub mod num;
     pub mod fs;
 }
 
index e1605959922c0530e64e1a2b1ab299282afc6639..70f03e02f46d9b9c6a8dd7c22c7afaa2cd4f31ae 100644 (file)
     "lifetimes or labels named `'_` were erroneously allowed"
 }
 
+declare_lint! {
+    pub RESOLVE_TRAIT_ON_DEFAULTED_UNIT,
+    Warn,
+    "attempt to resolve a trait on an expression whose type cannot be inferred but which \
+     currently defaults to ()"
+}
+
 declare_lint! {
     pub SAFE_EXTERN_STATICS,
     Warn,
@@ -272,6 +279,7 @@ fn get_lints(&self) -> LintArray {
             SUPER_OR_SELF_IN_GLOBAL_PATH,
             HR_LIFETIME_IN_ASSOC_TYPE,
             LIFETIME_UNDERSCORE,
+            RESOLVE_TRAIT_ON_DEFAULTED_UNIT,
             SAFE_EXTERN_STATICS,
             PATTERNS_IN_FNS_WITHOUT_BODY,
             EXTRA_REQUIREMENT_IN_IMPL,
index 3506a9c067ca6ddcce00fb6b3c870ddae5507651..32bc81e947037afaef2030b2f9250f35dd6da22f 100644 (file)
 use lint::{EarlyLintPassObject, LateLintPassObject};
 use lint::{Default, CommandLine, Node, Allow, Warn, Deny, Forbid};
 use lint::builtin;
+use rustc_serialize::{Decoder, Decodable, Encoder, Encodable};
 use util::nodemap::FxHashMap;
 
 use std::cmp;
 use std::default::Default as StdDefault;
 use std::mem;
 use std::fmt;
+use std::ops::Deref;
 use syntax::attr;
 use syntax::ast;
+use syntax::symbol::Symbol;
 use syntax_pos::{MultiSpan, Span};
 use errors::{self, Diagnostic, DiagnosticBuilder};
 use hir;
@@ -82,7 +85,7 @@ pub struct LintStore {
 
 /// When you call `add_lint` on the session, you wind up storing one
 /// of these, which records a "potential lint" at a particular point.
-#[derive(PartialEq)]
+#[derive(PartialEq, RustcEncodable, RustcDecodable)]
 pub struct EarlyLint {
     /// what lint is this? (e.g., `dead_code`)
     pub id: LintId,
@@ -298,8 +301,9 @@ pub fn process_command_line(&mut self, sess: &Session) {
             check_lint_name_cmdline(sess, self,
                                     &lint_name[..], level);
 
+            let lint_flag_val = Symbol::intern(&lint_name);
             match self.find_lint(&lint_name[..], sess, None) {
-                Ok(lint_id) => self.set_level(lint_id, (level, CommandLine)),
+                Ok(lint_id) => self.set_level(lint_id, (level, CommandLine(lint_flag_val))),
                 Err(FindLintError::Removed) => { }
                 Err(_) => {
                     match self.lint_groups.iter().map(|(&x, pair)| (x, pair.0.clone()))
@@ -309,7 +313,7 @@ pub fn process_command_line(&mut self, sess: &Session) {
                         Some(v) => {
                             v.iter()
                              .map(|lint_id: &LintId|
-                                     self.set_level(*lint_id, (level, CommandLine)))
+                                     self.set_level(*lint_id, (level, CommandLine(lint_flag_val))))
                              .collect::<Vec<()>>();
                         }
                         None => {
@@ -445,35 +449,18 @@ pub fn raw_struct_lint<'a, S>(sess: &'a Session,
                               -> DiagnosticBuilder<'a>
     where S: Into<MultiSpan>
 {
-    let (mut level, source) = lvlsrc;
+    let (level, source) = lvlsrc;
     if level == Allow {
         return sess.diagnostic().struct_dummy();
     }
 
     let name = lint.name_lower();
     let mut def = None;
-    let msg = match source {
-        Default => {
-            format!("{}, #[{}({})] on by default", msg,
-                    level.as_str(), name)
-        },
-        CommandLine => {
-            format!("{} [-{} {}]", msg,
-                    match level {
-                        Warn => 'W', Deny => 'D', Forbid => 'F',
-                        Allow => bug!()
-                    }, name.replace("_", "-"))
-        },
-        Node(src) => {
-            def = Some(src);
-            msg.to_string()
-        }
-    };
 
-    // For purposes of printing, we can treat forbid as deny.
-    if level == Forbid { level = Deny; }
+    // Except for possible note details, forbid behaves like deny.
+    let effective_level = if level == Forbid { Deny } else { level };
 
-    let mut err = match (level, span) {
+    let mut err = match (effective_level, span) {
         (Warn, Some(sp)) => sess.struct_span_warn(sp, &msg[..]),
         (Warn, None)     => sess.struct_warn(&msg[..]),
         (Deny, Some(sp)) => sess.struct_span_err(sp, &msg[..]),
@@ -481,6 +468,35 @@ pub fn raw_struct_lint<'a, S>(sess: &'a Session,
         _ => bug!("impossible level in raw_emit_lint"),
     };
 
+    match source {
+        Default => {
+            err.note(&format!("#[{}({})] on by default", level.as_str(), name));
+        },
+        CommandLine(lint_flag_val) => {
+            let flag = match level {
+                Warn => "-W", Deny => "-D", Forbid => "-F",
+                Allow => bug!("earlier conditional return should handle Allow case")
+            };
+            let hyphen_case_lint_name = name.replace("_", "-");
+            if lint_flag_val.as_str().deref() == name {
+                err.note(&format!("requested on the command line with `{} {}`",
+                                  flag, hyphen_case_lint_name));
+            } else {
+                let hyphen_case_flag_val = lint_flag_val.as_str().replace("_", "-");
+                err.note(&format!("`{} {}` implied by `{} {}`",
+                                  flag, hyphen_case_lint_name, flag, hyphen_case_flag_val));
+            }
+        },
+        Node(lint_attr_name, src) => {
+            def = Some(src);
+            if lint_attr_name.as_str().deref() != name {
+                let level_str = level.as_str();
+                err.note(&format!("#[{}({})] implied by #[{}({})]",
+                                  level_str, name, level_str, lint_attr_name));
+            }
+        }
+    }
+
     // Check for future incompatibility lints and issue a stronger warning.
     if let Some(future_incompatible) = lints.future_incompatible(LintId::of(lint)) {
         let explanation = format!("this was previously accepted by the compiler \
@@ -558,7 +574,7 @@ fn span_lint<S: Into<MultiSpan>>(&self, lint: &'static Lint, span: S, msg: &str)
         self.lookup_and_emit(lint, Some(span), msg);
     }
 
-    fn early_lint(&self, early_lint: EarlyLint) {
+    fn early_lint(&self, early_lint: &EarlyLint) {
         let span = early_lint.diagnostic.span.primary_span().expect("early lint w/o primary span");
         let mut err = self.struct_span_lint(early_lint.id.lint,
                                             span,
@@ -648,6 +664,8 @@ fn with_lint_attrs<F>(&mut self,
                 }
             };
 
+            let lint_attr_name = result.expect("lint attribute should be well-formed").0;
+
             for (lint_id, level, span) in v {
                 let (now, now_source) = self.lints().get_level_source(lint_id);
                 if now == Forbid && level != Forbid {
@@ -659,11 +677,11 @@ fn with_lint_attrs<F>(&mut self,
                     diag_builder.span_label(span, &format!("overruled by previous forbid"));
                     match now_source {
                         LintSource::Default => &mut diag_builder,
-                        LintSource::Node(forbid_source_span) => {
+                        LintSource::Node(_, forbid_source_span) => {
                             diag_builder.span_label(forbid_source_span,
                                                     &format!("`forbid` level set here"))
                         },
-                        LintSource::CommandLine => {
+                        LintSource::CommandLine(_) => {
                             diag_builder.note("`forbid` lint level was set on command line")
                         }
                     }.emit()
@@ -671,7 +689,7 @@ fn with_lint_attrs<F>(&mut self,
                     let src = self.lints().get_level_source(lint_id).1;
                     self.level_stack().push((lint_id, (now, src)));
                     pushed += 1;
-                    self.mut_lints().set_level(lint_id, (level, Node(span)));
+                    self.mut_lints().set_level(lint_id, (level, Node(lint_attr_name, span)));
                 }
             }
         }
@@ -773,11 +791,10 @@ fn nested_visit_map<'this>(&'this mut self) -> hir_visit::NestedVisitorMap<'this
 
     // Output any lints that were previously added to the session.
     fn visit_id(&mut self, id: ast::NodeId) {
-        if let Some(lints) = self.sess().lints.borrow_mut().remove(&id) {
-            debug!("LateContext::visit_id: id={:?} lints={:?}", id, lints);
-            for early_lint in lints {
-                self.early_lint(early_lint);
-            }
+        let lints = self.sess().lints.borrow_mut().take(id);
+        for early_lint in lints.iter().chain(self.tables.lints.get(id)) {
+            debug!("LateContext::visit_id: id={:?} early_lint={:?}", id, early_lint);
+            self.early_lint(early_lint);
         }
     }
 
@@ -1232,7 +1249,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
     // If we missed any lints added to the session, then there's a bug somewhere
     // in the iteration code.
-    for (id, v) in tcx.sess.lints.borrow().iter() {
+    if let Some((id, v)) = tcx.sess.lints.borrow().get_any() {
         for early_lint in v {
             span_bug!(early_lint.diagnostic.span.clone(),
                       "unprocessed lint {:?} at {}",
@@ -1250,10 +1267,9 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
     // Visit the whole crate.
     cx.with_lint_attrs(&krate.attrs, |cx| {
         // Lints may be assigned to the whole crate.
-        if let Some(lints) = cx.sess.lints.borrow_mut().remove(&ast::CRATE_NODE_ID) {
-            for early_lint in lints {
-                cx.early_lint(early_lint);
-            }
+        let lints = cx.sess.lints.borrow_mut().take(ast::CRATE_NODE_ID);
+        for early_lint in lints {
+            cx.early_lint(&early_lint);
         }
 
         // since the root module isn't visited as an item (because it isn't an
@@ -1270,9 +1286,28 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
 
     // If we missed any lints added to the session, then there's a bug somewhere
     // in the iteration code.
-    for (_, v) in sess.lints.borrow().iter() {
+    for (_, v) in sess.lints.borrow().get_any() {
         for early_lint in v {
             span_bug!(early_lint.diagnostic.span.clone(), "unprocessed lint {:?}", early_lint);
         }
     }
 }
+
+impl Encodable for LintId {
+    fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
+        s.emit_str(&self.lint.name.to_lowercase())
+    }
+}
+
+impl Decodable for LintId {
+    #[inline]
+    fn decode<D: Decoder>(d: &mut D) -> Result<LintId, D::Error> {
+        let s = d.read_str()?;
+        ty::tls::with(|tcx| {
+            match tcx.sess.lint_store.borrow().find_lint(&s, tcx.sess, None) {
+                Ok(id) => Ok(id),
+                Err(_) => panic!("invalid lint-id `{}`", s),
+            }
+        })
+    }
+}
index 7e0da00694c4a4280aa5722d0122f6f9fe8286ea..e9f603db15d6214b538c29a71a5aa55454641997 100644 (file)
 pub use self::Level::*;
 pub use self::LintSource::*;
 
+use hir;
+use hir::intravisit::FnKind;
 use std::hash;
 use std::ascii::AsciiExt;
 use syntax_pos::Span;
-use hir::intravisit::FnKind;
 use syntax::visit as ast_visit;
 use syntax::ast;
-use hir;
+use syntax::symbol::Symbol;
 
 pub use lint::context::{LateContext, EarlyContext, LintContext, LintStore,
                         raw_emit_lint, check_crate, check_ast_crate, gather_attrs,
                         raw_struct_lint, FutureIncompatibleInfo, EarlyLint, IntoEarlyLint};
 
+pub use lint::table::LintTable;
+
 /// Specification of a single lint.
 #[derive(Copy, Clone, Debug)]
 pub struct Lint {
@@ -336,13 +339,14 @@ pub enum LintSource {
     Default,
 
     /// Lint level was set by an attribute.
-    Node(Span),
+    Node(ast::Name, Span),
 
     /// Lint level was set by a command-line flag.
-    CommandLine,
+    CommandLine(Symbol),
 }
 
 pub type LevelSource = (Level, LintSource);
 
 pub mod builtin;
 mod context;
+mod table;
diff --git a/src/librustc/lint/table.rs b/src/librustc/lint/table.rs
new file mode 100644 (file)
index 0000000..f2dab25
--- /dev/null
@@ -0,0 +1,71 @@
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use syntax::ast;
+use syntax_pos::MultiSpan;
+use util::nodemap::NodeMap;
+
+use super::{Lint, LintId, EarlyLint, IntoEarlyLint};
+
+#[derive(RustcEncodable, RustcDecodable)]
+pub struct LintTable {
+    map: NodeMap<Vec<EarlyLint>>
+}
+
+impl LintTable {
+    pub fn new() -> Self {
+        LintTable { map: NodeMap() }
+    }
+
+    pub fn add_lint<S: Into<MultiSpan>>(&mut self,
+                                        lint: &'static Lint,
+                                        id: ast::NodeId,
+                                        sp: S,
+                                        msg: String)
+    {
+        self.add_lint_diagnostic(lint, id, (sp, &msg[..]))
+    }
+
+    pub fn add_lint_diagnostic<M>(&mut self,
+                                  lint: &'static Lint,
+                                  id: ast::NodeId,
+                                  msg: M)
+        where M: IntoEarlyLint,
+    {
+        let lint_id = LintId::of(lint);
+        let early_lint = msg.into_early_lint(lint_id);
+        let arr = self.map.entry(id).or_insert(vec![]);
+        if !arr.contains(&early_lint) {
+            arr.push(early_lint);
+        }
+    }
+
+    pub fn get(&self, id: ast::NodeId) -> &[EarlyLint] {
+        self.map.get(&id).map(|v| &v[..]).unwrap_or(&[])
+    }
+
+    pub fn take(&mut self, id: ast::NodeId) -> Vec<EarlyLint> {
+        self.map.remove(&id).unwrap_or(vec![])
+    }
+
+    pub fn transfer(&mut self, into: &mut LintTable) {
+        into.map.extend(self.map.drain());
+    }
+
+    /// Returns the first (id, lint) pair that is non-empty. Used to
+    /// implement a sanity check in lints that all node-ids are
+    /// visited.
+    pub fn get_any(&self) -> Option<(&ast::NodeId, &Vec<EarlyLint>)> {
+        self.map.iter()
+                .filter(|&(_, v)| !v.is_empty())
+                .next()
+    }
+}
+
index d11e6e3fc72bd415c31910243845b9a6bccae566..6537cc1adce001fa3c88522278c89c7524790da1 100644 (file)
@@ -47,7 +47,7 @@
 use hir;
 use rustc_back::PanicStrategy;
 
-pub use self::NativeLibraryKind::{NativeStatic, NativeFramework, NativeUnknown};
+pub use self::NativeLibraryKind::*;
 
 // lonely orphan structs and enums looking for a better home
 
@@ -123,6 +123,7 @@ pub enum LinkagePreference {
 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
 pub enum NativeLibraryKind {
     NativeStatic,    // native static library (.a archive)
+    NativeStaticNobundle, // native static library, which doesn't get bundled into .rlibs
     NativeFramework, // OSX-specific
     NativeUnknown,   // default way to specify a dynamic library
 }
index 0e8e1921de700fc1f7a77161bbb9162d1c051c5f..9d1bcb8164a9e08c477ef02cab8e6f6f7bb700de 100644 (file)
@@ -1199,7 +1199,7 @@ fn cat_pattern_<F>(&self, cmt: cmt<'tcx>, pat: &hir::Pat, op: &mut F) -> McResul
           PatKind::Tuple(ref subpats, ddpos) => {
             // (p1, ..., pN)
             let expected_len = match self.pat_ty(&pat)?.sty {
-                ty::TyTuple(ref tys) => tys.len(),
+                ty::TyTuple(ref tys, _) => tys.len(),
                 ref ty => span_bug!(pat.span, "tuple pattern unexpected type {:?}", ty),
             };
             for (i, subpat) in subpats.iter().enumerate_and_adjust(expected_len, ddpos) {
index 88ef2c69a04dce975ab907a9ee7b1a1e97bee033..158b406deb8a48c69323564cb2dee343a07cf2fa 100644 (file)
@@ -31,7 +31,7 @@
 use syntax::symbol::keywords;
 use syntax_pos::Span;
 use errors::DiagnosticBuilder;
-use util::nodemap::{NodeMap, FxHashSet, FxHashMap, DefIdMap};
+use util::nodemap::{NodeMap, NodeSet, FxHashSet, FxHashMap, DefIdMap};
 use rustc_back::slice;
 
 use hir;
@@ -150,10 +150,14 @@ pub struct NamedRegionMap {
     // `Region` describing how that region is bound
     pub defs: NodeMap<Region>,
 
-    // the set of lifetime def ids that are late-bound; late-bound ids
-    // are named regions appearing in fn arguments that do not appear
-    // in where-clauses
-    pub late_bound: NodeMap<ty::Issue32330>,
+    // the set of lifetime def ids that are late-bound; a region can
+    // be late-bound if (a) it does NOT appear in a where-clause and
+    // (b) it DOES appear in the arguments.
+    pub late_bound: NodeSet,
+
+    // Contains the node-ids for lifetimes that were (incorrectly) categorized
+    // as late-bound, until #32330 was fixed.
+    pub issue_32330: NodeMap<ty::Issue32330>,
 
     // For each type and trait definition, maps type parameters
     // to the trait object lifetime defaults computed from them.
@@ -261,7 +265,8 @@ pub fn krate(sess: &Session,
     let krate = hir_map.krate();
     let mut map = NamedRegionMap {
         defs: NodeMap(),
-        late_bound: NodeMap(),
+        late_bound: NodeSet(),
+        issue_32330: NodeMap(),
         object_lifetime_defaults: compute_object_lifetime_defaults(sess, hir_map),
     };
     sess.track_errors(|| {
@@ -840,7 +845,7 @@ fn visit_early_late<F>(&mut self,
         }
 
         let lifetimes = generics.lifetimes.iter().map(|def| {
-            if self.map.late_bound.contains_key(&def.lifetime.id) {
+            if self.map.late_bound.contains(&def.lifetime.id) {
                 Region::late(def)
             } else {
                 Region::early(&mut index, def)
@@ -1610,22 +1615,26 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
         // just mark it so we can issue warnings.
         let constrained_by_input = constrained_by_input.regions.contains(&name);
         let appears_in_output = appears_in_output.regions.contains(&name);
-        let will_change = !constrained_by_input && appears_in_output;
-        let issue_32330 = if will_change {
-            ty::Issue32330::WillChange {
-                fn_def_id: fn_def_id,
-                region_name: name,
-            }
-        } else {
-            ty::Issue32330::WontChange
-        };
+        if !constrained_by_input && appears_in_output {
+            debug!("inserting issue_32330 entry for {:?}, {:?} on {:?}",
+                   lifetime.lifetime.id,
+                   name,
+                   fn_def_id);
+            map.issue_32330.insert(
+                lifetime.lifetime.id,
+                ty::Issue32330 {
+                    fn_def_id: fn_def_id,
+                    region_name: name,
+                });
+            continue;
+        }
 
         debug!("insert_late_bound_lifetimes: \
-                lifetime {:?} with id {:?} is late-bound ({:?}",
-               lifetime.lifetime.name, lifetime.lifetime.id, issue_32330);
+                lifetime {:?} with id {:?} is late-bound",
+               lifetime.lifetime.name, lifetime.lifetime.id);
 
-        let prev = map.late_bound.insert(lifetime.lifetime.id, issue_32330);
-        assert!(prev.is_none(), "visited lifetime {:?} twice", lifetime.lifetime.id);
+        let inserted = map.late_bound.insert(lifetime.lifetime.id);
+        assert!(inserted, "visited lifetime {:?} twice", lifetime.lifetime.id);
     }
 
     return;
index 03530945e046df3651199a4438ffed8f80610f3d..f1268521d67086781de6701def629e40d4ab251e 100644 (file)
@@ -163,7 +163,7 @@ pub fn ty<'a, 'gcx>(&self, mir: &Mir<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Opti
                 let lhs_ty = lhs.ty(mir, tcx);
                 let rhs_ty = rhs.ty(mir, tcx);
                 let ty = op.ty(tcx, lhs_ty, rhs_ty);
-                let ty = tcx.intern_tup(&[ty, tcx.types.bool]);
+                let ty = tcx.intern_tup(&[ty, tcx.types.bool], false);
                 Some(ty)
             }
             &Rvalue::UnaryOp(_, ref operand) => {
@@ -184,7 +184,8 @@ pub fn ty<'a, 'gcx>(&self, mir: &Mir<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Opti
                     }
                     AggregateKind::Tuple => {
                         Some(tcx.mk_tup(
-                            ops.iter().map(|op| op.ty(mir, tcx))
+                            ops.iter().map(|op| op.ty(mir, tcx)),
+                            false
                         ))
                     }
                     AggregateKind::Adt(def, _, substs, _) => {
index 7419d74287b97a9d3e4c0adabc88063b2a823f45..d41c2ba93b93533a524e45f3be5b4028d5f29925 100644 (file)
@@ -1476,12 +1476,17 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
             (Some(name), "dylib") => (name, cstore::NativeUnknown),
             (Some(name), "framework") => (name, cstore::NativeFramework),
             (Some(name), "static") => (name, cstore::NativeStatic),
+            (Some(name), "static-nobundle") => (name, cstore::NativeStaticNobundle),
             (_, s) => {
                 early_error(error_format, &format!("unknown library kind `{}`, expected \
                                                   one of dylib, framework, or static",
                                                  s));
             }
         };
+        if kind == cstore::NativeStaticNobundle && !nightly_options::is_nightly_build() {
+            early_error(error_format, &format!("the library kind 'static-nobundle' is only \
+                                                accepted on the nightly compiler"));
+        }
         let mut name_parts = name.splitn(2, ':');
         let name = name_parts.next().unwrap();
         let new_name = name_parts.next();
index 36a887e062273b719d31edaa1311fba38432fa2c..f10ea3544f2cae7566189ae262e5ab43bce6ca63 100644 (file)
@@ -20,7 +20,7 @@
 use session::search_paths::PathKind;
 use session::config::DebugInfoLevel;
 use ty::tls;
-use util::nodemap::{NodeMap, FxHashMap, FxHashSet};
+use util::nodemap::{FxHashMap, FxHashSet};
 use util::common::duration_to_secs_str;
 use mir::transform as mir_pass;
 
@@ -78,7 +78,7 @@ pub struct Session {
     pub local_crate_source_file: Option<PathBuf>,
     pub working_dir: PathBuf,
     pub lint_store: RefCell<lint::LintStore>,
-    pub lints: RefCell<NodeMap<Vec<lint::EarlyLint>>>,
+    pub lints: RefCell<lint::LintTable>,
     /// Set of (LintId, span, message) tuples tracking lint (sub)diagnostics
     /// that have been set once, but should not be set again, in order to avoid
     /// redundantly verbose output (Issue #24690).
@@ -270,13 +270,14 @@ pub fn span_unimpl<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> ! {
     pub fn unimpl(&self, msg: &str) -> ! {
         self.diagnostic().unimpl(msg)
     }
+
     pub fn add_lint<S: Into<MultiSpan>>(&self,
                                         lint: &'static lint::Lint,
                                         id: ast::NodeId,
                                         sp: S,
                                         msg: String)
     {
-        self.add_lint_diagnostic(lint, id, (sp, &msg[..]))
+        self.lints.borrow_mut().add_lint(lint, id, sp, msg);
     }
 
     pub fn add_lint_diagnostic<M>(&self,
@@ -285,17 +286,9 @@ pub fn add_lint_diagnostic<M>(&self,
                                   msg: M)
         where M: lint::IntoEarlyLint,
     {
-        let lint_id = lint::LintId::of(lint);
-        let mut lints = self.lints.borrow_mut();
-        let early_lint = msg.into_early_lint(lint_id);
-        if let Some(arr) = lints.get_mut(&id) {
-            if !arr.contains(&early_lint) {
-                arr.push(early_lint);
-            }
-            return;
-        }
-        lints.insert(id, vec![early_lint]);
+        self.lints.borrow_mut().add_lint_diagnostic(lint, id, msg);
     }
+
     pub fn reserve_node_ids(&self, count: usize) -> ast::NodeId {
         let id = self.next_node_id.get();
 
@@ -617,7 +610,7 @@ pub fn build_session_(sopts: config::Options,
         local_crate_source_file: local_crate_source_file,
         working_dir: env::current_dir().unwrap(),
         lint_store: RefCell::new(lint::LintStore::new()),
-        lints: RefCell::new(NodeMap()),
+        lints: RefCell::new(lint::LintTable::new()),
         one_time_diagnostics: RefCell::new(FxHashSet()),
         plugin_llvm_passes: RefCell::new(Vec::new()),
         mir_passes: RefCell::new(mir_pass::Passes::new()),
index 661d47199df13991861ca3023eeb302a4a9d6931..024c14ce9d922b1e1cce6acf464b21078a0bbc15 100644 (file)
@@ -39,6 +39,8 @@
 use std::cmp;
 use std::fmt;
 use syntax::ast;
+use hir::{intravisit, Local, Pat};
+use hir::intravisit::{Visitor, NestedVisitorMap};
 use syntax_pos::{DUMMY_SP, Span};
 use errors::DiagnosticBuilder;
 
@@ -60,6 +62,30 @@ fn from_error(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
     }
 }
 
+struct FindLocalByTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
+    infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
+    target_ty: &'a Ty<'tcx>,
+    found_pattern: Option<&'a Pat>,
+}
+
+impl<'a, 'gcx, 'tcx> Visitor<'a> for FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
+    fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'a> {
+        NestedVisitorMap::None
+    }
+
+    fn visit_local(&mut self, local: &'a Local) {
+        if let Some(&ty) = self.infcx.tables.borrow().node_types.get(&local.id) {
+            let ty = self.infcx.resolve_type_vars_if_possible(&ty);
+            let is_match = ty.walk().any(|t| t == *self.target_ty);
+
+            if is_match && self.found_pattern.is_none() {
+                self.found_pattern = Some(&*local.pat);
+            }
+        }
+        intravisit::walk_local(self, local);
+    }
+}
+
 impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
     pub fn report_fulfillment_errors(&self, errors: &Vec<FulfillmentError<'tcx>>) {
         for error in errors {
@@ -775,7 +801,7 @@ fn maybe_report_ambiguity(&self, obligation: &PredicateObligation<'tcx>) {
                             self.tcx.lang_items.sized_trait()
                             .map_or(false, |sized_id| sized_id == trait_ref.def_id())
                         {
-                            self.need_type_info(obligation.cause.span, self_ty);
+                            self.need_type_info(obligation, self_ty);
                         } else {
                             let mut err = struct_span_err!(self.tcx.sess,
                                                            obligation.cause.span, E0283,
@@ -793,7 +819,7 @@ fn maybe_report_ambiguity(&self, obligation: &PredicateObligation<'tcx>) {
                 // Same hacky approach as above to avoid deluging user
                 // with error messages.
                 if !ty.references_error() && !self.tcx.sess.has_errors() {
-                    self.need_type_info(obligation.cause.span, ty);
+                    self.need_type_info(obligation, ty);
                 }
             }
 
@@ -857,27 +883,53 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
         })
     }
 
-
-    fn need_type_info(&self, span: Span, ty: Ty<'tcx>) {
-        let ty = self.resolve_type_vars_if_possible(&ty);
-        let name = if let ty::TyInfer(ty::TyVar(ty_vid)) = ty.sty {
+    fn extract_type_name(&self, ty: &'a Ty<'tcx>) -> String {
+        if let ty::TyInfer(ty::TyVar(ty_vid)) = (*ty).sty {
             let ty_vars = self.type_variables.borrow();
             if let TypeVariableOrigin::TypeParameterDefinition(_, name) =
-                    *ty_vars.var_origin(ty_vid)
-            {
+                *ty_vars.var_origin(ty_vid) {
                 name.to_string()
             } else {
                 ty.to_string()
             }
         } else {
             ty.to_string()
+        }
+    }
+
+    fn need_type_info(&self, obligation: &PredicateObligation<'tcx>, ty: Ty<'tcx>) {
+        let ty = self.resolve_type_vars_if_possible(&ty);
+        let name = self.extract_type_name(&ty);
+        let ref cause = obligation.cause;
+
+        let mut err = struct_span_err!(self.tcx.sess,
+                                       cause.span,
+                                       E0282,
+                                       "type annotations needed");
+
+        err.span_label(cause.span, &format!("cannot infer type for `{}`", name));
+
+        let expr = self.tcx.hir.expect_expr(cause.body_id);
+
+        let mut local_visitor = FindLocalByTypeVisitor {
+            infcx: &self,
+            target_ty: &ty,
+            found_pattern: None,
         };
 
-        let mut err = struct_span_err!(self.tcx.sess, span, E0282,
-                                       "unable to infer enough type information about `{}`",
-                                       name);
-        err.note("type annotations or generic parameter binding required");
-        err.span_label(span, &format!("cannot infer type for `{}`", name));
+        local_visitor.visit_expr(expr);
+
+        if let Some(pattern) = local_visitor.found_pattern {
+            let pattern_span = pattern.span;
+            if let Some(simple_name) = pattern.simple_name() {
+                err.span_label(pattern_span,
+                               &format!("consider giving `{}` a type",
+                                        simple_name));
+            } else {
+                err.span_label(pattern_span, &format!("consider giving a type to pattern"));
+            }
+        }
+
         err.emit();
     }
 
index d51332f833d77cfdbefddc812c1092da8d7177c6..41f3f825c3d191e16770527fd80819af4ef77719 100644 (file)
@@ -52,6 +52,7 @@
 use std::rc::Rc;
 use syntax::abi::Abi;
 use hir;
+use lint;
 use util::nodemap::FxHashMap;
 
 struct InferredObligationsSnapshotVecDelegate<'tcx> {
@@ -407,19 +408,62 @@ pub fn select(&mut self, obligation: &TraitObligation<'tcx>)
         debug!("select({:?})", obligation);
         assert!(!obligation.predicate.has_escaping_regions());
 
+        let tcx = self.tcx();
         let dep_node = obligation.predicate.dep_node();
-        let _task = self.tcx().dep_graph.in_task(dep_node);
+        let _task = tcx.dep_graph.in_task(dep_node);
 
         let stack = self.push_stack(TraitObligationStackList::empty(), obligation);
-        match self.candidate_from_obligation(&stack)? {
-            None => Ok(None),
+        let ret = match self.candidate_from_obligation(&stack)? {
+            None => None,
             Some(candidate) => {
                 let mut candidate = self.confirm_candidate(obligation, candidate)?;
                 let inferred_obligations = (*self.inferred_obligations).into_iter().cloned();
                 candidate.nested_obligations_mut().extend(inferred_obligations);
-                Ok(Some(candidate))
+                Some(candidate)
             },
+        };
+
+        // Test whether this is a `()` which was produced by defaulting a
+        // diverging type variable with `!` disabled. If so, we may need
+        // to raise a warning.
+        if obligation.predicate.skip_binder().self_ty().is_defaulted_unit() {
+            let mut raise_warning = true;
+            // Don't raise a warning if the trait is implemented for ! and only
+            // permits a trivial implementation for !. This stops us warning
+            // about (for example) `(): Clone` becoming `!: Clone` because such
+            // a switch can't cause code to stop compiling or execute
+            // differently.
+            let mut never_obligation = obligation.clone();
+            let def_id = never_obligation.predicate.skip_binder().trait_ref.def_id;
+            never_obligation.predicate = never_obligation.predicate.map_bound(|mut trait_pred| {
+                // Swap out () with ! so we can check if the trait is impld for !
+                {
+                    let mut trait_ref = &mut trait_pred.trait_ref;
+                    let unit_substs = trait_ref.substs;
+                    let mut never_substs = Vec::with_capacity(unit_substs.len());
+                    never_substs.push(From::from(tcx.types.never));
+                    never_substs.extend(&unit_substs[1..]);
+                    trait_ref.substs = tcx.intern_substs(&never_substs);
+                }
+                trait_pred
+            });
+            if let Ok(Some(..)) = self.select(&never_obligation) {
+                if !tcx.trait_relevant_for_never(def_id) {
+                    // The trait is also implemented for ! and the resulting
+                    // implementation cannot actually be invoked in any way.
+                    raise_warning = false;
+                }
+            }
+
+            if raise_warning {
+                tcx.sess.add_lint(lint::builtin::RESOLVE_TRAIT_ON_DEFAULTED_UNIT,
+                                  obligation.cause.body_id,
+                                  obligation.cause.span,
+                                  format!("code relies on type inference rules which are likely \
+                                           to change"));
+            }
         }
+        Ok(ret)
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -1744,7 +1788,7 @@ fn sized_conditions(&mut self, obligation: &TraitObligation<'tcx>)
 
             ty::TyStr | ty::TySlice(_) | ty::TyDynamic(..) => Never,
 
-            ty::TyTuple(tys) => {
+            ty::TyTuple(tys, _) => {
                 Where(ty::Binder(tys.last().into_iter().cloned().collect()))
             }
 
@@ -1752,7 +1796,7 @@ fn sized_conditions(&mut self, obligation: &TraitObligation<'tcx>)
                 let sized_crit = def.sized_constraint(self.tcx());
                 // (*) binder moved here
                 Where(ty::Binder(match sized_crit.sty {
-                    ty::TyTuple(tys) => tys.to_vec().subst(self.tcx(), substs),
+                    ty::TyTuple(tys, _) => tys.to_vec().subst(self.tcx(), substs),
                     ty::TyBool => vec![],
                     _ => vec![sized_crit.subst(self.tcx(), substs)]
                 }))
@@ -1799,7 +1843,7 @@ fn copy_conditions(&mut self, obligation: &TraitObligation<'tcx>)
                 Where(ty::Binder(vec![element_ty]))
             }
 
-            ty::TyTuple(tys) => {
+            ty::TyTuple(tys, _) => {
                 // (*) binder moved here
                 Where(ty::Binder(tys.to_vec()))
             }
@@ -1874,7 +1918,7 @@ fn constituent_types_for_ty(&self, t: Ty<'tcx>) -> Vec<Ty<'tcx>> {
                 vec![element_ty]
             }
 
-            ty::TyTuple(ref tys) => {
+            ty::TyTuple(ref tys, _) => {
                 // (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
                 tys.to_vec()
             }
index cebd8bf87d736cca88ae75bcf5917a22d5193da3..7b2882bb64f2cb97a13825a6e66ae7eefcf0b877 100644 (file)
@@ -489,7 +489,7 @@ pub fn closure_trait_ref_and_return_type(self,
         let arguments_tuple = match tuple_arguments {
             TupleArgumentsFlag::No => sig.skip_binder().inputs()[0],
             TupleArgumentsFlag::Yes =>
-                self.intern_tup(sig.skip_binder().inputs()),
+                self.intern_tup(sig.skip_binder().inputs(), false),
         };
         let trait_ref = ty::TraitRef {
             def_id: fn_trait_def_id,
index 00c6dca21b1ef4f5f2a031973b1008498785b420..56621c57eb8f7bed86f3b7c10f99b6fbd565acc1 100644 (file)
@@ -201,7 +201,7 @@ fn tc_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                         |ty| tc_ty(tcx, &ty, cache))
                 }
 
-                ty::TyTuple(ref tys) => {
+                ty::TyTuple(ref tys, _) => {
                     TypeContents::union(&tys[..],
                                         |ty| tc_ty(tcx, *ty, cache))
                 }
index ce4a6a3182635d5aad030d99e5ef25474822d4f7..a0eae33c4402b20c5a03478840ae208efe05bc54 100644 (file)
@@ -12,6 +12,7 @@
 
 use dep_graph::{DepGraph, DepTrackingMap};
 use session::Session;
+use lint;
 use middle;
 use hir::TraitMap;
 use hir::def::Def;
@@ -237,6 +238,9 @@ pub struct TypeckTables<'tcx> {
     /// Maps a cast expression to its kind. This is keyed on the
     /// *from* expression of the cast, not the cast itself.
     pub cast_kinds: NodeMap<ty::cast::CastKind>,
+
+    /// Lints for the body of this fn generated by typeck.
+    pub lints: lint::LintTable,
 }
 
 impl<'tcx> TypeckTables<'tcx> {
@@ -253,6 +257,7 @@ pub fn empty() -> TypeckTables<'tcx> {
             liberated_fn_sigs: NodeMap(),
             fru_field_types: NodeMap(),
             cast_kinds: NodeMap(),
+            lints: lint::LintTable::new(),
         }
     }
 
@@ -494,7 +499,7 @@ pub struct GlobalCtxt<'tcx> {
 
     /// Set of trait imports actually used in the method resolution.
     /// This is used for warning unused imports.
-    pub used_trait_imports: RefCell<NodeSet>,
+    pub used_trait_imports: RefCell<DepTrackingMap<maps::UsedTraitImports<'tcx>>>,
 
     /// The set of external nominal types whose implementations have been read.
     /// This is used for lazy resolution of methods.
@@ -783,7 +788,7 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
             inherent_impls: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
             used_unsafe: RefCell::new(NodeSet()),
             used_mut_nodes: RefCell::new(NodeSet()),
-            used_trait_imports: RefCell::new(NodeSet()),
+            used_trait_imports: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
             populated_external_types: RefCell::new(DefIdSet()),
             populated_external_primitive_impls: RefCell::new(DefIdSet()),
             stability: RefCell::new(stability),
@@ -1379,23 +1384,24 @@ pub fn mk_slice(self, ty: Ty<'tcx>) -> Ty<'tcx> {
         self.mk_ty(TySlice(ty))
     }
 
-    pub fn intern_tup(self, ts: &[Ty<'tcx>]) -> Ty<'tcx> {
-        self.mk_ty(TyTuple(self.intern_type_list(ts)))
+    pub fn intern_tup(self, ts: &[Ty<'tcx>], defaulted: bool) -> Ty<'tcx> {
+        self.mk_ty(TyTuple(self.intern_type_list(ts), defaulted))
     }
 
-    pub fn mk_tup<I: InternAs<[Ty<'tcx>], Ty<'tcx>>>(self, iter: I) -> I::Output {
-        iter.intern_with(|ts| self.mk_ty(TyTuple(self.intern_type_list(ts))))
+    pub fn mk_tup<I: InternAs<[Ty<'tcx>], Ty<'tcx>>>(self, iter: I,
+                                                     defaulted: bool) -> I::Output {
+        iter.intern_with(|ts| self.mk_ty(TyTuple(self.intern_type_list(ts), defaulted)))
     }
 
     pub fn mk_nil(self) -> Ty<'tcx> {
-        self.intern_tup(&[])
+        self.intern_tup(&[], false)
     }
 
     pub fn mk_diverging_default(self) -> Ty<'tcx> {
         if self.sess.features.borrow().never_type {
             self.types.never
         } else {
-            self.mk_nil()
+            self.intern_tup(&[], true)
         }
     }
 
index 29d855a7fcb78ebf9cc3362bc7e100060243b610..3ab3fc899e78c6754305f18f307f6534c3cc5378 100644 (file)
@@ -178,7 +178,7 @@ pub fn sort_string(&self, tcx: TyCtxt<'a, 'gcx, 'lcx>) -> String {
         match self.sty {
             ty::TyBool | ty::TyChar | ty::TyInt(_) |
             ty::TyUint(_) | ty::TyFloat(_) | ty::TyStr | ty::TyNever => self.to_string(),
-            ty::TyTuple(ref tys) if tys.is_empty() => self.to_string(),
+            ty::TyTuple(ref tys, _) if tys.is_empty() => self.to_string(),
 
             ty::TyAdt(def, _) => format!("{} `{}`", def.descr(), tcx.item_path_str(def.did)),
             ty::TyArray(_, n) => format!("array of {} elements", n),
@@ -209,7 +209,7 @@ pub fn sort_string(&self, tcx: TyCtxt<'a, 'gcx, 'lcx>) -> String {
                     |p| format!("trait {}", tcx.item_path_str(p.def_id())))
             }
             ty::TyClosure(..) => "closure".to_string(),
-            ty::TyTuple(_) => "tuple".to_string(),
+            ty::TyTuple(..) => "tuple".to_string(),
             ty::TyInfer(ty::TyVar(_)) => "inferred type".to_string(),
             ty::TyInfer(ty::IntVar(_)) => "integral variable".to_string(),
             ty::TyInfer(ty::FloatVar(_)) => "floating-point variable".to_string(),
index 94b9abc72025faed7f33357bdcd25610416ed7d8..981cf0897a034f2f68e1d600bdaac3e4448bbe31 100644 (file)
@@ -72,7 +72,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
             Some(ClosureSimplifiedType(def_id))
         }
         ty::TyNever => Some(NeverSimplifiedType),
-        ty::TyTuple(ref tys) => {
+        ty::TyTuple(ref tys, _) => {
             Some(TupleSimplifiedType(tys.len()))
         }
         ty::TyFnDef(.., ref f) | ty::TyFnPtr(ref f) => {
index 0de77526b5a46a2e934c36ee239a200f441ab05f..2012917f93a87e91669d74d8b61442ee97763e9f 100644 (file)
@@ -151,7 +151,7 @@ fn add_sty(&mut self, st: &ty::TypeVariants) {
                 self.add_ty(m.ty);
             }
 
-            &ty::TyTuple(ref ts) => {
+            &ty::TyTuple(ref ts, _) => {
                 self.add_tys(&ts[..]);
             }
 
index 6c49493a655597abb1b95ec23aeba408ea0bcffa..18a3f1a218d854e00d9e2f4204152234b08ba18f 100644 (file)
@@ -178,7 +178,7 @@ fn uninhabited_from_inner(
             },
 
             TyNever => DefIdForest::full(tcx),
-            TyTuple(ref tys) => {
+            TyTuple(ref tys, _) => {
                 DefIdForest::union(tcx, tys.iter().map(|ty| {
                     ty.uninhabited_from(visited, tcx)
                 }))
index b719911d18cf8706113805f6ccba94fe49f00b21..f45f00b4dec96bbf20590469c44687b98858a625 100644 (file)
@@ -319,9 +319,9 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> {
         ty::TyRawPtr(mt) |
         ty::TyRef(_, mt) => characteristic_def_id_of_type(mt.ty),
 
-        ty::TyTuple(ref tys) => tys.iter()
-                                   .filter_map(|ty| characteristic_def_id_of_type(ty))
-                                   .next(),
+        ty::TyTuple(ref tys, _) => tys.iter()
+                                      .filter_map(|ty| characteristic_def_id_of_type(ty))
+                                      .next(),
 
         ty::TyFnDef(def_id, ..) |
         ty::TyClosure(def_id, _) => Some(def_id),
index 78364abdaecba9ee2a160cf811b53846687211d1..ff3ac3586a78778b69a84b0bbd9b8ec9b2347f27 100644 (file)
@@ -20,7 +20,6 @@
 use syntax::ast::{FloatTy, IntTy, UintTy};
 use syntax::attr;
 use syntax_pos::DUMMY_SP;
-use rustc_i128::u128;
 use rustc_const_math::ConstInt;
 
 use std::cmp;
@@ -792,7 +791,7 @@ fn non_zero_field_in_type(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
                     Some(&variant.memory_index[..]))
             }
             // Can we use one of the fields in this tuple?
-            (&Univariant { ref variant, .. }, &ty::TyTuple(tys)) => {
+            (&Univariant { ref variant, .. }, &ty::TyTuple(tys, _)) => {
                 Struct::non_zero_field_paths(infcx, tys.iter().cloned(),
                     Some(&variant.memory_index[..]))
             }
@@ -1158,7 +1157,7 @@ pub fn compute_uncached(ty: Ty<'gcx>,
                 Univariant { variant: st, non_zero: false }
             }
 
-            ty::TyTuple(tys) => {
+            ty::TyTuple(tys, _) => {
                 // FIXME(camlorn): if we ever allow unsized tuples, this needs to be checked.
                 // See the univariant case below to learn how.
                 let st = Struct::new(dl,
index c0cf1d724273ed558e7c15a00c2eba318f8d4062..d7341d148b720636a865cadd0f0399f8f7d189cd 100644 (file)
@@ -12,6 +12,7 @@
 use hir::def_id::DefId;
 use mir;
 use ty::{self, Ty};
+use util::nodemap::DefIdSet;
 
 use std::cell::RefCell;
 use std::marker::PhantomData;
@@ -49,3 +50,4 @@ fn to_dep_node(key: &$key) -> DepNode<DefId> { DepNode::$node_name(*key) }
 dep_map_ty! { ClosureKinds: ItemSignature(DefId) -> ty::ClosureKind }
 dep_map_ty! { ClosureTypes: ItemSignature(DefId) -> ty::ClosureTy<'tcx> }
 dep_map_ty! { TypeckTables: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx> }
+dep_map_ty! { UsedTraitImports: UsedTraitImports(DefId) -> DefIdSet }
index 5ab45e746e7f25e67763af997ff915812cf60631..4d9514b1473c7a6d254f59e929ce9df7e6ca4cd5 100644 (file)
@@ -197,6 +197,17 @@ pub fn def(&self) -> Def {
             AssociatedKind::Type => Def::AssociatedTy(self.def_id),
         }
     }
+
+    /// Tests whether the associated item admits a non-trivial implementation
+    /// for !
+    pub fn relevant_for_never<'tcx>(&self) -> bool {
+        match self.kind {
+            AssociatedKind::Const => true,
+            AssociatedKind::Type => true,
+            // FIXME(canndrew): Be more thorough here, check if any argument is uninhabited.
+            AssociatedKind::Method => !self.method_has_self_argument,
+        }
+    }
 }
 
 #[derive(Clone, Debug, PartialEq, Eq, Copy, RustcEncodable, RustcDecodable)]
@@ -595,6 +606,7 @@ pub struct RegionParameterDef {
     pub name: Name,
     pub def_id: DefId,
     pub index: u32,
+    pub issue_32330: Option<ty::Issue32330>,
 
     /// `pure_wrt_drop`, set by the (unsafe) `#[may_dangle]` attribute
     /// on generic parameter `'a`, asserts data of lifetime `'a`
@@ -611,8 +623,7 @@ pub fn to_early_bound_region_data(&self) -> ty::EarlyBoundRegion {
     }
 
     pub fn to_bound_region(&self) -> ty::BoundRegion {
-        // this is an early bound region, so unaffected by #32330
-        ty::BoundRegion::BrNamed(self.def_id, self.name, Issue32330::WontChange)
+        ty::BoundRegion::BrNamed(self.def_id, self.name)
     }
 }
 
@@ -1603,7 +1614,7 @@ fn calculate_sized_constraint_inner(&self,
             _ if tys.references_error() => tcx.types.err,
             0 => tcx.types.bool,
             1 => tys[0],
-            _ => tcx.intern_tup(&tys[..])
+            _ => tcx.intern_tup(&tys[..], false)
         };
 
         let old = tcx.adt_sized_constraint.borrow().get(&self.did).cloned();
@@ -1638,7 +1649,7 @@ fn sized_constraint_for_ty(&self,
                 vec![ty]
             }
 
-            TyTuple(ref tys) => {
+            TyTuple(ref tys, _) => {
                 match tys.last() {
                     None => vec![],
                     Some(ty) => self.sized_constraint_for_ty(tcx, stack, ty)
@@ -1652,7 +1663,7 @@ fn sized_constraint_for_ty(&self,
                        .subst(tcx, substs);
                 debug!("sized_constraint_for_ty({:?}) intermediate = {:?}",
                        ty, adt_ty);
-                if let ty::TyTuple(ref tys) = adt_ty.sty {
+                if let ty::TyTuple(ref tys, _) = adt_ty.sty {
                     tys.iter().flat_map(|ty| {
                         self.sized_constraint_for_ty(tcx, stack, ty)
                     }).collect()
@@ -2010,6 +2021,12 @@ pub fn trait_impl_polarity(self, id: DefId) -> hir::ImplPolarity {
         }
     }
 
+    pub fn trait_relevant_for_never(self, did: DefId) -> bool {
+        self.associated_items(did).any(|item| {
+            item.relevant_for_never()
+        })
+    }
+
     pub fn custom_coerce_unsized_kind(self, did: DefId) -> adjustment::CustomCoerceUnsized {
         self.custom_coerce_unsized_kinds.memoize(did, || {
             let (kind, src) = if did.krate != LOCAL_CRATE {
index 89514085e1c78601d1efd4582387df06ef1b4fff..adedf78bba7c013e922cbc40cb89fcbaf67e9ced 100644 (file)
@@ -447,10 +447,11 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R,
             Ok(tcx.mk_slice(t))
         }
 
-        (&ty::TyTuple(as_), &ty::TyTuple(bs)) =>
+        (&ty::TyTuple(as_, a_defaulted), &ty::TyTuple(bs, b_defaulted)) =>
         {
             if as_.len() == bs.len() {
-                Ok(tcx.mk_tup(as_.iter().zip(bs).map(|(a, b)| relation.relate(a, b)))?)
+                let defaulted = a_defaulted || b_defaulted;
+                Ok(tcx.mk_tup(as_.iter().zip(bs).map(|(a, b)| relation.relate(a, b)), defaulted)?)
             } else if !(as_.is_empty() || bs.is_empty()) {
                 Err(TypeError::TupleSize(
                     expected_found(relation, &as_.len(), &bs.len())))
index 05f4abad469213f41347de0013a71ae28d3423ff..aa74e7cc0d0430c809f0195b34fcf98a4bdc2170 100644 (file)
@@ -474,7 +474,7 @@ fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
             ty::TyAdt(tid, substs) => ty::TyAdt(tid, substs.fold_with(folder)),
             ty::TyDynamic(ref trait_ty, ref region) =>
                 ty::TyDynamic(trait_ty.fold_with(folder), region.fold_with(folder)),
-            ty::TyTuple(ts) => ty::TyTuple(ts.fold_with(folder)),
+            ty::TyTuple(ts, defaulted) => ty::TyTuple(ts.fold_with(folder), defaulted),
             ty::TyFnDef(def_id, substs, f) => {
                 ty::TyFnDef(def_id,
                             substs.fold_with(folder),
@@ -511,7 +511,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
             ty::TyAdt(_, substs) => substs.visit_with(visitor),
             ty::TyDynamic(ref trait_ty, ref reg) =>
                 trait_ty.visit_with(visitor) || reg.visit_with(visitor),
-            ty::TyTuple(ts) => ts.visit_with(visitor),
+            ty::TyTuple(ts, _) => ts.visit_with(visitor),
             ty::TyFnDef(_, substs, ref f) => {
                 substs.visit_with(visitor) || f.visit_with(visitor)
             }
index 113534e4529cdc6c87c8855cbd11c366b392bd76..4ce1d7a9013621cce9c4deb186da33c39eaa1021 100644 (file)
@@ -58,7 +58,7 @@ pub enum BoundRegion {
     ///
     /// The def-id is needed to distinguish free regions in
     /// the event of shadowing.
-    BrNamed(DefId, Name, Issue32330),
+    BrNamed(DefId, Name),
 
     /// Fresh bound identifiers created during GLB computations.
     BrFresh(u32),
@@ -68,23 +68,18 @@ pub enum BoundRegion {
     BrEnv
 }
 
-/// True if this late-bound region is unconstrained, and hence will
-/// become early-bound once #32330 is fixed.
+/// When a region changed from late-bound to early-bound when #32330
+/// was fixed, its `RegionParameterDef` will have one of these
+/// structures that we can use to give nicer errors.
 #[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash,
          RustcEncodable, RustcDecodable)]
-pub enum Issue32330 {
-    WontChange,
+pub struct Issue32330 {
+    /// fn where is region declared
+    pub fn_def_id: DefId,
 
-    /// this region will change from late-bound to early-bound once
-    /// #32330 is fixed.
-    WillChange {
-        /// fn where is region declared
-        fn_def_id: DefId,
-
-        /// name of region; duplicates the info in BrNamed but convenient
-        /// to have it here, and this code is only temporary
-        region_name: ast::Name,
-    }
+    /// name of region; duplicates the info in BrNamed but convenient
+    /// to have it here, and this code is only temporary
+    pub region_name: ast::Name,
 }
 
 // NB: If you change this, you'll probably want to change the corresponding
@@ -151,7 +146,11 @@ pub enum TypeVariants<'tcx> {
     TyNever,
 
     /// A tuple type.  For example, `(i32, bool)`.
-    TyTuple(&'tcx Slice<Ty<'tcx>>),
+    /// The bool indicates whether this is a unit tuple and was created by
+    /// defaulting a diverging type variable with feature(never_type) disabled.
+    /// It's only purpose is for raising future-compatibility warnings for when
+    /// diverging type variables start defaulting to ! instead of ().
+    TyTuple(&'tcx Slice<Ty<'tcx>>, bool),
 
     /// The projection of an associated type.  For example,
     /// `<T as Trait<..>>::N`.
@@ -961,7 +960,7 @@ pub fn as_opt_param_ty(&self) -> Option<ty::ParamTy> {
 
     pub fn is_nil(&self) -> bool {
         match self.sty {
-            TyTuple(ref tys) => tys.is_empty(),
+            TyTuple(ref tys, _) => tys.is_empty(),
             _ => false
         }
     }
@@ -973,6 +972,15 @@ pub fn is_never(&self) -> bool {
         }
     }
 
+    // Test whether this is a `()` which was produced by defaulting a
+    // diverging type variable with feature(never_type) disabled.
+    pub fn is_defaulted_unit(&self) -> bool {
+        match self.sty {
+            TyTuple(_, true) => true,
+            _ => false,
+        }
+    }
+
     /// Checks whether a type is visibly uninhabited from a particular module.
     /// # Example
     /// ```rust
@@ -1355,7 +1363,7 @@ pub fn regions(&self) -> Vec<&'tcx ty::Region> {
             TySlice(_) |
             TyRawPtr(_) |
             TyNever |
-            TyTuple(_) |
+            TyTuple(..) |
             TyParam(_) |
             TyInfer(_) |
             TyError => {
index ba49aa1ef4866b97c8ffc5c211130ae5775a99a2..b01b77bbcf8a5c5e184b9a03ab06df54e037f2b9 100644 (file)
@@ -207,7 +207,7 @@ pub fn positional_element_ty(self,
                 // Don't use `struct_variant`, this may be a univariant enum.
                 adt.variants[0].fields.get(i).map(|f| f.ty(self, substs))
             }
-            (&TyTuple(ref v), None) => v.get(i).cloned(),
+            (&TyTuple(ref v, _), None) => v.get(i).cloned(),
             _ => None
         }
     }
@@ -466,8 +466,9 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
                     self.def_id(d);
                 }
             }
-            TyTuple(tys) => {
+            TyTuple(tys, defaulted) => {
                 self.hash(tys.len());
+                self.hash(defaulted);
             }
             TyParam(p) => {
                 self.hash(p.idx);
@@ -675,7 +676,7 @@ fn are_inner_types_recursive<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span,
                                                seen: &mut Vec<Ty<'tcx>>, ty: Ty<'tcx>)
                                                -> Representability {
             match ty.sty {
-                TyTuple(ref ts) => {
+                TyTuple(ref ts, _) => {
                     find_nonrepresentable(tcx, sp, seen, ts.iter().cloned())
                 }
                 // Fixed-length vectors.
index 0d1dc2e4d7c218c8ed3dabc3dcafca6d176eef87..01f31e5024c0dfeaf258100b77b17e136193a493 100644 (file)
@@ -112,7 +112,7 @@ fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) {
         ty::TyClosure(_, ref substs) => {
             stack.extend(substs.substs.types().rev());
         }
-        ty::TyTuple(ts) => {
+        ty::TyTuple(ts, _) => {
             stack.extend(ts.iter().cloned().rev());
         }
         ty::TyFnDef(_, substs, ref ft) => {
index 33b70b09dcb7b6d742ae1932e77079384fe574ae..8a5bd6862cf4552c099b431fa344c81142dc7876 100644 (file)
@@ -315,7 +315,7 @@ fn compute(&mut self, ty0: Ty<'tcx>) -> bool {
                     self.require_sized(subty, traits::SliceOrArrayElem);
                 }
 
-                ty::TyTuple(ref tys) => {
+                ty::TyTuple(ref tys, _) => {
                     if let Some((_last, rest)) = tys.split_last() {
                         for elem in rest {
                             self.require_sized(elem, traits::TupleElem);
index c290d8f893e9ed8e9c077e7fb53045f1c56bc845..3b4b3998c574531ee3cd16afaaf8540a0d2be24b 100644 (file)
@@ -31,7 +31,7 @@
 //   https://github.com/rust-lang/rust/issues/25505#issuecomment-102876737
 pub fn fix_windows_verbatim_for_gcc(p: &Path) -> PathBuf {
     if !cfg!(windows) {
-        return p.to_path_buf()
+        return p.to_path_buf();
     }
     let mut components = p.components();
     let prefix = match components.next() {
@@ -58,7 +58,7 @@ pub fn fix_windows_verbatim_for_gcc(p: &Path) -> PathBuf {
 
 pub enum LinkOrCopy {
     Link,
-    Copy
+    Copy,
 }
 
 /// Copy `p` into `q`, preferring to use hard-linking if possible. If
@@ -76,7 +76,35 @@ pub fn link_or_copy<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io::Result<Li
         Err(_) => {
             match fs::copy(p, q) {
                 Ok(_) => Ok(LinkOrCopy::Copy),
-                Err(e) => Err(e)
+                Err(e) => Err(e),
+            }
+        }
+    }
+}
+
+#[derive(Debug)]
+pub enum RenameOrCopyRemove {
+    Rename,
+    CopyRemove,
+}
+
+/// Rename `p` into `q`, preferring to use `rename` if possible.
+/// If `rename` fails (rename may fail for reasons such as crossing
+/// filesystem), fallback to copy & remove
+pub fn rename_or_copy_remove<P: AsRef<Path>, Q: AsRef<Path>>(p: P,
+                                                             q: Q)
+                                                             -> io::Result<RenameOrCopyRemove> {
+    let p = p.as_ref();
+    let q = q.as_ref();
+    match fs::rename(p, q) {
+        Ok(()) => Ok(RenameOrCopyRemove::Rename),
+        Err(_) => {
+            match fs::copy(p, q) {
+                Ok(_) => {
+                    fs::remove_file(p)?;
+                    Ok(RenameOrCopyRemove::CopyRemove)
+                }
+                Err(e) => Err(e),
             }
         }
     }
@@ -93,8 +121,7 @@ pub fn create_dir_racy(path: &Path) -> io::Result<()> {
     }
     match path.parent() {
         Some(p) => try!(create_dir_racy(p)),
-        None => return Err(io::Error::new(io::ErrorKind::Other,
-                                          "failed to create whole tree")),
+        None => return Err(io::Error::new(io::ErrorKind::Other, "failed to create whole tree")),
     }
     match fs::create_dir(path) {
         Ok(()) => Ok(()),
diff --git a/src/librustc/util/num.rs b/src/librustc/util/num.rs
deleted file mode 100644 (file)
index da04976..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait ToPrimitive {
-    fn to_i8(&self) -> Option<i8>;
-    fn to_i16(&self) -> Option<i16>;
-    fn to_i32(&self) -> Option<i32>;
-    fn to_i64(&self) -> Option<i64>;
-    fn to_u8(&self) -> Option<u8>;
-    fn to_u16(&self) -> Option<u16>;
-    fn to_u32(&self) -> Option<u32>;
-    fn to_u64(&self) -> Option<u64>;
-}
-
-impl ToPrimitive for i64 {
-    fn to_i8(&self) -> Option<i8> {
-        if *self < i8::min_value() as i64 || *self > i8::max_value() as i64 {
-            None
-        } else {
-            Some(*self as i8)
-        }
-    }
-    fn to_i16(&self) -> Option<i16> {
-        if *self < i16::min_value() as i64 || *self > i16::max_value() as i64 {
-            None
-        } else {
-            Some(*self as i16)
-        }
-    }
-    fn to_i32(&self) -> Option<i32> {
-        if *self < i32::min_value() as i64 || *self > i32::max_value() as i64 {
-            None
-        } else {
-            Some(*self as i32)
-        }
-    }
-    fn to_i64(&self) -> Option<i64> {
-        Some(*self)
-    }
-    fn to_u8(&self) -> Option<u8> {
-        if *self < 0 || *self > u8::max_value() as i64 {
-            None
-        } else {
-            Some(*self as u8)
-        }
-    }
-    fn to_u16(&self) -> Option<u16> {
-        if *self < 0 || *self > u16::max_value() as i64 {
-            None
-        } else {
-            Some(*self as u16)
-        }
-    }
-    fn to_u32(&self) -> Option<u32> {
-        if *self < 0 || *self > u32::max_value() as i64 {
-            None
-        } else {
-            Some(*self as u32)
-        }
-    }
-    fn to_u64(&self) -> Option<u64> {
-        if *self < 0 {None} else {Some(*self as u64)}
-    }
-}
-
-impl ToPrimitive for u64 {
-    fn to_i8(&self) -> Option<i8> {
-        if *self > i8::max_value() as u64 {None} else {Some(*self as i8)}
-    }
-    fn to_i16(&self) -> Option<i16> {
-        if *self > i16::max_value() as u64 {None} else {Some(*self as i16)}
-    }
-    fn to_i32(&self) -> Option<i32> {
-        if *self > i32::max_value() as u64 {None} else {Some(*self as i32)}
-    }
-    fn to_i64(&self) -> Option<i64> {
-        if *self > i64::max_value() as u64 {None} else {Some(*self as i64)}
-    }
-    fn to_u8(&self) -> Option<u8> {
-        if *self > u8::max_value() as u64 {None} else {Some(*self as u8)}
-    }
-    fn to_u16(&self) -> Option<u16> {
-        if *self > u16::max_value() as u64 {None} else {Some(*self as u16)}
-    }
-    fn to_u32(&self) -> Option<u32> {
-        if *self > u32::max_value() as u64 {None} else {Some(*self as u32)}
-    }
-    fn to_u64(&self) -> Option<u64> {
-        Some(*self)
-    }
-}
index aa2eb2955debe69cbd278e39cb3b7319de362c7e..a45c43235ebf857ff203cf6ef128360cbf10154c 100644 (file)
@@ -156,7 +156,7 @@ pub fn parameterized(f: &mut fmt::Formatter,
 
     if !verbose && fn_trait_kind.is_some() && projections.len() == 1 {
         let projection_ty = projections[0].ty;
-        if let TyTuple(ref args) = substs.type_at(1).sty {
+        if let TyTuple(ref args, _) = substs.type_at(1).sty {
             return fn_sig(f, args, false, projection_ty);
         }
     }
@@ -276,7 +276,7 @@ fn in_binder<'a, 'gcx, 'tcx, T, U>(f: &mut fmt::Formatter,
     let new_value = tcx.replace_late_bound_regions(&value, |br| {
         let _ = start_or_continue(f, "for<", ", ");
         let br = match br {
-            ty::BrNamed(_, name, _) => {
+            ty::BrNamed(_, name) => {
                 let _ = write!(f, "{}", name);
                 br
             }
@@ -286,8 +286,7 @@ fn in_binder<'a, 'gcx, 'tcx, T, U>(f: &mut fmt::Formatter,
                 let name = Symbol::intern("'r");
                 let _ = write!(f, "{}", name);
                 ty::BrNamed(tcx.hir.local_def_id(CRATE_NODE_ID),
-                            name,
-                            ty::Issue32330::WontChange)
+                            name)
             }
         };
         tcx.mk_region(ty::ReLateBound(ty::DebruijnIndex::new(1), br))
@@ -435,7 +434,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         }
 
         match *self {
-            BrNamed(_, name, _) => write!(f, "{}", name),
+            BrNamed(_, name) => write!(f, "{}", name),
             BrAnon(_) | BrFresh(_) | BrEnv => Ok(())
         }
     }
@@ -446,9 +445,9 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             BrAnon(n) => write!(f, "BrAnon({:?})", n),
             BrFresh(n) => write!(f, "BrFresh({:?})", n),
-            BrNamed(did, name, issue32330) => {
-                write!(f, "BrNamed({:?}:{:?}, {:?}, {:?})",
-                       did.krate, did.index, name, issue32330)
+            BrNamed(did, name) => {
+                write!(f, "BrNamed({:?}:{:?}, {:?})",
+                       did.krate, did.index, name)
             }
             BrEnv => "BrEnv".fmt(f),
         }
@@ -724,7 +723,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                 write!(f, "{}", tm)
             }
             TyNever => write!(f, "!"),
-            TyTuple(ref tys) => {
+            TyTuple(ref tys, _) => {
                 write!(f, "(")?;
                 let mut tys = tys.iter();
                 if let Some(&ty) = tys.next() {
diff --git a/src/librustc_back/target/aarch64_unknown_freebsd.rs b/src/librustc_back/target/aarch64_unknown_freebsd.rs
new file mode 100644 (file)
index 0000000..3c5d630
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use target::{Target, TargetOptions, TargetResult};
+
+pub fn target() -> TargetResult {
+    let mut base = super::freebsd_base::opts();
+    base.max_atomic_width = Some(128);
+
+    // see #36994
+    base.exe_allocation_crate = "alloc_system".to_string();
+
+    Ok(Target {
+        llvm_target: "aarch64-unknown-freebsd".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_width: "64".to_string(),
+        data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
+        arch: "aarch64".to_string(),
+        target_os: "freebsd".to_string(),
+        target_env: "".to_string(),
+        target_vendor: "unknown".to_string(),
+        options: TargetOptions {
+            abi_blacklist: super::arm_base::abi_blacklist(),
+            .. base
+        },
+    })
+}
index 2dbaeaf26e970f68cf15d27859324e6c94b88245..4d38b0d1705962afa24e58c81801073ea0569d67 100644 (file)
@@ -22,6 +22,7 @@ pub fn target() -> Result<Target, String> {
         linker_is_gnu: true,
         allow_asm: false,
         obj_is_bitcode: true,
+        is_like_emscripten: true,
         max_atomic_width: Some(32),
         post_link_args: vec!["-s".to_string(), "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string()],
         target_family: Some("unix".to_string()),
diff --git a/src/librustc_back/target/i686_unknown_netbsd.rs b/src/librustc_back/target/i686_unknown_netbsd.rs
new file mode 100644 (file)
index 0000000..e7e2ee3
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use target::{Target, TargetResult};
+
+pub fn target() -> TargetResult {
+    let mut base = super::netbsd_base::opts();
+    base.cpu = "pentium4".to_string();
+    base.max_atomic_width = Some(64);
+    base.pre_link_args.push("-m32".to_string());
+
+    Ok(Target {
+        llvm_target: "i686-unknown-netbsdelf".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_width: "32".to_string(),
+        data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
+        arch: "x86".to_string(),
+        target_os: "netbsd".to_string(),
+        target_env: "".to_string(),
+        target_vendor: "unknown".to_string(),
+        options: base,
+    })
+}
index 5afa85d155279e17a905edf5885a32d677209914..1d5d1e3ab2fc78a22f0ba2a9ac9dc0cbe1a994f8 100644 (file)
@@ -165,6 +165,7 @@ fn $module() {
     ("armv7-linux-androideabi", armv7_linux_androideabi),
     ("aarch64-linux-android", aarch64_linux_android),
 
+    ("aarch64-unknown-freebsd", aarch64_unknown_freebsd),
     ("i686-unknown-freebsd", i686_unknown_freebsd),
     ("x86_64-unknown-freebsd", x86_64_unknown_freebsd),
 
@@ -176,6 +177,7 @@ fn $module() {
     ("i686-unknown-openbsd", i686_unknown_openbsd),
     ("x86_64-unknown-openbsd", x86_64_unknown_openbsd),
 
+    ("i686-unknown-netbsd", i686_unknown_netbsd),
     ("sparc64-unknown-netbsd", sparc64_unknown_netbsd),
     ("x86_64-unknown-netbsd", x86_64_unknown_netbsd),
     ("x86_64-rumprun-netbsd", x86_64_rumprun_netbsd),
@@ -330,6 +332,10 @@ pub struct TargetOptions {
     /// Whether the target toolchain is like Android's. Only useful for compiling against Android.
     /// Defaults to false.
     pub is_like_android: bool,
+    /// Whether the target toolchain is like Emscripten's. Only useful for compiling with
+    /// Emscripten toolchain.
+    /// Defaults to false.
+    pub is_like_emscripten: bool,
     /// Whether the linker support GNU-like arguments such as -O. Defaults to false.
     pub linker_is_gnu: bool,
     /// The MinGW toolchain has a known issue that prevents it from correctly
@@ -428,6 +434,7 @@ fn default() -> TargetOptions {
             is_like_solaris: false,
             is_like_windows: false,
             is_like_android: false,
+            is_like_emscripten: false,
             is_like_msvc: false,
             linker_is_gnu: false,
             allows_weak_linkage: true,
@@ -603,6 +610,7 @@ macro_rules! key {
         key!(is_like_solaris, bool);
         key!(is_like_windows, bool);
         key!(is_like_msvc, bool);
+        key!(is_like_emscripten, bool);
         key!(is_like_android, bool);
         key!(linker_is_gnu, bool);
         key!(allows_weak_linkage, bool);
@@ -767,6 +775,7 @@ macro_rules! target_option_val {
         target_option_val!(is_like_solaris);
         target_option_val!(is_like_windows);
         target_option_val!(is_like_msvc);
+        target_option_val!(is_like_emscripten);
         target_option_val!(is_like_android);
         target_option_val!(linker_is_gnu);
         target_option_val!(allows_weak_linkage);
index a06980767fd75cd58baded41b2fabe298191e15a..b1967fa8f37a7aea5c3052d48d45e24bfbbf4098 100644 (file)
@@ -24,6 +24,7 @@ pub fn target() -> Result<Target, String> {
         linker_is_gnu: true,
         allow_asm: false,
         obj_is_bitcode: true,
+        is_like_emscripten: true,
         max_atomic_width: Some(32),
         post_link_args: vec!["-s".to_string(), "BINARYEN=1".to_string(),
                              "-s".to_string(), "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string()],
index 285f3ab9047c85c5379abf9171f886cbfb7aab56..dbab3bca52b4eccc5caba872e2d2d476de468cdf 100644 (file)
@@ -423,7 +423,7 @@ fn add_fragment_siblings_for_extension<'a, 'tcx>(this: &MoveData<'tcx>,
     };
 
     match parent_ty.sty {
-        ty::TyTuple(ref v) => {
+        ty::TyTuple(ref v, _) => {
             let tuple_idx = match *origin_field_name {
                 mc::PositionalField(tuple_idx) => tuple_idx,
                 mc::NamedField(_) =>
index 9e89a3689c7acd23c7894a16270052336813d430..d2f744bde2d63d33444202a38a1515d3fec1ae50 100644 (file)
@@ -713,7 +713,7 @@ fn open_drop<'a>(&mut self, c: &DropCtxt<'a, 'tcx>) -> BasicBlock {
                 let tys : Vec<_> = substs.upvar_tys(def_id, self.tcx).collect();
                 self.open_drop_for_tuple(c, &tys)
             }
-            ty::TyTuple(tys) => {
+            ty::TyTuple(tys, _) => {
                 self.open_drop_for_tuple(c, tys)
             }
             ty::TyAdt(def, _) if def.is_box() => {
index ff028c202a8497e5772c7575d6c6bdfc938f735c..780b2c16a32ecefc5bd556d2a88b6409b9246554 100644 (file)
@@ -19,4 +19,3 @@ rustc_errors = { path = "../librustc_errors" }
 syntax = { path = "../libsyntax" }
 graphviz = { path = "../libgraphviz" }
 syntax_pos = { path = "../libsyntax_pos" }
-rustc_i128 = { path = "../librustc_i128" }
index 94b2ba58c9aa539c776df5978597f95658365b93..7a64ff7114a7eaba36871218c566db2e58c54c2e 100644 (file)
@@ -721,7 +721,7 @@ fn pat_constructors(_cx: &mut MatchCheckCtxt,
 fn constructor_arity(_cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> usize {
     debug!("constructor_arity({:?}, {:?})", ctor, ty);
     match ty.sty {
-        ty::TyTuple(ref fs) => fs.len(),
+        ty::TyTuple(ref fs, _) => fs.len(),
         ty::TySlice(..) | ty::TyArray(..) => match *ctor {
             Slice(length) => length,
             ConstantValue(_) => 0,
@@ -745,7 +745,7 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>,
 {
     debug!("constructor_sub_pattern_tys({:?}, {:?})", ctor, ty);
     match ty.sty {
-        ty::TyTuple(ref fs) => fs.into_iter().map(|t| *t).collect(),
+        ty::TyTuple(ref fs, _) => fs.into_iter().map(|t| *t).collect(),
         ty::TySlice(ty) | ty::TyArray(ty, _) => match *ctor {
             Slice(length) => repeat(ty).take(length).collect(),
             ConstantValue(_) => vec![],
index 0b1f2465a4d5921daee9beced54ea09dde65bd53..6f33b4fad769f20d9e7d06b053a0a014fafbb5c3 100644 (file)
@@ -273,7 +273,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
     let mut seen = Matrix::empty();
     let mut catchall = None;
     let mut printed_if_let_err = false;
-    for &(ref pats, guard) in arms {
+    for (arm_index, &(ref pats, guard)) in arms.iter().enumerate() {
         for &(pat, hir_pat) in pats {
             let v = vec![pat];
 
@@ -302,10 +302,27 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                             let &(ref first_arm_pats, _) = &arms[0];
                             let first_pat = &first_arm_pats[0];
                             let span = first_pat.0.span;
-                            struct_span_err!(cx.tcx.sess, span, E0165,
-                                             "irrefutable while-let pattern")
-                                .span_label(span, &format!("irrefutable pattern"))
-                                .emit();
+
+                            // check which arm we're on.
+                            match arm_index {
+                                // The arm with the user-specified pattern.
+                                0 => {
+                                    let mut diagnostic = Diagnostic::new(Level::Warning,
+                                                                         "unreachable pattern");
+                                    diagnostic.set_span(pat.span);
+                                    cx.tcx.sess.add_lint_diagnostic(
+                                            lint::builtin::UNREACHABLE_PATTERNS,
+                                            hir_pat.id, diagnostic);
+                                },
+                                // The arm with the wildcard pattern.
+                                1 => {
+                                    struct_span_err!(cx.tcx.sess, span, E0165,
+                                                     "irrefutable while-let pattern")
+                                        .span_label(span, &format!("irrefutable pattern"))
+                                        .emit();
+                                },
+                                _ => bug!(),
+                            }
                         },
 
                         hir::MatchSource::ForLoopDesugar |
index a9dcb1ed8961330a9573435ec8382fed4181bddc..af4f63a05613eef94f20438b98343163cf7d0c35 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//#![allow(non_camel_case_types)]
-
 use rustc::middle::const_val::ConstVal::*;
 use rustc::middle::const_val::ConstVal;
 use self::ErrKind::*;
@@ -39,8 +37,6 @@
 use rustc_const_math::*;
 use rustc_errors::DiagnosticBuilder;
 
-use rustc_i128::{i128, u128};
-
 macro_rules! math {
     ($e:expr, $op:expr) => {
         match $op {
@@ -486,12 +482,9 @@ fn eval_const_expr_partial<'a, 'tcx>(cx: &ConstContext<'a, 'tcx>,
                 (&LitKind::Int(I64_OVERFLOW, Signed(IntTy::I64)), _) => {
                     return Ok(Integral(I64(i64::min_value())))
                 },
-                (&LitKind::Int(n, _), Some(&ty::TyInt(IntTy::I128))) |
-                (&LitKind::Int(n, Signed(IntTy::I128)), _) => {
-                    // SNAP: replace n in pattern with I128_OVERFLOW and remove this if.
-                    if n == I128_OVERFLOW {
-                        return Ok(Integral(I128(i128::min_value())))
-                    }
+                (&LitKind::Int(I128_OVERFLOW, _), Some(&ty::TyInt(IntTy::I128))) |
+                (&LitKind::Int(I128_OVERFLOW, Signed(IntTy::I128)), _) => {
+                    return Ok(Integral(I128(i128::min_value())))
                 },
                 (&LitKind::Int(n, _), Some(&ty::TyInt(IntTy::Is))) |
                 (&LitKind::Int(n, Signed(IntTy::Is)), _) => {
index 2b6f487c2c942a47694201937f499d5e68365d0e..198e49daabc63f74422d86778f4dd143ee4f39f9 100644 (file)
@@ -29,6 +29,7 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(const_fn)]
+#![feature(i128_type)]
 
 extern crate arena;
 #[macro_use] extern crate syntax;
@@ -41,8 +42,6 @@
 extern crate graphviz;
 extern crate syntax_pos;
 
-extern crate rustc_i128;
-
 // NB: This module needs to be declared first so diagnostics are
 // registered before they are used.
 pub mod diagnostics;
index c6272613f4d09fd3695222e4523e40dde99e6f37..609fb3e39d62cc8406987ca1ebd8e6fffb3d0e03 100644 (file)
@@ -342,7 +342,7 @@ pub fn lower_pattern(&mut self, pat: &hir::Pat) -> Pattern<'tcx> {
             PatKind::Tuple(ref subpatterns, ddpos) => {
                 let ty = self.tables.node_id_to_type(pat.id);
                 match ty.sty {
-                    ty::TyTuple(ref tys) => {
+                    ty::TyTuple(ref tys, _) => {
                         let subpatterns =
                             subpatterns.iter()
                                        .enumerate_and_adjust(tys.len(), ddpos)
index e6db1557fbe3d8c6ba6814cfaa2981e0e8203aa4..e74c1ef693ce010c568c6db36db8585a4eb59c6c 100644 (file)
@@ -11,4 +11,3 @@ crate-type = ["dylib"]
 [dependencies]
 serialize = { path = "../libserialize" }
 syntax = { path = "../libsyntax" }
-rustc_i128 = { path = "../librustc_i128" }
index 53f185b661b4193873588c6ddbdfa77e772de906..17714f2fb2d6cd3074c460e7b6783cbdf0704ee8 100644 (file)
@@ -11,7 +11,6 @@
 use std::cmp::Ordering;
 use syntax::attr::IntType;
 use syntax::ast::{IntTy, UintTy};
-use rustc_i128::{i128, u128};
 
 use super::is::*;
 use super::us::*;
@@ -54,7 +53,6 @@ macro_rules! bounds {
 
 mod ubounds {
     #![allow(dead_code)]
-    use rustc_i128::{u128, i128};
     bounds!{u128: 0,
         i8 I8MIN I8MAX i16 I16MIN I16MAX i32 I32MIN I32MAX i64 I64MIN I64MAX i128 I128MIN I128MAX
         u8 U8MIN U8MAX u16 U16MIN U16MAX u32 U32MIN U32MAX u64 U64MIN U64MAX u128 U128MIN U128MAX
@@ -65,12 +63,6 @@ mod ubounds {
 
 mod ibounds {
     #![allow(dead_code)]
-    use rustc_i128::i128;
-    #[cfg(stage0)]
-    pub const U64MIN: i128 = 0;
-    #[cfg(stage0)]
-    pub const U64MAX: i128 = i128::max_value();
-    #[cfg(not(stage0))]
     bounds!(i128, u64 U64MIN U64MAX);
 
     pub const U128MIN: i128 = 0;
@@ -163,13 +155,11 @@ pub fn infer(self, other: Self) -> Result<(Self, Self), ConstMathErr> {
             (InferSigned(a @ 0...ibounds::U8MAX), U8(_)) => U8(a as u8),
             (InferSigned(a @ 0...ibounds::U16MAX), U16(_)) => U16(a as u16),
             (InferSigned(a @ 0...ibounds::U32MAX), U32(_)) => U32(a as u32),
-            // SNAP: replace with U64MAX
-            (InferSigned(a @ 0...ibounds::I64MAX), U64(_)) => U64(a as u64),
+            (InferSigned(a @ 0...ibounds::U64MAX), U64(_)) => U64(a as u64),
             (InferSigned(a @ 0...ibounds::I128MAX), U128(_)) => U128(a as u128),
             (InferSigned(a @ 0...ibounds::U16MAX), Usize(Us16(_))) => Usize(Us16(a as u16)),
             (InferSigned(a @ 0...ibounds::U32MAX), Usize(Us32(_))) => Usize(Us32(a as u32)),
-            // SNAP: replace with U64MAX
-            (InferSigned(a @ 0...ibounds::I64MAX), Usize(Us64(_))) => Usize(Us64(a as u64)),
+            (InferSigned(a @ 0...ibounds::U64MAX), Usize(Us64(_))) => Usize(Us64(a as u64)),
             (InferSigned(_), _) => return Err(ConstMathErr::NotInRange),
             _ => self, // already known types
         };
@@ -483,10 +473,7 @@ fn $func(self, rhs: Self) -> Result<Self, ConstMathErr> {
 derive_binop!(BitOr, bitor);
 derive_binop!(BitXor, bitxor);
 
-#[cfg(not(stage0))]
 const I128_MIN: i128 = ::std::i128::MIN;
-#[cfg(stage0)]
-const I128_MIN: i128 = ::std::i64::MIN;
 
 fn check_division(
     lhs: ConstInt,
index 19ae0c91fc5f9b2ddd435178c9abaf0afaef5341..8f28ba14c6aef6b5dac21a4c8e11cdf3449d5013 100644 (file)
@@ -10,7 +10,6 @@
 
 use syntax::ast;
 use super::err::*;
-use rustc_i128::i128;
 
 /// Depending on the target only one variant is ever used in a compilation.
 /// Anything else is an error. This invariant is checked at several locations
index d40a6aa32fd46b9ef7a69c854372d424f05c13e7..13764ce5bbbfd2027f50cda905102dd6abf4b351 100644 (file)
 #![feature(rustc_private)]
 #![feature(staged_api)]
 #![feature(const_fn)]
-#![cfg_attr(not(stage0), feature(i128))]
+#![feature(i128)]
+#![feature(i128_type)]
 
 extern crate syntax;
 
-// SNAP: remove use of this crate
-extern crate rustc_i128;
-
 extern crate serialize as rustc_serialize; // used by deriving
 
 mod float;
index 9ebf5cab6bb06000a18d4125e3fb3942ddc9c365..76443f584abacc370b46f4be96480305c86465e4 100644 (file)
@@ -10,7 +10,6 @@
 
 use syntax::ast;
 use super::err::*;
-use rustc_i128::u128;
 
 /// Depending on the target only one variant is ever used in a compilation.
 /// Anything else is an error. This invariant is checked at several locations
index bb6103748102de1a49d1cd376b8d497039805d18..e2e16059d98718c534335bf277927d4cb35c7853 100644 (file)
@@ -11,4 +11,3 @@ crate-type = ["dylib"]
 [dependencies]
 log = { path = "../liblog" }
 serialize = { path = "../libserialize" }
-rustc_i128 = { path = "../librustc_i128" }
index b003cba292c80b9afb22224b844c820aa1e203df..cf6bf1cf1d4834bb00087658b565b58995f2ce17 100644 (file)
@@ -36,6 +36,7 @@
 #![feature(untagged_unions)]
 #![feature(associated_consts)]
 #![feature(unsize)]
+#![feature(i128_type)]
 
 #![cfg_attr(unix, feature(libc))]
 #![cfg_attr(test, feature(test))]
@@ -47,8 +48,6 @@
 #[cfg(unix)]
 extern crate libc;
 
-extern crate rustc_i128;
-
 pub use rustc_serialize::hex::ToHex;
 
 pub mod array_vec;
index 87048eff5b78b9fcc3af0d37be46da11cc29ab65..231c01c9ab78d8d99b55fccfddd9d29b152de220 100644 (file)
@@ -13,7 +13,6 @@
 use std::mem;
 use blake2b::Blake2bHasher;
 use rustc_serialize::leb128;
-use rustc_i128::{u128,i128};
 
 fn write_unsigned_leb128_to_buf(buf: &mut [u8; 16], value: u64) -> usize {
     leb128::write_unsigned_leb128_to(value as u128, |i, v| buf[i] = v)
index a7188f6da1ff9a9faee6ed93ef7bd1d1f8979e17..33bf4d5276adf23e7f9aa8b0d3204bc8483660a0 100644 (file)
@@ -22,6 +22,7 @@
 use rustc::ty::{self, TyCtxt, Resolutions, GlobalArenas};
 use rustc::util::common::time;
 use rustc::util::nodemap::{NodeSet, NodeMap};
+use rustc::util::fs::rename_or_copy_remove;
 use rustc_borrowck as borrowck;
 use rustc_incremental::{self, IncrementalHashesMap};
 use rustc_incremental::ich::Fingerprint;
@@ -741,15 +742,15 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
          "checking for inline asm in case the target doesn't support it",
          || no_asm::check_crate(sess, &krate));
 
-    time(sess.time_passes(),
+    time(time_passes,
          "early lint checks",
          || lint::check_ast_crate(sess, &krate));
 
-    time(sess.time_passes(),
+    time(time_passes,
          "AST validation",
          || ast_validation::check_crate(sess, &krate));
 
-    time(sess.time_passes(), "name resolution", || -> CompileResult {
+    time(time_passes, "name resolution", || -> CompileResult {
         // Since import resolution will eventually happen in expansion,
         // don't perform `after_expand` until after import resolution.
         after_expand(&krate)?;
@@ -770,7 +771,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
     })?;
 
     // Lower ast -> hir.
-    let hir_forest = time(sess.time_passes(), "lowering ast -> hir", || {
+    let hir_forest = time(time_passes, "lowering ast -> hir", || {
         let hir_crate = lower_crate(sess, &krate, &mut resolver);
 
         if sess.opts.debugging_opts.hir_stats {
@@ -780,7 +781,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
         hir_map::Forest::new(hir_crate, &sess.dep_graph)
     });
 
-    // Discard hygiene data, which isn't required past lowering to HIR.
+    // Discard hygiene data, which isn't required after lowering to HIR.
     if !keep_hygiene_data(sess) {
         syntax::ext::hygiene::reset_hygiene_data();
     }
@@ -1084,10 +1085,9 @@ pub fn phase_5_run_llvm_passes(sess: &Session,
         // are going to build an executable
         if sess.opts.output_types.contains_key(&OutputType::Exe) {
             let f = outputs.path(OutputType::Object);
-            fs::copy(&f,
+            rename_or_copy_remove(&f,
                      f.with_file_name(format!("{}.0.o",
                                               f.file_stem().unwrap().to_string_lossy()))).unwrap();
-            fs::remove_file(f).unwrap();
         }
 
         // Remove assembly source, unless --save-temps was specified
index 1086d75f02cb4055c030b85c0077eb55fb349804..5481de1811d78b91b411b6b470b288bec54dc154 100644 (file)
@@ -280,7 +280,7 @@ pub fn t_nil(&self) -> Ty<'tcx> {
     }
 
     pub fn t_pair(&self, ty1: Ty<'tcx>, ty2: Ty<'tcx>) -> Ty<'tcx> {
-        self.infcx.tcx.intern_tup(&[ty1, ty2])
+        self.infcx.tcx.intern_tup(&[ty1, ty2], false)
     }
 
     pub fn t_param(&self, index: u32) -> Ty<'tcx> {
@@ -803,8 +803,8 @@ fn walk_ty() {
         let tcx = env.infcx.tcx;
         let int_ty = tcx.types.isize;
         let uint_ty = tcx.types.usize;
-        let tup1_ty = tcx.intern_tup(&[int_ty, uint_ty, int_ty, uint_ty]);
-        let tup2_ty = tcx.intern_tup(&[tup1_ty, tup1_ty, uint_ty]);
+        let tup1_ty = tcx.intern_tup(&[int_ty, uint_ty, int_ty, uint_ty], false);
+        let tup2_ty = tcx.intern_tup(&[tup1_ty, tup1_ty, uint_ty], false);
         let walked: Vec<_> = tup2_ty.walk().collect();
         assert_eq!(walked,
                    [tup2_ty, tup1_ty, int_ty, uint_ty, int_ty, uint_ty, tup1_ty, int_ty,
@@ -818,8 +818,8 @@ fn walk_ty_skip_subtree() {
         let tcx = env.infcx.tcx;
         let int_ty = tcx.types.isize;
         let uint_ty = tcx.types.usize;
-        let tup1_ty = tcx.intern_tup(&[int_ty, uint_ty, int_ty, uint_ty]);
-        let tup2_ty = tcx.intern_tup(&[tup1_ty, tup1_ty, uint_ty]);
+        let tup1_ty = tcx.intern_tup(&[int_ty, uint_ty, int_ty, uint_ty], false);
+        let tup2_ty = tcx.intern_tup(&[tup1_ty, tup1_ty, uint_ty], false);
 
         // types we expect to see (in order), plus a boolean saying
         // whether to skip the subtree.
index 2ba1f501a63d800a9b659b33353480e515568bf4..78ff52b4b2371491c5cbf566293a52c588957e01 100644 (file)
@@ -9,4 +9,5 @@ path = "lib.rs"
 crate-type = ["dylib"]
 
 [dependencies]
+serialize = { path = "../libserialize" }
 syntax_pos = { path = "../libsyntax_pos" }
index ac39af2018998dfeeda3a9fe457242daaccb5557..1b77ead92deb6a4084d6539c7658fa8678af9cbd 100644 (file)
@@ -17,7 +17,7 @@
 use snippet::Style;
 
 #[must_use]
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)]
 pub struct Diagnostic {
     pub level: Level,
     pub message: Vec<(String, Style)>,
@@ -27,7 +27,7 @@ pub struct Diagnostic {
 }
 
 /// For example a note attached to an error.
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)]
 pub struct SubDiagnostic {
     pub level: Level,
     pub message: Vec<(String, Style)>,
index bf5f7cde7eb06b9ac56eaa1119838ecc5f6afbd2..d7bd5ed23c2b0af883ce9687447d15d233f63755 100644 (file)
@@ -26,6 +26,7 @@
 
 extern crate term;
 extern crate libc;
+extern crate serialize as rustc_serialize;
 extern crate syntax_pos;
 
 pub use emitter::ColorConfig;
@@ -49,7 +50,7 @@
 use syntax_pos::{BytePos, Loc, FileLinesResult, FileName, MultiSpan, Span, NO_EXPANSION};
 use syntax_pos::MacroBacktrace;
 
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)]
 pub enum RenderSpan {
     /// A FullSpan renders with both with an initial line for the
     /// message, prefixed by file:linenum, followed by a summary of
@@ -63,7 +64,7 @@ pub enum RenderSpan {
     Suggestion(CodeSuggestion),
 }
 
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)]
 pub struct CodeSuggestion {
     pub msp: MultiSpan,
     pub substitutes: Vec<String>,
@@ -477,7 +478,7 @@ pub fn emit_with_code(&self, msp: &MultiSpan, msg: &str, code: &str, lvl: Level)
 }
 
 
-#[derive(Copy, PartialEq, Clone, Debug)]
+#[derive(Copy, PartialEq, Clone, Debug, RustcEncodable, RustcDecodable)]
 pub enum Level {
     Bug,
     Fatal,
index 95b03677b72857b9ee6df5ddbe7a0736a83d1333..5debbf4d37c20286fab1be9ed9b763888c84327f 100644 (file)
@@ -204,7 +204,7 @@ pub struct StyledString {
     pub style: Style,
 }
 
-#[derive(Copy, Clone, Debug, PartialEq)]
+#[derive(Copy, Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)]
 pub enum Style {
     HeaderMsg,
     FileNameStyle,
diff --git a/src/librustc_i128/Cargo.toml b/src/librustc_i128/Cargo.toml
deleted file mode 100644 (file)
index 6fd6763..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-[package]
-authors = ["The Rust Project Developers"]
-name = "rustc_i128"
-version = "0.0.0"
-
-[lib]
-name = "rustc_i128"
-path = "lib.rs"
diff --git a/src/librustc_i128/lib.rs b/src/librustc_i128/lib.rs
deleted file mode 100644 (file)
index 80f550c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-#![allow(non_camel_case_types)]
-#![cfg_attr(not(stage0), feature(i128_type))]
-#![no_std]
-#![crate_type="rlib"]
-#![crate_name="rustc_i128"]
-
-#[cfg(stage0)]
-pub type i128 = i64;
-#[cfg(stage0)]
-pub type u128 = u64;
-
-#[cfg(not(stage0))]
-pub type i128 = int::_i128;
-#[cfg(not(stage0))]
-pub type u128 = int::_u128;
-#[cfg(not(stage0))]
-mod int {
-    pub type _i128 = i128;
-    pub type _u128 = u128;
-}
index a866a15c4d280e8842afadf7a977c4c1bc6f7afa..e3c339829f6a4f64cf0de3557601fe0682fd66ed 100644 (file)
@@ -23,6 +23,9 @@
 #![feature(staged_api)]
 #![feature(rand)]
 #![feature(core_intrinsics)]
+#![feature(conservative_impl_trait)]
+#![feature(field_init_shorthand)]
+#![feature(pub_restricted)]
 
 extern crate graphviz;
 #[macro_use] extern crate rustc;
index f0e4f4f99ef08e2977bbf069262e598db9d8bb8a..60f24b71de2452eb3660dfcb9f743153837d6e7f 100644 (file)
@@ -21,7 +21,7 @@
 /// Data for use when recompiling the **current crate**.
 #[derive(Debug, RustcEncodable, RustcDecodable)]
 pub struct SerializedDepGraph {
-    pub edges: Vec<SerializedEdge>,
+    pub edges: Vec<SerializedEdgeSet>,
 
     /// These are hashes of two things:
     /// - the HIR nodes in this crate
@@ -45,14 +45,13 @@ pub struct SerializedDepGraph {
     pub hashes: Vec<SerializedHash>,
 }
 
-/// Represents a "reduced" dependency edge. Unlike the full dep-graph,
-/// the dep-graph we serialize contains only edges `S -> T` where the
-/// source `S` is something hashable (a HIR node or foreign metadata)
-/// and the target `T` is something significant, like a work-product.
-/// Normally, significant nodes are only those that have saved data on
-/// disk, but in unit-testing the set of significant nodes can be
-/// increased.
-pub type SerializedEdge = (DepNode<DefPathIndex>, DepNode<DefPathIndex>);
+/// Represents a set of "reduced" dependency edge. We group the
+/// outgoing edges from a single source together.
+#[derive(Debug, RustcEncodable, RustcDecodable)]
+pub struct SerializedEdgeSet {
+    pub source: DepNode<DefPathIndex>,
+    pub targets: Vec<DepNode<DefPathIndex>>
+}
 
 #[derive(Debug, RustcEncodable, RustcDecodable)]
 pub struct SerializedHash {
index 6e66dac6470f03df93ecd83f54b492be4d72742c..a0bcb54af320fa1a1728ff893ca11ee5a4205e6a 100644 (file)
@@ -46,6 +46,7 @@
 use rustc::hir;
 use rustc::hir::def_id::DefId;
 use rustc::hir::itemlikevisit::ItemLikeVisitor;
+use rustc::hir::intravisit;
 use syntax::ast::{self, Attribute, NestedMetaItem};
 use rustc_data_structures::fx::{FxHashSet, FxHashMap};
 use syntax_pos::Span;
@@ -67,23 +68,38 @@ pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
     let _ignore = tcx.dep_graph.in_ignore();
     let dirty_inputs: FxHashSet<DepNode<DefId>> =
-        dirty_inputs.iter()
-                   .filter_map(|d| retraced.map(d))
-                   .collect();
+        dirty_inputs.keys()
+                    .filter_map(|d| retraced.map(d))
+                    .collect();
     let query = tcx.dep_graph.query();
     debug!("query-nodes: {:?}", query.nodes());
     let krate = tcx.hir.krate();
-    krate.visit_all_item_likes(&mut DirtyCleanVisitor {
+    let mut dirty_clean_visitor = DirtyCleanVisitor {
         tcx: tcx,
         query: &query,
         dirty_inputs: dirty_inputs,
-    });
+        checked_attrs: FxHashSet(),
+    };
+    krate.visit_all_item_likes(&mut dirty_clean_visitor);
+
+    let mut all_attrs = FindAllAttrs {
+        tcx: tcx,
+        attr_names: vec![ATTR_DIRTY, ATTR_CLEAN],
+        found_attrs: vec![],
+    };
+    intravisit::walk_crate(&mut all_attrs, krate);
+
+    // Note that we cannot use the existing "unused attribute"-infrastructure
+    // here, since that is running before trans. This is also the reason why
+    // all trans-specific attributes are `Whitelisted` in syntax::feature_gate.
+    all_attrs.report_unchecked_attrs(&dirty_clean_visitor.checked_attrs);
 }
 
 pub struct DirtyCleanVisitor<'a, 'tcx:'a> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     query: &'a DepGraphQuery<DefId>,
     dirty_inputs: FxHashSet<DepNode<DefId>>,
+    checked_attrs: FxHashSet<ast::AttrId>,
 }
 
 impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> {
@@ -109,7 +125,7 @@ fn dep_node_str(&self, dep_node: &DepNode<DefId>) -> DepNode<String> {
         dep_node.map_def(|&def_id| Some(self.tcx.item_path_str(def_id))).unwrap()
     }
 
-    fn assert_dirty(&self, item: &hir::Item, dep_node: DepNode<DefId>) {
+    fn assert_dirty(&self, item_span: Span, dep_node: DepNode<DefId>) {
         debug!("assert_dirty({:?})", dep_node);
 
         match dep_node {
@@ -121,7 +137,7 @@ fn assert_dirty(&self, item: &hir::Item, dep_node: DepNode<DefId>) {
                 if !self.dirty_inputs.contains(&dep_node) {
                     let dep_node_str = self.dep_node_str(&dep_node);
                     self.tcx.sess.span_err(
-                        item.span,
+                        item_span,
                         &format!("`{:?}` not found in dirty set, but should be dirty",
                                  dep_node_str));
                 }
@@ -132,14 +148,14 @@ fn assert_dirty(&self, item: &hir::Item, dep_node: DepNode<DefId>) {
                 if self.query.contains_node(&dep_node) {
                     let dep_node_str = self.dep_node_str(&dep_node);
                     self.tcx.sess.span_err(
-                        item.span,
+                        item_span,
                         &format!("`{:?}` found in dep graph, but should be dirty", dep_node_str));
                 }
             }
         }
     }
 
-    fn assert_clean(&self, item: &hir::Item, dep_node: DepNode<DefId>) {
+    fn assert_clean(&self, item_span: Span, dep_node: DepNode<DefId>) {
         debug!("assert_clean({:?})", dep_node);
 
         match dep_node {
@@ -150,7 +166,7 @@ fn assert_clean(&self, item: &hir::Item, dep_node: DepNode<DefId>) {
                 if self.dirty_inputs.contains(&dep_node) {
                     let dep_node_str = self.dep_node_str(&dep_node);
                     self.tcx.sess.span_err(
-                        item.span,
+                        item_span,
                         &format!("`{:?}` found in dirty-node set, but should be clean",
                                  dep_node_str));
                 }
@@ -160,35 +176,43 @@ fn assert_clean(&self, item: &hir::Item, dep_node: DepNode<DefId>) {
                 if !self.query.contains_node(&dep_node) {
                     let dep_node_str = self.dep_node_str(&dep_node);
                     self.tcx.sess.span_err(
-                        item.span,
+                        item_span,
                         &format!("`{:?}` not found in dep graph, but should be clean",
                                  dep_node_str));
                 }
             }
         }
     }
-}
 
-impl<'a, 'tcx> ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'a, 'tcx> {
-    fn visit_item(&mut self, item: &'tcx hir::Item) {
-        let def_id = self.tcx.hir.local_def_id(item.id);
+    fn check_item(&mut self, item_id: ast::NodeId, item_span: Span) {
+        let def_id = self.tcx.hir.local_def_id(item_id);
         for attr in self.tcx.get_attrs(def_id).iter() {
             if attr.check_name(ATTR_DIRTY) {
                 if check_config(self.tcx, attr) {
-                    self.assert_dirty(item, self.dep_node(attr, def_id));
+                    self.checked_attrs.insert(attr.id);
+                    self.assert_dirty(item_span, self.dep_node(attr, def_id));
                 }
             } else if attr.check_name(ATTR_CLEAN) {
                 if check_config(self.tcx, attr) {
-                    self.assert_clean(item, self.dep_node(attr, def_id));
+                    self.checked_attrs.insert(attr.id);
+                    self.assert_clean(item_span, self.dep_node(attr, def_id));
                 }
             }
         }
     }
+}
+
+impl<'a, 'tcx> ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'a, 'tcx> {
+    fn visit_item(&mut self, item: &'tcx hir::Item) {
+        self.check_item(item.id, item.span);
+    }
 
-    fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem) {
+    fn visit_trait_item(&mut self, item: &hir::TraitItem) {
+        self.check_item(item.id, item.span);
     }
 
-    fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) {
+    fn visit_impl_item(&mut self, item: &hir::ImplItem) {
+        self.check_item(item.id, item.span);
     }
 }
 
@@ -201,11 +225,25 @@ pub fn check_dirty_clean_metadata<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
     tcx.dep_graph.with_ignore(||{
         let krate = tcx.hir.krate();
-        krate.visit_all_item_likes(&mut DirtyCleanMetadataVisitor {
+        let mut dirty_clean_visitor = DirtyCleanMetadataVisitor {
             tcx: tcx,
             prev_metadata_hashes: prev_metadata_hashes,
             current_metadata_hashes: current_metadata_hashes,
-        });
+            checked_attrs: FxHashSet(),
+        };
+        krate.visit_all_item_likes(&mut dirty_clean_visitor);
+
+        let mut all_attrs = FindAllAttrs {
+            tcx: tcx,
+            attr_names: vec![ATTR_DIRTY_METADATA, ATTR_CLEAN_METADATA],
+            found_attrs: vec![],
+        };
+        intravisit::walk_crate(&mut all_attrs, krate);
+
+        // Note that we cannot use the existing "unused attribute"-infrastructure
+        // here, since that is running before trans. This is also the reason why
+        // all trans-specific attributes are `Whitelisted` in syntax::feature_gate.
+        all_attrs.report_unchecked_attrs(&dirty_clean_visitor.checked_attrs);
     });
 }
 
@@ -213,34 +251,43 @@ pub struct DirtyCleanMetadataVisitor<'a, 'tcx:'a, 'm> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     prev_metadata_hashes: &'m FxHashMap<DefId, Fingerprint>,
     current_metadata_hashes: &'m FxHashMap<DefId, Fingerprint>,
+    checked_attrs: FxHashSet<ast::AttrId>,
 }
 
 impl<'a, 'tcx, 'm> ItemLikeVisitor<'tcx> for DirtyCleanMetadataVisitor<'a, 'tcx, 'm> {
     fn visit_item(&mut self, item: &'tcx hir::Item) {
-        let def_id = self.tcx.hir.local_def_id(item.id);
+        self.check_item(item.id, item.span);
+    }
+
+    fn visit_trait_item(&mut self, item: &hir::TraitItem) {
+        self.check_item(item.id, item.span);
+    }
+
+    fn visit_impl_item(&mut self, item: &hir::ImplItem) {
+        self.check_item(item.id, item.span);
+    }
+}
+
+impl<'a, 'tcx, 'm> DirtyCleanMetadataVisitor<'a, 'tcx, 'm> {
+
+    fn check_item(&mut self, item_id: ast::NodeId, item_span: Span) {
+        let def_id = self.tcx.hir.local_def_id(item_id);
 
         for attr in self.tcx.get_attrs(def_id).iter() {
             if attr.check_name(ATTR_DIRTY_METADATA) {
                 if check_config(self.tcx, attr) {
-                    self.assert_state(false, def_id, item.span);
+                    self.checked_attrs.insert(attr.id);
+                    self.assert_state(false, def_id, item_span);
                 }
             } else if attr.check_name(ATTR_CLEAN_METADATA) {
                 if check_config(self.tcx, attr) {
-                    self.assert_state(true, def_id, item.span);
+                    self.checked_attrs.insert(attr.id);
+                    self.assert_state(true, def_id, item_span);
                 }
             }
         }
     }
 
-    fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem) {
-    }
-
-    fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) {
-    }
-}
-
-impl<'a, 'tcx, 'm> DirtyCleanMetadataVisitor<'a, 'tcx, 'm> {
-
     fn assert_state(&self, should_be_clean: bool, def_id: DefId, span: Span) {
         let item_path = self.tcx.item_path_str(def_id);
         debug!("assert_state({})", item_path);
@@ -274,7 +321,7 @@ fn assert_state(&self, should_be_clean: bool, def_id: DefId, span: Span) {
 /// Given a `#[rustc_dirty]` or `#[rustc_clean]` attribute, scan
 /// for a `cfg="foo"` attribute and check whether we have a cfg
 /// flag called `foo`.
-fn check_config(tcx: TyCtxt, attr: &ast::Attribute) -> bool {
+fn check_config(tcx: TyCtxt, attr: &Attribute) -> bool {
     debug!("check_config(attr={:?})", attr);
     let config = &tcx.sess.parse_sess.config;
     debug!("check_config: config={:?}", config);
@@ -304,3 +351,47 @@ fn expect_associated_value(tcx: TyCtxt, item: &NestedMetaItem) -> ast::Name {
         tcx.sess.span_fatal(item.span, &msg);
     }
 }
+
+
+// A visitor that collects all #[rustc_dirty]/#[rustc_clean] attributes from
+// the HIR. It is used to verfiy that we really ran checks for all annotated
+// nodes.
+pub struct FindAllAttrs<'a, 'tcx:'a> {
+    tcx: TyCtxt<'a, 'tcx, 'tcx>,
+    attr_names: Vec<&'static str>,
+    found_attrs: Vec<&'tcx Attribute>,
+}
+
+impl<'a, 'tcx> FindAllAttrs<'a, 'tcx> {
+
+    fn is_active_attr(&mut self, attr: &Attribute) -> bool {
+        for attr_name in &self.attr_names {
+            if attr.check_name(attr_name) && check_config(self.tcx, attr) {
+                return true;
+            }
+        }
+
+        false
+    }
+
+    fn report_unchecked_attrs(&self, checked_attrs: &FxHashSet<ast::AttrId>) {
+        for attr in &self.found_attrs {
+            if !checked_attrs.contains(&attr.id) {
+                self.tcx.sess.span_err(attr.span, &format!("found unchecked \
+                    #[rustc_dirty]/#[rustc_clean] attribute"));
+            }
+        }
+    }
+}
+
+impl<'a, 'tcx> intravisit::Visitor<'tcx> for FindAllAttrs<'a, 'tcx> {
+    fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> {
+        intravisit::NestedVisitorMap::All(&self.tcx.hir)
+    }
+
+    fn visit_attribute(&mut self, attr: &'tcx Attribute) {
+        if self.is_active_attr(attr) {
+            self.found_attrs.push(attr);
+        }
+    }
+}
index 433110a2a6de04d58d582dbe5f28af2964c53f36..b371ab6aa31bc1ac05080e4e52f4fb6c0758df1e 100644 (file)
@@ -10,7 +10,7 @@
 
 //! Code to save/load the dep-graph from files.
 
-use rustc::dep_graph::DepNode;
+use rustc::dep_graph::{DepNode, WorkProductId};
 use rustc::hir::def_id::DefId;
 use rustc::hir::svh::Svh;
 use rustc::session::Session;
@@ -19,6 +19,7 @@
 use rustc_serialize::Decodable as RustcDecodable;
 use rustc_serialize::opaque::Decoder;
 use std::path::{Path};
+use std::sync::Arc;
 
 use IncrementalHashesMap;
 use ich::Fingerprint;
@@ -30,7 +31,9 @@
 use super::file_format;
 use super::work_product;
 
-pub type DirtyNodes = FxHashSet<DepNode<DefPathIndex>>;
+// The key is a dirty node. The value is **some** base-input that we
+// can blame it on.
+pub type DirtyNodes = FxHashMap<DepNode<DefPathIndex>, DepNode<DefPathIndex>>;
 
 /// If we are in incremental mode, and a previous dep-graph exists,
 /// then load up those nodes/edges that are still valid into the
@@ -149,86 +152,75 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     let directory = DefIdDirectory::decode(&mut dep_graph_decoder)?;
     let serialized_dep_graph = SerializedDepGraph::decode(&mut dep_graph_decoder)?;
 
+    let edge_map: FxHashMap<_, _> = serialized_dep_graph.edges
+                                                        .into_iter()
+                                                        .map(|s| (s.source, s.targets))
+                                                        .collect();
+
     // Retrace the paths in the directory to find their current location (if any).
     let retraced = directory.retrace(tcx);
 
-    // Compute the set of Hir nodes whose data has changed or which
-    // have been removed.  These are "raw" source nodes, which means
-    // that they still use the original `DefPathIndex` values from the
-    // encoding, rather than having been retraced to a `DefId`. The
-    // reason for this is that this way we can include nodes that have
-    // been removed (which no longer have a `DefId` in the current
-    // compilation).
-    let dirty_raw_source_nodes = dirty_nodes(tcx,
-                                             incremental_hashes_map,
-                                             &serialized_dep_graph.hashes,
-                                             &retraced);
-
-    // Create a list of (raw-source-node ->
-    // retracted-target-node) edges. In the process of retracing the
-    // target nodes, we may discover some of them def-paths no longer exist,
-    // in which case there is no need to mark the corresopnding nodes as dirty
-    // (they are just not present). So this list may be smaller than the original.
-    //
-    // Note though that in the common case the target nodes are
-    // `DepNode::WorkProduct` instances, and those don't have a
-    // def-id, so they will never be considered to not exist. Instead,
-    // we do a secondary hashing step (later, in trans) when we know
-    // the set of symbols that go into a work-product: if any symbols
-    // have been removed (or added) the hash will be different and
-    // we'll ignore the work-product then.
-    let retraced_edges: Vec<_> =
-        serialized_dep_graph.edges.iter()
-                                  .filter_map(|&(ref raw_source_node, ref raw_target_node)| {
-                                      retraced.map(raw_target_node)
-                                              .map(|target_node| (raw_source_node, target_node))
-                                  })
-                                  .collect();
-
-    // Compute which work-products have an input that has changed or
-    // been removed. Put the dirty ones into a set.
-    let mut dirty_target_nodes = FxHashSet();
-    for &(raw_source_node, ref target_node) in &retraced_edges {
-        if dirty_raw_source_nodes.contains(raw_source_node) {
-            if !dirty_target_nodes.contains(target_node) {
-                dirty_target_nodes.insert(target_node.clone());
-
-                if tcx.sess.opts.debugging_opts.incremental_info {
-                    // It'd be nice to pretty-print these paths better than just
-                    // using the `Debug` impls, but wev.
-                    println!("incremental: module {:?} is dirty because {:?} \
-                              changed or was removed",
-                             target_node,
-                             raw_source_node.map_def(|&index| {
-                                 Some(directory.def_path_string(tcx, index))
-                             }).unwrap());
+    // Compute the set of nodes from the old graph where some input
+    // has changed or been removed. These are "raw" source nodes,
+    // which means that they still use the original `DefPathIndex`
+    // values from the encoding, rather than having been retraced to a
+    // `DefId`. The reason for this is that this way we can include
+    // nodes that have been removed (which no longer have a `DefId` in
+    // the current compilation).
+    let dirty_raw_nodes = initial_dirty_nodes(tcx,
+                                              incremental_hashes_map,
+                                              &serialized_dep_graph.hashes,
+                                              &retraced);
+    let dirty_raw_nodes = transitive_dirty_nodes(&edge_map, dirty_raw_nodes);
+
+    // Recreate the edges in the graph that are still clean.
+    let mut clean_work_products = FxHashSet();
+    let mut dirty_work_products = FxHashSet(); // incomplete; just used to suppress debug output
+    for (source, targets) in &edge_map {
+        for target in targets {
+            // If the target is dirty, skip the edge. If this is an edge
+            // that targets a work-product, we can print the blame
+            // information now.
+            if let Some(blame) = dirty_raw_nodes.get(target) {
+                if let DepNode::WorkProduct(ref wp) = *target {
+                    if tcx.sess.opts.debugging_opts.incremental_info {
+                        if dirty_work_products.insert(wp.clone()) {
+                            // It'd be nice to pretty-print these paths better than just
+                            // using the `Debug` impls, but wev.
+                            println!("incremental: module {:?} is dirty because {:?} \
+                                      changed or was removed",
+                                     wp,
+                                     blame.map_def(|&index| {
+                                         Some(directory.def_path_string(tcx, index))
+                                     }).unwrap());
+                        }
+                    }
                 }
+                continue;
             }
-        }
-    }
 
-    // For work-products that are still clean, add their deps into the
-    // graph. This is needed because later we will have to save this
-    // back out again!
-    let dep_graph = tcx.dep_graph.clone();
-    for (raw_source_node, target_node) in retraced_edges {
-        if dirty_target_nodes.contains(&target_node) {
-            continue;
+            // If the source is dirty, the target will be dirty.
+            assert!(!dirty_raw_nodes.contains_key(source));
+
+            // Retrace the source -> target edges to def-ids and then
+            // create an edge in the graph. Retracing may yield none if
+            // some of the data happens to have been removed; this ought
+            // to be impossible unless it is dirty, so we can unwrap.
+            let source_node = retraced.map(source).unwrap();
+            let target_node = retraced.map(target).unwrap();
+            let _task = tcx.dep_graph.in_task(target_node);
+            tcx.dep_graph.read(source_node);
+            if let DepNode::WorkProduct(ref wp) = *target {
+                clean_work_products.insert(wp.clone());
+            }
         }
-
-        let source_node = retraced.map(raw_source_node).unwrap();
-
-        debug!("decode_dep_graph: clean edge: {:?} -> {:?}", source_node, target_node);
-
-        let _task = dep_graph.in_task(target_node);
-        dep_graph.read(source_node);
     }
 
     // Add in work-products that are still clean, and delete those that are
     // dirty.
-    reconcile_work_products(tcx, work_products, &dirty_target_nodes);
+    reconcile_work_products(tcx, work_products, &clean_work_products);
 
-    dirty_clean::check_dirty_clean_annotations(tcx, &dirty_raw_source_nodes, &retraced);
+    dirty_clean::check_dirty_clean_annotations(tcx, &dirty_raw_nodes, &retraced);
 
     load_prev_metadata_hashes(tcx,
                               &retraced,
@@ -238,13 +230,13 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
 /// Computes which of the original set of def-ids are dirty. Stored in
 /// a bit vector where the index is the DefPathIndex.
-fn dirty_nodes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                         incremental_hashes_map: &IncrementalHashesMap,
-                         serialized_hashes: &[SerializedHash],
-                         retraced: &RetracedDefIdDirectory)
-                         -> DirtyNodes {
+fn initial_dirty_nodes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                                 incremental_hashes_map: &IncrementalHashesMap,
+                                 serialized_hashes: &[SerializedHash],
+                                 retraced: &RetracedDefIdDirectory)
+                                 -> DirtyNodes {
     let mut hcx = HashContext::new(tcx, incremental_hashes_map);
-    let mut dirty_nodes = FxHashSet();
+    let mut dirty_nodes = FxHashMap();
 
     for hash in serialized_hashes {
         if let Some(dep_node) = retraced.map(&hash.dep_node) {
@@ -277,21 +269,44 @@ fn dirty_nodes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                    hash.dep_node);
         }
 
-        dirty_nodes.insert(hash.dep_node.clone());
+        dirty_nodes.insert(hash.dep_node.clone(), hash.dep_node.clone());
     }
 
     dirty_nodes
 }
 
+fn transitive_dirty_nodes(edge_map: &FxHashMap<DepNode<DefPathIndex>, Vec<DepNode<DefPathIndex>>>,
+                          mut dirty_nodes: DirtyNodes)
+                          -> DirtyNodes
+{
+    let mut stack: Vec<(DepNode<DefPathIndex>, DepNode<DefPathIndex>)> = vec![];
+    stack.extend(dirty_nodes.iter().map(|(s, b)| (s.clone(), b.clone())));
+    while let Some((source, blame)) = stack.pop() {
+        // we know the source is dirty (because of the node `blame`)...
+        assert!(dirty_nodes.contains_key(&source));
+
+        // ...so we dirty all the targets (with the same blame)
+        if let Some(targets) = edge_map.get(&source) {
+            for target in targets {
+                if !dirty_nodes.contains_key(target) {
+                    dirty_nodes.insert(target.clone(), blame.clone());
+                    stack.push((target.clone(), blame.clone()));
+                }
+            }
+        }
+    }
+    dirty_nodes
+}
+
 /// Go through the list of work-products produced in the previous run.
 /// Delete any whose nodes have been found to be dirty or which are
 /// otherwise no longer applicable.
 fn reconcile_work_products<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                      work_products: Vec<SerializedWorkProduct>,
-                                     dirty_target_nodes: &FxHashSet<DepNode<DefId>>) {
+                                     clean_work_products: &FxHashSet<Arc<WorkProductId>>) {
     debug!("reconcile_work_products({:?})", work_products);
     for swp in work_products {
-        if dirty_target_nodes.contains(&DepNode::WorkProduct(swp.id.clone())) {
+        if !clean_work_products.contains(&swp.id) {
             debug!("reconcile_work_products: dep-node for {:?} is dirty", swp);
             delete_dirty_work_product(tcx, swp);
         } else {
diff --git a/src/librustc_incremental/persist/preds.rs b/src/librustc_incremental/persist/preds.rs
deleted file mode 100644 (file)
index 3daeacf..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use rustc::dep_graph::{DepGraphQuery, DepNode};
-use rustc::hir::def_id::DefId;
-use rustc_data_structures::fx::FxHashMap;
-use rustc_data_structures::bitvec::BitVector;
-use rustc_data_structures::graph::{NodeIndex, Graph};
-
-use super::hash::*;
-use ich::Fingerprint;
-
-/// A data-structure that makes it easy to enumerate the hashable
-/// predecessors of any given dep-node.
-pub struct Predecessors<'query> {
-    // - Keys: dep-nodes that may have work-products, output meta-data
-    //   nodes.
-    // - Values: transitive predecessors of the key that are hashable
-    //   (e.g., HIR nodes, input meta-data nodes)
-    pub inputs: FxHashMap<&'query DepNode<DefId>, Vec<&'query DepNode<DefId>>>,
-
-    // - Keys: some hashable node
-    // - Values: the hash thereof
-    pub hashes: FxHashMap<&'query DepNode<DefId>, Fingerprint>,
-}
-
-impl<'q> Predecessors<'q> {
-    pub fn new(query: &'q DepGraphQuery<DefId>, hcx: &mut HashContext) -> Self {
-        let tcx = hcx.tcx;
-
-        let collect_for_metadata = tcx.sess.opts.debugging_opts.incremental_cc ||
-                                   tcx.sess.opts.debugging_opts.query_dep_graph;
-
-        // Find nodes for which we want to know the full set of preds
-        let node_count = query.graph.len_nodes();
-
-        // Set up some data structures the cache predecessor search needs:
-        let mut visit_counts: Vec<u32> = Vec::new();
-        let mut node_cache: Vec<Option<Box<[u32]>>> = Vec::new();
-        visit_counts.resize(node_count, 0);
-        node_cache.resize(node_count, None);
-        let mut dfs_workspace1 = DfsWorkspace::new(node_count);
-        let mut dfs_workspace2 = DfsWorkspace::new(node_count);
-
-        let inputs: FxHashMap<_, _> = query
-            .graph
-            .all_nodes()
-            .iter()
-            .enumerate()
-            .filter(|&(_, node)| match node.data {
-                DepNode::WorkProduct(_) => true,
-                DepNode::MetaData(ref def_id) => collect_for_metadata && def_id.is_local(),
-
-                // if -Z query-dep-graph is passed, save more extended data
-                // to enable better unit testing
-                DepNode::TypeckTables(_) |
-                DepNode::TransCrateItem(_) => tcx.sess.opts.debugging_opts.query_dep_graph,
-
-                _ => false,
-            })
-            .map(|(node_index, node)| {
-                find_roots(&query.graph,
-                           node_index as u32,
-                           &mut visit_counts,
-                           &mut node_cache[..],
-                           HashContext::is_hashable,
-                           &mut dfs_workspace1,
-                           Some(&mut dfs_workspace2));
-
-                let inputs: Vec<_> = dfs_workspace1.output.nodes.iter().map(|&i| {
-                    query.graph.node_data(NodeIndex(i as usize))
-                }).collect();
-
-                (&node.data, inputs)
-            })
-            .collect();
-
-        let mut hashes = FxHashMap();
-        for input in inputs.values().flat_map(|v| v.iter().cloned()) {
-            hashes.entry(input)
-                  .or_insert_with(|| hcx.hash(input).unwrap());
-        }
-
-        Predecessors {
-            inputs: inputs,
-            hashes: hashes,
-        }
-    }
-}
-
-const CACHING_THRESHOLD: u32 = 60;
-
-// Starting at `start_node`, this function finds this node's "roots", that is,
-// anything that is hashable, in the dep-graph. It uses a simple depth-first
-// search to achieve that. However, since some sub-graphs are traversed over
-// and over again, the function also some caching built into it: Each time it
-// visits a node it increases a counter for that node. If a node has been
-// visited more often than CACHING_THRESHOLD, the function will allocate a
-// cache entry in the `cache` array. This cache entry contains a flat list of
-// all roots reachable from the given node. The next time the node is visited,
-// the search can just add the contents of this array to the output instead of
-// recursing further.
-//
-// The function takes two `DfsWorkspace` arguments. These contains some data
-// structures that would be expensive to re-allocate all the time, so they are
-// allocated once up-front. There are two of them because building a cache entry
-// requires a recursive invocation of this function. Two are enough though,
-// since function never recurses more than once.
-fn find_roots<T, F>(graph: &Graph<T, ()>,
-                    start_node: u32,
-                    visit_counts: &mut [u32],
-                    cache: &mut [Option<Box<[u32]>>],
-                    is_root: F,
-                    workspace: &mut DfsWorkspace,
-                    mut sub_workspace: Option<&mut DfsWorkspace>)
-    where F: Copy + Fn(&T) -> bool,
-          T: ::std::fmt::Debug,
-{
-    workspace.visited.clear();
-    workspace.output.clear();
-    workspace.stack.clear();
-    workspace.stack.push(start_node);
-
-    loop {
-        let node = match workspace.stack.pop() {
-            Some(node) => node,
-            None => return,
-        };
-
-        if !workspace.visited.insert(node as usize) {
-            continue
-        }
-
-        if is_root(graph.node_data(NodeIndex(node as usize))) {
-            // If this is a root, just add it to the output.
-            workspace.output.insert(node);
-        } else {
-            if let Some(ref cached) = cache[node as usize] {
-                for &n in &cached[..] {
-                    workspace.output.insert(n);
-                }
-                // No need to recurse further from this node
-                continue
-            }
-
-            visit_counts[node as usize] += 1;
-
-            // If this node has been visited often enough to be cached ...
-            if visit_counts[node as usize] > CACHING_THRESHOLD {
-                // ... we are actually allowed to cache something, do so:
-                if let Some(ref mut sub_workspace) = sub_workspace {
-                    // Note that the following recursive invocation does never
-                    // write to the cache (since we pass None as sub_workspace).
-                    // This is intentional: The graph we are working with
-                    // contains cycles and this prevent us from simply building
-                    // our caches recursively on-demand.
-                    // However, we can just do a regular, non-caching DFS to
-                    // yield the set of roots and cache that.
-                    find_roots(graph,
-                               node,
-                               visit_counts,
-                               cache,
-                               is_root,
-                               sub_workspace,
-                               None);
-
-                    for &n in &sub_workspace.output.nodes {
-                        workspace.output.insert(n);
-                    }
-
-                    cache[node as usize] = Some(sub_workspace.output
-                                                             .nodes
-                                                             .clone()
-                                                             .into_boxed_slice());
-                    // No need to recurse further from this node
-                    continue
-                }
-            }
-
-            for pred in graph.predecessor_nodes(NodeIndex(node as usize)) {
-                workspace.stack.push(pred.node_id() as u32);
-            }
-        }
-    }
-}
-
-struct DfsWorkspace {
-    stack: Vec<u32>,
-    visited: BitVector,
-    output: NodeIndexSet,
-}
-
-impl DfsWorkspace {
-    fn new(total_node_count: usize) -> DfsWorkspace {
-        DfsWorkspace {
-            stack: Vec::new(),
-            visited: BitVector::new(total_node_count),
-            output: NodeIndexSet::new(total_node_count),
-        }
-    }
-}
-
-struct NodeIndexSet {
-    bitset: BitVector,
-    nodes: Vec<u32>,
-}
-
-impl NodeIndexSet {
-    fn new(total_node_count: usize) -> NodeIndexSet {
-        NodeIndexSet {
-            bitset: BitVector::new(total_node_count),
-            nodes: Vec::new(),
-        }
-    }
-
-    #[inline]
-    fn clear(&mut self) {
-        self.bitset.clear();
-        self.nodes.clear();
-    }
-
-    #[inline]
-    fn insert(&mut self, node: u32) {
-        if self.bitset.insert(node as usize) {
-            self.nodes.push(node)
-        }
-    }
-}
-
-#[test]
-fn test_cached_dfs_acyclic() {
-
-    //     0     1   2
-    //     |      \ /
-    //     3---+   |
-    //     |   |   |
-    //     |   |   |
-    //     4   5   6
-    //      \ / \ / \
-    //       |   |   |
-    //       7   8   9
-
-    let mut g: Graph<bool, ()> = Graph::new();
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(true);
-    g.add_node(true);
-    g.add_node(true);
-
-    g.add_edge(NodeIndex(3), NodeIndex(0), ());
-    g.add_edge(NodeIndex(4), NodeIndex(3), ());
-    g.add_edge(NodeIndex(7), NodeIndex(4), ());
-    g.add_edge(NodeIndex(5), NodeIndex(3), ());
-    g.add_edge(NodeIndex(7), NodeIndex(5), ());
-    g.add_edge(NodeIndex(8), NodeIndex(5), ());
-    g.add_edge(NodeIndex(8), NodeIndex(6), ());
-    g.add_edge(NodeIndex(9), NodeIndex(6), ());
-    g.add_edge(NodeIndex(6), NodeIndex(1), ());
-    g.add_edge(NodeIndex(6), NodeIndex(2), ());
-
-    let mut ws1 = DfsWorkspace::new(g.len_nodes());
-    let mut ws2 = DfsWorkspace::new(g.len_nodes());
-    let mut visit_counts: Vec<_> = g.all_nodes().iter().map(|_| 0u32).collect();
-    let mut cache: Vec<Option<Box<[u32]>>> = g.all_nodes().iter().map(|_| None).collect();
-
-    fn is_root(x: &bool) -> bool { *x }
-
-    for _ in 0 .. CACHING_THRESHOLD + 1 {
-        find_roots(&g, 5, &mut visit_counts, &mut cache[..], is_root, &mut ws1, Some(&mut ws2));
-        ws1.output.nodes.sort();
-        assert_eq!(ws1.output.nodes, vec![7, 8]);
-
-        find_roots(&g, 6, &mut visit_counts, &mut cache[..], is_root, &mut ws1, Some(&mut ws2));
-        ws1.output.nodes.sort();
-        assert_eq!(ws1.output.nodes, vec![8, 9]);
-
-        find_roots(&g, 0, &mut visit_counts, &mut cache[..], is_root, &mut ws1, Some(&mut ws2));
-        ws1.output.nodes.sort();
-        assert_eq!(ws1.output.nodes, vec![7, 8]);
-
-        find_roots(&g, 1, &mut visit_counts, &mut cache[..], is_root, &mut ws1, Some(&mut ws2));
-        ws1.output.nodes.sort();
-        assert_eq!(ws1.output.nodes, vec![8, 9]);
-
-        find_roots(&g, 2, &mut visit_counts, &mut cache[..], is_root, &mut ws1, Some(&mut ws2));
-        ws1.output.nodes.sort();
-        assert_eq!(ws1.output.nodes, vec![8, 9]);
-
-        find_roots(&g, 3, &mut visit_counts, &mut cache[..], is_root, &mut ws1, Some(&mut ws2));
-        ws1.output.nodes.sort();
-        assert_eq!(ws1.output.nodes, vec![7, 8]);
-
-        find_roots(&g, 4, &mut visit_counts, &mut cache[..], is_root, &mut ws1, Some(&mut ws2));
-        ws1.output.nodes.sort();
-        assert_eq!(ws1.output.nodes, vec![7]);
-    }
-}
-
-#[test]
-fn test_cached_dfs_cyclic() {
-
-    //    0       1 <---- 2       3
-    //    ^       |       ^       ^
-    //    |       v       |       |
-    //    4 ----> 5 ----> 6 ----> 7
-    //    ^       ^       ^       ^
-    //    |       |       |       |
-    //    8       9      10      11
-
-
-    let mut g: Graph<bool, ()> = Graph::new();
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(false);
-    g.add_node(true);
-    g.add_node(true);
-    g.add_node(true);
-    g.add_node(true);
-
-    g.add_edge(NodeIndex( 4), NodeIndex(0), ());
-    g.add_edge(NodeIndex( 8), NodeIndex(4), ());
-    g.add_edge(NodeIndex( 4), NodeIndex(5), ());
-    g.add_edge(NodeIndex( 1), NodeIndex(5), ());
-    g.add_edge(NodeIndex( 9), NodeIndex(5), ());
-    g.add_edge(NodeIndex( 5), NodeIndex(6), ());
-    g.add_edge(NodeIndex( 6), NodeIndex(2), ());
-    g.add_edge(NodeIndex( 2), NodeIndex(1), ());
-    g.add_edge(NodeIndex(10), NodeIndex(6), ());
-    g.add_edge(NodeIndex( 6), NodeIndex(7), ());
-    g.add_edge(NodeIndex(11), NodeIndex(7), ());
-    g.add_edge(NodeIndex( 7), NodeIndex(3), ());
-
-    let mut ws1 = DfsWorkspace::new(g.len_nodes());
-    let mut ws2 = DfsWorkspace::new(g.len_nodes());
-    let mut visit_counts: Vec<_> = g.all_nodes().iter().map(|_| 0u32).collect();
-    let mut cache: Vec<Option<Box<[u32]>>> = g.all_nodes().iter().map(|_| None).collect();
-
-    fn is_root(x: &bool) -> bool { *x }
-
-    for _ in 0 .. CACHING_THRESHOLD + 1 {
-        find_roots(&g, 2, &mut visit_counts, &mut cache[..], is_root, &mut ws1, Some(&mut ws2));
-        ws1.output.nodes.sort();
-        assert_eq!(ws1.output.nodes, vec![8, 9, 10]);
-
-        find_roots(&g, 3, &mut visit_counts, &mut cache[..], is_root, &mut ws1, Some(&mut ws2));
-        ws1.output.nodes.sort();
-        assert_eq!(ws1.output.nodes, vec![8, 9, 10, 11]);
-    }
-}
diff --git a/src/librustc_incremental/persist/preds/compress/README.md b/src/librustc_incremental/persist/preds/compress/README.md
new file mode 100644 (file)
index 0000000..d2aa245
--- /dev/null
@@ -0,0 +1,48 @@
+Graph compression
+
+The graph compression algorithm is intended to remove and minimize the
+size of the dependency graph so it can be saved, while preserving
+everything we care about. In particular, given a set of input/output
+nodes in the graph (which must be disjoint), we ensure that the set of
+input nodes that can reach a given output node does not change,
+although the intermediate nodes may change in various ways. In short,
+the output nodes are intended to be the ones whose existence we care
+about when we start up, because they have some associated data that we
+will try to re-use (and hence if they are dirty, we have to throw that
+data away). The other intermediate nodes don't really matter so much.
+
+### Overview
+
+The algorithm works as follows:
+
+1. Do a single walk of the graph to construct a DAG
+    - in this walk, we identify and unify all cycles, electing a representative "head" node
+    - this is done using the union-find implementation
+    - this code is found in the `classify` module
+2. The result from this walk is a `Dag`: 
+   - the set of SCCs, represented by the union-find table
+   - a set of edges in the new DAG, represented by:
+     - a vector of parent nodes for each child node
+     - a vector of cross-edges
+     - once these are canonicalized, some of these edges may turn out to be cyclic edges
+       (i.e., an edge A -> A where A is the head of some SCC)
+3. We pass this `Dag` into the construct code, which then creates a
+   new graph.  This graph has a smaller set of indices which includes
+   *at least* the inputs/outputs from the original graph, but may have
+   other nodes as well, if keeping them reduces the overall size of
+   the graph.
+   - This code is found in the `construct` module.
+   
+### Some notes
+
+The input graph is assumed to have *read-by* edges. i.e., `A -> B`
+means that the task B reads data from A. But the DAG defined by
+classify is expressed in terms of *reads-from* edges, which are the
+inverse. So `A -> B` is the same as `B -rf-> A`. *reads-from* edges
+are more natural since we want to walk from the outputs to the inputs,
+effectively. When we construct the final graph, we reverse these edges
+back into the *read-by* edges common elsewhere.
+
+   
+   
+   
diff --git a/src/librustc_incremental/persist/preds/compress/classify/mod.rs b/src/librustc_incremental/persist/preds/compress/classify/mod.rs
new file mode 100644 (file)
index 0000000..559bdbd
--- /dev/null
@@ -0,0 +1,151 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! First phase. Detect cycles and cross-edges.
+
+use super::*;
+
+#[cfg(test)]
+mod test;
+
+pub struct Classify<'a, 'g: 'a, N: 'g, I: 'a, O: 'a>
+    where N: Debug + Clone + 'g,
+          I: Fn(&N) -> bool,
+          O: Fn(&N) -> bool,
+{
+    r: &'a mut GraphReduce<'g, N, I, O>,
+    stack: Vec<NodeIndex>,
+    colors: Vec<Color>,
+    dag: Dag,
+}
+
+#[derive(Copy, Clone, Debug, PartialEq)]
+enum Color {
+    // not yet visited
+    White,
+
+    // visiting; usize is index on stack
+    Grey(usize),
+
+    // finished visiting
+    Black,
+}
+
+impl<'a, 'g, N, I, O> Classify<'a, 'g, N, I, O>
+    where N: Debug + Clone + 'g,
+          I: Fn(&N) -> bool,
+          O: Fn(&N) -> bool,
+{
+    pub(super) fn new(r: &'a mut GraphReduce<'g, N, I, O>) -> Self {
+        Classify {
+            r: r,
+            colors: vec![Color::White; r.in_graph.len_nodes()],
+            stack: vec![],
+            dag: Dag {
+                parents: (0..r.in_graph.len_nodes()).map(|i| NodeIndex(i)).collect(),
+                cross_edges: vec![],
+                input_nodes: vec![],
+                output_nodes: vec![],
+            },
+        }
+    }
+
+    pub(super) fn walk(mut self) -> Dag {
+        for (index, node) in self.r.in_graph.all_nodes().iter().enumerate() {
+            if (self.r.is_output)(&node.data) {
+                let index = NodeIndex(index);
+                self.dag.output_nodes.push(index);
+                match self.colors[index.0] {
+                    Color::White => self.open(index),
+                    Color::Grey(_) => panic!("grey node but have not yet started a walk"),
+                    Color::Black => (), // already visited, skip
+                }
+            }
+        }
+
+        // At this point we've identifed all the cycles, and we've
+        // constructed a spanning tree over the original graph
+        // (encoded in `self.parents`) as well as a list of
+        // cross-edges that reflect additional edges from the DAG.
+        //
+        // If we converted each node to its `cycle-head` (a
+        // representative choice from each SCC, basically) and then
+        // take the union of `self.parents` and `self.cross_edges`
+        // (after canonicalization), that is basically our DAG.
+        //
+        // Note that both of those may well contain trivial `X -rf-> X`
+        // cycle edges after canonicalization, though. e.g., if you
+        // have a graph `{A -rf-> B, B -rf-> A}`, we will have unioned A and
+        // B, but A will also be B's parent (or vice versa), and hence
+        // when we canonicalize the parent edge it would become `A -rf->
+        // A` (or `B -rf-> B`).
+        self.dag
+    }
+
+    fn open(&mut self, node: NodeIndex) {
+        let index = self.stack.len();
+        self.stack.push(node);
+        self.colors[node.0] = Color::Grey(index);
+        for child in self.r.inputs(node) {
+            self.walk_edge(node, child);
+        }
+        self.stack.pop().unwrap();
+        self.colors[node.0] = Color::Black;
+
+        if (self.r.is_input)(&self.r.in_graph.node_data(node)) {
+            // base inputs should have no inputs
+            assert!(self.r.inputs(node).next().is_none());
+            debug!("input: `{:?}`", self.r.in_graph.node_data(node));
+            self.dag.input_nodes.push(node);
+        }
+    }
+
+    fn walk_edge(&mut self, parent: NodeIndex, child: NodeIndex) {
+        debug!("walk_edge: {:?} -rf-> {:?}, {:?}",
+               self.r.in_graph.node_data(parent),
+               self.r.in_graph.node_data(child),
+               self.colors[child.0]);
+
+        // Ignore self-edges, just in case they exist.
+        if child == parent {
+            return;
+        }
+
+        match self.colors[child.0] {
+            Color::White => {
+                // Not yet visited this node; start walking it.
+                assert_eq!(self.dag.parents[child.0], child);
+                self.dag.parents[child.0] = parent;
+                self.open(child);
+            }
+
+            Color::Grey(stack_index) => {
+                // Back-edge; unify everything on stack between here and `stack_index`
+                // since we are all participating in a cycle
+                assert!(self.stack[stack_index] == child);
+
+                for &n in &self.stack[stack_index..] {
+                    debug!("cycle `{:?}` and `{:?}`",
+                           self.r.in_graph.node_data(n),
+                           self.r.in_graph.node_data(parent));
+                    self.r.mark_cycle(n, parent);
+                }
+            }
+
+            Color::Black => {
+                // Cross-edge, record and ignore
+                self.dag.cross_edges.push((parent, child));
+                debug!("cross-edge `{:?} -rf-> {:?}`",
+                       self.r.in_graph.node_data(parent),
+                       self.r.in_graph.node_data(child));
+            }
+        }
+    }
+}
diff --git a/src/librustc_incremental/persist/preds/compress/classify/test.rs b/src/librustc_incremental/persist/preds/compress/classify/test.rs
new file mode 100644 (file)
index 0000000..ca26f71
--- /dev/null
@@ -0,0 +1,94 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use super::*;
+
+#[test]
+fn detect_cycles() {
+    let (graph, nodes) = graph! {
+        A -> C0,
+        A -> C1,
+        B -> C1,
+        C0 -> C1,
+        C1 -> C0,
+        C0 -> D,
+        C1 -> E,
+    };
+    let inputs = ["A", "B"];
+    let outputs = ["D", "E"];
+    let mut reduce = GraphReduce::new(&graph, |n| inputs.contains(n), |n| outputs.contains(n));
+    Classify::new(&mut reduce).walk();
+
+    assert!(!reduce.in_cycle(nodes("A"), nodes("C0")));
+    assert!(!reduce.in_cycle(nodes("B"), nodes("C0")));
+    assert!(reduce.in_cycle(nodes("C0"), nodes("C1")));
+    assert!(!reduce.in_cycle(nodes("D"), nodes("C0")));
+    assert!(!reduce.in_cycle(nodes("E"), nodes("C0")));
+    assert!(!reduce.in_cycle(nodes("E"), nodes("A")));
+}
+
+/// Regr test for a bug where we forgot to pop nodes off of the stack
+/// as we were walking. In this case, because edges are pushed to the front
+/// of the list, we would visit OUT, then A, then IN, and then close IN (but forget
+/// to POP. Then visit B, C, and then A, which would mark everything from A to C as
+/// cycle. But since we failed to pop IN, the stack was `OUT, A, IN, B, C` so that
+/// marked C and IN as being in a cycle.
+#[test]
+fn edge_order1() {
+    let (graph, nodes) = graph! {
+        A -> C,
+        C -> B,
+        B -> A,
+        IN -> B,
+        IN -> A,
+        A -> OUT,
+    };
+    let inputs = ["IN"];
+    let outputs = ["OUT"];
+    let mut reduce = GraphReduce::new(&graph, |n| inputs.contains(n), |n| outputs.contains(n));
+    Classify::new(&mut reduce).walk();
+
+    // A, B, and C are mutually in a cycle, but IN/OUT are not participating.
+    let names = ["A", "B", "C", "IN", "OUT"];
+    let cycle_names = ["A", "B", "C"];
+    for &i in &names {
+        for &j in names.iter().filter(|&&j| j != i) {
+            let in_cycle = cycle_names.contains(&i) && cycle_names.contains(&j);
+            assert_eq!(reduce.in_cycle(nodes(i), nodes(j)), in_cycle,
+                       "cycle status for nodes {} and {} is incorrect",
+                       i, j);
+        }
+    }
+}
+
+/// Same as `edge_order1` but in reverse order so as to detect a failure
+/// if we were to enqueue edges onto end of list instead.
+#[test]
+fn edge_order2() {
+    let (graph, nodes) = graph! {
+        A -> OUT,
+        IN -> A,
+        IN -> B,
+        B -> A,
+        C -> B,
+        A -> C,
+    };
+    let inputs = ["IN"];
+    let outputs = ["OUT"];
+    let mut reduce = GraphReduce::new(&graph, |n| inputs.contains(n), |n| outputs.contains(n));
+    Classify::new(&mut reduce).walk();
+
+    assert!(reduce.in_cycle(nodes("B"), nodes("C")));
+
+    assert!(!reduce.in_cycle(nodes("IN"), nodes("A")));
+    assert!(!reduce.in_cycle(nodes("IN"), nodes("B")));
+    assert!(!reduce.in_cycle(nodes("IN"), nodes("C")));
+    assert!(!reduce.in_cycle(nodes("IN"), nodes("OUT")));
+}
diff --git a/src/librustc_incremental/persist/preds/compress/construct.rs b/src/librustc_incremental/persist/preds/compress/construct.rs
new file mode 100644 (file)
index 0000000..394be74
--- /dev/null
@@ -0,0 +1,223 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Second phase. Construct new graph. The previous phase has
+//! converted the input graph into a DAG by detecting and unifying
+//! cycles. It provides us with the following (which is a
+//! representation of the DAG):
+//!
+//! - SCCs, in the form of a union-find repr that can convert each node to
+//!   its *cycle head* (an arbitrarly chosen representative from the cycle)
+//! - a vector of *leaf nodes*, just a convenience
+//! - a vector of *parents* for each node (in some cases, nodes have no parents,
+//!   or their parent is another member of same cycle; in that case, the vector
+//!   will be stored `v[i] == i`, after canonicalization)
+//! - a vector of *cross edges*, meaning add'l edges between graphs nodes beyond
+//!   the parents.
+
+use rustc_data_structures::fx::FxHashMap;
+
+use super::*;
+
+pub(super) fn construct_graph<'g, N, I, O>(r: &mut GraphReduce<'g, N, I, O>, dag: Dag)
+                                           -> Reduction<'g, N>
+    where N: Debug + Clone, I: Fn(&N) -> bool, O: Fn(&N) -> bool,
+{
+    let Dag { parents: old_parents, input_nodes, output_nodes, cross_edges } = dag;
+    let in_graph = r.in_graph;
+
+    debug!("construct_graph");
+
+    // Create a canonical list of edges; this includes both parent and
+    // cross-edges. We store this in `(target -> Vec<source>)` form.
+    // We call the first edge to any given target its "parent".
+    let mut edges = FxHashMap();
+    let old_parent_edges = old_parents.iter().cloned().zip((0..).map(NodeIndex));
+    for (source, target) in old_parent_edges.chain(cross_edges) {
+        debug!("original edge `{:?} -rf-> {:?}`",
+               in_graph.node_data(source),
+               in_graph.node_data(target));
+        let source = r.cycle_head(source);
+        let target = r.cycle_head(target);
+        if source != target {
+            let v = edges.entry(target).or_insert(vec![]);
+            if !v.contains(&source) {
+                debug!("edge `{:?} -rf-> {:?}` is edge #{} with that target",
+                       in_graph.node_data(source),
+                       in_graph.node_data(target),
+                       v.len());
+                v.push(source);
+            }
+        }
+    }
+    let parent = |ni: NodeIndex| -> NodeIndex {
+        edges[&ni][0]
+    };
+
+    // `retain_map`: a map of those nodes that we will want to
+    // *retain* in the ultimate graph; the key is the node index in
+    // the old graph, the value is the node index in the new
+    // graph. These are nodes in the following categories:
+    //
+    // - inputs
+    // - work-products
+    // - targets of a cross-edge
+    //
+    // The first two categories hopefully make sense. We want the
+    // inputs so we can compare hashes later. We want the
+    // work-products so we can tell precisely when a given
+    // work-product is invalidated. But the last one isn't strictly
+    // needed; we keep cross-target edges so as to minimize the total
+    // graph size.
+    //
+    // Consider a graph like:
+    //
+    //     WP0 -rf-> Y
+    //     WP1 -rf-> Y
+    //     Y -rf-> INPUT0
+    //     Y -rf-> INPUT1
+    //     Y -rf-> INPUT2
+    //     Y -rf-> INPUT3
+    //
+    // Now if we were to remove Y, we would have a total of 8 edges: both WP0 and WP1
+    // depend on INPUT0...INPUT3. As it is, we have 6 edges.
+    //
+    // NB: The current rules are not optimal. For example, given this
+    // input graph:
+    //
+    //     OUT0 -rf-> X
+    //     OUT1 -rf-> X
+    //     X -rf -> INPUT0
+    //
+    // we will preserve X because it has two "consumers" (OUT0 and
+    // OUT1).  We could as easily skip it, but we'd have to tally up
+    // the number of input nodes that it (transitively) reaches, and I
+    // was too lazy to do so. This is the unit test `suboptimal`.
+
+    let mut retain_map = FxHashMap();
+    let mut new_graph = Graph::new();
+
+    {
+        // Start by adding start-nodes and inputs.
+        let retained_nodes = output_nodes.iter().chain(&input_nodes).map(|&n| r.cycle_head(n));
+
+        // Next add in targets of cross-edges. Due to the canonicalization,
+        // some of these may be self-edges or may may duplicate the parent
+        // edges, so ignore those.
+        let retained_nodes = retained_nodes.chain(
+            edges.iter()
+                 .filter(|&(_, ref sources)| sources.len() > 1)
+                 .map(|(&target, _)| target));
+
+        // Now create the new graph, adding in the entries from the map.
+        for n in retained_nodes {
+            retain_map.entry(n)
+                      .or_insert_with(|| {
+                          let data = in_graph.node_data(n);
+                          debug!("retaining node `{:?}`", data);
+                          new_graph.add_node(data)
+                      });
+        }
+    }
+
+    // Given a cycle-head `ni`, converts it to the closest parent that has
+    // been retained in the output graph.
+    let retained_parent = |mut ni: NodeIndex| -> NodeIndex {
+        loop {
+            debug!("retained_parent({:?})", in_graph.node_data(ni));
+            match retain_map.get(&ni) {
+                Some(&v) => return v,
+                None => ni = parent(ni),
+            }
+        }
+    };
+
+    // Now add in the edges into the graph.
+    for (&target, sources) in &edges {
+        if let Some(&r_target) = retain_map.get(&target) {
+            debug!("adding edges that target `{:?}`", in_graph.node_data(target));
+            for &source in sources {
+                debug!("new edge `{:?} -rf-> {:?}`",
+                       in_graph.node_data(source),
+                       in_graph.node_data(target));
+                let r_source = retained_parent(source);
+
+                // NB. In the input graph, we have `a -> b` if b
+                // **reads from** a. But in the terminology of this
+                // code, we would describe that edge as `b -> a`,
+                // because we have edges *from* outputs *to* inputs.
+                // Therefore, when we create our new graph, we have to
+                // reverse the edge.
+                new_graph.add_edge(r_target, r_source, ());
+            }
+        } else {
+            assert_eq!(sources.len(), 1);
+        }
+    }
+
+    // One complication. In some cases, output nodes *may* participate in
+    // cycles. An example:
+    //
+    //             [HIR0]                    [HIR1]
+    //               |                         |
+    //               v                         v
+    //      TypeckClosureBody(X) -> ItemSignature(X::SomeClosureInX)
+    //            |  ^                         | |
+    //            |  +-------------------------+ |
+    //            |                              |
+    //            v                              v
+    //           Foo                            Bar
+    //
+    // In these cases, the output node may not wind up as the head
+    // of the cycle, in which case it would be absent from the
+    // final graph. We don't wish this to happen, therefore we go
+    // over the list of output nodes again and check for any that
+    // are not their own cycle-head. If we find such a node, we
+    // add it to the graph now with an edge from the cycle head.
+    // So the graph above could get transformed into this:
+    //
+    //                                    [HIR0, HIR1]
+    //                                         |
+    //                                         v
+    //      TypeckClosureBody(X)    ItemSignature(X::SomeClosureInX)
+    //               ^                         | |
+    //               +-------------------------+ |
+    //                                           v
+    //                                       [Foo, Bar]
+    //
+    // (Note that all the edges here are "read-by" edges, not
+    // "reads-from" edges.)
+    for &output_node in &output_nodes {
+        let head = r.cycle_head(output_node);
+        if output_node == head {
+            assert!(retain_map.contains_key(&output_node));
+        } else {
+            assert!(!retain_map.contains_key(&output_node));
+            let output_data = in_graph.node_data(output_node);
+            let new_node = new_graph.add_node(output_data);
+            let new_head_node = retain_map[&head];
+            new_graph.add_edge(new_head_node, new_node, ());
+        }
+    }
+
+    // Finally, prepare a list of the input node indices as found in
+    // the new graph. Note that since all input nodes are leaves in
+    // the graph, they should never participate in a cycle.
+    let input_nodes =
+        input_nodes.iter()
+                   .map(|&n| {
+                       assert_eq!(r.cycle_head(n), n, "input node participating in a cycle");
+                       retain_map[&n]
+                   })
+                   .collect();
+
+    Reduction { graph: new_graph, input_nodes: input_nodes }
+}
+
diff --git a/src/librustc_incremental/persist/preds/compress/dag_id.rs b/src/librustc_incremental/persist/preds/compress/dag_id.rs
new file mode 100644 (file)
index 0000000..a286862
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use rustc_data_structures::graph::NodeIndex;
+use rustc_data_structures::unify::UnifyKey;
+
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
+pub struct DagId {
+    index: u32,
+}
+
+impl DagId {
+    pub fn from_input_index(n: NodeIndex) -> Self {
+        DagId { index: n.0 as u32 }
+    }
+
+    pub fn as_input_index(&self) -> NodeIndex {
+        NodeIndex(self.index as usize)
+    }
+}
+
+impl UnifyKey for DagId {
+    type Value = ();
+
+    fn index(&self) -> u32 {
+        self.index
+    }
+
+    fn from_index(u: u32) -> Self {
+        DagId { index: u }
+    }
+
+    fn tag(_: Option<Self>) -> &'static str {
+        "DagId"
+    }
+}
diff --git a/src/librustc_incremental/persist/preds/compress/mod.rs b/src/librustc_incremental/persist/preds/compress/mod.rs
new file mode 100644 (file)
index 0000000..974a222
--- /dev/null
@@ -0,0 +1,125 @@
+// Copyright 2012-2013 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.
+
+//! Graph compression. See `README.md`.
+
+use rustc_data_structures::graph::{Graph, NodeIndex};
+use rustc_data_structures::unify::UnificationTable;
+use std::fmt::Debug;
+
+#[cfg(test)]
+#[macro_use]
+mod test_macro;
+
+mod construct;
+
+mod classify;
+use self::classify::Classify;
+
+mod dag_id;
+use self::dag_id::DagId;
+
+#[cfg(test)]
+mod test;
+
+pub fn reduce_graph<N, I, O>(graph: &Graph<N, ()>,
+                             is_input: I,
+                             is_output: O) -> Reduction<N>
+    where N: Debug + Clone,
+          I: Fn(&N) -> bool,
+          O: Fn(&N) -> bool,
+{
+    GraphReduce::new(graph, is_input, is_output).compute()
+}
+
+pub struct Reduction<'q, N> where N: 'q + Debug + Clone {
+    pub graph: Graph<&'q N, ()>,
+    pub input_nodes: Vec<NodeIndex>,
+}
+
+struct GraphReduce<'q, N, I, O>
+    where N: 'q + Debug + Clone,
+          I: Fn(&N) -> bool,
+          O: Fn(&N) -> bool,
+{
+    in_graph: &'q Graph<N, ()>,
+    unify: UnificationTable<DagId>,
+    is_input: I,
+    is_output: O,
+}
+
+struct Dag {
+    // The "parent" of a node is the node which reached it during the
+    // initial DFS. To encode the case of "no parent" (i.e., for the
+    // roots of the walk), we make `parents[i] == i` to start, which
+    // turns out be convenient.
+    parents: Vec<NodeIndex>,
+
+    // Additional edges beyond the parents.
+    cross_edges: Vec<(NodeIndex, NodeIndex)>,
+
+    // Nodes which we found that are considered "outputs"
+    output_nodes: Vec<NodeIndex>,
+
+    // Nodes which we found that are considered "inputs"
+    input_nodes: Vec<NodeIndex>,
+}
+
+#[derive(Copy, Clone, PartialEq, Eq, Hash)]
+struct DagNode {
+    in_index: NodeIndex
+}
+
+impl<'q, N, I, O> GraphReduce<'q, N, I, O>
+    where N: Debug + Clone,
+          I: Fn(&N) -> bool,
+          O: Fn(&N) -> bool,
+{
+    fn new(in_graph: &'q Graph<N, ()>, is_input: I, is_output: O) -> Self {
+        let mut unify = UnificationTable::new();
+
+        // create a set of unification keys whose indices
+        // correspond to the indices from the input graph
+        for i in 0..in_graph.len_nodes() {
+            let k = unify.new_key(());
+            assert!(k == DagId::from_input_index(NodeIndex(i)));
+        }
+
+        GraphReduce { in_graph, unify, is_input, is_output }
+    }
+
+    fn compute(mut self) -> Reduction<'q, N> {
+        let dag = Classify::new(&mut self).walk();
+        construct::construct_graph(&mut self, dag)
+    }
+
+    fn inputs(&self, in_node: NodeIndex) -> impl Iterator<Item = NodeIndex> + 'q {
+        self.in_graph.predecessor_nodes(in_node)
+    }
+
+    fn mark_cycle(&mut self, in_node1: NodeIndex, in_node2: NodeIndex) {
+        let dag_id1 = DagId::from_input_index(in_node1);
+        let dag_id2 = DagId::from_input_index(in_node2);
+        self.unify.union(dag_id1, dag_id2);
+    }
+
+    /// Convert a dag-id into its cycle head representative. This will
+    /// be a no-op unless `in_node` participates in a cycle, in which
+    /// case a distinct node *may* be returned.
+    fn cycle_head(&mut self, in_node: NodeIndex) -> NodeIndex {
+        let i = DagId::from_input_index(in_node);
+        self.unify.find(i).as_input_index()
+    }
+
+    #[cfg(test)]
+    fn in_cycle(&mut self, ni1: NodeIndex, ni2: NodeIndex) -> bool {
+        self.cycle_head(ni1) == self.cycle_head(ni2)
+    }
+}
diff --git a/src/librustc_incremental/persist/preds/compress/test.rs b/src/librustc_incremental/persist/preds/compress/test.rs
new file mode 100644 (file)
index 0000000..1c51308
--- /dev/null
@@ -0,0 +1,259 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use super::*;
+
+fn reduce(graph: &Graph<&'static str, ()>,
+          inputs: &[&'static str],
+          outputs: &[&'static str],
+          expected: &[&'static str])
+{
+    let reduce = GraphReduce::new(&graph,
+                                  |n| inputs.contains(n),
+                                  |n| outputs.contains(n));
+    let result = reduce.compute();
+    let mut edges: Vec<String> =
+        result.graph
+              .all_edges()
+              .iter()
+              .map(|edge| format!("{} -> {}",
+                                  result.graph.node_data(edge.source()),
+                                  result.graph.node_data(edge.target())))
+              .collect();
+    edges.sort();
+    println!("{:#?}", edges);
+    assert_eq!(edges.len(), expected.len());
+    for (expected, actual) in expected.iter().zip(&edges) {
+        assert_eq!(expected, actual);
+    }
+}
+
+#[test]
+fn test1() {
+    //  +---------------+
+    //  |               |
+    //  |      +--------|------+
+    //  |      |        v      v
+    // [A] -> [C0] -> [C1]    [D]
+    //        [  ] <- [  ] -> [E]
+    //                  ^
+    // [B] -------------+
+    let (graph, _nodes) = graph! {
+        A -> C0,
+        A -> C1,
+        B -> C1,
+        C0 -> C1,
+        C1 -> C0,
+        C0 -> D,
+        C1 -> E,
+    };
+
+    // [A] -> [C1] -> [D]
+    // [B] -> [  ] -> [E]
+    reduce(&graph, &["A", "B"], &["D", "E"], &[
+        "A -> C1",
+        "B -> C1",
+        "C1 -> D",
+        "C1 -> E",
+    ]);
+}
+
+#[test]
+fn test2() {
+    //  +---------------+
+    //  |               |
+    //  |      +--------|------+
+    //  |      |        v      v
+    // [A] -> [C0] -> [C1]    [D] -> [E]
+    //        [  ] <- [  ]
+    //                  ^
+    // [B] -------------+
+    let (graph, _nodes) = graph! {
+        A -> C0,
+        A -> C1,
+        B -> C1,
+        C0 -> C1,
+        C1 -> C0,
+        C0 -> D,
+        D -> E,
+    };
+
+    // [A] -> [D] -> [E]
+    // [B] -> [ ]
+    reduce(&graph, &["A", "B"], &["D", "E"], &[
+        "A -> D",
+        "B -> D",
+        "D -> E",
+    ]);
+}
+
+#[test]
+fn test2b() {
+    // Variant on test2 in which [B] is not
+    // considered an input.
+    let (graph, _nodes) = graph! {
+        A -> C0,
+        A -> C1,
+        B -> C1,
+        C0 -> C1,
+        C1 -> C0,
+        C0 -> D,
+        D -> E,
+    };
+
+    // [A] -> [D] -> [E]
+    reduce(&graph, &["A"], &["D", "E"], &[
+        "A -> D",
+        "D -> E",
+    ]);
+}
+
+#[test]
+fn test3() {
+
+    // Edges going *downwards*, so 0, 1 and 2 are inputs,
+    // while 7, 8, and 9 are outputs.
+    //
+    //     0     1   2
+    //     |      \ /
+    //     3---+   |
+    //     |   |   |
+    //     |   |   |
+    //     4   5   6
+    //      \ / \ / \
+    //       |   |   |
+    //       7   8   9
+    //
+    // Here the end result removes node 4, instead encoding an edge
+    // from n3 -> n7, but keeps nodes 5 and 6, as they are common
+    // inputs to nodes 8/9.
+
+    let (graph, _nodes) = graph! {
+        n0 -> n3,
+        n3 -> n4,
+        n3 -> n5,
+        n4 -> n7,
+        n5 -> n7,
+        n5 -> n8,
+        n1 -> n6,
+        n2 -> n6,
+        n6 -> n8,
+        n6 -> n9,
+    };
+
+    reduce(&graph, &["n0", "n1", "n2"], &["n7", "n8", "n9"], &[
+        "n0 -> n3",
+        "n1 -> n6",
+        "n2 -> n6",
+        "n3 -> n5",
+        "n3 -> n7",
+        "n5 -> n7",
+        "n5 -> n8",
+        "n6 -> n8",
+        "n6 -> n9"
+    ]);
+}
+
+#[test]
+fn test_cached_dfs_cyclic() {
+
+    //    0       1 <---- 2       3
+    //    ^       |       ^       ^
+    //    |       v       |       |
+    //    4 ----> 5 ----> 6 ----> 7
+    //    ^       ^       ^       ^
+    //    |       |       |       |
+    //    8       9      10      11
+
+    let (graph, _nodes) = graph! {
+        // edges from above diagram, in columns, top-to-bottom:
+        n4 -> n0,
+        n8 -> n4,
+        n4 -> n5,
+        n1 -> n5,
+        n9 -> n5,
+        n2 -> n1,
+        n5 -> n6,
+        n6 -> n2,
+        n10 -> n6,
+        n6 -> n7,
+        n7 -> n3,
+        n11 -> n7,
+    };
+
+    //    0       1  2            3
+    //    ^       ^ /             ^
+    //    |       |/              |
+    //    4 ----> 5 --------------+
+    //    ^       ^ \             |
+    //    |       |  \            |
+    //    8       9   10         11
+
+    reduce(&graph, &["n8", "n9", "n10", "n11"], &["n0", "n1", "n2", "n3"], &[
+        "n10 -> n5",
+        "n11 -> n3",
+        "n4 -> n0",
+        "n4 -> n5",
+        "n5 -> n1",
+        "n5 -> n2",
+        "n5 -> n3",
+        "n8 -> n4",
+        "n9 -> n5"
+    ]);
+}
+
+/// Demonstrates the case where we don't reduce as much as we could.
+#[test]
+fn suboptimal() {
+    let (graph, _nodes) = graph! {
+        INPUT0 -> X,
+        X -> OUTPUT0,
+        X -> OUTPUT1,
+    };
+
+    reduce(&graph, &["INPUT0"], &["OUTPUT0", "OUTPUT1"], &[
+        "INPUT0 -> X",
+        "X -> OUTPUT0",
+        "X -> OUTPUT1"
+    ]);
+}
+
+#[test]
+fn test_cycle_output() {
+    //  +---------------+
+    //  |               |
+    //  |      +--------|------+
+    //  |      |        v      v
+    // [A] -> [C0] <-> [C1] <- [D]
+    //                  +----> [E]
+    //                          ^
+    // [B] ----------------- ---+
+    let (graph, _nodes) = graph! {
+        A -> C0,
+        A -> C1,
+        B -> E,
+        C0 -> C1,
+        C1 -> C0,
+        C0 -> D,
+        C1 -> E,
+        D -> C1,
+    };
+
+    // [A] -> [C0] --> [D]
+    //          +----> [E]
+    //                  ^
+    // [B] -------------+
+    reduce(&graph, &["A", "B"], &["D", "E"], &[
+        "A -> C0",
+        "B -> E",
+        "C0 -> D",
+        "C0 -> E",
+    ]);
+}
diff --git a/src/librustc_incremental/persist/preds/compress/test_macro.rs b/src/librustc_incremental/persist/preds/compress/test_macro.rs
new file mode 100644 (file)
index 0000000..31b30d2
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! graph {
+    ($( $source:ident -> $target:ident, )*) => {
+        {
+            use $crate::rustc_data_structures::graph::{Graph, NodeIndex};
+            use $crate::rustc_data_structures::fx::FxHashMap;
+
+            let mut graph = Graph::new();
+            let mut nodes: FxHashMap<&'static str, NodeIndex> = FxHashMap();
+
+            for &name in &[ $(stringify!($source), stringify!($target)),* ] {
+                let name: &'static str = name;
+                nodes.entry(name)
+                     .or_insert_with(|| graph.add_node(name));
+            }
+
+            $(
+                {
+                    let source = nodes[&stringify!($source)];
+                    let target = nodes[&stringify!($target)];
+                    graph.add_edge(source, target, ());
+                }
+            )*
+
+            let f = move |name: &'static str| -> NodeIndex { nodes[&name] };
+
+            (graph, f)
+        }
+    }
+}
+
+macro_rules! set {
+    ($( $value:expr ),*) => {
+        {
+            use $crate::rustc_data_structures::fx::FxHashSet;
+            let mut set = FxHashSet();
+            $(set.insert($value);)*
+            set
+        }
+    }
+}
diff --git a/src/librustc_incremental/persist/preds/mod.rs b/src/librustc_incremental/persist/preds/mod.rs
new file mode 100644 (file)
index 0000000..a80620f
--- /dev/null
@@ -0,0 +1,75 @@
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use rustc::dep_graph::{DepGraphQuery, DepNode};
+use rustc::hir::def_id::DefId;
+use rustc_data_structures::fx::FxHashMap;
+use rustc_data_structures::graph::Graph;
+
+use super::hash::*;
+use ich::Fingerprint;
+
+mod compress;
+
+/// A data-structure that makes it easy to enumerate the hashable
+/// predecessors of any given dep-node.
+pub struct Predecessors<'query> {
+    // A reduced version of the input graph that contains fewer nodes.
+    // This is intended to keep all of the base inputs (i.e., HIR
+    // nodes) and all of the "work-products" we may care about
+    // later. Other nodes may be retained if it keeps the overall size
+    // of the graph down.
+    pub reduced_graph: Graph<&'query DepNode<DefId>, ()>,
+
+    // For the inputs (hir/foreign-metadata), we include hashes.
+    pub hashes: FxHashMap<&'query DepNode<DefId>, Fingerprint>,
+}
+
+impl<'q> Predecessors<'q> {
+    pub fn new(query: &'q DepGraphQuery<DefId>, hcx: &mut HashContext) -> Self {
+        let tcx = hcx.tcx;
+
+        let collect_for_metadata = tcx.sess.opts.debugging_opts.incremental_cc ||
+            tcx.sess.opts.debugging_opts.query_dep_graph;
+
+        // Find the set of "start nodes". These are nodes that we will
+        // possibly query later.
+        let is_output = |node: &DepNode<DefId>| -> bool {
+            match *node {
+                DepNode::WorkProduct(_) => true,
+                DepNode::MetaData(ref def_id) => collect_for_metadata && def_id.is_local(),
+
+                // if -Z query-dep-graph is passed, save more extended data
+                // to enable better unit testing
+                DepNode::TypeckTables(_) |
+                DepNode::TransCrateItem(_) => tcx.sess.opts.debugging_opts.query_dep_graph,
+
+                _ => false,
+            }
+        };
+
+        // Reduce the graph to the most important nodes.
+        let compress::Reduction { graph, input_nodes } =
+            compress::reduce_graph(&query.graph, HashContext::is_hashable, is_output);
+
+        let mut hashes = FxHashMap();
+        for input_index in input_nodes {
+            let input = *graph.node_data(input_index);
+            debug!("computing hash for input node `{:?}`", input);
+            hashes.entry(input)
+                  .or_insert_with(|| hcx.hash(input).unwrap());
+        }
+
+        Predecessors {
+            reduced_graph: graph,
+            hashes: hashes,
+        }
+    }
+}
index f626905f27d4a1d5ff2f9333e04a126861dedbb5..34bb125ef3f45d130dd8a53a14162103559f62f7 100644 (file)
@@ -14,6 +14,7 @@
 use rustc::session::Session;
 use rustc::ty::TyCtxt;
 use rustc_data_structures::fx::FxHashMap;
+use rustc_data_structures::graph::{NodeIndex, INCOMING};
 use rustc_serialize::Encodable as RustcEncodable;
 use rustc_serialize::opaque::Encoder;
 use std::hash::Hash;
@@ -177,8 +178,10 @@ pub fn encode_dep_graph(preds: &Predecessors,
 
     // Create a flat list of (Input, WorkProduct) edges for
     // serialization.
-    let mut edges = vec![];
-    for (&target, sources) in &preds.inputs {
+    let mut edges = FxHashMap();
+    for edge in preds.reduced_graph.all_edges() {
+        let source = *preds.reduced_graph.node_data(edge.source());
+        let target = *preds.reduced_graph.node_data(edge.target());
         match *target {
             DepNode::MetaData(ref def_id) => {
                 // Metadata *targets* are always local metadata nodes. We have
@@ -188,11 +191,10 @@ pub fn encode_dep_graph(preds: &Predecessors,
             }
             _ => (),
         }
+        debug!("serialize edge: {:?} -> {:?}", source, target);
+        let source = builder.map(source);
         let target = builder.map(target);
-        for &source in sources {
-            let source = builder.map(source);
-            edges.push((source, target.clone()));
-        }
+        edges.entry(source).or_insert(vec![]).push(target);
     }
 
     if tcx.sess.opts.debugging_opts.incremental_dump_hash {
@@ -202,6 +204,9 @@ pub fn encode_dep_graph(preds: &Predecessors,
     }
 
     // Create the serialized dep-graph.
+    let edges = edges.into_iter()
+                     .map(|(k, v)| SerializedEdgeSet { source: k, targets: v })
+                     .collect();
     let graph = SerializedDepGraph {
         edges: edges,
         hashes: preds.hashes
@@ -250,12 +255,10 @@ pub fn encode_metadata_hashes(tcx: TyCtxt,
 
     let mut def_id_hashes = FxHashMap();
 
-    for (&target, sources) in &preds.inputs {
-        let def_id = match *target {
-            DepNode::MetaData(def_id) => {
-                assert!(def_id.is_local());
-                def_id
-            }
+    for (index, target) in preds.reduced_graph.all_nodes().iter().enumerate() {
+        let index = NodeIndex(index);
+        let def_id = match *target.data {
+            DepNode::MetaData(def_id) if def_id.is_local() => def_id,
             _ => continue,
         };
 
@@ -281,13 +284,18 @@ pub fn encode_metadata_hashes(tcx: TyCtxt,
         // is the det. hash of the def-path. This is convenient
         // because we can sort this to get a stable ordering across
         // compilations, even if the def-ids themselves have changed.
-        let mut hashes: Vec<(DepNode<u64>, Fingerprint)> = sources.iter()
-            .map(|dep_node| {
-                let hash_dep_node = dep_node.map_def(|&def_id| Some(def_id_hash(def_id))).unwrap();
-                let hash = preds.hashes[dep_node];
-                (hash_dep_node, hash)
-            })
-            .collect();
+        let mut hashes: Vec<(DepNode<u64>, Fingerprint)> =
+            preds.reduced_graph
+                 .depth_traverse(index, INCOMING)
+                 .map(|index| preds.reduced_graph.node_data(index))
+                 .filter(|dep_node| HashContext::is_hashable(dep_node))
+                 .map(|dep_node| {
+                     let hash_dep_node = dep_node.map_def(|&def_id| Some(def_id_hash(def_id)))
+                                                 .unwrap();
+                     let hash = preds.hashes[dep_node];
+                     (hash_dep_node, hash)
+                 })
+                 .collect();
 
         hashes.sort();
         let mut state = IchHasher::new();
@@ -298,9 +306,12 @@ pub fn encode_metadata_hashes(tcx: TyCtxt,
 
         if tcx.sess.opts.debugging_opts.incremental_dump_hash {
             println!("metadata hash for {:?} is {}", def_id, hash);
-            for dep_node in sources {
-                println!("metadata hash for {:?} depends on {:?} with hash {}",
-                         def_id, dep_node, preds.hashes[dep_node]);
+            for pred_index in preds.reduced_graph.depth_traverse(index, INCOMING) {
+                let dep_node = preds.reduced_graph.node_data(pred_index);
+                if HashContext::is_hashable(&dep_node) {
+                    println!("metadata hash for {:?} depends on {:?} with hash {}",
+                             def_id, dep_node, preds.hashes[dep_node]);
+                }
             }
         }
 
index 272f8b4f64dbd65ef1ec6e291b40389a65904770..4d5c0d7ba0ae1130f253a8e05113c9078ed202e3 100644 (file)
@@ -14,6 +14,5 @@ log = { path = "../liblog" }
 rustc = { path = "../librustc" }
 rustc_back = { path = "../librustc_back" }
 rustc_const_eval = { path = "../librustc_const_eval" }
-rustc_i128 = { path = "../librustc_i128" }
 syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
index 18067cb86739b51cd0787c63973d8455cc183d92..8fb1740e66eacbfccf65cd8991bcd67aaea28130 100644 (file)
@@ -31,6 +31,7 @@
 #![cfg_attr(test, feature(test))]
 #![feature(box_patterns)]
 #![feature(box_syntax)]
+#![feature(i128_type)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
@@ -46,8 +47,6 @@
 extern crate rustc_const_eval;
 extern crate syntax_pos;
 
-extern crate rustc_i128;
-
 pub use rustc::lint;
 pub use rustc::middle;
 pub use rustc::session;
@@ -220,6 +219,10 @@ macro_rules! add_lint_group {
             id: LintId::of(LIFETIME_UNDERSCORE),
             reference: "issue #36892 <https://github.com/rust-lang/rust/issues/36892>",
         },
+        FutureIncompatibleInfo {
+            id: LintId::of(RESOLVE_TRAIT_ON_DEFAULTED_UNIT),
+            reference: "issue #39216 <https://github.com/rust-lang/rust/issues/39216>",
+        },
         FutureIncompatibleInfo {
             id: LintId::of(SAFE_EXTERN_STATICS),
             reference: "issue #36247 <https://github.com/rust-lang/rust/issues/35112>",
index 9669efa2d86b3954250d944ad213dadfb30ce37e..e42e038ea4d6c5a53779943ccb140522a9e3f442 100644 (file)
@@ -33,8 +33,6 @@
 
 use rustc::hir;
 
-use rustc_i128::{i128, u128};
-
 declare_lint! {
     UNUSED_COMPARISONS,
     Warn,
@@ -534,7 +532,7 @@ fn check_type_for_ffi(&self, cache: &mut FxHashSet<Ty<'tcx>>, ty: Ty<'tcx>) -> F
                            consider using a `*const libc::c_char`")
             }
 
-            ty::TyTuple(_) => {
+            ty::TyTuple(..) => {
                 FfiUnsafe("found Rust tuple type in foreign module; \
                            consider using a struct instead")
             }
index a85b47c8ada7a2c6c533567ed8ec160cfa9436af..28ce9126019ebdebb86da7436e62674b52e30474 100644 (file)
@@ -141,7 +141,7 @@ fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
 
         let t = cx.tables.expr_ty(&expr);
         let warned = match t.sty {
-            ty::TyTuple(ref tys) if tys.is_empty() => return,
+            ty::TyTuple(ref tys, _) if tys.is_empty() => return,
             ty::TyNever => return,
             ty::TyBool => return,
             ty::TyAdt(def, _) => {
index 2ee4cc49435611316e1a7e1d3b717dae609c8574..c74a9308e4eba4913aff70e4d598d8babf7d9c8b 100644 (file)
@@ -47,8 +47,6 @@ fn detect_llvm_link(llvm_config: &Path) -> (&'static str, Option<&'static str>)
 }
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
-
     let target = env::var("TARGET").expect("TARGET was not set");
     let llvm_config = env::var_os("LLVM_CONFIG")
         .map(PathBuf::from)
index caa27404086b99fdc6dfd1f5fe00770e26f652e5..8510b9f523cb5eb34af3910c2372a5511e8ae227 100644 (file)
@@ -8,6 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// FIXME: Rename 'DIGlobalVariable' to 'DIGlobalVariableExpression'
+// once support for LLVM 3.9 is dropped.
+//
+// This method was changed in this LLVM patch:
+// https://reviews.llvm.org/D26769
+
 use debuginfo::{DIBuilderRef, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
                 DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
                 DIGlobalVariable, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
@@ -804,7 +810,7 @@ pub fn LLVMRustBuildCatchSwitch(Builder: BuilderRef,
                                     Name: *const c_char)
                                     -> ValueRef;
     pub fn LLVMRustAddHandler(CatchSwitch: ValueRef, Handler: BasicBlockRef);
-    pub fn LLVMRustSetPersonalityFn(B: BuilderRef, Pers: ValueRef);
+    pub fn LLVMSetPersonalityFn(Func: ValueRef, Pers: ValueRef);
 
     // Add a case to the switch instruction
     pub fn LLVMAddCase(Switch: ValueRef, OnVal: ValueRef, Dest: BasicBlockRef);
index b1615b9e38bde11e25ad248d82363734bebc10c7..f300bf16145a736c92f95768eb911ada60f24c3e 100644 (file)
@@ -422,13 +422,3 @@ fn drop(&mut self) {
         }
     }
 }
-
-// The module containing the native LLVM dependencies, generated by the build system
-// Note that this must come after the rustllvm extern declaration so that
-// parts of LLVM that rustllvm depends on aren't thrown away by the linker.
-// Works to the above fix for #15460 to ensure LLVM dependencies that
-// are only used by rustllvm don't get stripped by the linker.
-#[cfg(not(cargobuild))]
-mod llvmdeps {
-    include! { env!("CFG_LLVM_LINKAGE_FILE") }
-}
index 4bd98c087f5171bcfc6c00a85665113cc575b39e..6f7f03ca216b9a3c83543c1448358e278f962285 100644 (file)
@@ -18,7 +18,6 @@ rustc_const_math = { path = "../librustc_const_math" }
 rustc_data_structures = { path = "../librustc_data_structures" }
 rustc_errors = { path = "../librustc_errors" }
 rustc_llvm = { path = "../librustc_llvm" }
-rustc_i128 = { path = "../librustc_i128" }
 serialize = { path = "../libserialize" }
 syntax = { path = "../libsyntax" }
 syntax_ext = { path = "../libsyntax_ext" }
index 161331b1728bcd0deb0973b3a52ff1d45e6faec1..81a4f7c93b6e91abe2eec44da15ef705b8dbccb9 100644 (file)
@@ -111,6 +111,13 @@ fn register_native_lib(sess: &Session,
                                        GateIssue::Language,
                                        "is feature gated");
     }
+    if lib.kind == cstore::NativeStaticNobundle && !sess.features.borrow().static_nobundle {
+        feature_gate::emit_feature_err(&sess.parse_sess,
+                                       "static_nobundle",
+                                       span.unwrap(),
+                                       GateIssue::Language,
+                                       "kind=\"static-nobundle\" is feature gated");
+    }
     cstore.add_used_library(lib);
 }
 
@@ -577,7 +584,7 @@ fn load_derive_macros(&mut self, root: &CrateRoot, dylib: Option<PathBuf>, span:
         use proc_macro::TokenStream;
         use proc_macro::__internal::Registry;
         use rustc_back::dynamic_lib::DynamicLibrary;
-        use syntax_ext::deriving::custom::CustomDerive;
+        use syntax_ext::deriving::custom::ProcMacroDerive;
         use syntax_ext::proc_macro_impl::AttrProcMacro;
 
         let path = match dylib {
@@ -609,8 +616,8 @@ fn register_custom_derive(&mut self,
                                       expand: fn(TokenStream) -> TokenStream,
                                       attributes: &[&'static str]) {
                 let attrs = attributes.iter().cloned().map(Symbol::intern).collect();
-                let derive = SyntaxExtension::CustomDerive(
-                    Box::new(CustomDerive::new(expand, attrs))
+                let derive = SyntaxExtension::ProcMacroDerive(
+                    Box::new(ProcMacroDerive::new(expand, attrs))
                 );
                 self.0.push((Symbol::intern(trait_name), Rc::new(derive)));
             }
@@ -688,6 +695,9 @@ fn register_statically_included_foreign_items(&mut self) {
         for id in self.get_foreign_items_of_kind(cstore::NativeStatic) {
             self.cstore.add_statically_included_foreign_item(id);
         }
+        for id in self.get_foreign_items_of_kind(cstore::NativeStaticNobundle) {
+            self.cstore.add_statically_included_foreign_item(id);
+        }
     }
 
     fn register_dllimport_foreign_items(&mut self) {
@@ -927,6 +937,7 @@ fn process_foreign_mod(&mut self, i: &ast::Item, fm: &ast::ForeignMod,
             }).and_then(|a| a.value_str()).map(Symbol::as_str);
             let kind = match kind.as_ref().map(|s| &s[..]) {
                 Some("static") => cstore::NativeStatic,
+                Some("static-nobundle") => cstore::NativeStaticNobundle,
                 Some("dylib") => cstore::NativeUnknown,
                 Some("framework") => cstore::NativeFramework,
                 Some(k) => {
index 761041ad7198aa6cdd3d146d3199280bc6d5998b..beba5faf3d03407c67f3c8558317a6b7188b1d97 100644 (file)
@@ -32,7 +32,7 @@
 use syntax_pos;
 
 pub use rustc::middle::cstore::{NativeLibrary, NativeLibraryKind, LinkagePreference};
-pub use rustc::middle::cstore::{NativeStatic, NativeFramework, NativeUnknown};
+pub use rustc::middle::cstore::NativeLibraryKind::*;
 pub use rustc::middle::cstore::{CrateSource, LinkMeta, LibSource};
 
 // A map from external crate numbers (as decoded from some crate file) to
index dd44ef202dc2733bcf7185dae4a2dd968c7f4dd2..f4a35ea5fd0cf396c38bee213e5aee611d270cd5 100644 (file)
@@ -42,7 +42,6 @@
 use syntax::ast;
 use syntax::codemap;
 use syntax_pos::{self, Span, BytePos, Pos, DUMMY_SP};
-use rustc_i128::{u128, i128};
 
 pub struct DecodeContext<'a, 'tcx: 'a> {
     opaque: opaque::Decoder<'a>,
index b9c2f0622b6988e70ff1fc5bd0c121948bd3352d..69e1bbd77662b8700ff88e94a46beee7fd1bd2a6 100644 (file)
@@ -43,8 +43,6 @@
 use rustc::hir::intravisit::{Visitor, NestedVisitorMap};
 use rustc::hir::intravisit;
 
-use rustc_i128::{u128, i128};
-
 use super::index_builder::{FromId, IndexBuilder, Untracked};
 
 pub struct EncodeContext<'a, 'tcx: 'a> {
index 484e0df658303a881d2c0dcfc1e6924002b14e6c..2fbdb8c0de676dec7f7921e3037e9c6410811c0f 100644 (file)
@@ -20,6 +20,7 @@
 #![feature(box_patterns)]
 #![feature(conservative_impl_trait)]
 #![feature(core_intrinsics)]
+#![feature(i128_type)]
 #![feature(proc_macro_internals)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
@@ -44,7 +45,6 @@
 extern crate rustc_const_math;
 extern crate rustc_data_structures;
 extern crate rustc_llvm;
-extern crate rustc_i128;
 
 mod diagnostics;
 
index d9c639f2bc573dbc4d853e32b62d8c27fb165730..d13628e9ce7a3c0787997ae62a42ce5e4e8694ef 100644 (file)
@@ -28,8 +28,6 @@
 
 use std::marker::PhantomData;
 
-use rustc_i128::u128;
-
 pub fn rustc_version() -> String {
     format!("rustc {}",
             option_env!("CFG_VERSION").unwrap_or("unknown version"))
index 9f49d02f86cecb6aa09f83e1c771351e11c6cfe4..531be0b6ae9f5f620528982f7edf7f829b7f7bb0 100644 (file)
@@ -16,6 +16,5 @@ rustc_const_eval = { path = "../librustc_const_eval" }
 rustc_const_math = { path = "../librustc_const_math" }
 rustc_data_structures = { path = "../librustc_data_structures" }
 rustc_bitflags = { path = "../librustc_bitflags" }
-rustc_i128 = { path = "../librustc_i128" }
 syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
index 73d3875ba2384866ffbd9e14d034d739b9bffe53..121d592da0316881621fc53468fffc0da11eca32 100644 (file)
@@ -16,8 +16,6 @@
 impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
     pub fn ast_block(&mut self,
                      destination: &Lvalue<'tcx>,
-                     // FIXME(#32959): temporary measure for the issue
-                     dest_is_unit: bool,
                      mut block: BasicBlock,
                      ast_block: &'tcx hir::Block)
                      -> BlockAnd<()> {
@@ -83,8 +81,7 @@ pub fn ast_block(&mut self,
             // of the block.
             if let Some(expr) = expr {
                 unpack!(block = this.into(destination, block, expr));
-            } else if dest_is_unit {
-                // FIXME(#31472)
+            } else {
                 let source_info = this.source_info(span);
                 this.cfg.push_assign_unit(block, source_info, destination);
             }
index 48690a275c205fca33e0a2d192e4a038e3e67586..dad1d713168cd43e39c66608a1909ba8440d9f4c 100644 (file)
@@ -15,7 +15,6 @@
 use rustc_const_math::{ConstMathErr, Op};
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::indexed_vec::Idx;
-use rustc_i128::i128;
 
 use build::{BlockAnd, BlockAndExtension, Builder};
 use build::expr::category::{Category, RvalueFunc};
@@ -258,7 +257,7 @@ pub fn build_binary_op(&mut self, mut block: BasicBlock,
         let source_info = self.source_info(span);
         let bool_ty = self.hir.bool_ty();
         if self.hir.check_overflow() && op.is_checkable() && ty.is_integral() {
-            let result_tup = self.hir.tcx().intern_tup(&[ty, bool_ty]);
+            let result_tup = self.hir.tcx().intern_tup(&[ty, bool_ty], false);
             let result_value = self.temp(result_tup);
 
             self.cfg.push_assign(block, source_info,
index 24b9c955658fd831d87e0ca59c9daf94310e07ea..3d4af259ec9f72550ed8ce17f51692872bc00392 100644 (file)
@@ -40,7 +40,7 @@ pub fn into_expr(&mut self,
                 this.in_scope(extent, block, |this| this.into(destination, block, value))
             }
             ExprKind::Block { body: ast_block } => {
-                this.ast_block(destination, expr.ty.is_nil(), block, ast_block)
+                this.ast_block(destination, block, ast_block)
             }
             ExprKind::Match { discriminant, arms } => {
                 this.match_expr(destination, expr_span, block, discriminant, arms)
index e7764d58d75ff55ac6dde6c9f307f5bfe88659eb..61ba9d90fef388bbc6f0a5564f7a1ee5f54c835d 100644 (file)
@@ -22,6 +22,7 @@
 
 #![feature(associated_consts)]
 #![feature(box_patterns)]
+#![feature(i128_type)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
@@ -40,8 +41,6 @@
 extern crate rustc_const_math;
 extern crate rustc_const_eval;
 
-extern crate rustc_i128;
-
 pub mod diagnostics;
 
 pub mod build;
index c71255dcc7c61fec7d5c15fd4a05f8652ea53723..b7f90682c7c74a5382a4824f2d48213125dada4c 100644 (file)
@@ -139,7 +139,7 @@ fn visit_nested_body(&mut self, body_id: hir::BodyId) {
 
             let mir = tcx.alloc_mir(mir);
             let def_id = tcx.hir.local_def_id(src.item_id());
-            assert!(tcx.mir_map.borrow_mut().insert(def_id, mir).is_none());
+            tcx.mir_map.borrow_mut().insert(def_id, mir);
         });
 
         let body = self.tcx.hir.body(body_id);
index c9195f29f1784481e0774d8b23ccfaba7d61a523..529fe564af02bc54e4dce16e0e046298fe381816 100644 (file)
@@ -282,7 +282,7 @@ fn field_ty(&mut self,
                         })
                     }
                 }
-                ty::TyTuple(tys) => {
+                ty::TyTuple(tys, _) => {
                     return match tys.get(field.index()) {
                         Some(&ty) => Ok(ty),
                         None => Err(FieldAccessError::OutOfRange {
index eb6c7f4bed5deaddb2cdeec5528afc97a4f3d2b0..4679b6be88b6f0835a06e410c37af1082423455a 100644 (file)
@@ -559,7 +559,7 @@ fn process_legacy_macro_imports(&mut self, item: &Item, module: Module<'a>, expa
                       "an `extern crate` loading macros must be at the crate root");
         } else if !self.use_extern_macros && !used &&
                   self.session.cstore.dep_kind(module.def_id().unwrap().krate).macros_only() {
-            let msg = "custom derive crates and `#[no_link]` crates have no effect without \
+            let msg = "proc macro crates and `#[no_link]` crates have no effect without \
                        `#[macro_use]`";
             self.session.span_warn(item.span, msg);
             used = true; // Avoid the normal unused extern crate warning
index 682b3ff834fad1eca4ddb76284ed08d12881cf97..ea3112b2463f8ba27007e6e14405c475ef93e153 100644 (file)
@@ -250,6 +250,32 @@ fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, force: bool)
         }
         result
     }
+
+    fn resolve_builtin_macro(&mut self, tname: Name) -> Result<Rc<SyntaxExtension>, Determinacy> {
+        match self.builtin_macros.get(&tname).cloned() {
+            Some(binding) => Ok(binding.get_macro(self)),
+            None => Err(Determinacy::Undetermined),
+        }
+    }
+
+    fn resolve_derive_macro(&mut self, scope: Mark, path: &ast::Path, force: bool)
+                            -> Result<Rc<SyntaxExtension>, Determinacy> {
+        let ast::Path { span, .. } = *path;
+        match self.resolve_macro(scope, path, false) {
+            Ok(ext) => match *ext {
+                SyntaxExtension::BuiltinDerive(..) |
+                SyntaxExtension::ProcMacroDerive(..) => Ok(ext),
+                _ => Err(Determinacy::Determined),
+            },
+            Err(Determinacy::Undetermined) if force => {
+                let msg = format!("cannot find derive macro `{}` in this scope", path);
+                let mut err = self.session.struct_span_err(span, &msg);
+                err.emit();
+                Err(Determinacy::Determined)
+            },
+            Err(err) => Err(err),
+        }
+    }
 }
 
 impl<'a> Resolver<'a> {
index 65cdeb9253d89ed4c1d2ab79d2d6cd75756be10e..dbc8bca548b769a1334f15facf53288a0a7e8845 100644 (file)
@@ -639,7 +639,19 @@ fn finalize_import(&mut self, directive: &'b ImportDirective<'b>) -> Option<Stri
                 let names = resolutions.iter().filter_map(|(&(ref i, _), resolution)| {
                     if *i == ident { return None; } // Never suggest the same name
                     match *resolution.borrow() {
-                        NameResolution { binding: Some(_), .. } => Some(&i.name),
+                        NameResolution { binding: Some(name_binding), .. } => {
+                            match name_binding.kind {
+                                NameBindingKind::Import { binding, .. } => {
+                                    match binding.kind {
+                                        // Never suggest the name that has binding error
+                                        // i.e. the name that cannot be previously resolved
+                                        NameBindingKind::Def(Def::Err) => return None,
+                                        _ => Some(&i.name),
+                                    }
+                                },
+                                _ => Some(&i.name),
+                            }
+                        },
                         NameResolution { single_imports: SingleImports::None, .. } => None,
                         _ => Some(&i.name),
                     }
index f128167bbf621b50e074a27a3d34bd2227ddaf70..41f91a1d2acc17ac234f00824cd88655868bde26 100644 (file)
@@ -1440,7 +1440,7 @@ fn visit_expr(&mut self, ex: &'l ast::Expr) {
                             }.lower(self.tcx));
                         }
                     }
-                    ty::TyTuple(_) => {}
+                    ty::TyTuple(..) => {}
                     _ => span_bug!(ex.span,
                                    "Expected struct or tuple type, found {:?}",
                                    ty),
index 8d0cdd1678c730a39c19175cc9dc3f943aef4fc9..ebb33a12c870397fe2dbd2331cb95de79cd0f67d 100644 (file)
@@ -430,6 +430,9 @@ pub fn get_trait_ref_data(&self,
                               -> Option<TypeRefData> {
         self.lookup_ref_id(trait_ref.ref_id).and_then(|def_id| {
             let span = trait_ref.path.span;
+            if generated_code(span) {
+                return None;
+            }
             let sub_span = self.span_utils.sub_span_for_type_name(span).or(Some(span));
             filter!(self.span_utils, sub_span, span, None);
             Some(TypeRefData {
index 36d2ba4f3676b4b9c765efcf3956f9c988375a47..fa48a63b6b8f5865350fd879a18523de28c22fc4 100644 (file)
@@ -21,7 +21,6 @@ rustc_data_structures = { path = "../librustc_data_structures" }
 rustc_errors = { path = "../librustc_errors" }
 rustc_incremental = { path = "../librustc_incremental" }
 rustc_llvm = { path = "../librustc_llvm" }
-rustc_i128 = { path = "../librustc_i128" }
 rustc_platform_intrinsics = { path = "../librustc_platform_intrinsics" }
 syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
index d392ebaa33d422dfb045ee80a01f67155bdbd96f..a476b1d29e5fb823ef8ffb9a605c2ab474210ba5 100644 (file)
@@ -367,7 +367,7 @@ pub fn unadjusted<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             assert!(!sig.variadic && extra_args.is_empty());
 
             match sig.inputs().last().unwrap().sty {
-                ty::TyTuple(ref tupled_arguments) => {
+                ty::TyTuple(ref tupled_arguments, _) => {
                     inputs = &sig.inputs()[0..sig.inputs().len() - 1];
                     &tupled_arguments[..]
                 }
index c3b9a56ac9778569b4d1e4e835ff2571fbcae58d..bc1e07e708c248e5dc051b450ec4fa6d5230ff85 100644 (file)
@@ -72,7 +72,7 @@ pub fn compute_fields<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>,
                 monomorphize::field_ty(cx.tcx(), substs, f)
             }).collect::<Vec<_>>()
         },
-        ty::TyTuple(fields) => fields.to_vec(),
+        ty::TyTuple(fields, _) => fields.to_vec(),
         ty::TyClosure(def_id, substs) => {
             if variant_index > 0 { bug!("{} is a closure, which only has one variant", t);}
             substs.upvar_tys(def_id, cx.tcx()).collect()
index defbb44448a9f3a5f4b7ce77ecc494086f5a9f61..4ddf8a883bc488781efd48a31d5758eefb7460b0 100644 (file)
@@ -29,6 +29,7 @@
 use rustc::hir::def_id::CrateNum;
 use rustc::hir::svh::Svh;
 use rustc_back::tempdir::TempDir;
+use rustc_back::PanicStrategy;
 use rustc_incremental::IncrementalHashesMap;
 
 use std::ascii;
@@ -476,6 +477,7 @@ fn link_rlib<'a>(sess: &'a Session,
     for lib in sess.cstore.used_libraries() {
         match lib.kind {
             NativeLibraryKind::NativeStatic => {}
+            NativeLibraryKind::NativeStaticNobundle |
             NativeLibraryKind::NativeFramework |
             NativeLibraryKind::NativeUnknown => continue,
         }
@@ -674,6 +676,7 @@ fn link_staticlib(sess: &Session, objects: &[PathBuf], out_filename: &Path,
 
     for lib in all_native_libs.iter().filter(|l| relevant_lib(sess, l)) {
         let name = match lib.kind {
+            NativeLibraryKind::NativeStaticNobundle |
             NativeLibraryKind::NativeUnknown => "library",
             NativeLibraryKind::NativeFramework => "framework",
             // These are included, no need to print them
@@ -712,6 +715,11 @@ fn link_natively(sess: &Session,
         cmd.arg(root.join(obj));
     }
 
+    if sess.target.target.options.is_like_emscripten &&
+       sess.panic_strategy() == PanicStrategy::Abort {
+        cmd.args(&["-s", "DISABLE_EXCEPTION_CATCHING=1"]);
+    }
+
     {
         let mut linker = trans.linker_info.to_linker(&mut cmd, &sess);
         link_args(&mut *linker, sess, crate_type, tmpdir,
@@ -894,7 +902,7 @@ fn link_args(cmd: &mut Linker,
     // on other dylibs (e.g. other native deps).
     add_local_native_libraries(cmd, sess);
     add_upstream_rust_crates(cmd, sess, crate_type, tmpdir);
-    add_upstream_native_libraries(cmd, sess);
+    add_upstream_native_libraries(cmd, sess, crate_type);
 
     // # Telling the linker what we're doing
 
@@ -985,6 +993,7 @@ fn add_local_native_libraries(cmd: &mut Linker, sess: &Session) {
         match lib.kind {
             NativeLibraryKind::NativeUnknown => cmd.link_dylib(&lib.name.as_str()),
             NativeLibraryKind::NativeFramework => cmd.link_framework(&lib.name.as_str()),
+            NativeLibraryKind::NativeStaticNobundle => cmd.link_staticlib(&lib.name.as_str()),
             NativeLibraryKind::NativeStatic => bug!(),
         }
     }
@@ -1210,7 +1219,7 @@ fn add_dynamic_crate(cmd: &mut Linker, sess: &Session, cratepath: &Path) {
 // generic function calls a native function, then the generic function must
 // be instantiated in the target crate, meaning that the native symbol must
 // also be resolved in the target crate.
-fn add_upstream_native_libraries(cmd: &mut Linker, sess: &Session) {
+fn add_upstream_native_libraries(cmd: &mut Linker, sess: &Session, crate_type: config::CrateType) {
     // Be sure to use a topological sorting of crates because there may be
     // interdependencies between native libraries. When passing -nodefaultlibs,
     // for example, almost all native libraries depend on libc, so we have to
@@ -1220,6 +1229,9 @@ fn add_upstream_native_libraries(cmd: &mut Linker, sess: &Session) {
     // This passes RequireStatic, but the actual requirement doesn't matter,
     // we're just getting an ordering of crate numbers, we're not worried about
     // the paths.
+    let formats = sess.dependency_formats.borrow();
+    let data = formats.get(&crate_type).unwrap();
+
     let crates = sess.cstore.used_crates(LinkagePreference::RequireStatic);
     for (cnum, _) in crates {
         for lib in sess.cstore.native_libraries(cnum) {
@@ -1229,7 +1241,15 @@ fn add_upstream_native_libraries(cmd: &mut Linker, sess: &Session) {
             match lib.kind {
                 NativeLibraryKind::NativeUnknown => cmd.link_dylib(&lib.name.as_str()),
                 NativeLibraryKind::NativeFramework => cmd.link_framework(&lib.name.as_str()),
-
+                NativeLibraryKind::NativeStaticNobundle => {
+                    // Link "static-nobundle" native libs only if the crate they originate from
+                    // is being linked statically to the current crate.  If it's linked dynamically
+                    // or is an rlib already included via some other dylib crate, the symbols from
+                    // native libs will have already been included in that dylib.
+                    if data[cnum.as_usize() - 1] == Linkage::Static {
+                        cmd.link_staticlib(&lib.name.as_str())
+                    }
+                },
                 // ignore statically included native libraries here as we've
                 // already included them when we included the rust library
                 // previously
index a147b598940a234100258990cb4e2c53e0cf764c..7f352f1da517d215215c740b0d82286a05f0724d 100644 (file)
@@ -450,6 +450,7 @@ fn export_symbols(&mut self,
             writeln!(f, "LIBRARY")?;
             writeln!(f, "EXPORTS")?;
             for symbol in self.info.exports[&crate_type].iter() {
+                debug!("  _{}", symbol);
                 writeln!(f, "  {}", symbol)?;
             }
             Ok(())
index cf7f3e9501d1a6e677a2576eac5e93681c4f84f4..c113716ca5c74295339868d95bda27492dbcc0d3 100644 (file)
@@ -1107,7 +1107,7 @@ pub fn add_handler(&self, catch_switch: ValueRef, handler: BasicBlockRef) {
 
     pub fn set_personality_fn(&self, personality: ValueRef) {
         unsafe {
-            llvm::LLVMRustSetPersonalityFn(self.llbuilder, personality);
+            llvm::LLVMSetPersonalityFn(self.llfn(), personality);
         }
     }
 
index 58d0c46850353697ddf9d908ac330ef682e438ff..c6b86c6ba48deed1ee9f5a775409b5e0c8f6fbb2 100644 (file)
@@ -485,7 +485,7 @@ fn trans_fn_pointer_shim<'a, 'tcx>(
         }
     };
     let sig = tcx.erase_late_bound_regions_and_normalize(sig);
-    let tuple_input_ty = tcx.intern_tup(sig.inputs());
+    let tuple_input_ty = tcx.intern_tup(sig.inputs(), false);
     let sig = tcx.mk_fn_sig(
         [bare_fn_ty_maybe_ref, tuple_input_ty].iter().cloned(),
         sig.output(),
index 392c270c130a857b09886bc64e51ad349a910fb2..89f5c00e9c11a6c6bf1e911f6c6e3e61880a75f9 100644 (file)
@@ -823,7 +823,7 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
                 output.push(TransItem::DropGlue(DropGlueKind::Ty(inner_type)));
             }
         }
-        ty::TyTuple(args) => {
+        ty::TyTuple(args, _) => {
             for arg in args {
                 let arg = glue::get_drop_glue_type(scx, arg);
                 if scx.type_needs_drop(arg) {
index 0ba94fdfe635cf5aca3968f15e836fa18597e319..64100ed4191cc3645b94337814865e0c186bc5a4 100644 (file)
@@ -40,8 +40,6 @@
 use syntax::symbol::InternedString;
 use syntax_pos::Span;
 
-use rustc_i128::u128;
-
 pub use context::{CrateContext, SharedCrateContext};
 
 pub fn type_is_fat_ptr<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -> bool {
@@ -95,7 +93,7 @@ pub fn type_pair_fields<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>)
                 }
             }))
         }
-        ty::TyTuple(tys) => {
+        ty::TyTuple(tys, _) => {
             if tys.len() != 2 {
                 return None;
             }
@@ -231,15 +229,10 @@ pub fn C_integral(t: Type, u: u64, sign_extend: bool) -> ValueRef {
     }
 }
 
-pub fn C_big_integral(t: Type, u: u128, sign_extend: bool) -> ValueRef {
-    if ::std::mem::size_of::<u128>() == 16 {
-        unsafe {
-            let words = [u as u64, u.wrapping_shr(64) as u64];
-            llvm::LLVMConstIntOfArbitraryPrecision(t.to_ref(), 2, words.as_ptr())
-        }
-    } else {
-        // SNAP: remove after snapshot
-        C_integral(t, u as u64, sign_extend)
+pub fn C_big_integral(t: Type, u: u128) -> ValueRef {
+    unsafe {
+        let words = [u as u64, u.wrapping_shr(64) as u64];
+        llvm::LLVMConstIntOfArbitraryPrecision(t.to_ref(), 2, words.as_ptr())
     }
 }
 
@@ -399,13 +392,6 @@ fn is_const_integral(v: ValueRef) -> bool {
 }
 
 #[inline]
-#[cfg(stage0)]
-fn hi_lo_to_u128(lo: u64, _: u64) -> u128 {
-    lo as u128
-}
-
-#[inline]
-#[cfg(not(stage0))]
 fn hi_lo_to_u128(lo: u64, hi: u64) -> u128 {
     ((hi as u128) << 64) | (lo as u128)
 }
index b7e319f2de43431cf9ef8190611dc227b9aab659..c83e2f4854bf5cda8cbfd195df2b58d6462b0a84 100644 (file)
@@ -383,7 +383,7 @@ fn subroutine_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 
     // return type
     signature_metadata.push(match signature.output().sty {
-        ty::TyTuple(ref tys) if tys.is_empty() => ptr::null_mut(),
+        ty::TyTuple(ref tys, _) if tys.is_empty() => ptr::null_mut(),
         _ => type_metadata(cx, signature.output(), span)
     });
 
@@ -528,7 +528,7 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         ty::TyFloat(_) => {
             MetadataCreationResult::new(basic_type_metadata(cx, t), false)
         }
-        ty::TyTuple(ref elements) if elements.is_empty() => {
+        ty::TyTuple(ref elements, _) if elements.is_empty() => {
             MetadataCreationResult::new(basic_type_metadata(cx, t), false)
         }
         ty::TyArray(typ, len) => {
@@ -603,7 +603,7 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                     usage_site_span).finalize(cx)
             }
         },
-        ty::TyTuple(ref elements) => {
+        ty::TyTuple(ref elements, _) => {
             prepare_tuple_metadata(cx,
                                    t,
                                    &elements[..],
@@ -706,7 +706,7 @@ fn basic_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 
     let (name, encoding) = match t.sty {
         ty::TyNever => ("!", DW_ATE_unsigned),
-        ty::TyTuple(ref elements) if elements.is_empty() =>
+        ty::TyTuple(ref elements, _) if elements.is_empty() =>
             ("()", DW_ATE_unsigned),
         ty::TyBool => ("bool", DW_ATE_boolean),
         ty::TyChar => ("char", DW_ATE_unsigned_char),
index e9468e56637d22cf1859fe79ebc91a72c666bb08..501f891befa8dafa279002972a0610e9571ac39d 100644 (file)
@@ -295,7 +295,7 @@ fn get_function_signature<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 
         // Return type -- llvm::DIBuilder wants this at index 0
         signature.push(match sig.output().sty {
-            ty::TyTuple(ref tys) if tys.is_empty() => ptr::null_mut(),
+            ty::TyTuple(ref tys, _) if tys.is_empty() => ptr::null_mut(),
             _ => type_metadata(cx, sig.output(), syntax_pos::DUMMY_SP)
         });
 
@@ -311,7 +311,7 @@ fn get_function_signature<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         }
 
         if abi == Abi::RustCall && !sig.inputs().is_empty() {
-            if let ty::TyTuple(args) = sig.inputs()[sig.inputs().len() - 1].sty {
+            if let ty::TyTuple(args, _) = sig.inputs()[sig.inputs().len() - 1].sty {
                 for &argument_type in args {
                     signature.push(type_metadata(cx, argument_type, syntax_pos::DUMMY_SP));
                 }
index 8e11bf6b8976a8c3c822c18cec94de6966458fbc..018bbb6e97d345167e46c9edfec272fa803f58f4 100644 (file)
@@ -48,7 +48,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             push_item_name(cx, def.did, qualified, output);
             push_type_params(cx, substs, output);
         },
-        ty::TyTuple(component_types) => {
+        ty::TyTuple(component_types, _) => {
             output.push('(');
             for &component_type in component_types {
                 push_debuginfo_type_name(cx, component_type, true, output);
index 3ee2497009f6513135438a7bb31ccd1bf75d683e..8d634c0e292ad7f35e5cfab404c75c89c88ecfc1 100644 (file)
@@ -60,8 +60,7 @@ pub fn bytes_to_bits(bytes: u64) -> u64 {
 #[inline]
 pub fn debug_context<'a, 'tcx>(cx: &'a CrateContext<'a, 'tcx>)
                            -> &'a CrateDebugContext<'tcx> {
-    let debug_context: &'a CrateDebugContext<'tcx> = cx.dbg_cx().as_ref().unwrap();
-    debug_context
+    cx.dbg_cx().as_ref().unwrap()
 }
 
 #[inline]
index 1415ca6029f530f885a8f469243db2aaf4dc6dac..fdefd37549ced1251245822615473da33c8f46ab 100644 (file)
@@ -442,7 +442,7 @@ fn iter_variant_fields<'a, 'tcx>(
             cx = tvec::slice_for_each(&cx, ptr.llval, unit_ty, ptr.llextra,
                 |bb, vv| drop_ty(bb, LvalueRef::new_sized_ty(vv, unit_ty)));
         }
-        ty::TyTuple(ref args) => {
+        ty::TyTuple(ref args, _) => {
             for (i, arg) in args.iter().enumerate() {
                 let llfld_a = ptr.trans_field_ptr(&cx, i);
                 drop_ty(&cx, LvalueRef::new_sized_ty(llfld_a, *arg));
index 842a21e98db46f12686db159bd8d27cb9421afcd..37f63e7499689f1cee16ccc3324584bffbd962a0 100644 (file)
@@ -33,8 +33,6 @@
 use rustc::session::Session;
 use syntax_pos::Span;
 
-use rustc_i128::u128;
-
 use std::cmp::Ordering;
 use std::iter;
 
index 659dbb441ee35000095a2bd69d8290b081d038bf..21c92cb4a4ad2329b5f06f558012a9db69fa1a05 100644 (file)
@@ -29,6 +29,7 @@
 #![feature(const_fn)]
 #![feature(custom_attribute)]
 #![allow(unused_attributes)]
+#![feature(i128_type)]
 #![feature(libc)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
@@ -53,7 +54,6 @@
 #[macro_use]
 #[no_link]
 extern crate rustc_bitflags;
-extern crate rustc_i128;
 
 #[macro_use] extern crate log;
 #[macro_use] extern crate syntax;
index 7d4a1ab5ae70e1f7b991934c94d1e0dbf036f60a..027779aca63e4e03f1432873278301674aedebc2 100644 (file)
@@ -695,7 +695,7 @@ fn trans_arguments_untupled(&mut self,
         let tuple = self.trans_operand(bcx, operand);
 
         let arg_types = match tuple.ty.sty {
-            ty::TyTuple(ref tys) => tys,
+            ty::TyTuple(ref tys, _) => tys,
             _ => span_bug!(self.mir.span,
                            "bad final argument to \"rust-call\" fn {:?}", tuple.ty)
         };
index 9ac2bea3b82fbc146495f46a7b6a5ed89db221dd..f92faaa0508a653ee035e2a6d8f3961273c122a8 100644 (file)
@@ -43,8 +43,6 @@
 use super::operand::{OperandRef, OperandValue};
 use super::MirContext;
 
-use rustc_i128::{u128, i128};
-
 /// A sized constant rvalue.
 /// The LLVM type might not be the same for a single Rust type,
 /// e.g. each enum variant would have its own LLVM struct type.
@@ -77,7 +75,7 @@ pub fn from_constval<'a>(ccx: &CrateContext<'a, 'tcx>,
             ConstVal::Integral(I16(v)) => C_integral(Type::i16(ccx), v as u64, true),
             ConstVal::Integral(I32(v)) => C_integral(Type::i32(ccx), v as u64, true),
             ConstVal::Integral(I64(v)) => C_integral(Type::i64(ccx), v as u64, true),
-            ConstVal::Integral(I128(v)) => C_big_integral(Type::i128(ccx), v as u128, true),
+            ConstVal::Integral(I128(v)) => C_big_integral(Type::i128(ccx), v as u128),
             ConstVal::Integral(Isize(v)) => {
                 let i = v.as_i64(ccx.tcx().sess.target.int_type);
                 C_integral(Type::int(ccx), i as u64, true)
@@ -86,7 +84,7 @@ pub fn from_constval<'a>(ccx: &CrateContext<'a, 'tcx>,
             ConstVal::Integral(U16(v)) => C_integral(Type::i16(ccx), v as u64, false),
             ConstVal::Integral(U32(v)) => C_integral(Type::i32(ccx), v as u64, false),
             ConstVal::Integral(U64(v)) => C_integral(Type::i64(ccx), v, false),
-            ConstVal::Integral(U128(v)) => C_big_integral(Type::i128(ccx), v, false),
+            ConstVal::Integral(U128(v)) => C_big_integral(Type::i128(ccx), v),
             ConstVal::Integral(Usize(v)) => {
                 let u = v.as_u64(ccx.tcx().sess.target.uint_type);
                 C_integral(Type::int(ccx), u, false)
@@ -737,7 +735,7 @@ fn const_rvalue(&self, rvalue: &mir::Rvalue<'tcx>,
                 let rhs = self.const_operand(rhs, span)?;
                 let ty = lhs.ty;
                 let val_ty = op.ty(tcx, lhs.ty, rhs.ty);
-                let binop_ty = tcx.intern_tup(&[val_ty, tcx.types.bool]);
+                let binop_ty = tcx.intern_tup(&[val_ty, tcx.types.bool], false);
                 let (lhs, rhs) = (lhs.llval, rhs.llval);
                 assert!(!ty.is_fp());
 
index eedd7956805b6a52fb7a43a074e27496ae387d7a..8a0a97a56343955c8fd258b09097da0b76912171 100644 (file)
@@ -319,7 +319,9 @@ pub fn trans_mir<'a, 'tcx: 'a>(
     mircx.cleanup_kinds.iter_enumerated().map(|(bb, cleanup_kind)| {
         if let CleanupKind::Funclet = *cleanup_kind {
             let bcx = mircx.get_builder(bb);
-            bcx.set_personality_fn(mircx.ccx.eh_personality());
+            unsafe {
+                llvm::LLVMSetPersonalityFn(mircx.llfn, mircx.ccx.eh_personality());
+            }
             if base::wants_msvc_seh(ccx.sess()) {
                 return Some(Funclet::new(bcx.cleanup_pad(None, &[])));
             }
@@ -382,7 +384,7 @@ fn arg_local_refs<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
             // individual LLVM function arguments.
 
             let tupled_arg_tys = match arg_ty.sty {
-                ty::TyTuple(ref tys) => tys,
+                ty::TyTuple(ref tys, _) => tys,
                 _ => bug!("spread argument isn't a tuple?!")
             };
 
index 1b97a8d010cfeafbe13f12ae03c000505beec03c..81b241b4851756a2441c572254900f3a1331afd3 100644 (file)
@@ -402,7 +402,7 @@ pub fn trans_rvalue_operand(&mut self,
                                                              lhs.immediate(), rhs.immediate(),
                                                              lhs.ty);
                 let val_ty = op.ty(bcx.tcx(), lhs.ty, rhs.ty);
-                let operand_ty = bcx.tcx().intern_tup(&[val_ty, bcx.tcx().types.bool]);
+                let operand_ty = bcx.tcx().intern_tup(&[val_ty, bcx.tcx().types.bool], false);
                 let operand = OperandRef {
                     val: result,
                     ty: operand_ty
index d58a93e3cb71c47d4ee758e7887b8648dc10ac28..04a6cb27501b3eab4000d02358d4d2103ca67948 100644 (file)
@@ -409,7 +409,7 @@ pub fn push_type_name(&self, t: Ty<'tcx>, output: &mut String) {
                 self.push_def_path(adt_def.did, output);
                 self.push_type_params(substs, iter::empty(), output);
             },
-            ty::TyTuple(component_types) => {
+            ty::TyTuple(component_types, _) => {
                 output.push('(');
                 for &component_type in component_types {
                     self.push_type_name(component_type, output);
index 4df0e989ada9975040bbe9eea3e350838f1f92af..87af3b6c5e1535bc4748624e367d36b73deb446b 100644 (file)
@@ -74,7 +74,7 @@ pub fn sizing_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Typ
             Type::array(&llty, size)
         }
 
-        ty::TyTuple(ref tys) if tys.is_empty() => {
+        ty::TyTuple(ref tys, _) if tys.is_empty() => {
             Type::nil(cx)
         }
 
@@ -276,7 +276,7 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
         let sig = cx.tcx().erase_late_bound_regions_and_normalize(&f.sig);
         FnType::new(cx, f.abi, &sig, &[]).llvm_type(cx).ptr_to()
       }
-      ty::TyTuple(ref tys) if tys.is_empty() => Type::nil(cx),
+      ty::TyTuple(ref tys, _) if tys.is_empty() => Type::nil(cx),
       ty::TyTuple(..) => {
           adt::type_of(cx, t)
       }
index bb9a487802e7b686c207cdff0ed41be19a7ac154..fb6d28448a0c5524cbaf6e78c0a1d0d1656c46fd 100644 (file)
@@ -29,7 +29,6 @@
 use hir::def::Def;
 use hir::def_id::DefId;
 use middle::resolve_lifetime as rl;
-use rustc::lint;
 use rustc::ty::subst::{Kind, Subst, Substs};
 use rustc::traits;
 use rustc::ty::{self, Ty, TyCtxt, ToPredicate, TypeFoldable};
@@ -148,20 +147,9 @@ pub fn ast_region_to_region(&self,
             }
 
             Some(&rl::Region::LateBound(debruijn, id)) => {
-                // If this region is declared on a function, it will have
-                // an entry in `late_bound`, but if it comes from
-                // `for<'a>` in some type or something, it won't
-                // necessarily have one. In that case though, we won't be
-                // changed from late to early bound, so we can just
-                // substitute false.
-                let issue_32330 = tcx.named_region_map
-                                     .late_bound
-                                     .get(&id)
-                                     .cloned()
-                                     .unwrap_or(ty::Issue32330::WontChange);
                 let name = tcx.hir.name(id);
                 tcx.mk_region(ty::ReLateBound(debruijn,
-                    ty::BrNamed(tcx.hir.local_def_id(id), name, issue_32330)))
+                    ty::BrNamed(tcx.hir.local_def_id(id), name)))
             }
 
             Some(&rl::Region::LateBoundAnon(debruijn, index)) => {
@@ -177,17 +165,10 @@ pub fn ast_region_to_region(&self,
             }
 
             Some(&rl::Region::Free(scope, id)) => {
-                // As in Region::LateBound above, could be missing for some late-bound
-                // regions, but also for early-bound regions.
-                let issue_32330 = tcx.named_region_map
-                                     .late_bound
-                                     .get(&id)
-                                     .cloned()
-                                     .unwrap_or(ty::Issue32330::WontChange);
                 let name = tcx.hir.name(id);
                 tcx.mk_region(ty::ReFree(ty::FreeRegion {
                     scope: scope.to_code_extent(&tcx.region_maps),
-                    bound_region: ty::BrNamed(tcx.hir.local_def_id(id), name, issue_32330)
+                    bound_region: ty::BrNamed(tcx.hir.local_def_id(id), name)
                 }))
 
                     // (*) -- not late-bound, won't change
@@ -421,7 +402,7 @@ fn convert_parenthesized_parameters(&self,
             span: output_span
         };
 
-        (self.tcx().mk_ty(ty::TyTuple(inputs)), output_binding)
+        (self.tcx().mk_ty(ty::TyTuple(inputs, false)), output_binding)
     }
 
     /// Instantiates the path for the given trait reference, assuming that it's
@@ -566,7 +547,7 @@ fn trait_defines_associated_type_named(&self,
 
     fn ast_type_binding_to_poly_projection_predicate(
         &self,
-        path_id: ast::NodeId,
+        _path_id: ast::NodeId,
         trait_ref: ty::PolyTraitRef<'tcx>,
         binding: &ConvertedBinding<'tcx>)
         -> Result<ty::PolyProjectionPredicate<'tcx>, ErrorReported>
@@ -602,7 +583,7 @@ fn ast_type_binding_to_poly_projection_predicate(
         debug!("late_bound_in_ty = {:?}", late_bound_in_ty);
         for br in late_bound_in_ty.difference(&late_bound_in_trait_ref) {
             let br_name = match *br {
-                ty::BrNamed(_, name, _) => name,
+                ty::BrNamed(_, name) => name,
                 _ => {
                     span_bug!(
                         binding.span,
@@ -610,13 +591,13 @@ fn ast_type_binding_to_poly_projection_predicate(
                         br);
                 }
             };
-            tcx.sess.add_lint(
-                lint::builtin::HR_LIFETIME_IN_ASSOC_TYPE,
-                path_id,
-                binding.span,
-                format!("binding for associated type `{}` references lifetime `{}`, \
-                         which does not appear in the trait input types",
-                        binding.item_name, br_name));
+            struct_span_err!(tcx.sess,
+                             binding.span,
+                             E0582,
+                             "binding for associated type `{}` references lifetime `{}`, \
+                              which does not appear in the trait input types",
+                             binding.item_name, br_name)
+                .emit();
         }
 
         // Simple case: X is defined in the current trait.
@@ -1170,7 +1151,7 @@ pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
                 tcx.types.never
             },
             hir::TyTup(ref fields) => {
-                tcx.mk_tup(fields.iter().map(|t| self.ast_ty_to_ty(&t)))
+                tcx.mk_tup(fields.iter().map(|t| self.ast_ty_to_ty(&t)), false)
             }
             hir::TyBareFn(ref bf) => {
                 require_c_abi_if_variadic(tcx, &bf.decl, bf.abi, ast_ty.span);
@@ -1197,7 +1178,7 @@ pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
                 let late_bound_in_ret = tcx.collect_referenced_late_bound_regions(&output);
                 for br in late_bound_in_ret.difference(&late_bound_in_args) {
                     let br_name = match *br {
-                        ty::BrNamed(_, name, _) => name,
+                        ty::BrNamed(_, name) => name,
                         _ => {
                             span_bug!(
                                 bf.decl.output.span(),
@@ -1205,13 +1186,13 @@ pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
                                 br);
                         }
                     };
-                    tcx.sess.add_lint(
-                        lint::builtin::HR_LIFETIME_IN_ASSOC_TYPE,
-                        ast_ty.id,
-                        ast_ty.span,
-                        format!("return type references lifetime `{}`, \
-                                 which does not appear in the trait input types",
-                                br_name));
+                    struct_span_err!(tcx.sess,
+                                     ast_ty.span,
+                                     E0581,
+                                     "return type references lifetime `{}`, \
+                                      which does not appear in the fn input types",
+                                     br_name)
+                        .emit();
                 }
                 tcx.mk_fn_ptr(bare_fn_ty)
             }
index 932e7ae1dd4266ffa480e092fbae9cf3e44033e7..feed5752cf8fb6c3b92bbeb8dd7ccfb0eb93229a 100644 (file)
@@ -164,7 +164,7 @@ pub fn check_pat_arg(&self, pat: &'gcx hir::Pat, expected: Ty<'tcx>, is_arg: boo
                 let mut expected_len = elements.len();
                 if ddpos.is_some() {
                     // Require known type only when `..` is present
-                    if let ty::TyTuple(ref tys) =
+                    if let ty::TyTuple(ref tys, _) =
                             self.structurally_resolved_type(pat.span, expected).sty {
                         expected_len = tys.len();
                     }
@@ -176,7 +176,7 @@ pub fn check_pat_arg(&self, pat: &'gcx hir::Pat, expected: Ty<'tcx>, is_arg: boo
                     //       from all tuple elements isn't trivial.
                     TypeVariableOrigin::TypeInference(pat.span)));
                 let element_tys = tcx.mk_type_list(element_tys_iter);
-                let pat_ty = tcx.mk_ty(ty::TyTuple(element_tys));
+                let pat_ty = tcx.mk_ty(ty::TyTuple(element_tys, false));
                 self.demand_eqtype(pat.span, expected, pat_ty);
                 for (i, elem) in elements.iter().enumerate_and_adjust(max_len, ddpos) {
                     self.check_pat(elem, &element_tys[i]);
index 6215b4498dc684ee3a63454b1c8bf1d242abfc9f..441d427fe499e366303512c107e6733b31e9f414 100644 (file)
@@ -311,23 +311,25 @@ fn trivial_cast_lint(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) {
         let t_cast = self.cast_ty;
         let t_expr = self.expr_ty;
         if t_cast.is_numeric() && t_expr.is_numeric() {
-            fcx.tcx.sess.add_lint(lint::builtin::TRIVIAL_NUMERIC_CASTS,
-                                  self.expr.id,
-                                  self.span,
-                                  format!("trivial numeric cast: `{}` as `{}`. Cast can be \
-                                           replaced by coercion, this might require type \
-                                           ascription or a temporary variable",
-                                          fcx.ty_to_string(t_expr),
-                                          fcx.ty_to_string(t_cast)));
+            fcx.tables.borrow_mut().lints.add_lint(
+                lint::builtin::TRIVIAL_NUMERIC_CASTS,
+                self.expr.id,
+                self.span,
+                format!("trivial numeric cast: `{}` as `{}`. Cast can be \
+                         replaced by coercion, this might require type \
+                         ascription or a temporary variable",
+                        fcx.ty_to_string(t_expr),
+                        fcx.ty_to_string(t_cast)));
         } else {
-            fcx.tcx.sess.add_lint(lint::builtin::TRIVIAL_CASTS,
-                                  self.expr.id,
-                                  self.span,
-                                  format!("trivial cast: `{}` as `{}`. Cast can be \
-                                           replaced by coercion, this might require type \
-                                           ascription or a temporary variable",
-                                          fcx.ty_to_string(t_expr),
-                                          fcx.ty_to_string(t_cast)));
+            fcx.tables.borrow_mut().lints.add_lint(
+                lint::builtin::TRIVIAL_CASTS,
+                self.expr.id,
+                self.span,
+                format!("trivial cast: `{}` as `{}`. Cast can be \
+                         replaced by coercion, this might require type \
+                         ascription or a temporary variable",
+                        fcx.ty_to_string(t_expr),
+                        fcx.ty_to_string(t_cast)));
         }
 
     }
index 2e6592b55017961034aff71eb3398c012209e428..7979edbf5e27a1c7c78536a1e8272b6662680db0 100644 (file)
@@ -89,7 +89,7 @@ fn check_closure(&self,
         // Tuple up the arguments and insert the resulting function type into
         // the `closures` table.
         fn_ty.sig.0 = self.tcx.mk_fn_sig(
-            iter::once(self.tcx.intern_tup(fn_ty.sig.skip_binder().inputs())),
+            iter::once(self.tcx.intern_tup(fn_ty.sig.skip_binder().inputs(), false)),
             fn_ty.sig.skip_binder().output(),
             fn_ty.sig.variadic()
         );
@@ -218,7 +218,7 @@ fn deduce_sig_from_projection(&self,
                arg_param_ty);
 
         let input_tys = match arg_param_ty.sty {
-            ty::TyTuple(tys) => tys.into_iter(),
+            ty::TyTuple(tys, _) => tys.into_iter(),
             _ => {
                 return None;
             }
index 34aa4eda772ada2b1904be85f40ca05612a29648..f701bc3220848d452b0b51aa913751d676ab9137 100644 (file)
@@ -489,7 +489,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'b, 'gcx, 'tcx>(
             Ok(())
         }
 
-        ty::TyTuple(tys) => {
+        ty::TyTuple(tys, _) => {
             for ty in tys {
                 iterate_over_potentially_unsafe_regions_in_type(cx, context, ty, depth+1)?
             }
index 7ead7ada893d7bccdb2e284a13d19c300ee21c83..cb4e85e842c2a8f3727cfad82a312fcfb7a3aecf 100644 (file)
@@ -87,7 +87,7 @@ fn param<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, n: u32) -> Ty<'tcx> {
             "cxchg" | "cxchgweak" => (1, vec![tcx.mk_mut_ptr(param(ccx, 0)),
                                               param(ccx, 0),
                                               param(ccx, 0)],
-                                      tcx.intern_tup(&[param(ccx, 0), tcx.types.bool])),
+                                      tcx.intern_tup(&[param(ccx, 0), tcx.types.bool], false)),
             "load" => (1, vec![tcx.mk_imm_ptr(param(ccx, 0))],
                        param(ccx, 0)),
             "store" => (1, vec![tcx.mk_mut_ptr(param(ccx, 0)), param(ccx, 0)],
@@ -272,7 +272,7 @@ fn param<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, n: u32) -> Ty<'tcx> {
 
             "add_with_overflow" | "sub_with_overflow"  | "mul_with_overflow" =>
                 (1, vec![param(ccx, 0), param(ccx, 0)],
-                tcx.intern_tup(&[param(ccx, 0), tcx.types.bool])),
+                tcx.intern_tup(&[param(ccx, 0), tcx.types.bool], false)),
 
             "unchecked_div" | "unchecked_rem" =>
                 (1, vec![param(ccx, 0), param(ccx, 0)], param(ccx, 0)),
@@ -420,7 +420,7 @@ fn match_intrinsic_type_to_type<'tcx, 'a>(
 
     match *expected {
         Void => match t.sty {
-            ty::TyTuple(ref v) if v.is_empty() => {},
+            ty::TyTuple(ref v, _) if v.is_empty() => {},
             _ => simple_error(&format!("`{}`", t), "()"),
         },
         // (The width we pass to LLVM doesn't concern the type checker.)
@@ -494,7 +494,7 @@ fn match_intrinsic_type_to_type<'tcx, 'a>(
         }
         Aggregate(_flatten, ref expected_contents) => {
             match t.sty {
-                ty::TyTuple(contents) => {
+                ty::TyTuple(contents, _) => {
                     if contents.len() != expected_contents.len() {
                         simple_error(&format!("tuple with length {}", contents.len()),
                                      &format!("tuple with length {}", expected_contents.len()));
index 9b8e77301e52480f5cb19576ffaaf51a44dec640..eae8989bd342eec23106eb22252eb96f0cf0030f 100644 (file)
@@ -137,7 +137,9 @@ pub fn lookup_method(&self,
                                        self_ty, call_expr.id)?;
 
         if let Some(import_id) = pick.import_id {
-            self.tcx.used_trait_imports.borrow_mut().insert(import_id);
+            let import_def_id = self.tcx.hir.local_def_id(import_id);
+            debug!("used_trait_import: {:?}", import_def_id);
+            self.used_trait_imports.borrow_mut().insert(import_def_id);
         }
 
         self.tcx.check_stability(pick.item.def_id, call_expr.id, span);
@@ -336,7 +338,9 @@ pub fn resolve_ufcs(&self,
                                        self_ty, expr_id)?;
 
         if let Some(import_id) = pick.import_id {
-            self.tcx.used_trait_imports.borrow_mut().insert(import_id);
+            let import_def_id = self.tcx.hir.local_def_id(import_id);
+            debug!("used_trait_import: {:?}", import_def_id);
+            self.used_trait_imports.borrow_mut().insert(import_def_id);
         }
 
         let def = pick.item.def();
index 300caca30fec8c12927dc4f405e30a2fdab8b627..201a223c15f157ccf6fbd1fe5d803605c948f17d 100644 (file)
@@ -55,7 +55,6 @@ struct ProbeContext<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
     inherent_candidates: Vec<Candidate<'tcx>>,
     extension_candidates: Vec<Candidate<'tcx>>,
     impl_dups: FxHashSet<DefId>,
-    import_id: Option<ast::NodeId>,
 
     /// Collects near misses when the candidate functions are missing a `self` keyword and is only
     /// used for error reporting
@@ -351,7 +350,6 @@ fn new(fcx: &'a FnCtxt<'a, 'gcx, 'tcx>,
             inherent_candidates: Vec::new(),
             extension_candidates: Vec::new(),
             impl_dups: FxHashSet(),
-            import_id: None,
             steps: Rc::new(steps),
             opt_simplified_steps: opt_simplified_steps,
             static_candidates: Vec::new(),
@@ -530,7 +528,7 @@ fn assemble_inherent_impl_probe(&mut self, impl_def_id: DefId) {
                 xform_self_ty: xform_self_ty,
                 item: item,
                 kind: InherentImplCandidate(impl_substs, obligations),
-                import_id: self.import_id,
+                import_id: None,
             });
         }
     }
@@ -559,7 +557,7 @@ fn assemble_inherent_candidates_from_object(&mut self,
                 xform_self_ty: xform_self_ty,
                 item: item,
                 kind: ObjectCandidate,
-                import_id: this.import_id,
+                import_id: None,
             });
         });
     }
@@ -609,7 +607,7 @@ fn assemble_inherent_candidates_from_param(&mut self,
                 xform_self_ty: xform_self_ty,
                 item: item,
                 kind: WhereClauseCandidate(poly_trait_ref),
-                import_id: this.import_id,
+                import_id: None,
             });
         });
     }
@@ -644,9 +642,8 @@ fn assemble_extension_candidates_for_traits_in_scope(&mut self,
             for trait_candidate in applicable_traits {
                 let trait_did = trait_candidate.def_id;
                 if duplicates.insert(trait_did) {
-                    self.import_id = trait_candidate.import_id;
-                    let result = self.assemble_extension_candidates_for_trait(trait_did);
-                    self.import_id = None;
+                    let import_id = trait_candidate.import_id;
+                    let result = self.assemble_extension_candidates_for_trait(import_id, trait_did);
                     result?;
                 }
             }
@@ -658,7 +655,7 @@ fn assemble_extension_candidates_for_all_traits(&mut self) -> Result<(), MethodE
         let mut duplicates = FxHashSet();
         for trait_info in suggest::all_traits(self.ccx) {
             if duplicates.insert(trait_info.def_id) {
-                self.assemble_extension_candidates_for_trait(trait_info.def_id)?;
+                self.assemble_extension_candidates_for_trait(None, trait_info.def_id)?;
             }
         }
         Ok(())
@@ -682,6 +679,7 @@ pub fn matches_return_type(&self, method: &ty::AssociatedItem,
     }
 
     fn assemble_extension_candidates_for_trait(&mut self,
+                                               import_id: Option<ast::NodeId>,
                                                trait_def_id: DefId)
                                                -> Result<(), MethodError<'tcx>> {
         debug!("assemble_extension_candidates_for_trait(trait_def_id={:?})",
@@ -695,19 +693,21 @@ fn assemble_extension_candidates_for_trait(&mut self,
                 continue;
             }
 
-            self.assemble_extension_candidates_for_trait_impls(trait_def_id, item.clone());
+            self.assemble_extension_candidates_for_trait_impls(import_id, trait_def_id,
+                                                               item.clone());
 
-            self.assemble_closure_candidates(trait_def_id, item.clone())?;
+            self.assemble_closure_candidates(import_id, trait_def_id, item.clone())?;
 
-            self.assemble_projection_candidates(trait_def_id, item.clone());
+            self.assemble_projection_candidates(import_id, trait_def_id, item.clone());
 
-            self.assemble_where_clause_candidates(trait_def_id, item.clone());
+            self.assemble_where_clause_candidates(import_id, trait_def_id, item.clone());
         }
 
         Ok(())
     }
 
     fn assemble_extension_candidates_for_trait_impls(&mut self,
+                                                     import_id: Option<ast::NodeId>,
                                                      trait_def_id: DefId,
                                                      item: ty::AssociatedItem) {
         let trait_def = self.tcx.lookup_trait_def(trait_def_id);
@@ -751,7 +751,7 @@ fn assemble_extension_candidates_for_trait_impls(&mut self,
                 xform_self_ty: xform_self_ty,
                 item: item.clone(),
                 kind: ExtensionImplCandidate(impl_def_id, impl_substs, obligations),
-                import_id: self.import_id,
+                import_id: import_id,
             });
         });
     }
@@ -777,6 +777,7 @@ fn impl_can_possibly_match(&self, impl_def_id: DefId) -> bool {
     }
 
     fn assemble_closure_candidates(&mut self,
+                                   import_id: Option<ast::NodeId>,
                                    trait_def_id: DefId,
                                    item: ty::AssociatedItem)
                                    -> Result<(), MethodError<'tcx>> {
@@ -840,7 +841,7 @@ fn assemble_closure_candidates(&mut self,
                 xform_self_ty: xform_self_ty,
                 item: item.clone(),
                 kind: TraitCandidate,
-                import_id: self.import_id,
+                import_id: import_id,
             });
         }
 
@@ -848,6 +849,7 @@ fn assemble_closure_candidates(&mut self,
     }
 
     fn assemble_projection_candidates(&mut self,
+                                      import_id: Option<ast::NodeId>,
                                       trait_def_id: DefId,
                                       item: ty::AssociatedItem) {
         debug!("assemble_projection_candidates(\
@@ -895,7 +897,7 @@ fn assemble_projection_candidates(&mut self,
                         xform_self_ty: xform_self_ty,
                         item: item.clone(),
                         kind: TraitCandidate,
-                        import_id: self.import_id,
+                        import_id: import_id,
                     });
                 }
             }
@@ -903,6 +905,7 @@ fn assemble_projection_candidates(&mut self,
     }
 
     fn assemble_where_clause_candidates(&mut self,
+                                        import_id: Option<ast::NodeId>,
                                         trait_def_id: DefId,
                                         item: ty::AssociatedItem) {
         debug!("assemble_where_clause_candidates(trait_def_id={:?})",
@@ -923,7 +926,7 @@ fn assemble_where_clause_candidates(&mut self,
                 xform_self_ty: xform_self_ty,
                 item: item.clone(),
                 kind: WhereClauseCandidate(poly_bound),
-                import_id: self.import_id,
+                import_id: import_id,
             });
         }
     }
index c435f9341253e92920ff621ecc13e8fa26486eb2..8329d3eeed9e54c628164ee1ff99fa22c0944eab 100644 (file)
 use TypeAndSubsts;
 use lint;
 use util::common::{ErrorReported, indenter};
-use util::nodemap::{DefIdMap, FxHashMap, FxHashSet, NodeMap};
+use util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap};
 
 use std::cell::{Cell, RefCell};
 use std::cmp;
@@ -179,6 +179,11 @@ pub struct Inherited<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
     // Obligations which will have to be checked at the end of
     // type-checking, after all functions have been inferred.
     deferred_obligations: RefCell<Vec<traits::DeferredObligation<'tcx>>>,
+
+    // a set of trait import def-ids that we use during method
+    // resolution; during writeback, this is written into
+    // `tcx.used_trait_imports` for this item def-id
+    used_trait_imports: RefCell<FxHashSet<DefId>>,
 }
 
 impl<'a, 'gcx, 'tcx> Deref for Inherited<'a, 'gcx, 'tcx> {
@@ -513,6 +518,7 @@ pub fn new(ccx: &'a CrateCtxt<'a, 'gcx>,
             deferred_cast_checks: RefCell::new(Vec::new()),
             anon_types: RefCell::new(DefIdMap()),
             deferred_obligations: RefCell::new(Vec::new()),
+            used_trait_imports: RefCell::new(DefIdSet()),
         }
     }
 
@@ -1412,7 +1418,7 @@ fn get_type_parameter_bounds(&self,
     fn re_infer(&self, span: Span, def: Option<&ty::RegionParameterDef>)
                 -> Option<&'tcx ty::Region> {
         let v = match def {
-            Some(def) => infer::EarlyBoundRegion(span, def.name),
+            Some(def) => infer::EarlyBoundRegion(span, def.name, def.issue_32330),
             None => infer::MiscVariable(span)
         };
         Some(self.next_region_var(v))
@@ -1521,9 +1527,10 @@ fn warn_if_unreachable(&self, id: ast::NodeId, span: Span, kind: &str) {
         if self.diverges.get() == Diverges::Always {
             self.diverges.set(Diverges::WarnedAlways);
 
-            self.tcx.sess.add_lint(lint::builtin::UNREACHABLE_CODE,
-                                   id, span,
-                                   format!("unreachable {}", kind));
+            self.tables.borrow_mut().lints.add_lint(
+                lint::builtin::UNREACHABLE_CODE,
+                id, span,
+                format!("unreachable {}", kind));
         }
     }
 
@@ -1940,7 +1947,9 @@ fn check_casts(&self) {
     }
 
     /// Apply "fallbacks" to some types
-    /// ! gets replaced with (), unconstrained ints with i32, and unconstrained floats with f64.
+    /// unconstrained types get replaced with ! or  () (depending on whether
+    /// feature(never_type) is enabled), unconstrained ints with i32, and
+    /// unconstrained floats with f64.
     fn default_type_parameters(&self) {
         use rustc::ty::error::UnconstrainedNumeric::Neither;
         use rustc::ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat};
@@ -2401,7 +2410,7 @@ fn check_method_argument_types(&self,
 
             let err_inputs = match tuple_arguments {
                 DontTupleArguments => err_inputs,
-                TupleArguments => vec![self.tcx.intern_tup(&err_inputs[..])],
+                TupleArguments => vec![self.tcx.intern_tup(&err_inputs[..], false)],
             };
 
             self.check_argument_types(sp, &err_inputs[..], &[], args_no_rcvr,
@@ -2498,16 +2507,16 @@ fn parameter_count_error<'tcx>(sess: &Session, sp: Span, expected_count: usize,
         let formal_tys = if tuple_arguments == TupleArguments {
             let tuple_type = self.structurally_resolved_type(sp, fn_inputs[0]);
             match tuple_type.sty {
-                ty::TyTuple(arg_types) if arg_types.len() != args.len() => {
+                ty::TyTuple(arg_types, _) if arg_types.len() != args.len() => {
                     parameter_count_error(tcx.sess, sp_args, arg_types.len(), args.len(),
                                           "E0057", false, def_span);
                     expected_arg_tys = &[];
                     self.err_args(args.len())
                 }
-                ty::TyTuple(arg_types) => {
+                ty::TyTuple(arg_types, _) => {
                     expected_arg_tys = match expected_arg_tys.get(0) {
                         Some(&ty) => match ty.sty {
-                            ty::TyTuple(ref tys) => &tys,
+                            ty::TyTuple(ref tys, _) => &tys,
                             _ => &[]
                         },
                         None => &[]
@@ -3065,7 +3074,7 @@ fn check_tup_field(&self,
                         }
                     })
                 }
-                ty::TyTuple(ref v) => {
+                ty::TyTuple(ref v, _) => {
                     tuple_like = true;
                     v.get(idx.node).cloned()
                 }
@@ -3857,7 +3866,7 @@ fn check_expr_kind(&self,
           hir::ExprTup(ref elts) => {
             let flds = expected.only_has_type(self).and_then(|ty| {
                 match ty.sty {
-                    ty::TyTuple(ref flds) => Some(&flds[..]),
+                    ty::TyTuple(ref flds, _) => Some(&flds[..]),
                     _ => None
                 }
             });
@@ -3875,7 +3884,7 @@ fn check_expr_kind(&self,
                 };
                 t
             });
-            let tuple = tcx.mk_tup(elt_ts_iter);
+            let tuple = tcx.mk_tup(elt_ts_iter, false);
             if tuple.references_error() {
                 tcx.types.err
             } else {
@@ -3916,7 +3925,7 @@ fn check_expr_kind(&self,
                               },
                               base_t);
                           // Try to give some advice about indexing tuples.
-                          if let ty::TyTuple(_) = base_t.sty {
+                          if let ty::TyTuple(..) = base_t.sty {
                               let mut needs_note = true;
                               // If the index is an integer, we can show the actual
                               // fixed expression:
index 7f82d7829ce52d7e700ff06bce99f8552f6bb2c2..28156dd616b3a59da3e615ef9437526e4b7a657e 100644 (file)
 use rustc::ty::adjustment;
 use rustc::ty::fold::{TypeFolder,TypeFoldable};
 use rustc::infer::{InferCtxt, FixupError};
-use rustc::util::nodemap::DefIdMap;
+use rustc::util::nodemap::{DefIdMap, DefIdSet};
 
 use std::cell::Cell;
+use std::mem;
 
 use syntax::ast;
 use syntax_pos::Span;
@@ -52,9 +53,15 @@ pub fn resolve_type_vars_in_body(&self, body: &'gcx hir::Body) {
         wbcx.visit_deferred_obligations(item_id);
         wbcx.visit_type_nodes();
         wbcx.visit_cast_types();
+        wbcx.visit_lints();
 
         let tables = self.tcx.alloc_tables(wbcx.tables);
         self.tcx.tables.borrow_mut().insert(item_def_id, tables);
+
+        let used_trait_imports = mem::replace(&mut *self.used_trait_imports.borrow_mut(),
+                                              DefIdSet());
+        debug!("used_trait_imports({:?}) = {:?}", item_def_id, used_trait_imports);
+        self.tcx.used_trait_imports.borrow_mut().insert(item_def_id, used_trait_imports);
     }
 }
 
@@ -101,7 +108,7 @@ fn new(fcx: &'cx FnCtxt<'cx, 'gcx, 'tcx>) -> WritebackCx<'cx, 'gcx, 'tcx> {
             };
             match *r {
                 ty::ReFree(ty::FreeRegion {
-                    bound_region: ty::BoundRegion::BrNamed(def_id, name, _), ..
+                    bound_region: ty::BoundRegion::BrNamed(def_id, name), ..
                 }) => {
                     let bound_region = gcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion {
                         index: i as u32,
@@ -301,6 +308,14 @@ fn visit_cast_types(&mut self) {
             self.fcx.tables.borrow().cast_kinds.iter().map(|(&key, &value)| (key, value)));
     }
 
+    fn visit_lints(&mut self) {
+        if self.fcx.writeback_errors.get() {
+            return
+        }
+
+        self.fcx.tables.borrow_mut().lints.transfer(&mut self.tables.lints);
+    }
+
     fn visit_anon_types(&self) {
         if self.fcx.writeback_errors.get() {
             return
index bdda538db160ec3765299ac174188f643693905d..6dff6d57e4facc1d576c06f0dcf89dcf6131f029 100644 (file)
 
 use rustc::hir;
 use rustc::hir::itemlikevisit::ItemLikeVisitor;
+use rustc::util::nodemap::DefIdSet;
 
-struct UnusedTraitImportVisitor<'a, 'tcx: 'a> {
+struct CheckVisitor<'a, 'tcx: 'a> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
+    used_trait_imports: DefIdSet,
 }
 
-impl<'a, 'tcx> UnusedTraitImportVisitor<'a, 'tcx> {
+impl<'a, 'tcx> CheckVisitor<'a, 'tcx> {
     fn check_import(&self, id: ast::NodeId, span: Span) {
         if !self.tcx.maybe_unused_trait_imports.contains(&id) {
             return;
         }
-        if self.tcx.used_trait_imports.borrow().contains(&id) {
+
+        let import_def_id = self.tcx.hir.local_def_id(id);
+        if self.used_trait_imports.contains(&import_def_id) {
             return;
         }
 
@@ -40,7 +44,7 @@ fn check_import(&self, id: ast::NodeId, span: Span) {
     }
 }
 
-impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for UnusedTraitImportVisitor<'a, 'tcx> {
+impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CheckVisitor<'a, 'tcx> {
     fn visit_item(&mut self, item: &hir::Item) {
         if item.vis == hir::Public || item.span == DUMMY_SP {
             return;
@@ -59,6 +63,21 @@ fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) {
 
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let _task = tcx.dep_graph.in_task(DepNode::UnusedTraitCheck);
-    let mut visitor = UnusedTraitImportVisitor { tcx: tcx };
+
+    let mut used_trait_imports = DefIdSet();
+    for &body_id in tcx.hir.krate().bodies.keys() {
+        let item_id = tcx.hir.body_owner(body_id);
+        let item_def_id = tcx.hir.local_def_id(item_id);
+
+        // this will have been written by the main typeck pass
+        if let Some(imports) = tcx.used_trait_imports.borrow().get(&item_def_id) {
+            debug!("GatherVisitor: item_def_id={:?} with imports {:#?}", item_def_id, imports);
+            used_trait_imports.extend(imports);
+        } else {
+            debug!("GatherVisitor: item_def_id={:?} with no imports", item_def_id);
+        }
+    }
+
+    let mut visitor = CheckVisitor { tcx, used_trait_imports };
     tcx.hir.krate().visit_all_item_likes(&mut visitor);
 }
index e9c710d2fec4c38ca1173e2e302cb620f52102f5..b6a863fd2ed0d533626972afbf1c6a219659a63d 100644 (file)
@@ -15,8 +15,9 @@
 // done by the orphan and overlap modules. Then we build up various
 // mappings. That mapping code resides here.
 
+use dep_graph::DepTrackingMap;
 use hir::def_id::DefId;
-use rustc::ty::{self, TyCtxt, TypeFoldable};
+use rustc::ty::{self, maps, TyCtxt, TypeFoldable};
 use rustc::ty::{Ty, TyBool, TyChar, TyError};
 use rustc::ty::{TyParam, TyRawPtr};
 use rustc::ty::{TyRef, TyAdt, TyDynamic, TyNever, TyTuple};
 use rustc::hir::itemlikevisit::ItemLikeVisitor;
 use rustc::hir::{Item, ItemImpl};
 use rustc::hir;
+use std::cell::RefMut;
 
 mod builtin;
 mod orphan;
 mod overlap;
 mod unsafety;
 
-struct CoherenceChecker<'a, 'tcx: 'a> {
+struct CoherenceCollect<'a, 'tcx: 'a> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
+    inherent_impls: RefMut<'a, DepTrackingMap<maps::InherentImpls<'tcx>>>,
 }
 
-impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CoherenceChecker<'a, 'tcx> {
+impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CoherenceCollect<'a, 'tcx> {
     fn visit_item(&mut self, item: &Item) {
         if let ItemImpl(..) = item.node {
             self.check_implementation(item)
@@ -53,7 +56,17 @@ fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) {
     }
 }
 
-impl<'a, 'tcx> CoherenceChecker<'a, 'tcx> {
+impl<'a, 'tcx> CoherenceCollect<'a, 'tcx> {
+    fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
+        let inherent_impls = tcx.inherent_impls.borrow_mut();
+        let mut this = &mut CoherenceCollect { tcx, inherent_impls };
+
+        // Check implementations and traits. This populates the tables
+        // containing the inherent methods and extension methods. It also
+        // builds up the trait inheritance table.
+        tcx.visit_all_item_likes_in_krate(DepNode::CoherenceCheckImpl, this);
+    }
+
     // Returns the def ID of the base type, if there is one.
     fn get_base_type_def_id(&self, span: Span, ty: Ty<'tcx>) -> Option<DefId> {
         match ty.sty {
@@ -75,14 +88,7 @@ fn get_base_type_def_id(&self, span: Span, ty: Ty<'tcx>) -> Option<DefId> {
         }
     }
 
-    fn check(&mut self) {
-        // Check implementations and traits. This populates the tables
-        // containing the inherent methods and extension methods. It also
-        // builds up the trait inheritance table.
-        self.tcx.visit_all_item_likes_in_krate(DepNode::CoherenceCheckImpl, self);
-    }
-
-    fn check_implementation(&self, item: &Item) {
+    fn check_implementation(&mut self, item: &Item) {
         let tcx = self.tcx;
         let impl_did = tcx.hir.local_def_id(item.id);
         let self_type = tcx.item_type(impl_did);
@@ -119,8 +125,19 @@ fn check_implementation(&self, item: &Item) {
         }
     }
 
-    fn add_inherent_impl(&self, base_def_id: DefId, impl_def_id: DefId) {
-        self.tcx.inherent_impls.borrow_mut().push(base_def_id, impl_def_id);
+    fn add_inherent_impl(&mut self, base_def_id: DefId, impl_def_id: DefId) {
+        // Subtle: it'd be better to collect these into a local map
+        // and then write the vector only once all items are known,
+        // but that leads to degenerate dep-graphs. The problem is
+        // that the write of that big vector winds up having reads
+        // from *all* impls in the krate, since we've lost the
+        // precision basically.  This would be ok in the firewall
+        // model so once we've made progess towards that we can modify
+        // the strategy here. In the meantime, using `push` is ok
+        // because we are doing this as a pre-pass before anyone
+        // actually reads from `inherent_impls` -- and we know this is
+        // true beacuse we hold the refcell lock.
+        self.inherent_impls.push(base_def_id, impl_def_id);
     }
 
     fn add_trait_impl(&self, impl_trait_ref: ty::TraitRef<'tcx>, impl_def_id: DefId) {
@@ -160,8 +177,9 @@ fn enforce_trait_manually_implementable(tcx: TyCtxt, sp: Span, trait_def_id: Def
 }
 
 pub fn check_coherence(ccx: &CrateCtxt) {
+    CoherenceCollect::check(ccx.tcx);
+
     let _task = ccx.tcx.dep_graph.in_task(DepNode::Coherence);
-    CoherenceChecker { tcx: ccx.tcx }.check();
     unsafety::check(ccx.tcx);
     orphan::check(ccx.tcx);
     overlap::check(ccx.tcx);
index bbd0c8058151f2b6669efce9a17beb374c52330a..1981e7c3a3d122086fcd695912cb515782cd2a6d 100644 (file)
@@ -634,7 +634,7 @@ fn convert_field<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     ccx.tcx.item_types.borrow_mut().insert(ty_f.did, tt);
 
     let def_id = ccx.tcx.hir.local_def_id(field.id);
-    ccx.tcx.item_types.borrow_mut().insert(def_id, tt);
+    assert_eq!(def_id, ty_f.did);
     ccx.tcx.generics.borrow_mut().insert(def_id, struct_generics);
     ccx.tcx.predicates.borrow_mut().insert(def_id, struct_predicates.clone());
 }
@@ -848,9 +848,10 @@ fn convert_trait_item(ccx: &CrateCtxt, trait_item: &hir::TraitItem) {
             let const_def_id = ccx.tcx.hir.local_def_id(trait_item.id);
             generics_of_def_id(ccx, const_def_id);
             let ty = ccx.icx(&trait_predicates).to_ty(&ty);
-            tcx.item_types.borrow_mut().insert(const_def_id, ty);
-            convert_associated_const(ccx, TraitContainer(trait_def_id),
-                                     trait_item.id, ty);
+            convert_associated_const(ccx,
+                                     TraitContainer(trait_def_id),
+                                     trait_item.id,
+                                     ty);
         }
 
         hir::TraitItemKind::Type(_, ref opt_ty) => {
@@ -884,9 +885,10 @@ fn convert_impl_item(ccx: &CrateCtxt, impl_item: &hir::ImplItem) {
             let const_def_id = ccx.tcx.hir.local_def_id(impl_item.id);
             generics_of_def_id(ccx, const_def_id);
             let ty = ccx.icx(&impl_predicates).to_ty(&ty);
-            tcx.item_types.borrow_mut().insert(const_def_id, ty);
-            convert_associated_const(ccx, ImplContainer(impl_def_id),
-                                     impl_item.id, ty);
+            convert_associated_const(ccx,
+                                     ImplContainer(impl_def_id),
+                                     impl_item.id,
+                                     ty);
         }
 
         hir::ImplItemKind::Type(ref ty) => {
@@ -1283,9 +1285,7 @@ fn convert_trait_predicates<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, it: &hir::Item)
                                                            items);
     trait_predicates.predicates.extend(assoc_predicates);
 
-    let prev_predicates = tcx.predicates.borrow_mut().insert(def_id, trait_predicates);
-    assert!(prev_predicates.is_none());
-
+    tcx.predicates.borrow_mut().insert(def_id, trait_predicates);
     return;
 
     fn predicates_for_associated_types<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
@@ -1442,11 +1442,15 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
 
         let early_lifetimes = early_bound_lifetimes_from_generics(ccx, ast_generics);
         let regions = early_lifetimes.iter().enumerate().map(|(i, l)| {
+            let issue_32330 = ccx.tcx.named_region_map.issue_32330
+                                                      .get(&l.lifetime.id)
+                                                      .cloned();
             ty::RegionParameterDef {
                 name: l.lifetime.name,
                 index: own_start + i as u32,
                 def_id: tcx.hir.local_def_id(l.lifetime.id),
                 pure_wrt_drop: l.pure_wrt_drop,
+                issue_32330: issue_32330,
             }
         }).collect::<Vec<_>>();
 
@@ -1592,9 +1596,7 @@ fn predicates_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     };
 
     let predicates = ty_generic_predicates(ccx, generics, None, vec![], false);
-    let prev_predicates = ccx.tcx.predicates.borrow_mut().insert(def_id,
-                                                                 predicates.clone());
-    assert!(prev_predicates.is_none());
+    ccx.tcx.predicates.borrow_mut().insert(def_id, predicates.clone());
 
     predicates
 }
@@ -1617,8 +1619,7 @@ fn convert_foreign_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     };
 
     let predicates = ty_generic_predicates(ccx, generics, None, vec![], false);
-    let prev_predicates = ccx.tcx.predicates.borrow_mut().insert(def_id, predicates);
-    assert!(prev_predicates.is_none());
+    ccx.tcx.predicates.borrow_mut().insert(def_id, predicates);
 }
 
 // Is it marked with ?Sized
@@ -1678,7 +1679,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx, 'hir>(
     ast_generics
         .lifetimes
         .iter()
-        .filter(|l| !ccx.tcx.named_region_map.late_bound.contains_key(&l.lifetime.id))
+        .filter(|l| !ccx.tcx.named_region_map.late_bound.contains(&l.lifetime.id))
         .collect()
 }
 
index c41d40b41e42ab53c8a9ca53a780e1766a8bfc82..5bfc3a934af059ee7999a5904a8eb862f497a75a 100644 (file)
@@ -4056,6 +4056,74 @@ fn main() {
 ```
 "##,
 
+E0581: r##"
+In a `fn` type, a lifetime appears only in the return type,
+and not in the arguments types.
+
+Erroneous code example:
+
+```compile_fail,E0581
+fn main() {
+    // Here, `'a` appears only in the return type:
+    let x: for<'a> fn() -> &'a i32;
+}
+```
+
+To fix this issue, either use the lifetime in the arguments, or use
+`'static`. Example:
+
+```
+fn main() {
+    // Here, `'a` appears only in the return type:
+    let x: for<'a> fn(&'a i32) -> &'a i32;
+    let y: fn() -> &'static i32;
+}
+```
+
+Note: The examples above used to be (erroneously) accepted by the
+compiler, but this was since corrected. See [issue #33685] for more
+details.
+
+[issue #33685]: https://github.com/rust-lang/rust/issues/33685
+"##,
+
+    E0582: r##"
+A lifetime appears only in an associated-type binding,
+and not in the input types to the trait.
+
+Erroneous code example:
+
+```compile_fail,E0582
+fn bar<F>(t: F)
+    // No type can satisfy this requirement, since `'a` does not
+    // appear in any of the input types (here, `i32`):
+    where F: for<'a> Fn(i32) -> Option<&'a i32>
+{
+}
+
+fn main() { }
+```
+
+To fix this issue, either use the lifetime in the inputs, or use
+`'static`. Example:
+
+```
+fn bar<F, G>(t: F, u: G)
+    where F: for<'a> Fn(&'a i32) -> Option<&'a i32>,
+          G: Fn(i32) -> Option<&'static i32>,
+{
+}
+
+fn main() { }
+```
+
+Note: The examples above used to be (erroneously) accepted by the
+compiler, but this was since corrected. See [issue #33685] for more
+details.
+
+[issue #33685]: https://github.com/rust-lang/rust/issues/33685
+"##,
+
 }
 
 register_diagnostics! {
index 4ed116b88f6d942622476e27fc0cbbf66c51cba1..f19a59a5d38aeb56e33733149ee59ce6c1347447 100644 (file)
@@ -77,6 +77,7 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(conservative_impl_trait)]
+#![feature(field_init_shorthand)]
 #![feature(loop_break_value)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
index 40e82959336de4e654ecc7a95f0ee075a5232f0e..860f6d98370ad1926a192e20b1c164c1f99f9c0b 100644 (file)
@@ -338,7 +338,7 @@ fn add_constraints_from_ty(&mut self,
                 self.add_constraints_from_mt(generics, mt, variance);
             }
 
-            ty::TyTuple(subtys) => {
+            ty::TyTuple(subtys, _) => {
                 for &subty in subtys {
                     self.add_constraints_from_ty(generics, subty, variance);
                 }
index bdf1d0590bcc7bf48a72db776abfa4ad7003fccb..3ccec97d606ea3afa60a968ad831825c6a8edca6 100644 (file)
@@ -137,11 +137,9 @@ fn write(&self) {
                           item_variances);
             }
 
-            let newly_added = tcx.item_variance_map
-                .borrow_mut()
-                .insert(item_def_id, Rc::new(item_variances))
-                .is_none();
-            assert!(newly_added);
+            tcx.item_variance_map
+               .borrow_mut()
+               .insert(item_def_id, Rc::new(item_variances));
         }
     }
 
index 0e09d34cc9bd3774c0c0ee13936cc266ce66c483..253d7a25b632f2fea0afd6a2e24b071b99b6cac8 100644 (file)
@@ -178,12 +178,10 @@ fn add_inferreds_for_item(&mut self,
         // parameters".
         if self.num_inferred() == inferreds_on_entry {
             let item_def_id = self.tcx.hir.local_def_id(item_id);
-            let newly_added = self.tcx
+            self.tcx
                 .item_variance_map
                 .borrow_mut()
-                .insert(item_def_id, self.empty_variances.clone())
-                .is_none();
-            assert!(newly_added);
+                .insert(item_def_id, self.empty_variances.clone());
         }
     }
 
index 171954f325a5e5dbcafd82003efb2283109cd06d..fcb7af11dce2f061d2abbfd0bcc1e0af72ee6ad0 100644 (file)
@@ -11,7 +11,6 @@
 extern crate gcc;
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
     let mut cfg = gcc::Config::new();
     cfg.file("../rt/hoedown/src/autolink.c")
        .file("../rt/hoedown/src/buffer.c")
index cdb24a56367fc39749f20d213cf0faadd62ebbe4..291fc8dfa96806b43d68a9739392e4b03c053b27 100644 (file)
@@ -521,17 +521,22 @@ fn has_word(self, word: &str) -> bool {
 #[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug, Default)]
 pub struct Attributes {
     pub doc_strings: Vec<String>,
-    pub other_attrs: Vec<ast::Attribute>
+    pub other_attrs: Vec<ast::Attribute>,
+    pub span: Option<syntax_pos::Span>,
 }
 
 impl Attributes {
     pub fn from_ast(attrs: &[ast::Attribute]) -> Attributes {
         let mut doc_strings = vec![];
+        let mut sp = None;
         let other_attrs = attrs.iter().filter_map(|attr| {
             attr.with_desugared_doc(|attr| {
                 if let Some(value) = attr.value_str() {
                     if attr.check_name("doc") {
                         doc_strings.push(value.to_string());
+                        if sp.is_none() {
+                            sp = Some(attr.span);
+                        }
                         return None;
                     }
                 }
@@ -541,7 +546,8 @@ pub fn from_ast(attrs: &[ast::Attribute]) -> Attributes {
         }).collect();
         Attributes {
             doc_strings: doc_strings,
-            other_attrs: other_attrs
+            other_attrs: other_attrs,
+            span: sp,
         }
     }
 
@@ -649,7 +655,7 @@ fn external_path_params(cx: &DocContext, trait_did: Option<DefId>, has_self: boo
         Some(did) if cx.tcx.lang_items.fn_trait_kind(did).is_some() => {
             assert_eq!(types.len(), 1);
             let inputs = match types[0].sty {
-                ty::TyTuple(ref tys) => tys.iter().map(|t| t.clean(cx)).collect(),
+                ty::TyTuple(ref tys, _) => tys.iter().map(|t| t.clean(cx)).collect(),
                 _ => {
                     return PathParameters::AngleBracketed {
                         lifetimes: lifetimes,
@@ -661,7 +667,7 @@ fn external_path_params(cx: &DocContext, trait_did: Option<DefId>, has_self: boo
             let output = None;
             // FIXME(#20299) return type comes from a projection now
             // match types[1].sty {
-            //     ty::TyTuple(ref v) if v.is_empty() => None, // -> ()
+            //     ty::TyTuple(ref v, _) if v.is_empty() => None, // -> ()
             //     _ => Some(types[1].clean(cx))
             // };
             PathParameters::Parenthesized {
@@ -704,7 +710,7 @@ fn clean(&self, cx: &DocContext) -> TyParamBound {
         // collect any late bound regions
         let mut late_bounds = vec![];
         for ty_s in self.input_types().skip(1) {
-            if let ty::TyTuple(ts) = ty_s.sty {
+            if let ty::TyTuple(ts, _) = ty_s.sty {
                 for &ty_s in ts {
                     if let ty::TyRef(ref reg, _) = ty_s.sty {
                         if let &ty::Region::ReLateBound(..) = *reg {
@@ -804,7 +810,7 @@ impl Clean<Option<Lifetime>> for ty::Region {
     fn clean(&self, cx: &DocContext) -> Option<Lifetime> {
         match *self {
             ty::ReStatic => Some(Lifetime::statik()),
-            ty::ReLateBound(_, ty::BrNamed(_, name, _)) => Some(Lifetime(name.to_string())),
+            ty::ReLateBound(_, ty::BrNamed(_, name)) => Some(Lifetime(name.to_string())),
             ty::ReEarlyBound(ref data) => Some(Lifetime(data.name.clean(cx))),
 
             ty::ReLateBound(..) |
@@ -1889,7 +1895,7 @@ fn clean(&self, cx: &DocContext) -> Type {
                     Never
                 }
             }
-            ty::TyTuple(ref t) => Tuple(t.clean(cx)),
+            ty::TyTuple(ref t, _) => Tuple(t.clean(cx)),
 
             ty::TyProjection(ref data) => data.clean(cx),
 
index 442a2f4074215a4f519ea4ec2c792520ca8ebf75..a0f4a3a87434845c7f464723bea9f47f4842c985 100644 (file)
 enum hoedown_document {}
 
 type blockcodefn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
-                                 *const hoedown_buffer, *const hoedown_renderer_data);
+                                 *const hoedown_buffer, *const hoedown_renderer_data,
+                                 libc::size_t);
 
 type blockquotefn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
-                                  *const hoedown_renderer_data);
+                                  *const hoedown_renderer_data, libc::size_t);
 
 type headerfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
-                              libc::c_int, *const hoedown_renderer_data);
+                              libc::c_int, *const hoedown_renderer_data,
+                              libc::size_t);
 
 type blockhtmlfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
-                                 *const hoedown_renderer_data);
+                                 *const hoedown_renderer_data, libc::size_t);
 
 type codespanfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
-                                *const hoedown_renderer_data) -> libc::c_int;
+                                *const hoedown_renderer_data, libc::size_t) -> libc::c_int;
 
 type linkfn = extern "C" fn (*mut hoedown_buffer, *const hoedown_buffer,
                              *const hoedown_buffer, *const hoedown_buffer,
-                             *const hoedown_renderer_data) -> libc::c_int;
+                             *const hoedown_renderer_data, libc::size_t) -> libc::c_int;
 
 type entityfn = extern "C" fn (*mut hoedown_buffer, *const hoedown_buffer,
-                               *const hoedown_renderer_data);
+                               *const hoedown_renderer_data, libc::size_t);
 
 type normaltextfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
-                                  *const hoedown_renderer_data);
+                                  *const hoedown_renderer_data, libc::size_t);
 
 #[repr(C)]
 struct hoedown_renderer_data {
@@ -147,7 +149,8 @@ struct html_toc_data {
 
 struct MyOpaque {
     dfltblk: extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
-                           *const hoedown_buffer, *const hoedown_renderer_data),
+                           *const hoedown_buffer, *const hoedown_renderer_data,
+                           libc::size_t),
     toc_builder: Option<TocBuilder>,
 }
 
@@ -159,11 +162,6 @@ struct hoedown_buffer {
     unit: libc::size_t,
 }
 
-// hoedown FFI
-#[link(name = "hoedown", kind = "static")]
-#[cfg(not(cargobuild))]
-extern {}
-
 extern {
     fn hoedown_html_renderer_new(render_flags: libc::c_uint,
                                  nesting_level: libc::c_int)
@@ -229,7 +227,8 @@ pub fn render(w: &mut fmt::Formatter,
               print_toc: bool,
               html_flags: libc::c_uint) -> fmt::Result {
     extern fn block(ob: *mut hoedown_buffer, orig_text: *const hoedown_buffer,
-                    lang: *const hoedown_buffer, data: *const hoedown_renderer_data) {
+                    lang: *const hoedown_buffer, data: *const hoedown_renderer_data,
+                    line: libc::size_t) {
         unsafe {
             if orig_text.is_null() { return }
 
@@ -246,7 +245,8 @@ pub fn render(w: &mut fmt::Formatter,
                 let rlang = str::from_utf8(rlang).unwrap();
                 if !LangString::parse(rlang).rust {
                     (my_opaque.dfltblk)(ob, orig_text, lang,
-                                        opaque as *const hoedown_renderer_data);
+                                        opaque as *const hoedown_renderer_data,
+                                        line);
                     true
                 } else {
                     false
@@ -312,7 +312,8 @@ fn dont_escape(c: u8) -> bool {
     }
 
     extern fn header(ob: *mut hoedown_buffer, text: *const hoedown_buffer,
-                     level: libc::c_int, data: *const hoedown_renderer_data) {
+                     level: libc::c_int, data: *const hoedown_renderer_data,
+                     _: libc::size_t) {
         // hoedown does this, we may as well too
         unsafe { hoedown_buffer_puts(ob, "\n\0".as_ptr() as *const _); }
 
@@ -373,6 +374,7 @@ fn dont_escape(c: u8) -> bool {
         ob: *mut hoedown_buffer,
         text: *const hoedown_buffer,
         _: *const hoedown_renderer_data,
+        _: libc::size_t
     ) -> libc::c_int {
         let content = if text.is_null() {
             "".to_owned()
@@ -422,11 +424,12 @@ fn dont_escape(c: u8) -> bool {
     }
 }
 
-pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
+pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector, start_line: usize) {
     extern fn block(_ob: *mut hoedown_buffer,
                     text: *const hoedown_buffer,
                     lang: *const hoedown_buffer,
-                    data: *const hoedown_renderer_data) {
+                    data: *const hoedown_renderer_data,
+                    line: libc::size_t) {
         unsafe {
             if text.is_null() { return }
             let block_info = if lang.is_null() {
@@ -445,16 +448,19 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
                 stripped_filtered_line(l).unwrap_or(l)
             });
             let text = lines.collect::<Vec<&str>>().join("\n");
+            let line = tests.get_line() + line;
             tests.add_test(text.to_owned(),
                            block_info.should_panic, block_info.no_run,
                            block_info.ignore, block_info.test_harness,
-                           block_info.compile_fail, block_info.error_codes);
+                           block_info.compile_fail, block_info.error_codes,
+                           line);
         }
     }
 
     extern fn header(_ob: *mut hoedown_buffer,
                      text: *const hoedown_buffer,
-                     level: libc::c_int, data: *const hoedown_renderer_data) {
+                     level: libc::c_int, data: *const hoedown_renderer_data,
+                     _: libc::size_t) {
         unsafe {
             let opaque = (*data).opaque as *mut hoedown_html_renderer_state;
             let tests = &mut *((*opaque).opaque as *mut ::test::Collector);
@@ -468,6 +474,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
         }
     }
 
+    tests.set_line(start_line);
     unsafe {
         let ob = hoedown_buffer_new(DEF_OUNIT);
         let renderer = hoedown_html_renderer_new(0, 0);
@@ -488,6 +495,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
 
 #[derive(Eq, PartialEq, Clone, Debug)]
 struct LangString {
+    original: String,
     should_panic: bool,
     no_run: bool,
     ignore: bool,
@@ -500,6 +508,7 @@ struct LangString {
 impl LangString {
     fn all_false() -> LangString {
         LangString {
+            original: String::new(),
             should_panic: false,
             no_run: false,
             ignore: false,
@@ -521,6 +530,7 @@ fn parse(string: &str) -> LangString {
             allow_error_code_check = true;
         }
 
+        data.original = string.to_owned();
         let tokens = string.split(|c: char|
             !(c == '_' || c == '-' || c.is_alphanumeric())
         );
@@ -586,7 +596,8 @@ pub fn plain_summary_line(md: &str) -> String {
                        _link: *const hoedown_buffer,
                        _title: *const hoedown_buffer,
                        content: *const hoedown_buffer,
-                       data: *const hoedown_renderer_data) -> libc::c_int
+                       data: *const hoedown_renderer_data,
+                       _: libc::size_t) -> libc::c_int
     {
         unsafe {
             if !content.is_null() && (*content).size > 0 {
@@ -599,8 +610,9 @@ pub fn plain_summary_line(md: &str) -> String {
     }
 
     extern fn normal_text(_ob: *mut hoedown_buffer,
-                              text: *const hoedown_buffer,
-                              data: *const hoedown_renderer_data)
+                          text: *const hoedown_buffer,
+                          data: *const hoedown_renderer_data,
+                          _: libc::size_t)
     {
         unsafe {
             let ob = (*data).opaque as *mut hoedown_buffer;
@@ -647,6 +659,7 @@ fn t(s: &str,
                 test_harness: test_harness,
                 compile_fail: compile_fail,
                 error_codes: error_codes,
+                original: s.to_owned(),
             })
         }
 
index 52257653405e095df56efdd44db607d3c2285a26..40eb7e5ab78c3df024e83346641c41979913fc76 100644 (file)
@@ -1806,12 +1806,13 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: usize, idx2: usize) -> Ordering
                     String::new()
                 };
 
-                let mut unsafety_flag = "";
-                if let clean::FunctionItem(ref func) = myitem.inner {
-                    if func.unsafety == hir::Unsafety::Unsafe {
-                        unsafety_flag = "<a title='unsafe function' href='#'><sup>âš </sup></a>";
+                let unsafety_flag = match myitem.inner {
+                    clean::FunctionItem(ref func) | clean::ForeignFunctionItem(ref func)
+                    if func.unsafety == hir::Unsafety::Unsafe => {
+                        "<a title='unsafe function' href='#'><sup>âš </sup></a>"
                     }
-                }
+                    _ => "",
+                };
 
                 let doc_value = myitem.doc_value().unwrap_or("");
                 write!(w, "
index 503ef4c3183d2aa2ca543501b3bd6d329d54efa1..84f69cd35045c91fd833f4dce04235ecd14048d6 100644 (file)
@@ -193,7 +193,7 @@ pub fn main_args(args: &[String]) -> isize {
     nightly_options::check_nightly_options(&matches, &opts());
 
     if matches.opt_present("h") || matches.opt_present("help") {
-        usage(&args[0]);
+        usage("rustdoc");
         return 0;
     } else if matches.opt_present("version") {
         rustc_driver::version("rustdoc", &matches);
index 369e18948ad5b44dbd18e4ad1c0ff8bd8a31b456..49497957be980734fe03a7e29713a4022b4dd319 100644 (file)
@@ -154,8 +154,9 @@ pub fn test(input: &str, cfgs: Vec<String>, libs: SearchPaths, externs: Externs,
     let mut opts = TestOptions::default();
     opts.no_crate_inject = true;
     let mut collector = Collector::new(input.to_string(), cfgs, libs, externs,
-                                       true, opts, maybe_sysroot);
-    find_testable_code(&input_str, &mut collector);
+                                       true, opts, maybe_sysroot, "input".to_string(),
+                                       None);
+    find_testable_code(&input_str, &mut collector, 0);
     test_args.insert(0, "rustdoctest".to_string());
     testing::test_main(&test_args, collector.tests);
     0
index ab0ac02fd88f1fc6cdeaa97835e24b6090f63719..6f38da4f24b0d5a2196fa96d19c8a6883e1b04d9 100644 (file)
@@ -37,6 +37,7 @@
 use syntax::ast;
 use syntax::codemap::CodeMap;
 use syntax::feature_gate::UnstableFeatures;
+use syntax_pos::{BytePos, DUMMY_SP, Pos};
 use errors;
 use errors::emitter::ColorConfig;
 
@@ -79,7 +80,7 @@ pub fn run(input: &str,
     let _ignore = dep_graph.in_ignore();
     let cstore = Rc::new(CStore::new(&dep_graph));
     let mut sess = session::build_session_(
-        sessopts, &dep_graph, Some(input_path.clone()), handler, codemap, cstore.clone(),
+        sessopts, &dep_graph, Some(input_path.clone()), handler, codemap.clone(), cstore.clone(),
     );
     rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
     sess.parse_sess.config =
@@ -96,13 +97,16 @@ pub fn run(input: &str,
         link::find_crate_name(None, &hir_forest.krate().attrs, &input)
     });
     let opts = scrape_test_config(hir_forest.krate());
+    let filename = input_path.to_str().unwrap_or("").to_owned();
     let mut collector = Collector::new(crate_name,
                                        cfgs,
                                        libs,
                                        externs,
                                        false,
                                        opts,
-                                       maybe_sysroot);
+                                       maybe_sysroot,
+                                       filename,
+                                       Some(codemap));
 
     {
         let dep_graph = DepGraph::new(false);
@@ -256,7 +260,9 @@ fn drop(&mut self) {
                         error_codes.retain(|err| !out.contains(err));
                     }
                 }
-                Ok(()) if compile_fail => panic!("test compiled while it wasn't supposed to"),
+                Ok(()) if compile_fail => {
+                    panic!("test compiled while it wasn't supposed to")
+                }
                 _ => {}
             }
         }
@@ -302,7 +308,7 @@ fn drop(&mut self) {
             if should_panic && out.status.success() {
                 panic!("test executable succeeded when it should have failed");
             } else if !should_panic && !out.status.success() {
-                panic!("test executable failed:\n{}\n{}",
+                panic!("test executable failed:\n{}\n{}\n",
                        str::from_utf8(&out.stdout).unwrap_or(""),
                        str::from_utf8(&out.stderr).unwrap_or(""));
             }
@@ -348,6 +354,7 @@ pub fn maketest(s: &str, cratename: Option<&str>, dont_insert_main: bool,
     prog
 }
 
+// FIXME(aburka): use a real parser to deal with multiline attributes
 fn partition_source(s: &str) -> (String, String) {
     use std_unicode::str::UnicodeStr;
 
@@ -358,7 +365,7 @@ fn partition_source(s: &str) -> (String, String) {
     for line in s.lines() {
         let trimline = line.trim();
         let header = trimline.is_whitespace() ||
-            trimline.starts_with("#![feature");
+            trimline.starts_with("#![");
         if !header || after_header {
             after_header = true;
             after.push_str(line);
@@ -384,11 +391,15 @@ pub struct Collector {
     cratename: String,
     opts: TestOptions,
     maybe_sysroot: Option<PathBuf>,
+    filename: String,
+    start_line: usize,
+    codemap: Option<Rc<CodeMap>>,
 }
 
 impl Collector {
     pub fn new(cratename: String, cfgs: Vec<String>, libs: SearchPaths, externs: Externs,
-               use_headers: bool, opts: TestOptions, maybe_sysroot: Option<PathBuf>) -> Collector {
+               use_headers: bool, opts: TestOptions, maybe_sysroot: Option<PathBuf>,
+               filename: String, codemap: Option<Rc<CodeMap>>) -> Collector {
         Collector {
             tests: Vec::new(),
             names: Vec::new(),
@@ -401,18 +412,17 @@ pub fn new(cratename: String, cfgs: Vec<String>, libs: SearchPaths, externs: Ext
             cratename: cratename,
             opts: opts,
             maybe_sysroot: maybe_sysroot,
+            filename: filename,
+            start_line: 0,
+            codemap: codemap,
         }
     }
 
     pub fn add_test(&mut self, test: String,
                     should_panic: bool, no_run: bool, should_ignore: bool,
-                    as_test_harness: bool, compile_fail: bool, error_codes: Vec<String>) {
-        let name = if self.use_headers {
-            let s = self.current_header.as_ref().map(|s| &**s).unwrap_or("");
-            format!("{}_{}", s, self.cnt)
-        } else {
-            format!("{}_{}", self.names.join("::"), self.cnt)
-        };
+                    as_test_harness: bool, compile_fail: bool, error_codes: Vec<String>,
+                    line: usize) {
+        let name = format!("{} - line {}", self.filename, line);
         self.cnt += 1;
         let cfgs = self.cfgs.clone();
         let libs = self.libs.clone();
@@ -456,6 +466,19 @@ pub fn add_test(&mut self, test: String,
         });
     }
 
+    pub fn get_line(&self) -> usize {
+        if let Some(ref codemap) = self.codemap{
+            let line = codemap.lookup_char_pos(BytePos(self.start_line as u32)).line;
+            if line > 0 { line - 1 } else { line }
+        } else {
+            self.start_line
+        }
+    }
+
+    pub fn set_line(&mut self, start_line: usize) {
+        self.start_line = start_line;
+    }
+
     pub fn register_header(&mut self, name: &str, level: u32) {
         if self.use_headers && level == 1 {
             // we use these headings as test names, so it's good if
@@ -496,7 +519,8 @@ fn visit_testable<F: FnOnce(&mut Self)>(&mut self,
         attrs.unindent_doc_comments();
         if let Some(doc) = attrs.doc_value() {
             self.collector.cnt = 0;
-            markdown::find_testable_code(doc, self.collector);
+            markdown::find_testable_code(doc, self.collector,
+                                         attrs.span.unwrap_or(DUMMY_SP).lo.to_usize());
         }
 
         nested(self);
index 47403b459817b839cef1f6f74c288c1365e8e193..a896c4a634c3660fef9501949ca8178114ae9274 100644 (file)
@@ -7,6 +7,3 @@ version = "0.0.0"
 name = "serialize"
 path = "lib.rs"
 crate-type = ["dylib", "rlib"]
-
-[dependencies]
-rustc_i128 = { path = "../librustc_i128" }
index 3e62026f512195d23069b64ff38b12c54e33998c..07417565e314ff533dd49b4088dd83f8c75e4408 100644 (file)
 use std::{char, f64, fmt, str};
 use std;
 
-use rustc_i128::{i128, u128};
-
 use Encodable;
 
 /// Represents a json value
index 392f332d508dd64e1979579531023b19066cb0cc..a9638717c66fa47dc860adafdf9434d7ab6848a4 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use rustc_i128::{i128, u128};
-
 #[inline]
 fn write_to_vec(vec: &mut Vec<u8>, position: usize, byte: u8) {
     if position == vec.len() {
index 1cb83fa33da068ecca77c6aaedc1111d8f0c55fe..2b31e2f4108063a7b7f88b1a370317ff3434e2a3 100644 (file)
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(core_intrinsics)]
+#![feature(i128_type)]
 #![feature(specialization)]
 #![feature(staged_api)]
 #![cfg_attr(test, feature(test))]
 
 extern crate collections;
 
-extern crate rustc_i128;
-
 pub use self::serialize::{Decoder, Encoder, Decodable, Encodable};
 
 pub use self::serialize::{SpecializationError, SpecializedEncoder, SpecializedDecoder};
index 8a0648d5851a18b988ee74c08d6fb711a1de9284..9c3db64d4d8639a66f3f4ceebdde0e710aec531e 100644 (file)
@@ -13,8 +13,6 @@
 use std::io::{self, Write};
 use serialize;
 
-use rustc_i128::{i128, u128};
-
 // -----------------------------------------------------------------------------
 // Encoder
 // -----------------------------------------------------------------------------
index 395f2ccbe6d28ef166780479f8b9f1c538dc4df1..ba39fcdec6f882bd9fc20abae88ae79f76e9e96a 100644 (file)
@@ -20,7 +20,6 @@
 use std::rc::Rc;
 use std::cell::{Cell, RefCell};
 use std::sync::Arc;
-use rustc_i128::{i128, u128};
 
 pub trait Encoder {
     type Error;
@@ -333,14 +332,12 @@ fn decode<D: Decoder>(d: &mut D) -> Result<u64, D::Error> {
     }
 }
 
-#[cfg(not(stage0))]
 impl Encodable for u128 {
     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
         s.emit_u128(*self)
     }
 }
 
-#[cfg(not(stage0))]
 impl Decodable for u128 {
     fn decode<D: Decoder>(d: &mut D) -> Result<u128, D::Error> {
         d.read_u128()
@@ -407,14 +404,12 @@ fn decode<D: Decoder>(d: &mut D) -> Result<i64, D::Error> {
     }
 }
 
-#[cfg(not(stage0))]
 impl Encodable for i128 {
     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
         s.emit_i128(*self)
     }
 }
 
-#[cfg(not(stage0))]
 impl Decodable for i128 {
     fn decode<D: Decoder>(d: &mut D) -> Result<i128, D::Error> {
         d.read_i128()
index b220504d2b4f5c6eb246303009a99aaec9292d3f..35c388ba076cef69d9c2eb32608275ff884d3a79 100644 (file)
@@ -399,7 +399,7 @@ impl ExactSizeIterator for EscapeDefault {}
 #[unstable(feature = "fused", issue = "35602")]
 impl FusedIterator for EscapeDefault {}
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for EscapeDefault {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("EscapeDefault { .. }")
index 9504194393f9429373ed6e2246bd72b7705e6413..0fca374f6e6d1035381faf7ba96498965663378b 100644 (file)
 
 #![deny(warnings)]
 
-extern crate gcc;
+#[macro_use]
 extern crate build_helper;
+extern crate gcc;
 
 use std::env;
-use std::path::PathBuf;
+use std::fs::{self, File};
+use std::path::{Path, PathBuf};
 use std::process::Command;
-
-use build_helper::run;
+use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date};
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
     println!("cargo:rerun-if-changed=build.rs");
 
     let target = env::var("TARGET").expect("TARGET was not set");
@@ -66,22 +66,17 @@ fn main() {
 }
 
 fn build_libbacktrace(host: &str, target: &str) {
-    let src_dir = env::current_dir().unwrap().join("../libbacktrace");
-    let build_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
+    let build_dir = env::var_os("RUSTBUILD_NATIVE_DIR").unwrap_or(env::var_os("OUT_DIR").unwrap());
+    let build_dir = PathBuf::from(build_dir).join("libbacktrace");
+    let _ = fs::create_dir_all(&build_dir);
 
     println!("cargo:rustc-link-lib=static=backtrace");
     println!("cargo:rustc-link-search=native={}/.libs", build_dir.display());
-
-    let mut stack = src_dir.read_dir().unwrap()
-                           .map(|e| e.unwrap())
-                           .collect::<Vec<_>>();
-    while let Some(entry) = stack.pop() {
-        let path = entry.path();
-        if entry.file_type().unwrap().is_dir() {
-            stack.extend(path.read_dir().unwrap().map(|e| e.unwrap()));
-        } else {
-            println!("cargo:rerun-if-changed={}", path.display());
-        }
+    let src_dir = env::current_dir().unwrap().join("../libbacktrace");
+    rerun_if_changed_anything_in_dir(&src_dir);
+    let timestamp = build_dir.join("rustbuild.timestamp");
+    if up_to_date(&Path::new("build.rs"), &timestamp) && up_to_date(&src_dir, &timestamp) {
+        return
     }
 
     let compiler = gcc::Config::new().get_compiler();
@@ -105,8 +100,11 @@ fn build_libbacktrace(host: &str, target: &str) {
                 .env("AR", &ar)
                 .env("RANLIB", format!("{} s", ar.display()))
                 .env("CFLAGS", cflags));
+
     run(Command::new(build_helper::make(host))
                 .current_dir(&build_dir)
                 .arg(format!("INCDIR={}", src_dir.display()))
                 .arg("-j").arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set")));
+
+    t!(File::create(&timestamp));
 }
index a314717a8772b222524bd660ca7b8248c1adbf60..ffb7a1a1fc15f2b0acd6ad439c9d407fce602259 100644 (file)
@@ -198,9 +198,9 @@ fn capacity(&self, raw_cap: usize) -> usize {
 /// attacks such as HashDoS.
 ///
 /// The hashing algorithm can be replaced on a per-`HashMap` basis using the
-/// `HashMap::default`, `HashMap::with_hasher`, and
-/// `HashMap::with_capacity_and_hasher` methods. Many alternative algorithms
-/// are available on crates.io, such as the `fnv` crate.
+/// [`HashMap::default`], [`HashMap::with_hasher`], and
+/// [`HashMap::with_capacity_and_hasher`] methods. Many alternative algorithms
+/// are available on crates.io, such as the [`fnv`] crate.
 ///
 /// It is required that the keys implement the [`Eq`] and [`Hash`] traits, although
 /// this can frequently be achieved by using `#[derive(PartialEq, Eq, Hash)]`.
@@ -302,6 +302,10 @@ fn capacity(&self, raw_cap: usize) -> usize {
 /// [`PartialEq`]: ../../std/cmp/trait.PartialEq.html
 /// [`RefCell`]: ../../std/cell/struct.RefCell.html
 /// [`Cell`]: ../../std/cell/struct.Cell.html
+/// [`HashMap::default`]: #method.default
+/// [`HashMap::with_hasher`]: #method.with_hasher
+/// [`HashMap::with_capacity_and_hasher`]: #method.with_capacity_and_hasher
+/// [`fnv`]: https://crates.io/crates/fnv
 ///
 /// ```
 /// use std::collections::HashMap;
@@ -680,7 +684,9 @@ fn raw_capacity(&self) -> usize {
     ///
     /// # Panics
     ///
-    /// Panics if the new allocation size overflows `usize`.
+    /// Panics if the new allocation size overflows [`usize`].
+    ///
+    /// [`usize`]: ../../std/primitive.usize.html
     ///
     /// # Examples
     ///
@@ -1141,13 +1147,14 @@ pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V>
 
     /// Inserts a key-value pair into the map.
     ///
-    /// If the map did not have this key present, `None` is returned.
+    /// If the map did not have this key present, [`None`] is returned.
     ///
     /// If the map did have this key present, the value is updated, and the old
     /// value is returned. The key is not updated, though; this matters for
     /// types that can be `==` without being identical. See the [module-level
     /// documentation] for more.
     ///
+    /// [`None`]: ../../std/option/enum.Option.html#variant.None
     /// [module-level documentation]: index.html#insert-and-complex-keys
     ///
     /// # Examples
@@ -1276,7 +1283,7 @@ fn clone(&self) -> Iter<'a, K, V> {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, K: Debug, V: Debug> fmt::Debug for Iter<'a, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list()
@@ -1311,7 +1318,7 @@ fn clone(&self) -> Keys<'a, K, V> {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, K: Debug, V: Debug> fmt::Debug for Keys<'a, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list()
@@ -1334,7 +1341,7 @@ fn clone(&self) -> Values<'a, K, V> {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, K: Debug, V: Debug> fmt::Debug for Values<'a, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list()
@@ -1584,7 +1591,7 @@ fn len(&self) -> usize {
 #[unstable(feature = "fused", issue = "35602")]
 impl<'a, K, V> FusedIterator for IterMut<'a, K, V> {}
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, K, V> fmt::Debug for IterMut<'a, K, V>
     where K: fmt::Debug,
           V: fmt::Debug,
@@ -1619,7 +1626,7 @@ fn len(&self) -> usize {
 #[unstable(feature = "fused", issue = "35602")]
 impl<K, V> FusedIterator for IntoIter<K, V> {}
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<K: Debug, V: Debug> fmt::Debug for IntoIter<K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list()
@@ -1697,7 +1704,7 @@ fn len(&self) -> usize {
 #[unstable(feature = "fused", issue = "35602")]
 impl<'a, K, V> FusedIterator for ValuesMut<'a, K, V> {}
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, K, V> fmt::Debug for ValuesMut<'a, K, V>
     where K: fmt::Debug,
           V: fmt::Debug,
@@ -1732,7 +1739,7 @@ fn len(&self) -> usize {
 #[unstable(feature = "fused", issue = "35602")]
 impl<'a, K, V> FusedIterator for Drain<'a, K, V> {}
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, K, V> fmt::Debug for Drain<'a, K, V>
     where K: fmt::Debug,
           V: fmt::Debug,
@@ -2220,7 +2227,7 @@ fn default() -> RandomState {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for RandomState {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("RandomState { .. }")
index 341b050862f5c455520c25d6496c7a264782fb0b..a3f7e13bbf9131615f369a5ee328947e1cdfc8b2 100644 (file)
@@ -948,7 +948,7 @@ fn len(&self) -> usize {
 #[unstable(feature = "fused", issue = "35602")]
 impl<'a, K> FusedIterator for Iter<'a, K> {}
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, K: fmt::Debug> fmt::Debug for Iter<'a, K> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list()
@@ -977,7 +977,7 @@ fn len(&self) -> usize {
 #[unstable(feature = "fused", issue = "35602")]
 impl<K> FusedIterator for IntoIter<K> {}
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<K: fmt::Debug> fmt::Debug for IntoIter<K> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let entries_iter = self.iter.inner.iter().map(|(k, _)| k);
@@ -1007,7 +1007,7 @@ fn len(&self) -> usize {
 #[unstable(feature = "fused", issue = "35602")]
 impl<'a, K> FusedIterator for Drain<'a, K> {}
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, K: fmt::Debug> fmt::Debug for Drain<'a, K> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let entries_iter = self.iter.inner.iter().map(|(k, _)| k);
@@ -1050,7 +1050,7 @@ fn size_hint(&self) -> (usize, Option<usize>) {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, T, S> fmt::Debug for Intersection<'a, T, S>
     where T: fmt::Debug + Eq + Hash,
           S: BuildHasher,
@@ -1109,7 +1109,7 @@ impl<'a, T, S> FusedIterator for Difference<'a, T, S>
 {
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, T, S> fmt::Debug for Difference<'a, T, S>
     where T: fmt::Debug + Eq + Hash,
           S: BuildHasher,
@@ -1150,7 +1150,7 @@ impl<'a, T, S> FusedIterator for SymmetricDifference<'a, T, S>
 {
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, T, S> fmt::Debug for SymmetricDifference<'a, T, S>
     where T: fmt::Debug + Eq + Hash,
           S: BuildHasher,
@@ -1176,7 +1176,7 @@ impl<'a, T, S> FusedIterator for Union<'a, T, S>
 {
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, T, S> fmt::Debug for Union<'a, T, S>
     where T: fmt::Debug + Eq + Hash,
           S: BuildHasher,
index c3a6b2433ed8815acb1460ba3800a2a13857738b..29f2ac6ab444c05463ac2eb6d87ded54ade44121 100644 (file)
@@ -145,7 +145,7 @@ fn next(&mut self) -> Option<(String, String)> {
     fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Vars {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Vars { .. }")
@@ -159,7 +159,7 @@ fn next(&mut self) -> Option<(OsString, OsString)> { self.inner.next() }
     fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for VarsOs {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("VarsOs { .. }")
@@ -382,7 +382,7 @@ fn next(&mut self) -> Option<PathBuf> { self.inner.next() }
     fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a> fmt::Debug for SplitPaths<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("SplitPaths { .. }")
@@ -665,7 +665,7 @@ fn next_back(&mut self) -> Option<String> {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Args {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Args { .. }")
@@ -690,7 +690,7 @@ impl DoubleEndedIterator for ArgsOs {
     fn next_back(&mut self) -> Option<OsString> { self.inner.next_back() }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for ArgsOs {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("ArgsOs { .. }")
index 249627c430cb7d49299b5cda6a3c4b1d9da91384..e5562d05f10ae92472aebb2a3fbe2c114f82f372 100644 (file)
@@ -869,7 +869,7 @@ pub fn created(&self) -> io::Result<SystemTime> {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Metadata {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("Metadata")
index de5fc5bfad13761297fb0af88c96737c020e99f6..8cb7b2bda7554239a9e2684f51843ad96aae8167 100644 (file)
@@ -1450,7 +1450,7 @@ pub struct Chain<T, U> {
     done_first: bool,
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("Chain")
index 83a675eb512e5c7faf34b5389199a6c3df2fdbcd..e16e8019b5f735fb6e2af5192363d2941bf6b869 100644 (file)
@@ -282,7 +282,7 @@ pub fn read_line(&self, buf: &mut String) -> io::Result<usize> {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Stdin {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Stdin { .. }")
@@ -321,7 +321,7 @@ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() }
     fn consume(&mut self, n: usize) { self.inner.consume(n) }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a> fmt::Debug for StdinLock<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("StdinLock { .. }")
@@ -438,7 +438,7 @@ pub fn lock(&self) -> StdoutLock {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Stdout {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Stdout { .. }")
@@ -470,7 +470,7 @@ fn flush(&mut self) -> io::Result<()> {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a> fmt::Debug for StdoutLock<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("StdoutLock { .. }")
@@ -573,7 +573,7 @@ pub fn lock(&self) -> StderrLock {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Stderr {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Stderr { .. }")
@@ -605,7 +605,7 @@ fn flush(&mut self) -> io::Result<()> {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a> fmt::Debug for StderrLock<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("StderrLock { .. }")
index e50665120eb47c1de435a873ac4ef5ef4667b378..4163187488e6544d378808bde18689977623edf3 100644 (file)
@@ -98,7 +98,7 @@ fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(&[]) }
     fn consume(&mut self, _n: usize) {}
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Empty {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Empty { .. }")
@@ -141,7 +141,7 @@ fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Repeat {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Repeat { .. }")
@@ -180,7 +180,7 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
     fn flush(&mut self) -> io::Result<()> { Ok(()) }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Sink {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Sink { .. }")
index 37632ac76f2dbab5c2e04793a892f7aad619fd9c..3a552c060a9b9066d0031e1007213b15561184e4 100644 (file)
 #![feature(generic_param_attrs)]
 #![feature(hashmap_hasher)]
 #![feature(heap_api)]
+#![feature(i128)]
+#![feature(i128_type)]
 #![feature(inclusive_range)]
 #![feature(int_error_internals)]
 #![feature(integer_atomics)]
 #![feature(oom)]
 #![feature(optin_builtin_traits)]
 #![feature(panic_unwind)]
+#![feature(peek)]
 #![feature(placement_in_syntax)]
 #![feature(prelude_import)]
 #![feature(pub_restricted)]
 #![feature(unwind_attributes)]
 #![feature(vec_push_all)]
 #![feature(zero_one)]
-#![feature(i128)]
 #![cfg_attr(test, feature(update_panic_count))]
 
 // Explicitly import the prelude. The compiler uses this same unstable attribute
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::i64;
 #[unstable(feature = "i128", issue = "35118")]
-#[cfg(not(stage0))]
 pub use core::i128;
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::usize;
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use std_unicode::char;
 #[unstable(feature = "i128", issue = "35118")]
-#[cfg(not(stage0))]
 pub use core::u128;
 
 pub mod f32;
 mod rand;
 mod memchr;
 
-// This module just defines per-platform native library dependencies
-mod rtdeps;
-
 // The runtime entry point and a few unstable public functions used by the
 // compiler
 pub mod rt;
index 751878c687c0150c21d53932b03d39e96c8250df..84c4acb8d9247c4365ca33db13653297f405a914 100644 (file)
@@ -456,6 +456,13 @@ fn from(sock6: SocketAddrV6) -> SocketAddr {
     }
 }
 
+#[stable(feature = "addr_from_into_ip", since = "1.17.0")]
+impl<I: Into<IpAddr>> From<(I, u16)> for SocketAddr {
+    fn from(pieces: (I, u16)) -> SocketAddr {
+        SocketAddr::new(pieces.0.into(), pieces.1)
+    }
+}
+
 impl<'a> IntoInner<(*const c::sockaddr, c::socklen_t)> for &'a SocketAddr {
     fn into_inner(self) -> (*const c::sockaddr, c::socklen_t) {
         match *self {
index 7803cf728f2e98777855e0fa32e7f09e4985769b..5d6e8d319d7b259f31d3e785ad9a9ea2484d038a 100644 (file)
@@ -656,6 +656,13 @@ fn from(ip: u32) -> Ipv4Addr {
     }
 }
 
+#[stable(feature = "ip_from_slice", since = "1.17.0")]
+impl From<[u8; 4]> for IpAddr {
+    fn from(octets: [u8; 4]) -> IpAddr {
+        IpAddr::V4(Ipv4Addr::from(octets))
+    }
+}
+
 impl Ipv6Addr {
     /// Creates a new IPv6 address from eight 16-bit segments.
     ///
@@ -1149,6 +1156,26 @@ fn from_inner(addr: c::in6_addr) -> Ipv6Addr {
     }
 }
 
+#[unstable(feature = "i128", issue = "35118")]
+impl From<Ipv6Addr> for u128 {
+    fn from(ip: Ipv6Addr) -> u128 {
+        let ip = ip.segments();
+        ((ip[0] as u128) << 112) + ((ip[1] as u128) << 96) + ((ip[2] as u128) << 80) +
+            ((ip[3] as u128) << 64) + ((ip[4] as u128) << 48) + ((ip[5] as u128) << 32) +
+            ((ip[6] as u128) << 16) + (ip[7] as u128)
+    }
+}
+#[unstable(feature = "i128", issue = "35118")]
+impl From<u128> for Ipv6Addr {
+    fn from(ip: u128) -> Ipv6Addr {
+        Ipv6Addr::new(
+            (ip >> 112) as u16, (ip >> 96) as u16, (ip >> 80) as u16,
+            (ip >> 64) as u16, (ip >> 48) as u16, (ip >> 32) as u16,
+            (ip >> 16) as u16, ip as u16,
+        )
+    }
+}
+
 #[stable(feature = "ipv6_from_octets", since = "1.9.0")]
 impl From<[u8; 16]> for Ipv6Addr {
     fn from(octets: [u8; 16]) -> Ipv6Addr {
@@ -1166,6 +1193,21 @@ fn from_inner(addr: c::in6_addr) -> Ipv6Addr {
     }
 }
 
+
+#[stable(feature = "ip_from_slice", since = "1.17.0")]
+impl From<[u8; 16]> for IpAddr {
+    fn from(octets: [u8; 16]) -> IpAddr {
+        IpAddr::V6(Ipv6Addr::from(octets))
+    }
+}
+
+#[stable(feature = "ip_from_slice", since = "1.17.0")]
+impl From<[u16; 8]> for IpAddr {
+    fn from(segments: [u16; 8]) -> IpAddr {
+        IpAddr::V6(Ipv6Addr::from(segments))
+    }
+}
+
 // Tests for this module
 #[cfg(all(test, not(target_os = "emscripten")))]
 mod tests {
@@ -1500,14 +1542,26 @@ fn to_socket_addr_socketaddr() {
 
     #[test]
     fn test_ipv4_to_int() {
-        let a = Ipv4Addr::new(127, 0, 0, 1);
-        assert_eq!(u32::from(a), 2130706433);
+        let a = Ipv4Addr::new(0x11, 0x22, 0x33, 0x44);
+        assert_eq!(u32::from(a), 0x11223344);
     }
 
     #[test]
     fn test_int_to_ipv4() {
-        let a = Ipv4Addr::new(127, 0, 0, 1);
-        assert_eq!(Ipv4Addr::from(2130706433), a);
+        let a = Ipv4Addr::new(0x11, 0x22, 0x33, 0x44);
+        assert_eq!(Ipv4Addr::from(0x11223344), a);
+    }
+
+    #[test]
+    fn test_ipv6_to_int() {
+        let a = Ipv6Addr::new(0x1122, 0x3344, 0x5566, 0x7788, 0x99aa, 0xbbcc, 0xddee, 0xff11);
+        assert_eq!(u128::from(a), 0x112233445566778899aabbccddeeff11u128);
+    }
+
+    #[test]
+    fn test_int_to_ipv6() {
+        let a = Ipv6Addr::new(0x1122, 0x3344, 0x5566, 0x7788, 0x99aa, 0xbbcc, 0xddee, 0xff11);
+        assert_eq!(Ipv6Addr::from(0x112233445566778899aabbccddeeff11u128), a);
     }
 
     #[test]
index 2b60fc38198ec3c090c365fc43dc36a96b9f85ae..b0d2e3e4687b44c24e4fee5cf64a14b9109261c0 100644 (file)
@@ -106,7 +106,10 @@ impl Iterator for LookupHost {
     fn next(&mut self) -> Option<SocketAddr> { self.0.next() }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[unstable(feature = "lookup_host", reason = "unsure about the returned \
+                                              iterator and returning socket \
+                                              addresses",
+           issue = "27705")]
 impl fmt::Debug for LookupHost {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("LookupHost { .. }")
index cbc672c28bc6aa858f7a5b1c90f0f7aec8eafa91..9bead22ef7f5e0516267712a326b3c465671e159 100644 (file)
@@ -296,6 +296,29 @@ pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
         self.0.write_timeout()
     }
 
+    /// Receives data on the socket from the remote adress to which it is
+    /// connected, without removing that data from the queue. On success,
+    /// returns the number of bytes peeked.
+    ///
+    /// Successive calls return the same data. This is accomplished by passing
+    /// `MSG_PEEK` as a flag to the underlying `recv` system call.
+    ///
+    /// # Examples
+    ///
+    /// ```no_run
+    /// #![feature(peek)]
+    /// use std::net::TcpStream;
+    ///
+    /// let stream = TcpStream::connect("127.0.0.1:8000")
+    ///                        .expect("couldn't bind to address");
+    /// let mut buf = [0; 10];
+    /// let len = stream.peek(&mut buf).expect("peek failed");
+    /// ```
+    #[unstable(feature = "peek", issue = "38980")]
+    pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
+        self.0.peek(buf)
+    }
+
     /// Sets the value of the `TCP_NODELAY` option on this socket.
     ///
     /// If set, this option disables the Nagle algorithm. This means that
@@ -1406,4 +1429,35 @@ fn set_nonblocking() {
             Err(e) => panic!("unexpected error {}", e),
         }
     }
+
+    #[test]
+    fn peek() {
+        each_ip(&mut |addr| {
+            let (txdone, rxdone) = channel();
+
+            let srv = t!(TcpListener::bind(&addr));
+            let _t = thread::spawn(move|| {
+                let mut cl = t!(srv.accept()).0;
+                cl.write(&[1,3,3,7]).unwrap();
+                t!(rxdone.recv());
+            });
+
+            let mut c = t!(TcpStream::connect(&addr));
+            let mut b = [0; 10];
+            for _ in 1..3 {
+                let len = c.peek(&mut b).unwrap();
+                assert_eq!(len, 4);
+            }
+            let len = c.read(&mut b).unwrap();
+            assert_eq!(len, 4);
+
+            t!(c.set_nonblocking(true));
+            match c.peek(&mut b) {
+                Ok(_) => panic!("expected error"),
+                Err(ref e) if e.kind() == ErrorKind::WouldBlock => {}
+                Err(e) => panic!("unexpected error {}", e),
+            }
+            t!(txdone.send(()));
+        })
+    }
 }
index 492e57f6e44e51f1047de23c4a48f238a11465a8..f452c75d389664ed90bf0da30aa2066ec12a7086 100644 (file)
@@ -83,6 +83,30 @@ pub fn recv_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
         self.0.recv_from(buf)
     }
 
+    /// Receives data from the socket, without removing it from the queue.
+    ///
+    /// Successive calls return the same data. This is accomplished by passing
+    /// `MSG_PEEK` as a flag to the underlying `recvfrom` system call.
+    ///
+    /// On success, returns the number of bytes peeked and the address from
+    /// whence the data came.
+    ///
+    /// # Examples
+    ///
+    /// ```no_run
+    /// #![feature(peek)]
+    /// use std::net::UdpSocket;
+    ///
+    /// let socket = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address");
+    /// let mut buf = [0; 10];
+    /// let (number_of_bytes, src_addr) = socket.peek_from(&mut buf)
+    ///                                         .expect("Didn't receive data");
+    /// ```
+    #[unstable(feature = "peek", issue = "38980")]
+    pub fn peek_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
+        self.0.peek_from(buf)
+    }
+
     /// Sends data on the socket to the given address. On success, returns the
     /// number of bytes written.
     ///
@@ -579,6 +603,37 @@ pub fn recv(&self, buf: &mut [u8]) -> io::Result<usize> {
         self.0.recv(buf)
     }
 
+    /// Receives data on the socket from the remote adress to which it is
+    /// connected, without removing that data from the queue. On success,
+    /// returns the number of bytes peeked.
+    ///
+    /// Successive calls return the same data. This is accomplished by passing
+    /// `MSG_PEEK` as a flag to the underlying `recv` system call.
+    ///
+    /// # Errors
+    ///
+    /// This method will fail if the socket is not connected. The `connect` method
+    /// will connect this socket to a remote address.
+    ///
+    /// # Examples
+    ///
+    /// ```no_run
+    /// #![feature(peek)]
+    /// use std::net::UdpSocket;
+    ///
+    /// let socket = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address");
+    /// socket.connect("127.0.0.1:8080").expect("connect function failed");
+    /// let mut buf = [0; 10];
+    /// match socket.peek(&mut buf) {
+    ///     Ok(received) => println!("received {} bytes", received),
+    ///     Err(e) => println!("peek function failed: {:?}", e),
+    /// }
+    /// ```
+    #[unstable(feature = "peek", issue = "38980")]
+    pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
+        self.0.peek(buf)
+    }
+
     /// Moves this UDP socket into or out of nonblocking mode.
     ///
     /// On Unix this corresponds to calling fcntl, and on Windows this
@@ -869,6 +924,48 @@ fn connect_send_recv() {
         assert_eq!(b"hello world", &buf[..]);
     }
 
+    #[test]
+    fn connect_send_peek_recv() {
+        each_ip(&mut |addr, _| {
+            let socket = t!(UdpSocket::bind(&addr));
+            t!(socket.connect(addr));
+
+            t!(socket.send(b"hello world"));
+
+            for _ in 1..3 {
+                let mut buf = [0; 11];
+                let size = t!(socket.peek(&mut buf));
+                assert_eq!(b"hello world", &buf[..]);
+                assert_eq!(size, 11);
+            }
+
+            let mut buf = [0; 11];
+            let size = t!(socket.recv(&mut buf));
+            assert_eq!(b"hello world", &buf[..]);
+            assert_eq!(size, 11);
+        })
+    }
+
+    #[test]
+    fn peek_from() {
+        each_ip(&mut |addr, _| {
+            let socket = t!(UdpSocket::bind(&addr));
+            t!(socket.send_to(b"hello world", &addr));
+
+            for _ in 1..3 {
+                let mut buf = [0; 11];
+                let (size, _) = t!(socket.peek_from(&mut buf));
+                assert_eq!(b"hello world", &buf[..]);
+                assert_eq!(size, 11);
+            }
+
+            let mut buf = [0; 11];
+            let (size, _) = t!(socket.recv_from(&mut buf));
+            assert_eq!(b"hello world", &buf[..]);
+            assert_eq!(size, 11);
+        })
+    }
+
     #[test]
     fn ttl() {
         let ttl = 100;
index cc154f7ab413b4341307d9eb127b91eb696f86f2..68d4ca900195c5ed8c3161eaa5d9853942fb5500 100644 (file)
@@ -73,7 +73,7 @@ pub enum c_void {
     #[doc(hidden)] __variant2,
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for c_void {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("c_void")
index faf4949e86192e2d76ba2cc7199f9a6a7a67ead7..ac0d0d2afb80328042a8a3109c7cffa366e520b5 100644 (file)
@@ -297,7 +297,7 @@ extern "rust-call" fn call_once(self, _args: ()) -> R {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<T: fmt::Debug> fmt::Debug for AssertUnwindSafe<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_tuple("AssertUnwindSafe")
index e5edea241e1990654e10d0113cc1dae57440363c..d76e8816ca45f3932b37baf92a35fcdf8fca5028 100644 (file)
@@ -311,12 +311,12 @@ pub fn line(&self) -> u32 {
 }
 
 fn default_hook(info: &PanicInfo) {
-    #[cfg(any(not(cargobuild), feature = "backtrace"))]
+    #[cfg(feature = "backtrace")]
     use sys_common::backtrace;
 
     // If this is a double panic, make sure that we print a backtrace
     // for this panic. Otherwise only print it if logging is enabled.
-    #[cfg(any(not(cargobuild), feature = "backtrace"))]
+    #[cfg(feature = "backtrace")]
     let log_backtrace = {
         let panics = update_panic_count(0);
 
@@ -341,7 +341,7 @@ fn default_hook(info: &PanicInfo) {
         let _ = writeln!(err, "thread '{}' panicked at '{}', {}:{}",
                          name, msg, file, line);
 
-        #[cfg(any(not(cargobuild), feature = "backtrace"))]
+        #[cfg(feature = "backtrace")]
         {
             use sync::atomic::{AtomicBool, Ordering};
 
index eb0a6cd74d7bc685a3dc8e864daaceb79f539707..07b43cd89ac711f82d7aeba246184735da033554 100644 (file)
@@ -1265,6 +1265,13 @@ fn borrow(&self) -> &Path {
     }
 }
 
+#[stable(feature = "default_for_pathbuf", since = "1.16.0")]
+impl Default for PathBuf {
+    fn default() -> Self {
+        PathBuf::new()
+    }
+}
+
 #[stable(feature = "cow_from_path", since = "1.6.0")]
 impl<'a> From<&'a Path> for Cow<'a, Path> {
     #[inline]
index 5af4ba53bf9a57e2d79325c68f5a8df60e54f5f6..c16b97ebda5e3c2bd4a1d4a4ca055c6101077c50 100644 (file)
@@ -114,7 +114,7 @@ impl IntoInner<imp::Process> for Child {
     fn into_inner(self) -> imp::Process { self.handle }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Child {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("Child")
@@ -160,7 +160,7 @@ fn from_inner(pipe: AnonPipe) -> ChildStdin {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for ChildStdin {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("ChildStdin { .. }")
@@ -201,7 +201,7 @@ fn from_inner(pipe: AnonPipe) -> ChildStdout {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for ChildStdout {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("ChildStdout { .. }")
@@ -242,7 +242,7 @@ fn from_inner(pipe: AnonPipe) -> ChildStderr {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for ChildStderr {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("ChildStderr { .. }")
@@ -696,7 +696,7 @@ fn from_inner(inner: imp::Stdio) -> Stdio {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Stdio {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Stdio { .. }")
@@ -959,10 +959,27 @@ pub fn wait_with_output(mut self) -> io::Result<Output> {
 ///
 /// # Examples
 ///
+/// Due to this function’s behavior regarding destructors, a conventional way
+/// to use the function is to extract the actual computation to another
+/// function and compute the exit code from its return value:
+///
 /// ```
-/// use std::process;
+/// use std::io::{self, Write};
+///
+/// fn run_app() -> Result<(), ()> {
+///     // Application logic here
+///     Ok(())
+/// }
 ///
-/// process::exit(0);
+/// fn main() {
+///     ::std::process::exit(match run_app() {
+///        Ok(_) => 0,
+///        Err(err) => {
+///            writeln!(io::stderr(), "error: {:?}", err).unwrap();
+///            1
+///        }
+///     });
+/// }
 /// ```
 ///
 /// Due to [platform-specific behavior], the exit code for this example will be
diff --git a/src/libstd/rtdeps.rs b/src/libstd/rtdeps.rs
deleted file mode 100644 (file)
index 5dc6ee2..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! This module contains the linkage attributes to all runtime dependencies of
-//! the standard library This varies per-platform, but these libraries are
-//! necessary for running libstd.
-
-#![cfg(not(cargobuild))]
-
-// LLVM implements the `frem` instruction as a call to `fmod`, which lives in
-// libm. Hence, we must explicitly link to it.
-//
-// On Linux, librt and libdl are indirect dependencies via std,
-// and binutils 2.22+ won't add them automatically
-#[cfg(all(target_os = "linux", not(target_env = "musl")))]
-#[link(name = "dl")]
-#[link(name = "pthread")]
-extern {}
-
-#[cfg(target_os = "android")]
-#[link(name = "dl")]
-#[link(name = "log")]
-extern {}
-
-#[cfg(target_os = "freebsd")]
-#[link(name = "execinfo")]
-#[link(name = "pthread")]
-extern {}
-
-#[cfg(any(target_os = "dragonfly",
-          target_os = "bitrig",
-          target_os = "netbsd",
-          target_os = "openbsd"))]
-#[link(name = "pthread")]
-extern {}
-
-#[cfg(target_os = "solaris")]
-#[link(name = "socket")]
-#[link(name = "posix4")]
-#[link(name = "pthread")]
-extern {}
-
-// For PNaCl targets, nacl_io is a Pepper wrapper for some IO functions
-// missing (ie always error) in Newlib.
-#[cfg(all(target_os = "nacl", not(test)))]
-#[link(name = "nacl_io", kind = "static")]
-#[link(name = "c++", kind = "static")] // for `nacl_io` and EH.
-#[link(name = "pthread", kind = "static")]
-extern {}
-
-#[cfg(target_os = "macos")]
-#[link(name = "System")]
-extern {}
-
-#[cfg(target_os = "ios")]
-#[link(name = "System")]
-extern {}
-
-#[cfg(target_os = "haiku")]
-#[link(name = "network")]
-extern {}
index b8e83dced8d4b100bae84db8804628bb78bef740..fc4fd4ce92b1b6fbe6f37e8fc3d998e90d68b8e4 100644 (file)
@@ -55,7 +55,7 @@ struct BarrierState {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct BarrierWaitResult(bool);
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Barrier {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Barrier { .. }")
@@ -110,7 +110,7 @@ pub fn wait(&self) -> BarrierWaitResult {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for BarrierWaitResult {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("BarrierWaitResult")
index 8ab30c51b282eb601ffba3f3eefbe3f01847851d..7ee1c98565cfd5525fd3afba2cdfba2e4743ac69 100644 (file)
@@ -36,7 +36,7 @@ pub fn timed_out(&self) -> bool {
 /// consumes no CPU time while waiting for an event to occur. Condition
 /// variables are typically associated with a boolean predicate (a condition)
 /// and a mutex. The predicate is always verified inside of the mutex before
-/// determining that thread must block.
+/// determining that thread must block.
 ///
 /// Functions in this module will block the current **thread** of execution and
 /// are bindings to system-provided condition variables where possible. Note
@@ -240,7 +240,7 @@ fn verify(&self, mutex: &sys_mutex::Mutex) {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Condvar {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Condvar { .. }")
index 2efddeb4610dd6211cb7ea06b5c2ae91073cde85..0d6ad5e38e98b0bcdec7b57e691a3675359e546f 100644 (file)
@@ -428,7 +428,7 @@ fn drop(&mut self) {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, T: ?Sized + fmt::Debug> fmt::Debug for MutexGuard<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("MutexGuard")
index a9747639aacd797381e8df74d4eb2b44ecbf13a4..ba99375139139c7d2a1cd71ed5e9c3961e8233df 100644 (file)
@@ -330,7 +330,7 @@ fn call_inner(&'static self,
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl fmt::Debug for Once {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("Once { .. }")
index adbb98e4b1f4f664a99ab278c06a517639e091de..a3db0adeda00dc6042c2c8f26dc77d6c3b65162c 100644 (file)
@@ -361,7 +361,7 @@ unsafe fn new(lock: &'rwlock RwLock<T>)
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, T: fmt::Debug> fmt::Debug for RwLockReadGuard<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("RwLockReadGuard")
@@ -370,7 +370,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<'a, T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'a, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("RwLockWriteGuard")
index 7ad8d27b48330edd475ca1b6db51256efa659cdd..fc81cc737d9f0e3937fe64a504d9bb8bee587719 100644 (file)
@@ -160,6 +160,10 @@ fn custom_flags(&mut self, flags: i32) -> &mut OpenOptions {
 // casts and rely on manual lowering to `stat` if the raw type is desired.
 #[stable(feature = "metadata_ext", since = "1.1.0")]
 pub trait MetadataExt {
+    #[stable(feature = "metadata_ext", since = "1.1.0")]
+    fn dev(&self) -> u64;
+    #[stable(feature = "metadata_ext", since = "1.1.0")]
+    fn ino(&self) -> u64;
     #[stable(feature = "metadata_ext", since = "1.1.0")]
     fn mode(&self) -> u32;
     #[stable(feature = "metadata_ext", since = "1.1.0")]
@@ -184,6 +188,12 @@ pub trait MetadataExt {
 
 #[stable(feature = "metadata_ext", since = "1.1.0")]
 impl MetadataExt for fs::Metadata {
+    fn dev(&self) -> u64 {
+        self.as_inner().as_inner().st_dev as u64
+    }
+    fn ino(&self) -> u64 {
+        self.as_inner().as_inner().st_ino as u64
+    }
     fn mode(&self) -> u32 {
         self.as_inner().as_inner().st_mode as u32
     }
index 0f447ff4ec452c96b5df9a356e42882f2755fdf0..6e35a472792c464de35268ebcd4897bb91d333eb 100644 (file)
@@ -189,11 +189,6 @@ pub fn args() -> Args {
             fn objc_msgSend_ul(obj: NsId, sel: Sel, ...) -> NsId;
         }
 
-        #[link(name = "Foundation", kind = "framework")]
-        #[link(name = "objc")]
-        #[cfg(not(cargobuild))]
-        extern {}
-
         type Sel = *const libc::c_void;
         type NsId = *const libc::c_void;
 
index 585dcbb9a34a1e2330ae5f9450f1128d9fc93df2..2961c4ec58245588d1592ef7d0799702852383c7 100644 (file)
@@ -67,10 +67,20 @@ fn before_exec<F>(&mut self, f: F) -> &mut process::Command
     /// an error indicating why the exec (or another part of the setup of the
     /// `Command`) failed.
     ///
+    /// `exec` not returning has the same implications as calling
+    /// [`process::exit`] â€“ no destructors on the current stack or any other
+    /// thread’s stack will be run. Therefore, it is recommended to only call
+    /// `exec` at a point where it is fine to not run any destructors. Note,
+    /// that the `execvp` syscall independently guarantees that all memory is
+    /// freed and all file descriptors with the `CLOEXEC` option (set by default
+    /// on all file descriptors opened by the standard library) are closed.
+    ///
     /// This function, unlike `spawn`, will **not** `fork` the process to create
     /// a new child. Like spawn, however, the default behavior for the stdio
     /// descriptors will be to inherited from the current process.
     ///
+    /// [`process::exit`]: ../../../process/fn.exit.html
+    ///
     /// # Notes
     ///
     /// The process may be in a "broken state" if this function returns in
index dcab30aad8385b9c9ed38929c3531007a1740b6d..c690fd467ee4125a97ddefb8af01e327c482f933 100644 (file)
@@ -144,11 +144,24 @@ pub fn set_cloexec(&self) -> io::Result<()> {
     pub fn set_cloexec(&self) -> io::Result<()> {
         unsafe {
             let previous = cvt(libc::fcntl(self.fd, libc::F_GETFD))?;
-            cvt(libc::fcntl(self.fd, libc::F_SETFD, previous | libc::FD_CLOEXEC))?;
+            let new = previous | libc::FD_CLOEXEC;
+            if new != previous {
+                cvt(libc::fcntl(self.fd, libc::F_SETFD, new))?;
+            }
+            Ok(())
+        }
+    }
+
+    #[cfg(target_os = "linux")]
+    pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
+        unsafe {
+            let v = nonblocking as c_int;
+            cvt(libc::ioctl(self.fd, libc::FIONBIO, &v))?;
             Ok(())
         }
     }
 
+    #[cfg(not(target_os = "linux"))]
     pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
         unsafe {
             let previous = cvt(libc::fcntl(self.fd, libc::F_GETFL))?;
@@ -157,7 +170,9 @@ pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
             } else {
                 previous & !libc::O_NONBLOCK
             };
-            cvt(libc::fcntl(self.fd, libc::F_SETFL, new))?;
+            if new != previous {
+                cvt(libc::fcntl(self.fd, libc::F_SETFL, new))?;
+            }
             Ok(())
         }
     }
index fd7dc17cccd8cbf36d3a24684215adebeb41326f..c57751a01d7c1b6f0293da4c000cd33b51e0dab4 100644 (file)
@@ -33,7 +33,7 @@
 
 pub mod args;
 pub mod android;
-#[cfg(any(not(cargobuild), feature = "backtrace"))]
+#[cfg(feature = "backtrace")]
 pub mod backtrace;
 pub mod condvar;
 pub mod env;
index ad287bbec3889b276c5292c7fa6efa082600b472..5efddca110f0506a048828e4611ddd2aac2eb723 100644 (file)
 
 use ffi::CStr;
 use io;
-use libc::{self, c_int, size_t, sockaddr, socklen_t, EAI_SYSTEM};
+use libc::{self, c_int, c_void, size_t, sockaddr, socklen_t, EAI_SYSTEM, MSG_PEEK};
+use mem;
 use net::{SocketAddr, Shutdown};
 use str;
 use sys::fd::FileDesc;
 use sys_common::{AsInner, FromInner, IntoInner};
-use sys_common::net::{getsockopt, setsockopt};
+use sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr};
 use time::Duration;
 
 pub use sys::{cvt, cvt_r};
@@ -155,8 +156,46 @@ pub fn duplicate(&self) -> io::Result<Socket> {
         self.0.duplicate().map(Socket)
     }
 
+    fn recv_with_flags(&self, buf: &mut [u8], flags: c_int) -> io::Result<usize> {
+        let ret = cvt(unsafe {
+            libc::recv(self.0.raw(),
+                       buf.as_mut_ptr() as *mut c_void,
+                       buf.len(),
+                       flags)
+        })?;
+        Ok(ret as usize)
+    }
+
     pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
-        self.0.read(buf)
+        self.recv_with_flags(buf, 0)
+    }
+
+    pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
+        self.recv_with_flags(buf, MSG_PEEK)
+    }
+
+    fn recv_from_with_flags(&self, buf: &mut [u8], flags: c_int)
+                            -> io::Result<(usize, SocketAddr)> {
+        let mut storage: libc::sockaddr_storage = unsafe { mem::zeroed() };
+        let mut addrlen = mem::size_of_val(&storage) as libc::socklen_t;
+
+        let n = cvt(unsafe {
+            libc::recvfrom(self.0.raw(),
+                        buf.as_mut_ptr() as *mut c_void,
+                        buf.len(),
+                        flags,
+                        &mut storage as *mut _ as *mut _,
+                        &mut addrlen)
+        })?;
+        Ok((n as usize, sockaddr_to_addr(&storage, addrlen as usize)?))
+    }
+
+    pub fn recv_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
+        self.recv_from_with_flags(buf, 0)
+    }
+
+    pub fn peek_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
+        self.recv_from_with_flags(buf, MSG_PEEK)
     }
 
     pub fn read_to_end(&self, buf: &mut Vec<u8>) -> io::Result<usize> {
index a8ed415b7f47f89216c5e5a83543e1203c7e7252..51e00fc1ab96abe8456cfb7280fc367af249dbef 100644 (file)
@@ -13,7 +13,7 @@
 use libc::{self, c_int};
 use mem;
 use ptr;
-use sys::cvt_r;
+use sys::{cvt, cvt_r};
 use sys::fd::FileDesc;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -29,34 +29,29 @@ pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> {
     // CLOEXEC flag is to use the `pipe2` syscall on Linux. This was added in
     // 2.6.27, however, and because we support 2.6.18 we must detect this
     // support dynamically.
-    if cfg!(target_os = "linux") {
+    if cfg!(any(target_os = "dragonfly",
+                target_os = "freebsd",
+                target_os = "linux",
+                target_os = "netbsd",
+                target_os = "openbsd"))
+    {
         weak! { fn pipe2(*mut c_int, c_int) -> c_int }
         if let Some(pipe) = pipe2.get() {
-            match cvt_r(|| unsafe { pipe(fds.as_mut_ptr(), libc::O_CLOEXEC) }) {
-                Ok(_) => {
-                    return Ok((AnonPipe(FileDesc::new(fds[0])),
-                               AnonPipe(FileDesc::new(fds[1]))))
-                }
-                Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => {}
-                Err(e) => return Err(e),
-            }
+            cvt(unsafe { pipe(fds.as_mut_ptr(), libc::O_CLOEXEC) })?;
+            return Ok((AnonPipe(FileDesc::new(fds[0])),
+                       AnonPipe(FileDesc::new(fds[1]))));
         }
     }
-    if unsafe { libc::pipe(fds.as_mut_ptr()) == 0 } {
-        let fd0 = FileDesc::new(fds[0]);
-        let fd1 = FileDesc::new(fds[1]);
-        Ok((AnonPipe::from_fd(fd0)?, AnonPipe::from_fd(fd1)?))
-    } else {
-        Err(io::Error::last_os_error())
-    }
+    cvt(unsafe { libc::pipe(fds.as_mut_ptr()) })?;
+
+    let fd0 = FileDesc::new(fds[0]);
+    let fd1 = FileDesc::new(fds[1]);
+    fd0.set_cloexec()?;
+    fd1.set_cloexec()?;
+    Ok((AnonPipe(fd0), AnonPipe(fd1)))
 }
 
 impl AnonPipe {
-    pub fn from_fd(fd: FileDesc) -> io::Result<AnonPipe> {
-        fd.set_cloexec()?;
-        Ok(AnonPipe(fd))
-    }
-
     pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
         self.0.read(buf)
     }
index 3497b266340e4c0f9dfc62cb3c39bb0f01c96b68..a4536520376e8dfe35795facc1ac4999354c3eab 100644 (file)
@@ -439,6 +439,10 @@ unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::c_in
     #[test]
     #[cfg_attr(target_os = "macos", ignore)]
     #[cfg_attr(target_os = "nacl", ignore)] // no signals on NaCl.
+    // When run under our current QEMU emulation test suite this test fails,
+    // although the reason isn't very clear as to why. For now this test is
+    // ignored there.
+    #[cfg_attr(target_arch = "arm", ignore)]
     fn test_process_mask() {
         unsafe {
             // Test to make sure that a signal mask does not get inherited.
@@ -471,7 +475,7 @@ fn test_process_mask() {
             // Either EOF or failure (EPIPE) is okay.
             let mut buf = [0; 5];
             if let Ok(ret) = stdout_read.read(&mut buf) {
-                assert!(ret == 0);
+                assert_eq!(ret, 0);
             }
 
             t!(cat.wait());
index 9b1cf6ffd0e2200a4b395e45ffc3c5948e2ffe07..77ebad4e344c24adbcef0ae199fee1c7a9c8168b 100644 (file)
@@ -257,10 +257,6 @@ enum SecRandom {}
     #[allow(non_upper_case_globals)]
     const kSecRandomDefault: *const SecRandom = ptr::null();
 
-    #[link(name = "Security", kind = "framework")]
-    #[cfg(not(cargobuild))]
-    extern {}
-
     extern {
         fn SecRandomCopyBytes(rnd: *const SecRandom,
                               count: size_t, bytes: *mut u8) -> c_int;
index 1b29bf73c7aec09794eff3830c87df9842c2c53c..e5010ca356449cfcf1c56e2145c3aab7c6c44f22 100644 (file)
@@ -167,6 +167,7 @@ fn clone(&self) -> Self { *self }
 pub const FSCTL_SET_REPARSE_POINT: DWORD = 0x900a4;
 
 pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 0x1;
+pub const SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE: DWORD = 0x2;
 
 // Note that these are not actually HANDLEs, just values to pass to GetStdHandle
 pub const STD_INPUT_HANDLE: DWORD = -10i32 as DWORD;
@@ -245,6 +246,7 @@ fn clone(&self) -> Self { *self }
 pub const IP_DROP_MEMBERSHIP: c_int = 13;
 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
+pub const MSG_PEEK: c_int = 0x2;
 
 #[repr(C)]
 pub struct ip_mreq {
@@ -831,13 +833,6 @@ pub struct CONSOLE_READCONSOLE_CONTROL {
 }
 pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL;
 
-#[link(name = "ws2_32")]
-#[link(name = "userenv")]
-#[link(name = "shell32")]
-#[link(name = "advapi32")]
-#[cfg(not(cargobuild))]
-extern {}
-
 extern "system" {
     pub fn WSAStartup(wVersionRequested: WORD,
                       lpWSAData: LPWSADATA) -> c_int;
index c410fcd1ee0ed59f0c2533172541f3cd64a89a17..4efc68afdc4c74f6387f359c788f30eb42b20fbe 100644 (file)
@@ -646,9 +646,25 @@ pub fn symlink_inner(src: &Path, dst: &Path, dir: bool) -> io::Result<()> {
     let src = to_u16s(src)?;
     let dst = to_u16s(dst)?;
     let flags = if dir { c::SYMBOLIC_LINK_FLAG_DIRECTORY } else { 0 };
-    cvt(unsafe {
-        c::CreateSymbolicLinkW(dst.as_ptr(), src.as_ptr(), flags) as c::BOOL
-    })?;
+    // Formerly, symlink creation required the SeCreateSymbolicLink privilege. For the Windows 10
+    // Creators Update, Microsoft loosened this to allow unprivileged symlink creation if the
+    // computer is in Developer Mode, but SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE must be
+    // added to dwFlags to opt into this behaviour.
+    let result = cvt(unsafe {
+        c::CreateSymbolicLinkW(dst.as_ptr(), src.as_ptr(),
+                               flags | c::SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE) as c::BOOL
+    });
+    if let Err(err) = result {
+        if err.raw_os_error() == Some(c::ERROR_INVALID_PARAMETER as i32) {
+            // Older Windows objects to SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE,
+            // so if we encounter ERROR_INVALID_PARAMETER, retry without that flag.
+            cvt(unsafe {
+                c::CreateSymbolicLinkW(dst.as_ptr(), src.as_ptr(), flags) as c::BOOL
+            })?;
+        } else {
+            return Err(err);
+        }
+    }
     Ok(())
 }
 
index aca6994503ff8aa46495e32747fda5c7c1e8a127..adf6210d82e897542d990bd43bcfb7b4cf2bf807 100644 (file)
@@ -147,12 +147,12 @@ pub fn duplicate(&self) -> io::Result<Socket> {
         Ok(socket)
     }
 
-    pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
+    fn recv_with_flags(&self, buf: &mut [u8], flags: c_int) -> io::Result<usize> {
         // On unix when a socket is shut down all further reads return 0, so we
         // do the same on windows to map a shut down socket to returning EOF.
         let len = cmp::min(buf.len(), i32::max_value() as usize) as i32;
         unsafe {
-            match c::recv(self.0, buf.as_mut_ptr() as *mut c_void, len, 0) {
+            match c::recv(self.0, buf.as_mut_ptr() as *mut c_void, len, flags) {
                 -1 if c::WSAGetLastError() == c::WSAESHUTDOWN => Ok(0),
                 -1 => Err(last_error()),
                 n => Ok(n as usize)
@@ -160,6 +160,46 @@ pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
         }
     }
 
+    pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
+        self.recv_with_flags(buf, 0)
+    }
+
+    pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
+        self.recv_with_flags(buf, c::MSG_PEEK)
+    }
+
+    fn recv_from_with_flags(&self, buf: &mut [u8], flags: c_int)
+                            -> io::Result<(usize, SocketAddr)> {
+        let mut storage: c::SOCKADDR_STORAGE_LH = unsafe { mem::zeroed() };
+        let mut addrlen = mem::size_of_val(&storage) as c::socklen_t;
+        let len = cmp::min(buf.len(), <wrlen_t>::max_value() as usize) as wrlen_t;
+
+        // On unix when a socket is shut down all further reads return 0, so we
+        // do the same on windows to map a shut down socket to returning EOF.
+        unsafe {
+            match c::recvfrom(self.0,
+                              buf.as_mut_ptr() as *mut c_void,
+                              len,
+                              flags,
+                              &mut storage as *mut _ as *mut _,
+                              &mut addrlen) {
+                -1 if c::WSAGetLastError() == c::WSAESHUTDOWN => {
+                    Ok((0, net::sockaddr_to_addr(&storage, addrlen as usize)?))
+                },
+                -1 => Err(last_error()),
+                n => Ok((n as usize, net::sockaddr_to_addr(&storage, addrlen as usize)?)),
+            }
+        }
+    }
+
+    pub fn recv_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
+        self.recv_from_with_flags(buf, 0)
+    }
+
+    pub fn peek_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
+        self.recv_from_with_flags(buf, c::MSG_PEEK)
+    }
+
     pub fn read_to_end(&self, buf: &mut Vec<u8>) -> io::Result<usize> {
         let mut me = self;
         (&mut me).read_to_end(buf)
index d464a13ad1d3f67484d986c6976af6099347bcea..0bdbeddb112121b0a015925bc83fc866e4dd0b31 100644 (file)
@@ -39,9 +39,6 @@ pub fn print(w: &mut Write, idx: isize, addr: *mut libc::c_void,
                       msg: *const libc::c_char,
                       errnum: libc::c_int);
     enum backtrace_state {}
-    #[link(name = "backtrace", kind = "static")]
-    #[cfg(all(not(test), not(cargobuild)))]
-    extern {}
 
     extern {
         fn backtrace_create_state(filename: *const libc::c_char,
index 634d6258885e864e7f040233fb883c134e446481..d4d3365dc0198a8129d08c6d10c28f0e85573de3 100644 (file)
@@ -29,7 +29,7 @@
 use sys;
 
 pub mod at_exit_imp;
-#[cfg(any(not(cargobuild), feature = "backtrace"))]
+#[cfg(feature = "backtrace")]
 pub mod backtrace;
 pub mod condvar;
 pub mod io;
@@ -50,7 +50,7 @@
 #[cfg(not(target_os = "redox"))]
 pub mod net;
 
-#[cfg(any(not(cargobuild), feature = "backtrace"))]
+#[cfg(feature = "backtrace")]
 #[cfg(any(all(unix, not(any(target_os = "macos", target_os = "ios", target_os = "emscripten"))),
           all(windows, target_env = "gnu")))]
 pub mod gnu;
index 10ad61f4c800c26b9593a7979edbf2f5cac55ce1..3cdeb511945756d7d8c451ad4ff89ff6aac8f164 100644 (file)
@@ -91,7 +91,7 @@ fn sockname<F>(f: F) -> io::Result<SocketAddr>
     }
 }
 
-fn sockaddr_to_addr(storage: &c::sockaddr_storage,
+pub fn sockaddr_to_addr(storage: &c::sockaddr_storage,
                     len: usize) -> io::Result<SocketAddr> {
     match storage.ss_family as c_int {
         c::AF_INET => {
@@ -222,6 +222,10 @@ pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
         self.inner.timeout(c::SO_SNDTIMEO)
     }
 
+    pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
+        self.inner.peek(buf)
+    }
+
     pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
         self.inner.read(buf)
     }
@@ -441,17 +445,11 @@ pub fn socket_addr(&self) -> io::Result<SocketAddr> {
     }
 
     pub fn recv_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
-        let mut storage: c::sockaddr_storage = unsafe { mem::zeroed() };
-        let mut addrlen = mem::size_of_val(&storage) as c::socklen_t;
-        let len = cmp::min(buf.len(), <wrlen_t>::max_value() as usize) as wrlen_t;
+        self.inner.recv_from(buf)
+    }
 
-        let n = cvt(unsafe {
-            c::recvfrom(*self.inner.as_inner(),
-                        buf.as_mut_ptr() as *mut c_void,
-                        len, 0,
-                        &mut storage as *mut _ as *mut _, &mut addrlen)
-        })?;
-        Ok((n as usize, sockaddr_to_addr(&storage, addrlen as usize)?))
+    pub fn peek_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
+        self.inner.peek_from(buf)
     }
 
     pub fn send_to(&self, buf: &[u8], dst: &SocketAddr) -> io::Result<usize> {
@@ -578,6 +576,10 @@ pub fn recv(&self, buf: &mut [u8]) -> io::Result<usize> {
         self.inner.read(buf)
     }
 
+    pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
+        self.inner.peek(buf)
+    }
+
     pub fn send(&self, buf: &[u8]) -> io::Result<usize> {
         let len = cmp::min(buf.len(), <wrlen_t>::max_value() as usize) as wrlen_t;
         let ret = cvt(unsafe {
index 01584979aabaae59c57e769cee73dd8e25e49477..5166ddf8a21b620bc516150da11ae1dd51926055 100644 (file)
@@ -99,7 +99,7 @@ pub struct LocalKey<T: 'static> {
     init: fn() -> T,
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<T: 'static> fmt::Debug for LocalKey<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("LocalKey { .. }")
@@ -332,7 +332,6 @@ pub struct Key<T> {
         marker: marker::PhantomData<Cell<T>>,
     }
 
-    #[stable(feature = "std_debug", since = "1.15.0")]
     impl<T> fmt::Debug for Key<T> {
         fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
             f.pad("Key { .. }")
index 8789006436c0c7baa2cfe93a0960b3ea1b4faa57..93e320c45223c5978b06f523002e01be941b889b 100644 (file)
@@ -698,7 +698,7 @@ fn new() -> ThreadId {
     }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[unstable(feature = "thread_id", issue = "21507")]
 impl fmt::Debug for ThreadId {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("ThreadId { .. }")
@@ -1002,7 +1002,7 @@ impl<T> IntoInner<imp::Thread> for JoinHandle<T> {
     fn into_inner(self) -> imp::Thread { self.0.native.unwrap() }
 }
 
-#[stable(feature = "std_debug", since = "1.15.0")]
+#[stable(feature = "std_debug", since = "1.16.0")]
 impl<T> fmt::Debug for JoinHandle<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("JoinHandle { .. }")
index f2c53efda173700e9e00e5c03151d4b66654aabf..4269ce8534bd032e056a76dabec6fd88359e1669 100644 (file)
@@ -131,7 +131,6 @@ fn next(&mut self) -> Option<char> {
     }
 }
 
-#[stable(feature = "char_struct_display", since = "1.17.0")]
 impl fmt::Display for CaseMappingIter {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
@@ -152,14 +151,14 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[stable(feature = "char_struct_display", since = "1.17.0")]
+#[stable(feature = "char_struct_display", since = "1.16.0")]
 impl fmt::Display for ToLowercase {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         fmt::Display::fmt(&self.0, f)
     }
 }
 
-#[stable(feature = "char_struct_display", since = "1.17.0")]
+#[stable(feature = "char_struct_display", since = "1.16.0")]
 impl fmt::Display for ToUppercase {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         fmt::Display::fmt(&self.0, f)
index a200da6c293eae0ccd1d764d043e86ae5e877104..0b38f5450b63faf09251971ad20926318130c2ff 100644 (file)
@@ -15,4 +15,3 @@ rustc_bitflags = { path = "../librustc_bitflags" }
 syntax_pos = { path = "../libsyntax_pos" }
 rustc_errors = { path = "../librustc_errors" }
 rustc_data_structures = { path = "../librustc_data_structures" }
-rustc_i128 = { path = "../librustc_i128" }
index d18215be3e638945f8f1c36976a4efbd2da225e8..09fb369cd3568b8f1a4d01507d7606b33f998bce 100644 (file)
@@ -33,8 +33,6 @@
 
 use serialize::{self, Encodable, Decodable, Encoder, Decoder};
 
-use rustc_i128::{u128, i128};
-
 /// An identifier contains a Name (index into the interner
 /// table) and a SyntaxContext to track renaming and
 /// macro expansion per Flatt et al., "Macros That Work Together"
index 099ca8f02d2b20cc63c307d04f859338fa5fd032..455a6a0fb32e21ae736fd81a50579dabdb09f976 100644 (file)
@@ -280,9 +280,9 @@ pub fn with_desugared_doc<T, F>(&self, f: F) -> T where
                 Symbol::intern("doc"),
                 Symbol::intern(&strip_doc_comment_decoration(&comment.as_str())));
             if self.style == ast::AttrStyle::Outer {
-                f(&mk_attr_outer(self.id, meta))
+                f(&mk_attr_outer(self.span, self.id, meta))
             } else {
-                f(&mk_attr_inner(self.id, meta))
+                f(&mk_attr_inner(self.span, self.id, meta))
             }
         } else {
             f(self)
@@ -339,8 +339,8 @@ pub fn mk_attr_id() -> AttrId {
 }
 
 /// Returns an inner attribute with the given value.
-pub fn mk_attr_inner(id: AttrId, item: MetaItem) -> Attribute {
-    mk_spanned_attr_inner(DUMMY_SP, id, item)
+pub fn mk_attr_inner(span: Span, id: AttrId, item: MetaItem) -> Attribute {
+    mk_spanned_attr_inner(span, id, item)
 }
 
 /// Returns an innter attribute with the given value and span.
@@ -356,8 +356,8 @@ pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: MetaItem) -> Attribute
 
 
 /// Returns an outer attribute with the given value.
-pub fn mk_attr_outer(id: AttrId, item: MetaItem) -> Attribute {
-    mk_spanned_attr_outer(DUMMY_SP, id, item)
+pub fn mk_attr_outer(span: Span, id: AttrId, item: MetaItem) -> Attribute {
+    mk_spanned_attr_outer(span, id, item)
 }
 
 /// Returns an outer attribute with the given value and span.
index edf74e1fe19f155d0a19075f42d50f4fb45ef801..9a717b86d091ed6682cd67427c89bda2baadf850 100644 (file)
@@ -10,7 +10,7 @@
 
 pub use self::SyntaxExtension::{MultiDecorator, MultiModifier, NormalTT, IdentTT};
 
-use ast::{self, Attribute, Name, PatKind};
+use ast::{self, Attribute, Name, PatKind, MetaItem};
 use attr::HasAttrs;
 use codemap::{self, CodeMap, ExpnInfo, Spanned, respan};
 use syntax_pos::{Span, ExpnId, NO_EXPANSION};
@@ -471,6 +471,9 @@ fn make_ty(self: Box<DummyResult>) -> Option<P<ast::Ty>> {
     }
 }
 
+pub type BuiltinDeriveFn =
+    for<'cx> fn(&'cx mut ExtCtxt, Span, &MetaItem, &Annotatable, &mut FnMut(Annotatable));
+
 /// An enum representing the different kinds of syntax extensions.
 pub enum SyntaxExtension {
     /// A syntax extension that is attached to an item and creates new items
@@ -507,7 +510,14 @@ pub enum SyntaxExtension {
     ///
     IdentTT(Box<IdentMacroExpander>, Option<Span>, bool),
 
-    CustomDerive(Box<MultiItemModifier>),
+    /// An attribute-like procedural macro. TokenStream -> TokenStream.
+    /// The input is the annotated item.
+    /// Allows generating code to implement a Trait for a given struct
+    /// or enum item.
+    ProcMacroDerive(Box<MultiItemModifier>),
+
+    /// An attribute-like procedural macro that derives a builtin trait.
+    BuiltinDerive(BuiltinDeriveFn),
 }
 
 pub type NamedSyntaxExtension = (Name, SyntaxExtension);
@@ -526,6 +536,9 @@ pub trait Resolver {
     fn find_attr_invoc(&mut self, attrs: &mut Vec<Attribute>) -> Option<Attribute>;
     fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, force: bool)
                      -> Result<Rc<SyntaxExtension>, Determinacy>;
+    fn resolve_builtin_macro(&mut self, tname: Name) -> Result<Rc<SyntaxExtension>, Determinacy>;
+    fn resolve_derive_macro(&mut self, scope: Mark, path: &ast::Path, force: bool)
+                            -> Result<Rc<SyntaxExtension>, Determinacy>;
 }
 
 #[derive(Copy, Clone, Debug)]
@@ -552,6 +565,13 @@ fn resolve_macro(&mut self, _scope: Mark, _path: &ast::Path, _force: bool)
                      -> Result<Rc<SyntaxExtension>, Determinacy> {
         Err(Determinacy::Determined)
     }
+    fn resolve_builtin_macro(&mut self, _tname: Name) -> Result<Rc<SyntaxExtension>, Determinacy> {
+        Err(Determinacy::Determined)
+    }
+    fn resolve_derive_macro(&mut self, _scope: Mark, _path: &ast::Path, _force: bool)
+                            -> Result<Rc<SyntaxExtension>, Determinacy> {
+        Err(Determinacy::Determined)
+    }
 }
 
 #[derive(Clone)]
index 1837fa1e5fee844b2ee957a60e51a69d6c3d3632..f8d4eff80b2d19f7eeb95fb62bdcc8be080688ee 100644 (file)
@@ -16,7 +16,6 @@
 use ext::base::ExtCtxt;
 use ptr::P;
 use symbol::{Symbol, keywords};
-use rustc_i128::u128;
 
 // Transitional reexports so qquote can find the paths it is looking for
 mod syntax {
diff --git a/src/libsyntax/ext/derive.rs b/src/libsyntax/ext/derive.rs
new file mode 100644 (file)
index 0000000..946448e
--- /dev/null
@@ -0,0 +1,218 @@
+// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// 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 ast::Name;
+use attr;
+use ast::{self, NestedMetaItem}; use ext::base::{ExtCtxt, SyntaxExtension};
+use codemap;
+use ext::build::AstBuilder;
+use feature_gate;
+use symbol::Symbol;
+use syntax_pos::Span;
+
+pub fn derive_attr_trait<'a>(cx: &mut ExtCtxt, attr: &'a ast::Attribute)
+                             -> Option<&'a NestedMetaItem> {
+    if attr.name() != "derive" {
+        return None;
+    }
+    if attr.value_str().is_some() {
+        cx.span_err(attr.span, "unexpected value in `derive`");
+        return None;
+    }
+
+    let traits = attr.meta_item_list().unwrap_or(&[]);
+
+    if traits.is_empty() {
+        cx.span_warn(attr.span, "empty trait list in `derive`");
+        return None;
+    }
+
+    return traits.get(0);
+}
+
+pub fn verify_derive_attrs(cx: &mut ExtCtxt, attrs: &[ast::Attribute]) {
+    for attr in attrs {
+        if attr.name() != "derive" {
+            continue;
+        }
+
+        if attr.value_str().is_some() {
+            cx.span_err(attr.span, "unexpected value in `derive`");
+        }
+
+        let traits = attr.meta_item_list().unwrap_or(&[]).to_owned();
+
+        if traits.is_empty() {
+            cx.span_warn(attr.span, "empty trait list in `derive`");
+            attr::mark_used(&attr);
+            continue;
+        }
+        for titem in traits {
+            if titem.word().is_none() {
+                cx.span_err(titem.span, "malformed `derive` entry");
+            }
+        }
+    }
+}
+
+#[derive(PartialEq, Debug, Clone, Copy)]
+pub enum DeriveType {
+    Legacy,
+    ProcMacro,
+    Builtin
+}
+
+impl DeriveType {
+    // Classify a derive trait name by resolving the macro.
+    pub fn classify(cx: &mut ExtCtxt, tname: Name) -> DeriveType {
+        let legacy_derive_name = Symbol::intern(&format!("derive_{}", tname));
+
+        if let Ok(_) = cx.resolver.resolve_builtin_macro(legacy_derive_name) {
+            return DeriveType::Legacy;
+        }
+
+        match cx.resolver.resolve_builtin_macro(tname) {
+            Ok(ext) => match *ext {
+                SyntaxExtension::BuiltinDerive(..) => DeriveType::Builtin,
+                _ => DeriveType::ProcMacro,
+            },
+            Err(_) => DeriveType::ProcMacro,
+        }
+    }
+}
+
+pub fn get_derive_attr(cx: &mut ExtCtxt, attrs: &mut Vec<ast::Attribute>,
+                       derive_type: DeriveType) -> Option<ast::Attribute> {
+    for i in 0..attrs.len() {
+        if attrs[i].name() != "derive" {
+            continue;
+        }
+
+        if attrs[i].value_str().is_some() {
+            continue;
+        }
+
+        let mut traits = attrs[i].meta_item_list().unwrap_or(&[]).to_owned();
+
+        // First, weed out malformed #[derive]
+        traits.retain(|titem| titem.word().is_some());
+
+        let mut titem = None;
+
+        // See if we can find a matching trait.
+        for j in 0..traits.len() {
+            let tname = match traits[j].name() {
+                Some(tname) => tname,
+                _ => continue,
+            };
+
+            if DeriveType::classify(cx, tname) == derive_type {
+                titem = Some(traits.remove(j));
+                break;
+            }
+        }
+
+        // If we find a trait, remove the trait from the attribute.
+        if let Some(titem) = titem {
+            if traits.len() == 0 {
+                attrs.remove(i);
+            } else {
+                let derive = Symbol::intern("derive");
+                let mitem = cx.meta_list(titem.span, derive, traits);
+                attrs[i] = cx.attribute(titem.span, mitem);
+            }
+            let derive = Symbol::intern("derive");
+            let mitem = cx.meta_list(titem.span, derive, vec![titem]);
+            return Some(cx.attribute(mitem.span, mitem));
+        }
+    }
+    return None;
+}
+
+fn allow_unstable(cx: &mut ExtCtxt, span: Span, attr_name: &str) -> Span {
+    Span {
+        expn_id: cx.codemap().record_expansion(codemap::ExpnInfo {
+            call_site: span,
+            callee: codemap::NameAndSpan {
+                format: codemap::MacroAttribute(Symbol::intern(attr_name)),
+                span: Some(span),
+                allow_internal_unstable: true,
+            },
+        }),
+        ..span
+    }
+}
+
+pub fn add_derived_markers(cx: &mut ExtCtxt, attrs: &mut Vec<ast::Attribute>) {
+    if attrs.is_empty() {
+        return;
+    }
+
+    let titems = attrs.iter().filter(|a| {
+        a.name() == "derive"
+    }).flat_map(|a| {
+        a.meta_item_list().unwrap_or(&[]).iter()
+    }).filter_map(|titem| {
+        titem.name()
+    }).collect::<Vec<_>>();
+
+    let span = attrs[0].span;
+
+    if !attrs.iter().any(|a| a.name() == "structural_match") &&
+       titems.iter().any(|t| *t == "PartialEq") && titems.iter().any(|t| *t == "Eq") {
+        let structural_match = Symbol::intern("structural_match");
+        let span = allow_unstable(cx, span, "derive(PartialEq, Eq)");
+        let meta = cx.meta_word(span, structural_match);
+        attrs.push(cx.attribute(span, meta));
+    }
+
+    if !attrs.iter().any(|a| a.name() == "rustc_copy_clone_marker") &&
+       titems.iter().any(|t| *t == "Copy") && titems.iter().any(|t| *t == "Clone") {
+        let structural_match = Symbol::intern("rustc_copy_clone_marker");
+        let span = allow_unstable(cx, span, "derive(Copy, Clone)");
+        let meta = cx.meta_word(span, structural_match);
+        attrs.push(cx.attribute(span, meta));
+    }
+}
+
+pub fn find_derive_attr(cx: &mut ExtCtxt, attrs: &mut Vec<ast::Attribute>)
+                        -> Option<ast::Attribute> {
+    verify_derive_attrs(cx, attrs);
+    get_derive_attr(cx, attrs, DeriveType::Legacy).and_then(|a| {
+        let titem = derive_attr_trait(cx, &a);
+        titem.and_then(|titem| {
+            let tword = titem.word().unwrap();
+            let tname = tword.name();
+            if !cx.ecfg.enable_custom_derive() {
+                feature_gate::emit_feature_err(
+                    &cx.parse_sess,
+                    "custom_derive",
+                    titem.span,
+                    feature_gate::GateIssue::Language,
+                    feature_gate::EXPLAIN_CUSTOM_DERIVE
+                );
+                None
+            } else {
+                let name = Symbol::intern(&format!("derive_{}", tname));
+                if !cx.resolver.is_whitelisted_legacy_custom_derive(name) {
+                    cx.span_warn(titem.span,
+                                 feature_gate::EXPLAIN_DEPR_CUSTOM_DERIVE);
+                }
+                let mitem = cx.meta_word(titem.span, name);
+                Some(cx.attribute(mitem.span, mitem))
+            }
+        })
+    }).or_else(|| {
+        get_derive_attr(cx, attrs, DeriveType::ProcMacro)
+    }).or_else(|| {
+        add_derived_markers(cx, attrs);
+        get_derive_attr(cx, attrs, DeriveType::Builtin)
+    })
+}
index 226625ebc8e5e4fd0cf501ac92ca1145e7029506..8e7f8830eafbc586d2b2c04ad60d44487cc12dc9 100644 (file)
@@ -8,26 +8,27 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use ast::{Block, Ident, Mac_, PatKind};
+use ast::{self, Block, Ident, Mac_, PatKind};
 use ast::{Name, MacStmtStyle, StmtKind, ItemKind};
-use ast;
-use ext::hygiene::Mark;
-use ext::placeholders::{placeholder, PlaceholderExpander};
 use attr::{self, HasAttrs};
 use codemap::{ExpnInfo, NameAndSpan, MacroBang, MacroAttribute};
-use syntax_pos::{self, Span, ExpnId};
 use config::{is_test_or_bench, StripUnconfigured};
 use ext::base::*;
+use ext::derive::{find_derive_attr, derive_attr_trait};
+use ext::hygiene::Mark;
+use ext::placeholders::{placeholder, PlaceholderExpander};
 use feature_gate::{self, Features};
 use fold;
 use fold::*;
-use parse::{ParseSess, DirectoryOwnership, PResult, filemap_to_tts};
 use parse::parser::Parser;
 use parse::token;
+use parse::{ParseSess, DirectoryOwnership, PResult, filemap_to_tts};
 use print::pprust;
 use ptr::P;
 use std_inject;
+use symbol::Symbol;
 use symbol::keywords;
+use syntax_pos::{self, Span, ExpnId};
 use tokenstream::{TokenTree, TokenStream};
 use util::small_vector::SmallVector;
 use visit::Visitor;
@@ -166,6 +167,10 @@ pub enum InvocationKind {
         attr: ast::Attribute,
         item: Annotatable,
     },
+    Derive {
+        attr: ast::Attribute,
+        item: Annotatable,
+    },
 }
 
 impl Invocation {
@@ -173,6 +178,7 @@ fn span(&self) -> Span {
         match self.kind {
             InvocationKind::Bang { span, .. } => span,
             InvocationKind::Attr { ref attr, .. } => attr.span,
+            InvocationKind::Derive { ref attr, .. } => attr.span,
         }
     }
 }
@@ -250,6 +256,13 @@ fn expand(&mut self, expansion: Expansion) -> Expansion {
                     let path = ast::Path::from_ident(attr.span, ident);
                     self.cx.resolver.resolve_macro(scope, &path, force)
                 }
+                InvocationKind::Derive { ref attr, .. } => {
+                    let titem = derive_attr_trait(self.cx, &attr).unwrap();
+                    let tname = titem.name().expect("Expected derive macro name");
+                    let ident = Ident::with_empty_ctxt(tname);
+                    let path = ast::Path::from_ident(attr.span, ident);
+                    self.cx.resolver.resolve_derive_macro(scope, &path, force)
+                }
             };
             let ext = match resolution {
                 Ok(ext) => Some(ext),
@@ -330,6 +343,7 @@ fn expand_invoc(&mut self, invoc: Invocation, ext: Rc<SyntaxExtension>) -> Expan
         match invoc.kind {
             InvocationKind::Bang { .. } => self.expand_bang_invoc(invoc, ext),
             InvocationKind::Attr { .. } => self.expand_attr_invoc(invoc, ext),
+            InvocationKind::Derive { .. } => self.expand_derive_invoc(invoc, ext),
         }
     }
 
@@ -370,7 +384,7 @@ fn expand_attr_invoc(&mut self, invoc: Invocation, ext: Rc<SyntaxExtension>) ->
                 let tok_result = mac.expand(self.cx, attr.span, attr_toks, item_toks);
                 self.parse_expansion(tok_result, kind, name, attr.span)
             }
-            SyntaxExtension::CustomDerive(_) => {
+            SyntaxExtension::ProcMacroDerive(..) | SyntaxExtension::BuiltinDerive(..) => {
                 self.cx.span_err(attr.span, &format!("`{}` is a derive mode", name));
                 kind.dummy(attr.span)
             }
@@ -440,7 +454,7 @@ fn expand_bang_invoc(&mut self, invoc: Invocation, ext: Rc<SyntaxExtension>) ->
                 return kind.dummy(span);
             }
 
-            SyntaxExtension::CustomDerive(..) => {
+            SyntaxExtension::ProcMacroDerive(..) | SyntaxExtension::BuiltinDerive(..) => {
                 self.cx.span_err(path.span, &format!("`{}` is a derive mode", extname));
                 return kind.dummy(span);
             }
@@ -486,6 +500,71 @@ fn expand_bang_invoc(&mut self, invoc: Invocation, ext: Rc<SyntaxExtension>) ->
         })
     }
 
+    /// Expand a derive invocation. Returns the result of expansion.
+    fn expand_derive_invoc(&mut self, invoc: Invocation, ext: Rc<SyntaxExtension>) -> Expansion {
+        let Invocation { expansion_kind: kind, .. } = invoc;
+        let (attr, item) = match invoc.kind {
+            InvocationKind::Derive { attr, item } => (attr, item),
+            _ => unreachable!(),
+        };
+
+        attr::mark_used(&attr);
+        let titem = derive_attr_trait(self.cx, &attr).unwrap();
+        let tname = ast::Ident::with_empty_ctxt(titem.name().unwrap());
+        let name = Symbol::intern(&format!("derive({})", tname));
+        let mitem = &attr.value;
+
+        self.cx.bt_push(ExpnInfo {
+            call_site: attr.span,
+            callee: NameAndSpan {
+                format: MacroAttribute(attr.name()),
+                span: Some(attr.span),
+                allow_internal_unstable: false,
+            }
+        });
+
+        match *ext {
+            SyntaxExtension::ProcMacroDerive(ref ext) => {
+                let span = Span {
+                    expn_id: self.cx.codemap().record_expansion(ExpnInfo {
+                        call_site: mitem.span,
+                        callee: NameAndSpan {
+                            format: MacroAttribute(Symbol::intern(&format!("derive({})", tname))),
+                            span: None,
+                            allow_internal_unstable: false,
+                        },
+                    }),
+                    ..mitem.span
+                };
+                return kind.expect_from_annotatables(ext.expand(self.cx, span, &mitem, item));
+            }
+            SyntaxExtension::BuiltinDerive(func) => {
+                let span = Span {
+                    expn_id: self.cx.codemap().record_expansion(ExpnInfo {
+                        call_site: titem.span,
+                        callee: NameAndSpan {
+                            format: MacroAttribute(name),
+                            span: None,
+                            allow_internal_unstable: true,
+                        },
+                    }),
+                    ..titem.span
+                };
+                let mut items = Vec::new();
+                func(self.cx, span, &mitem, &item, &mut |a| {
+                    items.push(a)
+                });
+                items.insert(0, item);
+                return kind.expect_from_annotatables(items);
+            }
+            _ => {
+                let msg = &format!("macro `{}` may not be used for derive attributes", name);
+                self.cx.span_err(attr.span, &msg);
+                kind.dummy(attr.span)
+            }
+        }
+    }
+
     fn parse_expansion(&mut self, toks: TokenStream, kind: ExpansionKind, name: Name, span: Span)
                        -> Expansion {
         let mut parser = self.cx.new_parser_from_tts(&toks.trees().cloned().collect::<Vec<_>>());
@@ -595,16 +674,31 @@ fn collect_bang(&mut self, mac: ast::Mac, span: Span, kind: ExpansionKind) -> Ex
 
     fn collect_attr(&mut self, attr: ast::Attribute, item: Annotatable, kind: ExpansionKind)
                     -> Expansion {
-        self.collect(kind, InvocationKind::Attr { attr: attr, item: item })
+        let invoc_kind = if attr.name() == "derive" {
+            if kind == ExpansionKind::TraitItems || kind == ExpansionKind::ImplItems {
+                self.cx.span_err(attr.span, "`derive` can be only be applied to items");
+                return kind.expect_from_annotatables(::std::iter::once(item));
+            }
+            InvocationKind::Derive { attr: attr, item: item }
+        } else {
+            InvocationKind::Attr { attr: attr, item: item }
+        };
+
+        self.collect(kind, invoc_kind)
     }
 
     // If `item` is an attr invocation, remove and return the macro attribute.
     fn classify_item<T: HasAttrs>(&mut self, mut item: T) -> (T, Option<ast::Attribute>) {
         let mut attr = None;
+
         item = item.map_attrs(|mut attrs| {
-            attr = self.cx.resolver.find_attr_invoc(&mut attrs);
+            attr = self.cx.resolver.find_attr_invoc(&mut attrs).or_else(|| {
+                find_derive_attr(self.cx, &mut attrs)
+            });
+
             attrs
         });
+
         (item, attr)
     }
 
index 8258a7427b62bbb5ba3ff5208e85b0d59c4996ca..6c46f90f3d4b95abdd791772314e5c8155218d8c 100644 (file)
@@ -41,7 +41,6 @@ pub mod rt {
     pub use parse::new_parser_from_tts;
     pub use syntax_pos::{BytePos, Span, DUMMY_SP};
     pub use codemap::{dummy_spanned};
-    use rustc_i128::{u128};
 
     pub trait ToTokens {
         fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree>;
index 112211851ec0505600528aea7bc457059a486b63..52ef2a05fcf195fa93fb1e72a875aff95ae47de2 100644 (file)
@@ -318,11 +318,14 @@ pub fn new() -> Features {
     (active, abi_unadjusted, "1.16.0", None),
 
     // Macros 1.1
-    (active, proc_macro, "1.16.0", Some(35900)),
+    (active, proc_macro, "1.16.0", Some(38356)),
 
     // Allows attributes on struct literal fields.
     (active, struct_field_attributes, "1.16.0", Some(38814)),
 
+    // Allows #[link(kind="static-nobundle"...]
+    (active, static_nobundle, "1.16.0", Some(37403)),
+
     // `extern "msp430-interrupt" fn()`
     (active, abi_msp430_interrupt, "1.16.0", Some(38487)),
 );
@@ -378,7 +381,7 @@ pub fn new() -> Features {
     (accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)),
     (accepted, item_like_imports, "1.14.0", Some(35120)),
     // Allows using `Self` and associated types in struct expressions and patterns.
-    (accepted, more_struct_aliases, "1.14.0", Some(37544)),
+    (accepted, more_struct_aliases, "1.16.0", Some(37544)),
 );
 // (changing above list without updating src/doc/reference.md makes @cmr sad)
 
index 871e6b3783a41e7d4daba1932e38874e97fc5dd8..87a03adf6b77c018784aa535a3939f0ba1db4a2c 100644 (file)
@@ -33,6 +33,7 @@
 #![feature(unicode)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(specialization)]
+#![feature(i128_type)]
 
 extern crate serialize;
 #[macro_use] extern crate log;
@@ -42,8 +43,6 @@
 extern crate syntax_pos;
 extern crate rustc_data_structures;
 
-extern crate rustc_i128;
-
 extern crate serialize as rustc_serialize; // used by deriving
 
 // A variant of 'try!' that panics on an Err. This is used as a crutch on the
@@ -129,6 +128,7 @@ pub mod print {
 pub mod ext {
     pub mod base;
     pub mod build;
+    pub mod derive;
     pub mod expand;
     pub mod placeholders;
     pub mod hygiene;
index f1a3b523cfd93cef737bd75d0311c04f3c538ca8..20e80afc115f5676ffc746377dd6920f2f2ae7ec 100644 (file)
@@ -28,8 +28,6 @@
 use std::rc::Rc;
 use std::str;
 
-use rustc_i128::u128;
-
 pub type PResult<'a, T> = Result<T, DiagnosticBuilder<'a>>;
 
 #[macro_use]
index 3480db8ec3b7d498c62c9e959102be93b0239773..45d8354d317dc5949959ebbdef94b67cfb157f6b 100644 (file)
@@ -65,8 +65,6 @@
 use std::rc::Rc;
 use std::slice;
 
-use rustc_i128::u128;
-
 bitflags! {
     flags Restrictions: u8 {
         const RESTRICTION_STMT_EXPR         = 1 << 0,
@@ -1693,6 +1691,7 @@ pub fn parse_path(&mut self, mode: PathStyle) -> PResult<'a, ast::Path> {
         }
 
         // Assemble the span.
+        // FIXME(#39450) This is bogus if part of the path is macro generated.
         let span = mk_sp(lo, self.prev_span.hi);
 
         // Assemble the result.
@@ -2456,9 +2455,21 @@ fn parse_dot_or_call_expr_with_(&mut self, e0: P<Expr>, lo: BytePos) -> PResult<
                             Some(f) => f,
                             None => continue,
                         };
-                        err.help(&format!("try parenthesizing the first index; e.g., `(foo.{}){}`",
-                                 float.trunc() as usize,
-                                 format!(".{}", fstr.splitn(2, ".").last().unwrap())));
+                        let sugg = pprust::to_string(|s| {
+                            use print::pprust::PrintState;
+                            use print::pp::word;
+                            s.popen()?;
+                            s.print_expr(&e)?;
+                            word(&mut s.s, ".")?;
+                            s.print_usize(float.trunc() as usize)?;
+                            s.pclose()?;
+                            word(&mut s.s, ".")?;
+                            word(&mut s.s, fstr.splitn(2, ".").last().unwrap())
+                        });
+                        err.span_suggestion(
+                            prev_span,
+                            "try parenthesizing the first index",
+                            sugg);
                     }
                     return Err(err);
 
@@ -3900,7 +3911,14 @@ pub fn parse_block(&mut self) -> PResult<'a, P<Block>> {
                     if self.eat(&token::Semi) {
                         stmt_span.hi = self.prev_span.hi;
                     }
-                    e.span_help(stmt_span, "try placing this code inside a block");
+                    let sugg = pprust::to_string(|s| {
+                        use print::pprust::{PrintState, INDENT_UNIT};
+                        s.ibox(INDENT_UNIT)?;
+                        s.bopen()?;
+                        s.print_stmt(&stmt)?;
+                        s.bclose_maybe_open(stmt.span, INDENT_UNIT, false)
+                    });
+                    e.span_suggestion(stmt_span, "try placing this code inside a block", sugg);
                 }
                 Err(mut e) => {
                     self.recover_stmt_(SemiColonMode::Break);
index e75671d27aa248eaed57ef87d1a51c0b9d90bba5..f8f1820d0b97ea47f3f566e49d877c8c13c54ae8 100644 (file)
 use ptr::P;
 use std_inject;
 use symbol::{Symbol, keywords};
+use syntax_pos::DUMMY_SP;
 use tokenstream::{self, TokenTree};
 
-use rustc_i128::i128;
-
 use std::ascii;
 use std::io::{self, Write, Read};
 use std::iter;
@@ -118,12 +117,12 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
         // #![feature(prelude_import)]
         let prelude_import_meta = attr::mk_list_word_item(Symbol::intern("prelude_import"));
         let list = attr::mk_list_item(Symbol::intern("feature"), vec![prelude_import_meta]);
-        let fake_attr = attr::mk_attr_inner(attr::mk_attr_id(), list);
+        let fake_attr = attr::mk_attr_inner(DUMMY_SP, attr::mk_attr_id(), list);
         s.print_attribute(&fake_attr)?;
 
         // #![no_std]
         let no_std_meta = attr::mk_word_item(Symbol::intern("no_std"));
-        let fake_attr = attr::mk_attr_inner(attr::mk_attr_id(), no_std_meta);
+        let fake_attr = attr::mk_attr_inner(DUMMY_SP, attr::mk_attr_id(), no_std_meta);
         s.print_attribute(&fake_attr)?;
     }
 
index 68d807b24a788547bc8516c68dbffd496e4ce353..4a2dfaf61247cb1648e5ea6ce0a3ffb049556421 100644 (file)
@@ -56,7 +56,8 @@ pub fn maybe_inject_crates_ref(sess: &ParseSess,
     let crate_name = Symbol::intern(&alt_std_name.unwrap_or(name.to_string()));
 
     krate.module.items.insert(0, P(ast::Item {
-        attrs: vec![attr::mk_attr_outer(attr::mk_attr_id(),
+        attrs: vec![attr::mk_attr_outer(DUMMY_SP,
+                                        attr::mk_attr_id(),
                                         attr::mk_word_item(Symbol::intern("macro_use")))],
         vis: ast::Visibility::Inherited,
         node: ast::ItemKind::ExternCrate(Some(crate_name)),
index 74ec33fdd2a85eeea381bbdcd11f842e364e91fc..dd2756cd2b22c95aa42b715c59a095488ab4bf41 100644 (file)
@@ -195,7 +195,8 @@ fn fold_item(&mut self, i: P<ast::Item>) -> SmallVector<P<ast::Item>> {
                     let dead_code_str = Symbol::intern("dead_code");
                     let word_vec = vec![attr::mk_list_word_item(dead_code_str)];
                     let allow_dead_code_item = attr::mk_list_item(allow_str, word_vec);
-                    let allow_dead_code = attr::mk_attr_outer(attr::mk_attr_id(),
+                    let allow_dead_code = attr::mk_attr_outer(DUMMY_SP,
+                                                              attr::mk_attr_id(),
                                                               allow_dead_code_item);
 
                     ast::Item {
index 2ce6fc03f7731a5d85f230b4c167d6cacc01fa6a..974e86a57412446d0b2457b48704e8e46a91f927 100644 (file)
@@ -32,18 +32,18 @@ fn visit_attribute(&mut self, attr: &Attribute) {
     fn visit_mac(&mut self, _mac: &Mac) {}
 }
 
-pub struct CustomDerive {
+pub struct ProcMacroDerive {
     inner: fn(TokenStream) -> TokenStream,
     attrs: Vec<ast::Name>,
 }
 
-impl CustomDerive {
-    pub fn new(inner: fn(TokenStream) -> TokenStream, attrs: Vec<ast::Name>) -> CustomDerive {
-        CustomDerive { inner: inner, attrs: attrs }
+impl ProcMacroDerive {
+    pub fn new(inner: fn(TokenStream) -> TokenStream, attrs: Vec<ast::Name>) -> ProcMacroDerive {
+        ProcMacroDerive { inner: inner, attrs: attrs }
     }
 }
 
-impl MultiItemModifier for CustomDerive {
+impl MultiItemModifier for ProcMacroDerive {
     fn expand(&self,
               ecx: &mut ExtCtxt,
               span: Span,
@@ -54,7 +54,7 @@ fn expand(&self,
             Annotatable::Item(item) => item,
             Annotatable::ImplItem(_) |
             Annotatable::TraitItem(_) => {
-                ecx.span_err(span, "custom derive attributes may only be \
+                ecx.span_err(span, "proc-macro derives may only be \
                                     applied to struct/enum items");
                 return Vec::new()
             }
@@ -63,7 +63,7 @@ fn expand(&self,
             ItemKind::Struct(..) |
             ItemKind::Enum(..) => {},
             _ => {
-                ecx.span_err(span, "custom derive attributes may only be \
+                ecx.span_err(span, "proc-macro derives may only be \
                                     applied to struct/enum items");
                 return Vec::new()
             }
@@ -81,7 +81,7 @@ fn expand(&self,
         let stream = match res {
             Ok(stream) => stream,
             Err(e) => {
-                let msg = "custom derive attribute panicked";
+                let msg = "proc-macro derive panicked";
                 let mut err = ecx.struct_span_fatal(span, msg);
                 if let Some(s) = e.downcast_ref::<String>() {
                     err.help(&format!("message: {}", s));
@@ -100,7 +100,7 @@ fn expand(&self,
                 Ok(new_items) => new_items,
                 Err(_) => {
                     // FIXME: handle this better
-                    let msg = "custom derive produced unparseable tokens";
+                    let msg = "proc-macro derive produced unparseable tokens";
                     ecx.struct_span_fatal(span, msg).emit();
                     panic!(FatalError);
                 }
index e2634c60dcaad0cd8f16ab3e824c8a54e8b7ccbb..498f2348b80f109157f55992e684e7e91111b864 100644 (file)
@@ -13,6 +13,7 @@
 use deriving;
 use deriving::generic::*;
 use deriving::generic::ty::*;
+use deriving::warn_if_deprecated;
 
 use syntax::ast;
 use syntax::ast::{Expr, MetaItem, Mutability};
@@ -35,6 +36,7 @@ pub fn expand_deriving_decodable(cx: &mut ExtCtxt,
                                  mitem: &MetaItem,
                                  item: &Annotatable,
                                  push: &mut FnMut(Annotatable)) {
+    warn_if_deprecated(cx, span, "Decodable");
     expand_deriving_decodable_imp(cx, span, mitem, item, push, "serialize")
 }
 
index 092738ab8a03d372333f6272ae608e775cc9d617..9d155c22ad031d86f4f3508d4195c5c051b5a5d8 100644 (file)
@@ -91,6 +91,7 @@
 use deriving;
 use deriving::generic::*;
 use deriving::generic::ty::*;
+use deriving::warn_if_deprecated;
 
 use syntax::ast::{Expr, ExprKind, MetaItem, Mutability};
 use syntax::ext::base::{Annotatable, ExtCtxt};
@@ -112,6 +113,7 @@ pub fn expand_deriving_encodable(cx: &mut ExtCtxt,
                                  mitem: &MetaItem,
                                  item: &Annotatable,
                                  push: &mut FnMut(Annotatable)) {
+    warn_if_deprecated(cx, span, "Encodable");
     expand_deriving_encodable_imp(cx, span, mitem, item, push, "serialize")
 }
 
index 096f6dfd5d8d86cbae0dc18d3c8a640ec70d1c04..3bceb02f3d6c5af6a2e2cff0a5cb9c452ce275c5 100644 (file)
 
 //! The compiler code necessary to implement the `#[derive]` extensions.
 
-use syntax::ast::{self, MetaItem};
-use syntax::attr::HasAttrs;
+use std::rc::Rc;
+use syntax::ast;
 use syntax::codemap;
-use syntax::ext::base::{Annotatable, ExtCtxt, SyntaxExtension};
+use syntax::ext::base::{Annotatable, ExtCtxt, SyntaxExtension, Resolver};
 use syntax::ext::build::AstBuilder;
-use syntax::feature_gate;
 use syntax::ptr::P;
 use syntax::symbol::Symbol;
 use syntax_pos::Span;
@@ -89,234 +88,6 @@ fn allow_unstable(cx: &mut ExtCtxt, span: Span, attr_name: &str) -> Span {
     }
 }
 
-pub fn expand_derive(cx: &mut ExtCtxt,
-                     span: Span,
-                     mitem: &MetaItem,
-                     annotatable: Annotatable)
-                     -> Vec<Annotatable> {
-    debug!("expand_derive: span = {:?}", span);
-    debug!("expand_derive: mitem = {:?}", mitem);
-    debug!("expand_derive: annotatable input  = {:?}", annotatable);
-    let mut item = match annotatable {
-        Annotatable::Item(item) => item,
-        other => {
-            cx.span_err(span, "`derive` can only be applied to items");
-            return vec![other]
-        }
-    };
-
-    let derive = Symbol::intern("derive");
-    let mut derive_attrs = Vec::new();
-    item = item.map_attrs(|attrs| {
-        let partition = attrs.into_iter().partition(|attr| attr.name() == derive);
-        derive_attrs = partition.0;
-        partition.1
-    });
-
-    // Expand `#[derive]`s after other attribute macro invocations.
-    if cx.resolver.find_attr_invoc(&mut item.attrs.clone()).is_some() {
-        return vec![Annotatable::Item(item.map_attrs(|mut attrs| {
-            attrs.push(cx.attribute(span, mitem.clone()));
-            attrs.extend(derive_attrs);
-            attrs
-        }))];
-    }
-
-    let get_traits = |mitem: &MetaItem, cx: &ExtCtxt| {
-        if mitem.value_str().is_some() {
-            cx.span_err(mitem.span, "unexpected value in `derive`");
-        }
-
-        let traits = mitem.meta_item_list().unwrap_or(&[]).to_owned();
-        if traits.is_empty() {
-            cx.span_warn(mitem.span, "empty trait list in `derive`");
-        }
-        traits
-    };
-
-    let mut traits = get_traits(mitem, cx);
-    for derive_attr in derive_attrs {
-        traits.extend(get_traits(&derive_attr.value, cx));
-    }
-
-    // First, weed out malformed #[derive]
-    traits.retain(|titem| {
-        if titem.word().is_none() {
-            cx.span_err(titem.span, "malformed `derive` entry");
-            false
-        } else {
-            true
-        }
-    });
-
-    // Next, check for old-style #[derive(Foo)]
-    //
-    // These all get expanded to `#[derive_Foo]` and will get expanded first. If
-    // we actually add any attributes here then we return to get those expanded
-    // and then eventually we'll come back to finish off the other derive modes.
-    let mut new_attributes = Vec::new();
-    traits.retain(|titem| {
-        let tword = titem.word().unwrap();
-        let tname = tword.name();
-
-        if is_builtin_trait(tname) || {
-            let derive_mode = ast::Path::from_ident(titem.span, ast::Ident::with_empty_ctxt(tname));
-            cx.resolver.resolve_macro(cx.current_expansion.mark, &derive_mode, false).map(|ext| {
-                if let SyntaxExtension::CustomDerive(_) = *ext { true } else { false }
-            }).unwrap_or(false)
-        } {
-            return true;
-        }
-
-        if !cx.ecfg.enable_custom_derive() {
-            feature_gate::emit_feature_err(&cx.parse_sess,
-                                           "custom_derive",
-                                           titem.span,
-                                           feature_gate::GateIssue::Language,
-                                           feature_gate::EXPLAIN_CUSTOM_DERIVE);
-        } else {
-            let name = Symbol::intern(&format!("derive_{}", tname));
-            if !cx.resolver.is_whitelisted_legacy_custom_derive(name) {
-                cx.span_warn(titem.span, feature_gate::EXPLAIN_DEPR_CUSTOM_DERIVE);
-            }
-            let mitem = cx.meta_word(titem.span, name);
-            new_attributes.push(cx.attribute(mitem.span, mitem));
-        }
-        false
-    });
-    if new_attributes.len() > 0 {
-        item = item.map(|mut i| {
-            i.attrs.extend(new_attributes);
-            if traits.len() > 0 {
-                let list = cx.meta_list(mitem.span, derive, traits);
-                i.attrs.push(cx.attribute(mitem.span, list));
-            }
-            i
-        });
-        return vec![Annotatable::Item(item)]
-    }
-
-    // Now check for macros-1.1 style custom #[derive].
-    //
-    // Expand each of them in order given, but *before* we expand any built-in
-    // derive modes. The logic here is to:
-    //
-    // 1. Collect the remaining `#[derive]` annotations into a list. If
-    //    there are any left, attach a `#[derive]` attribute to the item
-    //    that we're currently expanding with the remaining derive modes.
-    // 2. Manufacture a `#[derive(Foo)]` attribute to pass to the expander.
-    // 3. Expand the current item we're expanding, getting back a list of
-    //    items that replace it.
-    // 4. Extend the returned list with the current list of items we've
-    //    collected so far.
-    // 5. Return everything!
-    //
-    // If custom derive extensions end up threading through the `#[derive]`
-    // attribute, we'll get called again later on to continue expanding
-    // those modes.
-    let macros_11_derive = traits.iter()
-                                 .cloned()
-                                 .enumerate()
-                                 .filter(|&(_, ref name)| !is_builtin_trait(name.name().unwrap()))
-                                 .next();
-    if let Some((i, titem)) = macros_11_derive {
-        let tname = ast::Ident::with_empty_ctxt(titem.name().unwrap());
-        let path = ast::Path::from_ident(titem.span, tname);
-        let ext = cx.resolver.resolve_macro(cx.current_expansion.mark, &path, false).unwrap();
-
-        traits.remove(i);
-        if traits.len() > 0 {
-            item = item.map(|mut i| {
-                let list = cx.meta_list(mitem.span, derive, traits);
-                i.attrs.push(cx.attribute(mitem.span, list));
-                i
-            });
-        }
-        let titem = cx.meta_list_item_word(titem.span, titem.name().unwrap());
-        let mitem = cx.meta_list(titem.span, derive, vec![titem]);
-        let item = Annotatable::Item(item);
-
-        let span = Span {
-            expn_id: cx.codemap().record_expansion(codemap::ExpnInfo {
-                call_site: mitem.span,
-                callee: codemap::NameAndSpan {
-                    format: codemap::MacroAttribute(Symbol::intern(&format!("derive({})", tname))),
-                    span: None,
-                    allow_internal_unstable: false,
-                },
-            }),
-            ..mitem.span
-        };
-
-        if let SyntaxExtension::CustomDerive(ref ext) = *ext {
-            return ext.expand(cx, span, &mitem, item);
-        } else {
-            unreachable!()
-        }
-    }
-
-    // Ok, at this point we know that there are no old-style `#[derive_Foo]` nor
-    // any macros-1.1 style `#[derive(Foo)]`. Expand all built-in traits here.
-
-    // RFC #1445. `#[derive(PartialEq, Eq)]` adds a (trusted)
-    // `#[structural_match]` attribute.
-    let (partial_eq, eq) = (Symbol::intern("PartialEq"), Symbol::intern("Eq"));
-    if traits.iter().any(|t| t.name() == Some(partial_eq)) &&
-       traits.iter().any(|t| t.name() == Some(eq)) {
-        let structural_match = Symbol::intern("structural_match");
-        let span = allow_unstable(cx, span, "derive(PartialEq, Eq)");
-        let meta = cx.meta_word(span, structural_match);
-        item = item.map(|mut i| {
-            i.attrs.push(cx.attribute(span, meta));
-            i
-        });
-    }
-
-    // RFC #1521. `Clone` can assume that `Copy` types' clone implementation is
-    // the same as the copy implementation.
-    //
-    // Add a marker attribute here picked up during #[derive(Clone)]
-    let (copy, clone) = (Symbol::intern("Copy"), Symbol::intern("Clone"));
-    if traits.iter().any(|t| t.name() == Some(clone)) &&
-       traits.iter().any(|t| t.name() == Some(copy)) {
-        let marker = Symbol::intern("rustc_copy_clone_marker");
-        let span = allow_unstable(cx, span, "derive(Copy, Clone)");
-        let meta = cx.meta_word(span, marker);
-        item = item.map(|mut i| {
-            i.attrs.push(cx.attribute(span, meta));
-            i
-        });
-    }
-
-    let mut items = Vec::new();
-    for titem in traits.iter() {
-        let tname = titem.word().unwrap().name();
-        let name = Symbol::intern(&format!("derive({})", tname));
-        let mitem = cx.meta_word(titem.span, name);
-
-        let span = Span {
-            expn_id: cx.codemap().record_expansion(codemap::ExpnInfo {
-                call_site: titem.span,
-                callee: codemap::NameAndSpan {
-                    format: codemap::MacroAttribute(name),
-                    span: None,
-                    allow_internal_unstable: true,
-                },
-            }),
-            ..titem.span
-        };
-
-        let my_item = Annotatable::Item(item);
-        expand_builtin(&tname.as_str(), cx, span, &mitem, &my_item, &mut |a| {
-            items.push(a);
-        });
-        item = my_item.expect_item();
-    }
-
-    items.insert(0, Annotatable::Item(item));
-    return items
-}
-
 macro_rules! derive_traits {
     ($( $name:expr => $func:path, )+) => {
         pub fn is_builtin_trait(name: ast::Name) -> bool {
@@ -326,21 +97,13 @@ pub fn is_builtin_trait(name: ast::Name) -> bool {
             }
         }
 
-        fn expand_builtin(name: &str,
-                          ecx: &mut ExtCtxt,
-                          span: Span,
-                          mitem: &MetaItem,
-                          item: &Annotatable,
-                          push: &mut FnMut(Annotatable)) {
-            match name {
-                $(
-                    $name => {
-                        warn_if_deprecated(ecx, span, $name);
-                        $func(ecx, span, mitem, item, push);
-                    }
-                )*
-                _ => panic!("not a builtin derive mode: {}", name),
-            }
+        pub fn register_builtin_derives(resolver: &mut Resolver) {
+            $(
+                resolver.add_ext(
+                    ast::Ident::with_empty_ctxt(Symbol::intern($name)),
+                    Rc::new(SyntaxExtension::BuiltinDerive($func))
+                );
+            )*
         }
     }
 }
index ebec23d0901a0409ea705cf3db7cbe7fa1275204..7533171b08556df082f2fcabfd27dbcb11e3e3d0 100644 (file)
@@ -24,7 +24,6 @@
 #![feature(staged_api)]
 
 extern crate fmt_macros;
-#[macro_use]
 extern crate log;
 #[macro_use]
 extern crate syntax;
 
 use std::rc::Rc;
 use syntax::ast;
-use syntax::ext::base::{MacroExpanderFn, NormalTT, MultiModifier, NamedSyntaxExtension};
+use syntax::ext::base::{MacroExpanderFn, NormalTT, NamedSyntaxExtension};
 use syntax::symbol::Symbol;
 
 pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver,
                          user_exts: Vec<NamedSyntaxExtension>,
                          enable_quotes: bool) {
+    deriving::register_builtin_derives(resolver);
+
     let mut register = |name, ext| {
         resolver.add_ext(ast::Ident::with_empty_ctxt(name), Rc::new(ext));
     };
@@ -112,8 +113,6 @@ macro_rules! register {
     register(Symbol::intern("format_args"),
              NormalTT(Box::new(format::expand_format_args), None, true));
 
-    register(Symbol::intern("derive"), MultiModifier(Box::new(deriving::expand_derive)));
-
     for (name, ext) in user_exts {
         register(name, ext);
     }
index c8af16e9242f05c8277578b04576d11c13d08b04..325f09a83ddab80860afd3524f7937ab23cd2e7c 100644 (file)
@@ -27,7 +27,7 @@
 
 use deriving;
 
-struct CustomDerive {
+struct ProcMacroDerive {
     trait_name: ast::Name,
     function_name: Ident,
     span: Span,
@@ -40,7 +40,7 @@ struct AttrProcMacro {
 }
 
 struct CollectProcMacros<'a> {
-    derives: Vec<CustomDerive>,
+    derives: Vec<ProcMacroDerive>,
     attr_macros: Vec<AttrProcMacro>,
     in_root: bool,
     handler: &'a errors::Handler,
@@ -176,7 +176,7 @@ fn collect_custom_derive(&mut self, item: &'a ast::Item, attr: &'a ast::Attribut
         };
 
         if self.in_root && item.vis == ast::Visibility::Public {
-            self.derives.push(CustomDerive {
+            self.derives.push(ProcMacroDerive {
                 span: item.span,
                 trait_name: trait_name,
                 function_name: item.ident,
@@ -319,7 +319,7 @@ fn visit_mac(&mut self, mac: &ast::Mac) {
 //          }
 //      }
 fn mk_registrar(cx: &mut ExtCtxt,
-                custom_derives: &[CustomDerive],
+                custom_derives: &[ProcMacroDerive],
                 custom_attrs: &[AttrProcMacro]) -> P<ast::Item> {
     let eid = cx.codemap().record_expansion(ExpnInfo {
         call_site: DUMMY_SP,
index 92fdb45caaaeffbc4425c7370dc7cfff1cc69a74..3808923e7728f9813d4cb33a5e1d6dd0341dc602 100644 (file)
@@ -66,7 +66,7 @@ pub struct Span {
 ///   the error, and would be rendered with `^^^`.
 /// - they can have a *label*. In this case, the label is written next
 ///   to the mark in the snippet when we render.
-#[derive(Clone, Debug, Hash, PartialEq, Eq)]
+#[derive(Clone, Debug, Hash, PartialEq, Eq, RustcEncodable, RustcDecodable)]
 pub struct MultiSpan {
     primary_spans: Vec<Span>,
     span_labels: Vec<(Span, String)>,
index db41a368a1680ed67e5e5f1eec05fcc47f9ac03b..f18b694d3d0c70e5feb861718c31b1cee5f161ba 100644 (file)
@@ -11,8 +11,6 @@
 use std::env;
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
-
     let target = env::var("TARGET").expect("TARGET was not set");
 
     if target.contains("linux") {
index 269c2d65b632706f71d8f304ab4eb51987622d2d..7fb58373251a515be8a104da34b7af5829918597 100644 (file)
@@ -240,34 +240,3 @@ pub unsafe fn _Unwind_RaiseException(exc: *mut _Unwind_Exception) -> _Unwind_Rea
     }
 }
 } // cfg_if!
-
-#[cfg_attr(any(all(target_os = "linux", not(target_env = "musl")),
-               target_os = "freebsd",
-               target_os = "solaris",
-               target_os = "haiku",
-               all(target_os = "linux",
-                   target_env = "musl",
-                   not(target_arch = "x86"),
-                   not(target_arch = "x86_64"))),
-           link(name = "gcc_s"))]
-#[cfg_attr(all(target_os = "linux",
-               target_env = "musl",
-               any(target_arch = "x86", target_arch = "x86_64"),
-               not(test)),
-           link(name = "unwind", kind = "static"))]
-#[cfg_attr(target_os = "fuchsia",
-           link(name = "unwind"))]
-#[cfg_attr(any(target_os = "android", target_os = "openbsd"),
-           link(name = "gcc"))]
-#[cfg_attr(all(target_os = "netbsd", not(target_vendor = "rumprun")),
-           link(name = "gcc"))]
-#[cfg_attr(all(target_os = "netbsd", target_vendor = "rumprun"),
-           link(name = "unwind"))]
-#[cfg_attr(target_os = "dragonfly",
-           link(name = "gcc_pic"))]
-#[cfg_attr(target_os = "bitrig",
-           link(name = "c++abi"))]
-#[cfg_attr(all(target_os = "windows", target_env = "gnu"),
-           link(name = "gcc_eh"))]
-#[cfg(not(cargobuild))]
-extern "C" {}
index a3736a0a1907cbc8bf619708738815a5fd789c80..da282f1bb7277b4d30fa1599ee29ad8eb4dd2a92 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a3736a0a1907cbc8bf619708738815a5fd789c80
+Subproject commit da282f1bb7277b4d30fa1599ee29ad8eb4dd2a92
index 7260a8440734d9ea0f64a47167d06126dc76160d..14c9c5544b188561d41302d3a22ac5a6dcbc32ee 100644 (file)
@@ -21,7 +21,7 @@
 
 [package]
 name = "std_shim"
-version = "0.1.0"
+version = "0.0.0"
 authors = ["The Rust Project Developers"]
 
 [lib]
index ac7842770f5bb8b3ab4bdb90d1148bbc5c1958da..6ef613eee06281060bed344fae9cbc7448a5c215 100644 (file)
@@ -5,7 +5,7 @@
 
 [package]
 name = "test_shim"
-version = "0.1.0"
+version = "0.0.0"
 authors = ["The Rust Project Developers"]
 
 [lib]
index bd0ff9e8d83ccc40c675538e7310887decb614f9..c7bcd2558186e6f94ef24a4e82d14bbedd9326bf 100644 (file)
@@ -588,7 +588,11 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateStaticVariable(
   }
 #endif
 
+#if LLVM_VERSION_GE(4, 0)
+  return wrap(Builder->createGlobalVariableExpression(
+#else
   return wrap(Builder->createGlobalVariable(
+#endif
       unwrapDI<DIDescriptor>(Context), Name, LinkageName,
       unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), IsLocalToUnit,
 #if LLVM_VERSION_GE(4, 0)
@@ -1082,14 +1086,6 @@ extern "C" void LLVMRustAddHandler(LLVMValueRef CatchSwitchRef,
 #endif
 }
 
-extern "C" void LLVMRustSetPersonalityFn(LLVMBuilderRef B,
-                                         LLVMValueRef Personality) {
-#if LLVM_VERSION_GE(3, 8)
-  unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
-      cast<Function>(unwrap(Personality)));
-#endif
-}
-
 #if LLVM_VERSION_GE(3, 8)
 extern "C" OperandBundleDef *LLVMRustBuildOperandBundleDef(const char *Name,
                                                            LLVMValueRef *Inputs,
index 4be9e3e57baacbacef2d76e5630fd9a2f238fdca..cda9a5a96432b9e308c9add87f2a1f0b216a07cd 100644 (file)
@@ -12,5 +12,5 @@
 # tarball for a stable release you'll likely see `1.x.0-$date` where `1.x.0` was
 # released on `$date`
 
-rustc: beta-2016-12-20
+rustc: beta-2017-02-01
 cargo: bfee18f73287687c543bda8c35e4e33808792715
index dc88bfc40595f4401da5db5c86f16c2eede12ccd..61b1a0a0b4d25a702fe28a2b9fbc19696fd51935 100644 (file)
@@ -36,11 +36,9 @@ pub fn plugin_registrar(reg: &mut Registry) {
     reg.register_macro("identity", expand_identity);
     reg.register_syntax_extension(
         Symbol::intern("into_multi_foo"),
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         MultiModifier(Box::new(expand_into_foo_multi)));
     reg.register_syntax_extension(
         Symbol::intern("duplicate"),
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         MultiDecorator(Box::new(expand_duplicate)));
 }
 
index a5359946c09c2626557ba7fbb023b39f9c7db5e2..42fad803bfa68ae345d5643ff0ae3b0e99fbdadb 100644 (file)
@@ -16,7 +16,7 @@
 #[derive(
     A
 )]
-//~^^ ERROR: custom derive produced unparseable tokens
+//~^^ ERROR: proc-macro derive produced unparseable tokens
 struct A;
 
 fn main() {}
index f9906b650fb878c2b7c4340025b2719c15d9bd6b..c483c048b418f11f437a37a8f13a03200cd472a6 100644 (file)
@@ -14,7 +14,7 @@
 extern crate derive_panic;
 
 #[derive(A)]
-//~^ ERROR: custom derive attribute panicked
+//~^ ERROR: proc-macro derive panicked
 //~| HELP: message: nope!
 struct Foo;
 
index f61b8b4073b6f51aa0275e66645290284014744d..e47a4aefb5e0b67447dde7a118477e45622574ba 100644 (file)
@@ -13,7 +13,7 @@
 #![feature(rustc_attrs)]
 
 extern crate derive_a;
-//~^ WARN custom derive crates and `#[no_link]` crates have no effect without `#[macro_use]`
+//~^ WARN proc macro crates and `#[no_link]` crates have no effect without `#[macro_use]`
 
 #[rustc_error]
 fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/E0582.rs b/src/test/compile-fail/E0582.rs
new file mode 100644 (file)
index 0000000..5e6f65a
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This test was derived from the wasm and parsell crates.  They
+// stopped compiling when #32330 is fixed.
+
+#![allow(dead_code, unused_variables)]
+
+use std::str::Chars;
+
+pub trait HasOutput<Ch, Str> {
+    type Output;
+}
+
+#[derive(Clone, PartialEq, Eq, Hash, Ord, PartialOrd, Debug)]
+pub enum Token<'a> {
+    Begin(&'a str)
+}
+
+fn mk_unexpected_char_err<'a>() -> Option<&'a i32> {
+    unimplemented!()
+}
+
+fn foo<'a>(data: &mut Chars<'a>) {
+    bar(mk_unexpected_char_err)
+}
+
+fn bar<F>(t: F)
+    // No type can satisfy this requirement, since `'a` does not
+    // appear in any of the input types:
+    where F: for<'a> Fn() -> Option<&'a i32>
+    //~^ ERROR E0582
+{
+}
+
+fn baz<F>(t: F)
+    // No type can satisfy this requirement, since `'a` does not
+    // appear in any of the input types:
+    where F: for<'a> Iterator<Item=&'a i32>
+    //~^ ERROR E0582
+{
+}
+
+fn main() {
+}
index de6ce798d63542c3d7431f2e182467e538c8144b..7d04372088b76f81ef2863101b6377c34cdec87e 100644 (file)
@@ -12,7 +12,7 @@
 
 #![allow(dead_code)]
 #![feature(rustc_attrs)]
-#![deny(hr_lifetime_in_assoc_type)]
+#![allow(hr_lifetime_in_assoc_type)]
 
 trait Foo<'a> {
     type Item;
@@ -25,40 +25,34 @@ impl<'a> Foo<'a> for() {
 // Check that appearing in a projection input in the argument is not enough:
 #[cfg(func)]
 fn func1(_: for<'a> fn(<() as Foo<'a>>::Item) -> &'a i32) {
-    //[func]~^ ERROR return type references lifetime `'a`
-    //[func]~| WARNING previously accepted
+    //[func]~^ ERROR E0581
 }
 
 // Check that appearing in a projection input in the return still
 // causes an error:
 #[cfg(func)]
 fn func2(_: for<'a> fn() -> <() as Foo<'a>>::Item) {
-    //[func]~^ ERROR return type references lifetime `'a`
-    //[func]~| WARNING previously accepted
+    //[func]~^ ERROR E0581
 }
 
 #[cfg(object)]
 fn object1(_: Box<for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32>) {
-    //[object]~^ ERROR `Output` references lifetime `'a`
-    //[object]~| WARNING previously accepted
+    //[object]~^ ERROR E0582
 }
 
 #[cfg(object)]
 fn object2(_: Box<for<'a> Fn() -> <() as Foo<'a>>::Item>) {
-    //[object]~^ ERROR `Output` references lifetime `'a`
-    //[object]~| WARNING previously accepted
+    //[object]~^ ERROR E0582
 }
 
 #[cfg(clause)]
 fn clause1<T>() where T: for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32 {
     //[clause]~^ ERROR `Output` references lifetime `'a`
-    //[clause]~| WARNING previously accepted
 }
 
 #[cfg(clause)]
 fn clause2<T>() where T: for<'a> Fn() -> <() as Foo<'a>>::Item {
     //[clause]~^ ERROR `Output` references lifetime `'a`
-    //[clause]~| WARNING previously accepted
 }
 
 #[rustc_error]
index 020c9e5e1db5999280df72fbdb813ba9f62e57b2..7cb0623315e1e41ea2fef29da529514f57d8e213 100644 (file)
@@ -13,7 +13,6 @@
 #![allow(dead_code)]
 #![feature(rustc_attrs)]
 #![feature(unboxed_closures)]
-#![deny(hr_lifetime_in_assoc_type)]
 
 trait Foo {
     type Item;
@@ -22,49 +21,41 @@ trait Foo {
 #[cfg(angle)]
 fn angle<T: for<'a> Foo<Item=&'a i32>>() {
     //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
-    //[angle]~| WARNING previously accepted
 }
 
 #[cfg(angle)]
 fn angle1<T>() where T: for<'a> Foo<Item=&'a i32> {
     //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
-    //[angle]~| WARNING previously accepted
 }
 
 #[cfg(angle)]
 fn angle2<T>() where for<'a> T: Foo<Item=&'a i32> {
     //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
-    //[angle]~| WARNING previously accepted
 }
 
 #[cfg(angle)]
 fn angle3(_: &for<'a> Foo<Item=&'a i32>) {
     //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
-    //[angle]~| WARNING previously accepted
 }
 
 #[cfg(paren)]
 fn paren<T: for<'a> Fn() -> &'a i32>() {
     //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
-    //[paren]~| WARNING previously accepted
 }
 
 #[cfg(paren)]
 fn paren1<T>() where T: for<'a> Fn() -> &'a i32 {
     //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
-    //[paren]~| WARNING previously accepted
 }
 
 #[cfg(paren)]
 fn paren2<T>() where for<'a> T: Fn() -> &'a i32 {
     //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
-    //[paren]~| WARNING previously accepted
 }
 
 #[cfg(paren)]
 fn paren3(_: &for<'a> Fn() -> &'a i32) {
     //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
-    //[paren]~| WARNING previously accepted
 }
 
 #[cfg(elision)]
index 0b4a9bf58a66c6af56abd9043d0c084eba46aadf..7c1fbfa53d9651b997c5aa21ed56082a92677ec6 100644 (file)
@@ -22,27 +22,23 @@ trait Foo {
 #[cfg(sig)]
 fn sig1(_: for<'a> fn() -> &'a i32) {
     //[sig]~^ ERROR return type references lifetime `'a`
-    //[sig]~| WARNING previously accepted
 }
 
 #[cfg(sig)]
 fn sig2(_: for<'a, 'b> fn(&'b i32) -> &'a i32) {
     //[sig]~^ ERROR return type references lifetime `'a`
-    //[sig]~| WARNING previously accepted
 }
 
 #[cfg(local)]
 fn local1() {
     let _: for<'a> fn() -> &'a i32 = loop { };
     //[local]~^ ERROR return type references lifetime `'a`
-    //[local]~| WARNING previously accepted
 }
 
 #[cfg(structure)]
 struct Struct1 {
     x: for<'a> fn() -> &'a i32
     //[structure]~^ ERROR return type references lifetime `'a`
-    //[structure]~| WARNING previously accepted
 }
 
 #[cfg(elision)]
diff --git a/src/test/compile-fail/associated-types/cache/wasm-issue-32330.rs b/src/test/compile-fail/associated-types/cache/wasm-issue-32330.rs
deleted file mode 100644 (file)
index 6ba09ac..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// This test was derived from the wasm and parsell crates.  They
-// stopped compiling when #32330 is fixed.
-
-#![allow(dead_code, unused_variables)]
-#![deny(hr_lifetime_in_assoc_type)]
-
-use std::str::Chars;
-
-pub trait HasOutput<Ch, Str> {
-    type Output;
-}
-
-#[derive(Clone, PartialEq, Eq, Hash, Ord, PartialOrd, Debug)]
-pub enum Token<'a> {
-    Begin(&'a str)
-}
-
-fn mk_unexpected_char_err<'a>() -> Option<&'a i32> {
-    unimplemented!()
-}
-
-fn foo<'a>(data: &mut Chars<'a>) {
-    bar(mk_unexpected_char_err)
-    //~^ ERROR lifetime parameter `'a` declared on fn `mk_unexpected_char_err`
-    //~| WARNING hard error in a future release
-}
-
-fn bar<F>(t: F)
-    // No type can satisfy this requirement, since `'a` does not
-    // appear in any of the input types:
-    where F: for<'a> Fn() -> Option<&'a i32>
-    //~^ ERROR associated type `Output` references lifetime `'a`, which does not
-    //~| WARNING hard error in a future release
-{
-}
-
-fn main() {
-}
index e4eca7e7eceb4b1e6b23ffb5e0a5f45e52e3b324..f58eca7c8ae39229b8d75910cebcb205e37119ec 100644 (file)
@@ -17,7 +17,6 @@
 fn main() {
     let tmp: Box<_>;
     let mut buggy_map: HashMap<usize, &usize> = HashMap::new();
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough
 
     // but it is ok if we use a temporary
index f389380584b8469a850d8dc95d7ddc77a6148965..e5afccb9cf3943080ae12feb22ce6675f4ccced6 100644 (file)
@@ -16,7 +16,6 @@ trait Trait { fn foo(&self) {} }
 impl Trait for Foo {}
 
 pub fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let x: Box<Trait> = Box::new(Foo);
     let _y: &Trait = x; //~  ERROR mismatched types
                         //~| expected type `&Trait`
diff --git a/src/test/compile-fail/defaulted-unit-warning.rs b/src/test/compile-fail/defaulted-unit-warning.rs
new file mode 100644 (file)
index 0000000..5213a18
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(dead_code)]
+#![allow(unreachable_code)]
+#![deny(resolve_trait_on_defaulted_unit)]
+
+trait Deserialize: Sized {
+    fn deserialize() -> Result<Self, String>;
+}
+
+impl Deserialize for () {
+    fn deserialize() -> Result<(), String> {
+        Ok(())
+    }
+}
+
+fn doit() -> Result<(), String> {
+    let _ = match Deserialize::deserialize() {
+        //~^ ERROR code relies on type
+        //~| WARNING previously accepted
+        Ok(x) => x,
+        Err(e) => return Err(e),
+    };
+    Ok(())
+}
+
+trait ImplementedForUnitButNotNever {}
+
+impl ImplementedForUnitButNotNever for () {}
+
+fn foo<T: ImplementedForUnitButNotNever>(_t: T) {}
+
+fn smeg() {
+    let _x = return;
+    foo(_x);
+    //~^ ERROR code relies on type
+    //~| WARNING previously accepted
+}
+
+fn main() {
+    let _ = doit();
+}
+
index 596cc1e7d58163e8af3b843089e08092e1ccc43b..d388ece084417160ce98517533942f71e0387ca5 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-tidy-linelength
 
 #[derive(Eqr)]
-//~^ ERROR `#[derive]` for custom traits is not stable enough for use. It is deprecated and will be removed in v1.15 (see issue #29644)
+//~^ ERROR cannot find derive macro `Eqr` in this scope
 struct Foo;
 
 pub fn main() {}
index be822a173ab5821053a21d7b05abb6eb24562f55..97a39a46c19a81774f5e06f1b45118b65c7253da 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[derive(FromPrimitive)] //~ERROR `#[derive]` for custom traits is not stable
+#[derive(FromPrimitive)] //~ERROR cannot find derive macro `FromPrimitive` in this scope
 enum Foo {}
 
 fn main() {}
index 241fabf053c0bdc0cd26736027fe887e64abc88e..10c8f1eed00b0dfe89e26e241c48f738d69db49d 100644 (file)
@@ -41,7 +41,6 @@ fn to_val(&self) -> isize {
 pub fn main() {
     // Assignment.
     let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} };
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let z: Box<ToBar> = Box::new(Bar1 {f: 36});
     f5.ptr = *z;
     //~^ ERROR `ToBar: std::marker::Sized` is not satisfied
index 9e71ad2417792801b1eb88c5efe44ddb4abfcb81..4f7d07600ad154e68712ea96b736c627d8161d0c 100644 (file)
@@ -41,7 +41,6 @@ fn to_val(&self) -> isize {
 pub fn main() {
     // Assignment.
     let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} };
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let z: Box<ToBar> = Box::new(Bar1 {f: 36});
     f5.ptr = Bar1 {f: 36};
     //~^ ERROR mismatched types
diff --git a/src/test/compile-fail/feature-gate-static-nobundle.rs b/src/test/compile-fail/feature-gate-static-nobundle.rs
new file mode 100644 (file)
index 0000000..bc0025c
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[link(name="foo", kind="static-nobundle")]
+//~^ ERROR: kind="static-nobundle" is feature gated
+extern {}
index eb36129799a4e21e833b7927f1af65df1f956c13..1d67bf3a1cddad7617c3cbf9cc73fa0ca399020a 100644 (file)
@@ -23,6 +23,7 @@ fn f(_: Foo) {}
         //~^ WARN `Foo` is ambiguous
         //~| WARN hard error in a future release
         //~| NOTE see issue #38260
+        //~| NOTE #[warn(legacy_imports)] on by default
     }
 }
 
index 43255db2ff3ab96ea443117ed3e70fcbebb6cf97..d4e7dc7e9a35dfc705e0e5bdf36ee8159bcd12e4 100644 (file)
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 fn test<'x>(x: &'x isize) {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
         x //~ ERROR E0312
     }));
index f682d618ab646131735f3cf47ff98976be17369c..7afb8314ea689ffeba0615e449e18a503b16f2f1 100644 (file)
@@ -15,7 +15,6 @@ struct Test {
 }
 
 fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let closure: Box<Fn()+'static> = Box::new(|| ());
     let test = box Test { func: closure }; //~ ERROR mismatched types
 }
index 001e4b51bebc4f619beaa84665fb38a7d6ecf525..346fae11070e15b91e8ef1c8317bda7cf3287292 100644 (file)
@@ -14,7 +14,6 @@ fn new<T>() -> &'static T {
 
 fn main() {
     let &v = new();
-    //~^ ERROR unable to infer enough type information about `_` [E0282]
+    //~^ ERROR type annotations needed [E0282]
     //~| NOTE cannot infer type for `_`
-    //~| NOTE type annotations or generic parameter binding
 }
index 7cbee402b368253cb59845e912ed357307f77f33..848174d6fe1e057e1670c5e4d6e4e3161416e038 100644 (file)
@@ -14,7 +14,6 @@ fn new<'r, T>() -> &'r T {
 
 fn main() {
     let &v = new();
-    //~^ ERROR unable to infer enough type information about `_` [E0282]
+    //~^ ERROR type annotations needed [E0282]
     //~| NOTE cannot infer type for `_`
-    //~| NOTE type annotations or generic parameter binding
 }
index 508442fcb9453e4a0327aeb9c540f5cff5e3e736..ecf81c8af17f61018f4028cf2c0306ffa1a56876 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:type annotations or generic parameter binding required
+// error-pattern:type annotations needed
 fn main() {
     panic!(
         std::default::Default::default()
index 45ab9903532e73a399a18982bc1a48fb85c1f779..bddc9c13815e741ef8d9b2b00928acc90236e1d9 100644 (file)
@@ -13,7 +13,6 @@ fn main() {
     //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]`
     //~^^ HELP consider using an implicit coercion to `&[usize]` instead
 
-    // FIXME (#22405): Replace `std::boxed::Box::new` with `box` here when/if possible.
     let _bar = Box::new(1_usize) as std::fmt::Debug;
     //~^ ERROR cast to unsized type: `std::boxed::Box<usize>` as `std::fmt::Debug`
     //~^^ HELP try casting to a `Box` instead
index 5e69553d3a48532e1a78b6a50a60f4e9441cf98e..b55863f0dda7af14a55354c721e5c97046a42531 100644 (file)
@@ -13,6 +13,6 @@
 struct B<T>(marker::PhantomData<T>);
 
 fn main() {
-    let foo = B(marker::PhantomData); //~ ERROR unable to infer enough type information
+    let foo = B(marker::PhantomData); //~ ERROR type annotations needed
     let closure = || foo;
 }
index 3ea136aca4becdc9da48b09ef452906a7377e5d9..4996da057dd8ebc7be04358282479c5810b8a486 100644 (file)
@@ -12,7 +12,6 @@
 // and rejected.
 
 fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     (|| Box::new(*(&[0][..])))();
     //~^ ERROR `[{integer}]: std::marker::Sized` is not satisfied
 }
index e46bcf46cc3983dca3e36ab72d65278b3db1bb23..8991eded3d6b87d9be86a1b3c4d6d1bacdc46329 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 fn main() {
-    let x; //~ ERROR unable to infer enough type information
+    let x; //~ ERROR type annotations needed
 }
index 5eb3c439df2f3170d5a2cafb8bb01f5f308777c7..9a7b3781f1e24873ab6a627eb857695caa671176 100644 (file)
@@ -10,8 +10,6 @@
 
 use std::cell::RefCell;
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 fn main() {
     let mut y = 1;
     let c = RefCell::new(vec![]);
index 1be082ba9bbbad454982a42a82d8ce3e7c4b6361..4dfad4ee3c385d25b164a94393d4100806a18122 100644 (file)
@@ -15,5 +15,4 @@ fn main()
     let b:Box<Any> = Box::new(bar as fn(_)->_);
     b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282
                                   //~| NOTE cannot infer type for `_`
-                                  //~| NOTE type annotations or generic parameter binding required
 }
index c274665530fdb67f28b8108f4353b6adfe1265be..28109747b755747db465d323382a6aec6fda0822 100644 (file)
@@ -25,6 +25,6 @@ pub fn let_<'var, VAR, F: for<'v: 'var> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>>
 
 fn main() {
     let ex = |x| {
-        let_(add(x,x), |y| { //~ ERROR unable to infer enough type information about `VAR`
+        let_(add(x,x), |y| { //~ ERROR type annotations needed
             let_(add(x, x), |x|x)})};
 }
index df857a2e6eb1f9766a2cefabd0234aedf1b275dc..a7232781f6fbcfc710796b5b2de900f64157ccb4 100644 (file)
@@ -13,5 +13,5 @@ fn main() {
     let a = 1;
     let b = 2;
     unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
-    //~^ ERROR unable to infer enough type information about `_`
+    //~^ ERROR type annotations needed
 }
index 82804bb747406652640df86fffcd594a607476fa..086938334c78aa5480dc39ffedd72f8eb883b4d4 100644 (file)
@@ -9,5 +9,7 @@
 // except according to those terms.
 
 #![deny(warnings)] //~ NOTE: lint level defined here
-use std::thread; //~ ERROR: unused import
+use std::thread;
+//~^ ERROR: unused import
+//~| NOTE: #[deny(unused_imports)] implied by #[deny(warnings)]
 fn main() {}
index 085b4e76afbf71650fece23c0481522a9d9de5da..851f5dfeabe8ac31fa90ce61c8d6f96093ff6f84 100644 (file)
@@ -25,13 +25,11 @@ fn main() {
     let _woohoo = (&my_struct).priv_field;
     //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
 
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let _woohoo = (Box::new(my_struct)).priv_field;
     //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
 
     (&my_struct).happyfun();               //~ ERROR method `happyfun` is private
 
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     (Box::new(my_struct)).happyfun();          //~ ERROR method `happyfun` is private
     let nope = my_struct.priv_field;
     //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
index 51f5fc5ee98e1f38a3e14c46908b23d66af9f48f..c5aae894c3ecbc44c60b6de14a7dae510442b6c6 100644 (file)
@@ -13,7 +13,6 @@
 fn id<T>(t: T) -> T { t }
 
 fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     id(Box::new(|| *v))
         //~^ ERROR E0373
         //~| NOTE `v` is borrowed here
index cf78d6d8c0ad4715686519707a9b3e8050962318..ebfa4975d4d75c7ba77b1b444f20d243ac79e5f3 100644 (file)
@@ -9,4 +9,4 @@
 // except according to those terms.
 
 fn main() { format!("{:?}", None); }
-    //~^ ERROR unable to infer enough type information about `T` [E0282]
+    //~^ ERROR type annotations needed [E0282]
index 3816896d43d1f47533d3bad1366161d95f3b1472..87cf2b3f740c1c7528a5b47b6c0a3bc311b7d345 100644 (file)
@@ -11,5 +11,5 @@
 fn main() {
     // Unconstrained type:
     format!("{:?}", None);
-    //~^ ERROR unable to infer enough type information about `T` [E0282]
+    //~^ ERROR type annotations needed [E0282]
 }
index 8029522f5d3cc9cdb3bb696c769c50032dc4e6ce..1503da2baa73d24af5146d0f41337c97c30eaef7 100644 (file)
@@ -12,7 +12,6 @@
 
 fn main() {
     mem::transmute(0);
-    //~^ ERROR unable to infer enough type information about `U` [E0282]
+    //~^ ERROR type annotations needed [E0282]
     //~| NOTE cannot infer type for `U`
-    //~| NOTE type annotations or generic parameter binding
 }
index f8354ddbf12a58df5563eb80639a3dfb1cfab696..db4d4e76c11c9ae26a91b738678d6cb99786788d 100644 (file)
@@ -17,9 +17,8 @@ pub fn foo<State>(_: TypeWithState<State>) {}
 
 pub fn bar() {
    foo(TypeWithState(marker::PhantomData));
-   //~^ ERROR unable to infer enough type information about `State` [E0282]
+   //~^ ERROR type annotations needed [E0282]
    //~| NOTE cannot infer type for `State`
-   //~| NOTE type annotations or generic parameter binding
 }
 
 fn main() {
index e37a881642393fd9400a7f2fe0d2ea24c6521171..fdd89058fd3973498140ded97fe2f7b3d1c2d43c 100644 (file)
@@ -10,7 +10,7 @@
 
 fn main() {
     let v = &[];
-    let it = v.iter(); //~ ERROR unable to infer enough type information about `T` [E0282]
+    let it = v.iter(); //~ ERROR type annotations needed [E0282]
                        //~| NOTE cannot infer type for `T`
-                       //~| NOTE type annotations or generic parameter binding
+                       //~| NOTE consider giving `it` a type
 }
diff --git a/src/test/compile-fail/lint-group-style.rs b/src/test/compile-fail/lint-group-style.rs
deleted file mode 100644 (file)
index b2e6072..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(bad_style)]
-//~^ NOTE lint level defined here
-#![allow(dead_code)]
-
-fn CamelCase() {} //~ ERROR function `CamelCase` should have a snake case name
-
-#[allow(bad_style)]
-mod test {
-    fn CamelCase() {}
-
-    #[forbid(bad_style)]
-    //~^ NOTE lint level defined here
-    //~^^ NOTE lint level defined here
-    mod bad {
-        fn CamelCase() {} //~ ERROR function `CamelCase` should have a snake case name
-
-        static bad: isize = 1; //~ ERROR static variable `bad` should have an upper case name
-    }
-
-    mod warn {
-        #![warn(bad_style)]
-        //~^ NOTE lint level defined here
-        //~| NOTE lint level defined here
-
-        fn CamelCase() {} //~ WARN function `CamelCase` should have a snake case name
-
-        struct snake_case; //~ WARN type `snake_case` should have a camel case name
-    }
-}
-
-fn main() {}
index 2f74325d19c7d587389ac654de1a3db14dece71b..0e68ff752e5a9876769844624525e55dda0fe82c 100644 (file)
 // compile-flags: -F unused_features
 // aux-build:lint_output_format.rs
 
-#![feature(foo)] //~ ERROR unused or unknown feature
+#![feature(foo)]
+//~^ ERROR unused or unknown feature
+//~| NOTE requested on the command line with `-F unused-features`
 
 #![feature(test_feature)]
 
 extern crate lint_output_format;
 use lint_output_format::{foo, bar};
-//~^ WARNING use of deprecated item: text,
+//~^ WARNING use of deprecated item: text
+//~| NOTE #[warn(deprecated)] on by default
 
 fn main() {
-    let _x = foo(); //~ WARNING #[warn(deprecated)] on by default
+    let _x = foo();
+    //~^ WARNING use of deprecated item: text
+    //~| NOTE #[warn(deprecated)] on by default
     let _y = bar();
 }
index 4a6dbf014a1cace35ae973c1daa5cf77ca3bade8..f467ba3b1e19521a8e161573ea538c494ea5e34a 100644 (file)
@@ -16,5 +16,5 @@ fn main() {
     foo!(0); // Check that we report errors at macro definition, not expansion.
 
     let _: cfg!(foo) = (); //~ ERROR non-type macro in type position
-    derive!(); //~ ERROR `derive` can only be used in attributes
+    derive!(); //~ ERROR macro undefined: 'derive!'
 }
index 723e936212a5b76efa3a82765c1ba03df7b906c8..3f710af8ac9a883f0c31ac5161e2828b3998771f 100644 (file)
 #![feature(asm)]
 #![feature(trace_macros, concat_idents)]
 
-#[derive(Default, //~ ERROR
-           Zero)] //~ ERROR
-enum CantDeriveThose {}
+#[derive(Zero)] //~ ERROR
+struct CantDeriveThis;
+
+#[derive(Default)] //~ ERROR
+enum OrDeriveThis {}
 
 fn main() {
     doesnt_exist!(); //~ ERROR
index eaafc312379c21168f1197bb33b2b8f7b69b9db2..9dcf902a69f916c7f343ebcd3de73f1853519ff9 100644 (file)
@@ -24,7 +24,6 @@ impl<K, V> Map<K, V> for HashMap<K, V> {}
 fn main() {
     let x: Box<HashMap<isize, isize>> = box HashMap::new();
     let x: Box<Map<isize, isize>> = x;
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let y: Box<Map<usize, isize>> = Box::new(x);
     //~^ ERROR `std::boxed::Box<Map<isize, isize>>: Map<usize, isize>` is not satisfied
 }
index 1cf41f95a2d6d8bc977ad375defe266ed85c20cb..9acf5a52166e07d5f5368516d6bc12eda7739a40 100644 (file)
@@ -32,7 +32,7 @@ fn foo(&self) -> isize {2}
 fn m1() {
     // we couldn't infer the type of the vector just based on calling foo()...
     let mut x = Vec::new();
-    //~^ ERROR unable to infer enough type information about `T` [E0282]
+    //~^ ERROR type annotations needed [E0282]
     x.foo();
 }
 
index 1f29ff4e05c09811ed29ff33b914baee6b070f8f..6a140e6f21c1948220cd005b7a66f7b6198f65d1 100644 (file)
@@ -15,6 +15,7 @@ fn main() {
     {
         if (foo)
             bar; //~ ERROR expected `{`, found `bar`
-                 //^ HELP try placing this code inside a block
+                 //~^ HELP try placing this code inside a block
+                 //~| SUGGESTION { bar; }
     }
 }
index df9a3519d5d6152633f8e17b2d4000779105d69f..d52960659999421e78f3c93c2eb359369a6c0195 100644 (file)
@@ -38,7 +38,6 @@ fn innocent_looking_victim() {
 }
 
 fn conspirator<F>(mut f: F) where F: FnMut(&mut R, bool) {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let mut r = R {c: Box::new(f)};
     f(&mut r, false) //~ ERROR use of moved value
 }
index d8e7411bded2cbfcaa1baa91a805c5ac0d460d6e..f74ff55e2c08e406399443b2c7a4ca49a3a3c7c1 100644 (file)
@@ -12,7 +12,7 @@
 
 #[no_link]
 extern crate empty_struct;
-//~^ WARN custom derive crates and `#[no_link]` crates have no effect without `#[macro_use]`
+//~^ WARN proc macro crates and `#[no_link]` crates have no effect without `#[macro_use]`
 
 fn main() {
     empty_struct::XEmpty1; //~ ERROR cannot find value `XEmpty1` in module `empty_struct`
index f95ee405895a9c78cd286b54e98e09ea255d2fc5..687b2c344a3b755d42f6baa392b31ddc18b1741a 100644 (file)
@@ -14,8 +14,6 @@
 trait Foo {}
 impl<'a> Foo for &'a [u8] {}
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 fn a(v: &[u8]) -> Box<Foo + 'static> {
     let x: Box<Foo + 'static> = Box::new(v);
     //~^ ERROR cannot infer an appropriate lifetime due to conflicting
index 61897aac18769353f932d70296f4c36899784510..6b88abfca6c914f8ae611bbb8af82ffbf5491c58 100644 (file)
@@ -10,8 +10,6 @@
 
 #![feature(box_syntax)]
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 trait X {}
 
 trait Iter {
index 7324d4a4a0ed624e314b3ed46eb80c90ac9576b3..c9063405bd7e203ea6e449e214bf078df37131f5 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 trait X { fn foo(&self) {} }
 
 fn p1<T>(v: T) -> Box<X+'static>
index c0116b21166e0350429cc6063306b82bf5b22fac..ac7dd022c7c467ab287f989c7850b361e4888a0a 100644 (file)
@@ -46,7 +46,10 @@ fn baz(x: &S) -> &S {
 
 fn supply_F() {
     want_F(foo);
-    want_F(bar);
+
+    // FIXME(#33684) -- this should be a subtype, but current alg. rejects it incorrectly
+    want_F(bar); //~ ERROR E0308
+
     want_F(baz);
 }
 
index 5ef2a701a6005f37c2c54cfc208ae856bef4fcec..010b7d17688125542558d0f2db720d50c91def7d 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 fn ignore<T>(t: T) {}
 
 fn nested<'x>(x: &'x isize) {
index 48b6e8b773f3b65dea7ef1d02532f2812b8bf444..fb726e31af586a5ba81e434d086ccf8d3f7af9d1 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 fn borrowed_proc<'a>(x: &'a isize) -> Box<FnMut()->(isize) + 'a> {
     // This is legal, because the region bound on `proc`
     // states that it captures `x`.
index 59fe1ce3af1af7e87e1549662ce28f896a62a977..7ca63b9896fe0064035144f28cffdba4f118f45e 100644 (file)
@@ -21,7 +21,6 @@ fn box_it<'r>(x: Box<FnMut() + 'r>) -> closure_box<'r> {
 fn main() {
     let mut cl_box = {
         let mut i = 3;
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough
     };
     cl_box.cl.call_mut(());
index dd64085f6f6668a17d8ab42553a0a61b0ab2659f..3839e90ed9fe769263f0ab6faac96b5a34b32c75 100644 (file)
@@ -23,7 +23,6 @@ fn f(&self, x: &'static str) {
 }
 
 fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let s: Box<Trait<isize>> = Box::new(Struct { person: "Fred" });
     //~^ ERROR `Struct: Trait<isize>` is not satisfied
     s.f(1);
index 9ba017e150e6112a1f1c3f4db1f2d6da1d7188e3..18d3ded77f8f3d61bb57ccc07f78b3eae0fb8256 100644 (file)
@@ -25,6 +25,5 @@ fn f(&self, x: &'static str) {
 fn main() {
     let person = "Fred".to_string();
     let person: &str = &person;  //~ ERROR `person` does not live long enough
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let s: Box<Trait<&'static str>> = Box::new(Struct { person: person });
 }
index ed2ffa995e521ce188e83b8c5de832f6868a196c..2e115431c92c45698946c96b3ca2ec4610c3f897 100644 (file)
@@ -34,9 +34,8 @@ fn test<T,U>(_: T, _: U)
 
 fn a() {
     test(22, std::default::Default::default());
-    //~^ ERROR unable to infer enough type information about `U` [E0282]
+    //~^ ERROR type annotations needed [E0282]
     //~| NOTE cannot infer type for `U`
-    //~| NOTE type annotations or generic parameter binding
 }
 
 fn main() {}
index 564b1b4669f7d0235ea2ed45c1a124b6577485cc..427be5607600db9abbc86a80e7598358116a13ad 100644 (file)
@@ -18,8 +18,6 @@ fn to_fn<A,F:Fn<A>>(f: F) -> F { f }
 fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
 fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 fn main() {
     // By-ref cases
     {
index 88080bc70cab4e404a65c97108b7889ba42ff7b1..52ca91e62f8df56337f2c4f46c18af4fe60fc30d 100644 (file)
@@ -11,7 +11,6 @@
 // Issue #5062
 
 fn main() {
-    None; //~ ERROR unable to infer enough type information about `T` [E0282]
+    None; //~ ERROR type annotations needed [E0282]
           //~| NOTE cannot infer type for `T`
-          //~| NOTE type annotations or generic parameter binding
 }
index 12278549215ed132deca9b9cb4584dc78d74fbbc..6aaed789716a36d7847a4daf2a845c316b643625 100644 (file)
@@ -13,7 +13,6 @@ struct S<'a, T:'a> {
 }
 
 fn main() {
-    S { o: &None }; //~ ERROR unable to infer enough type information about `T` [E0282]
+    S { o: &None }; //~ ERROR type annotations needed [E0282]
                     //~| NOTE cannot infer type for `T`
-                    //~| NOTE type annotations or generic parameter binding
 }
index 0de29f3a8d7375e1d0d49ed517ddbc94752efb90..4c894b0bdd3dd2b7724978159332ca00bc61ec28 100644 (file)
@@ -24,6 +24,10 @@ struct NotSoSecretlyEmpty {
     _priv: !,
 }
 
+fn foo() -> Option<NotSoSecretlyEmpty> {
+    None
+}
+
 fn main() {
     let x: &[!] = &[];
 
@@ -45,5 +49,9 @@ fn main() {
         Err(Err(_y)) => (),
         Err(Ok(_y)) => (),  //~ ERROR unreachable pattern
     }
+
+    while let Some(_y) = foo() {
+        //~^ ERROR unreachable pattern
+    }
 }
 
index d971940db38f5af20cced487fa34dec81d825cf8..c09feec1d4af25b1b713ce74fe4875153404905c 100644 (file)
@@ -18,7 +18,6 @@ fn drop(&mut self) {}
 }
 
 fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let i = Box::new(r { b: true });
     let _j = i.clone(); //~ ERROR no method named `clone` found
     println!("{:?}", i);
index d559caf77a1a37944dedf9d43f7bb6cdf1acd583..de229ded463f68570f5ed0a71866e9dbec44548a 100644 (file)
@@ -11,7 +11,7 @@
 
 fn main() {
     let _foo = Vec::new();
-    //~^ ERROR unable to infer enough type information about `T` [E0282]
+    //~^ ERROR type annotations needed [E0282]
     //~| NOTE cannot infer type for `T`
-    //~| NOTE type annotations or generic parameter binding
+    //~| NOTE consider giving `_foo` a type
 }
index c457fed7ecd52984b3504a0bc8ff0cc6bd165f98..9e63beff3cb2eeb0f7c3973a87224fe562f3cc9c 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-tidy-linelength
 // min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12
+// ignore-gdb-version: 7.11.90 - 7.12.9
 
 // compile-flags:-g
 
index df56ccccca3f55744fcea41f7d3e1e78532f7866..4a1d14ccf6118c862f540777a3b4e49186356226 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-tidy-linelength
 // min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12
+// ignore-gdb-version: 7.11.90 - 7.12.9
 
 // compile-flags:-g
 
index e538700f0f84c59e7af5f49d670070e25d86906f..012bd6140cdbe6470f3f54e92696cad08979c528 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-tidy-linelength
 // min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12
+// ignore-gdb-version: 7.11.90 - 7.12.9
 
 // compile-flags:-g
 
index c476e9fe0796fa71438c99e307252e86f36c7ca0..16e6371a9c0a9944db7f6989d8061dd26492f5ff 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-tidy-linelength
 // min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12
+// ignore-gdb-version: 7.11.90 - 7.12.9
 
 // compile-flags:-g
 
index f33dfac07d2033e3718b8d57b46c2ee9e1545be5..75c2feb480ede8f32d0aae9055d9a60a0890ac84 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-tidy-linelength
 // ignore-lldb
-// ignore-gdb-version: 7.11.90 - 7.12
+// ignore-gdb-version: 7.11.90 - 7.12.9
 
 // compile-flags:-g
 
index d9763aedd7c15a168c2a8db3a1acdeb92bbd822b..bd044188dbcbcd4f50d4195fe83a335f613855cf 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-tidy-linelength
 // min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12
+// ignore-gdb-version: 7.11.90 - 7.12.9
 
 // compile-flags:-g
 
index 6212caa69538dcb2af0f27c8387f359137f84763..b156a3be699e3359490962ebe9c755824aaee5e3 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-tidy-linelength
 // min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12
+// ignore-gdb-version: 7.11.90 - 7.12.9
 
 // compile-flags:-g
 
index f85cd6a50f51982c522c7cdc698fdd42b6222ebf..f36153d1f5c5a8eca5d52aa027edf3d4f559ce27 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-tidy-linelength
 // min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12
+// ignore-gdb-version: 7.11.90 - 7.12.9
 
 // compile-flags:-g
 
index 844e9405ba55c888c21afa9a8b522f9f08ae7bec..0b2544151fd323b0d6a6c38d4ce1ac43d2fba107 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12
+// ignore-gdb-version: 7.11.90 - 7.12.9
 
 // compile-flags:-g
 
index e8eb4315007afd62dacced6cd298c50c3384a9d9..5a99de7779cffd3972190b807d7981b2db6b3e68 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-tidy-linelength
 // min-lldb-version: 310
-// ignore-gdb-version: 7.11.90 - 7.12
+// ignore-gdb-version: 7.11.90 - 7.12.9
 
 // compile-flags:-g
 
index 5c37bc133596dd02cf8e369c396a50aee8a7eb55..fd9ac61046e3a978add0ffde467dc65a420c9d60 100644 (file)
@@ -39,9 +39,7 @@ pub fn method_name() { }
 #[rustc_metadata_dirty(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl Foo {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
-    #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     pub fn method_name2() { }
 }
@@ -60,16 +58,47 @@ pub fn method_body() { }
 #[rustc_metadata_clean(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl Foo {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
-    #[rustc_metadata_dirty(cfg="cfail2")]
+    #[rustc_dirty(label="HirBody", cfg="cfail2")]
+    #[rustc_clean(label="HirBody", cfg="cfail3")]
+    #[rustc_metadata_clean(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     pub fn method_body() {
         println!("Hello, world!");
     }
 }
 
-// Change Method Privacy -----------------------------------------------------------
+
+// Change Method Body (inlined) ------------------------------------------------
+//
+// This should affect the method itself, but not the impl.
+#[cfg(cfail1)]
+impl Foo {
+    #[inline]
+    pub fn method_body_inlined() { }
+}
+
+#[cfg(not(cfail1))]
+#[rustc_clean(label="Hir", cfg="cfail2")]
+#[rustc_clean(label="Hir", cfg="cfail3")]
+#[rustc_metadata_clean(cfg="cfail2")]
+#[rustc_metadata_clean(cfg="cfail3")]
+impl Foo {
+    #[rustc_clean(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail3")]
+    #[rustc_dirty(label="HirBody", cfg="cfail2")]
+    #[rustc_clean(label="HirBody", cfg="cfail3")]
+    #[rustc_metadata_dirty(cfg="cfail2")]
+    #[rustc_metadata_clean(cfg="cfail3")]
+    #[inline]
+    pub fn method_body_inlined() {
+        println!("Hello, world!");
+    }
+}
+
+
+// Change Method Privacy -------------------------------------------------------
 #[cfg(cfail1)]
 impl Foo {
     pub fn method_privacy() { }
@@ -142,13 +171,11 @@ pub fn add_method_to_impl1(&self) { }
 impl Foo {
     #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
-    #[rustc_metadata_clean(cfg="cfail2")]
+    #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     pub fn add_method_to_impl1(&self) { }
 
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
-    #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     pub fn add_method_to_impl2(&self) { }
 }
@@ -188,9 +215,13 @@ pub fn change_method_parameter_name(&self, a: i64) { }
 #[rustc_metadata_clean(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl Foo {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
-    #[rustc_metadata_dirty(cfg="cfail2")]
+    #[rustc_dirty(label="HirBody", cfg="cfail2")]
+    #[rustc_clean(label="HirBody", cfg="cfail3")]
+    // At the moment we explicitly ignore argument names in metadata, since they
+    // are not used in downstream crates (except in rustdoc)
+    #[rustc_metadata_clean(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     pub fn change_method_parameter_name(&self, b: i64) { }
 }
@@ -252,9 +283,13 @@ pub fn change_method_parameter_order(&self, a: i64, b: i64) { }
 #[rustc_metadata_clean(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl Foo {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
-    #[rustc_metadata_dirty(cfg="cfail2")]
+    #[rustc_dirty(label="HirBody", cfg="cfail2")]
+    #[rustc_clean(label="HirBody", cfg="cfail3")]
+    // At the moment we explicitly ignore argument names in metadata, since they
+    // are not used in downstream crates (except in rustdoc)
+    #[rustc_metadata_clean(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     pub fn change_method_parameter_order(&self, b: i64, a: i64) { }
 }
@@ -465,7 +500,7 @@ pub fn add_type_parameter_to_impl(&self) { }
 #[rustc_metadata_dirty(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl<T> Bar<T> {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
     #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
@@ -486,7 +521,7 @@ pub fn change_impl_self_type(&self) { }
 #[rustc_metadata_dirty(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl Bar<u64> {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
     #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
@@ -507,7 +542,7 @@ pub fn add_lifetime_bound_to_impl_parameter(&self) { }
 #[rustc_metadata_dirty(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl<T: 'static> Bar<T> {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
     #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
@@ -528,7 +563,7 @@ pub fn add_trait_bound_to_impl_parameter(&self) { }
 #[rustc_metadata_dirty(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl<T: Clone> Bar<T> {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
     #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
index bc401ae93404f0a45e099b022e781654715d5e2b..94698506ec53fd6df782c9fcb32fe7775a6a177e 100644 (file)
@@ -316,8 +316,10 @@ fn method(self) {}
 #[rustc_metadata_clean(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 trait TraitChangeModeSelfOwnToMut: Sized {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
+    #[rustc_dirty(label="HirBody", cfg="cfail2")]
+    #[rustc_clean(label="HirBody", cfg="cfail3")]
     #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     fn method(mut self) {}
index 15094492248e647480c00bb5df1853507f27a5f0..30e376f04fb87ff78b0a4fa7d4f4db82306c4516 100644 (file)
@@ -46,9 +46,7 @@ fn method_name() { }
 #[rustc_metadata_dirty(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 pub trait ChangeMethodNameTrait {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
-    #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     fn method_name2();
 }
@@ -59,16 +57,14 @@ pub trait ChangeMethodNameTrait {
 #[rustc_metadata_dirty(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl ChangeMethodNameTrait for Foo {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
-    #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
     fn method_name2() { }
 }
 
 // Change Method Body -----------------------------------------------------------
 //
-// This should affect the method itself, but not the trait.
+// This should affect the method itself, but not the impl.
 
 pub trait ChangeMethodBodyTrait {
     fn method_name();
@@ -85,16 +81,50 @@ fn method_name() { }
 #[rustc_metadata_clean(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl ChangeMethodBodyTrait for Foo {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail3")]
+    #[rustc_dirty(label="HirBody", cfg="cfail2")]
+    #[rustc_clean(label="HirBody", cfg="cfail3")]
+    #[rustc_metadata_clean(cfg="cfail2")]
+    #[rustc_metadata_clean(cfg="cfail3")]
+    fn method_name() {
+        ()
+    }
+}
+
+// Change Method Body (inlined fn) ---------------------------------------------
+//
+// This should affect the method itself, but not the impl.
+
+pub trait ChangeMethodBodyTraitInlined {
+    fn method_name();
+}
+
+#[cfg(cfail1)]
+impl ChangeMethodBodyTraitInlined for Foo {
+    #[inline]
+    fn method_name() { }
+}
+
+#[cfg(not(cfail1))]
+#[rustc_clean(label="Hir", cfg="cfail2")]
+#[rustc_clean(label="Hir", cfg="cfail3")]
+#[rustc_metadata_clean(cfg="cfail2")]
+#[rustc_metadata_clean(cfg="cfail3")]
+impl ChangeMethodBodyTraitInlined for Foo {
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
+    #[rustc_dirty(label="HirBody", cfg="cfail2")]
+    #[rustc_clean(label="HirBody", cfg="cfail3")]
     #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
+    #[inline]
     fn method_name() {
         ()
     }
 }
 
-// Change Method Selfness -----------------------------------------------------------
+// Change Method Selfness ------------------------------------------------------
 
 #[cfg(cfail1)]
 pub trait ChangeMethodSelfnessTrait {
@@ -447,7 +477,7 @@ fn id(self) -> Self { self }
 #[rustc_metadata_dirty(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl ChangeSelfTypeOfImpl for u64 {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
     #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
@@ -472,7 +502,7 @@ fn id(self) -> Self { self }
 #[rustc_metadata_dirty(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl<T: 'static> AddLifetimeBoundToImplParameter for T {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
     #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
@@ -497,7 +527,7 @@ fn id(self) -> Self { self }
 #[rustc_metadata_dirty(cfg="cfail2")]
 #[rustc_metadata_clean(cfg="cfail3")]
 impl<T: Clone> AddTraitBoundToImplParameter for T {
-    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    #[rustc_clean(label="Hir", cfg="cfail2")]
     #[rustc_clean(label="Hir", cfg="cfail3")]
     #[rustc_metadata_dirty(cfg="cfail2")]
     #[rustc_metadata_clean(cfg="cfail3")]
diff --git a/src/test/incremental/unchecked_dirty_clean.rs b/src/test/incremental/unchecked_dirty_clean.rs
new file mode 100644 (file)
index 0000000..a81e884
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions: rpass1 cfail2
+// compile-flags: -Z query-dep-graph
+
+#![allow(warnings)]
+#![feature(rustc_attrs)]
+
+// Sanity check for the dirty-clean system. We add #[rustc_dirty]/#[rustc_clean]
+// attributes in places that are not checked and make sure that this causes an
+// error.
+
+fn main() {
+
+    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    //[cfail2]~^ ERROR found unchecked #[rustc_dirty]/#[rustc_clean] attribute
+    {
+        // empty block
+    }
+
+    #[rustc_clean(label="Hir", cfg="cfail2")]
+    //[cfail2]~^ ERROR found unchecked #[rustc_dirty]/#[rustc_clean] attribute
+    {
+        // empty block
+    }
+}
+
+struct _Struct {
+    #[rustc_dirty(label="Hir", cfg="cfail2")]
+    //[cfail2]~^ ERROR found unchecked #[rustc_dirty]/#[rustc_clean] attribute
+    _field1: i32,
+
+    #[rustc_clean(label="Hir", cfg="cfail2")]
+    //[cfail2]~^ ERROR found unchecked #[rustc_dirty]/#[rustc_clean] attribute
+    _field2: i32,
+}
diff --git a/src/test/incremental/unchecked_dirty_clean_metadata.rs b/src/test/incremental/unchecked_dirty_clean_metadata.rs
new file mode 100644 (file)
index 0000000..4017b4d
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions: rpass1 cfail2
+// compile-flags: -Z query-dep-graph
+
+#![allow(warnings)]
+#![feature(rustc_attrs)]
+
+// Sanity check for the dirty-clean system. We add
+// #[rustc_metadata_dirty]/#[rustc_metadata_clean] attributes in places that
+// are not checked and make sure that this causes an error.
+
+fn main() {
+
+    #[rustc_metadata_dirty(cfg="cfail2")]
+    //[cfail2]~^ ERROR found unchecked #[rustc_dirty]/#[rustc_clean] attribute
+    {
+        // empty block
+    }
+
+    #[rustc_metadata_clean(cfg="cfail2")]
+    //[cfail2]~^ ERROR found unchecked #[rustc_dirty]/#[rustc_clean] attribute
+    {
+        // empty block
+    }
+}
+
+struct _Struct {
+    #[rustc_metadata_dirty(cfg="cfail2")]
+    //[cfail2]~^ ERROR found unchecked #[rustc_dirty]/#[rustc_clean] attribute
+    _field1: i32,
+
+    #[rustc_metadata_clean(cfg="cfail2")]
+    //[cfail2]~^ ERROR found unchecked #[rustc_dirty]/#[rustc_clean] attribute
+    _field2: i32,
+}
+
index f3f5e356346822a1fa87f673008aed49c3bb87d9..57ad89ad374045f1cd6a645139722f5e12a69fc7 100644 (file)
@@ -12,5 +12,6 @@
 
 fn main () {
     (1, (2, 3)).1.1; //~ ERROR unexpected token
-                     //~^ HELP try parenthesizing the first index; e.g., `(foo.1).1`
+                     //~^ HELP try parenthesizing the first index
+                     //~| SUGGESTION ((1, (2, 3)).1).1
 }
diff --git a/src/test/pretty/attr-derive.rs b/src/test/pretty/attr-derive.rs
new file mode 100644 (file)
index 0000000..a1c581a
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:derive-foo.rs
+// ignore-stage1
+// pp-exact
+// Testing that both the inner item and next outer item are
+// preserved, and that the first outer item parsed in main is not
+// accidentally carried over to each inner function
+
+#[macro_use]
+extern crate derive_foo;
+
+#[derive(Foo)]
+struct X;
+
+#[derive(Foo)]
+#[Bar]
+struct Y;
+
+#[derive(Foo)]
+struct WithRef {
+    x: X,
+    #[Bar]
+    y: Y,
+}
+
+#[derive(Foo)]
+enum Enum {
+
+    #[Bar]
+    Asdf,
+    Qwerty,
+}
+
+fn main() { }
diff --git a/src/test/pretty/attr-variant-data.rs b/src/test/pretty/attr-variant-data.rs
deleted file mode 100644 (file)
index 1ffacaa..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2012 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.
-
-// pp-exact
-// Testing that both the inner item and next outer item are
-// preserved, and that the first outer item parsed in main is not
-// accidentally carried over to each inner function
-
-#![feature(custom_attribute)]
-#![feature(custom_derive)]
-
-#[derive(Serialize, Deserialize)]
-struct X;
-
-#[derive(Serialize, Deserialize)]
-struct WithRef<'a, T: 'a> {
-    #[serde(skip_deserializing)]
-    t: Option<&'a T>,
-    #[serde(serialize_with = "ser_x", deserialize_with = "de_x")]
-    x: X,
-}
-
-#[derive(Serialize, Deserialize)]
-enum EnumWith<T> {
-    Unit,
-    Newtype(
-            #[serde(serialize_with = "ser_x", deserialize_with = "de_x")]
-            X),
-    Tuple(T,
-          #[serde(serialize_with = "ser_x", deserialize_with = "de_x")]
-          X),
-    Struct {
-        t: T,
-        #[serde(serialize_with = "ser_x", deserialize_with = "de_x")]
-        x: X,
-    },
-}
-
-#[derive(Serialize, Deserialize)]
-struct Tuple<T>(T,
-                #[serde(serialize_with = "ser_x", deserialize_with = "de_x")]
-                X);
-
-fn main() { }
diff --git a/src/test/pretty/auxiliary/derive-foo.rs b/src/test/pretty/auxiliary/derive-foo.rs
new file mode 100644 (file)
index 0000000..bd81d3e
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(Foo, attributes(Bar))]
+pub fn derive(input: TokenStream) -> TokenStream {
+    "".parse().unwrap()
+}
index 1e8568626a6a15d25c30ee27871e18badca1ccc7..f65cc9e06a329486e467e2071605dd08cbfb1684 100644 (file)
@@ -4,4 +4,4 @@ all: foo.rs
        $(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs
        $(HOST_RPATH_ENV) '$(RUSTDOC)' --test --cfg 'feature="bar"' \
                -L $(TMPDIR) foo.rs |\
-               grep -q 'test foo_0 ... ok'
+               grep -q 'foo.rs - line 11 ... ok'
diff --git a/src/test/run-make/static-nobundle/Makefile b/src/test/run-make/static-nobundle/Makefile
new file mode 100644 (file)
index 0000000..3eac12f
--- /dev/null
@@ -0,0 +1,21 @@
+-include ../tools.mk
+
+# aaa is a native static library
+# bbb is a rlib
+# ccc is a dylib
+# ddd is an executable
+
+all: $(call NATIVE_STATICLIB,aaa)
+       $(RUSTC) bbb.rs --crate-type=rlib
+
+       # Check that bbb does NOT contain the definition of `native_func`
+       nm $(TMPDIR)/libbbb.rlib | (! grep "T _*native_func")
+       nm $(TMPDIR)/libbbb.rlib | grep "U _*native_func"
+
+       # Check that aaa gets linked (either as `-l aaa` or `aaa.lib`) when building ccc.
+       $(RUSTC) ccc.rs -C prefer-dynamic --crate-type=dylib -Z print-link-args | grep -e "-l[\" ]*aaa" -e "aaa.lib"
+
+       # Check that aaa does NOT get linked when building ddd.
+       $(RUSTC) ddd.rs -Z print-link-args | (! grep -e "-l[\" ]*aaa" -e "aaa.lib")
+
+       $(call RUN,ddd)
diff --git a/src/test/run-make/static-nobundle/aaa.c b/src/test/run-make/static-nobundle/aaa.c
new file mode 100644 (file)
index 0000000..806ef87
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+void native_func() {}
diff --git a/src/test/run-make/static-nobundle/bbb.rs b/src/test/run-make/static-nobundle/bbb.rs
new file mode 100644 (file)
index 0000000..2bd69c9
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type = "rlib"]
+#![feature(static_nobundle)]
+
+#[link(name = "aaa", kind = "static-nobundle")]
+extern {
+    pub fn native_func();
+}
+
+pub fn wrapped_func() {
+    unsafe {
+        native_func();
+    }
+}
diff --git a/src/test/run-make/static-nobundle/ccc.rs b/src/test/run-make/static-nobundle/ccc.rs
new file mode 100644 (file)
index 0000000..bd34753
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type = "dylib"]
+
+extern crate bbb;
+
+pub fn do_work() {
+    unsafe { bbb::native_func(); }
+    bbb::wrapped_func();
+}
+
+pub fn do_work_generic<T>() {
+    unsafe { bbb::native_func(); }
+    bbb::wrapped_func();
+}
diff --git a/src/test/run-make/static-nobundle/ddd.rs b/src/test/run-make/static-nobundle/ddd.rs
new file mode 100644 (file)
index 0000000..f7d23a8
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern crate ccc;
+
+fn main() {
+    ccc::do_work();
+    ccc::do_work_generic::<i16>();
+    ccc::do_work_generic::<i32>();
+}
index 29cc6b7db94741c4b44b1f0b5e66a65cea1a5b0a..aa2f1626a6a868bf635a4c0c57c582dc5c53165c 100644 (file)
@@ -38,15 +38,12 @@ pub fn plugin_registrar(reg: &mut Registry) {
     reg.register_macro("identity", expand_identity);
     reg.register_syntax_extension(
         Symbol::intern("into_multi_foo"),
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         MultiModifier(Box::new(expand_into_foo_multi)));
     reg.register_syntax_extension(
         Symbol::intern("duplicate"),
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         MultiDecorator(Box::new(expand_duplicate)));
     reg.register_syntax_extension(
         Symbol::intern("caller"),
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         MultiDecorator(Box::new(expand_caller)));
 }
 
index ba2af77cdb297f75c2cbc2e6e66c6ee08c4031d3..3c8868f1664e8185d471185b3ecd872bb80ff94f 100644 (file)
@@ -48,6 +48,5 @@ fn expand<'cx>(&self,
 pub fn plugin_registrar(reg: &mut Registry) {
     let args = reg.args().to_owned();
     reg.register_syntax_extension(Symbol::intern("plugin_args"),
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         NormalTT(Box::new(Expander { args: args, }), None, false));
 }
index 328cc134f3b1fdf17da835c24c68ad925169d447..1573b0807173f3061906c565d31a69b7612f4d9d 100644 (file)
@@ -24,7 +24,6 @@ struct A {
 }
 
 fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let obj = A { foo: Box::new([true, false]) };
     let s = json::encode(&obj).unwrap();
     let obj2: A = json::decode(&s).unwrap();
index 995da8c73fab8b8f74077e655c465ff7436a2d25..4af642a106c153722181b72ab7f1df6bad963629 100644 (file)
@@ -28,7 +28,6 @@ struct Fat<T: ?Sized> {
 
 pub fn main() {
     {
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         let _x: Box<Fat<Trait>> = Box::<Fat<Foo>>::new(Fat { f: Foo });
     }
     unsafe {
index 471169340d793057daa42a23fb657b78e6e03cbe..283b8202b35d0bb5b63b69805d415972404810c1 100644 (file)
@@ -25,7 +25,6 @@ struct Fat<T: ?Sized> {
 
 pub fn main() {
     {
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         let _x: Box<Fat<[Foo]>> = Box::<Fat<[Foo; 3]>>::new(Fat { f: [Foo, Foo, Foo] });
     }
     unsafe {
index dd194447740b7cf7ce92a7de9bc8d35d548a429d..0a6135080bb6e8c93743efa8d88ee1b21e7c5123 100644 (file)
@@ -26,7 +26,6 @@ fn pairwise_sub(mut t: Box<DoubleEndedIterator<Item=isize>>) -> isize {
 
 fn main() {
     let v = vec![1, 2, 3, 4, 5, 6];
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let r = pairwise_sub(Box::new(v.into_iter()));
     assert_eq!(r, 9);
 }
index e4792e7936bc4e067feffd0e0319958073d19677..a074aea9caa5c35a47a7ee3100e20adea18dd01e 100644 (file)
 // rvalue expressions to be unsized. See #20169 for more information.
 
 pub fn main() {
-    // FIXME #22405: We cannot infer the type `Box<[isize; k]>` for
-    // the r-value expression from the context `Box<[isize]>`, and
-    // therefore the `box EXPR` desugaring breaks down.
-    //
-    // One could reasonably claim that the `box EXPR` desugaring is
-    // effectively regressing half of Issue #20169. Hopefully we will
-    // eventually fix that, at which point the `Box::new` calls below
-    // should be replaced wth uses of `box`.
-
     let _: Box<[isize]> = Box::new({ [1, 2, 3] });
     let _: Box<[isize]> = Box::new(if true { [1, 2, 3] } else { [1, 3, 4] });
     let _: Box<[isize]> = Box::new(match true { true => [1, 2, 3], false => [1, 3, 4] });
index dc31e71aad8730b484c1e2005873d1b7de08fd9b..c9e5b014da37ae16af1d7fb1c7b1326aacb23da9 100644 (file)
@@ -21,7 +21,6 @@ struct A {
 
 pub fn main() {
     let a: A = Default::default();
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let b: Box<[_]> = Box::<[bool; 0]>::new([]);
     assert_eq!(a.foo, b);
 }
index f490cca6a699d7000ef578c4b6e4e58a666ffaec..16c49065008aa264cf8185e82e18bac817bdd376 100644 (file)
@@ -12,7 +12,6 @@
 struct Foo(Box<[u8]>);
 
 pub fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let a = Foo(Box::new([0, 1, 2]));
     let b = Foo(Box::new([0, 1, 2]));
     assert_eq!(a, b);
index 0666e41738e3c88410e3702300d2cc12615999ff..9fb4635765ca0a3cd1e61c59036096bff524f3b7 100644 (file)
@@ -39,7 +39,6 @@ pub fn foo(arr: &mut Arr) {
 }
 
 fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let mut a = Arr { ptr: Box::new([1, 2, 3]) };
     foo(&mut a);
 }
index 957ed13a3d8175009f2563dce6269afd5675c504..4a143873e6e1347d1b9bb5cbbb6a71a04d7f6b64 100644 (file)
@@ -34,7 +34,6 @@ pub fn foo(arr: &Arr) {
 }
 
 fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let a = Arr { ptr: Box::new([1, 2, 3]) };
     foo(&a);
 }
index 94efa7a256b4d0cf0c1d6c638ad5611aaa001763..56199c1aa61fa5506586781cabcf4c68e6414fb3 100644 (file)
@@ -127,7 +127,6 @@ pub fn main() {
     let f2 : Box<Fat<[isize]>> = f1;
     foo(&*f2);
 
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let f3 : Box<Fat<[isize]>> =
         Box::<Fat<[_; 3]>>::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] });
     foo(&*f3);
index 9d12a4a34b7d4a1c5ca7c688ba5e019b0d94b529..d8d7d9a28bfbdb5ffc8f12aa439e57b23a9903b4 100644 (file)
@@ -97,7 +97,6 @@ pub fn main() {
 
     // &*
     //
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let f7: Box<ToBar> = Box::new(Bar1 {f :42});
     bar(&*f7);
 
index af6e321e40aa65ee59dcb90e8acd4aea14575453..3dbe7da6ac704ee97f3f1300a8f5307d791be3e7 100644 (file)
@@ -8,9 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
-
 pub fn main() {
     assert!(Some(Box::new(())).is_some());
 
index 0abe44d82591d702a89c93c44986c54b0ceeed7b..a1b7d42a196e9e77115d96f797f98aecfc113079 100644 (file)
@@ -35,7 +35,7 @@ fn main() {
 }
 
 fn parent() {
-    let file = File::open(file!()).unwrap();
+    let file = File::open(env::current_exe().unwrap()).unwrap();
     let tcp1 = TcpListener::bind("127.0.0.1:0").unwrap();
     let tcp2 = tcp1.try_clone().unwrap();
     let addr = tcp1.local_addr().unwrap();
index 2306fa9afa2ef419d98d7664276dc2ef6f2faa65..bd90ce683c45202dc8b468a2d4ea25d874a71eaf 100644 (file)
@@ -62,7 +62,6 @@ fn emit(im: &mut HashMap<String, isize>,
         }
 
         let ctrl_clone = ctrl.clone();
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         ::map(input, Box::new(|a,b| emit(&mut intermediates, ctrl.clone(), a, b)));
         ctrl_clone.send(ctrl_proto::mapper_done).unwrap();
     }
index d93e52a8f5fbb10d45623c13c9521710f6b5ac43..516278df178eb5eb11e8469f9045647a6d776b49 100644 (file)
@@ -17,7 +17,6 @@
 // cause a compilation error. Issue #18772.
 
 fn adder(y: isize) -> Box<Fn(isize) -> isize + 'static> {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     Box::new(move |x| y + x)
 }
 
index 222f32754fb6b9415f7aeb808dcf5113b0c33fa3..473f1cc2301dc565f7a30b2761fe8869be17b130 100644 (file)
@@ -8,9 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-stage0
-// ignore-stage1
-
 // MSVC doesn't support 128 bit integers, and other Windows
 // C compilers have very inconsistent views on how the ABI
 // should look like.
index 3eb1c95050267b59344c7ddef26a2c53499a6162..dc4f0774b9771e87e35557a4759585888a6c8bf1 100644 (file)
@@ -8,9 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-stage0
-// ignore-stage1
-
 // ignore-emscripten
 
 #![feature(i128_type, test)]
index 679d494a4730203115475882fd05fc8f18aee8ba..25c66bf8d485ff0949f0fcb4d234a967782e235f 100644 (file)
@@ -12,8 +12,6 @@
 
 #![allow(dead_code)]
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 trait Foo { fn dummy(&self) { } }
 impl Foo for isize {}
 fn foo(_: [&Foo; 2]) {}
index d4244d44439b0bccaeef3fd3c1c64914e2705fdf..62da3b1467559e6ed51cb7060420ea5db8f34994 100644 (file)
@@ -27,6 +27,5 @@ impl X<isize> for F {
 }
 
 fn main() {
-  // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
   S {f: Box::new(F), g: Box::new(F) };
 }
index 56d1d3599c7fde3dcb7e3cfd8a49c5a88cc46d2f..aec45216b1b7366d949d8253b6dc8944a8cfbaf8 100644 (file)
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     fn test() -> Box<std::any::Any + 'static> { Box::new(1) }
     println!("{:?}", test())
 }
index c85c0117581a5f771657a9a91cc23a57748cefa4..ccdfa0646c6aaba123dc686ea160e40364fe98f3 100644 (file)
@@ -16,7 +16,6 @@ struct Foo<'a> {
 
 impl<'a> Foo<'a> {
     fn new<F>(listener: F) -> Foo<'a> where F: FnMut() + 'a {
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         Foo { listener: Box::new(listener) }
     }
 }
index b0893e21af7e92eeef90baa34c9d1d98bbefc39f..8aaa24e991ea12662e72de944fd46e08c7da81a0 100644 (file)
@@ -11,8 +11,6 @@
 // All 3 expressions should work in that the argument gets
 // coerced to a trait object
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 // pretty-expanded FIXME #23616
 
 fn main() {
index d3c9fe9161ccb52259606a86f63755e0e73f4c59..df5d62e7699bb6919347ba87622ed8005c00b8e3 100644 (file)
@@ -31,7 +31,6 @@ trait IntoMatcher<'a, T> {
 
 impl<'a, 'b, F> IntoMatcher<'a, CharPredMatcher<'a, 'b>> for F where F: FnMut(char) -> bool + 'b {
     fn into_matcher(self, s: &'a str) -> CharPredMatcher<'a, 'b> {
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         CharPredMatcher {
             str: s,
             pred: Box::new(self),
index 18861feb1997aabe999d367f332806791b0719c7..5613211b31df427f85c18940b2fc04e81f013a0d 100644 (file)
@@ -16,7 +16,6 @@ struct Parser<'a, I, O> {
 
 impl<'a, I: 'a, O: 'a> Parser<'a, I, O> {
     fn compose<K: 'a>(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> {
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         Parser {
             parse: Box::new(move |x: I| {
                 match (self.parse)(x) {
index 0fc8eea778da9333083d16debf46f28183f6381d..8178c1fd7c885e293b725e4a94f3805b781a127d 100644 (file)
@@ -17,8 +17,6 @@ fn f(s: Box<str>) -> Box<str> {
 
 fn main() {
     // There is currently no safe way to construct a `Box<str>`, so improvise
-    //
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let box_arr: Box<[u8]> = Box::new(['h' as u8, 'e' as u8, 'l' as u8, 'l' as u8, 'o' as u8]);
     let box_str: Box<str> = unsafe { std::mem::transmute(box_arr) };
     assert_eq!(&*box_str, "hello");
index e73492e7a7ee5216a72c41203eaa8f0a7b8b8ab6..7db7e3b28e8e66c3728d00ceccef0b4539f44da4 100644 (file)
@@ -13,7 +13,6 @@
 // pretty-expanded FIXME #23616
 
 fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let functions: [Box<Fn() -> Option<()>>; 1] = [Box::new(|| None)];
 
     let _: Option<Vec<()>> = functions.iter().map(|f| (*f)()).collect();
index 8f013ee4f3a0fb9039ea195fb4e87ab3a718b876..3b56b2e28ff22ecebf7309bbd492800cce791680 100644 (file)
@@ -13,7 +13,6 @@
 type Connection = Box<FnMut(Vec<u8>) + 'static>;
 
 fn f() -> Option<Connection> {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let mock_connection: Connection = Box::new(|_| {});
     Some(mock_connection)
 }
index 61de3c6385e7bb49581f01e73703a241e7ded94b..d1bf7e066cb5ae098c067bfea9e95cbb56941c78 100644 (file)
@@ -26,7 +26,6 @@ fn foo(name: String, samples_chan: Sender<Msg>) {
     thread::spawn(move|| {
         let mut samples_chan = samples_chan;
 
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         let callback: SamplesFn = Box::new(move |buffer| {
             for i in 0..buffer.len() {
                 println!("{}: {}", i, buffer[i])
index 29e96c162b8def8ba9fe06b88095f6b9c6347f1c..a513476d4a33a3fc2ed51dcabd072a71fe90983d 100644 (file)
@@ -9,10 +9,6 @@
 // except according to those terms.
 #![feature(i128_type)]
 
-// SNAP: run on all stages after snapshot, i128 currently doesn't work on stages 0 and 1
-// ignore-stage1
-// ignore-stage0
-
 fn main() {
     let _ = -0x8000_0000_0000_0000_0000_0000_0000_0000i128;
 }
index 9700ed247959b43039d5bb8afebdf5a81be1b2e4..78a37f51837860f8d532d2c4c5032491a5ebf7bc 100644 (file)
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// compile-flags: -g
 
 #[derive(PartialEq, Eq)]
 struct NewBool(bool);
index 543dbb36b2850a218001fb9513774018b73f4e6a..428eed0787a833db32a0959fed1a74f89a35c61a 100644 (file)
@@ -11,7 +11,6 @@
 // Test that the lambda kind is inferred correctly as a return
 // expression
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
 // pretty-expanded FIXME #23616
 
 fn unique() -> Box<FnMut()+'static> { return Box::new(|| ()); }
index e8297173a58345fe8e383a9de7056c87e50f637a..439ea3f2b579c0919e998c7042156e51c2e9ea7d 100644 (file)
@@ -11,7 +11,6 @@
 // Test that the lambda kind is inferred correctly as a return
 // expression
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
 // pretty-expanded FIXME #23616
 
 fn unique() -> Box<FnMut()+'static> { Box::new(|| ()) }
index 017259af190fc2d861f0d0375def08b362a0cbcb..5c195c8a4c63a37ddd09a1a4d21fa31967709b44 100644 (file)
 
 // Parser test for #37765
 
-fn with_parens<T: ToString>(arg: T) -> String { //~WARN dead_code
-  return (<T as ToString>::to_string(&arg)); //~WARN unused_parens
+fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
+  return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
 }
 
-fn no_parens<T: ToString>(arg: T) -> String { //~WARN dead_code
+fn no_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `no_parens`
   return <T as ToString>::to_string(&arg);
 }
 
index fc42fbc714c099cfbb5d27e1e1aeac7b5042b07a..c7a4accff85e12ad7853bb427bbf29bbbcd84ce2 100644 (file)
@@ -16,8 +16,6 @@
 #![allow(unused_variables)]
 #![allow(unknown_features)]
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 // Should pass region checking.
 fn ok(f: Box<FnMut(&usize)>) {
     // Here, g is a function that can accept a usize pointer with
index 8eee54b3fec6642288d5ab45729949aac0699610..ae4adbfb1f497f71b38138f7291be3d523311e29 100644 (file)
@@ -31,7 +31,6 @@ struct Foo<'a,'tcx:'a> {
 
 impl<'a,'tcx> Foo<'a,'tcx> {
     fn bother(&mut self) -> isize {
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         self.elaborate_bounds(Box::new(|this| {
             // (*) Here: type of `this` is `&'f0 Foo<&'f1, '_2>`,
             // where `'f0` and `'f1` are fresh, free regions that
index 03971668182acd98ff8d1607b2f6dad8033dfa98..47d0737dfc451d0c88ba70d4c62c24a56b0edf4f 100644 (file)
@@ -12,6 +12,5 @@
 struct Foo(Box<[u8]>);
 
 pub fn main() {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     println!("{:?}", Foo(Box::new([0, 1, 2])));
 }
index 9877dffe9df02f7cec3ee450fd2f4a68f3e37d7f..c58442aa58f332b0d1a3b26473628d013e9991f6 100644 (file)
@@ -105,7 +105,6 @@ fn check_legs(arc: Arc<Vec<Box<Pet+Sync+Send>>>) {
 }
 fn check_names(arc: Arc<Vec<Box<Pet+Sync+Send>>>) {
     for pet in arc.iter() {
-        // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         pet.name(Box::new(|name| {
             assert!(name.as_bytes()[0] == 'a' as u8 && name.as_bytes()[1] == 'l' as u8);
         }))
index f9a22d5ccec6d07a867ae5a24c27e5492f31a8e2..40453262ddf3a6019f53b986092dda0ef6c12a0d 100644 (file)
@@ -26,7 +26,6 @@ fn f(&self, x: &'static str) {
 
 pub fn main() {
     let a = Struct { x: 1, y: 2 };
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     let b: Box<Trait<&'static str>> = Box::new(a);
     b.f("Mary");
     let c: &Trait<&'static str> = &a;
index d40d9c89f89dff05b683eecad1d7bd40621995c6..130c6ee7521b4634c6cd5c22234aac083ed11fdc 100644 (file)
@@ -30,8 +30,6 @@ fn f(&self) {
 
 fn foo(mut a: Box<Write>) {}
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-
 pub fn main() {
     let a = Struct { x: 1, y: 2 };
     let b: Box<Trait> = Box::new(a);
index a92fb05306f483081104e601b7089c61224a140d..789d2237c543c544c9f92a0782749b0d61d25e90 100644 (file)
@@ -15,7 +15,6 @@
 use std::ops::FnMut;
 
 fn make_adder(x: isize) -> Box<FnMut(isize)->isize + 'static> {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     Box::new(move |y| { x + y })
 }
 
index 5dd2343cfd1dd43bf67c4b39e93954e77de20efb..e73077154717048cc21f76db5c3ec05ef14c73ca 100644 (file)
@@ -13,7 +13,6 @@
 use std::ops::FnMut;
 
 fn make_adder(x: isize) -> Box<FnMut(isize)->isize + 'static> {
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     Box::new(move |y| { x + y })
 }
 
diff --git a/src/test/rustdoc/issue-38129.rs b/src/test/rustdoc/issue-38129.rs
new file mode 100644 (file)
index 0000000..00ccc74
--- /dev/null
@@ -0,0 +1,110 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:--test
+
+// This file tests the source-partitioning behavior of rustdoc.
+// Each test contains some code that should be put into the generated
+// `fn main` and some attributes should be left outside (except the first
+// one, which has no attributes).
+// If the #![recursion_limit] attribute is incorrectly left inside,
+// then the tests will fail because the macro recurses 128 times.
+
+/// ```
+/// assert_eq!(1 + 1, 2);
+/// ```
+pub fn simple() {}
+
+/// ```
+/// #![recursion_limit = "1024"]
+/// macro_rules! recurse {
+///     (()) => {};
+///     (() $($rest:tt)*) => { recurse!($($rest)*); }
+/// }
+/// recurse!(() () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ());
+/// assert_eq!(1 + 1, 2);
+/// ```
+pub fn non_feature_attr() {}
+
+/// ```
+/// #![feature(core_intrinsics)]
+/// assert_eq!(1 + 1, 2);
+/// ```
+pub fn feature_attr() {}
+
+/// ```
+/// #![feature(core_intrinsics)]
+/// #![recursion_limit = "1024"]
+/// macro_rules! recurse {
+///     (()) => {};
+///     (() $($rest:tt)*) => { recurse!($($rest)*); }
+/// }
+/// recurse!(() () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ());
+/// assert_eq!(1 + 1, 2);
+/// ```
+pub fn both_attrs() {}
+
+/// ```
+/// #![recursion_limit = "1024"]
+/// #![feature(core_intrinsics)]
+/// macro_rules! recurse {
+///     (()) => {};
+///     (() $($rest:tt)*) => { recurse!($($rest)*); }
+/// }
+/// recurse!(() () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ()
+///          () () () () () () () ());
+/// assert_eq!(1 + 1, 2);
+/// ```
+pub fn both_attrs_reverse() {}
+
diff --git a/src/test/rustdoc/test_option_check/test.rs b/src/test/rustdoc/test_option_check/test.rs
new file mode 100644 (file)
index 0000000..b2afe43
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: --test
+// check-test-line-numbers-match
+
+/// This is a Foo;
+///
+/// ```
+/// println!("baaaaaar");
+/// ```
+pub struct Foo;
+
+/// This is a Bar;
+///
+/// ```
+/// println!("fooooo");
+/// ```
+pub struct Bar;
diff --git a/src/test/ui/codemap_tests/issue-38812-2.rs b/src/test/ui/codemap_tests/issue-38812-2.rs
new file mode 100644 (file)
index 0000000..c476657
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let (x,) = (vec![],);
+}
diff --git a/src/test/ui/codemap_tests/issue-38812-2.stderr b/src/test/ui/codemap_tests/issue-38812-2.stderr
new file mode 100644 (file)
index 0000000..156a6bd
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0282]: type annotations needed
+  --> $DIR/issue-38812-2.rs:12:17
+   |
+12 |     let (x,) = (vec![],);
+   |         ----    ^^^^^^ cannot infer type for `T`
+   |         |
+   |         consider giving a type to pattern
+   |
+   = note: this error originates in a macro outside of the current crate
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/codemap_tests/issue-38812.rs b/src/test/ui/codemap_tests/issue-38812.rs
new file mode 100644 (file)
index 0000000..a9943f7
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = vec![];
+}
diff --git a/src/test/ui/codemap_tests/issue-38812.stderr b/src/test/ui/codemap_tests/issue-38812.stderr
new file mode 100644 (file)
index 0000000..6365e76
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0282]: type annotations needed
+  --> $DIR/issue-38812.rs:12:13
+   |
+12 |     let x = vec![];
+   |         -   ^^^^^^ cannot infer type for `T`
+   |         |
+   |         consider giving `x` a type
+   |
+   = note: this error originates in a macro outside of the current crate
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/codemap_tests/repair_span_std_macros.rs b/src/test/ui/codemap_tests/repair_span_std_macros.rs
deleted file mode 100644 (file)
index 3abc91d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x = vec![];
-}
diff --git a/src/test/ui/codemap_tests/repair_span_std_macros.stderr b/src/test/ui/codemap_tests/repair_span_std_macros.stderr
deleted file mode 100644 (file)
index 7e0d778..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0282]: unable to infer enough type information about `T`
-  --> $DIR/repair_span_std_macros.rs:12:13
-   |
-12 |     let x = vec![];
-   |             ^^^^^^ cannot infer type for `T`
-   |
-   = note: type annotations or generic parameter binding required
-   = note: this error originates in a macro outside of the current crate
-
-error: aborting due to previous error
-
index 021b571fe793cd77c84ca3f1a302db1655883077..2a707c6eb8b103b428de32c4fb5f2c64f848b38a 100644 (file)
@@ -1,4 +1,4 @@
-error[E0276]: impl has stricter requirements than trait, #[deny(extra_requirement_in_impl)] on by default
+error[E0276]: impl has stricter requirements than trait
   --> $DIR/proj-outlives-region.rs:22:5
    |
 17 |     fn foo() where T: 'a;
@@ -7,6 +7,7 @@ error[E0276]: impl has stricter requirements than trait, #[deny(extra_requiremen
 22 |     fn foo() where U: 'a { } //~ ERROR E0276
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a`
    |
+   = note: #[deny(extra_requirement_in_impl)] on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #37166 <https://github.com/rust-lang/rust/issues/37166>
 
index 4df337c525743f778e21582776fe22c1f9c2194e..9e822bd8b0790097ff4832bd78edadf41677b8e9 100644 (file)
@@ -1,4 +1,4 @@
-error[E0276]: impl has stricter requirements than trait, #[deny(extra_requirement_in_impl)] on by default
+error[E0276]: impl has stricter requirements than trait
   --> $DIR/region-unrelated.rs:22:5
    |
 17 |     fn foo() where T: 'a;
@@ -7,6 +7,7 @@ error[E0276]: impl has stricter requirements than trait, #[deny(extra_requiremen
 22 |     fn foo() where V: 'a { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a`
    |
+   = note: #[deny(extra_requirement_in_impl)] on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #37166 <https://github.com/rust-lang/rust/issues/37166>
 
index 213366a307d40decb9165d209add3f94c337a99e..9a5e2de14e3b0788754bee7982778fea7adb0253 100644 (file)
@@ -1,4 +1,4 @@
-error: custom derive attribute panicked
+error: proc-macro derive panicked
   --> $DIR/issue-36935.rs:17:15
    |
 17 | #[derive(Foo, Bar)]
diff --git a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs
new file mode 100644 (file)
index 0000000..1938d33
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use Foo;
+
+use Foo1;
+
+fn main() {}
diff --git a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr
new file mode 100644 (file)
index 0000000..325f55e
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0432]: unresolved import `Foo`
+  --> $DIR/issue-38054-do-not-show-unresolved-names.rs:11:5
+   |
+11 | use Foo;
+   |     ^^^ no `Foo` in the root
+
+error[E0432]: unresolved import `Foo1`
+  --> $DIR/issue-38054-do-not-show-unresolved-names.rs:13:5
+   |
+13 | use Foo1;
+   |     ^^^^ no `Foo1` in the root
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/lint/command-line-lint-group-allow.rs b/src/test/ui/lint/command-line-lint-group-allow.rs
new file mode 100644 (file)
index 0000000..cdb9684
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -A bad-style
+
+fn main() {
+    let _InappropriateCamelCasing = true;
+}
diff --git a/src/test/ui/lint/command-line-lint-group-deny.rs b/src/test/ui/lint/command-line-lint-group-deny.rs
new file mode 100644 (file)
index 0000000..1248601
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -D bad-style
+
+fn main() {
+    let _InappropriateCamelCasing = true;
+}
diff --git a/src/test/ui/lint/command-line-lint-group-deny.stderr b/src/test/ui/lint/command-line-lint-group-deny.stderr
new file mode 100644 (file)
index 0000000..23fac66
--- /dev/null
@@ -0,0 +1,10 @@
+error: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing`
+  --> $DIR/command-line-lint-group-deny.rs:14:9
+   |
+14 |     let _InappropriateCamelCasing = true;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `-D non-snake-case` implied by `-D bad-style`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lint/command-line-lint-group-forbid.rs b/src/test/ui/lint/command-line-lint-group-forbid.rs
new file mode 100644 (file)
index 0000000..ae16db4
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -F bad-style
+
+fn main() {
+    let _InappropriateCamelCasing = true;
+}
diff --git a/src/test/ui/lint/command-line-lint-group-forbid.stderr b/src/test/ui/lint/command-line-lint-group-forbid.stderr
new file mode 100644 (file)
index 0000000..0babd7f
--- /dev/null
@@ -0,0 +1,10 @@
+error: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing`
+  --> $DIR/command-line-lint-group-forbid.rs:14:9
+   |
+14 |     let _InappropriateCamelCasing = true;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `-F non-snake-case` implied by `-F bad-style`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lint/command-line-lint-group-warn.rs b/src/test/ui/lint/command-line-lint-group-warn.rs
new file mode 100644 (file)
index 0000000..7d65c80
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -W bad-style
+
+fn main() {
+    let _InappropriateCamelCasing = true;
+}
diff --git a/src/test/ui/lint/command-line-lint-group-warn.stderr b/src/test/ui/lint/command-line-lint-group-warn.stderr
new file mode 100644 (file)
index 0000000..998c892
--- /dev/null
@@ -0,0 +1,8 @@
+warning: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing`
+  --> $DIR/command-line-lint-group-warn.rs:14:9
+   |
+14 |     let _InappropriateCamelCasing = true;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `-W non-snake-case` implied by `-W bad-style`
+
diff --git a/src/test/ui/lint/lint-group-style.rs b/src/test/ui/lint/lint-group-style.rs
new file mode 100644 (file)
index 0000000..2bd760e
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright 2014–2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(bad_style)]
+#![allow(dead_code)]
+
+fn CamelCase() {}
+
+#[allow(bad_style)]
+mod test {
+    fn CamelCase() {}
+
+    #[forbid(bad_style)]
+    mod bad {
+        fn CamelCase() {}
+
+        static bad: isize = 1;
+    }
+
+    mod warn {
+        #![warn(bad_style)]
+
+        fn CamelCase() {}
+
+        struct snake_case;
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/lint/lint-group-style.stderr b/src/test/ui/lint/lint-group-style.stderr
new file mode 100644 (file)
index 0000000..9c0f486
--- /dev/null
@@ -0,0 +1,67 @@
+error: function `CamelCase` should have a snake case name such as `camel_case`
+  --> $DIR/lint-group-style.rs:14:1
+   |
+14 | fn CamelCase() {}
+   | ^^^^^^^^^^^^^^^^^
+   |
+   = note: #[deny(non_snake_case)] implied by #[deny(bad_style)]
+note: lint level defined here
+  --> $DIR/lint-group-style.rs:11:9
+   |
+11 | #![deny(bad_style)]
+   |         ^^^^^^^^^
+
+error: function `CamelCase` should have a snake case name such as `camel_case`
+  --> $DIR/lint-group-style.rs:22:9
+   |
+22 |         fn CamelCase() {}
+   |         ^^^^^^^^^^^^^^^^^
+   |
+   = note: #[forbid(non_snake_case)] implied by #[forbid(bad_style)]
+note: lint level defined here
+  --> $DIR/lint-group-style.rs:20:14
+   |
+20 |     #[forbid(bad_style)]
+   |              ^^^^^^^^^
+
+error: static variable `bad` should have an upper case name such as `BAD`
+  --> $DIR/lint-group-style.rs:24:9
+   |
+24 |         static bad: isize = 1;
+   |         ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: #[forbid(non_upper_case_globals)] implied by #[forbid(bad_style)]
+note: lint level defined here
+  --> $DIR/lint-group-style.rs:20:14
+   |
+20 |     #[forbid(bad_style)]
+   |              ^^^^^^^^^
+
+warning: function `CamelCase` should have a snake case name such as `camel_case`
+  --> $DIR/lint-group-style.rs:30:9
+   |
+30 |         fn CamelCase() {}
+   |         ^^^^^^^^^^^^^^^^^
+   |
+   = note: #[warn(non_snake_case)] implied by #[warn(bad_style)]
+note: lint level defined here
+  --> $DIR/lint-group-style.rs:28:17
+   |
+28 |         #![warn(bad_style)]
+   |                 ^^^^^^^^^
+
+warning: type `snake_case` should have a camel case name such as `SnakeCase`
+  --> $DIR/lint-group-style.rs:32:9
+   |
+32 |         struct snake_case;
+   |         ^^^^^^^^^^^^^^^^^^
+   |
+   = note: #[warn(non_camel_case_types)] implied by #[warn(bad_style)]
+note: lint level defined here
+  --> $DIR/lint-group-style.rs:28:17
+   |
+28 |         #![warn(bad_style)]
+   |                 ^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
index 3671abd66246d864d6f38574adbc6ffce0ea48f5..79368587062e8b6fcecac948877846d5cb90a541 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
index 2d007af4980b208aad23781e8478e5d385ae2bdf..a16ae5538bf92d2038afae65670a6d6d909c7b1a 100644 (file)
@@ -1,10 +1,8 @@
-error[E0282]: unable to infer enough type information about `X`
+error[E0282]: type annotations needed
   --> $DIR/missing-type-parameter.rs:14:5
    |
 14 |     foo();
    |     ^^^ cannot infer type for `X`
-   |
-   = note: type annotations or generic parameter binding required
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/regions-fn-subtyping-return-static.rs b/src/test/ui/regions-fn-subtyping-return-static.rs
new file mode 100644 (file)
index 0000000..9098511
--- /dev/null
@@ -0,0 +1,57 @@
+// Copyright 2012 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.
+
+// In this fn, the type `F` is a function that takes a reference to a
+// struct and returns another reference with the same lifetime.
+//
+// Meanwhile, the bare fn `foo` takes a reference to a struct with
+// *ANY* lifetime and returns a reference with the 'static lifetime.
+// This can safely be considered to be an instance of `F` because all
+// lifetimes are sublifetimes of 'static.
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+
+struct S;
+
+// Given 'cx, return 'cx
+type F = for<'cx> fn(&'cx S) -> &'cx S;
+fn want_F(f: F) { }
+
+// Given anything, return 'static
+type G = for<'cx> fn(&'cx S) -> &'static S;
+fn want_G(f: G) { }
+
+// Should meet both.
+fn foo(x: &S) -> &'static S {
+    panic!()
+}
+
+// Should meet both.
+fn bar<'a,'b>(x: &'a S) -> &'b S {
+    panic!()
+}
+
+// Meets F, but not G.
+fn baz(x: &S) -> &S {
+    panic!()
+}
+
+fn supply_F() {
+    want_F(foo);
+
+    // FIXME(#33684) -- this should be a subtype, but current alg. rejects it incorrectly
+    want_F(bar); //~ ERROR E0308
+
+    want_F(baz);
+}
+
+pub fn main() {
+}
diff --git a/src/test/ui/regions-fn-subtyping-return-static.stderr b/src/test/ui/regions-fn-subtyping-return-static.stderr
new file mode 100644 (file)
index 0000000..0c7b44a
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0308]: mismatched types
+  --> $DIR/regions-fn-subtyping-return-static.rs:51:12
+   |
+51 |     want_F(bar); //~ ERROR E0308
+   |            ^^^ expected concrete lifetime, found bound lifetime parameter 'cx
+   |
+   = note: expected type `fn(&'cx S) -> &'cx S`
+              found type `fn(&'a S) -> &S {bar::<'_>}`
+   = note: lifetime parameter `'b` declared on fn `bar` appears only in the return type, but here is required to be higher-ranked, which means that `'b` must appear in both argument and return types
+   = note: this error is the result of a recent bug fix; for more information, see issue #33685 <https://github.com/rust-lang/rust/issues/33685>
+
+error: aborting due to previous error
+
index ba1ae64ec330af6cda67d77fec86f81891ee1524..6264d11186452b7e164eeb354acd5a60be80c855 100644 (file)
@@ -18,7 +18,6 @@ struct Test<'a> {
     f: Box<FnMut() + 'a>
 }
 
-// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
 fn call<F>(mut f: F) where F: FnMut(Fn) {
     f(Box::new(|| {
     //~^ ERROR: cannot borrow `f` as mutable more than once
@@ -58,7 +57,6 @@ fn test6() {
 fn test7() {
     fn foo<F>(_: F) where F: FnMut(Box<FnMut(isize)>, isize) {}
     let mut f = |g: Box<FnMut(isize)>, b: isize| {};
-    // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     f(Box::new(|a| {
         foo(f);
         //~^ ERROR cannot move `f` into closure because it is borrowed
index f2f0e027f0161927da53cdb4f77f8dfe8e445a53..58b3f205fe35289c9dc185c3ab32ab6f0cf4e2c9 100644 (file)
@@ -1,44 +1,44 @@
 error[E0499]: cannot borrow `f` as mutable more than once at a time
-  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:23:16
+  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:22:16
    |
-23 |     f(Box::new(|| {
+22 |     f(Box::new(|| {
    |     -          ^^ second mutable borrow occurs here
    |     |
    |     first mutable borrow occurs here
-24 |     //~^ ERROR: cannot borrow `f` as mutable more than once
-25 |         f((Box::new(|| {})))
+23 |     //~^ ERROR: cannot borrow `f` as mutable more than once
+24 |         f((Box::new(|| {})))
    |         - borrow occurs due to use of `f` in closure
-26 |     }));
+25 |     }));
    |       - first borrow ends here
 
 error: cannot borrow immutable borrowed content `*f` as mutable
-  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:36:5
+  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:35:5
    |
-35 | fn test2<F>(f: &F) where F: FnMut() {
+34 | fn test2<F>(f: &F) where F: FnMut() {
    |                -- use `&mut F` here to make mutable
-36 |     (*f)(); //~ ERROR: cannot borrow immutable borrowed content `*f` as mutable
+35 |     (*f)(); //~ ERROR: cannot borrow immutable borrowed content `*f` as mutable
    |     ^^^^ cannot borrow as mutable
 
 error: cannot borrow immutable `Box` content `*f.f` as mutable
-  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:44:5
+  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:43:5
    |
-43 | fn test4(f: &Test) {
+42 | fn test4(f: &Test) {
    |             ----- use `&mut Test` here to make mutable
-44 |     f.f.call_mut(()) //~ ERROR: cannot borrow immutable `Box` content `*f.f` as mutable
+43 |     f.f.call_mut(()) //~ ERROR: cannot borrow immutable `Box` content `*f.f` as mutable
    |     ^^^ cannot borrow as mutable
 
 error[E0504]: cannot move `f` into closure because it is borrowed
-  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:63:13
+  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:61:13
    |
-62 |     f(Box::new(|a| {
+60 |     f(Box::new(|a| {
    |     - borrow of `f` occurs here
-63 |         foo(f);
+61 |         foo(f);
    |             ^ move into closure occurs here
 
 error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
-  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:63:13
+  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:61:13
    |
-63 |         foo(f);
+61 |         foo(f);
    |             ^ cannot move out of captured outer variable in an `FnMut` closure
 
 error: aborting due to 5 previous errors
index dbe5e31287e9793b2d3be74d91b18b9aa391ef46..c4f2616f5945b1baa5680d1bc475fc3e8c282f5c 100644 (file)
@@ -4,6 +4,7 @@ error: variable `theTwo` should have a snake case name such as `the_two`
 19 |     let theTwo = 2;
    |         ^^^^^^
    |
+   = note: #[deny(non_snake_case)] implied by #[deny(warnings)]
 note: lint level defined here
   --> $DIR/issue-24690.rs:16:9
    |
@@ -15,6 +16,8 @@ error: variable `theOtherTwo` should have a snake case name such as `the_other_t
    |
 20 |     let theOtherTwo = 2;
    |         ^^^^^^^^^^^
+   |
+   = note: #[deny(non_snake_case)] implied by #[deny(warnings)]
 
 error: unused variable: `theOtherTwo`
   --> $DIR/issue-24690.rs:20:9
@@ -22,6 +25,7 @@ error: unused variable: `theOtherTwo`
 20 |     let theOtherTwo = 2;
    |         ^^^^^^^^^^^
    |
+   = note: #[deny(unused_variables)] implied by #[deny(warnings)]
 note: lint level defined here
   --> $DIR/issue-24690.rs:16:9
    |
index b581584eee7e2471cff58053d25716a01f208010..4b1ca7f98bbf65d1d2ad8bd2e73462f5dcd16087 100644 (file)
@@ -1,6 +1,8 @@
-warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd`, #[warn(unused_imports)] on by default
+warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd`
   --> $DIR/multispan-import-lint.rs:11:16
    |
 11 | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd};
    |                ^^  ^^^       ^^^^^^^^^  ^^^^^^^^^^
+   |
+   = note: #[warn(unused_imports)] on by default
 
index 83fd766c547398a91214a5db57fe62d7b362ab10..786b3192e067568174a23a86b35c13f6e1e59a8a 100644 (file)
@@ -25,7 +25,7 @@ struct Test {
     Test {
         name: "cargo",
         repo: "https://github.com/rust-lang/cargo",
-        sha: "2324c2bbaf7fc6ea9cbdd77c034ef1af769cb617",
+        sha: "0e1e34be7540bdaed4918457654fbf028cf69e56",
         lock: None,
     },
     Test {
index 2982f29f931c326087a89540866dc2e084a4819e..1fc98a78a7c473c73148174942d0e62f82bb9fda 100644 (file)
@@ -2,9 +2,9 @@
 authors = ["The Rust Project Developers"]
 name = "compiletest"
 version = "0.0.0"
-build = "build.rs"
 
 [dependencies]
 log = "0.3"
 env_logger = { version = "0.3.5", default-features = false }
 rustc-serialize = "0.3"
+filetime = "0.1"
diff --git a/src/tools/compiletest/build.rs b/src/tools/compiletest/build.rs
deleted file mode 100644 (file)
index d5164b9..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
-}
index 1aeb76c0a0ecedebe8a3d50ba6317fa2bab68868..eb8cdcee6e69c495b0219fbebd8415944a5a66bb 100644 (file)
@@ -185,6 +185,9 @@ pub struct Config {
     // Print one character per test instead of one line
     pub quiet: bool,
 
+    // where to find the qemu test client process, if we're using it
+    pub qemu_test_client: Option<PathBuf>,
+
     // Configuration for various run-make tests frobbing things like C compilers
     // or querying about various LLVM component information.
     pub cc: String,
index ac1ac1c2f6c088e6ec6f0be258931673834b6d75..522cd222c269171efd09f2a2b76e5a527df53d34 100644 (file)
@@ -25,6 +25,7 @@
 pub struct EarlyProps {
     pub ignore: bool,
     pub should_fail: bool,
+    pub aux: Vec<String>,
 }
 
 impl EarlyProps {
@@ -32,6 +33,7 @@ pub fn from_file(config: &Config, testfile: &Path) -> Self {
         let mut props = EarlyProps {
             ignore: false,
             should_fail: false,
+            aux: Vec::new(),
         };
 
         iter_header(testfile,
@@ -50,6 +52,10 @@ pub fn from_file(config: &Config, testfile: &Path) -> Self {
                 ignore_lldb(config, ln) ||
                 ignore_llvm(config, ln);
 
+            if let Some(s) = parse_aux_build(ln) {
+                props.aux.push(s);
+            }
+
             props.should_fail = props.should_fail || parse_name_directive(ln, "should-fail");
         });
 
@@ -224,6 +230,8 @@ pub struct TestProps {
     pub incremental_dir: Option<PathBuf>,
     // Specifies that a cfail test must actually compile without errors.
     pub must_compile_successfully: bool,
+    // rustdoc will test the output of the `--test` option
+    pub check_test_line_numbers_match: bool,
 }
 
 impl TestProps {
@@ -248,6 +256,7 @@ pub fn new() -> Self {
             forbid_output: vec![],
             incremental_dir: None,
             must_compile_successfully: false,
+            check_test_line_numbers_match: false,
         }
     }
 
@@ -347,6 +356,10 @@ pub fn load_from(&mut self, testfile: &Path, cfg: Option<&str>) {
             if !self.must_compile_successfully {
                 self.must_compile_successfully = parse_must_compile_successfully(ln);
             }
+
+            if !self.check_test_line_numbers_match {
+                self.check_test_line_numbers_match = parse_check_test_line_numbers_match(ln);
+            }
         });
 
         for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_THREADS"] {
@@ -458,6 +471,10 @@ fn parse_must_compile_successfully(line: &str) -> bool {
     parse_name_directive(line, "must-compile-successfully")
 }
 
+fn parse_check_test_line_numbers_match(line: &str) -> bool {
+    parse_name_directive(line, "check-test-line-numbers-match")
+}
+
 fn parse_env(line: &str, name: &str) -> Option<(String, String)> {
     parse_name_value_directive(line, name).map(|nv| {
         // nv is either FOO or FOO=BAR
index 43d02479fb17de8442e823b401c537707c5a2966..5a97f7e3ee9b533321328b2d8548f3367b783687 100644 (file)
 extern crate libc;
 extern crate test;
 extern crate getopts;
-
-#[cfg(cargobuild)]
 extern crate rustc_serialize;
-#[cfg(not(cargobuild))]
-extern crate serialize as rustc_serialize;
-
 #[macro_use]
 extern crate log;
-
-#[cfg(cargobuild)]
 extern crate env_logger;
+extern crate filetime;
 
 use std::env;
 use std::ffi::OsString;
@@ -39,6 +33,7 @@
 use std::io;
 use std::path::{Path, PathBuf};
 use std::process::Command;
+use filetime::FileTime;
 use getopts::{optopt, optflag, reqopt};
 use common::Config;
 use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Mode};
 mod uidiff;
 
 fn main() {
-    #[cfg(cargobuild)]
-    fn log_init() { env_logger::init().unwrap(); }
-    #[cfg(not(cargobuild))]
-    fn log_init() {}
-    log_init();
+    env_logger::init().unwrap();
 
     let config = parse_config(env::args().collect());
 
@@ -116,6 +107,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
           reqopt("", "llvm-components", "list of LLVM components built in", "LIST"),
           reqopt("", "llvm-cxxflags", "C++ flags for LLVM", "FLAGS"),
           optopt("", "nodejs", "the name of nodejs", "PATH"),
+          optopt("", "qemu-test-client", "path to the qemu test client", "PATH"),
           optflag("h", "help", "show this message")];
 
     let (argv0, args_) = args.split_first().unwrap();
@@ -196,6 +188,7 @@ fn make_absolute(path: PathBuf) -> PathBuf {
         lldb_python_dir: matches.opt_str("lldb-python-dir"),
         verbose: matches.opt_present("verbose"),
         quiet: matches.opt_present("quiet"),
+        qemu_test_client: matches.opt_str("qemu-test-client").map(PathBuf::from),
 
         cc: matches.opt_str("cc").unwrap(),
         cxx: matches.opt_str("cxx").unwrap(),
@@ -302,6 +295,14 @@ pub fn run_tests(config: &Config) {
             // time.
             env::set_var("RUST_TEST_THREADS", "1");
         }
+
+        DebugInfoGdb => {
+            if config.qemu_test_client.is_some() {
+                println!("WARNING: debuginfo tests are not available when \
+                          testing with QEMU");
+                return
+            }
+        }
         _ => { /* proceed */ }
     }
 
@@ -468,7 +469,7 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
     };
 
     // Debugging emscripten code doesn't make sense today
-    let mut ignore = early_props.ignore;
+    let mut ignore = early_props.ignore || !up_to_date(config, testpaths, &early_props);
     if (config.mode == DebugInfoGdb || config.mode == DebugInfoLldb) &&
         config.target.contains("emscripten") {
         ignore = true;
@@ -484,6 +485,42 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
     }
 }
 
+fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf {
+    let stamp_name = format!("{}-H-{}-T-{}-S-{}.stamp",
+                             testpaths.file.file_name().unwrap()
+                                           .to_str().unwrap(),
+                             config.host,
+                             config.target,
+                             config.stage_id);
+    config.build_base.canonicalize()
+          .unwrap_or(config.build_base.clone())
+          .join(stamp_name)
+}
+
+fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> bool {
+    let stamp = mtime(&stamp(config, testpaths));
+    let mut inputs = vec![
+        mtime(&testpaths.file),
+        mtime(&config.rustc_path),
+    ];
+    for aux in props.aux.iter() {
+        inputs.push(mtime(&testpaths.file.parent().unwrap()
+                                         .join("auxiliary")
+                                         .join(aux)));
+    }
+    for lib in config.run_lib_path.read_dir().unwrap() {
+        let lib = lib.unwrap();
+        inputs.push(mtime(&lib.path()));
+    }
+    inputs.iter().any(|input| *input > stamp)
+}
+
+fn mtime(path: &Path) -> FileTime {
+    fs::metadata(path).map(|f| {
+        FileTime::from_last_modification_time(&f)
+    }).unwrap_or(FileTime::zero())
+}
+
 pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName {
     // Convert a complete path to something like
     //
index 86fa5e70c9c28322f11d651af32f51408ae82028..bcec1f63bc089df560acffeb839d7ca69a2c4c85 100644 (file)
@@ -43,7 +43,7 @@ pub fn run(config: Config, testpaths: &TestPaths) {
         }
 
         _ => {
-            // android has it's own gdb handling
+            // android has its own gdb handling
             if config.mode == DebugInfoGdb && config.gdb.is_none() {
                 panic!("gdb not available but debuginfo gdb debuginfo test requested");
             }
@@ -80,6 +80,8 @@ pub fn run(config: Config, testpaths: &TestPaths) {
     }
 
     base_cx.complete_all();
+
+    File::create(::stamp(&config, &testpaths)).unwrap();
 }
 
 struct TestCx<'test> {
@@ -1190,7 +1192,45 @@ fn exec_compiled_test(&self) -> ProcRes {
             "arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => {
                 self._arm_exec_compiled_test(env)
             }
-            _=> {
+
+            // This is pretty similar to below, we're transforming:
+            //
+            //      program arg1 arg2
+            //
+            // into
+            //
+            //      qemu-test-client run program:support-lib.so arg1 arg2
+            //
+            // The test-client program will upload `program` to the emulator
+            // along with all other support libraries listed (in this case
+            // `support-lib.so`. It will then execute the program on the
+            // emulator with the arguments specified (in the environment we give
+            // the process) and then report back the same result.
+            _ if self.config.qemu_test_client.is_some() => {
+                let aux_dir = self.aux_output_dir_name();
+                let mut args = self.make_run_args();
+                let mut program = args.prog.clone();
+                if let Ok(entries) = aux_dir.read_dir() {
+                    for entry in entries {
+                        let entry = entry.unwrap();
+                        if !entry.path().is_file() {
+                            continue
+                        }
+                        program.push_str(":");
+                        program.push_str(entry.path().to_str().unwrap());
+                    }
+                }
+                args.args.insert(0, program);
+                args.args.insert(0, "run".to_string());
+                args.prog = self.config.qemu_test_client.clone().unwrap()
+                                .into_os_string().into_string().unwrap();
+                self.compose_and_run(args,
+                                     env,
+                                     self.config.run_lib_path.to_str().unwrap(),
+                                     Some(aux_dir.to_str().unwrap()),
+                                     None)
+            }
+            _ => {
                 let aux_dir = self.aux_output_dir_name();
                 self.compose_and_run(self.make_run_args(),
                                      env,
@@ -1887,14 +1927,75 @@ fn run_rustdoc_test(&self) {
         if !proc_res.status.success() {
             self.fatal_proc_rec("rustdoc failed!", &proc_res);
         }
-        let root = self.find_rust_src_root().unwrap();
 
-        let res = self.cmd2procres(Command::new(&self.config.docck_python)
-                                   .arg(root.join("src/etc/htmldocck.py"))
-                                   .arg(out_dir)
-                                   .arg(&self.testpaths.file));
-        if !res.status.success() {
-            self.fatal_proc_rec("htmldocck failed!", &res);
+        if self.props.check_test_line_numbers_match == true {
+            self.check_rustdoc_test_option(proc_res);
+        } else {
+            let root = self.find_rust_src_root().unwrap();
+            let res = self.cmd2procres(Command::new(&self.config.docck_python)
+                                       .arg(root.join("src/etc/htmldocck.py"))
+                                       .arg(out_dir)
+                                       .arg(&self.testpaths.file));
+            if !res.status.success() {
+                self.fatal_proc_rec("htmldocck failed!", &res);
+            }
+        }
+    }
+
+    fn check_rustdoc_test_option(&self, res: ProcRes) {
+        let mut file = fs::File::open(&self.testpaths.file)
+                                .expect("markdown_test_output_check_entry File::open failed");
+        let mut content = String::new();
+        file.read_to_string(&mut content)
+            .expect("markdown_test_output_check_entry read_to_string failed");
+        let mut ignore = false;
+        let mut v: Vec<usize> =
+            content.lines()
+                   .enumerate()
+                   .filter_map(|(line_nb, line)| {
+                       let sline = line.split("///").last().unwrap_or("");
+                       let line = sline.trim_left();
+                       if line.starts_with("```") {
+                           if ignore {
+                               ignore = false;
+                               None
+                           } else {
+                               ignore = true;
+                               Some(line_nb + 1)
+                           }
+                       } else {
+                           None
+                       }
+                   })
+                   .collect();
+
+        let mut tested = 0;
+        for _ in res.stdout.split("\n")
+                           .filter(|s| s.starts_with("test "))
+                           .inspect(|s| {
+                               let tmp: Vec<&str> = s.split(" - line ").collect();
+                               if tmp.len() == 2 {
+                                   tested += 1;
+                                   let line = tmp[1].split(" ...")
+                                                    .next()
+                                                    .unwrap_or("0")
+                                                    .parse()
+                                                    .unwrap_or(0);
+                                   if let Ok(pos) = v.binary_search(&line) {
+                                       v.remove(pos);
+                                   } else {
+                                       self.fatal_proc_rec(
+                                           &format!("Not found doc test: \"{}\" in {:?}", s, v),
+                                           &res);
+                                   }
+                               }
+                           }) {}
+        if tested == 0 {
+            self.fatal_proc_rec("No test has been found", &res);
+        } else if v.len() != 0 {
+            self.fatal_proc_rec(&format!("Not found test at line{} {:?}",
+                                         if v.len() > 1 { "s" } else { "" }, v),
+                                &res);
         }
     }
 
diff --git a/src/tools/qemu-test-client/Cargo.toml b/src/tools/qemu-test-client/Cargo.toml
new file mode 100644 (file)
index 0000000..eb326c0
--- /dev/null
@@ -0,0 +1,6 @@
+[package]
+name = "qemu-test-client"
+version = "0.1.0"
+authors = ["The Rust Project Developers"]
+
+[dependencies]
diff --git a/src/tools/qemu-test-client/src/main.rs b/src/tools/qemu-test-client/src/main.rs
new file mode 100644 (file)
index 0000000..b7ff411
--- /dev/null
@@ -0,0 +1,221 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+/// This is a small client program intended to pair with `qemu-test-server` in
+/// this repository. This client connects to the server over TCP and is used to
+/// push artifacts and run tests on the server instead of locally.
+///
+/// Here is also where we bake in the support to spawn the QEMU emulator as
+/// well.
+
+use std::env;
+use std::fs::File;
+use std::io::prelude::*;
+use std::io::{self, BufWriter};
+use std::net::TcpStream;
+use std::path::Path;
+use std::process::{Command, Stdio};
+use std::thread;
+use std::time::Duration;
+
+macro_rules! t {
+    ($e:expr) => (match $e {
+        Ok(e) => e,
+        Err(e) => panic!("{} failed with {}", stringify!($e), e),
+    })
+}
+
+fn main() {
+    let mut args = env::args().skip(1);
+
+    match &args.next().unwrap()[..] {
+        "spawn-emulator" => {
+            spawn_emulator(Path::new(&args.next().unwrap()),
+                           Path::new(&args.next().unwrap()))
+        }
+        "push" => {
+            push(Path::new(&args.next().unwrap()))
+        }
+        "run" => {
+            run(args.next().unwrap(), args.collect())
+        }
+        cmd => panic!("unknown command: {}", cmd),
+    }
+}
+
+fn spawn_emulator(rootfs: &Path, tmpdir: &Path) {
+    // Generate a new rootfs image now that we've updated the test server
+    // executable. This is the equivalent of:
+    //
+    //      find $rootfs -print 0 | cpio --null -o --format=newc > rootfs.img
+    let rootfs_img = tmpdir.join("rootfs.img");
+    let mut cmd = Command::new("cpio");
+    cmd.arg("--null")
+       .arg("-o")
+       .arg("--format=newc")
+       .stdin(Stdio::piped())
+       .stdout(Stdio::piped())
+       .current_dir(rootfs);
+    let mut child = t!(cmd.spawn());
+    let mut stdin = child.stdin.take().unwrap();
+    let rootfs = rootfs.to_path_buf();
+    thread::spawn(move || add_files(&mut stdin, &rootfs, &rootfs));
+    t!(io::copy(&mut child.stdout.take().unwrap(),
+                &mut t!(File::create(&rootfs_img))));
+    assert!(t!(child.wait()).success());
+
+    // Start up the emulator, in the background
+    let mut cmd = Command::new("qemu-system-arm");
+    cmd.arg("-M").arg("vexpress-a15")
+       .arg("-m").arg("1024")
+       .arg("-kernel").arg("/tmp/zImage")
+       .arg("-initrd").arg(&rootfs_img)
+       .arg("-dtb").arg("/tmp/vexpress-v2p-ca15-tc1.dtb")
+       .arg("-append").arg("console=ttyAMA0 root=/dev/ram rdinit=/sbin/init init=/sbin/init")
+       .arg("-nographic")
+       .arg("-redir").arg("tcp:12345::12345");
+    t!(cmd.spawn());
+
+    // Wait for the emulator to come online
+    loop {
+        let dur = Duration::from_millis(100);
+        if let Ok(mut client) = TcpStream::connect("127.0.0.1:12345") {
+            t!(client.set_read_timeout(Some(dur)));
+            t!(client.set_write_timeout(Some(dur)));
+            if client.write_all(b"ping").is_ok() {
+                let mut b = [0; 4];
+                if client.read_exact(&mut b).is_ok() {
+                    break
+                }
+            }
+        }
+        thread::sleep(dur);
+    }
+
+    fn add_files(w: &mut Write, root: &Path, cur: &Path) {
+        for entry in t!(cur.read_dir()) {
+            let entry = t!(entry);
+            let path = entry.path();
+            let to_print = path.strip_prefix(root).unwrap();
+            t!(write!(w, "{}\u{0}", to_print.to_str().unwrap()));
+            if t!(entry.file_type()).is_dir() {
+                add_files(w, root, &path);
+            }
+        }
+    }
+}
+
+fn push(path: &Path) {
+    let client = t!(TcpStream::connect("127.0.0.1:12345"));
+    let mut client = BufWriter::new(client);
+    t!(client.write_all(b"push"));
+    t!(client.write_all(path.file_name().unwrap().to_str().unwrap().as_bytes()));
+    t!(client.write_all(&[0]));
+    let mut file = t!(File::open(path));
+    t!(io::copy(&mut file, &mut client));
+    t!(client.flush());
+    println!("done pushing {:?}", path);
+}
+
+fn run(files: String, args: Vec<String>) {
+    let client = t!(TcpStream::connect("127.0.0.1:12345"));
+    let mut client = BufWriter::new(client);
+    t!(client.write_all(b"run "));
+
+    // Send over the args
+    for arg in args {
+        t!(client.write_all(arg.as_bytes()));
+        t!(client.write_all(&[0]));
+    }
+    t!(client.write_all(&[0]));
+
+    // Send over env vars
+    for (k, v) in env::vars() {
+        if k != "PATH" && k != "LD_LIBRARY_PATH" {
+            t!(client.write_all(k.as_bytes()));
+            t!(client.write_all(&[0]));
+            t!(client.write_all(v.as_bytes()));
+            t!(client.write_all(&[0]));
+        }
+    }
+    t!(client.write_all(&[0]));
+
+    // Send over support libraries
+    let mut files = files.split(':');
+    let exe = files.next().unwrap();
+    for file in files.map(Path::new) {
+        t!(client.write_all(file.file_name().unwrap().to_str().unwrap().as_bytes()));
+        t!(client.write_all(&[0]));
+        send(&file, &mut client);
+    }
+    t!(client.write_all(&[0]));
+
+    // Send over the client executable as the last piece
+    send(exe.as_ref(), &mut client);
+
+    println!("uploaded {:?}, waiting for result", exe);
+
+    // Ok now it's time to read all the output. We're receiving "frames"
+    // representing stdout/stderr, so we decode all that here.
+    let mut header = [0; 5];
+    let mut stderr_done = false;
+    let mut stdout_done = false;
+    let mut client = t!(client.into_inner());
+    let mut stdout = io::stdout();
+    let mut stderr = io::stderr();
+    while !stdout_done || !stderr_done {
+        t!(client.read_exact(&mut header));
+        let amt = ((header[1] as u64) << 24) |
+                  ((header[2] as u64) << 16) |
+                  ((header[3] as u64) <<  8) |
+                  ((header[4] as u64) <<  0);
+        if header[0] == 0 {
+            if amt == 0 {
+                stdout_done = true;
+            } else {
+                t!(io::copy(&mut (&mut client).take(amt), &mut stdout));
+                t!(stdout.flush());
+            }
+        } else {
+            if amt == 0 {
+                stderr_done = true;
+            } else {
+                t!(io::copy(&mut (&mut client).take(amt), &mut stderr));
+                t!(stderr.flush());
+            }
+        }
+    }
+
+    // Finally, read out the exit status
+    let mut status = [0; 5];
+    t!(client.read_exact(&mut status));
+    let code = ((status[1] as i32) << 24) |
+               ((status[2] as i32) << 16) |
+               ((status[3] as i32) <<  8) |
+               ((status[4] as i32) <<  0);
+    if status[0] == 0 {
+        std::process::exit(code);
+    } else {
+        println!("died due to signal {}", code);
+        std::process::exit(3);
+    }
+}
+
+fn send(path: &Path, dst: &mut Write) {
+    let mut file = t!(File::open(&path));
+    let amt = t!(file.metadata()).len();
+    t!(dst.write_all(&[
+        (amt >> 24) as u8,
+        (amt >> 16) as u8,
+        (amt >>  8) as u8,
+        (amt >>  0) as u8,
+    ]));
+    t!(io::copy(&mut file, dst));
+}
diff --git a/src/tools/qemu-test-server/Cargo.toml b/src/tools/qemu-test-server/Cargo.toml
new file mode 100644 (file)
index 0000000..af445a2
--- /dev/null
@@ -0,0 +1,6 @@
+[package]
+name = "qemu-test-server"
+version = "0.1.0"
+authors = ["The Rust Project Developers"]
+
+[dependencies]
diff --git a/src/tools/qemu-test-server/src/main.rs b/src/tools/qemu-test-server/src/main.rs
new file mode 100644 (file)
index 0000000..1c5d7b9
--- /dev/null
@@ -0,0 +1,232 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+/// This is a small server which is intended to run inside of an emulator. This
+/// server pairs with the `qemu-test-client` program in this repository. The
+/// `qemu-test-client` connects to this server over a TCP socket and performs
+/// work such as:
+///
+/// 1. Pushing shared libraries to the server
+/// 2. Running tests through the server
+///
+/// The server supports running tests concurrently and also supports tests
+/// themselves having support libraries. All data over the TCP sockets is in a
+/// basically custom format suiting our needs.
+
+use std::fs::{self, File, Permissions};
+use std::io::prelude::*;
+use std::io::{self, BufReader};
+use std::net::{TcpListener, TcpStream};
+use std::os::unix::prelude::*;
+use std::sync::{Arc, Mutex};
+use std::path::Path;
+use std::str;
+use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use std::thread;
+use std::process::{Command, Stdio};
+
+macro_rules! t {
+    ($e:expr) => (match $e {
+        Ok(e) => e,
+        Err(e) => panic!("{} failed with {}", stringify!($e), e),
+    })
+}
+
+static TEST: AtomicUsize = ATOMIC_USIZE_INIT;
+
+fn main() {
+    println!("starting test server");
+    let listener = t!(TcpListener::bind("10.0.2.15:12345"));
+    println!("listening!");
+
+    let work = Path::new("/tmp/work");
+    t!(fs::create_dir_all(work));
+
+    let lock = Arc::new(Mutex::new(()));
+
+    for socket in listener.incoming() {
+        let mut socket = t!(socket);
+        let mut buf = [0; 4];
+        t!(socket.read_exact(&mut buf));
+        if &buf[..] == b"ping" {
+            t!(socket.write_all(b"pong"));
+        } else if &buf[..] == b"push" {
+            handle_push(socket, work);
+        } else if &buf[..] == b"run " {
+            let lock = lock.clone();
+            thread::spawn(move || handle_run(socket, work, &lock));
+        } else {
+            panic!("unknown command {:?}", buf);
+        }
+    }
+}
+
+fn handle_push(socket: TcpStream, work: &Path) {
+    let mut reader = BufReader::new(socket);
+    let mut filename = Vec::new();
+    t!(reader.read_until(0, &mut filename));
+    filename.pop(); // chop off the 0
+    let filename = t!(str::from_utf8(&filename));
+
+    let path = work.join(filename);
+    t!(io::copy(&mut reader, &mut t!(File::create(&path))));
+    t!(fs::set_permissions(&path, Permissions::from_mode(0o755)));
+}
+
+struct RemoveOnDrop<'a> {
+    inner: &'a Path,
+}
+
+impl<'a> Drop for RemoveOnDrop<'a> {
+    fn drop(&mut self) {
+        t!(fs::remove_dir_all(self.inner));
+    }
+}
+
+fn handle_run(socket: TcpStream, work: &Path, lock: &Mutex<()>) {
+    let mut arg = Vec::new();
+    let mut reader = BufReader::new(socket);
+
+    // Allocate ourselves a directory that we'll delete when we're done to save
+    // space.
+    let n = TEST.fetch_add(1, Ordering::SeqCst);
+    let path = work.join(format!("test{}", n));
+    let exe = path.join("exe");
+    t!(fs::create_dir(&path));
+    let _a = RemoveOnDrop { inner: &path };
+
+    // First up we'll get a list of arguments delimited with 0 bytes. An empty
+    // argument means that we're done.
+    let mut cmd = Command::new(&exe);
+    while t!(reader.read_until(0, &mut arg)) > 1 {
+        cmd.arg(t!(str::from_utf8(&arg[..arg.len() - 1])));
+        arg.truncate(0);
+    }
+
+    // Next we'll get a bunch of env vars in pairs delimited by 0s as well
+    arg.truncate(0);
+    while t!(reader.read_until(0, &mut arg)) > 1 {
+        let key_len = arg.len() - 1;
+        let val_len = t!(reader.read_until(0, &mut arg)) - 1;
+        {
+            let key = &arg[..key_len];
+            let val = &arg[key_len + 1..][..val_len];
+            let key = t!(str::from_utf8(key));
+            let val = t!(str::from_utf8(val));
+            cmd.env(key, val);
+        }
+        arg.truncate(0);
+    }
+
+    // The section of code from here down to where we drop the lock is going to
+    // be a critical section for us. On Linux you can't execute a file which is
+    // open somewhere for writing, as you'll receive the error "text file busy".
+    // Now here we never have the text file open for writing when we spawn it,
+    // so why do we still need a critical section?
+    //
+    // Process spawning first involves a `fork` on Unix, which clones all file
+    // descriptors into the child process. This means that it's possible for us
+    // to open the file for writing (as we're downloading it), then some other
+    // thread forks, then we close the file and try to exec. At that point the
+    // other thread created a child process with the file open for writing, and
+    // we attempt to execute it, so we get an error.
+    //
+    // This race is resolve by ensuring that only one thread can writ ethe file
+    // and spawn a child process at once. Kinda an unfortunate solution, but we
+    // don't have many other choices with this sort of setup!
+    //
+    // In any case the lock is acquired here, before we start writing any files.
+    // It's then dropped just after we spawn the child. That way we don't lock
+    // the execution of the child, just the creation of its files.
+    let lock = lock.lock();
+
+    // Next there's a list of dynamic libraries preceded by their filenames.
+    arg.truncate(0);
+    while t!(reader.read_until(0, &mut arg)) > 1 {
+        let dst = path.join(t!(str::from_utf8(&arg[..arg.len() - 1])));
+        let amt = read_u32(&mut reader) as u64;
+        t!(io::copy(&mut reader.by_ref().take(amt),
+                    &mut t!(File::create(&dst))));
+        t!(fs::set_permissions(&dst, Permissions::from_mode(0o755)));
+        arg.truncate(0);
+    }
+
+    // Finally we'll get the binary. The other end will tell us how big the
+    // binary is and then we'll download it all to the exe path we calculated
+    // earlier.
+    let amt = read_u32(&mut reader) as u64;
+    t!(io::copy(&mut reader.by_ref().take(amt),
+                &mut t!(File::create(&exe))));
+    t!(fs::set_permissions(&exe, Permissions::from_mode(0o755)));
+
+    // Support libraries were uploaded to `work` earlier, so make sure that's
+    // in `LD_LIBRARY_PATH`. Also include our own current dir which may have
+    // had some libs uploaded.
+    cmd.env("LD_LIBRARY_PATH",
+            format!("{}:{}", work.display(), path.display()));
+
+    // Spawn the child and ferry over stdout/stderr to the socket in a framed
+    // fashion (poor man's style)
+    let mut child = t!(cmd.stdin(Stdio::null())
+                          .stdout(Stdio::piped())
+                          .stderr(Stdio::piped())
+                          .spawn());
+    drop(lock);
+    let mut stdout = child.stdout.take().unwrap();
+    let mut stderr = child.stderr.take().unwrap();
+    let socket = Arc::new(Mutex::new(reader.into_inner()));
+    let socket2 = socket.clone();
+    let thread = thread::spawn(move || my_copy(&mut stdout, 0, &*socket2));
+    my_copy(&mut stderr, 1, &*socket);
+    thread.join().unwrap();
+
+    // Finally send over the exit status.
+    let status = t!(child.wait());
+    let (which, code) = match status.code() {
+        Some(n) => (0, n),
+        None => (1, status.signal().unwrap()),
+    };
+    t!(socket.lock().unwrap().write_all(&[
+        which,
+        (code >> 24) as u8,
+        (code >> 16) as u8,
+        (code >>  8) as u8,
+        (code >>  0) as u8,
+    ]));
+}
+
+fn my_copy(src: &mut Read, which: u8, dst: &Mutex<Write>) {
+    let mut b = [0; 1024];
+    loop {
+        let n = t!(src.read(&mut b));
+        let mut dst = dst.lock().unwrap();
+        t!(dst.write_all(&[
+            which,
+            (n >> 24) as u8,
+            (n >> 16) as u8,
+            (n >>  8) as u8,
+            (n >>  0) as u8,
+        ]));
+        if n > 0 {
+            t!(dst.write_all(&b[..n]));
+        } else {
+            break
+        }
+    }
+}
+
+fn read_u32(r: &mut Read) -> u32 {
+    let mut len = [0; 4];
+    t!(r.read_exact(&mut len));
+    ((len[0] as u32) << 24) |
+    ((len[1] as u32) << 16) |
+    ((len[2] as u32) <<  8) |
+    ((len[3] as u32) <<  0)
+}