]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #55758 - davidtwco:issue-55344, r=pnkfelix
authorMark Rousskov <mark.simulacrum@gmail.com>
Fri, 9 Nov 2018 01:15:10 +0000 (18:15 -0700)
committerGitHub <noreply@github.com>
Fri, 9 Nov 2018 01:15:10 +0000 (18:15 -0700)
[regression - rust2018]: unused_mut lint false positives on nightly

Fixes #55344.

This commit filters out locals that have never been initialized for
consideration in the `unused_mut` lint.

This is intended to detect when the statement that would have
initialized the local was removed as unreachable code. In these cases,
we would not want to lint. This is the same behaviour as the AST borrow
checker.

This is achieved by taking advantage of an existing pass over the MIR
for the `unused_mut` lint and creating a set of those locals that were
never initialized.

r? @pnkfelix

603 files changed:
src/bootstrap/configure.py
src/ci/docker/disabled/dist-powerpcspe-linux/Dockerfile [new file with mode: 0644]
src/ci/docker/dist-various-1/Dockerfile
src/etc/gdb_rust_pretty_printing.py
src/liballoc/lib.rs
src/liballoc/string.rs
src/libcore/alloc.rs
src/libcore/cell.rs
src/libpanic_unwind/dwarf/mod.rs
src/libpanic_unwind/seh64_gnu.rs
src/librustc/infer/error_reporting/mod.rs
src/librustc/infer/resolve.rs
src/librustc/infer/type_variable.rs
src/librustc/infer/unify_key.rs
src/librustc/middle/dead.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/stability.rs
src/librustc/mir/interpret/error.rs
src/librustc/mir/interpret/mod.rs
src/librustc/mir/interpret/value.rs
src/librustc/mir/mod.rs
src/librustc/mir/tcx.rs
src/librustc/session/config.rs
src/librustc/session/mod.rs
src/librustc/traits/auto_trait.rs
src/librustc/traits/fulfill.rs
src/librustc/traits/project.rs
src/librustc/traits/select.rs
src/librustc/traits/specialize/mod.rs
src/librustc/ty/_match.rs
src/librustc/ty/fold.rs
src/librustc/ty/query/on_disk_cache.rs
src/librustc_codegen_llvm/abi.rs
src/librustc_codegen_llvm/back/lto.rs
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/builder.rs
src/librustc_codegen_llvm/context.rs
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_llvm/llvm/ffi.rs
src/librustc_codegen_llvm/llvm/mod.rs
src/librustc_codegen_llvm/mir/analyze.rs
src/librustc_codegen_llvm/mir/block.rs
src/librustc_codegen_llvm/mir/operand.rs
src/librustc_codegen_utils/symbol_names_test.rs
src/librustc_data_structures/flock.rs
src/librustc_data_structures/obligation_forest/mod.rs
src/librustc_data_structures/obligation_forest/test.rs
src/librustc_data_structures/svh.rs
src/librustc_driver/lib.rs
src/librustc_lint/types.rs
src/librustc_metadata/encoder.rs
src/librustc_mir/borrow_check/borrow_set.rs
src/librustc_mir/build/scope.rs
src/librustc_mir/const_eval.rs
src/librustc_mir/dataflow/impls/borrowed_locals.rs
src/librustc_mir/dataflow/impls/storage_liveness.rs
src/librustc_mir/hair/pattern/check_match.rs
src/librustc_mir/hair/pattern/mod.rs
src/librustc_mir/interpret/eval_context.rs
src/librustc_mir/interpret/intrinsics.rs
src/librustc_mir/interpret/machine.rs
src/librustc_mir/interpret/memory.rs
src/librustc_mir/interpret/mod.rs
src/librustc_mir/interpret/operand.rs
src/librustc_mir/interpret/operator.rs
src/librustc_mir/interpret/place.rs
src/librustc_mir/interpret/validity.rs
src/librustc_mir/interpret/visitor.rs [new file with mode: 0644]
src/librustc_mir/monomorphize/partitioning.rs
src/librustc_mir/shim.rs
src/librustc_mir/transform/const_prop.rs
src/librustc_mir/transform/elaborate_drops.rs
src/librustc_mir/transform/inline.rs
src/librustc_mir/transform/simplify.rs
src/librustc_mir/transform/simplify_branches.rs
src/librustc_passes/ast_validation.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/librustc_save_analysis/json_dumper.rs
src/librustc_target/spec/linux_musl_base.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/method/mod.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/coherence/orphan.rs
src/librustc_typeck/coherence/unsafety.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/impl_wf_check.rs
src/librustdoc/clean/mod.rs
src/libstd/collections/hash/map.rs
src/libstd/fs.rs
src/libstd/io/util.rs
src/libstd/lib.rs
src/libstd/sync/mpsc/mod.rs
src/libstd/sys/cloudabi/time.rs
src/libstd/sys/redox/fd.rs
src/libstd/sys/redox/fs.rs
src/libstd/sys/redox/syscall/error.rs
src/libstd/sys/redox/thread.rs
src/libstd/sys/redox/time.rs
src/libstd/sys/unix/fd.rs
src/libstd/sys/unix/fs.rs
src/libstd/sys/unix/time.rs
src/libstd/sys/windows/process.rs
src/libstd/sys/windows/time.rs
src/libstd/sys_common/poison.rs
src/libstd/sys_common/wtf8.rs
src/libstd/thread/local.rs
src/libsyntax/attr/mod.rs
src/libsyntax/ext/source_util.rs
src/libsyntax/feature_gate.rs
src/libsyntax/fold.rs
src/libsyntax/parse/parser.rs
src/rustllvm/RustWrapper.cpp
src/stdsimd
src/test/codegen/packed.rs
src/test/codegen/stores.rs
src/test/debuginfo/vec-slices.rs
src/test/run-make/thumb-none-qemu/Makefile [new file with mode: 0644]
src/test/run-make/thumb-none-qemu/example/.cargo/config [new file with mode: 0644]
src/test/run-make/thumb-none-qemu/example/Cargo.toml [new file with mode: 0644]
src/test/run-make/thumb-none-qemu/example/memory.x [new file with mode: 0644]
src/test/run-make/thumb-none-qemu/example/src/main.rs [new file with mode: 0644]
src/test/run-make/thumb-none-qemu/script.sh [new file with mode: 0644]
src/test/run-make/wasm-symbols-not-imported/foo.rs
src/test/run-pass/optimization-fuel-0.rs
src/test/run-pass/optimization-fuel-0.stderr [new file with mode: 0644]
src/test/run-pass/optimization-fuel-0.stdout [deleted file]
src/test/run-pass/optimization-fuel-1.rs
src/test/run-pass/optimization-fuel-1.stderr [new file with mode: 0644]
src/test/run-pass/optimization-fuel-1.stdout [deleted file]
src/test/run-pass/thread-local-not-in-prelude.rs [new file with mode: 0644]
src/test/rustdoc/issue-54705.rs [new file with mode: 0644]
src/test/ui/asm/asm-bad-clobber.rs
src/test/ui/asm/asm-misplaced-option.rs
src/test/ui/asm/asm-misplaced-option.stderr
src/test/ui/associated-types/cache/chrono-scan.rs
src/test/ui/associated-types/cache/chrono-scan.stderr [deleted file]
src/test/ui/associated-types/cache/elision.rs
src/test/ui/associated-types/cache/elision.stderr [deleted file]
src/test/ui/bad/bad-lint-cap3.rs
src/test/ui/bad/bad-lint-cap3.stderr
src/test/ui/binop/binop-move-semantics.nll.stderr
src/test/ui/binop/binop-move-semantics.rs
src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr
src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs
src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr
src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-closures-mut-of-mut.rs [new file with mode: 0644]
src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-lend-flow-loop.ast.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr
src/test/ui/borrowck/borrowck-lend-flow-loop.rs
src/test/ui/borrowck/borrowck-lend-flow-loop.stderr [deleted file]
src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr
src/test/ui/borrowck/borrowck-overloaded-call.rs
src/test/ui/borrowck/borrowck-overloaded-call.stderr
src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr
src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs
src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr
src/test/ui/borrowck/borrowck-reborrow-from-mut.rs
src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr
src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr
src/test/ui/borrowck/borrowck-unboxed-closures.rs
src/test/ui/borrowck/borrowck-unboxed-closures.stderr
src/test/ui/codemap_tests/overlapping_spans.nll.stderr [deleted file]
src/test/ui/codemap_tests/overlapping_spans.rs [deleted file]
src/test/ui/codemap_tests/overlapping_spans.stderr [deleted file]
src/test/ui/coherence/coherence-impls-copy.stderr
src/test/ui/coherence/coherence-projection-ok-orphan.rs
src/test/ui/coherence/coherence-projection-ok-orphan.stderr [deleted file]
src/test/ui/coherence/coherence-projection-ok.rs
src/test/ui/coherence/coherence-projection-ok.stderr [deleted file]
src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs
src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.stderr [deleted file]
src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs
src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.stderr [deleted file]
src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs
src/test/ui/coherence/coherence_local.rs
src/test/ui/coherence/coherence_local.stderr [deleted file]
src/test/ui/coherence/coherence_local_err_struct.rs
src/test/ui/coherence/coherence_local_err_tuple.rs
src/test/ui/coherence/coherence_local_ref.rs
src/test/ui/coherence/coherence_local_ref.stderr [deleted file]
src/test/ui/conditional-compilation/cfg_attr_path.rs
src/test/ui/conditional-compilation/cfg_attr_path.stderr [deleted file]
src/test/ui/consts/const-eval/double_check2.stderr
src/test/ui/consts/const-eval/transmute-const.stderr
src/test/ui/consts/const-eval/ub-enum.rs
src/test/ui/consts/const-eval/ub-enum.stderr
src/test/ui/consts/const-eval/ub-nonnull.rs
src/test/ui/consts/const-eval/ub-nonnull.stderr
src/test/ui/consts/const-eval/ub-ref.rs
src/test/ui/consts/const-eval/ub-ref.stderr
src/test/ui/consts/const-eval/ub-uninhabit.rs
src/test/ui/consts/const-eval/ub-uninhabit.stderr
src/test/ui/consts/const-eval/ub-upvars.rs
src/test/ui/consts/const-eval/ub-upvars.stderr
src/test/ui/consts/const-eval/union-ub-fat-ptr.rs
src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr
src/test/ui/consts/const-eval/union-ub.rs
src/test/ui/consts/const-eval/union-ub.stderr
src/test/ui/consts/const-fn-stability-calls-3.rs
src/test/ui/consts/const-fn-stability-calls-3.stderr [deleted file]
src/test/ui/consts/dangling-alloc-id-ice.rs [new file with mode: 0644]
src/test/ui/consts/dangling-alloc-id-ice.stderr [new file with mode: 0644]
src/test/ui/consts/dangling_raw_ptr.rs [new file with mode: 0644]
src/test/ui/consts/dangling_raw_ptr.stderr [new file with mode: 0644]
src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr [new file with mode: 0644]
src/test/ui/dropck/dropck-eyepatch-extern-crate.rs
src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr [deleted file]
src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr [new file with mode: 0644]
src/test/ui/dropck/dropck-eyepatch-reorder.rs
src/test/ui/dropck/dropck-eyepatch-reorder.stderr [deleted file]
src/test/ui/dropck/dropck-eyepatch.ast.stderr [new file with mode: 0644]
src/test/ui/dropck/dropck-eyepatch.rs
src/test/ui/dropck/dropck-eyepatch.stderr [deleted file]
src/test/ui/e0119/issue-28981.stderr
src/test/ui/error-codes/E0004-2.stderr
src/test/ui/expanded-cfg.rs
src/test/ui/expanded-cfg.stderr [deleted file]
src/test/ui/extern/extern-const.fixed [new file with mode: 0644]
src/test/ui/extern/extern-const.rs
src/test/ui/extern/extern-const.stderr
src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs
src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr
src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs
src/test/ui/feature-gate/issue-43106-gating-of-deprecated.stderr [deleted file]
src/test/ui/feature-gates/feature-gate-allow_fail.stderr
src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr
src/test/ui/feature-gates/feature-gate-custom_attribute.rs
src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr
src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr
src/test/ui/feature-gates/feature-gate-nll.nll.stderr [deleted file]
src/test/ui/feature-gates/feature-gate-nll.rs
src/test/ui/feature-gates/feature-gate-panic-implementation.rs [deleted file]
src/test/ui/feature-gates/feature-gate-panic-implementation.stderr [deleted file]
src/test/ui/feature-gates/feature-gate-repr-simd.rs
src/test/ui/feature-gates/feature-gate-repr-simd.stderr
src/test/ui/feature-gates/feature-gate-repr_packed.rs
src/test/ui/feature-gates/feature-gate-repr_packed.stderr
src/test/ui/glob-cycles.rs
src/test/ui/glob-cycles.stderr [deleted file]
src/test/ui/hygiene/assoc_ty_bindings.rs
src/test/ui/hygiene/assoc_ty_bindings.stderr [deleted file]
src/test/ui/if/if-loop.rs
src/test/ui/if/if-loop.stderr [deleted file]
src/test/ui/impl-trait/issue-55608-captures-empty-region.rs [new file with mode: 0644]
src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr [new file with mode: 0644]
src/test/ui/imports/import-crate-var.rs
src/test/ui/imports/import-crate-var.stderr
src/test/ui/imports/issue-55457.rs [new file with mode: 0644]
src/test/ui/imports/issue-55457.stderr [new file with mode: 0644]
src/test/ui/issue-40827.rs [deleted file]
src/test/ui/issue-40827.stderr [deleted file]
src/test/ui/issue-49556.rs [deleted file]
src/test/ui/issue-51602.rs [deleted file]
src/test/ui/issue-51602.stderr [deleted file]
src/test/ui/issue-51947.rs [new file with mode: 0644]
src/test/ui/issue-52717.rs [deleted file]
src/test/ui/issue-52717.stderr [deleted file]
src/test/ui/issue-52992.rs [deleted file]
src/test/ui/issue-53251.rs [deleted file]
src/test/ui/issue-53251.stderr [deleted file]
src/test/ui/issue-53300.rs [deleted file]
src/test/ui/issue-53300.stderr [deleted file]
src/test/ui/issue-53419.rs [deleted file]
src/test/ui/issue-53565.rs [deleted file]
src/test/ui/issue-53565.stderr [deleted file]
src/test/ui/issue-53568.rs [deleted file]
src/test/ui/issue-53692.rs [deleted file]
src/test/ui/issue-53692.stderr [deleted file]
src/test/ui/issue-53840.rs [deleted file]
src/test/ui/issue-53840.stderr [deleted file]
src/test/ui/issue-54302-cases.rs [deleted file]
src/test/ui/issue-54302-cases.stderr [deleted file]
src/test/ui/issue-54302.rs [deleted file]
src/test/ui/issue-54302.stderr [deleted file]
src/test/ui/issues/auxiliary/issue-11680.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/issue-16725.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/issue-1920.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/issue-21202.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/issue-30123-aux.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/issue-41549.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/issue-5844-aux.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/issue_11680.rs [deleted file]
src/test/ui/issues/auxiliary/issue_16725.rs [deleted file]
src/test/ui/issues/auxiliary/issue_17718_const_privacy.rs [deleted file]
src/test/ui/issues/auxiliary/issue_1920.rs [deleted file]
src/test/ui/issues/auxiliary/issue_21202.rs [deleted file]
src/test/ui/issues/auxiliary/issue_30123_aux.rs [deleted file]
src/test/ui/issues/auxiliary/issue_41549.rs [deleted file]
src/test/ui/issues/auxiliary/issue_5844_aux.rs [deleted file]
src/test/ui/issues/auxiliary/lint-stability.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/lint_stability.rs [deleted file]
src/test/ui/issues/auxiliary/private-trait-xc.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/private_trait_xc.rs [deleted file]
src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/xcrate_issue_43189_a.rs [deleted file]
src/test/ui/issues/auxiliary/xcrate_issue_43189_b.rs [deleted file]
src/test/ui/issues/auxiliary/xcrate_issue_46112_rexport_core.rs [deleted file]
src/test/ui/issues/issue-11593.rs
src/test/ui/issues/issue-11680.rs
src/test/ui/issues/issue-11740.rs
src/test/ui/issues/issue-11740.stderr [deleted file]
src/test/ui/issues/issue-16725.rs
src/test/ui/issues/issue-16994.rs
src/test/ui/issues/issue-16994.stderr [deleted file]
src/test/ui/issues/issue-17263.ast.stderr [new file with mode: 0644]
src/test/ui/issues/issue-17263.nll.stderr
src/test/ui/issues/issue-17263.rs
src/test/ui/issues/issue-17263.stderr [deleted file]
src/test/ui/issues/issue-17718-const-privacy.rs
src/test/ui/issues/issue-1920-1.rs
src/test/ui/issues/issue-1920-2.rs
src/test/ui/issues/issue-1920-3.rs
src/test/ui/issues/issue-19601.rs
src/test/ui/issues/issue-19601.stderr [deleted file]
src/test/ui/issues/issue-21202.rs
src/test/ui/issues/issue-22603.rs
src/test/ui/issues/issue-22603.stderr [deleted file]
src/test/ui/issues/issue-22789.rs
src/test/ui/issues/issue-22789.stderr [deleted file]
src/test/ui/issues/issue-22933-1.rs
src/test/ui/issues/issue-22933-1.stderr [deleted file]
src/test/ui/issues/issue-24883.rs
src/test/ui/issues/issue-24883.stderr [deleted file]
src/test/ui/issues/issue-26614.rs
src/test/ui/issues/issue-26614.stderr [deleted file]
src/test/ui/issues/issue-26930.rs
src/test/ui/issues/issue-26930.stderr [deleted file]
src/test/ui/issues/issue-28075.rs
src/test/ui/issues/issue-28388-3.rs
src/test/ui/issues/issue-29857.rs
src/test/ui/issues/issue-29857.stderr [deleted file]
src/test/ui/issues/issue-30123.rs
src/test/ui/issues/issue-3096-1.stderr
src/test/ui/issues/issue-3096-2.stderr
src/test/ui/issues/issue-31076.rs [new file with mode: 0644]
src/test/ui/issues/issue-31076.stderr [new file with mode: 0644]
src/test/ui/issues/issue-31924-non-snake-ffi.rs
src/test/ui/issues/issue-31924-non-snake-ffi.stderr [deleted file]
src/test/ui/issues/issue-32119.rs
src/test/ui/issues/issue-32119.stderr [deleted file]
src/test/ui/issues/issue-32222.rs
src/test/ui/issues/issue-32222.stderr [deleted file]
src/test/ui/issues/issue-32797.rs
src/test/ui/issues/issue-32797.stderr [deleted file]
src/test/ui/issues/issue-32829-2.rs [new file with mode: 0644]
src/test/ui/issues/issue-32829-2.stderr [new file with mode: 0644]
src/test/ui/issues/issue-32922.rs
src/test/ui/issues/issue-32922.stderr [deleted file]
src/test/ui/issues/issue-33241.rs
src/test/ui/issues/issue-33241.stderr [deleted file]
src/test/ui/issues/issue-34028.rs
src/test/ui/issues/issue-34028.stderr [deleted file]
src/test/ui/issues/issue-34171.rs
src/test/ui/issues/issue-34171.stderr [deleted file]
src/test/ui/issues/issue-34418.rs
src/test/ui/issues/issue-34418.stderr [deleted file]
src/test/ui/issues/issue-34839.rs
src/test/ui/issues/issue-34839.stderr [deleted file]
src/test/ui/issues/issue-35570.rs
src/test/ui/issues/issue-35570.stderr [deleted file]
src/test/ui/issues/issue-36116.rs
src/test/ui/issues/issue-36116.stderr
src/test/ui/issues/issue-36379.rs
src/test/ui/issues/issue-36379.stderr [deleted file]
src/test/ui/issues/issue-36839.rs
src/test/ui/issues/issue-36839.stderr [deleted file]
src/test/ui/issues/issue-37051.rs
src/test/ui/issues/issue-37051.stderr [deleted file]
src/test/ui/issues/issue-37366.rs
src/test/ui/issues/issue-37366.stderr [deleted file]
src/test/ui/issues/issue-37510.rs
src/test/ui/issues/issue-37510.stderr [deleted file]
src/test/ui/issues/issue-37515.rs
src/test/ui/issues/issue-37515.stderr
src/test/ui/issues/issue-38160.rs
src/test/ui/issues/issue-38160.stderr [deleted file]
src/test/ui/issues/issue-38381.rs
src/test/ui/issues/issue-38381.stderr [deleted file]
src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs [new file with mode: 0644]
src/test/ui/issues/issue-38875/auxiliary/issue_38875_b.rs [deleted file]
src/test/ui/issues/issue-38875/issue-38875.rs [new file with mode: 0644]
src/test/ui/issues/issue-38875/issue_38875.rs [deleted file]
src/test/ui/issues/issue-40350.rs
src/test/ui/issues/issue-40350.stderr [deleted file]
src/test/ui/issues/issue-40510-1.nll.stderr
src/test/ui/issues/issue-40510-1.rs
src/test/ui/issues/issue-40510-1.stderr [deleted file]
src/test/ui/issues/issue-40510-2.rs
src/test/ui/issues/issue-40510-2.stderr [deleted file]
src/test/ui/issues/issue-40510-3.nll.stderr
src/test/ui/issues/issue-40510-3.rs
src/test/ui/issues/issue-40510-3.stderr [deleted file]
src/test/ui/issues/issue-40510-4.rs
src/test/ui/issues/issue-40510-4.stderr [deleted file]
src/test/ui/issues/issue-40827.rs [new file with mode: 0644]
src/test/ui/issues/issue-40827.stderr [new file with mode: 0644]
src/test/ui/issues/issue-41549.rs
src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs [new file with mode: 0644]
src/test/ui/issues/issue-41652/auxiliary/issue_41652_b.rs [deleted file]
src/test/ui/issues/issue-41652/issue-41652.rs [new file with mode: 0644]
src/test/ui/issues/issue-41652/issue-41652.stderr [new file with mode: 0644]
src/test/ui/issues/issue-41652/issue_41652.rs [deleted file]
src/test/ui/issues/issue-41652/issue_41652.stderr [deleted file]
src/test/ui/issues/issue-41998.rs
src/test/ui/issues/issue-41998.stderr [deleted file]
src/test/ui/issues/issue-43189.rs
src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs [new file with mode: 0644]
src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs [new file with mode: 0644]
src/test/ui/issues/issue-45829/auxiliary/issue_45829_a.rs [deleted file]
src/test/ui/issues/issue-45829/auxiliary/issue_45829_b.rs [deleted file]
src/test/ui/issues/issue-45829/rename-extern-vs-use.rs
src/test/ui/issues/issue-45829/rename-extern-with-tab.rs
src/test/ui/issues/issue-45829/rename-extern.rs
src/test/ui/issues/issue-45829/rename-use-vs-extern.rs
src/test/ui/issues/issue-46112.rs
src/test/ui/issues/issue-49556.rs [new file with mode: 0644]
src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs [new file with mode: 0644]
src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr [new file with mode: 0644]
src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.rs [deleted file]
src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr [deleted file]
src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs [new file with mode: 0644]
src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr [new file with mode: 0644]
src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs [new file with mode: 0644]
src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr [new file with mode: 0644]
src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs [new file with mode: 0644]
src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr [new file with mode: 0644]
src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.rs [deleted file]
src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr [deleted file]
src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.rs [deleted file]
src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr [deleted file]
src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.rs [deleted file]
src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr [deleted file]
src/test/ui/issues/issue-51602.rs [new file with mode: 0644]
src/test/ui/issues/issue-51602.stderr [new file with mode: 0644]
src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr
src/test/ui/issues/issue-52126-assign-op-invariance.rs
src/test/ui/issues/issue-52717.rs [new file with mode: 0644]
src/test/ui/issues/issue-52717.stderr [new file with mode: 0644]
src/test/ui/issues/issue-52992.rs [new file with mode: 0644]
src/test/ui/issues/issue-53251.rs [new file with mode: 0644]
src/test/ui/issues/issue-53251.stderr [new file with mode: 0644]
src/test/ui/issues/issue-53300.rs [new file with mode: 0644]
src/test/ui/issues/issue-53300.stderr [new file with mode: 0644]
src/test/ui/issues/issue-53419.rs [new file with mode: 0644]
src/test/ui/issues/issue-53565.rs [new file with mode: 0644]
src/test/ui/issues/issue-53565.stderr [new file with mode: 0644]
src/test/ui/issues/issue-53568.rs [new file with mode: 0644]
src/test/ui/issues/issue-53692.rs [new file with mode: 0644]
src/test/ui/issues/issue-53692.stderr [new file with mode: 0644]
src/test/ui/issues/issue-53840.rs [new file with mode: 0644]
src/test/ui/issues/issue-53840.stderr [new file with mode: 0644]
src/test/ui/issues/issue-54302-cases.rs [new file with mode: 0644]
src/test/ui/issues/issue-54302-cases.stderr [new file with mode: 0644]
src/test/ui/issues/issue-54302.rs [new file with mode: 0644]
src/test/ui/issues/issue-54302.stderr [new file with mode: 0644]
src/test/ui/issues/issue-5844.rs
src/test/ui/issues/issue32829.rs [deleted file]
src/test/ui/issues/issue32829.stderr [deleted file]
src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.rs [new file with mode: 0644]
src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs
src/test/ui/lint/lint-output-format-2.rs
src/test/ui/lint/lint-output-format-2.stderr
src/test/ui/lint/lint-stability-deprecated.rs
src/test/ui/lint/lint-stability-deprecated.stderr
src/test/ui/lint/lint-type-overflow2.rs
src/test/ui/lint/lint-type-overflow2.stderr
src/test/ui/lint/lint-unknown-feature-default.rs
src/test/ui/lint/lint-unknown-feature-default.stderr [deleted file]
src/test/ui/lint/lint-unknown-feature.rs
src/test/ui/lint/lint-unknown-feature.stderr [deleted file]
src/test/ui/loops/loops-reject-duplicate-labels-2.rs
src/test/ui/loops/loops-reject-duplicate-labels-2.stderr
src/test/ui/loops/loops-reject-duplicate-labels.rs
src/test/ui/loops/loops-reject-duplicate-labels.stderr
src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs
src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr
src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs
src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr
src/test/ui/macros/macro-expanded-include/test.rs
src/test/ui/macros/macro-expanded-include/test.stderr [deleted file]
src/test/ui/macros/macro-stmt-matchers.rs
src/test/ui/macros/macro-stmt-matchers.stderr [deleted file]
src/test/ui/macros/macro-tt-matchers.rs
src/test/ui/macros/macro-tt-matchers.stderr [deleted file]
src/test/ui/macros/macro-use-scope.rs
src/test/ui/macros/macro-use-scope.stderr [deleted file]
src/test/ui/match/match-fn-call.rs [new file with mode: 0644]
src/test/ui/match/match-fn-call.stderr [new file with mode: 0644]
src/test/ui/maybe-bounds-where-cpass.rs
src/test/ui/maybe-bounds-where-cpass.stderr [deleted file]
src/test/ui/methods/method-call-lifetime-args-subst-index.rs
src/test/ui/methods/method-call-lifetime-args-subst-index.stderr [deleted file]
src/test/ui/missing/missing-semicolon-warning.rs
src/test/ui/missing/missing-semicolon-warning.stderr
src/test/ui/never-assign-dead-code.rs
src/test/ui/never-assign-dead-code.stderr
src/test/ui/no-warn-on-field-replace-issue-34101.rs
src/test/ui/no-warn-on-field-replace-issue-34101.stderr [deleted file]
src/test/ui/object-safety/object-safety-by-value-self.rs
src/test/ui/object-safety/object-safety-by-value-self.stderr [deleted file]
src/test/ui/object-safety/object-safety-phantom-fn.rs
src/test/ui/object-safety/object-safety-phantom-fn.stderr [deleted file]
src/test/ui/on-unimplemented/multiple-impls.rs
src/test/ui/on-unimplemented/on-impl.rs
src/test/ui/on-unimplemented/slice-index.rs
src/test/ui/panic-implementation/panic-implementation-deprecated.rs [deleted file]
src/test/ui/panic-implementation/panic-implementation-deprecated.stderr [deleted file]
src/test/ui/print-fuel/print-fuel.rs
src/test/ui/print-fuel/print-fuel.stderr [new file with mode: 0644]
src/test/ui/print-fuel/print-fuel.stdout [deleted file]
src/test/ui/privacy/restricted/lookup-ignores-private.rs
src/test/ui/privacy/restricted/lookup-ignores-private.stderr [deleted file]
src/test/ui/range/range_traits-4.rs
src/test/ui/range/range_traits-4.stderr [deleted file]
src/test/ui/range/range_traits-5.rs
src/test/ui/range/range_traits-5.stderr [deleted file]
src/test/ui/range/range_traits-7.rs
src/test/ui/range/range_traits-7.stderr [deleted file]
src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.rs
src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.stderr [deleted file]
src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.rs
src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.stderr [deleted file]
src/test/ui/regions/region-object-lifetime-1.rs
src/test/ui/regions/region-object-lifetime-1.stderr [deleted file]
src/test/ui/regions/region-object-lifetime-3.rs
src/test/ui/regions/region-object-lifetime-3.stderr [deleted file]
src/test/ui/regions/regions-implied-bounds-projection-gap-2.rs
src/test/ui/regions/regions-implied-bounds-projection-gap-2.stderr [deleted file]
src/test/ui/regions/regions-implied-bounds-projection-gap-3.rs
src/test/ui/regions/regions-implied-bounds-projection-gap-3.stderr [deleted file]
src/test/ui/regions/regions-implied-bounds-projection-gap-4.rs
src/test/ui/regions/regions-implied-bounds-projection-gap-4.stderr [deleted file]
src/test/ui/regions/regions-outlives-projection-container-hrtb.rs
src/test/ui/regions/regions-outlives-projection-hrtype.rs
src/test/ui/regions/regions-outlives-projection-hrtype.stderr [deleted file]
src/test/ui/regions/regions-outlives-projection-trait-def.rs
src/test/ui/regions/regions-outlives-projection-trait-def.stderr [deleted file]
src/test/ui/regions/regions-outlives-scalar.rs
src/test/ui/regions/regions-outlives-scalar.stderr [deleted file]
src/test/ui/retslot-cast.rs
src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.rs
src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.rs
src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.rs
src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.rs
src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr
src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs
src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
src/test/ui/span/issue-24690.rs
src/test/ui/span/issue-24690.stderr
src/test/ui/traits/trait-privacy.rs
src/test/ui/traits/trait-privacy.stderr [deleted file]
src/test/ui/traits/traits-issue-23003-overflow.rs
src/test/ui/traits/traits-issue-23003-overflow.stderr [deleted file]
src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr
src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr
src/test/ui/union/union-borrow-move-parent-sibling.rs
src/test/ui/union/union-borrow-move-parent-sibling.stderr
src/test/ui/unop-move-semantics.nll.stderr
src/test/ui/unop-move-semantics.rs
src/test/ui/unreachable/unreachable-try-pattern.rs
src/test/ui/unreachable/unreachable-try-pattern.stderr
src/test/ui/variance/variance-btree-invariant-types.rs
src/test/ui/variance/variance-use-contravariant-struct-1.rs
src/test/ui/variance/variance-use-contravariant-struct-2.rs
src/test/ui/variance/variance-use-contravariant-struct-2.stderr [deleted file]
src/test/ui/variance/variance-use-covariant-struct-2.rs
src/test/ui/variance/variance-use-covariant-struct-2.stderr [deleted file]
src/test/ui/variance/variance-use-invariant-struct-1.rs
src/test/ui/wf/wf-array-elem-sized.rs
src/test/ui/wf/wf-const-type.rs
src/test/ui/wf/wf-enum-bound.rs
src/test/ui/wf/wf-enum-fields-struct-variant.rs
src/test/ui/wf/wf-enum-fields.rs
src/test/ui/wf/wf-fn-where-clause.rs
src/test/ui/wf/wf-impl-associated-type-region.rs
src/test/ui/wf/wf-impl-associated-type-trait.rs
src/test/ui/wf/wf-in-fn-type-static.rs
src/test/ui/wf/wf-in-fn-where-clause.rs
src/test/ui/wf/wf-in-obj-type-static.rs
src/test/ui/wf/wf-inherent-impl-method-where-clause.rs
src/test/ui/wf/wf-inherent-impl-where-clause.rs
src/test/ui/wf/wf-static-type.rs
src/test/ui/wf/wf-struct-bound.rs
src/test/ui/wf/wf-struct-field.rs
src/test/ui/wf/wf-trait-associated-type-bound.rs
src/test/ui/wf/wf-trait-associated-type-region.rs
src/test/ui/wf/wf-trait-associated-type-trait.rs
src/test/ui/wf/wf-trait-bound.rs
src/test/ui/wf/wf-trait-default-fn-arg.rs
src/test/ui/wf/wf-trait-default-fn-where-clause.rs
src/test/ui/wf/wf-trait-fn-where-clause.rs
src/tools/build-manifest/src/main.rs
src/tools/lldb

index c58fe881c8a62633c4d5124f62bb101508dae242..5467c9f9d5bf914499deaefcbfa4913c393cdaf5 100755 (executable)
@@ -40,7 +40,7 @@ def v(*args):
     options.append(Option(*args, value=True))
 
 
-o("debug", "rust.debug", "debug mode; disables optimization unless `--enable-optimize` given")
+o("debug", "rust.debug", "enables debugging environment; does not affect optimization of bootstrapped code (use `--disable-optimize` for that)")
 o("docs", "build.docs", "build standard library documentation")
 o("compiler-docs", "build.compiler-docs", "build compiler documentation")
 o("optimize-tests", "rust.optimize-tests", "build tests with optimizations")
diff --git a/src/ci/docker/disabled/dist-powerpcspe-linux/Dockerfile b/src/ci/docker/disabled/dist-powerpcspe-linux/Dockerfile
new file mode 100644 (file)
index 0000000..3227819
--- /dev/null
@@ -0,0 +1,26 @@
+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 \
+  g++-powerpc-linux-gnuspe \
+  libssl-dev \
+  pkg-config
+
+
+COPY scripts/sccache.sh /scripts/
+RUN sh /scripts/sccache.sh
+
+ENV HOSTS=powerpc-unknown-linux-gnuspe
+
+ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
+ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
index e2484b7224b26fb96decc794a86464ee6fb3a495..c7e6af28f9d4fbb385c4d8f21394eea12f492ac8 100644 (file)
@@ -22,7 +22,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
   libssl-dev \
   pkg-config \
   gcc-arm-none-eabi \
-  libnewlib-arm-none-eabi
+  libnewlib-arm-none-eabi \
+  qemu-system-arm
 
 WORKDIR /build
 
index b1252f386df364dcd18708dc5bc6139fe465e0dd..e6d5ef1a23ff786890e14b28c81029ff1ce20ea6 100755 (executable)
@@ -9,7 +9,6 @@
 # except according to those terms.
 
 import gdb
-import re
 import sys
 import debugger_pretty_printers_common as rustpp
 
index ad6e594c884af9674c7311ffcd0200bac1fd79da..abacc62c8562b0e594477a96904b292cfd7518a6 100644 (file)
 #![feature(const_vec_new)]
 #![feature(slice_partition_dedup)]
 #![feature(maybe_uninit)]
+#![feature(alloc_layout_extra)]
 
 // Allow testing this library
 
index ff3587d5d87306af60550c20f71c5d24325ba626..5c776292f53d7a86a49f0c1dcedf80d4dd261097 100644 (file)
@@ -502,7 +502,7 @@ pub fn from_str(_: &str) -> String {
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error> {
         match str::from_utf8(&vec) {
-            Ok(..) => Ok(String { vec: vec }),
+            Ok(..) => Ok(String { vec }),
             Err(e) => {
                 Err(FromUtf8Error {
                     bytes: vec,
index 4efcaae59b012ce1a192c4a51379d8d9a0c20c53..113a85abecbef4613163b79d0056cde77513faf8 100644 (file)
@@ -164,15 +164,13 @@ pub fn for_value<T: ?Sized>(t: &T) -> Self {
     /// alignment. In other words, if `K` has size 16, `K.align_to(32)`
     /// will *still* have size 16.
     ///
-    /// # Panics
-    ///
-    /// Panics if the combination of `self.size()` and the given `align`
-    /// violates the conditions listed in
+    /// Returns an error if the combination of `self.size()` and the given
+    /// `align` violates the conditions listed in
     /// [`Layout::from_size_align`](#method.from_size_align).
-    #[unstable(feature = "allocator_api", issue = "32838")]
+    #[unstable(feature = "alloc_layout_extra", issue = "55724")]
     #[inline]
-    pub fn align_to(&self, align: usize) -> Self {
-        Layout::from_size_align(self.size(), cmp::max(self.align(), align)).unwrap()
+    pub fn align_to(&self, align: usize) -> Result<Self, LayoutErr> {
+        Layout::from_size_align(self.size(), cmp::max(self.align(), align))
     }
 
     /// Returns the amount of padding we must insert after `self`
@@ -191,7 +189,7 @@ pub fn align_to(&self, align: usize) -> Self {
     /// to be less than or equal to the alignment of the starting
     /// address for the whole allocated block of memory. One way to
     /// satisfy this constraint is to ensure `align <= self.align()`.
-    #[unstable(feature = "allocator_api", issue = "32838")]
+    #[unstable(feature = "alloc_layout_extra", issue = "55724")]
     #[inline]
     pub fn padding_needed_for(&self, align: usize) -> usize {
         let len = self.size();
@@ -228,7 +226,7 @@ pub fn padding_needed_for(&self, align: usize) -> usize {
     /// of each element in the array.
     ///
     /// On arithmetic overflow, returns `LayoutErr`.
-    #[unstable(feature = "allocator_api", issue = "32838")]
+    #[unstable(feature = "alloc_layout_extra", issue = "55724")]
     #[inline]
     pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutErr> {
         let padded_size = self.size().checked_add(self.padding_needed_for(self.align()))
@@ -248,13 +246,16 @@ pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutErr> {
     /// will be properly aligned. Note that the result layout will
     /// satisfy the alignment properties of both `self` and `next`.
     ///
+    /// The resulting layout will be the same as that of a C struct containing
+    /// two fields with the layouts of `self` and `next`, in that order.
+    ///
     /// Returns `Some((k, offset))`, where `k` is layout of the concatenated
     /// record and `offset` is the relative location, in bytes, of the
     /// start of the `next` embedded within the concatenated record
     /// (assuming that the record itself starts at offset 0).
     ///
     /// On arithmetic overflow, returns `LayoutErr`.
-    #[unstable(feature = "allocator_api", issue = "32838")]
+    #[unstable(feature = "alloc_layout_extra", issue = "55724")]
     #[inline]
     pub fn extend(&self, next: Self) -> Result<(Self, usize), LayoutErr> {
         let new_align = cmp::max(self.align(), next.align());
@@ -281,7 +282,7 @@ pub fn extend(&self, next: Self) -> Result<(Self, usize), LayoutErr> {
     /// aligned.
     ///
     /// On arithmetic overflow, returns `LayoutErr`.
-    #[unstable(feature = "allocator_api", issue = "32838")]
+    #[unstable(feature = "alloc_layout_extra", issue = "55724")]
     #[inline]
     pub fn repeat_packed(&self, n: usize) -> Result<Self, LayoutErr> {
         let size = self.size().checked_mul(n).ok_or(LayoutErr { private: () })?;
@@ -293,29 +294,20 @@ pub fn repeat_packed(&self, n: usize) -> Result<Self, LayoutErr> {
     /// padding is inserted, the alignment of `next` is irrelevant,
     /// and is not incorporated *at all* into the resulting layout.
     ///
-    /// Returns `(k, offset)`, where `k` is layout of the concatenated
-    /// record and `offset` is the relative location, in bytes, of the
-    /// start of the `next` embedded within the concatenated record
-    /// (assuming that the record itself starts at offset 0).
-    ///
-    /// (The `offset` is always the same as `self.size()`; we use this
-    ///  signature out of convenience in matching the signature of
-    ///  `extend`.)
-    ///
     /// On arithmetic overflow, returns `LayoutErr`.
-    #[unstable(feature = "allocator_api", issue = "32838")]
+    #[unstable(feature = "alloc_layout_extra", issue = "55724")]
     #[inline]
-    pub fn extend_packed(&self, next: Self) -> Result<(Self, usize), LayoutErr> {
+    pub fn extend_packed(&self, next: Self) -> Result<Self, LayoutErr> {
         let new_size = self.size().checked_add(next.size())
             .ok_or(LayoutErr { private: () })?;
         let layout = Layout::from_size_align(new_size, self.align())?;
-        Ok((layout, self.size()))
+        Ok(layout)
     }
 
     /// Creates a layout describing the record for a `[T; n]`.
     ///
     /// On arithmetic overflow, returns `LayoutErr`.
-    #[unstable(feature = "allocator_api", issue = "32838")]
+    #[unstable(feature = "alloc_layout_extra", issue = "55724")]
     #[inline]
     pub fn array<T>(n: usize) -> Result<Self, LayoutErr> {
         Layout::new::<T>()
index ec7d366c3f5ce90fbd24cb2d3be6af7a2d352feb..689cf319bd750bd1c710e135c4ee0bd2f54d157d 100644 (file)
 ///
 /// # Examples
 ///
-/// Here you can see how using `Cell<T>` allows to use mutable field inside
-/// immutable struct (which is also called 'interior mutability').
+/// In this example, you can see that `Cell<T>` enables mutation inside an
+/// immutable struct. In other words, it enables "interior mutability".
 ///
 /// ```
 /// use std::cell::Cell;
 ///
 /// let new_value = 100;
 ///
-/// // ERROR, because my_struct is immutable
+/// // ERROR: `my_struct` is immutable
 /// // my_struct.regular_field = new_value;
 ///
-/// // WORKS, although `my_struct` is immutable, field `special_field` is mutable because it is Cell
+/// // WORKS: although `my_struct` is immutable, `special_field` is a `Cell`,
+/// // which can always be mutated
 /// my_struct.special_field.set(new_value);
 /// assert_eq!(my_struct.special_field.get(), new_value);
 /// ```
index 7e0c32fe03d8a57a43f5d7b17e8264e646fdbc88..3ff250ff6592bdbb717ab98c273b7b20d94e1a48 100644 (file)
@@ -29,7 +29,7 @@ pub struct DwarfReader {
 
 impl DwarfReader {
     pub fn new(ptr: *const u8) -> DwarfReader {
-        DwarfReader { ptr: ptr }
+        DwarfReader { ptr }
     }
 
     // DWARF streams are packed, so e.g. a u32 would not necessarily be aligned
index c2074db00385b8367c823eb44d3ba4365d65b1c0..60e9829ef9eaffdef851e06fe30ebace8353b5a5 100644 (file)
@@ -41,7 +41,7 @@ struct PanicData {
 }
 
 pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
-    let panic_ctx = Box::new(PanicData { data: data });
+    let panic_ctx = Box::new(PanicData { data });
     let params = [Box::into_raw(panic_ctx) as c::ULONG_PTR];
     c::RaiseException(RUST_PANIC,
                       c::EXCEPTION_NONCONTINUABLE,
index 1963d366e7a66d5d5daa5ba3111852663416bd6c..f833ebc7ca763ec9ffab99f78e997de8249f35cc 100644 (file)
@@ -178,6 +178,7 @@ fn msg_span_from_free_region(self, region: ty::Region<'tcx>) -> (String, Option<
                 self.msg_span_from_early_bound_and_free_regions(region)
             }
             ty::ReStatic => ("the static lifetime".to_owned(), None),
+            ty::ReEmpty => ("an empty lifetime".to_owned(), None),
             _ => bug!("{:?}", region),
         }
     }
index 0ef97618572640f4ac5e1003963d1a3e56c7971b..a0c310ac2761e1fbf869fc57bb29764d8a2915ff 100644 (file)
@@ -26,7 +26,7 @@ pub struct OpportunisticTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
 
 impl<'a, 'gcx, 'tcx> OpportunisticTypeResolver<'a, 'gcx, 'tcx> {
     pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
-        OpportunisticTypeResolver { infcx: infcx }
+        OpportunisticTypeResolver { infcx }
     }
 }
 
@@ -54,7 +54,7 @@ pub struct OpportunisticTypeAndRegionResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
 
 impl<'a, 'gcx, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> {
     pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
-        OpportunisticTypeAndRegionResolver { infcx: infcx }
+        OpportunisticTypeAndRegionResolver { infcx }
     }
 }
 
index 970b6e096ffe4d04370e482d43e079e29daa214e..39bf59a7a4ec5d31e5240fd12a4f9eb0c554f403 100644 (file)
@@ -169,7 +169,7 @@ pub fn instantiate(&mut self, vid: ty::TyVid, ty: Ty<'tcx>) {
         // Hack: we only need this so that `types_escaping_snapshot`
         // can see what has been unified; see the Delegate impl for
         // more details.
-        self.values.record(Instantiate { vid: vid });
+        self.values.record(Instantiate { vid });
     }
 
     /// Creates a new type variable.
index cdc92877a5ae82e0596f6b256af74e78136852fb..f8001e085c469e4c3b74f62655f434584177e381 100644 (file)
@@ -43,7 +43,7 @@ fn unify_values(value1: &Self, value2: &Self) -> Result<Self, NoError> {
             value2.min_vid
         };
 
-        Ok(RegionVidKey { min_vid: min_vid })
+        Ok(RegionVidKey { min_vid })
     }
 }
 
index dc5f736172503be4805b680731c79dd72105aac1..c5bcfd48cf39a5dbcc46fc2b527f0900031acf70 100644 (file)
@@ -291,10 +291,8 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
         return true;
     }
 
-    // (To be) stable attribute for #[lang = "panic_impl"]
-    if attr::contains_name(attrs, "panic_implementation") ||
-        attr::contains_name(attrs, "panic_handler")
-    {
+    // Stable attribute for #[lang = "panic_impl"]
+    if attr::contains_name(attrs, "panic_handler") {
         return true;
     }
 
index cce8081daf28e5b397cd3edb7350e0f1b2309c6b..55ffa50e7c896b0600390f434b4c8599d2a62083 100644 (file)
@@ -204,9 +204,7 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
             if let Some(value) = attribute.value_str() {
                 return Some((value, attribute.span));
             }
-        } else if attribute.check_name("panic_implementation") ||
-            attribute.check_name("panic_handler")
-        {
+        } else if attribute.check_name("panic_handler") {
             return Some((Symbol::intern("panic_impl"), attribute.span))
         } else if attribute.check_name("alloc_error_handler") {
             return Some((Symbol::intern("oom"), attribute.span))
index ec8e7d060587f450821f45c82be5f976cb9ff577..5d456481896b6bdc8596ad624b653c634ab39372 100644 (file)
@@ -469,7 +469,7 @@ pub fn local_deprecation_entry(&self, id: HirId) -> Option<DeprecationEntry> {
 /// Cross-references the feature names of unstable APIs with enabled
 /// features and possibly prints errors.
 pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    let mut checker = Checker { tcx: tcx };
+    let mut checker = Checker { tcx };
     tcx.hir.krate().visit_all_item_likes(&mut checker.as_deep_visitor());
 }
 
index 8e025f0d029b72f41237e1b1a5f6a6133c3fbd54..f28aa41ed42221a22053b389bd9cbdc429309312 100644 (file)
@@ -15,7 +15,7 @@
 use ty::layout::{Size, Align, LayoutError};
 use rustc_target::spec::abi::Abi;
 
-use super::Pointer;
+use super::{Pointer, Scalar};
 
 use backtrace::Backtrace;
 
@@ -240,7 +240,7 @@ pub enum EvalErrorKind<'tcx, O> {
     InvalidMemoryAccess,
     InvalidFunctionPointer,
     InvalidBool,
-    InvalidDiscriminant(u128),
+    InvalidDiscriminant(Scalar),
     PointerOutOfBounds {
         ptr: Pointer,
         access: bool,
index f8a5dbc6905ca9be31429b042d183fe26926a95e..e2abf7970d6d821fe9808ac3b2cf4b120fd22eb8 100644 (file)
@@ -91,42 +91,43 @@ fn pointer_size(&self) -> Size {
     }
 
     //// Trunace the given value to the pointer size; also return whether there was an overflow
+    #[inline]
     fn truncate_to_ptr(&self, val: u128) -> (u64, bool) {
         let max_ptr_plus_1 = 1u128 << self.pointer_size().bits();
         ((val % max_ptr_plus_1) as u64, val >= max_ptr_plus_1)
     }
 
-    // Overflow checking only works properly on the range from -u64 to +u64.
-    fn overflowing_signed_offset(&self, val: u64, i: i128) -> (u64, bool) {
-        // FIXME: is it possible to over/underflow here?
-        if i < 0 {
-            // trickery to ensure that i64::min_value() works fine
-            // this formula only works for true negative values, it panics for zero!
-            let n = u64::max_value() - (i as u64) + 1;
-            val.overflowing_sub(n)
-        } else {
-            self.overflowing_offset(val, i as u64)
-        }
+    #[inline]
+    fn offset<'tcx>(&self, val: u64, i: u64) -> EvalResult<'tcx, u64> {
+        let (res, over) = self.overflowing_offset(val, i);
+        if over { err!(Overflow(mir::BinOp::Add)) } else { Ok(res) }
     }
 
+    #[inline]
     fn overflowing_offset(&self, val: u64, i: u64) -> (u64, bool) {
         let (res, over1) = val.overflowing_add(i);
-        let (res, over2) = self.truncate_to_ptr(res as u128);
+        let (res, over2) = self.truncate_to_ptr(u128::from(res));
         (res, over1 || over2)
     }
 
+    #[inline]
     fn signed_offset<'tcx>(&self, val: u64, i: i64) -> EvalResult<'tcx, u64> {
-        let (res, over) = self.overflowing_signed_offset(val, i as i128);
+        let (res, over) = self.overflowing_signed_offset(val, i128::from(i));
         if over { err!(Overflow(mir::BinOp::Add)) } else { Ok(res) }
     }
 
-    fn offset<'tcx>(&self, val: u64, i: u64) -> EvalResult<'tcx, u64> {
-        let (res, over) = self.overflowing_offset(val, i);
-        if over { err!(Overflow(mir::BinOp::Add)) } else { Ok(res) }
-    }
-
-    fn wrapping_signed_offset(&self, val: u64, i: i64) -> u64 {
-        self.overflowing_signed_offset(val, i as i128).0
+    // Overflow checking only works properly on the range from -u64 to +u64.
+    #[inline]
+    fn overflowing_signed_offset(&self, val: u64, i: i128) -> (u64, bool) {
+        // FIXME: is it possible to over/underflow here?
+        if i < 0 {
+            // trickery to ensure that i64::min_value() works fine
+            // this formula only works for true negative values, it panics for zero!
+            let n = u64::max_value() - (i as u64) + 1;
+            val.overflowing_sub(n)
+        } else {
+            self.overflowing_offset(val, i as u64)
+        }
     }
 }
 
@@ -176,19 +177,27 @@ pub fn new_with_tag(alloc_id: AllocId, offset: Size, tag: Tag) -> Self {
         Pointer { alloc_id, offset, tag }
     }
 
-    pub fn wrapping_signed_offset(self, i: i64, cx: &impl HasDataLayout) -> Self {
-        Pointer::new_with_tag(
+    #[inline]
+    pub fn offset(self, i: Size, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
+        Ok(Pointer::new_with_tag(
             self.alloc_id,
-            Size::from_bytes(cx.data_layout().wrapping_signed_offset(self.offset.bytes(), i)),
-            self.tag,
-        )
+            Size::from_bytes(cx.data_layout().offset(self.offset.bytes(), i.bytes())?),
+            self.tag
+        ))
     }
 
-    pub fn overflowing_signed_offset(self, i: i128, cx: &impl HasDataLayout) -> (Self, bool) {
-        let (res, over) = cx.data_layout().overflowing_signed_offset(self.offset.bytes(), i);
+    #[inline]
+    pub fn overflowing_offset(self, i: Size, cx: &impl HasDataLayout) -> (Self, bool) {
+        let (res, over) = cx.data_layout().overflowing_offset(self.offset.bytes(), i.bytes());
         (Pointer::new_with_tag(self.alloc_id, Size::from_bytes(res), self.tag), over)
     }
 
+    #[inline(always)]
+    pub fn wrapping_offset(self, i: Size, cx: &impl HasDataLayout) -> Self {
+        self.overflowing_offset(i, cx).0
+    }
+
+    #[inline]
     pub fn signed_offset(self, i: i64, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
         Ok(Pointer::new_with_tag(
             self.alloc_id,
@@ -197,20 +206,18 @@ pub fn signed_offset(self, i: i64, cx: &impl HasDataLayout) -> EvalResult<'tcx,
         ))
     }
 
-    pub fn overflowing_offset(self, i: Size, cx: &impl HasDataLayout) -> (Self, bool) {
-        let (res, over) = cx.data_layout().overflowing_offset(self.offset.bytes(), i.bytes());
+    #[inline]
+    pub fn overflowing_signed_offset(self, i: i128, cx: &impl HasDataLayout) -> (Self, bool) {
+        let (res, over) = cx.data_layout().overflowing_signed_offset(self.offset.bytes(), i);
         (Pointer::new_with_tag(self.alloc_id, Size::from_bytes(res), self.tag), over)
     }
 
-    pub fn offset(self, i: Size, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
-        Ok(Pointer::new_with_tag(
-            self.alloc_id,
-            Size::from_bytes(cx.data_layout().offset(self.offset.bytes(), i.bytes())?),
-            self.tag
-        ))
+    #[inline(always)]
+    pub fn wrapping_signed_offset(self, i: i64, cx: &impl HasDataLayout) -> Self {
+        self.overflowing_signed_offset(i128::from(i), cx).0
     }
 
-    #[inline]
+    #[inline(always)]
     pub fn erase_tag(self) -> Pointer {
         Pointer { alloc_id: self.alloc_id, offset: self.offset, tag: () }
     }
index 3b8e19c6ecaa9b4c1c7b272da17ddc95a1757a5f..3f5399396abcf837ea2f3b874427cd197ffae868 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(unknown_lints)]
+use std::fmt;
 
 use ty::layout::{HasDataLayout, Size};
 use ty::subst::Substs;
@@ -99,6 +99,15 @@ pub enum Scalar<Tag=(), Id=AllocId> {
     Ptr(Pointer<Tag, Id>),
 }
 
+impl<Tag> fmt::Display for Scalar<Tag> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self {
+            Scalar::Ptr(_) => write!(f, "a pointer"),
+            Scalar::Bits { bits, .. } => write!(f, "{}", bits),
+        }
+    }
+}
+
 impl<'tcx> Scalar<()> {
     #[inline]
     pub fn with_default_tag<Tag>(self) -> Scalar<Tag>
@@ -134,32 +143,47 @@ pub fn zst() -> Self {
     }
 
     #[inline]
-    pub fn ptr_signed_offset(self, i: i64, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
+    pub fn ptr_offset(self, i: Size, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
         let dl = cx.data_layout();
         match self {
             Scalar::Bits { bits, size } => {
                 assert_eq!(size as u64, dl.pointer_size.bytes());
                 Ok(Scalar::Bits {
-                    bits: dl.signed_offset(bits as u64, i)? as u128,
+                    bits: dl.offset(bits as u64, i.bytes())? as u128,
                     size,
                 })
             }
-            Scalar::Ptr(ptr) => ptr.signed_offset(i, dl).map(Scalar::Ptr),
+            Scalar::Ptr(ptr) => ptr.offset(i, dl).map(Scalar::Ptr),
         }
     }
 
     #[inline]
-    pub fn ptr_offset(self, i: Size, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
+    pub fn ptr_wrapping_offset(self, i: Size, cx: &impl HasDataLayout) -> Self {
         let dl = cx.data_layout();
         match self {
             Scalar::Bits { bits, size } => {
                 assert_eq!(size as u64, dl.pointer_size.bytes());
+                Scalar::Bits {
+                    bits: dl.overflowing_offset(bits as u64, i.bytes()).0 as u128,
+                    size,
+                }
+            }
+            Scalar::Ptr(ptr) => Scalar::Ptr(ptr.wrapping_offset(i, dl)),
+        }
+    }
+
+    #[inline]
+    pub fn ptr_signed_offset(self, i: i64, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
+        let dl = cx.data_layout();
+        match self {
+            Scalar::Bits { bits, size } => {
+                assert_eq!(size as u64, dl.pointer_size().bytes());
                 Ok(Scalar::Bits {
-                    bits: dl.offset(bits as u64, i.bytes())? as u128,
+                    bits: dl.signed_offset(bits as u64, i)? as u128,
                     size,
                 })
             }
-            Scalar::Ptr(ptr) => ptr.offset(i, dl).map(Scalar::Ptr),
+            Scalar::Ptr(ptr) => ptr.signed_offset(i, dl).map(Scalar::Ptr),
         }
     }
 
@@ -170,7 +194,7 @@ pub fn ptr_wrapping_signed_offset(self, i: i64, cx: &impl HasDataLayout) -> Self
             Scalar::Bits { bits, size } => {
                 assert_eq!(size as u64, dl.pointer_size.bytes());
                 Scalar::Bits {
-                    bits: dl.wrapping_signed_offset(bits as u64, i) as u128,
+                    bits: dl.overflowing_signed_offset(bits as u64, i128::from(i)).0 as u128,
                     size,
                 }
             }
@@ -178,6 +202,19 @@ pub fn ptr_wrapping_signed_offset(self, i: i64, cx: &impl HasDataLayout) -> Self
         }
     }
 
+    /// Returns this pointers offset from the allocation base, or from NULL (for
+    /// integer pointers).
+    #[inline]
+    pub fn get_ptr_offset(self, cx: &impl HasDataLayout) -> Size {
+        match self {
+            Scalar::Bits { bits, size } => {
+                assert_eq!(size as u64, cx.pointer_size().bytes());
+                Size::from_bytes(bits as u64)
+            }
+            Scalar::Ptr(ptr) => ptr.offset,
+        }
+    }
+
     #[inline]
     pub fn is_null_ptr(self, cx: &impl HasDataLayout) -> bool {
         match self {
index 722bb64a7469dd85e23eaac532436894eecaab04..a84226bf665d0df364b6604961f641233c728e1f 100644 (file)
@@ -520,25 +520,25 @@ pub enum BorrowKind {
     /// implicit closure bindings. It is needed when the closure is
     /// borrowing or mutating a mutable referent, e.g.:
     ///
-    ///    let x: &mut isize = ...;
-    ///    let y = || *x += 5;
+    ///     let x: &mut isize = ...;
+    ///     let y = || *x += 5;
     ///
     /// If we were to try to translate this closure into a more explicit
     /// form, we'd encounter an error with the code as written:
     ///
-    ///    struct Env { x: & &mut isize }
-    ///    let x: &mut isize = ...;
-    ///    let y = (&mut Env { &x }, fn_ptr);  // Closure is pair of env and fn
-    ///    fn fn_ptr(env: &mut Env) { **env.x += 5; }
+    ///     struct Env { x: & &mut isize }
+    ///     let x: &mut isize = ...;
+    ///     let y = (&mut Env { &x }, fn_ptr);  // Closure is pair of env and fn
+    ///     fn fn_ptr(env: &mut Env) { **env.x += 5; }
     ///
     /// This is then illegal because you cannot mutate an `&mut` found
     /// in an aliasable location. To solve, you'd have to translate with
     /// an `&mut` borrow:
     ///
-    ///    struct Env { x: & &mut isize }
-    ///    let x: &mut isize = ...;
-    ///    let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
-    ///    fn fn_ptr(env: &mut Env) { **env.x += 5; }
+    ///     struct Env { x: & &mut isize }
+    ///     let x: &mut isize = ...;
+    ///     let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
+    ///     fn fn_ptr(env: &mut Env) { **env.x += 5; }
     ///
     /// Now the assignment to `**env.x` is legal, but creating a
     /// mutable pointer to `x` is not because `x` is not mutable. We
@@ -3000,7 +3000,7 @@ fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
         use mir::TerminatorKind::*;
 
         let kind = match self.kind {
-            Goto { target } => Goto { target: target },
+            Goto { target } => Goto { target },
             SwitchInt {
                 ref discr,
                 switch_ty,
index 473730c548990c8005986a903aa8d546bcf951c1..4b53235eab4af2aa2f1a420e29b80d5ffc77f6cc 100644 (file)
@@ -32,7 +32,7 @@ pub enum PlaceTy<'tcx> {
 
 impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> {
     pub fn from_ty(ty: Ty<'tcx>) -> PlaceTy<'tcx> {
-        PlaceTy::Ty { ty: ty }
+        PlaceTy::Ty { ty }
     }
 
     pub fn to_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> {
index 76200777584012a60666a7d654ba7bd4e1dafbf5..78aabf86e300d72ae2a8784897db7bff0356a679 100644 (file)
@@ -2082,7 +2082,7 @@ pub fn build_session_options_and_crate_config(
                         error_format,
                         &format!(
                             "optimization level needs to be \
-                             between 0-3 (instead was `{}`)",
+                             between 0-3, s or z (instead was `{}`)",
                             arg
                         ),
                     );
@@ -2202,8 +2202,7 @@ pub fn build_session_options_and_crate_config(
     if !cg.remark.is_empty() && debuginfo == DebugInfo::None {
         early_warn(
             error_format,
-            "-C remark will not show source locations without \
-             --debuginfo",
+            "-C remark requires \"-C debuginfo=n\" to show source locations",
         );
     }
 
index a17825a877d88cb45ecaba6e31d2cc6a15e0860a..fe94b62ef19e266c6e0989daba86a1992fd46d45 100644 (file)
@@ -868,7 +868,7 @@ pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -
                 let fuel = self.optimization_fuel_limit.get();
                 ret = fuel != 0;
                 if fuel == 0 && !self.out_of_fuel.get() {
-                    println!("optimization-fuel-exhausted: {}", msg());
+                    eprintln!("optimization-fuel-exhausted: {}", msg());
                     self.out_of_fuel.set(true);
                 } else if fuel > 0 {
                     self.optimization_fuel_limit.set(fuel - 1);
index e87e425762d56eaf96399c1468eb1250f04f9eb4..8239e5ac56e44c4a5d5eab84ce07ff0cac543755 100644 (file)
@@ -447,27 +447,51 @@ fn add_user_pred<'c>(
                                     ty::RegionKind::ReLateBound(_, _),
                                 ) => {}
 
-                                (ty::RegionKind::ReLateBound(_, _), _) => {
+                                (ty::RegionKind::ReLateBound(_, _), _) |
+                                (_, ty::RegionKind::ReVar(_)) => {
+                                    // One of these is true:
                                     // The new predicate has a HRTB in a spot where the old
                                     // predicate does not (if they both had a HRTB, the previous
-                                    // match arm would have executed).
+                                    // match arm would have executed). A HRBT is a 'stricter'
+                                    // bound than anything else, so we want to keep the newer
+                                    // predicate (with the HRBT) in place of the old predicate.
                                     //
-                                    // The means we want to remove the older predicate from
-                                    // user_computed_preds, since having both it and the new
+                                    // OR
+                                    //
+                                    // The old predicate has a region variable where the new
+                                    // predicate has some other kind of region. An region
+                                    // variable isn't something we can actually display to a user,
+                                    // so we choose ther new predicate (which doesn't have a region
+                                    // varaible).
+                                    //
+                                    // In both cases, we want to remove the old predicate,
+                                    // from user_computed_preds, and replace it with the new
+                                    // one. Having both the old and the new
                                     // predicate in a ParamEnv would confuse SelectionContext
+                                    //
                                     // We're currently in the predicate passed to 'retain',
                                     // so we return 'false' to remove the old predicate from
                                     // user_computed_preds
                                     return false;
                                 }
-                                (_, ty::RegionKind::ReLateBound(_, _)) => {
-                                    // This is the opposite situation as the previous arm - the
-                                    // old predicate has a HRTB lifetime in a place where the
-                                    // new predicate does not. We want to leave the old
+                                (_, ty::RegionKind::ReLateBound(_, _)) |
+                                (ty::RegionKind::ReVar(_), _) => {
+                                    // This is the opposite situation as the previous arm.
+                                    // One of these is true:
+                                    //
+                                    // The old predicate has a HRTB lifetime in a place where the
+                                    // new predicate does not.
+                                    //
+                                    // OR
+                                    //
+                                    // The new predicate has a region variable where the old
+                                    // predicate has some other type of region.
+                                    //
+                                    // We want to leave the old
                                     // predicate in user_computed_preds, and skip adding
                                     // new_pred to user_computed_params.
                                     should_add_new = false
-                                }
+                                },
                                 _ => {}
                             }
                         }
index aea956461f27bea7252ff69d43a72af19d10d377..bc091a4e7e0848e0ebd81fd2f0e3dde53ab44ec7 100644 (file)
@@ -12,8 +12,9 @@
 use mir::interpret::{GlobalId, ErrorHandled};
 use ty::{self, Ty, TypeFoldable, ToPolyTraitRef, ToPredicate};
 use ty::error::ExpectedFound;
-use rustc_data_structures::obligation_forest::{Error, ForestObligation, ObligationForest};
-use rustc_data_structures::obligation_forest::{ObligationProcessor, ProcessResult};
+use rustc_data_structures::obligation_forest::{DoCompleted, Error, ForestObligation};
+use rustc_data_structures::obligation_forest::{ObligationForest, ObligationProcessor};
+use rustc_data_structures::obligation_forest::{ProcessResult};
 use std::marker::PhantomData;
 use hir::def_id::DefId;
 
@@ -98,7 +99,7 @@ fn select(&mut self, selcx: &mut SelectionContext<'a, 'gcx, 'tcx>)
             let outcome = self.predicates.process_obligations(&mut FulfillProcessor {
                 selcx,
                 register_region_obligations: self.register_region_obligations
-            });
+            }, DoCompleted::No);
             debug!("select: outcome={:#?}", outcome);
 
             // FIXME: if we kept the original cache key, we could mark projection
index a388c7eeb7e49ede897bbe130ffc07ffd4071d93..6b5eb4293e0285311a0316bdf017530058d665e8 100644 (file)
@@ -266,7 +266,7 @@ fn project_and_unify_type<'cx, 'gcx, 'tcx>(
         },
         Err(err) => {
             debug!("project_and_unify_type: equating types encountered error {:?}", err);
-            Err(MismatchedProjectionTypes { err: err })
+            Err(MismatchedProjectionTypes { err })
         }
     }
 }
index 312cd66dcc75c229b78b1d9d7a4d2b537b7eb55b..550c27ca0ab8bc669b4c95396443de56c90e8f0a 100644 (file)
@@ -3526,7 +3526,7 @@ fn confirm_builtin_unsize_candidate(
             _ => bug!(),
         };
 
-        Ok(VtableBuiltinData { nested: nested })
+        Ok(VtableBuiltinData { nested })
     }
 
     ///////////////////////////////////////////////////////////////////////////
index 0ce1d8f8227553ec5e3d312fa4ca6eda15635c66..d7b5dd049e35088f015a6628a1794e8489089d2b 100644 (file)
@@ -396,7 +396,10 @@ fn to_pretty_impl_header(tcx: TyCtxt<'_, '_, '_>, impl_def_id: DefId) -> Option<
     if !substs.is_noop() {
         types_without_default_bounds.extend(substs.types());
         w.push('<');
-        w.push_str(&substs.iter().map(|k| k.to_string()).collect::<Vec<_>>().join(", "));
+        w.push_str(&substs.iter()
+            .map(|k| k.to_string())
+            .filter(|k| &k[..] != "'_")
+            .collect::<Vec<_>>().join(", "));
         w.push('>');
     }
 
index c9b0e97c9b05c61847e79409a6232055c2ba1647..d20b6d361991b6804630e997bc0cb5c2d3efe72c 100644 (file)
@@ -34,7 +34,7 @@ pub struct Match<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
 
 impl<'a, 'gcx, 'tcx> Match<'a, 'gcx, 'tcx> {
     pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Match<'a, 'gcx, 'tcx> {
-        Match { tcx: tcx }
+        Match { tcx }
     }
 }
 
index 8c822adf7b0236bd39b829d1cae1335f7a8c7169..ffa4380a5d63c48fcb59687dfdb7af2df841de6f 100644 (file)
@@ -82,7 +82,7 @@ fn has_escaping_bound_vars(&self) -> bool {
     }
 
     fn has_type_flags(&self, flags: TypeFlags) -> bool {
-        self.visit_with(&mut HasTypeFlagsVisitor { flags: flags })
+        self.visit_with(&mut HasTypeFlagsVisitor { flags })
     }
     fn has_projections(&self) -> bool {
         self.has_type_flags(TypeFlags::HAS_PROJECTION)
index 3dc31c517169f2a0f9708186e3315cc797e74793..54550b8a2055f44214f38b818c6b8b88836201b6 100644 (file)
@@ -450,8 +450,7 @@ fn compute_cnum_map(tcx: TyCtxt<'_, '_, '_>,
                                      .map(|&(cnum, ..)| cnum)
                                      .max()
                                      .unwrap_or(0) + 1;
-            let mut map = IndexVec::new();
-            map.resize(map_size as usize, None);
+            let mut map = IndexVec::from_elem_n(None, map_size as usize);
 
             for &(prev_cnum, ref crate_name, crate_disambiguator) in prev_cnums {
                 let key = (crate_name.clone(), crate_disambiguator);
index e50534a4e1dc95fc7d19eaf5f3c6d4f0e691046c..bd7a1c2c3293eb28194d3b8e4f2af54d56580d46 100644 (file)
@@ -225,9 +225,10 @@ fn store(&self, bx: &Builder<'_, 'll, 'tcx>, val: &'ll Value, dst: PlaceRef<'ll,
                 // ...and then memcpy it to the intended destination.
                 base::call_memcpy(bx,
                                   bx.pointercast(dst.llval, Type::i8p(cx)),
+                                  self.layout.align,
                                   bx.pointercast(llscratch, Type::i8p(cx)),
+                                  scratch_align,
                                   C_usize(cx, self.layout.size.bytes()),
-                                  self.layout.align.min(scratch_align),
                                   MemFlags::empty());
 
                 bx.lifetime_end(llscratch, scratch_size);
index 8f940e0d22a83db3000da3eea32c9824e3919133..3d96fef7c0d6f09e9e47f93c52e475fd0d700627 100644 (file)
@@ -605,6 +605,13 @@ fn run_pass_manager(cgcx: &CodegenContext,
             }
         });
 
+        // We always generate bitcode through ThinLTOBuffers,
+        // which do not support anonymous globals
+        if config.bitcode_needed() {
+            let pass = llvm::LLVMRustFindAndCreatePass("name-anon-globals\0".as_ptr() as *const _);
+            llvm::LLVMRustAddPass(pm, pass.unwrap());
+        }
+
         if config.verify_llvm_ir {
             let pass = llvm::LLVMRustFindAndCreatePass("verify\0".as_ptr() as *const _);
             llvm::LLVMRustAddPass(pm, pass.unwrap());
index d04e80195f054afcb155a8823a099767c11e0e94..184be4b9eab39d76841af69ce451f065c2ee9757 100644 (file)
@@ -337,6 +337,11 @@ fn set_flags(&mut self, sess: &Session, no_builtins: bool) {
         self.merge_functions = sess.opts.optimize == config::OptLevel::Default ||
                                sess.opts.optimize == config::OptLevel::Aggressive;
     }
+
+    pub fn bitcode_needed(&self) -> bool {
+        self.emit_bc || self.obj_is_bitcode
+            || self.emit_bc_compressed || self.embed_bitcode
+    }
 }
 
 /// Assembler name and command used by codegen when no_integrated_as is enabled
@@ -564,8 +569,7 @@ unsafe fn optimize(cgcx: &CodegenContext,
             // Some options cause LLVM bitcode to be emitted, which uses ThinLTOBuffers, so we need
             // to make sure we run LLVM's NameAnonGlobals pass when emitting bitcode; otherwise
             // we'll get errors in LLVM.
-            let using_thin_buffers = config.emit_bc || config.obj_is_bitcode
-                || config.emit_bc_compressed || config.embed_bitcode;
+            let using_thin_buffers = config.bitcode_needed();
             let mut have_name_anon_globals_pass = false;
             if !config.no_prepopulate_passes {
                 llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
index fb33fe85b005441782f340c8f880a687273bbf3e..806025937cb110c75028094c56caee1e6fda7f1e 100644 (file)
@@ -53,7 +53,7 @@
 use attributes;
 use builder::{Builder, MemFlags};
 use callee;
-use common::{C_bool, C_bytes_in_context, C_i32, C_usize};
+use common::{C_bool, C_bytes_in_context, C_usize};
 use rustc_mir::monomorphize::item::DefPathBasedNames;
 use common::{C_struct_in_context, C_array, val_ty};
 use consts;
@@ -77,7 +77,6 @@
 use std::any::Any;
 use std::cmp;
 use std::ffi::CString;
-use std::i32;
 use std::ops::{Deref, DerefMut};
 use std::sync::mpsc;
 use std::time::{Instant, Duration};
@@ -319,8 +318,8 @@ pub fn coerce_unsized_into(
                 }
 
                 if src_f.layout.ty == dst_f.layout.ty {
-                    memcpy_ty(bx, dst_f.llval, src_f.llval, src_f.layout,
-                              src_f.align.min(dst_f.align), MemFlags::empty());
+                    memcpy_ty(bx, dst_f.llval, dst_f.align, src_f.llval, src_f.align,
+                              src_f.layout, MemFlags::empty());
                 } else {
                     coerce_unsized_into(bx, src_f, dst_f);
                 }
@@ -420,36 +419,34 @@ pub fn to_immediate_scalar(
 pub fn call_memcpy(
     bx: &Builder<'_, 'll, '_>,
     dst: &'ll Value,
+    dst_align: Align,
     src: &'ll Value,
+    src_align: Align,
     n_bytes: &'ll Value,
-    align: Align,
     flags: MemFlags,
 ) {
     if flags.contains(MemFlags::NONTEMPORAL) {
         // HACK(nox): This is inefficient but there is no nontemporal memcpy.
-        let val = bx.load(src, align);
+        let val = bx.load(src, src_align);
         let ptr = bx.pointercast(dst, val_ty(val).ptr_to());
-        bx.store_with_flags(val, ptr, align, flags);
+        bx.store_with_flags(val, ptr, dst_align, flags);
         return;
     }
     let cx = bx.cx;
-    let ptr_width = &cx.sess().target.target.target_pointer_width;
-    let key = format!("llvm.memcpy.p0i8.p0i8.i{}", ptr_width);
-    let memcpy = cx.get_intrinsic(&key);
     let src_ptr = bx.pointercast(src, Type::i8p(cx));
     let dst_ptr = bx.pointercast(dst, Type::i8p(cx));
     let size = bx.intcast(n_bytes, cx.isize_ty, false);
-    let align = C_i32(cx, align.abi() as i32);
-    let volatile = C_bool(cx, flags.contains(MemFlags::VOLATILE));
-    bx.call(memcpy, &[dst_ptr, src_ptr, size, align, volatile], None);
+    let volatile = flags.contains(MemFlags::VOLATILE);
+    bx.memcpy(dst_ptr, dst_align.abi(), src_ptr, src_align.abi(), size, volatile);
 }
 
 pub fn memcpy_ty(
     bx: &Builder<'_, 'll, 'tcx>,
     dst: &'ll Value,
+    dst_align: Align,
     src: &'ll Value,
+    src_align: Align,
     layout: TyLayout<'tcx>,
-    align: Align,
     flags: MemFlags,
 ) {
     let size = layout.size.bytes();
@@ -457,7 +454,7 @@ pub fn memcpy_ty(
         return;
     }
 
-    call_memcpy(bx, dst, src, C_usize(bx.cx, size), align, flags);
+    call_memcpy(bx, dst, dst_align, src, src_align, C_usize(bx.cx, size), flags);
 }
 
 pub fn call_memset(
index f70a68c72489a457df330d85794677f40ce912ca..1b1a31def3759bea88c4642f44e8b7a2d5b922c8 100644 (file)
@@ -781,6 +781,24 @@ pub fn call(&self, llfn: &'ll Value, args: &[&'ll Value],
         }
     }
 
+    pub fn memcpy(&self, dst: &'ll Value, dst_align: u64,
+                  src: &'ll Value, src_align: u64,
+                  size: &'ll Value, is_volatile: bool) -> &'ll Value {
+        unsafe {
+            llvm::LLVMRustBuildMemCpy(self.llbuilder, dst, dst_align as c_uint,
+                                      src, src_align as c_uint, size, is_volatile)
+        }
+    }
+
+    pub fn memmove(&self, dst: &'ll Value, dst_align: u64,
+                  src: &'ll Value, src_align: u64,
+                  size: &'ll Value, is_volatile: bool) -> &'ll Value {
+        unsafe {
+            llvm::LLVMRustBuildMemMove(self.llbuilder, dst, dst_align as c_uint,
+                                      src, src_align as c_uint, size, is_volatile)
+        }
+    }
+
     pub fn minnum(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
         self.count_insn("minnum");
         unsafe {
index 120449ae2af4c2518294656eaac3aa6fb68370d5..555e4012c3add7c54d5e331c7e7aa372c22e645c 100644 (file)
@@ -530,12 +530,6 @@ macro_rules! mk_struct {
     let t_v4f64 = Type::vector(t_f64, 4);
     let t_v8f64 = Type::vector(t_f64, 8);
 
-    ifn!("llvm.memcpy.p0i8.p0i8.i16", fn(i8p, i8p, t_i16, t_i32, i1) -> void);
-    ifn!("llvm.memcpy.p0i8.p0i8.i32", fn(i8p, i8p, t_i32, t_i32, i1) -> void);
-    ifn!("llvm.memcpy.p0i8.p0i8.i64", fn(i8p, i8p, t_i64, t_i32, i1) -> void);
-    ifn!("llvm.memmove.p0i8.p0i8.i16", fn(i8p, i8p, t_i16, t_i32, i1) -> void);
-    ifn!("llvm.memmove.p0i8.p0i8.i32", fn(i8p, i8p, t_i32, t_i32, i1) -> void);
-    ifn!("llvm.memmove.p0i8.p0i8.i64", fn(i8p, i8p, t_i64, t_i32, i1) -> void);
     ifn!("llvm.memset.p0i8.i16", fn(i8p, t_i8, t_i16, t_i32, i1) -> void);
     ifn!("llvm.memset.p0i8.i32", fn(i8p, t_i8, t_i32, t_i32, i1) -> void);
     ifn!("llvm.memset.p0i8.i64", fn(i8p, t_i8, t_i64, t_i32, i1) -> void);
index e44bd2d23672fcb371facfb0459b2a351595414d..a4401cf96d9deed201aa62a27f7031172ab1df0a 100644 (file)
@@ -23,7 +23,7 @@
 use type_::Type;
 use type_of::LayoutLlvmExt;
 use rustc::ty::{self, Ty};
-use rustc::ty::layout::{HasDataLayout, LayoutOf};
+use rustc::ty::layout::LayoutOf;
 use rustc::hir;
 use syntax::ast;
 use syntax::symbol::Symbol;
@@ -690,28 +690,14 @@ fn copy_intrinsic(
     let cx = bx.cx;
     let (size, align) = cx.size_and_align_of(ty);
     let size = C_usize(cx, size.bytes());
-    let align = C_i32(cx, align.abi() as i32);
-
-    let operation = if allow_overlap {
-        "memmove"
-    } else {
-        "memcpy"
-    };
-
-    let name = format!("llvm.{}.p0i8.p0i8.i{}", operation,
-                       cx.data_layout().pointer_size.bits());
-
+    let align = align.abi();
     let dst_ptr = bx.pointercast(dst, Type::i8p(cx));
     let src_ptr = bx.pointercast(src, Type::i8p(cx));
-    let llfn = cx.get_intrinsic(&name);
-
-    bx.call(llfn,
-        &[dst_ptr,
-        src_ptr,
-        bx.mul(size, count),
-        align,
-        C_bool(cx, volatile)],
-        None)
+    if allow_overlap {
+        bx.memmove(dst_ptr, align, src_ptr, align, bx.mul(size, count), volatile)
+    } else {
+        bx.memcpy(dst_ptr, align, src_ptr, align, bx.mul(size, count), volatile)
+    }
 }
 
 fn memset_intrinsic(
index 12d4670e4be4bed52973273fdaf37e5b3bb2b598..b994b1ffc4bce91842b64630d4d88cf2a4afc974 100644 (file)
@@ -998,6 +998,22 @@ pub fn LLVMRustBuildCall(B: &Builder<'a>,
                              Bundle: Option<&OperandBundleDef<'a>>,
                              Name: *const c_char)
                              -> &'a Value;
+    pub fn LLVMRustBuildMemCpy(B: &Builder<'a>,
+                               Dst: &'a Value,
+                               DstAlign: c_uint,
+                               Src: &'a Value,
+                               SrcAlign: c_uint,
+                               Size: &'a Value,
+                               IsVolatile: bool)
+                               -> &'a Value;
+    pub fn LLVMRustBuildMemMove(B: &Builder<'a>,
+                                Dst: &'a Value,
+                                DstAlign: c_uint,
+                                Src: &'a Value,
+                                SrcAlign: c_uint,
+                                Size: &'a Value,
+                                IsVolatile: bool)
+                                -> &'a Value;
     pub fn LLVMBuildSelect(B: &Builder<'a>,
                            If: &'a Value,
                            Then: &'a Value,
index 4343c8c184ecf02b8a9b4d87246e77858dc016f5..fbd5192a63f8e42c1ccc93eec222af882e97c96b 100644 (file)
@@ -190,7 +190,7 @@ impl ObjectFile {
     pub fn new(llmb: &'static mut MemoryBuffer) -> Option<ObjectFile> {
         unsafe {
             let llof = LLVMCreateObjectFile(llmb)?;
-            Some(ObjectFile { llof: llof })
+            Some(ObjectFile { llof })
         }
     }
 }
index a93c6faaf7ba927658a0c6c030bc1b59d24e8ccf..2af772bd7ce22abaf9f3229c97c56c674324588d 100644 (file)
@@ -346,7 +346,7 @@ fn propagate<'tcx>(result: &mut IndexVec<mir::BasicBlock, CleanupKind>,
                        funclet, succ, kind);
                 match kind {
                     CleanupKind::NotCleanup => {
-                        result[succ] = CleanupKind::Internal { funclet: funclet };
+                        result[succ] = CleanupKind::Internal { funclet };
                     }
                     CleanupKind::Funclet => {
                         if funclet != succ {
index a7f4c48c89bd6c99ef8e7a559e702f14d0033b26..3f9921a5cf930b68372a3584a17f6b725727d6f4 100644 (file)
@@ -784,7 +784,8 @@ fn codegen_argument(&mut self,
                     // have scary latent bugs around.
 
                     let scratch = PlaceRef::alloca(bx, arg.layout, "arg");
-                    base::memcpy_ty(bx, scratch.llval, llval, op.layout, align, MemFlags::empty());
+                    base::memcpy_ty(bx, scratch.llval, scratch.align, llval, align,
+                                    op.layout, MemFlags::empty());
                     (scratch.llval, scratch.align, true)
                 } else {
                     (llval, align, true)
index d1b6aa7fc4280c9cfddc1486b5601a7ca2aa05ab..c76cbfcd9717711e244a7a3b6e1421be3dfd0e2c 100644 (file)
@@ -282,8 +282,8 @@ fn store_with_flags(
         }
         match self {
             OperandValue::Ref(r, None, source_align) => {
-                base::memcpy_ty(bx, dest.llval, r, dest.layout,
-                                source_align.min(dest.align), flags)
+                base::memcpy_ty(bx, dest.llval, dest.align, r, source_align,
+                                dest.layout, flags)
             }
             OperandValue::Ref(_, Some(_), _) => {
                 bug!("cannot directly store unsized values");
@@ -324,7 +324,7 @@ pub fn store_unsized(self, bx: &Builder<'a, 'll, 'tcx>, indirect_dest: PlaceRef<
         // Allocate an appropriate region on the stack, and copy the value into it
         let (llsize, _) = glue::size_and_align_of_dst(&bx, unsized_ty, Some(llextra));
         let lldst = bx.array_alloca(Type::i8(bx.cx), llsize, "unsized_tmp", max_align);
-        base::call_memcpy(&bx, lldst, llptr, llsize, min_align, flags);
+        base::call_memcpy(&bx, lldst, max_align, llptr, min_align, llsize, flags);
 
         // Store the allocated region and the extra to the indirect place.
         let indirect_operand = OperandValue::Pair(lldst, llextra);
index 47bbd67fb5c70840cc5fdf85e8cfca77338df991..6eaf0c1c08da126778ef2170931229d764ec5c1c 100644 (file)
@@ -32,7 +32,7 @@ pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     }
 
     tcx.dep_graph.with_ignore(|| {
-        let mut visitor = SymbolNamesTest { tcx: tcx };
+        let mut visitor = SymbolNamesTest { tcx };
         tcx.hir.krate().visit_all_item_likes(&mut visitor);
     })
 }
index 38ce331051fecc81b029a2bd460a0406963e8644..86e48e21626abd39b4a9546c237de189595464f9 100644 (file)
@@ -214,7 +214,7 @@ pub fn new(p: &Path,
                     unsafe { libc::close(fd); }
                     Err(err)
                 } else {
-                    Ok(Lock { fd: fd })
+                    Ok(Lock { fd })
                 }
             }
         }
index ccf2a7f81590e94b182fc92f631879c8c4fe3689..c211d888df131b5b62f29fde6d1b98a5cc4496d5 100644 (file)
@@ -162,8 +162,8 @@ enum NodeState {
 #[derive(Debug)]
 pub struct Outcome<O, E> {
     /// Obligations that were completely evaluated, including all
-    /// (transitive) subobligations.
-    pub completed: Vec<O>,
+    /// (transitive) subobligations. Only computed if requested.
+    pub completed: Option<Vec<O>>,
 
     /// Backtrace of obligations that were found to be in error.
     pub errors: Vec<Error<O, E>>,
@@ -177,6 +177,14 @@ pub struct Outcome<O, E> {
     pub stalled: bool,
 }
 
+/// Should `process_obligations` compute the `Outcome::completed` field of its
+/// result?
+#[derive(PartialEq)]
+pub enum DoCompleted {
+    No,
+    Yes,
+}
+
 #[derive(Debug, PartialEq, Eq)]
 pub struct Error<O, E> {
     pub error: E,
@@ -282,8 +290,8 @@ pub fn to_errors<E: Clone>(&mut self, error: E) -> Vec<Error<O, E>> {
                 });
             }
         }
-        let successful_obligations = self.compress();
-        assert!(successful_obligations.is_empty());
+        let successful_obligations = self.compress(DoCompleted::Yes);
+        assert!(successful_obligations.unwrap().is_empty());
         errors
     }
 
@@ -311,7 +319,8 @@ fn insert_into_error_cache(&mut self, node_index: usize) {
     /// be called in a loop until `outcome.stalled` is false.
     ///
     /// This CANNOT be unrolled (presently, at least).
-    pub fn process_obligations<P>(&mut self, processor: &mut P) -> Outcome<O, P::Error>
+    pub fn process_obligations<P>(&mut self, processor: &mut P, do_completed: DoCompleted)
+                                  -> Outcome<O, P::Error>
         where P: ObligationProcessor<Obligation=O>
     {
         debug!("process_obligations(len={})", self.nodes.len());
@@ -366,7 +375,7 @@ pub fn process_obligations<P>(&mut self, processor: &mut P) -> Outcome<O, P::Err
             // There's no need to perform marking, cycle processing and compression when nothing
             // changed.
             return Outcome {
-                completed: vec![],
+                completed: if do_completed == DoCompleted::Yes { Some(vec![]) } else { None },
                 errors,
                 stalled,
             };
@@ -376,12 +385,12 @@ pub fn process_obligations<P>(&mut self, processor: &mut P) -> Outcome<O, P::Err
         self.process_cycles(processor);
 
         // Now we have to compress the result
-        let completed_obligations = self.compress();
+        let completed = self.compress(do_completed);
 
         debug!("process_obligations: complete");
 
         Outcome {
-            completed: completed_obligations,
+            completed,
             errors,
             stalled,
         }
@@ -524,7 +533,7 @@ fn mark_as_waiting_from(&self, node: &Node<O>) {
     /// Beforehand, all nodes must be marked as `Done` and no cycles
     /// on these nodes may be present. This is done by e.g. `process_cycles`.
     #[inline(never)]
-    fn compress(&mut self) -> Vec<O> {
+    fn compress(&mut self, do_completed: DoCompleted) -> Option<Vec<O>> {
         let nodes_len = self.nodes.len();
         let mut node_rewrites: Vec<_> = self.scratch.take().unwrap();
         node_rewrites.extend(0..nodes_len);
@@ -573,21 +582,26 @@ fn compress(&mut self) -> Vec<O> {
         if dead_nodes == 0 {
             node_rewrites.truncate(0);
             self.scratch = Some(node_rewrites);
-            return vec![];
+            return if do_completed == DoCompleted::Yes { Some(vec![]) } else { None };
         }
 
         // Pop off all the nodes we killed and extract the success
         // stories.
-        let successful = (0..dead_nodes)
-                             .map(|_| self.nodes.pop().unwrap())
-                             .flat_map(|node| {
-                                 match node.state.get() {
-                                     NodeState::Error => None,
-                                     NodeState::Done => Some(node.obligation),
-                                     _ => unreachable!()
-                                 }
-                             })
-            .collect();
+        let successful = if do_completed == DoCompleted::Yes {
+            Some((0..dead_nodes)
+                .map(|_| self.nodes.pop().unwrap())
+                .flat_map(|node| {
+                    match node.state.get() {
+                        NodeState::Error => None,
+                        NodeState::Done => Some(node.obligation),
+                        _ => unreachable!()
+                    }
+                })
+                .collect())
+        } else {
+            self.nodes.truncate(self.nodes.len() - dead_nodes);
+            None
+        };
         self.apply_rewrites(&node_rewrites);
 
         node_rewrites.truncate(0);
index c27a65e34310ff19e774a6d0029366d5ffeaa8f2..2a418973fbda2010d37613bd78458123470bff5f 100644 (file)
@@ -10,7 +10,7 @@
 
 #![cfg(test)]
 
-use super::{Error, ObligationForest, ObligationProcessor, Outcome, ProcessResult};
+use super::{Error, DoCompleted, ObligationForest, ObligationProcessor, Outcome, ProcessResult};
 
 use std::fmt;
 use std::marker::PhantomData;
@@ -84,8 +84,8 @@ fn push_pop() {
                 "C" => ProcessResult::Changed(vec![]),
                 _ => unreachable!(),
             }
-        }, |_| {}));
-    assert_eq!(ok, vec!["C"]);
+        }, |_| {}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap(), vec!["C"]);
     assert_eq!(err,
                vec![Error {
                         error: "B is for broken",
@@ -108,8 +108,8 @@ fn push_pop() {
                 "D" => ProcessResult::Changed(vec!["D.1", "D.2"]),
                 _ => unreachable!(),
             }
-        }, |_| {}));
-    assert_eq!(ok, Vec::<&'static str>::new());
+        }, |_| {}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap(), Vec::<&'static str>::new());
     assert_eq!(err, Vec::new());
 
 
@@ -127,8 +127,8 @@ fn push_pop() {
                 "D.2" => ProcessResult::Changed(vec!["D.2.i"]),
                 _ => unreachable!(),
             }
-        }, |_| {}));
-    assert_eq!(ok, vec!["A.3", "A.1", "A.3.i"]);
+        }, |_| {}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap(), vec!["A.3", "A.1", "A.3.i"]);
     assert_eq!(err,
                vec![Error {
                         error: "A is for apple",
@@ -143,8 +143,8 @@ fn push_pop() {
                 "D.2.i" => ProcessResult::Changed(vec![]),
                 _ => panic!("unexpected obligation {:?}", obligation),
             }
-        }, |_| {}));
-    assert_eq!(ok, vec!["D.2.i", "D.2"]);
+        }, |_| {}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap(), vec!["D.2.i", "D.2"]);
     assert_eq!(err,
                vec![Error {
                         error: "D is for dumb",
@@ -171,8 +171,8 @@ fn success_in_grandchildren() {
                 "A" => ProcessResult::Changed(vec!["A.1", "A.2", "A.3"]),
                 _ => unreachable!(),
             }
-        }, |_| {}));
-    assert!(ok.is_empty());
+        }, |_| {}), DoCompleted::Yes);
+    assert!(ok.unwrap().is_empty());
     assert!(err.is_empty());
 
     let Outcome { completed: ok, errors: err, .. } =
@@ -183,8 +183,8 @@ fn success_in_grandchildren() {
                 "A.3" => ProcessResult::Changed(vec![]),
                 _ => unreachable!(),
             }
-        }, |_| {}));
-    assert_eq!(ok, vec!["A.3", "A.1"]);
+        }, |_| {}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap(), vec!["A.3", "A.1"]);
     assert!(err.is_empty());
 
     let Outcome { completed: ok, errors: err, .. } =
@@ -194,8 +194,8 @@ fn success_in_grandchildren() {
                 "A.2.ii" => ProcessResult::Changed(vec![]),
                 _ => unreachable!(),
             }
-        }, |_| {}));
-    assert_eq!(ok, vec!["A.2.ii"]);
+        }, |_| {}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap(), vec!["A.2.ii"]);
     assert!(err.is_empty());
 
     let Outcome { completed: ok, errors: err, .. } =
@@ -204,14 +204,15 @@ fn success_in_grandchildren() {
                 "A.2.i.a" => ProcessResult::Changed(vec![]),
                 _ => unreachable!(),
             }
-        }, |_| {}));
-    assert_eq!(ok, vec!["A.2.i.a", "A.2.i", "A.2", "A"]);
+        }, |_| {}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap(), vec!["A.2.i.a", "A.2.i", "A.2", "A"]);
     assert!(err.is_empty());
 
     let Outcome { completed: ok, errors: err, .. } =
-        forest.process_obligations(&mut C(|_| unreachable!(), |_| {}));
+        forest.process_obligations(&mut C(|_| unreachable!(), |_| {}),
+        DoCompleted::Yes);
 
-    assert!(ok.is_empty());
+    assert!(ok.unwrap().is_empty());
     assert!(err.is_empty());
 }
 
@@ -227,8 +228,8 @@ fn to_errors_no_throw() {
                 "A" => ProcessResult::Changed(vec!["A.1", "A.2", "A.3"]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok.len(), 0);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err.len(), 0);
     let errors = forest.to_errors(());
     assert_eq!(errors[0].backtrace, vec!["A.1", "A"]);
@@ -248,8 +249,8 @@ fn diamond() {
                 "A" => ProcessResult::Changed(vec!["A.1", "A.2"]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok.len(), 0);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err.len(), 0);
 
     let Outcome { completed: ok, errors: err, .. } =
@@ -259,8 +260,8 @@ fn diamond() {
                 "A.2" => ProcessResult::Changed(vec!["D"]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok.len(), 0);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err.len(), 0);
 
     let mut d_count = 0;
@@ -270,9 +271,9 @@ fn diamond() {
                 "D" => { d_count += 1; ProcessResult::Changed(vec![]) },
                 _ => unreachable!(),
             }
-        }, |_|{}));
+        }, |_|{}), DoCompleted::Yes);
     assert_eq!(d_count, 1);
-    assert_eq!(ok, vec!["D", "A.2", "A.1", "A"]);
+    assert_eq!(ok.unwrap(), vec!["D", "A.2", "A.1", "A"]);
     assert_eq!(err.len(), 0);
 
     let errors = forest.to_errors(());
@@ -285,8 +286,8 @@ fn diamond() {
                 "A'" => ProcessResult::Changed(vec!["A'.1", "A'.2"]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok.len(), 0);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err.len(), 0);
 
     let Outcome { completed: ok, errors: err, .. } =
@@ -296,8 +297,8 @@ fn diamond() {
                 "A'.2" => ProcessResult::Changed(vec!["D'"]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok.len(), 0);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err.len(), 0);
 
     let mut d_count = 0;
@@ -307,9 +308,9 @@ fn diamond() {
                 "D'" => { d_count += 1; ProcessResult::Error("operation failed") },
                 _ => unreachable!(),
             }
-        }, |_|{}));
+        }, |_|{}), DoCompleted::Yes);
     assert_eq!(d_count, 1);
-    assert_eq!(ok.len(), 0);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err, vec![super::Error {
         error: "operation failed",
         backtrace: vec!["D'", "A'.1", "A'"]
@@ -333,8 +334,8 @@ fn done_dependency() {
                 "A: Sized" | "B: Sized" | "C: Sized" => ProcessResult::Changed(vec![]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok, vec!["C: Sized", "B: Sized", "A: Sized"]);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap(), vec!["C: Sized", "B: Sized", "A: Sized"]);
     assert_eq!(err.len(), 0);
 
     forest.register_obligation("(A,B,C): Sized");
@@ -348,8 +349,8 @@ fn done_dependency() {
                         ]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok, vec!["(A,B,C): Sized"]);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap(), vec!["(A,B,C): Sized"]);
     assert_eq!(err.len(), 0);
 }
 
@@ -371,8 +372,8 @@ fn orphan() {
                 "C2" => ProcessResult::Changed(vec![]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok, vec!["C2", "C1"]);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap(), vec!["C2", "C1"]);
     assert_eq!(err.len(), 0);
 
     let Outcome { completed: ok, errors: err, .. } =
@@ -382,8 +383,8 @@ fn orphan() {
                 "B" => ProcessResult::Changed(vec!["D"]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok.len(), 0);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err.len(), 0);
 
     let Outcome { completed: ok, errors: err, .. } =
@@ -393,8 +394,8 @@ fn orphan() {
                 "E" => ProcessResult::Error("E is for error"),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok.len(), 0);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err, vec![super::Error {
         error: "E is for error",
         backtrace: vec!["E", "A"]
@@ -406,8 +407,8 @@ fn orphan() {
                 "D" => ProcessResult::Error("D is dead"),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok.len(), 0);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err, vec![super::Error {
         error: "D is dead",
         backtrace: vec!["D"]
@@ -431,8 +432,8 @@ fn simultaneous_register_and_error() {
                 "B" => ProcessResult::Changed(vec!["A"]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok.len(), 0);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err, vec![super::Error {
         error: "An error",
         backtrace: vec!["A"]
@@ -449,8 +450,8 @@ fn simultaneous_register_and_error() {
                 "B" => ProcessResult::Changed(vec!["A"]),
                 _ => unreachable!(),
             }
-        }, |_|{}));
-    assert_eq!(ok.len(), 0);
+        }, |_|{}), DoCompleted::Yes);
+    assert_eq!(ok.unwrap().len(), 0);
     assert_eq!(err, vec![super::Error {
         error: "An error",
         backtrace: vec!["A"]
index 94f132562b5ea460cadae948fb116de58e46e0d6..3d17824608cc81b485a35440e272387b0b7884e3 100644 (file)
@@ -31,7 +31,7 @@ impl Svh {
     /// compute the SVH from some HIR, you want the `calculate_svh`
     /// function found in `librustc_incremental`.
     pub fn new(hash: u64) -> Svh {
-        Svh { hash: hash }
+        Svh { hash }
     }
 
     pub fn as_u64(&self) -> u64 {
index e8fdaddaeb89cd5a3e654f196c3dd9007030707f..6c7982242bfada275219bc82d01eac49235190b6 100644 (file)
@@ -952,7 +952,7 @@ fn build_controller(self: Box<Self>,
             control.compilation_done.callback = box move |state| {
                 old_callback(state);
                 let sess = state.session;
-                println!("Fuel used by {}: {}",
+                eprintln!("Fuel used by {}: {}",
                     sess.print_fuel_crate.as_ref().unwrap(),
                     sess.print_fuel.get());
             }
index 0b788a8fd97630523487e41bc6a172a52500169d..4ce87a9675a80d4f8f76740fc6eb58fc11170ed7 100644 (file)
@@ -795,7 +795,7 @@ fn get_lints(&self) -> LintArray {
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes {
     fn check_foreign_item(&mut self, cx: &LateContext, it: &hir::ForeignItem) {
-        let mut vis = ImproperCTypesVisitor { cx: cx };
+        let mut vis = ImproperCTypesVisitor { cx };
         let abi = cx.tcx.hir.get_foreign_abi(it.id);
         if abi != Abi::RustIntrinsic && abi != Abi::PlatformIntrinsic {
             match it.node {
index a855c947078806567cb9bb0480825d87bb930ee0..c9df36c5e236aa1dce3d83cc7c7c248d088f5696 100644 (file)
@@ -323,7 +323,7 @@ fn encode_info_for_items(&mut self) -> Index {
         index.record(DefId::local(CRATE_DEF_INDEX),
                      IsolatedEncoder::encode_info_for_mod,
                      FromId(CRATE_NODE_ID, (&krate.module, &krate.attrs, &vis)));
-        let mut visitor = EncodeVisitor { index: index };
+        let mut visitor = EncodeVisitor { index };
         krate.visit_all_item_likes(&mut visitor.as_deep_visitor());
         for macro_def in &krate.exported_macros {
             visitor.visit_macro_def(macro_def);
index db56ce4627410408318632f98e3ee53ac4ce9279..c432826dca865de3a8cba3850b947966b462a1b1 100644 (file)
@@ -21,7 +21,6 @@
 use rustc_data_structures::indexed_vec::IndexVec;
 use rustc_data_structures::bit_set::BitSet;
 use std::fmt;
-use std::hash::Hash;
 use std::ops::Index;
 
 crate struct BorrowSet<'tcx> {
@@ -233,21 +232,13 @@ fn visit_assign(
 
             self.insert_as_pending_if_two_phase(location, &assigned_place, region, kind, idx);
 
-            insert(&mut self.region_map, &region, idx);
+            self.region_map.entry(region).or_default().insert(idx);
             if let Some(local) = borrowed_place.root_local() {
-                insert(&mut self.local_map, &local, idx);
+                self.local_map.entry(local).or_default().insert(idx);
             }
         }
 
-        return self.super_assign(block, assigned_place, rvalue, location);
-
-        fn insert<'a, K, V>(map: &'a mut FxHashMap<K, FxHashSet<V>>, k: &K, v: V)
-        where
-            K: Clone + Eq + Hash,
-            V: Eq + Hash,
-        {
-            map.entry(k.clone()).or_default().insert(v);
-        }
+        self.super_assign(block, assigned_place, rvalue, location)
     }
 
     fn visit_place(
index b3e62788256836a046e164a0bb4bece440b37807..99badd5a03fe6ee9840bf0f0e9d985b100ed1035 100644 (file)
@@ -453,7 +453,7 @@ pub fn exit_scope(&mut self,
         }
         let scope = &self.scopes[len - scope_count];
         self.cfg.terminate(block, scope.source_info(span),
-                           TerminatorKind::Goto { target: target });
+                           TerminatorKind::Goto { target });
     }
 
     /// Creates a path that performs all required cleanup for dropping a generator.
@@ -1019,7 +1019,7 @@ fn build_diverge_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
         } else {
             let block = cfg.start_new_cleanup_block();
             cfg.push_end_region(tcx, block, source_info(span), scope.region_scope);
-            cfg.terminate(block, source_info(span), TerminatorKind::Goto { target: target });
+            cfg.terminate(block, source_info(span), TerminatorKind::Goto { target });
             *cached_block = Some(block);
             block
         }
index 2658d7f59a07f40f240bb0f3ac694366cb0febe1..011887090eefe8002f3ffffc9b02f2ef415b718c 100644 (file)
@@ -539,10 +539,10 @@ fn validate_const<'a, 'tcx>(
     let val = (|| {
         let op = ecx.const_to_op(constant)?;
         let mut ref_tracking = RefTracking::new(op);
-        while let Some((op, mut path)) = ref_tracking.todo.pop() {
+        while let Some((op, path)) = ref_tracking.todo.pop() {
             ecx.validate_operand(
                 op,
-                &mut path,
+                path,
                 Some(&mut ref_tracking),
                 /* const_mode */ true,
             )?;
index 8d186597b142c32517a3ccd680549971c9595780..1e279d8dd97083295f2d74e9cf94545bd6aad010 100644 (file)
@@ -28,7 +28,7 @@ pub struct HaveBeenBorrowedLocals<'a, 'tcx: 'a> {
 impl<'a, 'tcx: 'a> HaveBeenBorrowedLocals<'a, 'tcx> {
     pub fn new(mir: &'a Mir<'tcx>)
                -> Self {
-        HaveBeenBorrowedLocals { mir: mir }
+        HaveBeenBorrowedLocals { mir }
     }
 
     pub fn mir(&self) -> &Mir<'tcx> {
index ab03ace23d7b4ef635a9c39f6e82bee7da5dc15e..c8faa34df8a2bcda20bbf9320f4709834807b373 100644 (file)
@@ -21,7 +21,7 @@ pub struct MaybeStorageLive<'a, 'tcx: 'a> {
 impl<'a, 'tcx: 'a> MaybeStorageLive<'a, 'tcx> {
     pub fn new(mir: &'a Mir<'tcx>)
                -> Self {
-        MaybeStorageLive { mir: mir }
+        MaybeStorageLive { mir }
     }
 
     pub fn mir(&self) -> &Mir<'tcx> {
index f2ae5774da875f8eb014635cbcef5e05ba42f894..32f8752c31be7dfe92a27c3328912181fe8bcd28 100644 (file)
@@ -52,7 +52,7 @@ fn visit_body(&mut self, body: &'tcx hir::Body) {
 }
 
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    tcx.hir.krate().visit_all_item_likes(&mut OuterVisitor { tcx: tcx }.as_deep_visitor());
+    tcx.hir.krate().visit_all_item_likes(&mut OuterVisitor { tcx }.as_deep_visitor());
     tcx.sess.abort_if_errors();
 }
 
@@ -238,8 +238,8 @@ fn check_match(
                                                         is non-empty",
                                                        pat_ty));
                     span_help!(&mut err, scrut.span,
-                               "Please ensure that all possible cases are being handled; \
-                                possibly adding wildcards or more match arms.");
+                               "ensure that all possible cases are being handled, \
+                                possibly by adding wildcards or more match arms");
                     err.emit();
                 }
                 // If the type *is* uninhabited, it's vacuously exhaustive
index 0e1f8d1d32816ace04d2eb9e3189d9d4bfd49af9..0acb4052fd73e04d2852d66cffbe7042560fc064 100644 (file)
@@ -571,7 +571,7 @@ fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat) -> Pattern<'tcx> {
                                        })
                                        .collect();
 
-                        PatternKind::Leaf { subpatterns: subpatterns }
+                        PatternKind::Leaf { subpatterns }
                     }
                     ty::Error => { // Avoid ICE (#50577)
                         return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) };
@@ -778,13 +778,13 @@ fn lower_variant_or_leaf(
                         subpatterns,
                     }
                 } else {
-                    PatternKind::Leaf { subpatterns: subpatterns }
+                    PatternKind::Leaf { subpatterns }
                 }
             }
 
             Def::Struct(..) | Def::StructCtor(..) | Def::Union(..) |
             Def::TyAlias(..) | Def::AssociatedTy(..) | Def::SelfTy(..) | Def::SelfCtor(..) => {
-                PatternKind::Leaf { subpatterns: subpatterns }
+                PatternKind::Leaf { subpatterns }
             }
 
             _ => {
index fc13c5fef2dda2a599fd5b5835348a0aacd91cb7..e6267012dc27587848c9b42c105f429b2cb8ded8 100644 (file)
@@ -521,7 +521,7 @@ pub(super) fn pop_stack_frame(&mut self) -> EvalResult<'tcx> {
                 // return place is always a local and then this cannot happen.
                 self.validate_operand(
                     self.place_to_op(return_place)?,
-                    &mut vec![],
+                    vec![],
                     None,
                     /*const_mode*/false,
                 )?;
index bed938a534f4d0439e903e1fd6ee0d73de75d644..cb2a750f4e3b6cc4a987a5fe88ee6ac31ff9833c 100644 (file)
@@ -140,7 +140,7 @@ pub fn emulate_intrinsic(
                     "unchecked_shr" => BinOp::Shr,
                     _ => bug!("Already checked for int ops")
                 };
-                let (val, overflowed) = self.binary_op_val(bin_op, l, r)?;
+                let (val, overflowed) = self.binary_op_imm(bin_op, l, r)?;
                 if overflowed {
                     let layout = self.layout_of(substs.type_at(0))?;
                     let r_val =  r.to_scalar()?.to_bits(layout.size)?;
index e9d181479e52e9962735625b392a825d6d05a8e6..27cf28ef41e8ac3a261d2d0a0a1d01dd3cdc97b7 100644 (file)
 
 use rustc::hir::{self, def_id::DefId};
 use rustc::mir;
-use rustc::ty::{self, Ty, layout::{Size, TyLayout}, query::TyCtxtAt};
+use rustc::ty::{self, layout::{Size, TyLayout}, query::TyCtxtAt};
 
 use super::{
     Allocation, AllocId, EvalResult, Scalar,
-    EvalContext, PlaceTy, OpTy, Pointer, MemPlace, MemoryKind,
+    EvalContext, PlaceTy, MPlaceTy, OpTy, Pointer, MemoryKind,
 };
 
 /// Whether this kind of memory is allowed to leak
@@ -217,26 +217,22 @@ fn tag_new_allocation(
     #[inline]
     fn tag_reference(
         _ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
-        place: MemPlace<Self::PointerTag>,
-        _ty: Ty<'tcx>,
-        _size: Size,
+        place: MPlaceTy<'tcx, Self::PointerTag>,
         _mutability: Option<hir::Mutability>,
-    ) -> EvalResult<'tcx, MemPlace<Self::PointerTag>> {
-        Ok(place)
+    ) -> EvalResult<'tcx, Scalar<Self::PointerTag>> {
+        Ok(place.ptr)
     }
 
     /// Executed when evaluating the `*` operator: Following a reference.
-    /// This has the change to adjust the tag.  It should not change anything else!
+    /// This has the chance to adjust the tag.  It should not change anything else!
     /// `mutability` can be `None` in case a raw ptr is being dereferenced.
     #[inline]
     fn tag_dereference(
         _ecx: &EvalContext<'a, 'mir, 'tcx, Self>,
-        place: MemPlace<Self::PointerTag>,
-        _ty: Ty<'tcx>,
-        _size: Size,
+        place: MPlaceTy<'tcx, Self::PointerTag>,
         _mutability: Option<hir::Mutability>,
-    ) -> EvalResult<'tcx, MemPlace<Self::PointerTag>> {
-        Ok(place)
+    ) -> EvalResult<'tcx, Scalar<Self::PointerTag>> {
+        Ok(place.ptr)
     }
 
     /// Execute a validation operation
index a0231f3feb13a409f04bf9d9c2d4d0e59fb7c639..6a109efe3c43e2cc3ae6dcc9b61e90852653b0c4 100644 (file)
@@ -730,6 +730,11 @@ pub fn intern_static(
             if self.alloc_map.contains_key(&alloc) {
                 // Not yet interned, so proceed recursively
                 self.intern_static(alloc, mutability)?;
+            } else if self.dead_alloc_map.contains_key(&alloc) {
+                // dangling pointer
+                return err!(ValidationFailure(
+                    "encountered dangling pointer in final constant".into(),
+                ))
             }
         }
         Ok(())
index 6b31c675cc7d6a1a5ce9bfd881c8df696fc01372..82fe08fa038a4ad32c9deba323f34c4214aab597 100644 (file)
@@ -23,6 +23,7 @@
 mod traits;
 mod validity;
 mod intrinsics;
+mod visitor;
 
 pub use rustc::mir::interpret::*; // have all the `interpret` symbols in one place: here
 
@@ -38,4 +39,6 @@
 
 pub use self::operand::{ScalarMaybeUndef, Immediate, ImmTy, Operand, OpTy};
 
+pub use self::visitor::ValueVisitor;
+
 pub use self::validity::RefTracking;
index 6f66dd1e70a55bc0b53d75a5473fe38b0739ea3f..83a2d14b7ca4cdf9896d81e46758e697b6b67de0 100644 (file)
@@ -12,6 +12,7 @@
 //! All high-level functions to read from memory work on operands as sources.
 
 use std::convert::TryInto;
+use std::fmt;
 
 use rustc::{mir, ty};
 use rustc::ty::layout::{self, Size, LayoutOf, TyLayout, HasDataLayout, IntegerExt};
@@ -36,6 +37,15 @@ fn from(s: Scalar<Tag>) -> Self {
     }
 }
 
+impl<Tag> fmt::Display for ScalarMaybeUndef<Tag> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self {
+            ScalarMaybeUndef::Undef => write!(f, "uninitialized bytes"),
+            ScalarMaybeUndef::Scalar(s) => write!(f, "{}", s),
+        }
+    }
+}
+
 impl<'tcx> ScalarMaybeUndef<()> {
     #[inline]
     pub fn with_default_tag<Tag>(self) -> ScalarMaybeUndef<Tag>
@@ -732,8 +742,12 @@ pub fn read_discriminant(
         Ok(match rval.layout.variants {
             layout::Variants::Single { .. } => bug!(),
             layout::Variants::Tagged { .. } => {
+                let bits_discr = match raw_discr.to_bits(discr_val.layout.size) {
+                    Ok(raw_discr) => raw_discr,
+                    Err(_) => return err!(InvalidDiscriminant(raw_discr.erase_tag())),
+                };
                 let real_discr = if discr_val.layout.ty.is_signed() {
-                    let i = raw_discr.to_bits(discr_val.layout.size)? as i128;
+                    let i = bits_discr as i128;
                     // going from layout tag type to typeck discriminant type
                     // requires first sign extending with the layout discriminant
                     let shift = 128 - discr_val.layout.size.bits();
@@ -748,7 +762,7 @@ pub fn read_discriminant(
                     let truncatee = sexted as u128;
                     (truncatee << shift) >> shift
                 } else {
-                    raw_discr.to_bits(discr_val.layout.size)?
+                    bits_discr
                 };
                 // Make sure we catch invalid discriminants
                 let index = rval.layout.ty
@@ -756,7 +770,7 @@ pub fn read_discriminant(
                     .expect("tagged layout for non adt")
                     .discriminants(self.tcx.tcx)
                     .position(|var| var.val == real_discr)
-                    .ok_or_else(|| EvalErrorKind::InvalidDiscriminant(real_discr))?;
+                    .ok_or_else(|| EvalErrorKind::InvalidDiscriminant(raw_discr.erase_tag()))?;
                 (real_discr, index)
             },
             layout::Variants::NicheFilling {
index 2c6b8732fdbb9213efcd04e5376db9788c82e8fc..31824d5ec4a93380b2ad428361f36505e682c903 100644 (file)
@@ -28,7 +28,7 @@ pub fn binop_with_overflow(
         right: ImmTy<'tcx, M::PointerTag>,
         dest: PlaceTy<'tcx, M::PointerTag>,
     ) -> EvalResult<'tcx> {
-        let (val, overflowed) = self.binary_op_val(op, left, right)?;
+        let (val, overflowed) = self.binary_op_imm(op, left, right)?;
         let val = Immediate::ScalarPair(val.into(), Scalar::from_bool(overflowed).into());
         self.write_immediate(val, dest)
     }
@@ -42,7 +42,7 @@ pub fn binop_ignore_overflow(
         right: ImmTy<'tcx, M::PointerTag>,
         dest: PlaceTy<'tcx, M::PointerTag>,
     ) -> EvalResult<'tcx> {
-        let (val, _overflowed) = self.binary_op_val(op, left, right)?;
+        let (val, _overflowed) = self.binary_op_imm(op, left, right)?;
         self.write_scalar(val, dest)
     }
 }
@@ -283,9 +283,9 @@ fn binary_int_op(
     }
 
     /// Convenience wrapper that's useful when keeping the layout together with the
-    /// value.
+    /// immediate value.
     #[inline]
-    pub fn binary_op_val(
+    pub fn binary_op_imm(
         &self,
         bin_op: mir::BinOp,
         left: ImmTy<'tcx, M::PointerTag>,
index fa4d31846df4a3de276c2fa8799a248c5c09e316..19430c85cf73c20877b02ab7451bcb0e19f82a2a 100644 (file)
@@ -278,11 +278,9 @@ pub fn ref_to_mplace(
         let meta = val.to_meta()?;
         let ptr = val.to_scalar_ptr()?;
         let mplace = MemPlace { ptr, align, meta };
+        let mut mplace = MPlaceTy { mplace, layout };
         // Pointer tag tracking might want to adjust the tag.
-        let mplace = if M::ENABLE_PTR_TRACKING_HOOKS {
-            let (size, _) = self.size_and_align_of(meta, layout)?
-                // for extern types, just cover what we can
-                .unwrap_or_else(|| layout.size_and_align());
+        if M::ENABLE_PTR_TRACKING_HOOKS {
             let mutbl = match val.layout.ty.sty {
                 // `builtin_deref` considers boxes immutable, that's useless for our purposes
                 ty::Ref(_, _, mutbl) => Some(mutbl),
@@ -290,11 +288,10 @@ pub fn ref_to_mplace(
                 ty::RawPtr(_) => None,
                 _ => bug!("Unexpected pointer type {}", val.layout.ty.sty),
             };
-            M::tag_dereference(self, mplace, pointee_type, size, mutbl)?
-        } else {
-            mplace
-        };
-        Ok(MPlaceTy { mplace, layout })
+            mplace.mplace.ptr = M::tag_dereference(self, mplace, mutbl)?;
+        }
+        // Done
+        Ok(mplace)
     }
 
     /// Turn a mplace into a (thin or fat) pointer, as a reference, pointing to the same space.
@@ -302,18 +299,13 @@ pub fn ref_to_mplace(
     /// `mutbl` indicates whether we are create a shared or mutable ref, or a raw pointer (`None`).
     pub fn create_ref(
         &mut self,
-        place: MPlaceTy<'tcx, M::PointerTag>,
+        mut place: MPlaceTy<'tcx, M::PointerTag>,
         mutbl: Option<hir::Mutability>,
     ) -> EvalResult<'tcx, Immediate<M::PointerTag>> {
         // Pointer tag tracking might want to adjust the tag
-        let place = if M::ENABLE_PTR_TRACKING_HOOKS {
-            let (size, _) = self.size_and_align_of_mplace(place)?
-                // for extern types, just cover what we can
-                .unwrap_or_else(|| place.layout.size_and_align());
-            M::tag_reference(self, *place, place.layout.ty, size, mutbl)?
-        } else {
-            *place
-        };
+        if M::ENABLE_PTR_TRACKING_HOOKS {
+            place.mplace.ptr = M::tag_reference(self, place, mutbl)?
+        }
         Ok(match place.meta {
             None => Immediate::Scalar(place.ptr.into()),
             Some(meta) => Immediate::ScalarPair(place.ptr.into(), meta.into()),
@@ -489,6 +481,8 @@ pub fn mplace_projection(
 
     /// Get the place of a field inside the place, and also the field's type.
     /// Just a convenience function, but used quite a bit.
+    /// This is the only projection that might have a side-effect: We cannot project
+    /// into the field of a local `ScalarPair`, we have to first allocate it.
     pub fn place_field(
         &mut self,
         base: PlaceTy<'tcx, M::PointerTag>,
@@ -501,7 +495,7 @@ pub fn place_field(
     }
 
     pub fn place_downcast(
-        &mut self,
+        &self,
         base: PlaceTy<'tcx, M::PointerTag>,
         variant: usize,
     ) -> EvalResult<'tcx, PlaceTy<'tcx, M::PointerTag>> {
@@ -643,7 +637,7 @@ pub fn write_immediate(
 
         if M::enforce_validity(self) {
             // Data got changed, better make sure it matches the type!
-            self.validate_operand(self.place_to_op(dest)?, &mut vec![], None, /*const_mode*/false)?;
+            self.validate_operand(self.place_to_op(dest)?, vec![], None, /*const_mode*/false)?;
         }
 
         Ok(())
@@ -765,7 +759,7 @@ pub fn copy_op(
 
         if M::enforce_validity(self) {
             // Data got changed, better make sure it matches the type!
-            self.validate_operand(self.place_to_op(dest)?, &mut vec![], None, /*const_mode*/false)?;
+            self.validate_operand(self.place_to_op(dest)?, vec![], None, /*const_mode*/false)?;
         }
 
         Ok(())
@@ -843,7 +837,7 @@ pub fn copy_op_transmute(
 
         if M::enforce_validity(self) {
             // Data got changed, better make sure it matches the type!
-            self.validate_operand(dest.into(), &mut vec![], None, /*const_mode*/false)?;
+            self.validate_operand(dest.into(), vec![], None, /*const_mode*/false)?;
         }
 
         Ok(())
index 4dbae3c8c3d280ab465ff57318951287f7b74b7b..8fde0c9b8afd93e78d25ff9f03468be8ac4edfce 100644 (file)
@@ -10,6 +10,7 @@
 
 use std::fmt::Write;
 use std::hash::Hash;
+use std::ops::RangeInclusive;
 
 use syntax_pos::symbol::Symbol;
 use rustc::ty::layout::{self, Size, Align, TyLayout, LayoutOf};
 };
 
 use super::{
-    ImmTy, OpTy, MPlaceTy, Machine, EvalContext, ScalarMaybeUndef
+    OpTy, MPlaceTy, ImmTy, Machine, EvalContext, ValueVisitor
 };
 
 macro_rules! validation_failure {
     ($what:expr, $where:expr, $details:expr) => {{
-        let where_ = path_format($where);
+        let where_ = path_format(&$where);
         let where_ = if where_.is_empty() {
             String::new()
         } else {
@@ -37,7 +38,7 @@ macro_rules! validation_failure {
         )))
     }};
     ($what:expr, $where:expr) => {{
-        let where_ = path_format($where);
+        let where_ = path_format(&$where);
         let where_ = if where_.is_empty() {
             String::new()
         } else {
@@ -78,6 +79,7 @@ pub enum PathElem {
     TupleElem(usize),
     Deref,
     Tag,
+    DynDowncast,
 }
 
 /// State for tracking recursive validation of references
@@ -97,15 +99,6 @@ pub fn new(op: OpTy<'tcx, Tag>) -> Self {
     }
 }
 
-// Adding a Deref and making a copy of the path to be put into the queue
-// always go together.  This one does it with only new allocation.
-fn path_clone_and_deref(path: &Vec<PathElem>) -> Vec<PathElem> {
-    let mut new_path = Vec::with_capacity(path.len()+1);
-    new_path.clone_from(path);
-    new_path.push(PathElem::Deref);
-    new_path
-}
-
 /// Format a path
 fn path_format(path: &Vec<PathElem>) -> String {
     use self::PathElem::*;
@@ -113,64 +106,186 @@ fn path_format(path: &Vec<PathElem>) -> String {
     let mut out = String::new();
     for elem in path.iter() {
         match elem {
-            Field(name) => write!(out, ".{}", name).unwrap(),
-            ClosureVar(name) => write!(out, ".<closure-var({})>", name).unwrap(),
-            TupleElem(idx) => write!(out, ".{}", idx).unwrap(),
-            ArrayElem(idx) => write!(out, "[{}]", idx).unwrap(),
+            Field(name) => write!(out, ".{}", name),
+            ClosureVar(name) => write!(out, ".<closure-var({})>", name),
+            TupleElem(idx) => write!(out, ".{}", idx),
+            ArrayElem(idx) => write!(out, "[{}]", idx),
             Deref =>
                 // This does not match Rust syntax, but it is more readable for long paths -- and
                 // some of the other items here also are not Rust syntax.  Actually we can't
                 // even use the usual syntax because we are just showing the projections,
                 // not the root.
-                write!(out, ".<deref>").unwrap(),
-            Tag => write!(out, ".<enum-tag>").unwrap(),
-        }
+                write!(out, ".<deref>"),
+            Tag => write!(out, ".<enum-tag>"),
+            DynDowncast => write!(out, ".<dyn-downcast>"),
+        }.unwrap()
     }
     out
 }
 
-fn scalar_format<Tag>(value: ScalarMaybeUndef<Tag>) -> String {
-    match value {
-        ScalarMaybeUndef::Undef =>
-            "uninitialized bytes".to_owned(),
-        ScalarMaybeUndef::Scalar(Scalar::Ptr(_)) =>
-            "a pointer".to_owned(),
-        ScalarMaybeUndef::Scalar(Scalar::Bits { bits, .. }) =>
-            bits.to_string(),
+// Test if a range that wraps at overflow contains `test`
+fn wrapping_range_contains(r: &RangeInclusive<u128>, test: u128) -> bool {
+    let (lo, hi) = r.clone().into_inner();
+    if lo > hi {
+        // Wrapped
+        (..=hi).contains(&test) || (lo..).contains(&test)
+    } else {
+        // Normal
+        r.contains(&test)
     }
 }
 
-impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
-    /// Make sure that `value` is valid for `ty`, *assuming* `ty` is a primitive type.
-    fn validate_primitive_type(
-        &self,
-        value: ImmTy<'tcx, M::PointerTag>,
-        path: &Vec<PathElem>,
-        ref_tracking: Option<&mut RefTracking<'tcx, M::PointerTag>>,
-        const_mode: bool,
+// Formats such that a sentence like "expected something {}" to mean
+// "expected something <in the given range>" makes sense.
+fn wrapping_range_format(r: &RangeInclusive<u128>, max_hi: u128) -> String {
+    let (lo, hi) = r.clone().into_inner();
+    debug_assert!(hi <= max_hi);
+    if lo > hi {
+        format!("less or equal to {}, or greater or equal to {}", hi, lo)
+    } else {
+        if lo == 0 {
+            debug_assert!(hi < max_hi, "should not be printing if the range covers everything");
+            format!("less or equal to {}", hi)
+        } else if hi == max_hi {
+            format!("greater or equal to {}", lo)
+        } else {
+            format!("in the range {:?}", r)
+        }
+    }
+}
+
+struct ValidityVisitor<'rt, 'a: 'rt, 'mir: 'rt, 'tcx: 'a+'rt+'mir, M: Machine<'a, 'mir, 'tcx>+'rt> {
+    /// The `path` may be pushed to, but the part that is present when a function
+    /// starts must not be changed!  `visit_fields` and `visit_array` rely on
+    /// this stack discipline.
+    path: Vec<PathElem>,
+    ref_tracking: Option<&'rt mut RefTracking<'tcx, M::PointerTag>>,
+    const_mode: bool,
+    ecx: &'rt EvalContext<'a, 'mir, 'tcx, M>,
+}
+
+impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> ValidityVisitor<'rt, 'a, 'mir, 'tcx, M> {
+    fn push_aggregate_field_path_elem(
+        &mut self,
+        layout: TyLayout<'tcx>,
+        field: usize,
+    ) {
+        let elem = match layout.ty.sty {
+            // generators and closures.
+            ty::Closure(def_id, _) | ty::Generator(def_id, _, _) => {
+                if let Some(upvar) = self.ecx.tcx.optimized_mir(def_id).upvar_decls.get(field) {
+                    PathElem::ClosureVar(upvar.debug_name)
+                } else {
+                    // Sometimes the index is beyond the number of freevars (seen
+                    // for a generator).
+                    PathElem::ClosureVar(Symbol::intern(&field.to_string()))
+                }
+            }
+
+            // tuples
+            ty::Tuple(_) => PathElem::TupleElem(field),
+
+            // enums
+            ty::Adt(def, ..) if def.is_enum() => {
+                // we might be projecting *to* a variant, or to a field *in*a variant.
+                match layout.variants {
+                    layout::Variants::Single { index } =>
+                        // Inside a variant
+                        PathElem::Field(def.variants[index].fields[field].ident.name),
+                    _ =>
+                        // To a variant
+                        PathElem::Field(def.variants[field].name)
+                }
+            }
+
+            // other ADTs
+            ty::Adt(def, _) => PathElem::Field(def.non_enum_variant().fields[field].ident.name),
+
+            // arrays/slices
+            ty::Array(..) | ty::Slice(..) => PathElem::ArrayElem(field),
+
+            // dyn traits
+            ty::Dynamic(..) => PathElem::DynDowncast,
+
+            // nothing else has an aggregate layout
+            _ => bug!("aggregate_field_path_elem: got non-aggregate type {:?}", layout.ty),
+        };
+        self.path.push(elem);
+    }
+}
+
+impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>
+    ValueVisitor<'a, 'mir, 'tcx, M> for ValidityVisitor<'rt, 'a, 'mir, 'tcx, M>
+{
+    type V = OpTy<'tcx, M::PointerTag>;
+
+    #[inline(always)]
+    fn ecx(&self) -> &EvalContext<'a, 'mir, 'tcx, M> {
+        &self.ecx
+    }
+
+    #[inline]
+    fn visit_field(
+        &mut self,
+        old_op: OpTy<'tcx, M::PointerTag>,
+        field: usize,
+        new_op: OpTy<'tcx, M::PointerTag>
     ) -> EvalResult<'tcx> {
+        // Remember the old state
+        let path_len = self.path.len();
+        // Perform operation
+        self.push_aggregate_field_path_elem(old_op.layout, field);
+        self.visit_value(new_op)?;
+        // Undo changes
+        self.path.truncate(path_len);
+        Ok(())
+    }
+
+    #[inline]
+    fn visit_value(&mut self, op: OpTy<'tcx, M::PointerTag>) -> EvalResult<'tcx>
+    {
+        trace!("visit_value: {:?}, {:?}", *op, op.layout);
+        // Translate some possible errors to something nicer.
+        match self.walk_value(op) {
+            Ok(()) => Ok(()),
+            Err(err) => match err.kind {
+                EvalErrorKind::InvalidDiscriminant(val) =>
+                    validation_failure!(
+                        val, self.path, "a valid enum discriminant"
+                    ),
+                EvalErrorKind::ReadPointerAsBytes =>
+                    validation_failure!(
+                        "a pointer", self.path, "plain bytes"
+                    ),
+                _ => Err(err),
+            }
+        }
+    }
+
+    fn visit_primitive(&mut self, value: ImmTy<'tcx, M::PointerTag>) -> EvalResult<'tcx>
+    {
         // Go over all the primitive types
         let ty = value.layout.ty;
         match ty.sty {
             ty::Bool => {
                 let value = value.to_scalar_or_undef();
                 try_validation!(value.to_bool(),
-                    scalar_format(value), path, "a boolean");
+                    value, self.path, "a boolean");
             },
             ty::Char => {
                 let value = value.to_scalar_or_undef();
                 try_validation!(value.to_char(),
-                    scalar_format(value), path, "a valid unicode codepoint");
+                    value, self.path, "a valid unicode codepoint");
             },
             ty::Float(_) | ty::Int(_) | ty::Uint(_) => {
                 // NOTE: Keep this in sync with the array optimization for int/float
                 // types below!
                 let size = value.layout.size;
                 let value = value.to_scalar_or_undef();
-                if const_mode {
+                if self.const_mode {
                     // Integers/floats in CTFE: Must be scalar bits, pointers are dangerous
                     try_validation!(value.to_bits(size),
-                        scalar_format(value), path, "initialized plain bits");
+                        value, self.path, "initialized plain bits");
                 } else {
                     // At run-time, for now, we accept *anything* for these types, including
                     // undef. We should fix that, but let's start low.
@@ -180,33 +295,33 @@ fn validate_primitive_type(
                 // No undef allowed here.  Eventually this should be consistent with
                 // the integer types.
                 let _ptr = try_validation!(value.to_scalar_ptr(),
-                    "undefined address in pointer", path);
+                    "undefined address in pointer", self.path);
                 let _meta = try_validation!(value.to_meta(),
-                    "uninitialized data in fat pointer metadata", path);
+                    "uninitialized data in fat pointer metadata", self.path);
             }
             _ if ty.is_box() || ty.is_region_ptr() => {
                 // Handle fat pointers.
                 // Check metadata early, for better diagnostics
                 let ptr = try_validation!(value.to_scalar_ptr(),
-                    "undefined address in pointer", path);
+                    "undefined address in pointer", self.path);
                 let meta = try_validation!(value.to_meta(),
-                    "uninitialized data in fat pointer metadata", path);
-                let layout = self.layout_of(value.layout.ty.builtin_deref(true).unwrap().ty)?;
+                    "uninitialized data in fat pointer metadata", self.path);
+                let layout = self.ecx.layout_of(value.layout.ty.builtin_deref(true).unwrap().ty)?;
                 if layout.is_unsized() {
-                    let tail = self.tcx.struct_tail(layout.ty);
+                    let tail = self.ecx.tcx.struct_tail(layout.ty);
                     match tail.sty {
                         ty::Dynamic(..) => {
                             let vtable = try_validation!(meta.unwrap().to_ptr(),
-                                "non-pointer vtable in fat pointer", path);
-                            try_validation!(self.read_drop_type_from_vtable(vtable),
-                                "invalid drop fn in vtable", path);
-                            try_validation!(self.read_size_and_align_from_vtable(vtable),
-                                "invalid size or align in vtable", path);
+                                "non-pointer vtable in fat pointer", self.path);
+                            try_validation!(self.ecx.read_drop_type_from_vtable(vtable),
+                                "invalid drop fn in vtable", self.path);
+                            try_validation!(self.ecx.read_size_and_align_from_vtable(vtable),
+                                "invalid size or align in vtable", self.path);
                             // FIXME: More checks for the vtable.
                         }
                         ty::Slice(..) | ty::Str => {
-                            try_validation!(meta.unwrap().to_usize(self),
-                                "non-integer slice length in fat pointer", path);
+                            try_validation!(meta.unwrap().to_usize(self.ecx),
+                                "non-integer slice length in fat pointer", self.path);
                         }
                         ty::Foreign(..) => {
                             // Unsized, but not fat.
@@ -216,25 +331,25 @@ fn validate_primitive_type(
                     }
                 }
                 // Make sure this is non-NULL and aligned
-                let (size, align) = self.size_and_align_of(meta, layout)?
+                let (size, align) = self.ecx.size_and_align_of(meta, layout)?
                     // for the purpose of validity, consider foreign types to have
                     // alignment and size determined by the layout (size will be 0,
                     // alignment should take attributes into account).
                     .unwrap_or_else(|| layout.size_and_align());
-                match self.memory.check_align(ptr, align) {
+                match self.ecx.memory.check_align(ptr, align) {
                     Ok(_) => {},
                     Err(err) => {
                         error!("{:?} is not aligned to {:?}", ptr, align);
                         match err.kind {
                             EvalErrorKind::InvalidNullPointerUsage =>
-                                return validation_failure!("NULL reference", path),
+                                return validation_failure!("NULL reference", self.path),
                             EvalErrorKind::AlignmentCheckFailed { .. } =>
-                                return validation_failure!("unaligned reference", path),
+                                return validation_failure!("unaligned reference", self.path),
                             _ =>
                                 return validation_failure!(
                                     "dangling (out-of-bounds) reference (might be NULL at \
                                         run-time)",
-                                    path
+                                    self.path
                                 ),
                         }
                     }
@@ -242,29 +357,29 @@ fn validate_primitive_type(
                 // Turn ptr into place.
                 // `ref_to_mplace` also calls the machine hook for (re)activating the tag,
                 // which in turn will (in full miri) check if the pointer is dereferencable.
-                let place = self.ref_to_mplace(value)?;
+                let place = self.ecx.ref_to_mplace(value)?;
                 // Recursive checking
-                if let Some(ref_tracking) = ref_tracking {
-                    assert!(const_mode, "We should only do recursie checking in const mode");
+                if let Some(ref mut ref_tracking) = self.ref_tracking {
+                    assert!(self.const_mode, "We should only do recursie checking in const mode");
                     if size != Size::ZERO {
                         // Non-ZST also have to be dereferencable
                         let ptr = try_validation!(place.ptr.to_ptr(),
-                            "integer pointer in non-ZST reference", path);
+                            "integer pointer in non-ZST reference", self.path);
                         // Skip validation entirely for some external statics
-                        let alloc_kind = self.tcx.alloc_map.lock().get(ptr.alloc_id);
+                        let alloc_kind = self.ecx.tcx.alloc_map.lock().get(ptr.alloc_id);
                         if let Some(AllocType::Static(did)) = alloc_kind {
                             // `extern static` cannot be validated as they have no body.
                             // FIXME: Statics from other crates are also skipped.
                             // They might be checked at a different type, but for now we
                             // want to avoid recursing too deeply.  This is not sound!
-                            if !did.is_local() || self.tcx.is_foreign_item(did) {
+                            if !did.is_local() || self.ecx.tcx.is_foreign_item(did) {
                                 return Ok(());
                             }
                         }
                         // Maintain the invariant that the place we are checking is
                         // already verified to be in-bounds.
-                        try_validation!(self.memory.check_bounds(ptr, size, false),
-                            "dangling (not entirely in bounds) reference", path);
+                        try_validation!(self.ecx.memory.check_bounds(ptr, size, false),
+                            "dangling (not entirely in bounds) reference", self.path);
                     }
                     // Check if we have encountered this pointer+layout combination
                     // before.  Proceed recursively even for integer pointers, no
@@ -273,35 +388,45 @@ fn validate_primitive_type(
                     let op = place.into();
                     if ref_tracking.seen.insert(op) {
                         trace!("Recursing below ptr {:#?}", *op);
-                        ref_tracking.todo.push((op, path_clone_and_deref(path)));
+                        // We need to clone the path anyway, make sure it gets created
+                        // with enough space for the additional `Deref`.
+                        let mut new_path = Vec::with_capacity(self.path.len()+1);
+                        new_path.clone_from(&self.path);
+                        new_path.push(PathElem::Deref);
+                        // Remember to come back to this later.
+                        ref_tracking.todo.push((op, new_path));
                     }
                 }
             }
             ty::FnPtr(_sig) => {
                 let value = value.to_scalar_or_undef();
                 let ptr = try_validation!(value.to_ptr(),
-                    scalar_format(value), path, "a pointer");
-                let _fn = try_validation!(self.memory.get_fn(ptr),
-                    scalar_format(value), path, "a function pointer");
+                    value, self.path, "a pointer");
+                let _fn = try_validation!(self.ecx.memory.get_fn(ptr),
+                    value, self.path, "a function pointer");
                 // FIXME: Check if the signature matches
             }
             // This should be all the primitive types
-            ty::Never => bug!("Uninhabited type should have been caught earlier"),
             _ => bug!("Unexpected primitive type {}", value.layout.ty)
         }
         Ok(())
     }
 
-    /// Make sure that `value` matches the
-    fn validate_scalar_layout(
-        &self,
-        value: ScalarMaybeUndef<M::PointerTag>,
-        size: Size,
-        path: &Vec<PathElem>,
+    fn visit_uninhabited(&mut self) -> EvalResult<'tcx>
+    {
+        validation_failure!("a value of an uninhabited type", self.path)
+    }
+
+    fn visit_scalar(
+        &mut self,
+        op: OpTy<'tcx, M::PointerTag>,
         layout: &layout::Scalar,
     ) -> EvalResult<'tcx> {
+        let value = self.ecx.read_scalar(op)?;
+        // Determine the allowed range
         let (lo, hi) = layout.valid_range.clone().into_inner();
-        let max_hi = u128::max_value() >> (128 - size.bits()); // as big as the size fits
+        // `max_hi` is as big as the size fits
+        let max_hi = u128::max_value() >> (128 - op.layout.size.bits());
         assert!(hi <= max_hi);
         // We could also write `(hi + 1) % (max_hi + 1) == lo` but `max_hi + 1` overflows for `u128`
         if (lo == 0 && hi == max_hi) || (hi + 1 == lo) {
@@ -310,7 +435,8 @@ fn validate_scalar_layout(
         }
         // At least one value is excluded. Get the bits.
         let value = try_validation!(value.not_undef(),
-            scalar_format(value), path, format!("something in the range {:?}", layout.valid_range));
+            value, self.path,
+            format!("something in the range {:?}", layout.valid_range));
         let bits = match value {
             Scalar::Ptr(ptr) => {
                 if lo == 1 && hi == max_hi {
@@ -318,13 +444,13 @@ fn validate_scalar_layout(
                     // We can call `check_align` to check non-NULL-ness, but have to also look
                     // for function pointers.
                     let non_null =
-                        self.memory.check_align(
+                        self.ecx.memory.check_align(
                             Scalar::Ptr(ptr), Align::from_bytes(1, 1).unwrap()
                         ).is_ok() ||
-                        self.memory.get_fn(ptr).is_ok();
+                        self.ecx.memory.get_fn(ptr).is_ok();
                     if !non_null {
                         // could be NULL
-                        return validation_failure!("a potentially NULL pointer", path);
+                        return validation_failure!("a potentially NULL pointer", self.path);
                     }
                     return Ok(());
                 } else {
@@ -332,294 +458,135 @@ fn validate_scalar_layout(
                     // value.
                     return validation_failure!(
                         "a pointer",
-                        path,
+                        self.path,
                         format!(
-                            "something that cannot possibly be outside the (wrapping) range {:?}",
-                            layout.valid_range
+                            "something that cannot possibly fail to be {}",
+                            wrapping_range_format(&layout.valid_range, max_hi)
                         )
                     );
                 }
             }
-            Scalar::Bits { bits, size: value_size } => {
-                assert_eq!(value_size as u64, size.bytes());
+            Scalar::Bits { bits, size } => {
+                assert_eq!(size as u64, op.layout.size.bytes());
                 bits
             }
         };
         // Now compare. This is slightly subtle because this is a special "wrap-around" range.
-        use std::ops::RangeInclusive;
-        let in_range = |bound: RangeInclusive<u128>| bound.contains(&bits);
-        if lo > hi {
-            // wrapping around
-            if in_range(0..=hi) || in_range(lo..=max_hi) {
-                Ok(())
-            } else {
-                validation_failure!(
-                    bits,
-                    path,
-                    format!("something in the range {:?} or {:?}", 0..=hi, lo..=max_hi)
-                )
-            }
+        if wrapping_range_contains(&layout.valid_range, bits) {
+            Ok(())
         } else {
-            if in_range(layout.valid_range.clone()) {
-                Ok(())
-            } else {
-                validation_failure!(
-                    bits,
-                    path,
-                    if hi == max_hi {
-                        format!("something greater or equal to {}", lo)
-                    } else {
-                        format!("something in the range {:?}", layout.valid_range)
-                    }
-                )
-            }
+            validation_failure!(
+                bits,
+                self.path,
+                format!("something {}", wrapping_range_format(&layout.valid_range, max_hi))
+            )
         }
     }
 
-    /// This function checks the data at `op`.  `op` is assumed to cover valid memory if it
-    /// is an indirect operand.
-    /// It will error if the bits at the destination do not match the ones described by the layout.
-    /// The `path` may be pushed to, but the part that is present when the function
-    /// starts must not be changed!
-    ///
-    /// `ref_tracking` can be None to avoid recursive checking below references.
-    /// This also toggles between "run-time" (no recursion) and "compile-time" (with recursion)
-    /// validation (e.g., pointer values are fine in integers at runtime).
-    pub fn validate_operand(
-        &self,
-        dest: OpTy<'tcx, M::PointerTag>,
-        path: &mut Vec<PathElem>,
-        mut ref_tracking: Option<&mut RefTracking<'tcx, M::PointerTag>>,
-        const_mode: bool,
+    fn visit_aggregate(
+        &mut self,
+        op: OpTy<'tcx, M::PointerTag>,
+        fields: impl Iterator<Item=EvalResult<'tcx, Self::V>>,
     ) -> EvalResult<'tcx> {
-        trace!("validate_operand: {:?}, {:?}", *dest, dest.layout.ty);
-
-        // If this is a multi-variant layout, we have find the right one and proceed with that.
-        // (No good reasoning to make this recursion, but it is equivalent to that.)
-        let dest = match dest.layout.variants {
-            layout::Variants::NicheFilling { .. } |
-            layout::Variants::Tagged { .. } => {
-                let variant = match self.read_discriminant(dest) {
-                    Ok(res) => res.1,
-                    Err(err) => match err.kind {
-                        EvalErrorKind::InvalidDiscriminant(val) =>
-                            return validation_failure!(
-                                format!("invalid enum discriminant {}", val), path
-                            ),
-                        _ =>
-                            return validation_failure!(
-                                String::from("non-integer enum discriminant"), path
-                            ),
-                    }
-                };
-                // Put the variant projection onto the path, as a field
-                path.push(PathElem::Field(dest.layout.ty
-                                          .ty_adt_def()
-                                          .unwrap()
-                                          .variants[variant].name));
-                // Proceed with this variant
-                let dest = self.operand_downcast(dest, variant)?;
-                trace!("variant layout: {:#?}", dest.layout);
-                dest
-            },
-            layout::Variants::Single { .. } => dest,
-        };
-
-        // First thing, find the real type:
-        // If it is a trait object, switch to the actual type that was used to create it.
-        let dest = match dest.layout.ty.sty {
-            ty::Dynamic(..) => {
-                let dest = dest.to_mem_place(); // immediate trait objects are not a thing
-                self.unpack_dyn_trait(dest)?.1.into()
-            },
-            _ => dest
-        };
-
-        // If this is a scalar, validate the scalar layout.
-        // Things can be aggregates and have scalar layout at the same time, and that
-        // is very relevant for `NonNull` and similar structs: We need to validate them
-        // at their scalar layout *before* descending into their fields.
-        // FIXME: We could avoid some redundant checks here. For newtypes wrapping
-        // scalars, we do the same check on every "level" (e.g. first we check
-        // MyNewtype and then the scalar in there).
-        match dest.layout.abi {
-            layout::Abi::Uninhabited =>
-                return validation_failure!("a value of an uninhabited type", path),
-            layout::Abi::Scalar(ref layout) => {
-                let value = try_validation!(self.read_scalar(dest),
-                            "uninitialized or unrepresentable data", path);
-                self.validate_scalar_layout(value, dest.layout.size, &path, layout)?;
+        match op.layout.ty.sty {
+            ty::Str => {
+                let mplace = op.to_mem_place(); // strings are never immediate
+                try_validation!(self.ecx.read_str(mplace),
+                    "uninitialized or non-UTF-8 data in str", self.path);
             }
-            // FIXME: Should we do something for ScalarPair? Vector?
-            _ => {}
-        }
-
-        // Check primitive types.  We do this after checking the scalar layout,
-        // just to have that done as well.  Primitives can have varying layout,
-        // so we check them separately and before aggregate handling.
-        // It is CRITICAL that we get this check right, or we might be
-        // validating the wrong thing!
-        let primitive = match dest.layout.fields {
-            // Primitives appear as Union with 0 fields -- except for fat pointers.
-            layout::FieldPlacement::Union(0) => true,
-            _ => dest.layout.ty.builtin_deref(true).is_some(),
-        };
-        if primitive {
-            let value = try_validation!(self.read_immediate(dest),
-                "uninitialized or unrepresentable data", path);
-            return self.validate_primitive_type(
-                value,
-                &path,
-                ref_tracking,
-                const_mode,
-            );
-        }
-
-        // Validate all fields of compound data structures
-        let path_len = path.len(); // Remember the length, in case we need to truncate
-        match dest.layout.fields {
-            layout::FieldPlacement::Union(fields) => {
-                // Empty unions are not accepted by rustc. That's great, it means we can
-                // use that as an unambiguous signal for detecting primitives.  Make sure
-                // we did not miss any primitive.
-                debug_assert!(fields > 0);
-                // We can't check unions, their bits are allowed to be anything.
-                // The fields don't need to correspond to any bit pattern of the union's fields.
-                // See https://github.com/rust-lang/rust/issues/32836#issuecomment-406875389
-            },
-            layout::FieldPlacement::Arbitrary { ref offsets, .. } => {
-                // Go look at all the fields
-                for i in 0..offsets.len() {
-                    let field = self.operand_field(dest, i as u64)?;
-                    path.push(self.aggregate_field_path_elem(dest.layout, i));
-                    self.validate_operand(
-                        field,
-                        path,
-                        ref_tracking.as_mut().map(|r| &mut **r),
-                        const_mode,
-                    )?;
-                    path.truncate(path_len);
+            ty::Array(tys, ..) | ty::Slice(tys) if {
+                // This optimization applies only for integer and floating point types
+                // (i.e., types that can hold arbitrary bytes).
+                match tys.sty {
+                    ty::Int(..) | ty::Uint(..) | ty::Float(..) => true,
+                    _ => false,
                 }
-            }
-            layout::FieldPlacement::Array { stride, .. } => {
-                let dest = if dest.layout.is_zst() {
+            } => {
+                let mplace = if op.layout.is_zst() {
                     // it's a ZST, the memory content cannot matter
-                    MPlaceTy::dangling(dest.layout, self)
+                    MPlaceTy::dangling(op.layout, self.ecx)
                 } else {
                     // non-ZST array/slice/str cannot be immediate
-                    dest.to_mem_place()
+                    op.to_mem_place()
                 };
-                match dest.layout.ty.sty {
-                    // Special handling for strings to verify UTF-8
-                    ty::Str => {
-                        try_validation!(self.read_str(dest),
-                            "uninitialized or non-UTF-8 data in str", path);
-                    }
-                    // Special handling for arrays/slices of builtin integer types
-                    ty::Array(tys, ..) | ty::Slice(tys) if {
-                        // This optimization applies only for integer and floating point types
-                        // (i.e., types that can hold arbitrary bytes).
-                        match tys.sty {
-                            ty::Int(..) | ty::Uint(..) | ty::Float(..) => true,
-                            _ => false,
-                        }
-                    } => {
-                        // This is the length of the array/slice.
-                        let len = dest.len(self)?;
-                        // Since primitive types are naturally aligned and tightly packed in arrays,
-                        // we can use the stride to get the size of the integral type.
-                        let ty_size = stride.bytes();
-                        // This is the size in bytes of the whole array.
-                        let size = Size::from_bytes(ty_size * len);
-
-                        // NOTE: Keep this in sync with the handling of integer and float
-                        // types above, in `validate_primitive_type`.
-                        // In run-time mode, we accept pointers in here.  This is actually more
-                        // permissive than a per-element check would be, e.g. we accept
-                        // an &[u8] that contains a pointer even though bytewise checking would
-                        // reject it.  However, that's good: We don't inherently want
-                        // to reject those pointers, we just do not have the machinery to
-                        // talk about parts of a pointer.
-                        // We also accept undef, for consistency with the type-based checks.
-                        match self.memory.check_bytes(
-                            dest.ptr,
-                            size,
-                            /*allow_ptr_and_undef*/!const_mode,
-                        ) {
-                            // In the happy case, we needn't check anything else.
-                            Ok(()) => {},
-                            // Some error happened, try to provide a more detailed description.
-                            Err(err) => {
-                                // For some errors we might be able to provide extra information
-                                match err.kind {
-                                    EvalErrorKind::ReadUndefBytes(offset) => {
-                                        // Some byte was undefined, determine which
-                                        // element that byte belongs to so we can
-                                        // provide an index.
-                                        let i = (offset.bytes() / ty_size) as usize;
-                                        path.push(PathElem::ArrayElem(i));
-
-                                        return validation_failure!(
-                                            "undefined bytes", path
-                                        )
-                                    },
-                                    // Other errors shouldn't be possible
-                                    _ => return Err(err),
-                                }
-                            }
-                        }
-                    },
-                    _ => {
-                        // This handles the unsized case correctly as well, as well as
-                        // SIMD an all sorts of other array-like types.
-                        for (i, field) in self.mplace_array_fields(dest)?.enumerate() {
-                            let field = field?;
-                            path.push(PathElem::ArrayElem(i));
-                            self.validate_operand(
-                                field.into(),
-                                path,
-                                ref_tracking.as_mut().map(|r| &mut **r),
-                                const_mode,
-                            )?;
-                            path.truncate(path_len);
+                // This is the length of the array/slice.
+                let len = mplace.len(self.ecx)?;
+                // This is the element type size.
+                let ty_size = self.ecx.layout_of(tys)?.size;
+                // This is the size in bytes of the whole array.
+                let size = ty_size * len;
+
+                // NOTE: Keep this in sync with the handling of integer and float
+                // types above, in `visit_primitive`.
+                // In run-time mode, we accept pointers in here.  This is actually more
+                // permissive than a per-element check would be, e.g. we accept
+                // an &[u8] that contains a pointer even though bytewise checking would
+                // reject it.  However, that's good: We don't inherently want
+                // to reject those pointers, we just do not have the machinery to
+                // talk about parts of a pointer.
+                // We also accept undef, for consistency with the type-based checks.
+                match self.ecx.memory.check_bytes(
+                    mplace.ptr,
+                    size,
+                    /*allow_ptr_and_undef*/!self.const_mode,
+                ) {
+                    // In the happy case, we needn't check anything else.
+                    Ok(()) => {},
+                    // Some error happened, try to provide a more detailed description.
+                    Err(err) => {
+                        // For some errors we might be able to provide extra information
+                        match err.kind {
+                            EvalErrorKind::ReadUndefBytes(offset) => {
+                                // Some byte was undefined, determine which
+                                // element that byte belongs to so we can
+                                // provide an index.
+                                let i = (offset.bytes() / ty_size.bytes()) as usize;
+                                self.path.push(PathElem::ArrayElem(i));
+
+                                return validation_failure!(
+                                    "undefined bytes", self.path
+                                )
+                            },
+                            // Other errors shouldn't be possible
+                            _ => return Err(err),
                         }
                     }
                 }
-            },
+            }
+            _ => {
+                self.walk_aggregate(op, fields)? // default handler
+            }
         }
         Ok(())
     }
+}
 
-    fn aggregate_field_path_elem(&self, layout: TyLayout<'tcx>, field: usize) -> PathElem {
-        match layout.ty.sty {
-            // generators and closures.
-            ty::Closure(def_id, _) | ty::Generator(def_id, _, _) => {
-                if let Some(upvar) = self.tcx.optimized_mir(def_id).upvar_decls.get(field) {
-                    PathElem::ClosureVar(upvar.debug_name)
-                } else {
-                    // Sometimes the index is beyond the number of freevars (seen
-                    // for a generator).
-                    PathElem::ClosureVar(Symbol::intern(&field.to_string()))
-                }
-            }
-
-            // tuples
-            ty::Tuple(_) => PathElem::TupleElem(field),
-
-            // enums
-            ty::Adt(def, ..) if def.is_enum() => {
-                let variant = match layout.variants {
-                    layout::Variants::Single { index } => &def.variants[index],
-                    _ => bug!("aggregate_field_path_elem: got enum but not in a specific variant"),
-                };
-                PathElem::Field(variant.fields[field].ident.name)
-            }
+impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
+    /// This function checks the data at `op`.  `op` is assumed to cover valid memory if it
+    /// is an indirect operand.
+    /// It will error if the bits at the destination do not match the ones described by the layout.
+    ///
+    /// `ref_tracking` can be None to avoid recursive checking below references.
+    /// This also toggles between "run-time" (no recursion) and "compile-time" (with recursion)
+    /// validation (e.g., pointer values are fine in integers at runtime).
+    pub fn validate_operand(
+        &self,
+        op: OpTy<'tcx, M::PointerTag>,
+        path: Vec<PathElem>,
+        ref_tracking: Option<&mut RefTracking<'tcx, M::PointerTag>>,
+        const_mode: bool,
+    ) -> EvalResult<'tcx> {
+        trace!("validate_operand: {:?}, {:?}", *op, op.layout.ty);
 
-            // other ADTs
-            ty::Adt(def, _) => PathElem::Field(def.non_enum_variant().fields[field].ident.name),
+        // Construct a visitor
+        let mut visitor = ValidityVisitor {
+            path,
+            ref_tracking,
+            const_mode,
+            ecx: self,
+        };
 
-            // nothing else has an aggregate layout
-            _ => bug!("aggregate_field_path_elem: got non-aggregate type {:?}", layout.ty),
-        }
+        // Run it
+        visitor.visit_value(op)
     }
 }
diff --git a/src/librustc_mir/interpret/visitor.rs b/src/librustc_mir/interpret/visitor.rs
new file mode 100644 (file)
index 0000000..392e279
--- /dev/null
@@ -0,0 +1,320 @@
+//! Visitor for a run-time value with a given layout: Traverse enums, structs and other compound
+//! types until we arrive at the leaves, with custom handling for primitive types.
+
+use rustc::ty::layout::{self, TyLayout};
+use rustc::ty;
+use rustc::mir::interpret::{
+    EvalResult,
+};
+
+use super::{
+    Machine, EvalContext, MPlaceTy, OpTy, ImmTy,
+};
+
+// A thing that we can project into, and that has a layout.
+// This wouldn't have to depend on `Machine` but with the current type inference,
+// that's just more convenient to work with (avoids repeating all the `Machine` bounds).
+pub trait Value<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>: Copy
+{
+    /// Get this value's layout.
+    fn layout(&self) -> TyLayout<'tcx>;
+
+    /// Make this into an `OpTy`.
+    fn to_op(
+        self,
+        ecx: &EvalContext<'a, 'mir, 'tcx, M>,
+    ) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>>;
+
+    /// Create this from an `MPlaceTy`.
+    fn from_mem_place(MPlaceTy<'tcx, M::PointerTag>) -> Self;
+
+    /// Project to the given enum variant.
+    fn project_downcast(
+        self,
+        ecx: &EvalContext<'a, 'mir, 'tcx, M>,
+        variant: usize,
+    ) -> EvalResult<'tcx, Self>;
+
+    /// Project to the n-th field.
+    fn project_field(
+        self,
+        ecx: &EvalContext<'a, 'mir, 'tcx, M>,
+        field: u64,
+    ) -> EvalResult<'tcx, Self>;
+}
+
+// Operands and memory-places are both values.
+// Places in general are not due to `place_field` having to do `force_allocation`.
+impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M>
+    for OpTy<'tcx, M::PointerTag>
+{
+    #[inline(always)]
+    fn layout(&self) -> TyLayout<'tcx> {
+        self.layout
+    }
+
+    #[inline(always)]
+    fn to_op(
+        self,
+        _ecx: &EvalContext<'a, 'mir, 'tcx, M>,
+    ) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>> {
+        Ok(self)
+    }
+
+    #[inline(always)]
+    fn from_mem_place(mplace: MPlaceTy<'tcx, M::PointerTag>) -> Self {
+        mplace.into()
+    }
+
+    #[inline(always)]
+    fn project_downcast(
+        self,
+        ecx: &EvalContext<'a, 'mir, 'tcx, M>,
+        variant: usize,
+    ) -> EvalResult<'tcx, Self> {
+        ecx.operand_downcast(self, variant)
+    }
+
+    #[inline(always)]
+    fn project_field(
+        self,
+        ecx: &EvalContext<'a, 'mir, 'tcx, M>,
+        field: u64,
+    ) -> EvalResult<'tcx, Self> {
+        ecx.operand_field(self, field)
+    }
+}
+impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M>
+    for MPlaceTy<'tcx, M::PointerTag>
+{
+    #[inline(always)]
+    fn layout(&self) -> TyLayout<'tcx> {
+        self.layout
+    }
+
+    #[inline(always)]
+    fn to_op(
+        self,
+        _ecx: &EvalContext<'a, 'mir, 'tcx, M>,
+    ) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>> {
+        Ok(self.into())
+    }
+
+    #[inline(always)]
+    fn from_mem_place(mplace: MPlaceTy<'tcx, M::PointerTag>) -> Self {
+        mplace
+    }
+
+    #[inline(always)]
+    fn project_downcast(
+        self,
+        ecx: &EvalContext<'a, 'mir, 'tcx, M>,
+        variant: usize,
+    ) -> EvalResult<'tcx, Self> {
+        ecx.mplace_downcast(self, variant)
+    }
+
+    #[inline(always)]
+    fn project_field(
+        self,
+        ecx: &EvalContext<'a, 'mir, 'tcx, M>,
+        field: u64,
+    ) -> EvalResult<'tcx, Self> {
+        ecx.mplace_field(self, field)
+    }
+}
+
+macro_rules! make_value_visitor {
+    ($visitor_trait_name:ident, $($mutability:ident)*) => {
+        // How to traverse a value and what to do when we are at the leaves.
+        pub trait $visitor_trait_name<'a, 'mir, 'tcx: 'mir+'a, M: Machine<'a, 'mir, 'tcx>>: Sized {
+            type V: Value<'a, 'mir, 'tcx, M>;
+
+            /// The visitor must have an `EvalContext` in it.
+            fn ecx(&$($mutability)* self)
+                -> &$($mutability)* EvalContext<'a, 'mir, 'tcx, M>;
+
+            // Recursive actions, ready to be overloaded.
+            /// Visit the given value, dispatching as appropriate to more specialized visitors.
+            #[inline(always)]
+            fn visit_value(&mut self, v: Self::V) -> EvalResult<'tcx>
+            {
+                self.walk_value(v)
+            }
+            /// Visit the given value as a union.  No automatic recursion can happen here.
+            #[inline(always)]
+            fn visit_union(&mut self, _v: Self::V) -> EvalResult<'tcx>
+            {
+                Ok(())
+            }
+            /// Visit this vale as an aggregate, you are even getting an iterator yielding
+            /// all the fields (still in an `EvalResult`, you have to do error handling yourself).
+            /// Recurses into the fields.
+            #[inline(always)]
+            fn visit_aggregate(
+                &mut self,
+                v: Self::V,
+                fields: impl Iterator<Item=EvalResult<'tcx, Self::V>>,
+            ) -> EvalResult<'tcx> {
+                self.walk_aggregate(v, fields)
+            }
+            /// Called each time we recurse down to a field, passing in old and new value.
+            /// This gives the visitor the chance to track the stack of nested fields that
+            /// we are descending through.
+            #[inline(always)]
+            fn visit_field(
+                &mut self,
+                _old_val: Self::V,
+                _field: usize,
+                new_val: Self::V,
+            ) -> EvalResult<'tcx> {
+                self.visit_value(new_val)
+            }
+
+            /// Called whenever we reach a value with uninhabited layout.
+            /// Recursing to fields will *always* continue after this!  This is not meant to control
+            /// whether and how we descend recursively/ into the scalar's fields if there are any,
+            /// it is meant to provide the chance for additional checks when a value of uninhabited
+            /// layout is detected.
+            #[inline(always)]
+            fn visit_uninhabited(&mut self) -> EvalResult<'tcx>
+            { Ok(()) }
+            /// Called whenever we reach a value with scalar layout.
+            /// We do NOT provide a `ScalarMaybeUndef` here to avoid accessing memory if the
+            /// visitor is not even interested in scalars.
+            /// Recursing to fields will *always* continue after this!  This is not meant to control
+            /// whether and how we descend recursively/ into the scalar's fields if there are any,
+            /// it is meant to provide the chance for additional checks when a value of scalar
+            /// layout is detected.
+            #[inline(always)]
+            fn visit_scalar(&mut self, _v: Self::V, _layout: &layout::Scalar) -> EvalResult<'tcx>
+            { Ok(()) }
+
+            /// Called whenever we reach a value of primitive type.  There can be no recursion
+            /// below such a value.  This is the leave function.
+            #[inline(always)]
+            fn visit_primitive(&mut self, _val: ImmTy<'tcx, M::PointerTag>) -> EvalResult<'tcx>
+            { Ok(()) }
+
+            // Default recursors. Not meant to be overloaded.
+            fn walk_aggregate(
+                &mut self,
+                v: Self::V,
+                fields: impl Iterator<Item=EvalResult<'tcx, Self::V>>,
+            ) -> EvalResult<'tcx> {
+                // Now iterate over it.
+                for (idx, field_val) in fields.enumerate() {
+                    self.visit_field(v, idx, field_val?)?;
+                }
+                Ok(())
+            }
+            fn walk_value(&mut self, v: Self::V) -> EvalResult<'tcx>
+            {
+                trace!("walk_value: type: {}", v.layout().ty);
+                // If this is a multi-variant layout, we have find the right one and proceed with
+                // that.
+                match v.layout().variants {
+                    layout::Variants::NicheFilling { .. } |
+                    layout::Variants::Tagged { .. } => {
+                        let op = v.to_op(self.ecx())?;
+                        let idx = self.ecx().read_discriminant(op)?.1;
+                        let inner = v.project_downcast(self.ecx(), idx)?;
+                        trace!("walk_value: variant layout: {:#?}", inner.layout());
+                        // recurse with the inner type
+                        return self.visit_field(v, idx, inner);
+                    }
+                    layout::Variants::Single { .. } => {}
+                }
+
+                // Even for single variants, we might be able to get a more refined type:
+                // If it is a trait object, switch to the actual type that was used to create it.
+                match v.layout().ty.sty {
+                    ty::Dynamic(..) => {
+                        // immediate trait objects are not a thing
+                        let dest = v.to_op(self.ecx())?.to_mem_place();
+                        let inner = self.ecx().unpack_dyn_trait(dest)?.1;
+                        trace!("walk_value: dyn object layout: {:#?}", inner.layout);
+                        // recurse with the inner type
+                        return self.visit_field(v, 0, Value::from_mem_place(inner));
+                    },
+                    _ => {},
+                };
+
+                // If this is a scalar, visit it as such.
+                // Things can be aggregates and have scalar layout at the same time, and that
+                // is very relevant for `NonNull` and similar structs: We need to visit them
+                // at their scalar layout *before* descending into their fields.
+                // FIXME: We could avoid some redundant checks here. For newtypes wrapping
+                // scalars, we do the same check on every "level" (e.g. first we check
+                // MyNewtype and then the scalar in there).
+                match v.layout().abi {
+                    layout::Abi::Uninhabited => {
+                        self.visit_uninhabited()?;
+                    }
+                    layout::Abi::Scalar(ref layout) => {
+                        self.visit_scalar(v, layout)?;
+                    }
+                    // FIXME: Should we do something for ScalarPair? Vector?
+                    _ => {}
+                }
+
+                // Check primitive types.  We do this after checking the scalar layout,
+                // just to have that done as well.  Primitives can have varying layout,
+                // so we check them separately and before aggregate handling.
+                // It is CRITICAL that we get this check right, or we might be
+                // validating the wrong thing!
+                let primitive = match v.layout().fields {
+                    // Primitives appear as Union with 0 fields - except for Boxes and fat pointers.
+                    layout::FieldPlacement::Union(0) => true,
+                    _ => v.layout().ty.builtin_deref(true).is_some(),
+                };
+                if primitive {
+                    let op = v.to_op(self.ecx())?;
+                    let val = self.ecx().read_immediate(op)?;
+                    return self.visit_primitive(val);
+                }
+
+                // Proceed into the fields.
+                match v.layout().fields {
+                    layout::FieldPlacement::Union(fields) => {
+                        // Empty unions are not accepted by rustc. That's great, it means we can
+                        // use that as an unambiguous signal for detecting primitives.  Make sure
+                        // we did not miss any primitive.
+                        debug_assert!(fields > 0);
+                        self.visit_union(v)?;
+                    },
+                    layout::FieldPlacement::Arbitrary { ref offsets, .. } => {
+                        // FIXME: We collect in a vec because otherwise there are lifetime errors:
+                        // Projecting to a field needs (mutable!) access to `ecx`.
+                        let fields: Vec<EvalResult<'tcx, Self::V>> =
+                            (0..offsets.len()).map(|i| {
+                                v.project_field(self.ecx(), i as u64)
+                            })
+                            .collect();
+                        self.visit_aggregate(v, fields.into_iter())?;
+                    },
+                    layout::FieldPlacement::Array { .. } => {
+                        // Let's get an mplace first.
+                        let mplace = if v.layout().is_zst() {
+                            // it's a ZST, the memory content cannot matter
+                            MPlaceTy::dangling(v.layout(), self.ecx())
+                        } else {
+                            // non-ZST array/slice/str cannot be immediate
+                            v.to_op(self.ecx())?.to_mem_place()
+                        };
+                        // Now we can go over all the fields.
+                        let iter = self.ecx().mplace_array_fields(mplace)?
+                            .map(|f| f.and_then(|f| {
+                                Ok(Value::from_mem_place(f))
+                            }));
+                        self.visit_aggregate(v, iter)?;
+                    }
+                }
+                Ok(())
+            }
+        }
+    }
+}
+
+make_value_visitor!(ValueVisitor,);
+make_value_visitor!(MutValueVisitor,mut);
index 2c2bfc995e4d7556a9c7aecea2c9e9eae7979333..6dba020120f848385ac0a3bcb5a1cd39f818bcd1 100644 (file)
@@ -511,7 +511,7 @@ fn mono_item_visibility(
         //
         // * First is weak lang items. These are basically mechanisms for
         //   libcore to forward-reference symbols defined later in crates like
-        //   the standard library or `#[panic_implementation]` definitions. The
+        //   the standard library or `#[panic_handler]` definitions. The
         //   definition of these weak lang items needs to be referenceable by
         //   libcore, so we're no longer a candidate for internalization.
         //   Removal of these functions can't be done by LLVM but rather must be
index 76a8501fb177a89c4375e3c99fa175a8da097aaf..54983b8f4e026abd40026540e985dd2095a7cd80 100644 (file)
@@ -196,7 +196,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     let source_info = SourceInfo { span, scope: OUTERMOST_SOURCE_SCOPE };
 
     let return_block = BasicBlock::new(1);
-    let mut blocks = IndexVec::new();
+    let mut blocks = IndexVec::with_capacity(2);
     let block = |blocks: &mut IndexVec<_, _>, kind| {
         blocks.push(BasicBlockData {
             statements: vec![],
@@ -768,7 +768,8 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         }));
     }
 
-    let mut blocks = IndexVec::new();
+    let n_blocks = if let Adjustment::RefMut = rcvr_adjustment { 5 } else { 2 };
+    let mut blocks = IndexVec::with_capacity(n_blocks);
     let block = |blocks: &mut IndexVec<_, _>, statements, kind, is_cleanup| {
         blocks.push(BasicBlockData {
             statements,
index 52ef37ab40e57d8ee07f7487a2a312ba6fd79e48..4f92ba400481bfc2759e4f1fab4ba40cb3efd934 100644 (file)
@@ -455,7 +455,7 @@ fn const_prop(
                 })?;
                 trace!("const evaluating {:?} for {:?} and {:?}", op, left, right);
                 let (val, overflow) = self.use_ecx(source_info, |this| {
-                    this.ecx.binary_op_val(op, l, r)
+                    this.ecx.binary_op_imm(op, l, r)
                 })?;
                 let val = if let Rvalue::CheckedBinaryOp(..) = *rvalue {
                     Immediate::ScalarPair(
index 958d4e353c8990bffaaea20952388ac00fa42d1f..5de289068b25509db5fd4e49de7e217b763fdde2 100644 (file)
@@ -495,7 +495,7 @@ fn elaborate_replace(
         let target = self.patch.new_block(BasicBlockData {
             statements: vec![assign],
             terminator: Some(Terminator {
-                kind: TerminatorKind::Goto { target: target },
+                kind: TerminatorKind::Goto { target },
                 ..*terminator
             }),
             is_cleanup: false,
index 199cf5650fda8c2f6f5f82d2f239e26d56a1f560..2db3bbda3233bf8c895e0352a587511b4b92ceb2 100644 (file)
@@ -137,7 +137,7 @@ fn run_pass(&self, caller_mir: &mut Mir<'tcx>) {
 
                 let callee_mir = match self.tcx.try_optimized_mir(callsite.location.span,
                                                                   callsite.callee) {
-                    Ok(callee_mir) if self.should_inline(callsite, callee_mir) => {
+                    Ok(callee_mir) if self.consider_optimizing(callsite, callee_mir) => {
                         self.tcx.subst_and_normalize_erasing_regions(
                             &callsite.substs,
                             param_env,
@@ -198,6 +198,18 @@ fn run_pass(&self, caller_mir: &mut Mir<'tcx>) {
         }
     }
 
+    fn consider_optimizing(&self,
+                           callsite: CallSite<'tcx>,
+                           callee_mir: &Mir<'tcx>)
+                           -> bool
+    {
+        debug!("consider_optimizing({:?})", callsite);
+        self.should_inline(callsite, callee_mir)
+            && self.tcx.consider_optimizing(|| format!("Inline {:?} into {:?}",
+                                                       callee_mir.span,
+                                                       callsite))
+    }
+
     fn should_inline(&self,
                      callsite: CallSite<'tcx>,
                      callee_mir: &Mir<'tcx>)
index c20d40af50151eba8fc0207eb2bcc84a3ba4873a..f643870dec207c6e28bf08ea42460bbf6b735212 100644 (file)
@@ -302,7 +302,7 @@ fn run_pass<'a, 'tcx>(&self,
 
         let map = make_local_map(&mut mir.local_decls, marker.locals);
         // Update references to all vars and tmps now
-        LocalUpdater { map: map }.visit_mir(mir);
+        LocalUpdater { map }.visit_mir(mir);
         mir.local_decls.shrink_to_fit();
     }
 }
index e14941b8aeb9a2e6075214eb907edff21cb6032d..b24898095435b4dc227b3cadd09428c6f8c2c2a2 100644 (file)
@@ -57,7 +57,7 @@ fn run_pass<'a, 'tcx>(&self,
                 TerminatorKind::Assert {
                     target, cond: Operand::Constant(ref c), expected, ..
                 } if (c.literal.assert_bool(tcx) == Some(true)) == expected => {
-                    TerminatorKind::Goto { target: target }
+                    TerminatorKind::Goto { target }
                 },
                 TerminatorKind::FalseEdges { real_target, .. } => {
                     TerminatorKind::Goto { target: real_target }
index 61861da62f759134b1c6858ab4167d169b70453c..b878a330ab6490b562e54d0eeae0d97c731176dd 100644 (file)
@@ -672,5 +672,5 @@ pub fn check_crate(session: &Session, krate: &Crate) {
             is_banned: false,
         }, krate);
 
-    visit::walk_crate(&mut AstValidator { session: session }, krate)
+    visit::walk_crate(&mut AstValidator { session }, krate)
 }
index 17ca8c275c3cb39e48c20be846f1914f11e09f10..241db271177b7e543ee00c5492eeeb6657ee9e21 100644 (file)
@@ -4422,7 +4422,7 @@ fn lookup_import_candidates_from_module<FilterFn>(&mut self,
                         // declared as public (due to pruning, we don't explore
                         // outside crate private modules => no need to check this)
                         if !in_module_is_extern || name_binding.vis == ty::Visibility::Public {
-                            candidates.push(ImportSuggestion { path: path });
+                            candidates.push(ImportSuggestion { path });
                         }
                     }
                 }
@@ -4519,7 +4519,7 @@ fn find_module(&mut self,
                             span: name_binding.span,
                             segments: path_segments,
                         };
-                        result = Some((module, ImportSuggestion { path: path }));
+                        result = Some((module, ImportSuggestion { path }));
                     } else {
                         // add the module to the lookup
                         if seen_modules.insert(module.def_id().unwrap()) {
index d5f344346c2d17238fe4bd89eec7322b4bb72d5a..43a5fdb7a025ff2977da7a3666cc132ec80661d6 100644 (file)
@@ -449,6 +449,9 @@ fn resolve_macro_to_def(
                     return Err(Determinacy::Determined);
                 }
             }
+            Def::Err => {
+                return Err(Determinacy::Determined);
+            }
             _ => panic!("expected `Def::Macro` or `Def::NonMacroAttr`"),
         }
 
index d2354f38e2685e90c55105952795a3133211034f..ca336ceb381c5f5f61ee474c014b09da25e39970 100644 (file)
@@ -71,7 +71,7 @@ pub fn with_callback(
         config: Config,
     ) -> JsonDumper<CallbackOutput<'b>> {
         JsonDumper {
-            output: CallbackOutput { callback: callback },
+            output: CallbackOutput { callback },
             config: config.clone(),
             result: Analysis::new(config),
         }
index 7a3f3c2a518bc7d065602ce42d30d3f9abc1ad1e..c87f14977cb1d5f50702d58e47874e6699835816 100644 (file)
@@ -24,31 +24,6 @@ pub fn opts() -> TargetOptions {
     // argument is *not* necessary for normal builds, but it can't hurt!
     base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,--eh-frame-hdr".to_string());
 
-    // There's a whole bunch of circular dependencies when dealing with MUSL
-    // unfortunately. To put this in perspective libc is statically linked to
-    // liblibc and libunwind is statically linked to libstd:
-    //
-    // * libcore depends on `fmod` which is in libc (transitively in liblibc).
-    //   liblibc, however, depends on libcore.
-    // * compiler-rt has personality symbols that depend on libunwind, but
-    //   libunwind is in libstd which depends on compiler-rt.
-    //
-    // Recall that linkers discard libraries and object files as much as
-    // possible, and with all the static linking and archives flying around with
-    // MUSL the linker is super aggressively stripping out objects. For example
-    // the first case has fmod stripped from liblibc (it's in its own object
-    // file) so it's not there when libcore needs it. In the second example all
-    // the unused symbols from libunwind are stripped (each is in its own object
-    // file in libstd) before we end up linking compiler-rt which depends on
-    // those symbols.
-    //
-    // To deal with these circular dependencies we just force the compiler to
-    // link everything as a group, not stripping anything out until everything
-    // is processed. The linker will still perform a pass to strip out object
-    // files but it won't do so until all objects/archives have been processed.
-    base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,-(".to_string());
-    base.post_link_args.insert(LinkerFlavor::Gcc, vec!["-Wl,-)".to_string()]);
-
     // When generating a statically linked executable there's generally some
     // small setup needed which is listed in these files. These are provided by
     // a musl toolchain and are linked by default by the `musl-gcc` script. Note
index 40f2072079a5a1ba203536b642b3f3d14ea8c53c..4a300fe09215cbfc01e2dbd068b409dbfb2e400e 100644 (file)
@@ -814,11 +814,6 @@ fn check_pat_tuple_struct(&self,
             report_unexpected_def(def);
             return self.tcx.types.err;
         }
-        // Replace constructor type with constructed type for tuple struct patterns.
-        let pat_ty = pat_ty.fn_sig(tcx).output();
-        let pat_ty = pat_ty.no_bound_vars().expect("expected fn type");
-
-        self.demand_eqtype(pat.span, expected, pat_ty);
 
         let variant = match def {
             Def::Err => {
@@ -836,6 +831,13 @@ fn check_pat_tuple_struct(&self,
             }
             _ => bug!("unexpected pattern definition: {:?}", def)
         };
+
+        // Replace constructor type with constructed type for tuple struct patterns.
+        let pat_ty = pat_ty.fn_sig(tcx).output();
+        let pat_ty = pat_ty.no_bound_vars().expect("expected fn type");
+
+        self.demand_eqtype(pat.span, expected, pat_ty);
+
         // Type check subpatterns.
         if subpats.len() == variant.fields.len() ||
                 subpats.len() < variant.fields.len() && ddpos.is_some() {
index 54c6c8f7b9322aba35bf87570aa138a7eb387fb0..45c5457c9e14016a62a39ed72c7842313481e646 100644 (file)
@@ -595,7 +595,9 @@ fn compare_number_of_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     if num_impl_m_type_params != num_trait_m_type_params {
         let impl_m_node_id = tcx.hir.as_local_node_id(impl_m.def_id).unwrap();
         let impl_m_item = tcx.hir.expect_impl_item(impl_m_node_id);
-        let span = if impl_m_item.generics.params.is_empty() {
+        let span = if impl_m_item.generics.params.is_empty()
+            || impl_m_item.generics.span.is_dummy()  // impl Trait in argument position (#55374)
+        {
             impl_m_span
         } else {
             impl_m_item.generics.span
index 11448750618e218252dd96cb040609c91127dac6..637f3eaae9a6ac91e0f3e5874cd420354699f697 100644 (file)
@@ -289,8 +289,14 @@ pub fn lookup_method_in_trait(&self,
         // Trait must have a method named `m_name` and it should not have
         // type parameters or early-bound regions.
         let tcx = self.tcx;
-        let method_item =
-            self.associated_item(trait_def_id, m_name, Namespace::Value).unwrap();
+        let method_item = match self.associated_item(trait_def_id, m_name, Namespace::Value) {
+            Some(method_item) => method_item,
+            None => {
+                tcx.sess.delay_span_bug(span,
+                    "operator trait does not have corresponding operator method");
+                return None;
+            }
+        };
         let def_id = method_item.def_id;
         let generics = tcx.generics_of(def_id);
         assert_eq!(generics.params.len(), 0);
index 791b5a0bdd92abebb5025afe718f7791612c8e68..7dfdb926c60ef63a0b9f8fe8d71fb0bfe451e660 100644 (file)
@@ -1167,7 +1167,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
         }
     }
 
-    // Check that a function marked as `#[panic_implementation]` has signature `fn(&PanicInfo) -> !`
+    // Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !`
     if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() {
         if panic_impl_did == fcx.tcx.hir.local_def_id(fn_id) {
             if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() {
index 527ba276de2732556ea7c4211facc15e06a6db0e..266b9e3c0abad33bf63ff5b9f455e98907d1c2dc 100644 (file)
@@ -993,7 +993,7 @@ fn non_enum_variant(&self, struct_def: &hir::VariantData) -> AdtVariant<'tcx> {
             AdtField { ty: field_ty, span: field.span }
         })
         .collect();
-        AdtVariant { fields: fields }
+        AdtVariant { fields }
     }
 
     fn enum_variants(&self, enum_def: &hir::EnumDef) -> Vec<AdtVariant<'tcx>> {
index b155587dddc419f284fcda6978e89a0201c98f98..14c6864434fcfcbf5cd15c7c59d6c3da64226544 100644 (file)
@@ -17,7 +17,7 @@
 use rustc::hir;
 
 pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    let mut orphan = OrphanChecker { tcx: tcx };
+    let mut orphan = OrphanChecker { tcx };
     tcx.hir.krate().visit_all_item_likes(&mut orphan);
 }
 
index bdbf93ddec286c2506b7d2ce91b703f4fd8a31a5..0894c1d49e80e7e7e0ae97770063d8af35ba2d90 100644 (file)
@@ -16,7 +16,7 @@
 use rustc::hir::{self, Unsafety};
 
 pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    let mut unsafety = UnsafetyChecker { tcx: tcx };
+    let mut unsafety = UnsafetyChecker { tcx };
     tcx.hir.krate().visit_all_item_likes(&mut unsafety);
 }
 
index 74dea7fe411ad0e710a016afd5fabc6bb39089e3..be09cfce8cae6424ad9dc1fbde3ba554e211f3db 100644 (file)
@@ -64,7 +64,7 @@
 // Main entry point
 
 pub fn collect_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    let mut visitor = CollectItemTypesVisitor { tcx: tcx };
+    let mut visitor = CollectItemTypesVisitor { tcx };
     tcx.hir
        .krate()
        .visit_all_item_likes(&mut visitor.as_deep_visitor());
index edf3ddf7bdbfabd67b4f4e72d316c9524e59e90b..74a53f7fca273fa81146fa2a677fdd6d72f26f3a 100644 (file)
@@ -62,7 +62,7 @@ pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     // We will tag this as part of the WF check -- logically, it is,
     // but it's one that we must perform earlier than the rest of
     // WfCheck.
-    tcx.hir.krate().visit_all_item_likes(&mut ImplWfCheck { tcx: tcx });
+    tcx.hir.krate().visit_all_item_likes(&mut ImplWfCheck { tcx });
 }
 
 struct ImplWfCheck<'a, 'tcx: 'a> {
index 9f68fd56c5e04512d023436a9f7b0f5c47479914..c39b71e33ca0cecfe1491bcead121dd6e4c5f472 100644 (file)
@@ -2966,7 +2966,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             source: cx.tcx.def_span(self.did).clean(cx),
             visibility: Some(Inherited),
             def_id: self.did,
-            inner: VariantItem(Variant { kind: kind }),
+            inner: VariantItem(Variant { kind }),
             stability: get_stability(cx, self.did),
             deprecation: get_deprecation(cx, self.did),
         }
index aea4522892cba3839ae2188df0fcbd195ec8799a..8de415e8aed5cc25ec6577e59f8a461034076098 100644 (file)
@@ -3418,7 +3418,7 @@ fn new(k: usize) -> Droppable {
                 slot.borrow_mut()[k] += 1;
             });
 
-            Droppable { k: k }
+            Droppable { k }
         }
     }
 
index 017949291bcf16e37f200141b9254d9fdbaad544..f4703dec187b8cf0843f973e2c80bbf0c4b973f1 100644 (file)
@@ -877,7 +877,7 @@ pub fn open<P: AsRef<Path>>(&self, path: P) -> io::Result<File> {
 
     fn _open(&self, path: &Path) -> io::Result<File> {
         let inner = fs_imp::File::open(path, &self.0)?;
-        Ok(File { inner: inner })
+        Ok(File { inner })
     }
 }
 
@@ -1755,12 +1755,19 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
 ///
 /// [changes]: ../io/index.html#platform-specific-behavior
 ///
+/// **NOTE**: If a parent of the given path doesn't exist, this function will
+/// return an error. To create a directory and all its missing parents at the
+/// same time, use the [`create_dir_all`] function.
+///
 /// # Errors
 ///
 /// This function will return an error in the following situations, but is not
 /// limited to just these cases:
 ///
 /// * User lacks permissions to create directory at `path`.
+/// * A parent of the given path doesn't exist. (To create a directory and all
+///   its missing parents at the same time, use the [`create_dir_all`]
+///   function.)
 /// * `path` already exists.
 ///
 /// # Examples
index 371e5b21c13b26c117b915b4ec04d22d8ad764b1..12995d08683450175af2c3fe2b5b1377c70ab320 100644 (file)
@@ -150,7 +150,7 @@ pub struct Repeat { byte: u8 }
 /// assert_eq!(buffer, [0b101, 0b101, 0b101]);
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn repeat(byte: u8) -> Repeat { Repeat { byte: byte } }
+pub fn repeat(byte: u8) -> Repeat { Repeat { byte } }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Read for Repeat {
index b55d12e4c8dc96693dc81493fc9e7d8a94995bfa..f27beb0b46cafd9fe47b98bc909fb962b4ffac61 100644 (file)
 #![feature(doc_keyword)]
 #![feature(panic_info_message)]
 #![feature(non_exhaustive)]
+#![feature(alloc_layout_extra)]
 
 #![default_lib_allocator]
 
index 59cf741487e443710cdd1e32222abe4cf8a7c92b..81f98a55c117149bd5bfe8aa0e9f3d907853eb81 100644 (file)
@@ -931,7 +931,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 impl<T> SyncSender<T> {
     fn new(inner: Arc<sync::Packet<T>>) -> SyncSender<T> {
-        SyncSender { inner: inner }
+        SyncSender { inner }
     }
 
     /// Sends a value on this synchronous channel.
index ee12731619aac3bfbae63a38a796ba8984a7ec4d..3d66998b9f549e91108e3dfdd8b7e7b77fcfd5b5 100644 (file)
@@ -32,7 +32,7 @@ pub fn now() -> Instant {
             let mut t = mem::uninitialized();
             let ret = abi::clock_time_get(abi::clockid::MONOTONIC, 0, &mut t);
             assert_eq!(ret, abi::errno::SUCCESS);
-            Instant { t: t }
+            Instant { t }
         }
     }
 
@@ -71,7 +71,7 @@ pub fn now() -> SystemTime {
             let mut t = mem::uninitialized();
             let ret = abi::clock_time_get(abi::clockid::REALTIME, 0, &mut t);
             assert_eq!(ret, abi::errno::SUCCESS);
-            SystemTime { t: t }
+            SystemTime { t }
         }
     }
 
index e04e2791b23a1a496694af26b6f134d7a566ba27..d61103a872f9e6781d2f890cba298ae09ae56622 100644 (file)
@@ -21,7 +21,7 @@ pub struct FileDesc {
 
 impl FileDesc {
     pub fn new(fd: usize) -> FileDesc {
-        FileDesc { fd: fd }
+        FileDesc { fd }
     }
 
     pub fn raw(&self) -> usize { self.fd }
index 2e2216186f1e6b8228e4a425a0c3345f494b534f..6059406997dff100f458c1e4c64f180d81f2754c 100644 (file)
@@ -264,7 +264,7 @@ pub fn open(path: &Path, opts: &OpenOptions) -> io::Result<File> {
     pub fn file_attr(&self) -> io::Result<FileAttr> {
         let mut stat = syscall::Stat::default();
         cvt(syscall::fstat(self.0.raw(), &mut stat))?;
-        Ok(FileAttr { stat: stat })
+        Ok(FileAttr { stat })
     }
 
     pub fn fsync(&self) -> io::Result<()> {
index 1ef79547431f8ac0a23d9e3a85d92c288da346fa..1e3783705537ab274b651a115a723dea7a53f5b3 100644 (file)
@@ -19,7 +19,7 @@ pub struct Error {
 
 impl Error {
     pub fn new(errno: i32) -> Error {
-        Error { errno: errno }
+        Error { errno }
     }
 
     pub fn mux(result: Result<usize>) -> usize {
index f4177087d77a1e24cd68dc06f0f5e52fa6332583..bab91b16e6c0a4f3bdec59a71c14a8570c7a87d8 100644 (file)
@@ -38,7 +38,7 @@ pub unsafe fn new<'a>(_stack: usize, p: Box<dyn FnBox() + 'a>) -> io::Result<Thr
             panic!("thread failed to exit");
         } else {
             mem::forget(p);
-            Ok(Thread { id: id })
+            Ok(Thread { id })
         }
     }
 
index 5c491115c55160dafcc356c2082699454b9b29f4..aac6d2704e790cd0519d77e44a27a5c46e4c8ea4 100644 (file)
@@ -187,7 +187,7 @@ pub fn sub_duration(&self, other: &Duration) -> SystemTime {
 
 impl From<syscall::TimeSpec> for SystemTime {
     fn from(t: syscall::TimeSpec) -> SystemTime {
-        SystemTime { t: Timespec { t: t } }
+        SystemTime { t: Timespec { t } }
     }
 }
 
index db2ea6b660a7ab73a4f882ccbf8d8d1f789a2b25..af33d2636fb1fef1bd8ce5facaade975585e514c 100644 (file)
@@ -41,7 +41,7 @@ fn max_len() -> usize {
 
 impl FileDesc {
     pub fn new(fd: c_int) -> FileDesc {
-        FileDesc { fd: fd }
+        FileDesc { fd }
     }
 
     pub fn raw(&self) -> c_int { self.fd }
index 1d5b0cfa94ad549e9252ed00b7fe2a5d9e812b57..add06aec11b64a294d558f57b9f84383bea0f454 100644 (file)
@@ -317,7 +317,7 @@ pub fn metadata(&self) -> io::Result<FileAttr> {
         cvt(unsafe {
             fstatat64(fd, self.entry.d_name.as_ptr(), &mut stat, libc::AT_SYMLINK_NOFOLLOW)
         })?;
-        Ok(FileAttr { stat: stat })
+        Ok(FileAttr { stat })
     }
 
     #[cfg(not(any(target_os = "linux", target_os = "emscripten", target_os = "android")))]
@@ -526,7 +526,7 @@ pub fn file_attr(&self) -> io::Result<FileAttr> {
         cvt(unsafe {
             fstat64(self.0.raw(), &mut stat)
         })?;
-        Ok(FileAttr { stat: stat })
+        Ok(FileAttr { stat })
     }
 
     pub fn fsync(&self) -> io::Result<()> {
@@ -807,7 +807,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
     cvt(unsafe {
         stat64(p.as_ptr(), &mut stat)
     })?;
-    Ok(FileAttr { stat: stat })
+    Ok(FileAttr { stat })
 }
 
 pub fn lstat(p: &Path) -> io::Result<FileAttr> {
@@ -816,7 +816,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
     cvt(unsafe {
         lstat64(p.as_ptr(), &mut stat)
     })?;
-    Ok(FileAttr { stat: stat })
+    Ok(FileAttr { stat })
 }
 
 pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
index 0b1fb726357e1056d8685ce50e338843d842c5a8..af51f8a8e257a0875f8154ebb298040b6fdf7b88 100644 (file)
@@ -217,7 +217,7 @@ fn from(t: libc::timeval) -> SystemTime {
 
     impl From<libc::timespec> for SystemTime {
         fn from(t: libc::timespec) -> SystemTime {
-            SystemTime { t: Timespec { t: t } }
+            SystemTime { t: Timespec { t } }
         }
     }
 
@@ -332,7 +332,7 @@ pub fn sub_duration(&self, other: &Duration) -> SystemTime {
 
     impl From<libc::timespec> for SystemTime {
         fn from(t: libc::timespec) -> SystemTime {
-            SystemTime { t: Timespec { t: t } }
+            SystemTime { t: Timespec { t } }
         }
     }
 
index 4974a8de89c79f91d6850d0b017221720046ecbc..ff1ee0d26fe5412a944a55a733426e857fed7c73 100644 (file)
@@ -241,7 +241,7 @@ impl<'a> DropGuard<'a> {
     fn new(lock: &'a Mutex) -> DropGuard<'a> {
         unsafe {
             lock.lock();
-            DropGuard { lock: lock }
+            DropGuard { lock }
         }
     }
 }
index 07e64d386a1c2b7c94927fda6d73a1f6b190ba5e..54bcbc76b1a3c347ba64b23fa03087f61e3ae92d 100644 (file)
@@ -170,7 +170,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 impl From<c::FILETIME> for SystemTime {
     fn from(t: c::FILETIME) -> SystemTime {
-        SystemTime { t: t }
+        SystemTime { t }
     }
 }
 
index 1625efe4a2ae7142a06023a31b1058991a2bcdd8..af93571a604828508c7245610601f95b5544f946 100644 (file)
@@ -174,7 +174,7 @@ impl<T> PoisonError<T> {
     /// [`RwLock::read`]: ../../std/sync/struct.RwLock.html#method.read
     #[stable(feature = "sync_poison", since = "1.2.0")]
     pub fn new(guard: T) -> PoisonError<T> {
-        PoisonError { guard: guard }
+        PoisonError { guard }
     }
 
     /// Consumes this error indicating that a lock is poisoned, returning the
index 8725abe741679a50da912a28021ba9be6800986d..19ce932aa1233f6985158b03ef75fa05d5d641eb 100644 (file)
@@ -67,7 +67,7 @@ impl CodePoint {
     /// Only use when `value` is known to be less than or equal to 0x10FFFF.
     #[inline]
     pub unsafe fn from_u32_unchecked(value: u32) -> CodePoint {
-        CodePoint { value: value }
+        CodePoint { value }
     }
 
     /// Creates a new `CodePoint` if the value is a valid code point.
@@ -76,7 +76,7 @@ pub unsafe fn from_u32_unchecked(value: u32) -> CodePoint {
     #[inline]
     pub fn from_u32(value: u32) -> Option<CodePoint> {
         match value {
-            0 ..= 0x10FFFF => Some(CodePoint { value: value }),
+            0 ..= 0x10FFFF => Some(CodePoint { value }),
             _ => None
         }
     }
index ccbead7cc2f77f3d77d52ba20bb16e6b11feac72..4df4751117244451299281594de09ec169aa75b4 100644 (file)
@@ -146,13 +146,13 @@ macro_rules! thread_local {
 
     // process multiple declarations
     ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr; $($rest:tt)*) => (
-        __thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
-        thread_local!($($rest)*);
+        $crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
+        $crate::thread_local!($($rest)*);
     );
 
     // handle a single declaration
     ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr) => (
-        __thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
+        $crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
     );
 }
 
@@ -202,7 +202,7 @@ unsafe fn __getit() -> $crate::option::Option<
     };
     ($(#[$attr:meta])* $vis:vis $name:ident, $t:ty, $init:expr) => {
         $(#[$attr])* $vis const $name: $crate::thread::LocalKey<$t> =
-            __thread_local_inner!(@key $(#[$attr])* $vis $name, $t, $init);
+            $crate::__thread_local_inner!(@key $(#[$attr])* $vis $name, $t, $init);
     }
 }
 
index 5404420988c35a930666693a60d1f4f2675e3536..6487665947729e21f277a768503a8cb8cbeb9d40 100644 (file)
@@ -455,6 +455,11 @@ pub fn find_by_name<'a>(attrs: &'a [Attribute], name: &str) -> Option<&'a Attrib
     attrs.iter().find(|attr| attr.check_name(name))
 }
 
+pub fn filter_by_name<'a>(attrs: &'a [Attribute], name: &'a str)
+    -> impl Iterator<Item = &'a Attribute> {
+    attrs.iter().filter(move |attr| attr.check_name(name))
+}
+
 pub fn first_attr_value_str_by_name(attrs: &[Attribute], name: &str) -> Option<Symbol> {
     attrs.iter()
         .find(|at| at.check_name(name))
index f5d1bd6255e2abe6d1800f59cd35254398c65a7b..e1ba8897a47f4d76d6df8cc457167bcddc5d9d3a 100644 (file)
@@ -126,7 +126,7 @@ fn make_expr(mut self: Box<ExpandResult<'a>>) -> Option<P<ast::Expr>> {
         }
     }
 
-    Box::new(ExpandResult { p: p })
+    Box::new(ExpandResult { p })
 }
 
 // include_str! : read the given file, insert it as a literal string expr
index 6abc506c07b736d08059d390626f7a78fcf86ae7..55652c481bd3f07478d90588229b6c3ae755825a 100644 (file)
@@ -349,7 +349,7 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (active, abi_thiscall, "1.19.0", None, None),
 
     // Allows a test to fail without failing the whole suite
-    (active, allow_fail, "1.19.0", Some(42219), None),
+    (active, allow_fail, "1.19.0", Some(46488), None),
 
     // Allows unsized tuple coercion.
     (active, unsized_tuple_coercion, "1.20.0", Some(42877), None),
@@ -376,7 +376,7 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (active, non_exhaustive, "1.22.0", Some(44109), None),
 
     // `crate` as visibility modifier, synonymous to `pub(crate)`
-    (active, crate_visibility_modifier, "1.23.0", Some(45388), None),
+    (active, crate_visibility_modifier, "1.23.0", Some(53120), None),
 
     // extern types
     (active, extern_types, "1.23.0", Some(43467), None),
@@ -391,13 +391,13 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (active, generic_associated_types, "1.23.0", Some(44265), None),
 
     // `extern` in paths
-    (active, extern_in_paths, "1.23.0", Some(44660), None),
+    (active, extern_in_paths, "1.23.0", Some(55600), None),
 
     // Use `?` as the Kleene "at most one" operator
     (active, macro_at_most_once_rep, "1.25.0", Some(48075), None),
 
     // Infer static outlives requirements; RFC 2093
-    (active, infer_static_outlives_requirements, "1.26.0", Some(44493), None),
+    (active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),
 
     // Multiple patterns with `|` in `if let` and `while let`
     (active, if_while_or_patterns, "1.26.0", Some(48215), None),
@@ -448,9 +448,6 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     // Integer match exhaustiveness checking
     (active, exhaustive_integer_patterns, "1.30.0", Some(50907), None),
 
-    // RFC 2070: #[panic_implementation] / #[panic_handler]
-    (active, panic_implementation, "1.28.0", Some(44489), None),
-
     // #[doc(keyword = "...")]
     (active, doc_keyword, "1.28.0", Some(51315), None),
 
@@ -466,7 +463,7 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (active, test_2018_feature, "1.31.0", Some(0), Some(Edition::Edition2018)),
 
     // Support for arbitrary delimited token streams in non-macro attributes
-    (active, unrestricted_attribute_tokens, "1.30.0", Some(44690), None),
+    (active, unrestricted_attribute_tokens, "1.30.0", Some(55208), None),
 
     // Allows `use x::y;` to resolve through `self::x`, not just `::x`
     (active, uniform_paths, "1.30.0", Some(53130), None),
@@ -503,7 +500,7 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (active, underscore_const_names, "1.31.0", Some(54912), None),
 
     // `extern crate foo as bar;` puts `bar` into extern prelude.
-    (active, extern_crate_item_prelude, "1.31.0", Some(54658), None),
+    (active, extern_crate_item_prelude, "1.31.0", Some(55599), None),
 
     // `reason = ` in lint attributes and `expect` lint attribute
     (active, lint_reasons, "1.31.0", Some(54503), None),
@@ -541,6 +538,8 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
      Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
     (removed, proc_macro_gen, "1.27.0", Some(54727), None,
      Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
+    (removed, panic_implementation, "1.28.0", Some(44489), None,
+     Some("subsumed by `#[panic_handler]`")),
 );
 
 declare_features! (
@@ -1160,16 +1159,6 @@ pub fn is_builtin_attr(attr: &ast::Attribute) -> bool {
                                    "infer 'static lifetime requirements",
                                    cfg_fn!(infer_static_outlives_requirements))),
 
-    // RFC 2070 (deprecated attribute name)
-    ("panic_implementation",
-     Normal,
-     Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/44489\
-                                  #issuecomment-415140224",
-                                 Some("replace this attribute with `#[panic_handler]`")),
-           "panic_implementation",
-           "this attribute was renamed to `panic_handler`",
-           cfg_fn!(panic_implementation))),
-
     // RFC 2070
     ("panic_handler", Normal, Ungated),
 
@@ -1625,7 +1614,7 @@ fn visit_item(&mut self, i: &'a ast::Item) {
             }
 
             ast::ItemKind::Struct(..) => {
-                if let Some(attr) = attr::find_by_name(&i.attrs[..], "repr") {
+                for attr in attr::filter_by_name(&i.attrs[..], "repr") {
                     for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
                         if item.check_name("simd") {
                             gate_feature_post!(&self, repr_simd, attr.span,
index bec193548e176389edb161ce37aad598fb831653..0e6e2f90693cf54861abc1ada9fd6d50a84670d5 100644 (file)
@@ -945,7 +945,7 @@ pub fn noop_fold_item_kind<T: Folder>(i: ItemKind, folder: &mut T) -> ItemKind {
         ItemKind::Enum(enum_definition, generics) => {
             let generics = folder.fold_generics(generics);
             let variants = enum_definition.variants.move_map(|x| folder.fold_variant(x));
-            ItemKind::Enum(ast::EnumDef { variants: variants }, generics)
+            ItemKind::Enum(ast::EnumDef { variants }, generics)
         }
         ItemKind::Struct(struct_def, generics) => {
             let generics = folder.fold_generics(generics);
index 7e29eaae4e856ea67671694658fad910063d5366..c8a686da179fbbcba51d828313dcced3743ee9fc 100644 (file)
@@ -6929,7 +6929,7 @@ fn parse_enum_def(&mut self, _generics: &ast::Generics) -> PResult<'a, EnumDef>
             _ => ()
         }
 
-        Ok(ast::EnumDef { variants: variants })
+        Ok(ast::EnumDef { variants })
     }
 
     /// Parse an "enum" declaration
index 3dbde46f762411598632ce24b23b7df7c877d0dc..f00b7f3a58f9c2c91e95a263535c4a9039c5020e 100644 (file)
@@ -1237,6 +1237,40 @@ extern "C" LLVMValueRef LLVMRustBuildCall(LLVMBuilderRef B, LLVMValueRef Fn,
       unwrap(Fn), makeArrayRef(unwrap(Args), NumArgs), Bundles, Name));
 }
 
+extern "C" LLVMValueRef LLVMRustBuildMemCpy(LLVMBuilderRef B,
+                                            LLVMValueRef Dst, unsigned DstAlign,
+                                            LLVMValueRef Src, unsigned SrcAlign,
+                                            LLVMValueRef Size, bool IsVolatile) {
+#if LLVM_VERSION_GE(7, 0)
+  return wrap(unwrap(B)->CreateMemCpy(
+      unwrap(Dst), DstAlign,
+      unwrap(Src), SrcAlign,
+      unwrap(Size), IsVolatile));
+#else
+  unsigned Align = std::min(DstAlign, SrcAlign);
+  return wrap(unwrap(B)->CreateMemCpy(
+      unwrap(Dst), unwrap(Src),
+      unwrap(Size), Align, IsVolatile));
+#endif
+}
+
+extern "C" LLVMValueRef LLVMRustBuildMemMove(LLVMBuilderRef B,
+                                             LLVMValueRef Dst, unsigned DstAlign,
+                                             LLVMValueRef Src, unsigned SrcAlign,
+                                             LLVMValueRef Size, bool IsVolatile) {
+#if LLVM_VERSION_GE(7, 0)
+  return wrap(unwrap(B)->CreateMemMove(
+      unwrap(Dst), DstAlign,
+      unwrap(Src), SrcAlign,
+      unwrap(Size), IsVolatile));
+#else
+  unsigned Align = std::min(DstAlign, SrcAlign);
+  return wrap(unwrap(B)->CreateMemMove(
+      unwrap(Dst), unwrap(Src),
+      unwrap(Size), Align, IsVolatile));
+#endif
+}
+
 extern "C" LLVMValueRef
 LLVMRustBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args,
                     unsigned NumArgs, LLVMBasicBlockRef Then,
index 431766a3fbcfb6dafb2d5a3866c1609bf44ee554..0309be1ade6bf61066f2c69f77ac3567b7dc31b5 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 431766a3fbcfb6dafb2d5a3866c1609bf44ee554
+Subproject commit 0309be1ade6bf61066f2c69f77ac3567b7dc31b5
index 10dd12909b6444a65772dfa4cd5a0c7aa85aad05..b50f5b6f16fedad9743b5be8b2be36fea7a6eb7b 100644 (file)
@@ -65,7 +65,7 @@ pub struct BigPacked2 {
 pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 {
 // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca %Array
 // CHECK: call void %{{.*}}(%Array* noalias nocapture sret dereferenceable(32) [[ALLOCA]])
-// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 %{{.*}}, i8* align 1 %{{.*}}, i{{[0-9]+}} 32, i1 false)
+// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 %{{.*}}, i8* align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false)
     // check that calls whose destination is a field of a packed struct
     // go through an alloca rather than calling the function with an
     // unaligned destination.
@@ -77,7 +77,7 @@ pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 {
 pub fn call_pkd2(f: fn() -> Array) -> BigPacked2 {
 // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca %Array
 // CHECK: call void %{{.*}}(%Array* noalias nocapture sret dereferenceable(32) [[ALLOCA]])
-// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 2 %{{.*}}, i8* align 2 %{{.*}}, i{{[0-9]+}} 32, i1 false)
+// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 2 %{{.*}}, i8* align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false)
     // check that calls whose destination is a field of a packed struct
     // go through an alloca rather than calling the function with an
     // unaligned destination.
index 0aaf00bfdbe8ef1597825ed81c7d0ade8c1287f0..871bee13b1931eddf04b259ad387f3bd2cb70f08 100644 (file)
@@ -31,7 +31,7 @@ pub struct Bytes {
 // CHECK: store i32 %0, i32* [[TMP]]
 // CHECK: [[Y8:%[0-9]+]] = bitcast [4 x i8]* %y to i8*
 // CHECK: [[TMP8:%[0-9]+]] = bitcast i32* [[TMP]] to i8*
-// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 [[Y8]], i8* align 1 [[TMP8]], i{{[0-9]+}} 4, i1 false)
+// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 [[Y8]], i8* align 4 [[TMP8]], i{{[0-9]+}} 4, i1 false)
     *x = y;
 }
 
@@ -45,6 +45,6 @@ pub fn small_struct_alignment(x: &mut Bytes, y: Bytes) {
 // CHECK: store i32 %0, i32* [[TMP]]
 // CHECK: [[Y8:%[0-9]+]] = bitcast %Bytes* %y to i8*
 // CHECK: [[TMP8:%[0-9]+]] = bitcast i32* [[TMP]] to i8*
-// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 [[Y8]], i8* align 1 [[TMP8]], i{{[0-9]+}} 4, i1 false)
+// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 [[Y8]], i8* align 4 [[TMP8]], i{{[0-9]+}} 4, i1 false)
     *x = y;
 }
index 39267edaac04566b535657a5ec1920928b7a881f..dba3972a3df99bac98bdd55de9acd59b8228f9a8 100644 (file)
@@ -99,7 +99,7 @@
 
 // lldb-command:print padded_tuple
 // lldbg-check:[...]$4 = &[(6, 7), (8, 9)]
-// lldbr-check:(&[(i32, i16)]) padded_tuple = { data_ptr = *0x555555555030 length = 2 }
+// lldbr-check:(&[(i32, i16)]) padded_tuple = { data_ptr = *[...] length = 2 }
 
 // lldb-command:print padded_struct
 // lldbg-check:[...]$5 = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }]
diff --git a/src/test/run-make/thumb-none-qemu/Makefile b/src/test/run-make/thumb-none-qemu/Makefile
new file mode 100644 (file)
index 0000000..ffd1772
--- /dev/null
@@ -0,0 +1,30 @@
+-include ../../run-make-fulldeps/tools.mk
+
+# How to run this
+# $ ./x.py clean
+# $ ./x.py test --target thumbv7m-none-eabi src/test/run-make
+
+ifneq (,$(filter $(TARGET),thumbv6m-none-eabi thumbv7m-none-eabi))
+
+# For cargo setting
+export RUSTC := $(RUSTC_ORIGINAL)
+export LD_LIBRARY_PATH := $(HOST_RPATH_DIR)
+# We need to be outside of 'src' dir in order to run cargo
+export WORK_DIR := $(TMPDIR)
+export HERE := $(shell pwd)
+
+## clean up unused env variables which might cause harm.
+unexport RUSTC_LINKER
+unexport RUSTC_BOOTSTRAP
+unexport RUST_BUILD_STAGE
+unexport RUST_TEST_THREADS
+unexport RUST_TEST_TMPDIR
+unexport AR
+unexport CC
+unexport CXX
+
+all:
+       bash script.sh
+else
+all:
+endif
diff --git a/src/test/run-make/thumb-none-qemu/example/.cargo/config b/src/test/run-make/thumb-none-qemu/example/.cargo/config
new file mode 100644 (file)
index 0000000..0d6b19c
--- /dev/null
@@ -0,0 +1,31 @@
+[target.thumbv7m-none-eabi]
+# uncomment this to make `cargo run` execute programs on QEMU
+runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
+
+[target.thumbv6m-none-eabi]
+# uncomment this to make `cargo run` execute programs on QEMU
+# For now, we use cortex-m3 instead of cortex-m0 which are not supported by QEMU
+runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
+
+[target.'cfg(all(target_arch = "arm", target_os = "none"))']
+# uncomment ONE of these three option to make `cargo run` start a GDB session
+# which option to pick depends on your system
+# runner = "arm-none-eabi-gdb -q -x openocd.gdb"
+# runner = "gdb-multiarch -q -x openocd.gdb"
+# runner = "gdb -q -x openocd.gdb"
+
+rustflags = [
+  # LLD (shipped with the Rust toolchain) is used as the default linker
+  "-C", "link-arg=-Tlink.x",
+
+  # if you run into problems with LLD switch to the GNU linker by commenting out
+  # this line
+  # "-C", "linker=arm-none-eabi-ld",
+
+  # if you need to link to pre-compiled C libraries provided by a C toolchain
+  # use GCC as the linker by commenting out both lines above and then
+  # uncommenting the three lines below
+  # "-C", "linker=arm-none-eabi-gcc",
+  # "-C", "link-arg=-Wl,-Tlink.x",
+  # "-C", "link-arg=-nostartfiles",
+]
\ No newline at end of file
diff --git a/src/test/run-make/thumb-none-qemu/example/Cargo.toml b/src/test/run-make/thumb-none-qemu/example/Cargo.toml
new file mode 100644 (file)
index 0000000..4995533
--- /dev/null
@@ -0,0 +1,11 @@
+[package]
+name = "example"
+version = "0.1.0"
+authors = ["Hideki Sekine <sekineh@me.com>"]
+# edition = "2018"
+
+[dependencies]
+cortex-m = "0.5.4"
+cortex-m-rt = "=0.5.4"
+panic-halt = "0.2.0"
+cortex-m-semihosting = "0.3.1"
diff --git a/src/test/run-make/thumb-none-qemu/example/memory.x b/src/test/run-make/thumb-none-qemu/example/memory.x
new file mode 100644 (file)
index 0000000..dc7ad96
--- /dev/null
@@ -0,0 +1,23 @@
+/* Device specific memory layout */
+
+/* This file is used to build the cortex-m-rt examples,
+   but not other applications using cortex-m-rt. */
+
+MEMORY
+{
+  /* FLASH and RAM are mandatory memory regions */
+  /* Update examples/data_overflow.rs if you change these sizes. */
+  FLASH : ORIGIN = 0x00000000, LENGTH = 256K
+  RAM : ORIGIN = 0x20000000, LENGTH = 64K
+
+  /* More memory regions can declared: for example this is a second RAM region */
+  /* CCRAM : ORIGIN = 0x10000000, LENGTH = 8K */
+}
+
+/* The location of the stack can be overridden using the `_stack_start` symbol.
+   By default it will be placed at the end of the RAM region */
+/* _stack_start = ORIGIN(CCRAM) + LENGTH(CCRAM); */
+
+/* The location of the .text section can be overridden using the `_stext` symbol.
+   By default it will place after .vector_table */
+/* _stext = ORIGIN(FLASH) + 0x40c; */
\ No newline at end of file
diff --git a/src/test/run-make/thumb-none-qemu/example/src/main.rs b/src/test/run-make/thumb-none-qemu/example/src/main.rs
new file mode 100644 (file)
index 0000000..d88a327
--- /dev/null
@@ -0,0 +1,30 @@
+// #![feature(stdsimd)]
+#![no_main]
+#![no_std]
+
+extern crate cortex_m;
+
+extern crate cortex_m_rt as rt;
+extern crate cortex_m_semihosting as semihosting;
+extern crate panic_halt;
+
+use core::fmt::Write;
+use cortex_m::asm;
+use rt::entry;
+
+entry!(main);
+
+fn main() -> ! {
+    let x = 42;
+
+    loop {
+        asm::nop();
+
+        // write something through semihosting interface
+        let mut hstdout = semihosting::hio::hstdout().unwrap();
+        write!(hstdout, "x = {}\n", x);
+
+        // exit from qemu
+        semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS);
+    }
+}
diff --git a/src/test/run-make/thumb-none-qemu/script.sh b/src/test/run-make/thumb-none-qemu/script.sh
new file mode 100644 (file)
index 0000000..0f1c49f
--- /dev/null
@@ -0,0 +1,16 @@
+set -exuo pipefail
+
+CRATE=example
+
+env | sort
+mkdir -p $WORK_DIR
+pushd $WORK_DIR
+    rm -rf $CRATE || echo OK
+    cp -a $HERE/example .
+    pushd $CRATE
+        env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \
+            $CARGO run --target $TARGET           | grep "x = 42"
+        env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \
+            $CARGO run --target $TARGET --release | grep "x = 42"
+    popd
+popd
index 156db486a47676f398148bf607f2637ffdb5ddc0..dcc2f4f5223007cd09abe8325f1b37f4510ebec6 100644 (file)
@@ -9,8 +9,6 @@
 // except according to those terms.
 
 #![crate_type = "cdylib"]
-
-#![feature(panic_implementation)]
 #![no_std]
 
 use core::panic::PanicInfo;
@@ -20,7 +18,7 @@
     panic!()
 }
 
-#[panic_implementation]
+#[panic_handler]
 fn panic(_info: &PanicInfo) -> ! {
     loop {}
 }
index 3832c040108f8f0b0ad35306357929331a479255..a12dad4489df92384837f0709350b449c40fc73e 100644 (file)
@@ -12,7 +12,8 @@
 
 use std::mem::size_of;
 
-// compile-flags: -Z fuel=foo=0
+// (#55495: The --error-format is to sidestep an issue in our test harness)
+// compile-flags: --error-format human -Z fuel=foo=0
 
 struct S1(u8, u16, u8);
 struct S2(u8, u16, u8);
diff --git a/src/test/run-pass/optimization-fuel-0.stderr b/src/test/run-pass/optimization-fuel-0.stderr
new file mode 100644 (file)
index 0000000..3ad405b
--- /dev/null
@@ -0,0 +1 @@
+optimization-fuel-exhausted: Reorder fields of "S1"
diff --git a/src/test/run-pass/optimization-fuel-0.stdout b/src/test/run-pass/optimization-fuel-0.stdout
deleted file mode 100644 (file)
index 3ad405b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-optimization-fuel-exhausted: Reorder fields of "S1"
index e3529ebfb0d811fa629df89c0a896aea5730495e..1e76aaa48b761065cfb20c24e0ef6a5bfb7ffeb2 100644 (file)
@@ -12,7 +12,8 @@
 
 use std::mem::size_of;
 
-// compile-flags: -Z fuel=foo=1
+// (#55495: The --error-format is to sidestep an issue in our test harness)
+// compile-flags: --error-format human -Z fuel=foo=1
 
 struct S1(u8, u16, u8);
 struct S2(u8, u16, u8);
diff --git a/src/test/run-pass/optimization-fuel-1.stderr b/src/test/run-pass/optimization-fuel-1.stderr
new file mode 100644 (file)
index 0000000..197e452
--- /dev/null
@@ -0,0 +1 @@
+optimization-fuel-exhausted: Reorder fields of "S2"
diff --git a/src/test/run-pass/optimization-fuel-1.stdout b/src/test/run-pass/optimization-fuel-1.stdout
deleted file mode 100644 (file)
index 197e452..0000000
+++ /dev/null
@@ -1 +0,0 @@
-optimization-fuel-exhausted: Reorder fields of "S2"
diff --git a/src/test/run-pass/thread-local-not-in-prelude.rs b/src/test/run-pass/thread-local-not-in-prelude.rs
new file mode 100644 (file)
index 0000000..0c36559
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![no_std]
+
+extern crate std;
+
+std::thread_local!(static A: usize = 30);
+
+fn main() {
+}
diff --git a/src/test/rustdoc/issue-54705.rs b/src/test/rustdoc/issue-54705.rs
new file mode 100644 (file)
index 0000000..ccc9396
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+pub trait ScopeHandle<'scope> {}
+
+
+
+// @has issue_54705/struct.ScopeFutureContents.html
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'scope, S> \
+// Send for ScopeFutureContents<'scope, S> where S: Sync"
+//
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'scope, S> \
+// Sync for ScopeFutureContents<'scope, S> where S: Sync"
+pub struct ScopeFutureContents<'scope, S>
+    where S: ScopeHandle<'scope>,
+{
+    dummy: &'scope S,
+    this: Box<ScopeFuture<'scope, S>>,
+}
+
+struct ScopeFuture<'scope, S>
+    where S: ScopeHandle<'scope>,
+{
+    contents: ScopeFutureContents<'scope, S>,
+}
+
+unsafe impl<'scope, S> Send for ScopeFuture<'scope, S>
+    where S: ScopeHandle<'scope>,
+{}
+unsafe impl<'scope, S> Sync for ScopeFuture<'scope, S>
+    where S: ScopeHandle<'scope>,
+{}
index c2b54e37e399d9cc724b9af569013f729ea560cb..543eb2ac84263f70cf6ba80d336051b966d69e5f 100644 (file)
 // ignore-mips
 // ignore-mips64
 
-#![feature(asm, rustc_attrs)]
+#![feature(asm)]
 
 #[cfg(any(target_arch = "x86",
           target_arch = "x86_64"))]
-#[rustc_error]
+
 pub fn main() {
     unsafe {
         // clobber formatted as register input/output
index bfc1fd68fe07ba4845ad506db3cac119c1dc1ebc..bb75fbc5bc4ca2a7c793e118853a06ba4175ad0a 100644 (file)
 // ignore-mips
 // ignore-mips64
 
-#![feature(asm, rustc_attrs)]
-
+// compile-pass
+// skip-codegen
+#![feature(asm)]
 #![allow(dead_code, non_upper_case_globals)]
 
 #[cfg(any(target_arch = "x86",
           target_arch = "x86_64"))]
-#[rustc_error]
-pub fn main() { //~ ERROR compilation successful
+pub fn main() {
     // assignment not dead
     let mut x: isize = 0;
     unsafe {
index 46723918a3afe45b600ce6126293efaa1f19daa5..589fd47cc1ed591b853d3482e9ca14b0831baaaf 100644 (file)
@@ -10,17 +10,3 @@ warning: expected a clobber, found an option
 LL |         asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile");
    |                                                                                ^^^^^^^^^^
 
-error: compilation successful
-  --> $DIR/asm-misplaced-option.rs:31:1
-   |
-LL | / pub fn main() { //~ ERROR compilation successful
-LL | |     // assignment not dead
-LL | |     let mut x: isize = 0;
-LL | |     unsafe {
-...  |
-LL | |     assert_eq!(x, 13);
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index a753527ea53d55f341943aa9cedd98d90b4783de..c4b8164522c0e8dcbaf8048e783406cda1927df9 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(warnings)]
-
 pub type ParseResult<T> = Result<T, ()>;
 
 pub enum Item<'a> {     Literal(&'a str),
@@ -35,5 +35,5 @@ macro_rules! try_consume {
     Ok(())
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/associated-types/cache/chrono-scan.stderr b/src/test/ui/associated-types/cache/chrono-scan.stderr
deleted file mode 100644 (file)
index 99281e7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/chrono-scan.rs:39:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index d1117328c8657b3213746f72714f027b46509037..01bf25ba9937f6faa0b7ea848404edfb4d37b6f2 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(warnings)]
-
 // Check that you are allowed to implement using elision but write
 // trait without elision (a bug in this cropped up during
 // bootstrapping, so this is a regression test).
@@ -30,5 +30,5 @@ fn split_whitespace(&self) -> SplitWhitespace {
     }
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/associated-types/cache/elision.stderr b/src/test/ui/associated-types/cache/elision.stderr
deleted file mode 100644 (file)
index c5314b5..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/elision.rs:34:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index c9394954c5fbd3485c99e74abf0a6e8b9f3d1ce6..1a8c18db8968a4b45d8fd33ac140be5478843715 100644 (file)
 
 #![warn(unused)]
 #![deny(warnings)]
-#![feature(rustc_attrs)]
-
+// compile-pass
+// skip-codegen
 use std::option; //~ WARN
 
-#[rustc_error]
-fn main() {} //~ ERROR: compilation successful
+
+fn main() {}
 
index d32246073146f3bd2a6f095b81afc0ae873f9509..aa455c51932e0d6317000deb2530eb22647f3b4e 100644 (file)
@@ -11,11 +11,3 @@ LL | #![deny(warnings)]
    |         ^^^^^^^^
    = note: #[warn(unused_imports)] implied by #[warn(warnings)]
 
-error: compilation successful
-  --> $DIR/bad-lint-cap3.rs:20:1
-   |
-LL | fn main() {} //~ ERROR: compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 545a60f6770d9471d24ffd0230fc4c8c0de8c17a..612375f904783995bc27aec4d96f1e1466402055 100644 (file)
@@ -20,6 +20,29 @@ LL |     x.clone();  //~ ERROR: use of moved value
    |
    = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
 
+error[E0505]: cannot move out of `x` because it is borrowed
+  --> $DIR/binop-move-semantics.rs:31:5
+   |
+LL |     let m = &x;
+   |             -- borrow of `x` occurs here
+...
+LL |     x  //~ ERROR: cannot move out of `x` because it is borrowed
+   |     ^ move out of `x` occurs here
+...
+LL |     use_mut(n); use_imm(m);
+   |                         - borrow later used here
+
+error[E0505]: cannot move out of `y` because it is borrowed
+  --> $DIR/binop-move-semantics.rs:33:5
+   |
+LL |     let n = &mut y;
+   |             ------ borrow of `y` occurs here
+...
+LL |     y;  //~ ERROR: cannot move out of `y` because it is borrowed
+   |     ^ move out of `y` occurs here
+LL |     use_mut(n); use_imm(m);
+   |             - borrow later used here
+
 error[E0507]: cannot move out of borrowed content
   --> $DIR/binop-move-semantics.rs:40:5
    |
@@ -62,7 +85,7 @@ LL | |     &mut f;  //~ ERROR: cannot borrow `f` as mutable because it is also b
    |       |    immutable borrow later used here
    |       mutable borrow occurs here
 
-error: aborting due to 6 previous errors
+error: aborting due to 8 previous errors
 
-Some errors occurred: E0382, E0502, E0507.
+Some errors occurred: E0382, E0502, E0505, E0507.
 For more information about an error, try `rustc --explain E0382`.
index cff0064497aff34ac814b8be55d4a1b9c4e64b9d..f6fad8b46dd9d4f68ff983ca8959f45924652404 100644 (file)
@@ -31,8 +31,8 @@ fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) {
     x  //~ ERROR: cannot move out of `x` because it is borrowed
     +
     y;  //~ ERROR: cannot move out of `y` because it is borrowed
+    use_mut(n); use_imm(m);
 }
-
 fn illegal_dereference<T: Add<Output=()>>(mut x: T, y: T) {
     let m = &mut x;
     let n = &y;
@@ -40,8 +40,8 @@ fn illegal_dereference<T: Add<Output=()>>(mut x: T, y: T) {
     *m  //~ ERROR: cannot move out of borrowed content
     +
     *n;  //~ ERROR: cannot move out of borrowed content
+    use_imm(n); use_mut(m);
 }
-
 struct Foo;
 
 impl<'a, 'b> Add<&'b Foo> for &'a mut Foo {
@@ -73,3 +73,6 @@ fn immut_plus_mut() {
 }
 
 fn main() {}
+
+fn use_mut<T>(_: &mut T) { }
+fn use_imm<T>(_: &T) { }
index e8fae63a5d617d1c2ec63cd36e9fea79d9cf6ed2..160a84c480cd31a6f930ed18b7a6bac3a9c52c1b 100644 (file)
@@ -1,15 +1,32 @@
 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
-  --> $DIR/borrowck-closures-mut-of-imm.rs:23:21
+  --> $DIR/borrowck-closures-mut-of-imm.rs:23:25
    |
-LL |     let c1 = || set(&mut *x);
-   |                     ^^^^^^^ cannot borrow as mutable
+LL |     let mut c1 = || set(&mut *x);
+   |                         ^^^^^^^ cannot borrow as mutable
 
 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
-  --> $DIR/borrowck-closures-mut-of-imm.rs:25:21
+  --> $DIR/borrowck-closures-mut-of-imm.rs:25:25
    |
-LL |     let c2 = || set(&mut *x);
-   |                     ^^^^^^^ cannot borrow as mutable
+LL |     let mut c2 = || set(&mut *x);
+   |                         ^^^^^^^ cannot borrow as mutable
 
-error: aborting due to 2 previous errors
+error[E0524]: two closures require unique access to `x` at the same time
+  --> $DIR/borrowck-closures-mut-of-imm.rs:25:18
+   |
+LL |     let mut c1 = || set(&mut *x);
+   |                  --           - first borrow occurs due to use of `x` in closure
+   |                  |
+   |                  first closure is constructed here
+LL |     //~^ ERROR cannot borrow
+LL |     let mut c2 = || set(&mut *x);
+   |                  ^^           - second borrow occurs due to use of `x` in closure
+   |                  |
+   |                  second closure is constructed here
+...
+LL |     c2(); c1();
+   |           -- first borrow later used here
+
+error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0596`.
+Some errors occurred: E0524, E0596.
+For more information about an error, try `rustc --explain E0524`.
index dc2f0e8395f08154172853662d3d83f97d12ac09..3bf4f17fde1a808a997df2ab9575d0d9822ecc7d 100644 (file)
@@ -20,11 +20,12 @@ fn set(x: &mut isize) {
 }
 
 fn a(x: &isize) {
-    let c1 = || set(&mut *x);
+    let mut c1 = || set(&mut *x);
     //~^ ERROR cannot borrow
-    let c2 = || set(&mut *x);
+    let mut c2 = || set(&mut *x);
     //~^ ERROR cannot borrow
     //~| ERROR two closures require unique access to `x` at the same time
+    c2(); c1();
 }
 
 fn main() {
index 87eb52b6aa6052ab13421e9a621bc7bd90aab2d6..c248595d57119c1929283086d1e52ea3c5cbb451 100644 (file)
@@ -1,30 +1,30 @@
 error[E0524]: two closures require unique access to `x` at the same time
-  --> $DIR/borrowck-closures-mut-of-imm.rs:25:14
+  --> $DIR/borrowck-closures-mut-of-imm.rs:25:18
    |
-LL |     let c1 = || set(&mut *x);
-   |              --           - previous borrow occurs due to use of `x` in closure
-   |              |
-   |              first closure is constructed here
+LL |     let mut c1 = || set(&mut *x);
+   |                  --           - previous borrow occurs due to use of `x` in closure
+   |                  |
+   |                  first closure is constructed here
 LL |     //~^ ERROR cannot borrow
-LL |     let c2 = || set(&mut *x);
-   |              ^^           - borrow occurs due to use of `x` in closure
-   |              |
-   |              second closure is constructed here
+LL |     let mut c2 = || set(&mut *x);
+   |                  ^^           - borrow occurs due to use of `x` in closure
+   |                  |
+   |                  second closure is constructed here
 ...
 LL | }
    | - borrow from first closure ends here
 
 error[E0596]: cannot borrow immutable borrowed content `***x` as mutable
-  --> $DIR/borrowck-closures-mut-of-imm.rs:23:26
+  --> $DIR/borrowck-closures-mut-of-imm.rs:23:30
    |
-LL |     let c1 = || set(&mut *x);
-   |                          ^^ cannot borrow as mutable
+LL |     let mut c1 = || set(&mut *x);
+   |                              ^^ cannot borrow as mutable
 
 error[E0596]: cannot borrow immutable borrowed content `***x` as mutable
-  --> $DIR/borrowck-closures-mut-of-imm.rs:25:26
+  --> $DIR/borrowck-closures-mut-of-imm.rs:25:30
    |
-LL |     let c2 = || set(&mut *x);
-   |                          ^^ cannot borrow as mutable
+LL |     let mut c2 = || set(&mut *x);
+   |                              ^^ cannot borrow as mutable
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr
new file mode 100644 (file)
index 0000000..18f95f2
--- /dev/null
@@ -0,0 +1,18 @@
+error[E0524]: two closures require unique access to `x` at the same time
+  --> $DIR/borrowck-closures-mut-of-mut.rs:14:18
+   |
+LL |     let mut c1 = || set(&mut *x);
+   |                  --           - first borrow occurs due to use of `x` in closure
+   |                  |
+   |                  first closure is constructed here
+LL |     let mut c2 = || set(&mut *x);
+   |                  ^^           - second borrow occurs due to use of `x` in closure
+   |                  |
+   |                  second closure is constructed here
+LL |     //~^ ERROR two closures require unique access to `x` at the same time
+LL |     c2(); c1();
+   |           -- first borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0524`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.rs b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.rs
new file mode 100644 (file)
index 0000000..50c6f2c
--- /dev/null
@@ -0,0 +1,20 @@
+// Tests that two closures cannot simultaneously both have mutable
+// access to the variable. Related to issue #6801.
+
+fn get(x: &isize) -> isize {
+    *x
+}
+
+fn set(x: &mut isize) {
+    *x = 4;
+}
+
+fn a(x: &mut isize) {
+    let mut c1 = || set(&mut *x);
+    let mut c2 = || set(&mut *x);
+    //~^ ERROR two closures require unique access to `x` at the same time
+    c2(); c1();
+}
+
+fn main() {
+}
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr
new file mode 100644 (file)
index 0000000..2c55877
--- /dev/null
@@ -0,0 +1,18 @@
+error[E0524]: two closures require unique access to `x` at the same time
+  --> $DIR/borrowck-closures-mut-of-mut.rs:14:18
+   |
+LL |     let mut c1 = || set(&mut *x);
+   |                  --           - previous borrow occurs due to use of `x` in closure
+   |                  |
+   |                  first closure is constructed here
+LL |     let mut c2 = || set(&mut *x);
+   |                  ^^           - borrow occurs due to use of `x` in closure
+   |                  |
+   |                  second closure is constructed here
+...
+LL | }
+   | - borrow from first closure ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0524`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.ast.stderr b/src/test/ui/borrowck/borrowck-lend-flow-loop.ast.stderr
new file mode 100644 (file)
index 0000000..1844d82
--- /dev/null
@@ -0,0 +1,93 @@
+error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
+  --> $DIR/borrowck-lend-flow-loop.rs:35:17
+   |
+LL |     let mut x = &mut v;
+   |                      - mutable borrow occurs here
+...
+LL |         borrow(&*v); //[ast]~ ERROR cannot borrow
+   |                 ^^ immutable borrow occurs here
+LL |     }
+LL | }
+   | - mutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
+  --> $DIR/borrowck-lend-flow-loop.rs:45:17
+   |
+LL |     let mut x = &mut v;
+   |                      - mutable borrow occurs here
+LL |     for _ in 0..3 {
+LL |         borrow(&*v); //[ast]~ ERROR cannot borrow
+   |                 ^^ immutable borrow occurs here
+...
+LL | }
+   | - mutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
+  --> $DIR/borrowck-lend-flow-loop.rs:57:25
+   |
+LL |         borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
+   |                         ^^ mutable borrow occurs here
+LL |         _x = &v;
+   |               - immutable borrow occurs here
+LL |     }
+LL | }
+   | - immutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
+  --> $DIR/borrowck-lend-flow-loop.rs:69:25
+   |
+LL |         borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
+   |                         ^^ mutable borrow occurs here
+LL |         _x = &v;
+   |               - immutable borrow occurs here
+LL |     }
+LL | }
+   | - immutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
+  --> $DIR/borrowck-lend-flow-loop.rs:86:21
+   |
+LL |         _x = &v;
+   |               - immutable borrow occurs here
+...
+LL |     borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
+   |                     ^^ mutable borrow occurs here
+LL | }
+   | - immutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
+  --> $DIR/borrowck-lend-flow-loop.rs:100:21
+   |
+LL |         _x = &v;
+   |               - immutable borrow occurs here
+...
+LL |     borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
+   |                     ^^ mutable borrow occurs here
+LL | }
+   | - immutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
+  --> $DIR/borrowck-lend-flow-loop.rs:109:17
+   |
+LL |         borrow(&*v); //[ast]~ ERROR cannot borrow
+   |                 ^^ immutable borrow occurs here
+...
+LL |             x = &mut v; //[ast]~ ERROR cannot borrow
+   |                      - mutable borrow occurs here
+...
+LL | }
+   | - mutable borrow ends here
+
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+  --> $DIR/borrowck-lend-flow-loop.rs:112:22
+   |
+LL |             x = &mut v; //[ast]~ ERROR cannot borrow
+   |                      ^ mutable borrow starts here in previous iteration of loop
+...
+LL | }
+   | - mutable borrow ends here
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
index 388fc9c5fa8acd976911a2ebb7180eb76cd7dd23..19de3582c881964372e0b23851fca87a1bd352c0 100644 (file)
@@ -4,9 +4,9 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mut
 LL |     let mut x = &mut v;
    |                 ------ mutable borrow occurs here
 LL |     for _ in 0..3 {
-LL |         borrow(&*v); //~ ERROR cannot borrow
+LL |         borrow(&*v); //[ast]~ ERROR cannot borrow
    |                ^^^ immutable borrow occurs here
-LL |     }
+...
 LL |     *x = box 5;
    |     -- mutable borrow used here, in later iteration of loop
 
@@ -15,10 +15,10 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mut
    |
 LL |         **x += 1;
    |         -------- mutable borrow used here, in later iteration of loop
-LL |         borrow(&*v); //~ ERROR cannot borrow
+LL |         borrow(&*v); //[ast]~ ERROR cannot borrow
    |                ^^^ immutable borrow occurs here
-LL |         if cond2 {
-LL |             x = &mut v; //~ ERROR cannot borrow
+...
+LL |             x = &mut v; //[ast]~ ERROR cannot borrow
    |                 ------ mutable borrow occurs here
 
 error: aborting due to 2 previous errors
index f09e7ffd7e4b791c4b51472ca9db8013b79e0659..7008e5cef4b7587380ebd06ca5caf538beab8df6 100644 (file)
@@ -1,18 +1,18 @@
-// 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.
-
-// Note: the borrowck analysis is currently flow-insensitive.
-// Therefore, some of these errors are marked as spurious and could be
-// corrected by a simple change to the analysis.  The others are
-// either genuine or would require more advanced changes.  The latter
-// cases are noted.
+// revisions: ast nll
+
+// Since we are testing nll migration explicitly as a separate
+// revision, don't worry about the --compare-mode=nll on this test.
+
+// ignore-compare-mode-nll
+
+//[ast]compile-flags: -Z borrowck=ast
+//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+
+// Note: the borrowck analysis was originally a flow-insensitive pass
+// over the AST. Therefore, some of these (AST) errors are marked as
+// spurious and are corrected by the flow-sensitive (NLL) analysis.
+// The others are either genuine or would require more advanced
+// changes. The latter cases are noted.
 
 #![feature(box_syntax)]
 
@@ -32,7 +32,7 @@ fn loop_overarching_alias_mut() {
     let mut x = &mut v;
     **x += 1;
     loop {
-        borrow(&*v); //~ ERROR cannot borrow
+        borrow(&*v); //[ast]~ ERROR cannot borrow
     }
 }
 
@@ -42,11 +42,11 @@ fn block_overarching_alias_mut() {
     let mut v: Box<_> = box 3;
     let mut x = &mut v;
     for _ in 0..3 {
-        borrow(&*v); //~ ERROR cannot borrow
+        borrow(&*v); //[ast]~ ERROR cannot borrow
+        //[nll]~^ ERROR cannot borrow
     }
     *x = box 5;
 }
-
 fn loop_aliased_mut() {
     // In this instance, the borrow is carried through the loop.
 
@@ -54,7 +54,7 @@ fn loop_aliased_mut() {
     let mut w: Box<_> = box 4;
     let mut _x = &w;
     loop {
-        borrow_mut(&mut *v); //~ ERROR cannot borrow
+        borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
         _x = &v;
     }
 }
@@ -66,7 +66,7 @@ fn while_aliased_mut() {
     let mut w: Box<_> = box 4;
     let mut _x = &w;
     while cond() {
-        borrow_mut(&mut *v); //~ ERROR cannot borrow
+        borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
         _x = &v;
     }
 }
@@ -83,7 +83,7 @@ fn loop_aliased_mut_break() {
         _x = &v;
         break;
     }
-    borrow_mut(&mut *v); //~ ERROR cannot borrow
+    borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
 }
 
 fn while_aliased_mut_break() {
@@ -97,7 +97,7 @@ fn while_aliased_mut_break() {
         _x = &v;
         break;
     }
-    borrow_mut(&mut *v); //~ ERROR cannot borrow
+    borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
 }
 
 fn while_aliased_mut_cond(cond: bool, cond2: bool) {
@@ -106,13 +106,13 @@ fn while_aliased_mut_cond(cond: bool, cond2: bool) {
     let mut x = &mut w;
     while cond {
         **x += 1;
-        borrow(&*v); //~ ERROR cannot borrow
+        borrow(&*v); //[ast]~ ERROR cannot borrow
+        //[nll]~^ ERROR cannot borrow
         if cond2 {
-            x = &mut v; //~ ERROR cannot borrow
+            x = &mut v; //[ast]~ ERROR cannot borrow
         }
     }
 }
-
 fn loop_break_pops_scopes<'r, F>(_v: &'r mut [usize], mut f: F) where
     F: FnMut(&'r mut usize) -> bool,
 {
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr b/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr
deleted file mode 100644 (file)
index 534e30b..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
-  --> $DIR/borrowck-lend-flow-loop.rs:35:17
-   |
-LL |     let mut x = &mut v;
-   |                      - mutable borrow occurs here
-...
-LL |         borrow(&*v); //~ ERROR cannot borrow
-   |                 ^^ immutable borrow occurs here
-LL |     }
-LL | }
-   | - mutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
-  --> $DIR/borrowck-lend-flow-loop.rs:45:17
-   |
-LL |     let mut x = &mut v;
-   |                      - mutable borrow occurs here
-LL |     for _ in 0..3 {
-LL |         borrow(&*v); //~ ERROR cannot borrow
-   |                 ^^ immutable borrow occurs here
-...
-LL | }
-   | - mutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
-  --> $DIR/borrowck-lend-flow-loop.rs:57:25
-   |
-LL |         borrow_mut(&mut *v); //~ ERROR cannot borrow
-   |                         ^^ mutable borrow occurs here
-LL |         _x = &v;
-   |               - immutable borrow occurs here
-LL |     }
-LL | }
-   | - immutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
-  --> $DIR/borrowck-lend-flow-loop.rs:69:25
-   |
-LL |         borrow_mut(&mut *v); //~ ERROR cannot borrow
-   |                         ^^ mutable borrow occurs here
-LL |         _x = &v;
-   |               - immutable borrow occurs here
-LL |     }
-LL | }
-   | - immutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
-  --> $DIR/borrowck-lend-flow-loop.rs:86:21
-   |
-LL |         _x = &v;
-   |               - immutable borrow occurs here
-...
-LL |     borrow_mut(&mut *v); //~ ERROR cannot borrow
-   |                     ^^ mutable borrow occurs here
-LL | }
-   | - immutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
-  --> $DIR/borrowck-lend-flow-loop.rs:100:21
-   |
-LL |         _x = &v;
-   |               - immutable borrow occurs here
-...
-LL |     borrow_mut(&mut *v); //~ ERROR cannot borrow
-   |                     ^^ mutable borrow occurs here
-LL | }
-   | - immutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
-  --> $DIR/borrowck-lend-flow-loop.rs:109:17
-   |
-LL |         borrow(&*v); //~ ERROR cannot borrow
-   |                 ^^ immutable borrow occurs here
-LL |         if cond2 {
-LL |             x = &mut v; //~ ERROR cannot borrow
-   |                      - mutable borrow occurs here
-...
-LL | }
-   | - mutable borrow ends here
-
-error[E0499]: cannot borrow `v` as mutable more than once at a time
-  --> $DIR/borrowck-lend-flow-loop.rs:111:22
-   |
-LL |             x = &mut v; //~ ERROR cannot borrow
-   |                      ^ mutable borrow starts here in previous iteration of loop
-...
-LL | }
-   | - mutable borrow ends here
-
-error: aborting due to 8 previous errors
-
-Some errors occurred: E0499, E0502.
-For more information about an error, try `rustc --explain E0499`.
index dc8d731dede74236aa65119e9528b939d291f697..0c4f2fa9d718bbca248899b6aada15b77244cf82 100644 (file)
@@ -1,3 +1,13 @@
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-overloaded-call.rs:69:5
+   |
+LL |     let sp = &mut s;
+   |              ------ mutable borrow occurs here
+LL |     s(3);   //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
+   |     ^ immutable borrow occurs here
+LL |     use_mut(sp);
+   |             -- mutable borrow later used here
+
 error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
   --> $DIR/borrowck-overloaded-call.rs:77:5
    |
@@ -17,7 +27,7 @@ LL |     s(" world".to_string());    //~ ERROR use of moved value: `s`
    |
    = note: move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
-Some errors occurred: E0382, E0596.
+Some errors occurred: E0382, E0502, E0596.
 For more information about an error, try `rustc --explain E0382`.
index 41f3e472cd125596078db87236915af96f336bef..b2401fbbc042c559739427564959380a316df284 100644 (file)
@@ -67,8 +67,8 @@ fn f() {
     };
     let sp = &mut s;
     s(3);   //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
+    use_mut(sp);
 }
-
 fn g() {
     let s = SFnMut {
         x: 1,
@@ -86,3 +86,5 @@ fn h() {
 }
 
 fn main() {}
+
+fn use_mut<T>(_: &mut T) { }
index fa2473adc2ffd14a5a5617b9b8772953bbae8140..bb5bafbbc7b85a0dbb314d7e0868831829e4a5e7 100644 (file)
@@ -5,6 +5,7 @@ LL |     let sp = &mut s;
    |                   - mutable borrow occurs here
 LL |     s(3);   //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
    |     ^ immutable borrow occurs here
+LL |     use_mut(sp);
 LL | }
    | - mutable borrow ends here
 
index 824d8298ecbc671e28457576fc7591c60d0d4e99..198d086aa3be6d9926fef9eab1fa8d8087f3d4a4 100644 (file)
@@ -1,3 +1,27 @@
+error[E0505]: cannot move out of `s` because it is borrowed
+  --> $DIR/borrowck-overloaded-index-move-index.rs:60:22
+   |
+LL |     let rs = &mut s;
+   |              ------ borrow of `s` occurs here
+LL | 
+LL |     println!("{}", f[s]);
+   |                      ^ move out of `s` occurs here
+...
+LL |     use_mut(rs);
+   |             -- borrow later used here
+
+error[E0505]: cannot move out of `s` because it is borrowed
+  --> $DIR/borrowck-overloaded-index-move-index.rs:63:7
+   |
+LL |     let rs = &mut s;
+   |              ------ borrow of `s` occurs here
+...
+LL |     f[s] = 10;
+   |       ^ move out of `s` occurs here
+...
+LL |     use_mut(rs);
+   |             -- borrow later used here
+
 error[E0382]: use of moved value: `s`
   --> $DIR/borrowck-overloaded-index-move-index.rs:63:7
    |
@@ -9,6 +33,7 @@ LL |     f[s] = 10;
    |
    = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
 
-error: aborting due to previous error
+error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0382`.
+Some errors occurred: E0382, E0505.
+For more information about an error, try `rustc --explain E0382`.
index d8615d1905338444f1ff3ab171f15b19b18c3ebe..e95423a8e834d78e224b0c0568c95a2805900f01 100644 (file)
@@ -71,4 +71,8 @@ fn main() {
     let _j = &i;
     println!("{}", s[i]); // no error, i is copy
     println!("{}", s[i]);
+
+    use_mut(rs);
 }
+
+fn use_mut<T>(_: &mut T) { }
index 4c81bb8eb3086401951f30a7391fd4e2324c684e..1b4f9e77da80b77d17041e91862687bb23b3d34a 100644 (file)
@@ -1,3 +1,107 @@
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+  --> $DIR/borrowck-reborrow-from-mut.rs:23:17
+   |
+LL |     let _bar1 = &mut foo.bar1;
+   |                 ------------- first mutable borrow occurs here
+LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+   |                 ^^^^^^^^^^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
+   |             ----- first borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:28:17
+   |
+LL |     let _bar1 = &mut foo.bar1;
+   |                 ------------- mutable borrow occurs here
+LL |     let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
+   |                 ^^^^^^^^^ immutable borrow occurs here
+LL |     use_mut(_bar1);
+   |             ----- mutable borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:33:17
+   |
+LL |     let _bar1 = &foo.bar1;
+   |                 --------- immutable borrow occurs here
+LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+   |                 ^^^^^^^^^^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
+   |             ----- immutable borrow later used here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+  --> $DIR/borrowck-reborrow-from-mut.rs:55:21
+   |
+LL |     let _bar1 = &mut foo.bar1;
+   |                 ------------- first mutable borrow occurs here
+LL |     match *foo {
+LL |         Foo { bar1: ref mut _bar1, bar2: _ } => {}
+   |                     ^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL |     use_mut(_bar1);
+   |             ----- first borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:62:17
+   |
+LL |     let _bar1 = &mut foo.bar1.int1;
+   |                 ------------------ mutable borrow occurs here
+LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+   |                 ^^^^^^^^^ immutable borrow occurs here
+LL |     let _foo2 = &*foo; //~ ERROR cannot borrow
+LL |     use_mut(_bar1);
+   |             ----- mutable borrow later used here
+
+error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:63:17
+   |
+LL |     let _bar1 = &mut foo.bar1.int1;
+   |                 ------------------ mutable borrow occurs here
+LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+LL |     let _foo2 = &*foo; //~ ERROR cannot borrow
+   |                 ^^^^^ immutable borrow occurs here
+LL |     use_mut(_bar1);
+   |             ----- mutable borrow later used here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+  --> $DIR/borrowck-reborrow-from-mut.rs:68:17
+   |
+LL |     let _bar1 = &mut foo.bar1.int1;
+   |                 ------------------ first mutable borrow occurs here
+LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+   |                 ^^^^^^^^^^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
+   |             ----- first borrow later used here
+
+error[E0499]: cannot borrow `*foo` as mutable more than once at a time
+  --> $DIR/borrowck-reborrow-from-mut.rs:73:17
+   |
+LL |     let _bar1 = &mut foo.bar1.int1;
+   |                 ------------------ first mutable borrow occurs here
+LL |     let _foo2 = &mut *foo; //~ ERROR cannot borrow
+   |                 ^^^^^^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
+   |             ----- first borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:78:17
+   |
+LL |     let _bar1 = &foo.bar1.int1;
+   |                 -------------- immutable borrow occurs here
+LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+   |                 ^^^^^^^^^^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
+   |             ----- immutable borrow later used here
+
+error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:83:17
+   |
+LL |     let _bar1 = &foo.bar1.int1;
+   |                 -------------- immutable borrow occurs here
+LL |     let _foo2 = &mut *foo; //~ ERROR cannot borrow
+   |                 ^^^^^^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
+   |             ----- immutable borrow later used here
+
 error[E0596]: cannot borrow `foo.bar1` as mutable, as it is behind a `&` reference
   --> $DIR/borrowck-reborrow-from-mut.rs:98:17
    |
@@ -6,6 +110,7 @@ LL | fn borrow_mut_from_imm(foo: &Foo) {
 LL |     let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow
    |                 ^^^^^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be borrowed as mutable
 
-error: aborting due to previous error
+error: aborting due to 11 previous errors
 
-For more information about this error, try `rustc --explain E0596`.
+Some errors occurred: E0499, E0502, E0596.
+For more information about an error, try `rustc --explain E0499`.
index 6f5dfa67be50debc5837b965d18eff2e5281c4bb..9235d900a7e792db5a978ebcc8550601269eb84e 100644 (file)
@@ -21,79 +21,79 @@ struct Bar {
 fn borrow_same_field_twice_mut_mut(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+    use_mut(_bar1);
 }
-
 fn borrow_same_field_twice_mut_imm(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
+    use_mut(_bar1);
 }
-
 fn borrow_same_field_twice_imm_mut(foo: &mut Foo) {
     let _bar1 = &foo.bar1;
     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+    use_imm(_bar1);
 }
-
 fn borrow_same_field_twice_imm_imm(foo: &mut Foo) {
     let _bar1 = &foo.bar1;
     let _bar2 = &foo.bar1;
+    use_imm(_bar1);
 }
-
 fn borrow_both_mut(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     let _bar2 = &mut foo.bar2;
+    use_mut(_bar1);
 }
-
 fn borrow_both_mut_pattern(foo: &mut Foo) {
     match *foo {
-        Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {}
+        Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } =>
+        { use_mut(_bar1); use_mut(_bar2); }
     }
 }
-
 fn borrow_var_and_pattern(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     match *foo {
         Foo { bar1: ref mut _bar1, bar2: _ } => {}
         //~^ ERROR cannot borrow
     }
+    use_mut(_bar1);
 }
-
 fn borrow_mut_and_base_imm(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
     let _foo2 = &*foo; //~ ERROR cannot borrow
+    use_mut(_bar1);
 }
-
 fn borrow_mut_and_base_mut(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+    use_mut(_bar1);
 }
-
 fn borrow_mut_and_base_mut2(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
     let _foo2 = &mut *foo; //~ ERROR cannot borrow
+    use_mut(_bar1);
 }
-
 fn borrow_imm_and_base_mut(foo: &mut Foo) {
     let _bar1 = &foo.bar1.int1;
     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+    use_imm(_bar1);
 }
-
 fn borrow_imm_and_base_mut2(foo: &mut Foo) {
     let _bar1 = &foo.bar1.int1;
     let _foo2 = &mut *foo; //~ ERROR cannot borrow
+    use_imm(_bar1);
 }
-
 fn borrow_imm_and_base_imm(foo: &mut Foo) {
     let _bar1 = &foo.bar1.int1;
     let _foo1 = &foo.bar1;
     let _foo2 = &*foo;
+    use_imm(_bar1);
 }
-
 fn borrow_mut_and_imm(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     let _foo1 = &foo.bar2;
+    use_mut(_bar1);
 }
-
 fn borrow_mut_from_imm(foo: &Foo) {
     let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow
 }
@@ -101,6 +101,9 @@ fn borrow_mut_from_imm(foo: &Foo) {
 fn borrow_long_path_both_mut(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
     let _foo1 = &mut foo.bar2.int2;
+    use_mut(_bar1);
 }
-
 fn main() {}
+
+fn use_mut<T>(_: &mut T) { }
+fn use_imm<T>(_: &T) { }
index 00660ff84841b002184430a75d46ff25b9b94596..1310e38cb3ee6f7567b57d9f51b80f9889374bad 100644 (file)
@@ -5,6 +5,7 @@ LL |     let _bar1 = &mut foo.bar1;
    |                      -------- first mutable borrow occurs here
 LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
    |                      ^^^^^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
 LL | }
    | - first borrow ends here
 
@@ -15,6 +16,7 @@ LL |     let _bar1 = &mut foo.bar1;
    |                      -------- mutable borrow occurs here
 LL |     let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
    |                  ^^^^^^^^ immutable borrow occurs here
+LL |     use_mut(_bar1);
 LL | }
    | - mutable borrow ends here
 
@@ -25,6 +27,7 @@ LL |     let _bar1 = &foo.bar1;
    |                  -------- immutable borrow occurs here
 LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
    |                      ^^^^^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
 LL | }
    | - immutable borrow ends here
 
@@ -47,7 +50,7 @@ LL |     let _bar1 = &mut foo.bar1.int1;
    |                      ------------- mutable borrow occurs here
 LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
    |                  ^^^^^^^^ immutable borrow occurs here
-LL |     let _foo2 = &*foo; //~ ERROR cannot borrow
+...
 LL | }
    | - mutable borrow ends here
 
@@ -59,6 +62,7 @@ LL |     let _bar1 = &mut foo.bar1.int1;
 LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
 LL |     let _foo2 = &*foo; //~ ERROR cannot borrow
    |                  ^^^^ immutable borrow occurs here
+LL |     use_mut(_bar1);
 LL | }
    | - mutable borrow ends here
 
@@ -69,6 +73,7 @@ LL |     let _bar1 = &mut foo.bar1.int1;
    |                      ------------- first mutable borrow occurs here
 LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
    |                      ^^^^^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
 LL | }
    | - first borrow ends here
 
@@ -79,6 +84,7 @@ LL |     let _bar1 = &mut foo.bar1.int1;
    |                      ------------- first mutable borrow occurs here
 LL |     let _foo2 = &mut *foo; //~ ERROR cannot borrow
    |                      ^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
 LL | }
    | - first borrow ends here
 
@@ -89,6 +95,7 @@ LL |     let _bar1 = &foo.bar1.int1;
    |                  ------------- immutable borrow occurs here
 LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
    |                      ^^^^^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
 LL | }
    | - immutable borrow ends here
 
@@ -99,6 +106,7 @@ LL |     let _bar1 = &foo.bar1.int1;
    |                  ------------- immutable borrow occurs here
 LL |     let _foo2 = &mut *foo; //~ ERROR cannot borrow
    |                      ^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
 LL | }
    | - immutable borrow ends here
 
index 3fbb747db24f14053f5cb7d4d40b0e1cb4fe63c9..ee5ad58290e9e11a6eb7238ca3840106c071b096 100644 (file)
@@ -1,3 +1,13 @@
+error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-unboxed-closures.rs:13:5
+   |
+LL |     let g = &mut f;
+   |             ------ mutable borrow occurs here
+LL |     f(1, 2);    //~ ERROR cannot borrow `f` as immutable
+   |     ^ immutable borrow occurs here
+LL |     use_mut(g);
+   |             - mutable borrow later used here
+
 error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
   --> $DIR/borrowck-unboxed-closures.rs:17:5
    |
@@ -16,7 +26,7 @@ LL |     f(1, 2);    //~ ERROR use of moved value
    |
    = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
-Some errors occurred: E0382, E0596.
+Some errors occurred: E0382, E0502, E0596.
 For more information about an error, try `rustc --explain E0382`.
index 4813b4b6a72cd127539c5a83499786437360c209..43f143a492fd63b76108c44ec14a3ce0a73ca300 100644 (file)
@@ -11,8 +11,8 @@
 fn a<F:Fn(isize, isize) -> isize>(mut f: F) {
     let g = &mut f;
     f(1, 2);    //~ ERROR cannot borrow `f` as immutable
+    use_mut(g);
 }
-
 fn b<F:FnMut(isize, isize) -> isize>(f: F) {
     f(1, 2);    //~ ERROR cannot borrow immutable argument
 }
@@ -23,3 +23,5 @@ fn c<F:FnOnce(isize, isize) -> isize>(f: F) {
 }
 
 fn main() {}
+
+fn use_mut<T>(_: &mut T) { }
index 0c067c47004cfbe03b19236b070605bf20b7a75e..6ee1a6245a556b51774baf80effe93b1f923b68c 100644 (file)
@@ -5,6 +5,7 @@ LL |     let g = &mut f;
    |                  - mutable borrow occurs here
 LL |     f(1, 2);    //~ ERROR cannot borrow `f` as immutable
    |     ^ immutable borrow occurs here
+LL |     use_mut(g);
 LL | }
    | - mutable borrow ends here
 
diff --git a/src/test/ui/codemap_tests/overlapping_spans.nll.stderr b/src/test/ui/codemap_tests/overlapping_spans.nll.stderr
deleted file mode 100644 (file)
index e334472..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
-  --> $DIR/overlapping_spans.rs:20:11
-   |
-LL |     match (S {f:"foo".to_string()}) {
-   |           ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
-LL |         S {f:_s} => {} //~ ERROR cannot move out
-   |              -- data moved here
-   |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
-  --> $DIR/overlapping_spans.rs:21:14
-   |
-LL |         S {f:_s} => {} //~ ERROR cannot move out
-   |              ^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/codemap_tests/overlapping_spans.rs b/src/test/ui/codemap_tests/overlapping_spans.rs
deleted file mode 100644 (file)
index 467e90b..0000000
+++ /dev/null
@@ -1,23 +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.
-
-#[derive(Debug)]
-struct Foo { }
-
-struct S {f:String}
-impl Drop for S {
-    fn drop(&mut self) { println!("{}", self.f); }
-}
-
-fn main() {
-    match (S {f:"foo".to_string()}) {
-        S {f:_s} => {} //~ ERROR cannot move out
-    }
-}
diff --git a/src/test/ui/codemap_tests/overlapping_spans.stderr b/src/test/ui/codemap_tests/overlapping_spans.stderr
deleted file mode 100644 (file)
index 62a4f08..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
-  --> $DIR/overlapping_spans.rs:21:9
-   |
-LL |         S {f:_s} => {} //~ ERROR cannot move out
-   |         ^^^^^--^
-   |         |    |
-   |         |    hint: to prevent move, use `ref _s` or `ref mut _s`
-   |         cannot move out of here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0509`.
index 613ee0a269e70cd62a285e3a469da5cde0bad64c..dc417957795f5b3b6765e7ea37de569e47ee7cce 100644 (file)
@@ -14,7 +14,7 @@ LL | impl Copy for &'static NotSync {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: conflicting implementation in crate `core`:
-           - impl<'_, T> std::marker::Copy for &T
+           - impl<T> std::marker::Copy for &T
              where T: ?Sized;
 
 error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`:
@@ -24,7 +24,7 @@ LL | impl Copy for &'static [NotSync] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: conflicting implementation in crate `core`:
-           - impl<'_, T> std::marker::Copy for &T
+           - impl<T> std::marker::Copy for &T
              where T: ?Sized;
 
 error[E0206]: the trait `Copy` may not be implemented for this type
index a52af0873a8231e936c9c6acdee561515c14b9f3..1ce455123aa75237dd4e3f291e4bd952af7a5f6f 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(dead_code)]
-
 // Here we do not get a coherence conflict because `Baz: Iterator`
 // does not hold and (due to the orphan rules), we can rely on that.
 
@@ -25,5 +25,5 @@ impl Foo<i32> for Baz { }
 
 impl<A:Iterator> Foo<A::Item> for A { }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/coherence/coherence-projection-ok-orphan.stderr b/src/test/ui/coherence/coherence-projection-ok-orphan.stderr
deleted file mode 100644 (file)
index 1b9a325..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/coherence-projection-ok-orphan.rs:29:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index af88f3744eaeb428c768276bfa282382ce5905ff..dfb2ef0a2baa3a7f71672a3fa2e0b30cdcb93a0b 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
-
+// compile-pass
+// skip-codegen
 pub trait Foo<P> {}
 
 pub trait Bar {
@@ -24,5 +24,5 @@ impl Bar for i32 {
     type Output = u32;
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/coherence/coherence-projection-ok.stderr b/src/test/ui/coherence/coherence-projection-ok.stderr
deleted file mode 100644 (file)
index 945f3b3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/coherence-projection-ok.rs:28:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 9fbb7aa4cb1a7f70a180821a46bd137fdda6503a..7d41fc1fb63c47a6f7da95fdfa33475229215bc5 100644 (file)
@@ -12,8 +12,8 @@
 // `MyType: !MyTrait` along with other "fundamental" wrappers.
 
 // aux-build:coherence_copy_like_lib.rs
-
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codgen
 #![allow(dead_code)]
 
 extern crate coherence_copy_like_lib as lib;
@@ -30,5 +30,5 @@ impl<T: lib::MyCopy> MyTrait for T { }
 // Huzzah.
 impl MyTrait for lib::MyFundamentalStruct<MyType> { }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.stderr b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.stderr
deleted file mode 100644 (file)
index 675dc1b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/coherence_copy_like_err_fundamental_struct.rs:34:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 2f6dca4f3c2715ae4915cab7ea847f7dc1f401a6..15acf1a99af236317ab16e097808e94464f1e011 100644 (file)
@@ -12,8 +12,8 @@
 // `MyType: !MyTrait` along with other "fundamental" wrappers.
 
 // aux-build:coherence_copy_like_lib.rs
-
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(dead_code)]
 
 extern crate coherence_copy_like_lib as lib;
@@ -30,5 +30,5 @@ impl<T: lib::MyCopy> MyTrait for T { }
 // Huzzah.
 impl<'a> MyTrait for lib::MyFundamentalStruct<&'a MyType> { }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.stderr b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.stderr
deleted file mode 100644 (file)
index 5143d4e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/coherence_copy_like_err_fundamental_struct_ref.rs:34:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index f424e8872010f25d5d4414a5ff07d1e3d636f48f..ee6a61dca4add7a2649a8404f4f41fd5813cba4b 100644 (file)
@@ -13,7 +13,7 @@
 
 // aux-build:coherence_copy_like_lib.rs
 
-#![feature(rustc_attrs)]
+
 
 extern crate coherence_copy_like_lib as lib;
 
@@ -26,5 +26,5 @@ impl<T: lib::MyCopy> MyTrait for T { }
 // Tuples are not fundamental.
 impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119
 
-#[rustc_error]
+
 fn main() { }
index 551577b6b4e08c8c820e827f0884b0c4925c16d4..7124c05036ce9f3908d21e7fbb5dd145558a7222 100644 (file)
@@ -12,8 +12,8 @@
 // `MyType: !MyTrait` along with other "fundamental" wrappers.
 
 // aux-build:coherence_copy_like_lib.rs
-
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(dead_code)]
 
 extern crate coherence_copy_like_lib as lib;
@@ -29,5 +29,5 @@ impl lib::MyCopy for Box<MyType> { }
 impl lib::MyCopy for lib::MyFundamentalStruct<MyType> { }
 impl lib::MyCopy for lib::MyFundamentalStruct<Box<MyType>> { }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/coherence/coherence_local.stderr b/src/test/ui/coherence/coherence_local.stderr
deleted file mode 100644 (file)
index c4340e8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/coherence_local.rs:33:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 01f4c1cd8a5c9f311786dfd95be76214e572da04..72772a6efbd12055f5aed5ca003f23e5c46facc2 100644 (file)
@@ -13,7 +13,7 @@
 
 // aux-build:coherence_copy_like_lib.rs
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 extern crate coherence_copy_like_lib as lib;
@@ -25,5 +25,5 @@ struct MyType { x: i32 }
 // MyStruct is not fundamental.
 impl lib::MyCopy for lib::MyStruct<MyType> { } //~ ERROR E0117
 
-#[rustc_error]
+
 fn main() { }
index 590f68cee59ef3fb9898f5e1a6822559344cf39e..88e98c7ce00117c7e19ba3e725f9b6ebeae8d001 100644 (file)
@@ -13,7 +13,7 @@
 
 // aux-build:coherence_copy_like_lib.rs
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 extern crate coherence_copy_like_lib as lib;
@@ -25,5 +25,5 @@ struct MyType { x: i32 }
 // Tuples are not fundamental, so this is not a local impl.
 impl lib::MyCopy for (MyType,) { } //~ ERROR E0117
 
-#[rustc_error]
+
 fn main() { }
index f6e1aab59766a1e7d0b1884516cf37c7cb21f889..de26433012d901851258fb05459db7791c16a34e 100644 (file)
@@ -12,8 +12,8 @@
 // `MyType: !MyTrait` along with other "fundamental" wrappers.
 
 // aux-build:coherence_copy_like_lib.rs
-
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(dead_code)]
 
 extern crate coherence_copy_like_lib as lib;
@@ -23,5 +23,5 @@ struct MyType { x: i32 }
 // naturally, legal
 impl lib::MyCopy for MyType { }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/coherence/coherence_local_ref.stderr b/src/test/ui/coherence/coherence_local_ref.stderr
deleted file mode 100644 (file)
index 13d6fdd..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/coherence_local_ref.rs:27:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 7d799850a651ebacc3638ca79b55f8c994ec5273..b2805d76d8f6b5983b9de840d60db52b59118cf2 100644 (file)
@@ -8,17 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(dead_code)]
 #![deny(unused_attributes)] // c.f #35584
-
 mod auxiliary {
     #[cfg_attr(any(), path = "nonexistent_file.rs")] pub mod namespaced_enums;
     #[cfg_attr(all(), path = "namespaced_enums.rs")] pub mod nonexistent_file;
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let _ = auxiliary::namespaced_enums::Foo::A;
     let _ = auxiliary::nonexistent_file::Foo::A;
 }
diff --git a/src/test/ui/conditional-compilation/cfg_attr_path.stderr b/src/test/ui/conditional-compilation/cfg_attr_path.stderr
deleted file mode 100644 (file)
index 67e59d0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: compilation successful
-  --> $DIR/cfg_attr_path.rs:21:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let _ = auxiliary::namespaced_enums::Foo::A;
-LL | |     let _ = auxiliary::nonexistent_file::Foo::A;
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 28825477c810276f25c5b30876d49a5aab3eb839..7e82d4fc264f564ca81820fdffe93d4215a3898f 100644 (file)
@@ -5,7 +5,7 @@ LL | / static FOO: (&Foo, &Bar) = unsafe {( //~ undefined behavior
 LL | |     Union { u8: &BAR }.foo,
 LL | |     Union { u8: &BAR }.bar,
 LL | | )};
-   | |___^ type validation failed: encountered invalid enum discriminant 5 at .1.<deref>
+   | |___^ type validation failed: encountered 5 at .1.<deref>, but expected a valid enum discriminant
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
index 91faa4684c3929d2af8657cbdf8fe12de2511af0..cf87170a89d89d3ec3e6973626b3034a783aacfb 100644 (file)
@@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value
   --> $DIR/transmute-const.rs:15:1
    |
 LL | static FOO: bool = unsafe { mem::transmute(3u8) };
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3, but expected something in the range 0..=1
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3, but expected something less or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
index 2f7a5dda9ffcbd4d52355a26e530a6e1ccc9a69b..0aa15c839387952f70474057d56d400c02cf0577 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(const_err)] // make sure we cannot allow away the errors tested here
+
 #[repr(usize)]
 #[derive(Copy, Clone)]
 enum Enum {
@@ -15,34 +17,48 @@ enum Enum {
 }
 union TransmuteEnum {
     a: &'static u8,
-    b: Enum,
+    out: Enum,
 }
 
 // A pointer is guaranteed non-null
-const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.b };
+const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.out };
 //~^ ERROR is undefined behavior
 
-// Invalid enum discriminant
+// (Potentially) invalid enum discriminant
 #[repr(usize)]
 #[derive(Copy, Clone)]
 enum Enum2 {
     A = 2,
 }
+#[repr(transparent)]
+#[derive(Copy, Clone)]
+struct Wrap<T>(T);
 union TransmuteEnum2 {
-    a: usize,
-    b: Enum2,
+    in1: usize,
+    in2: &'static u8,
+    in3: (),
+    out1: Enum2,
+    out2: Wrap<Enum2>, // something wrapping the enum so that we test layout first, not enum
 }
-const BAD_ENUM2 : Enum2 = unsafe { TransmuteEnum2 { a: 0 }.b };
+const BAD_ENUM2: Enum2 = unsafe { TransmuteEnum2 { in1: 0 }.out1 };
+//~^ ERROR is undefined behavior
+const BAD_ENUM3: Enum2 = unsafe { TransmuteEnum2 { in2: &0 }.out1 };
+//~^ ERROR is undefined behavior
+const BAD_ENUM4: Wrap<Enum2> = unsafe { TransmuteEnum2 { in2: &0 }.out2 };
+//~^ ERROR is undefined behavior
+
+// Undef enum discriminant. In an arry to avoid `Scalar` layout.
+const BAD_ENUM_UNDEF: [Enum2; 2] = [unsafe { TransmuteEnum2 { in3: () }.out1 }; 2];
 //~^ ERROR is undefined behavior
 
-// Invalid enum field content (mostly to test printing of apths for enum tuple
+// Invalid enum field content (mostly to test printing of paths for enum tuple
 // variants and tuples).
 union TransmuteChar {
     a: u32,
     b: char,
 }
 // Need to create something which does not clash with enum layout optimizations.
-const BAD_ENUM_CHAR : Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b }));
+const BAD_ENUM_CHAR: Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b }));
 //~^ ERROR is undefined behavior
 
 fn main() {
index 4cbaa2f3a906fe9319fe0e72f00469b39db2a2d7..804c9643d8ae30f93dc42fae1187258f12a57bda 100644 (file)
@@ -1,27 +1,51 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-enum.rs:22:1
+  --> $DIR/ub-enum.rs:24:1
    |
-LL | const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.b };
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer enum discriminant
+LL | const BAD_ENUM: Enum = unsafe { TransmuteEnum { a: &1 }.out };
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-enum.rs:35:1
+  --> $DIR/ub-enum.rs:43:1
    |
-LL | const BAD_ENUM2 : Enum2 = unsafe { TransmuteEnum2 { a: 0 }.b };
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid enum discriminant 0
+LL | const BAD_ENUM2: Enum2 = unsafe { TransmuteEnum2 { in1: 0 }.out1 };
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected a valid enum discriminant
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-enum.rs:45:1
    |
-LL | const BAD_ENUM_CHAR : Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b }));
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 4294967295 at .Some.0.1, but expected something in the range 0..=1114111
+LL | const BAD_ENUM3: Enum2 = unsafe { TransmuteEnum2 { in2: &0 }.out1 };
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error: aborting due to 3 previous errors
+error[E0080]: it is undefined behavior to use this value
+  --> $DIR/ub-enum.rs:47:1
+   |
+LL | const BAD_ENUM4: Wrap<Enum2> = unsafe { TransmuteEnum2 { in2: &0 }.out2 };
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected something that cannot possibly fail to be in the range 2..=2
+   |
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
+
+error[E0080]: it is undefined behavior to use this value
+  --> $DIR/ub-enum.rs:51:1
+   |
+LL | const BAD_ENUM_UNDEF: [Enum2; 2] = [unsafe { TransmuteEnum2 { in3: () }.out1 }; 2];
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
+   |
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
+
+error[E0080]: it is undefined behavior to use this value
+  --> $DIR/ub-enum.rs:61:1
+   |
+LL | const BAD_ENUM_CHAR: Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b }));
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 4294967295 at .Some.0.1, but expected something less or equal to 1114111
+   |
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
+
+error: aborting due to 6 previous errors
 
 For more information about this error, try `rustc --explain E0080`.
index 6d6ad38afdb96127c874653643bd779b61195e9a..113221959fb9c3e033fe99551f1c6304cc4ac349 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_transmute)]
+#![feature(rustc_attrs, const_transmute)]
+#![allow(const_err)] // make sure we cannot allow away the errors tested here
 
 use std::mem;
 use std::ptr::NonNull;
 const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
 //~^ ERROR it is undefined behavior to use this value
 
+// Also test other uses of rustc_layout_scalar_valid_range_start
+
+#[rustc_layout_scalar_valid_range_start(10)]
+#[rustc_layout_scalar_valid_range_end(30)]
+struct RestrictedRange1(u32);
+const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
+//~^ ERROR it is undefined behavior to use this value
+
+#[rustc_layout_scalar_valid_range_start(30)]
+#[rustc_layout_scalar_valid_range_end(10)]
+struct RestrictedRange2(u32);
+const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
+//~^ ERROR it is undefined behavior to use this value
+
 fn main() {}
index 1fdea3f38d38d5ca4f6ed9e6cb14573689bd6ee6..c50b0208f15ef947afed5cd384ba7ae6c0f8abcf 100644 (file)
@@ -1,5 +1,5 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-nonnull.rs:17:1
+  --> $DIR/ub-nonnull.rs:18:1
    |
 LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1
@@ -7,7 +7,7 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-nonnull.rs:20:1
+  --> $DIR/ub-nonnull.rs:21:1
    |
 LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1
@@ -15,13 +15,29 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-nonnull.rs:22:1
+  --> $DIR/ub-nonnull.rs:23:1
    |
 LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error: aborting due to 3 previous errors
+error[E0080]: it is undefined behavior to use this value
+  --> $DIR/ub-nonnull.rs:31:1
+   |
+LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something in the range 10..=30
+   |
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
+
+error[E0080]: it is undefined behavior to use this value
+  --> $DIR/ub-nonnull.rs:37:1
+   |
+LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 20, but expected something less or equal to 10, or greater or equal to 30
+   |
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
+
+error: aborting due to 5 previous errors
 
 For more information about this error, try `rustc --explain E0080`.
index 2c2abd9127582a32dd3178ebf13bab47fd4814a0..c0dd94a375bcbb0c69d36886fa3e582b51a63619 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(const_transmute)]
+#![allow(const_err)] // make sure we cannot allow away the errors tested here
 
 use std::mem;
 
index 4ae4640d074e3a2b3b750fae93d45256d6a3ed23..c3f5f4a26f55594cbc6b2545df8774de73d588ab 100644 (file)
@@ -1,5 +1,5 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-ref.rs:15:1
+  --> $DIR/ub-ref.rs:16:1
    |
 LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered unaligned reference
@@ -7,7 +7,7 @@ LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-ref.rs:18:1
+  --> $DIR/ub-ref.rs:19:1
    |
 LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1
@@ -15,7 +15,7 @@ LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-ref.rs:21:1
+  --> $DIR/ub-ref.rs:22:1
    |
 LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
@@ -23,15 +23,15 @@ LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-ref.rs:24:1
+  --> $DIR/ub-ref.rs:25:1
    |
 LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a raw memory access tried to access part of a pointer value as raw bytes
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer at .<deref>, but expected plain bytes
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-ref.rs:27:1
+  --> $DIR/ub-ref.rs:28:1
    |
 LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered integer pointer in non-ZST reference
index 22262fd0b977449c558ec1acdb8305c6fc410f1b..74713af2ea033114ee9ed28e9b45338efa55f52f 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(const_transmute)]
+#![allow(const_err)] // make sure we cannot allow away the errors tested here
 
 use std::mem;
 
index 2ac0a6e4e86739589476e6ea6f089d8e33da36ca..c5ac72b639c05a94292c40ec0722d284d9c6633a 100644 (file)
@@ -1,5 +1,5 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-uninhabit.rs:18:1
+  --> $DIR/ub-uninhabit.rs:19:1
    |
 LL | const BAD_BAD_BAD: Bar = unsafe { mem::transmute(()) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type
@@ -7,7 +7,7 @@ LL | const BAD_BAD_BAD: Bar = unsafe { mem::transmute(()) };
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-uninhabit.rs:21:1
+  --> $DIR/ub-uninhabit.rs:22:1
    |
 LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type at .<deref>
@@ -15,7 +15,7 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-uninhabit.rs:24:1
+  --> $DIR/ub-uninhabit.rs:25:1
    |
 LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { mem::transmute(()) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type at [0]
index f591a5affe5da2b2adb85ef0bba8baf57493228b..6661de4ab2cb586bcaa737211848c2a56d51ca7b 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(const_transmute,const_let)]
+#![allow(const_err)] // make sure we cannot allow away the errors tested here
 
 use std::mem;
 
index 178f80f88e8d6c4a05c189f44eb4481148cd4824..3617a53a9788da4f2fde860a1f3e0ebc480f019d 100644 (file)
@@ -1,12 +1,12 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-upvars.rs:15:1
+  --> $DIR/ub-upvars.rs:16:1
    |
 LL | / const BAD_UPVAR: &FnOnce() = &{ //~ ERROR it is undefined behavior to use this value
 LL | |     let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) };
 LL | |     let another_var = 13;
 LL | |     move || { let _ = bad_ref; let _ = another_var; }
 LL | | };
-   | |__^ type validation failed: encountered 0 at .<deref>.<closure-var(bad_ref)>, but expected something greater or equal to 1
+   | |__^ type validation failed: encountered 0 at .<deref>.<dyn-downcast>.<closure-var(bad_ref)>, but expected something greater or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
index 479cee92b94b375258f9060998dda38d97d79676..31540b46631c0558b181344158f8588b75131452 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![allow(unused)]
+#![allow(const_err)] // make sure we cannot allow away the errors tested here
 
 // normalize-stderr-test "alignment \d+" -> "alignment N"
 // normalize-stderr-test "offset \d+" -> "offset N"
index b61ea9ca6f95b3f482333c03c32da9ab3d2992f2..c21690754f62cc5b0366b751f90ebab6fcd97847 100644 (file)
@@ -1,5 +1,5 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:87:1
+  --> $DIR/union-ub-fat-ptr.rs:88:1
    |
 LL | const B: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.str};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling (not entirely in bounds) reference
@@ -7,7 +7,7 @@ LL | const B: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len:
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:90:1
+  --> $DIR/union-ub-fat-ptr.rs:91:1
    |
 LL | const C: &str = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.str};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in fat pointer
@@ -15,7 +15,7 @@ LL | const C: &str = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:93:1
+  --> $DIR/union-ub-fat-ptr.rs:94:1
    |
 LL | const C2: &MyStr = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.my_str};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in fat pointer
@@ -23,7 +23,7 @@ LL | const C2: &MyStr = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42,
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:99:1
+  --> $DIR/union-ub-fat-ptr.rs:100:1
    |
 LL | const B2: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.slice};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling (not entirely in bounds) reference
@@ -31,7 +31,7 @@ LL | const B2: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:102:1
+  --> $DIR/union-ub-fat-ptr.rs:103:1
    |
 LL | const C3: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.slice};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in fat pointer
@@ -39,7 +39,7 @@ LL | const C3: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, l
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:106:1
+  --> $DIR/union-ub-fat-ptr.rs:107:1
    |
 LL | const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable
@@ -47,7 +47,7 @@ LL | const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable:
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:109:1
+  --> $DIR/union-ub-fat-ptr.rs:110:1
    |
 LL | const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable
@@ -55,7 +55,7 @@ LL | const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtabl
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:112:1
+  --> $DIR/union-ub-fat-ptr.rs:113:1
    |
 LL | const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-pointer vtable in fat pointer
@@ -63,39 +63,39 @@ LL | const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtabl
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:116:1
+  --> $DIR/union-ub-fat-ptr.rs:117:1
    |
 LL | const G: &Trait = &unsafe { BoolTransmute { val: 3 }.bl };
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>, but expected something in the range 0..=1
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.<dyn-downcast>, but expected something less or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:120:1
+  --> $DIR/union-ub-fat-ptr.rs:121:1
    |
 LL | const H: &[bool] = &[unsafe { BoolTransmute { val: 3 }.bl }];
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>[0], but expected something in the range 0..=1
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>[0], but expected something less or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:126:1
+  --> $DIR/union-ub-fat-ptr.rs:127:1
    |
 LL | const I2: &MySliceBool = &MySlice(unsafe { BoolTransmute { val: 3 }.bl }, [false]);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.0, but expected something in the range 0..=1
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.0, but expected something less or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:129:1
+  --> $DIR/union-ub-fat-ptr.rs:130:1
    |
 LL | const I3: &MySliceBool = &MySlice(true, [unsafe { BoolTransmute { val: 3 }.bl }]);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.1[0], but expected something in the range 0..=1
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.1[0], but expected something less or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:133:1
+  --> $DIR/union-ub-fat-ptr.rs:134:1
    |
 LL | const J1: &str = unsafe { SliceTransmute { slice: &[0xFF] }.str };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at .<deref>
@@ -103,7 +103,7 @@ LL | const J1: &str = unsafe { SliceTransmute { slice: &[0xFF] }.str };
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub-fat-ptr.rs:136:1
+  --> $DIR/union-ub-fat-ptr.rs:137:1
    |
 LL | const J2: &MyStr = unsafe { SliceTransmute { slice: &[0xFF] }.my_str };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at .<deref>.0
index 008f1f2364866b7d2bbca736190c0fad24c9a17d..712147b52e96465dda4024e8aef4f89af5963317 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(const_err)] // make sure we cannot allow away the errors tested here
+
 union DummyUnion {
     u8: u8,
     bool: bool,
index bb916ddbbcfd797eda1e48984b7786172949fd19..db78ead370b873769293c25c2d655b2a83a191aa 100644 (file)
@@ -1,8 +1,8 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/union-ub.rs:36:1
+  --> $DIR/union-ub.rs:38:1
    |
 LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool};
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something in the range 0..=1
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something less or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
index 0f413b0bbc11201bbf4adfab5dedf3689b8d0a99..031576dd30830480655873f2b3d10179d6f4abb7 100644 (file)
 
 // Test use of const fn from another crate without a feature gate.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(unused_variables)]
-
 // aux-build:const_fn_lib.rs
 
 extern crate const_fn_lib;
 
 use const_fn_lib::foo;
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let x = foo(); // use outside a constant is ok
 }
diff --git a/src/test/ui/consts/const-fn-stability-calls-3.stderr b/src/test/ui/consts/const-fn-stability-calls-3.stderr
deleted file mode 100644 (file)
index 50c959d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: compilation successful
-  --> $DIR/const-fn-stability-calls-3.rs:23:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let x = foo(); // use outside a constant is ok
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/consts/dangling-alloc-id-ice.rs b/src/test/ui/consts/dangling-alloc-id-ice.rs
new file mode 100644 (file)
index 0000000..695d33b
--- /dev/null
@@ -0,0 +1,15 @@
+// https://github.com/rust-lang/rust/issues/55223
+
+#![feature(const_let)]
+
+union Foo<'a> {
+    y: &'a (),
+    long_live_the_unit: &'static (),
+}
+
+const FOO: &() = { //~ ERROR any use of this value will cause an error
+    let y = ();
+    unsafe { Foo { y: &y }.long_live_the_unit }
+};
+
+fn main() {}
diff --git a/src/test/ui/consts/dangling-alloc-id-ice.stderr b/src/test/ui/consts/dangling-alloc-id-ice.stderr
new file mode 100644 (file)
index 0000000..a5fa88e
--- /dev/null
@@ -0,0 +1,13 @@
+error: any use of this value will cause an error
+  --> $DIR/dangling-alloc-id-ice.rs:10:1
+   |
+LL | / const FOO: &() = { //~ ERROR any use of this value will cause an error
+LL | |     let y = ();
+LL | |     unsafe { Foo { y: &y }.long_live_the_unit }
+LL | | };
+   | |__^ type validation failed: encountered dangling pointer in final constant
+   |
+   = note: #[deny(const_err)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/consts/dangling_raw_ptr.rs b/src/test/ui/consts/dangling_raw_ptr.rs
new file mode 100644 (file)
index 0000000..7fc7734
--- /dev/null
@@ -0,0 +1,10 @@
+#![feature(const_let)]
+
+const FOO: *const u32 = { //~ ERROR any use of this value will cause an error
+    let x = 42;
+    &x
+};
+
+fn main() {
+    let x = FOO;
+}
diff --git a/src/test/ui/consts/dangling_raw_ptr.stderr b/src/test/ui/consts/dangling_raw_ptr.stderr
new file mode 100644 (file)
index 0000000..3b20936
--- /dev/null
@@ -0,0 +1,13 @@
+error: any use of this value will cause an error
+  --> $DIR/dangling_raw_ptr.rs:3:1
+   |
+LL | / const FOO: *const u32 = { //~ ERROR any use of this value will cause an error
+LL | |     let x = 42;
+LL | |     &x
+LL | | };
+   | |__^ type validation failed: encountered dangling pointer in final constant
+   |
+   = note: #[deny(const_err)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr b/src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr
new file mode 100644 (file)
index 0000000..31adb2f
--- /dev/null
@@ -0,0 +1,69 @@
+error[E0597]: `c` does not live long enough
+  --> $DIR/dropck-eyepatch-extern-crate.rs:41:20
+   |
+LL |     dt = Dt("dt", &c);
+   |                    ^ borrowed value does not live long enough
+...
+LL | }
+   | - `c` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c` does not live long enough
+  --> $DIR/dropck-eyepatch-extern-crate.rs:43:20
+   |
+LL |     dr = Dr("dr", &c);
+   |                    ^ borrowed value does not live long enough
+...
+LL | }
+   | - `c` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch-extern-crate.rs:47:20
+   |
+LL |     dt = Dt("dt", &c_shortest);
+   |                    ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch-extern-crate.rs:50:20
+   |
+LL |     dr = Dr("dr", &c_shortest);
+   |                    ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch-extern-crate.rs:57:29
+   |
+LL |     pt = Pt("pt", &c_long, &c_shortest);
+   |                             ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch-extern-crate.rs:59:29
+   |
+LL |     pr = Pr("pr", &c_long, &c_shortest);
+   |                             ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
index 3e531d9fd6011e8fee34972998a929cb9de8c4ed..68065639398a591409ab042d6251431d54d335a8 100644 (file)
@@ -1,12 +1,12 @@
-// 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.
+// The behavior of AST-borrowck and NLL explcitly differ here due to
+// NLL's increased precision; so we use revisions and do not worry
+// about the --compare-mode=nll on this test.
+
+// revisions: ast nll
+//[ast]compile-flags: -Z borrowck=ast
+//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+
+// ignore-compare-mode-nll
 
 // aux-build:dropck_eyepatch_extern_crate.rs
 
@@ -39,29 +39,32 @@ fn main() { #![rustc_error] // rust-lang/rust#49855
 
     // Error: destructor order imprecisely modelled
     dt = Dt("dt", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
     dr = Dr("dr", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
 
     // Error: `c_shortest` dies too soon for the references in dtors to be valid.
     dt = Dt("dt", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
+    //[nll]~^^ ERROR `c_shortest` does not live long enough
     dr = Dr("dr", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
-
+    //[ast]~^ ERROR `c_shortest` does not live long enough
     // No error: Drop impl asserts .1 (A and &'a _) are not accessed
     pt = Pt("pt", &c_shortest, &c_long);
     pr = Pr("pr", &c_shortest, &c_long);
 
     // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
     pt = Pt("pt", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
     pr = Pr("pr", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
 
     // No error: St and Sr have no destructor.
     st = St("st", &c_shortest);
     sr = Sr("sr", &c_shortest);
 
     println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
+    use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1);
 }
+
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr b/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr
deleted file mode 100644 (file)
index 35db46f..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:41:20
-   |
-LL |     dt = Dt("dt", &c);
-   |                    ^ borrowed value does not live long enough
-...
-LL | }
-   | - `c` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:43:20
-   |
-LL |     dr = Dr("dr", &c);
-   |                    ^ borrowed value does not live long enough
-...
-LL | }
-   | - `c` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:47:20
-   |
-LL |     dt = Dt("dt", &c_shortest);
-   |                    ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:49:20
-   |
-LL |     dr = Dr("dr", &c_shortest);
-   |                    ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:57:29
-   |
-LL |     pt = Pt("pt", &c_long, &c_shortest);
-   |                             ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:59:29
-   |
-LL |     pr = Pr("pr", &c_long, &c_shortest);
-   |                             ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr b/src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr
new file mode 100644 (file)
index 0000000..ddd47e9
--- /dev/null
@@ -0,0 +1,69 @@
+error[E0597]: `c` does not live long enough
+  --> $DIR/dropck-eyepatch-reorder.rs:58:20
+   |
+LL |     dt = Dt("dt", &c);
+   |                    ^ borrowed value does not live long enough
+...
+LL | }
+   | - `c` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c` does not live long enough
+  --> $DIR/dropck-eyepatch-reorder.rs:60:20
+   |
+LL |     dr = Dr("dr", &c);
+   |                    ^ borrowed value does not live long enough
+...
+LL | }
+   | - `c` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch-reorder.rs:64:20
+   |
+LL |     dt = Dt("dt", &c_shortest);
+   |                    ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch-reorder.rs:67:20
+   |
+LL |     dr = Dr("dr", &c_shortest);
+   |                    ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch-reorder.rs:74:29
+   |
+LL |     pt = Pt("pt", &c_long, &c_shortest);
+   |                             ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch-reorder.rs:76:29
+   |
+LL |     pr = Pr("pr", &c_long, &c_shortest);
+   |                             ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
index 1806dc71424527947eb8f3ffb9c3073913e68ae9..16aaa2612576821c954b62ca84e1247ac71ee034 100644 (file)
@@ -1,12 +1,12 @@
-// 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.
+// The behavior of AST-borrowck and NLL explcitly differ here due to
+// NLL's increased precision; so we use revisions and do not worry
+// about the --compare-mode=nll on this test.
+
+// revisions: ast nll
+//[ast]compile-flags: -Z borrowck=ast
+//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+
+// ignore-compare-mode-nll
 
 #![feature(dropck_eyepatch, rustc_attrs)]
 
@@ -56,29 +56,32 @@ fn main() { #![rustc_error] // rust-lang/rust#49855
 
     // Error: destructor order imprecisely modelled
     dt = Dt("dt", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
     dr = Dr("dr", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
 
     // Error: `c_shortest` dies too soon for the references in dtors to be valid.
     dt = Dt("dt", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
+    //[nll]~^^ ERROR `c_shortest` does not live long enough
     dr = Dr("dr", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
-
+    //[ast]~^ ERROR `c_shortest` does not live long enough
     // No error: Drop impl asserts .1 (A and &'a _) are not accessed
     pt = Pt("pt", &c_shortest, &c_long);
     pr = Pr("pr", &c_shortest, &c_long);
 
     // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
     pt = Pt("pt", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
     pr = Pr("pr", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
 
     // No error: St and Sr have no destructor.
     st = St("st", &c_shortest);
     sr = Sr("sr", &c_shortest);
 
     println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
+    use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1);
 }
+
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.stderr b/src/test/ui/dropck/dropck-eyepatch-reorder.stderr
deleted file mode 100644 (file)
index 9984a7b..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:58:20
-   |
-LL |     dt = Dt("dt", &c);
-   |                    ^ borrowed value does not live long enough
-...
-LL | }
-   | - `c` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:60:20
-   |
-LL |     dr = Dr("dr", &c);
-   |                    ^ borrowed value does not live long enough
-...
-LL | }
-   | - `c` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:64:20
-   |
-LL |     dt = Dt("dt", &c_shortest);
-   |                    ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:66:20
-   |
-LL |     dr = Dr("dr", &c_shortest);
-   |                    ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:74:29
-   |
-LL |     pt = Pt("pt", &c_long, &c_shortest);
-   |                             ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:76:29
-   |
-LL |     pr = Pr("pr", &c_long, &c_shortest);
-   |                             ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-eyepatch.ast.stderr b/src/test/ui/dropck/dropck-eyepatch.ast.stderr
new file mode 100644 (file)
index 0000000..0952ed0
--- /dev/null
@@ -0,0 +1,69 @@
+error[E0597]: `c` does not live long enough
+  --> $DIR/dropck-eyepatch.rs:81:20
+   |
+LL |     dt = Dt("dt", &c);
+   |                    ^ borrowed value does not live long enough
+...
+LL | }
+   | - `c` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c` does not live long enough
+  --> $DIR/dropck-eyepatch.rs:83:20
+   |
+LL |     dr = Dr("dr", &c);
+   |                    ^ borrowed value does not live long enough
+...
+LL | }
+   | - `c` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch.rs:87:20
+   |
+LL |     dt = Dt("dt", &c_shortest);
+   |                    ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch.rs:90:20
+   |
+LL |     dr = Dr("dr", &c_shortest);
+   |                    ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch.rs:98:29
+   |
+LL |     pt = Pt("pt", &c_long, &c_shortest);
+   |                             ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `c_shortest` does not live long enough
+  --> $DIR/dropck-eyepatch.rs:100:29
+   |
+LL |     pr = Pr("pr", &c_long, &c_shortest);
+   |                             ^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+   | - `c_shortest` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
index 40d3ff050e2aa3db6fa71367fbd80780a97831bc..d7a671fd33c2c62713325081c71edbe326b16556 100644 (file)
@@ -1,12 +1,12 @@
-// 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.
+// The behavior of AST-borrowck and NLL explcitly differ here due to
+// NLL's increased precision; so we use revisions and do not worry
+// about the --compare-mode=nll on this test.
+
+// revisions: ast nll
+//[ast]compile-flags: -Z borrowck=ast
+//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+
+// ignore-compare-mode-nll
 
 #![feature(dropck_eyepatch, rustc_attrs)]
 
@@ -79,16 +79,16 @@ fn main() { #![rustc_error] // rust-lang/rust#49855
 
     // Error: destructor order imprecisely modelled
     dt = Dt("dt", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
     dr = Dr("dr", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
 
     // Error: `c_shortest` dies too soon for the references in dtors to be valid.
     dt = Dt("dt", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
+    //[nll]~^^ ERROR `c_shortest` does not live long enough
     dr = Dr("dr", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
-
+    //[ast]~^ ERROR `c_shortest` does not live long enough
 
     // No error: Drop impl asserts .1 (A and &'a _) are not accessed
     pt = Pt("pt", &c_shortest, &c_long);
@@ -96,13 +96,16 @@ fn main() { #![rustc_error] // rust-lang/rust#49855
 
     // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
     pt = Pt("pt", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
     pr = Pr("pr", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
 
     // No error: St and Sr have no destructor.
     st = St("st", &c_shortest);
     sr = Sr("sr", &c_shortest);
 
     println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
+    use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1);
 }
+
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/dropck/dropck-eyepatch.stderr b/src/test/ui/dropck/dropck-eyepatch.stderr
deleted file mode 100644 (file)
index 7cdf645..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:81:20
-   |
-LL |     dt = Dt("dt", &c);
-   |                    ^ borrowed value does not live long enough
-...
-LL | }
-   | - `c` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:83:20
-   |
-LL |     dr = Dr("dr", &c);
-   |                    ^ borrowed value does not live long enough
-...
-LL | }
-   | - `c` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:87:20
-   |
-LL |     dt = Dt("dt", &c_shortest);
-   |                    ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:89:20
-   |
-LL |     dr = Dr("dr", &c_shortest);
-   |                    ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:98:29
-   |
-LL |     pt = Pt("pt", &c_long, &c_shortest);
-   |                             ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:100:29
-   |
-LL |     pr = Pr("pr", &c_long, &c_shortest);
-   |                             ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
-   | - `c_shortest` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
index 4886ad7717574e6eae004a6529139beccaac83d3..76ff88d6cc62346b52412741cd1026668d7b5627 100644 (file)
@@ -5,7 +5,7 @@ LL | impl<Foo> Deref for Foo { } //~ ERROR must be used
    | ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: conflicting implementation in crate `core`:
-           - impl<'_, T> std::ops::Deref for &T
+           - impl<T> std::ops::Deref for &T
              where T: ?Sized;
 
 error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g. `MyStruct<Foo>`)
index 6a4392df35d8b31646a25266f8df11e380667e05..900812787bcf7debe389d41ab08db9cb9f33d8d0 100644 (file)
@@ -4,7 +4,7 @@ error[E0004]: non-exhaustive patterns: type std::option::Option<i32> is non-empt
 LL |     match x { } //~ ERROR E0004
    |           ^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/E0004-2.rs:14:11
    |
 LL |     match x { } //~ ERROR E0004
index 77351f6e4f171f4dc40c33ce067700078e2e8d3f..9fd9f7b85af447a41f7c85806152b0e5ae55bd3b 100644 (file)
@@ -7,9 +7,9 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-
-#![feature(custom_attribute, rustc_attrs)]
-
+// skip-codegen
+// compile-pass
+#![feature(custom_attribute)]
 macro_rules! mac {
     {} => {
         #[cfg(attr)]
@@ -28,5 +28,5 @@ fn g() {}
 
 mac! {}
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/expanded-cfg.stderr b/src/test/ui/expanded-cfg.stderr
deleted file mode 100644 (file)
index d7bc47f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/expanded-cfg.rs:32:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/extern/extern-const.fixed b/src/test/ui/extern/extern-const.fixed
new file mode 100644 (file)
index 0000000..dca5698
--- /dev/null
@@ -0,0 +1,25 @@
+// Check extern items cannot be const + `rustfix` suggests using
+// extern static.
+//
+// #54388: an unused reference to an undefined static may or may not
+// compile. To sidestep this by using one that *is* defined.
+
+// run-rustfix
+// ignore-wasm32 no external library to link to.
+// compile-flags: -g -Z continue-parse-after-error
+#![feature(libc)]
+extern crate libc;
+
+#[link(name = "rust_test_helpers", kind = "static")]
+extern "C" {
+    static rust_dbg_static_mut: libc::c_int; //~ ERROR extern items cannot be `const`
+}
+
+fn main() {
+    // We suggest turning the (illegal) extern `const` into an extern `static`,
+    // but this also requires `unsafe` (a deny-by-default lint at comment time,
+    // future error; Issue #36247)
+    unsafe {
+        let _x = rust_dbg_static_mut;
+    }
+}
index d8a167311d55c12dbe389a2187607208fceff214..07dbe545a850a46c26fb7e68abd58a3e88e68752 100644 (file)
@@ -1,18 +1,18 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
+// Check extern items cannot be const + `rustfix` suggests using
+// extern static.
 //
-// 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.
+// #54388: an unused reference to an undefined static may or may not
+// compile. To sidestep this by using one that *is* defined.
 
-// FIXME(#54388): re-enable rustfix later, when this test has consistent output across targets
-// compile-flags: -Z continue-parse-after-error
+// run-rustfix
+// ignore-wasm32 no external library to link to.
+// compile-flags: -g -Z continue-parse-after-error
+#![feature(libc)]
+extern crate libc;
 
+#[link(name = "rust_test_helpers", kind = "static")]
 extern "C" {
-    const C: u8; //~ ERROR extern items cannot be `const`
+    const rust_dbg_static_mut: libc::c_int; //~ ERROR extern items cannot be `const`
 }
 
 fn main() {
@@ -20,6 +20,6 @@ fn main() {
     // but this also requires `unsafe` (a deny-by-default lint at comment time,
     // future error; Issue #36247)
     unsafe {
-        let _x = C;
+        let _x = rust_dbg_static_mut;
     }
 }
index cbed5e56c76c4523c42e39712d30cfc575bd2416..7ebaec0368e3d46f53c4f429a6fc3aad5e0f0343 100644 (file)
@@ -1,7 +1,7 @@
 error: extern items cannot be `const`
   --> $DIR/extern-const.rs:15:5
    |
-LL |     const C: u8; //~ ERROR extern items cannot be `const`
+LL |     const rust_dbg_static_mut: libc::c_int; //~ ERROR extern items cannot be `const`
    |     ^^^^^ help: try using a static value: `static`
 
 error: aborting due to previous error
index bbddbb7d679a8ded69b3119fba4dffbe869ad8a5..3f340145acffede8f87bb2dba4e52999a4bfe9b3 100644 (file)
@@ -40,7 +40,7 @@
 // inputs are handled by each, and (2.) to ease searching for related
 // occurrences in the source text.
 
-#![feature(rustc_attrs)] // For `rustc_error`; see note below.
+// skip-codegen
 #![warn(unused_attributes, unknown_lints)]
 #![allow(dead_code)]
 #![allow(stable_features)]
@@ -584,7 +584,7 @@ mod inner { #![export_name="2200"] }
     #[export_name = "2200"] impl S { }
 }
 
-// Note that this test ends with a `#[rustc_error] fn main()`, so it
+// Note that this test has a `skip-codegen`, so it
 // will never invoke the linker. These are here nonetheless to point
 // out that we allow them at non-crate-level (though I do not know
 // whether they have the same effect here as at crate-level).
@@ -835,12 +835,12 @@ mod inner { #![type_length_limit="0100"] }
     //~| WARN crate-level attribute should be an inner attribute
 }
 
-// Since we expect for the mix of attributes used here to compile
-// successfully, and we are just testing for the expected warnings of
-// various (mis)uses of attributes, we use the `rustc_error` attribute
-// on the `fn main()`.
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+
+
+
+
+fn main() {
     println!("Hello World");
 }
index 3b31b411f3f56785f37b012850a1bf58c1dd7664..59e327bc1ba6288275abfb33962c9e93eca741cb 100644 (file)
@@ -1303,13 +1303,7 @@ warning: unused attribute
 LL | #![proc_macro_derive          = "2500"] //~ WARN unused attribute
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: compilation successful
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:844:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     println!("Hello World");
-LL | | }
-   | |_^
+error: invalid windows subsystem `1000`, only `windows` and `console` are allowed
 
 error: aborting due to previous error
 
index 98da43c3a2252ffd078d0609b8105aad460b5158..3f423a415cfb80a120b4f077729c80f51daa2065 100644 (file)
@@ -15,9 +15,9 @@
 //
 // (For non-crate-level cases, see issue-43106-gating-of-builtin-attrs.rs)
 
-#![feature(rustc_attrs)] // For `rustc_error`; see note below.
+// compile-pass
+// skip-codegen
 #![allow(dead_code)]
-
 #![deprecated           = "1100"]
 
 // Since we expect for the mix of attributes used here to compile
@@ -25,7 +25,7 @@
 // various (mis)uses of attributes, we use the `rustc_error` attribute
 // on the `fn main()`.
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     println!("Hello World");
 }
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.stderr
deleted file mode 100644 (file)
index 802c5d9..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-43106-gating-of-deprecated.rs:29:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     println!("Hello World");
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 3f8ad32437df99b18cf621f3f1d76629235c6dd3..736fad44b8b5840b4259c4ddeafe8eb1d185e4d2 100644 (file)
@@ -1,4 +1,4 @@
-error[E0658]: allow_fail attribute is currently unstable (see issue #42219)
+error[E0658]: allow_fail attribute is currently unstable (see issue #46488)
   --> $DIR/feature-gate-allow_fail.rs:13:1
    |
 LL | #[allow_fail] //~ ERROR allow_fail attribute is currently unstable
index d0ee40504fb21b9497e6802ef916dbd68895115a..e1c1dcbcd790ce271faa113fd3c83542b6e53674 100644 (file)
@@ -1,4 +1,4 @@
-error[E0658]: `crate` visibility modifier is experimental (see issue #45388)
+error[E0658]: `crate` visibility modifier is experimental (see issue #53120)
   --> $DIR/feature-gate-crate_visibility_modifier.rs:11:1
    |
 LL | crate struct Bender { //~ ERROR `crate` visibility modifier is experimental
index ed8392ad7a3d1841a632fcfb1e8881d6db113807..4371de57776dffcc7f45653d86daea7db7863ac3 100644 (file)
@@ -10,7 +10,7 @@
 
 // Check that literals in attributes parse just fine.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 #![allow(unused_variables)]
 
@@ -29,5 +29,5 @@
 #[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown
 struct Q {  }
 
-#[rustc_error]
+
 fn main() { }
index cabfb56d7a840b5913110774390b241fceae17d0..bbd4b630263a44706e21fb21377a314db30c7319 100644 (file)
@@ -1,4 +1,4 @@
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:26:9
    |
 LL |     use alloc;
@@ -6,7 +6,7 @@ LL |     use alloc;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:28:9
    |
 LL |     use alloc::boxed;
@@ -14,7 +14,7 @@ LL |     use alloc::boxed;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:33:11
    |
 LL |     use ::alloc;
@@ -22,7 +22,7 @@ LL |     use ::alloc;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:35:11
    |
 LL |     use ::alloc::boxed;
@@ -30,7 +30,7 @@ LL |     use ::alloc::boxed;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:9:17
    |
 LL |         let v = alloc::vec![0];
@@ -38,7 +38,7 @@ LL |         let v = alloc::vec![0];
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:11:18
    |
 LL |         type A = alloc::boxed::Box<u8>;
@@ -46,7 +46,7 @@ LL |         type A = alloc::boxed::Box<u8>;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:18:19
    |
 LL |         let v = ::alloc::vec![0];
@@ -54,7 +54,7 @@ LL |         let v = ::alloc::vec![0];
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:20:20
    |
 LL |         type A = ::alloc::boxed::Box<u8>;
@@ -62,7 +62,7 @@ LL |         type A = ::alloc::boxed::Box<u8>;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:42:14
    |
 LL |     type A = core::boxed::Box<u8>;
index 535ed94565c6db61472144dfae144f6802746a0e..a73533b617891c121ce4029a46d0d8cb414729bd 100644 (file)
@@ -1,4 +1,4 @@
-error[E0658]: `extern` in paths is experimental (see issue #44660)
+error[E0658]: `extern` in paths is experimental (see issue #55600)
   --> $DIR/feature-gate-extern_in_paths.rs:14:13
    |
 LL |     let _ = extern::std::vec::Vec::new(); //~ ERROR `extern` in paths is experimental
diff --git a/src/test/ui/feature-gates/feature-gate-nll.nll.stderr b/src/test/ui/feature-gates/feature-gate-nll.nll.stderr
deleted file mode 100644 (file)
index 81de0d1..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: compilation successful
-  --> $DIR/feature-gate-nll.rs:13:1
-   |
-LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
-LL | |     let mut x = 33;
-LL | |
-LL | |     let p = &x;
-LL | |     x = 22; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 752b1fa821f7f9cf59fcaa1610c3ef3d833028de..14c48fb48a09b6a83d85ca616cc5a0af6d42505b 100644 (file)
@@ -1,16 +1,16 @@
-// 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.
-#![feature(rustc_attrs)]
+// This is a test checking that if you do not opt into NLL then you
+// should not get the effects of NLL applied to the test.
+
+// Don't use 2018 edition, since that turns on NLL (migration mode).
+// edition:2015
+
+// Don't use compare-mode=nll, since that turns on NLL.
+// ignore-compare-mode-nll
+
+
 #![allow(dead_code)]
 
-fn main() { #![rustc_error] // rust-lang/rust#49855
+fn main() {
     let mut x = 33;
 
     let p = &x;
diff --git a/src/test/ui/feature-gates/feature-gate-panic-implementation.rs b/src/test/ui/feature-gates/feature-gate-panic-implementation.rs
deleted file mode 100644 (file)
index ca51154..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags:-C panic=abort
-
-#![no_std]
-#![no_main]
-
-use core::panic::PanicInfo;
-
-#[panic_implementation] //~ ERROR this attribute was renamed to `panic_handler` (see issue #44489)
-fn panic(info: &PanicInfo) -> ! {
-    loop {}
-}
diff --git a/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr b/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr
deleted file mode 100644 (file)
index a547804..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0658]: this attribute was renamed to `panic_handler` (see issue #44489)
-  --> $DIR/feature-gate-panic-implementation.rs:18:1
-   |
-LL | #[panic_implementation] //~ ERROR this attribute was renamed to `panic_handler` (see issue #44489)
-   | ^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: add #![feature(panic_implementation)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
index 429cec7ec90d05076456f82abf144c65f2624e0c..a70f2758abb5972bccadefc877be6432b6a5a540 100644 (file)
@@ -11,4 +11,8 @@
 #[repr(simd)] //~ error: SIMD types are experimental
 struct Foo(u64, u64);
 
+#[repr(C)]
+#[repr(simd)] //~ error: SIMD types are experimental
+struct Bar(u64, u64);
+
 fn main() {}
index 8174f82060a18935f321a352bc2bfcd7b35ff543..2f98bd24d4f7994644f74d2f7b10767dfd1fb2cb 100644 (file)
@@ -6,6 +6,14 @@ LL | #[repr(simd)] //~ error: SIMD types are experimental
    |
    = help: add #![feature(repr_simd)] to the crate attributes to enable
 
-error: aborting due to previous error
+error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731)
+  --> $DIR/feature-gate-repr-simd.rs:15:1
+   |
+LL | #[repr(simd)] //~ error: SIMD types are experimental
+   | ^^^^^^^^^^^^^
+   |
+   = help: add #![feature(repr_simd)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
index 12bb152b4674953cc77f280e9aa9d243ff75f3bf..65e3be288fdf72447a0a038a32a819775c655158 100644 (file)
@@ -11,4 +11,8 @@
 #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental
 struct Foo(u64);
 
+#[repr(C)]
+#[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental
+struct Bar(u64);
+
 fn main() {}
index d0faf9d90bd5c88f7f3d688b6c3b8e703eac4c99..ed89a3f6b3169373f6290c0ecf2eda56ffee56f9 100644 (file)
@@ -6,6 +6,14 @@ LL | #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experim
    |
    = help: add #![feature(repr_packed)] to the crate attributes to enable
 
-error: aborting due to previous error
+error[E0658]: the `#[repr(packed(n))]` attribute is experimental (see issue #33158)
+  --> $DIR/feature-gate-repr_packed.rs:15:1
+   |
+LL | #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental
+   | ^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(repr_packed)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
index 8f1b8ec91db38aafa4b79e74ebe7cbb89a71387e..d57dad074b27b3fc44d410a70ceb1734e1447114 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
-
+// compile-pass
+// skip-codegen
 mod foo {
     pub use bar::*;
     pub use main as f;
@@ -25,5 +25,5 @@ mod baz {
     pub use super::*;
 }
 
-#[rustc_error]
-pub fn main() {} //~ ERROR compilation successful
+
+pub fn main() {}
diff --git a/src/test/ui/glob-cycles.stderr b/src/test/ui/glob-cycles.stderr
deleted file mode 100644 (file)
index a9fd930..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/glob-cycles.rs:29:1
-   |
-LL | pub fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 46a138749ff176e4e521e60cd22ad2e8ece949dd..bdf591ba7ab54f581396fa7c0e6c853a657ea697 100644 (file)
@@ -11,8 +11,8 @@
 // ignore-pretty pretty-printing is unhygienic
 
 #![feature(decl_macro, associated_type_defaults)]
-#![feature(rustc_attrs)]
-
+// compile-pass
+// skip-codegen
 trait Base {
     type AssocTy;
     fn f();
@@ -45,5 +45,5 @@ fn h<T: Base, U: Derived>() {
 
 mac!();
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/hygiene/assoc_ty_bindings.stderr b/src/test/ui/hygiene/assoc_ty_bindings.stderr
deleted file mode 100644 (file)
index 0adf809..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/assoc_ty_bindings.rs:49:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 15f04df6939811dce2bc9ac603907d710de24ade..a52bb7f8a288a268f4f87d2f1a41a162326d61ee 100644 (file)
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(warnings)]
-
 // This used to ICE because the "if" being unreachable was not handled correctly
 fn err() {
     if loop {} {}
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/if/if-loop.stderr b/src/test/ui/if/if-loop.stderr
deleted file mode 100644 (file)
index 6862560..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/if-loop.rs:20:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/impl-trait/issue-55608-captures-empty-region.rs b/src/test/ui/impl-trait/issue-55608-captures-empty-region.rs
new file mode 100644 (file)
index 0000000..7ebc348
--- /dev/null
@@ -0,0 +1,22 @@
+// This used to ICE because it creates an `impl Trait` that captures a
+// hidden empty region.
+
+#![feature(conservative_impl_trait)]
+
+fn server() -> impl FilterBase2 { //~ ERROR [E0700]
+    segment2(|| { loop { } }).map2(|| "")
+}
+
+trait FilterBase2 {
+    fn map2<F>(self, _fn: F) -> Map2<F> where Self: Sized { loop { } }
+}
+
+struct Map2<F> { _func: F }
+
+impl<F> FilterBase2 for Map2<F> { }
+
+fn segment2<F>(_fn: F) -> Map2<F> where F: Fn() -> Result<(), ()> {
+    loop { }
+}
+
+fn main() { server(); }
diff --git a/src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr b/src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr
new file mode 100644 (file)
index 0000000..d1f1478
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/issue-55608-captures-empty-region.rs:6:16
+   |
+LL | fn server() -> impl FilterBase2 { //~ ERROR [E0700]
+   |                ^^^^^^^^^^^^^^^^
+   |
+   = note: hidden type `Map2<[closure@$DIR/issue-55608-captures-empty-region.rs:7:36: 7:41]>` captures an empty lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
index b09883d9adeeae254c6f30590f4bba48e7ec695d..663e1379b40b117a1a08aeb53c4a7281d9217f4b 100644 (file)
 
 // aux-build:import_crate_var.rs
 
-#![feature(rustc_attrs)]
-
+// compile-pass
+// skip-codegen
 #[macro_use] extern crate import_crate_var;
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     m!();
     //~^ WARN `$crate` may not be imported
     //~| NOTE `use $crate;` was erroneously allowed and will become a hard error
index 3f02223fb67a45fc63cf24662b9663c7f9666e6b..ce4ffe796f3034d06883b5478119af6fde4439b2 100644 (file)
@@ -7,15 +7,3 @@ LL |     m!();
    = note: `use $crate;` was erroneously allowed and will become a hard error in a future release
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
-error: compilation successful
-  --> $DIR/import-crate-var.rs:18:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     m!();
-LL | |     //~^ WARN `$crate` may not be imported
-LL | |     //~| NOTE `use $crate;` was erroneously allowed and will become a hard error
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/imports/issue-55457.rs b/src/test/ui/imports/issue-55457.rs
new file mode 100644 (file)
index 0000000..9c6750f
--- /dev/null
@@ -0,0 +1,8 @@
+use NonExistent; //~ ERROR unresolved import `NonExistent`
+use non_existent::non_existent; //~ ERROR unresolved import `non_existent`
+
+#[non_existent] //~ ERROR cannot determine resolution for the attribute macro `non_existent`
+#[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive macro `NonExistent`
+struct S;
+
+fn main() {}
diff --git a/src/test/ui/imports/issue-55457.stderr b/src/test/ui/imports/issue-55457.stderr
new file mode 100644 (file)
index 0000000..363dec0
--- /dev/null
@@ -0,0 +1,31 @@
+error[E0432]: unresolved import `NonExistent`
+  --> $DIR/issue-55457.rs:1:5
+   |
+LL | use NonExistent; //~ ERROR unresolved import `NonExistent`
+   |     ^^^^^^^^^^^ no `NonExistent` in the root. Did you mean to use `non_existent`?
+
+error[E0432]: unresolved import `non_existent`
+  --> $DIR/issue-55457.rs:2:5
+   |
+LL | use non_existent::non_existent; //~ ERROR unresolved import `non_existent`
+   |     ^^^^^^^^^^^^ Maybe a missing `extern crate non_existent;`?
+
+error: cannot determine resolution for the derive macro `NonExistent`
+  --> $DIR/issue-55457.rs:5:10
+   |
+LL | #[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive macro `NonExistent`
+   |          ^^^^^^^^^^^
+   |
+   = note: import resolution is stuck, try simplifying macro imports
+
+error: cannot determine resolution for the attribute macro `non_existent`
+  --> $DIR/issue-55457.rs:4:3
+   |
+LL | #[non_existent] //~ ERROR cannot determine resolution for the attribute macro `non_existent`
+   |   ^^^^^^^^^^^^
+   |
+   = note: import resolution is stuck, try simplifying macro imports
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/issue-40827.rs b/src/test/ui/issue-40827.rs
deleted file mode 100644 (file)
index 4b079ac..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::rc::Rc;
-use std::sync::Arc;
-
-struct Foo(Arc<Bar>);
-
-enum Bar {
-    A(Rc<Foo>),
-    B(Option<Foo>),
-}
-
-fn f<T: Send>(_: T) {}
-
-fn main() {
-    f(Foo(Arc::new(Bar::B(None))));
-    //~^ ERROR E0277
-    //~| ERROR E0277
-}
diff --git a/src/test/ui/issue-40827.stderr b/src/test/ui/issue-40827.stderr
deleted file mode 100644 (file)
index dd0ebf9..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0277]: `std::rc::Rc<Foo>` cannot be sent between threads safely
-  --> $DIR/issue-40827.rs:24:5
-   |
-LL |     f(Foo(Arc::new(Bar::B(None))));
-   |     ^ `std::rc::Rc<Foo>` cannot be sent between threads safely
-   |
-   = help: within `Bar`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<Foo>`
-   = note: required because it appears within the type `Bar`
-   = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<Bar>`
-   = note: required because it appears within the type `Foo`
-note: required by `f`
-  --> $DIR/issue-40827.rs:21:1
-   |
-LL | fn f<T: Send>(_: T) {}
-   | ^^^^^^^^^^^^^^^^^^^
-
-error[E0277]: `std::rc::Rc<Foo>` cannot be shared between threads safely
-  --> $DIR/issue-40827.rs:24:5
-   |
-LL |     f(Foo(Arc::new(Bar::B(None))));
-   |     ^ `std::rc::Rc<Foo>` cannot be shared between threads safely
-   |
-   = help: within `Bar`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc<Foo>`
-   = note: required because it appears within the type `Bar`
-   = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<Bar>`
-   = note: required because it appears within the type `Foo`
-note: required by `f`
-  --> $DIR/issue-40827.rs:21:1
-   |
-LL | fn f<T: Send>(_: T) {}
-   | ^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-49556.rs b/src/test/ui/issue-49556.rs
deleted file mode 100644 (file)
index 7f7b349..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-pass
-fn iter<'a>(data: &'a [usize]) -> impl Iterator<Item = usize> + 'a {
-    data.iter()
-        .map(
-            |x| x // fn(&'a usize) -> &'(ReScope) usize
-        )
-        .map(
-            |x| *x // fn(&'(ReScope) usize) -> usize
-        )
-}
-
-fn main() {
-}
diff --git a/src/test/ui/issue-51602.rs b/src/test/ui/issue-51602.rs
deleted file mode 100644 (file)
index a3edecb..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main(){
-    if i in 1..10 {
-        break;
-    }
-}
diff --git a/src/test/ui/issue-51602.stderr b/src/test/ui/issue-51602.stderr
deleted file mode 100644 (file)
index d50ee64..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: expected `{`, found keyword `in`
-  --> $DIR/issue-51602.rs:12:10
-   |
-LL |     if i in 1..10 {
-   |     --   ^^ expected `{`
-   |     |
-   |     this `if` statement has a condition, but no block
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issue-51947.rs b/src/test/ui/issue-51947.rs
new file mode 100644 (file)
index 0000000..7b79807
--- /dev/null
@@ -0,0 +1,17 @@
+// compile-pass
+
+#![crate_type = "lib"]
+#![feature(linkage)]
+
+// MergeFunctions will merge these via an anonymous internal
+// backing function, which must be named if ThinLTO buffers are used
+
+#[linkage = "weak"]
+pub fn fn1(a: u32, b: u32, c: u32) -> u32 {
+    a + b + c
+}
+
+#[linkage = "weak"]
+pub fn fn2(a: u32, b: u32, c: u32) -> u32 {
+    a + b + c
+}
diff --git a/src/test/ui/issue-52717.rs b/src/test/ui/issue-52717.rs
deleted file mode 100644 (file)
index d40e2bd..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-enum A {
-  A {
-    foo: usize,
-  }
-}
-
-fn main() {
-  let x = A::A { foo: 3 };
-  match x {
-    A::A { fob } => { println!("{}", fob); }
-  }
-}
diff --git a/src/test/ui/issue-52717.stderr b/src/test/ui/issue-52717.stderr
deleted file mode 100644 (file)
index 0ef5a84..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0026]: variant `A::A` does not have a field named `fob`
-  --> $DIR/issue-52717.rs:19:12
-   |
-LL |     A::A { fob } => { println!("{}", fob); }
-   |            ^^^
-   |            |
-   |            variant `A::A` does not have this field
-   |            help: did you mean: `foo`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0026`.
diff --git a/src/test/ui/issue-52992.rs b/src/test/ui/issue-52992.rs
deleted file mode 100644 (file)
index 2ece0ee..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for an NLL-related ICE (#52992) -- computing
-// implied bounds was causing outlives relations that were not
-// properly handled.
-//
-// compile-pass
-
-#![feature(nll)]
-
-fn main() {}
-
-fn fail<'a>() -> Struct<'a, Generic<()>> {
-    Struct(&Generic(()))
-}
-
-struct Struct<'a, T>(&'a T) where
-    T: Trait + 'a,
-    T::AT: 'a; // only fails with this bound
-
-struct Generic<T>(T);
-
-trait Trait {
-    type AT;
-}
-
-impl<T> Trait for Generic<T> {
-    type AT = T; // only fails with a generic AT
-}
diff --git a/src/test/ui/issue-53251.rs b/src/test/ui/issue-53251.rs
deleted file mode 100644 (file)
index 8c75ea4..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct S;
-
-impl S {
-    fn f() {}
-}
-
-macro_rules! impl_add {
-    ($($n:ident)*) => {
-        $(
-            fn $n() {
-                S::f::<i64>();
-                //~^ ERROR wrong number of type arguments
-            }
-        )*
-    }
-}
-
-impl_add!(a b);
-
-fn main() {}
diff --git a/src/test/ui/issue-53251.stderr b/src/test/ui/issue-53251.stderr
deleted file mode 100644 (file)
index 51ea745..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0107]: wrong number of type arguments: expected 0, found 1
-  --> $DIR/issue-53251.rs:21:24
-   |
-LL |                 S::f::<i64>();
-   |                        ^^^ unexpected type argument
-...
-LL | impl_add!(a b);
-   | --------------- in this macro invocation
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0107`.
diff --git a/src/test/ui/issue-53300.rs b/src/test/ui/issue-53300.rs
deleted file mode 100644 (file)
index d055a6f..0000000
+++ /dev/null
@@ -1,22 +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.
-
-// issue 53300
-
-pub trait A {
-    fn add(&self, b: i32) -> i32;
-}
-
-fn addition() -> Wrapper<impl A> {}
-//~^ ERROR cannot find type `Wrapper` in this scope [E0412]
-
-fn main() {
-    let res = addition();
-}
diff --git a/src/test/ui/issue-53300.stderr b/src/test/ui/issue-53300.stderr
deleted file mode 100644 (file)
index 920287a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0412]: cannot find type `Wrapper` in this scope
-  --> $DIR/issue-53300.rs:17:18
-   |
-LL | fn addition() -> Wrapper<impl A> {}
-   |                  ^^^^^^^ not found in this scope
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/issue-53419.rs b/src/test/ui/issue-53419.rs
deleted file mode 100644 (file)
index 0dd5a85..0000000
+++ /dev/null
@@ -1,19 +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.
-
-//compile-pass
-
-struct Foo {
-    bar: for<'r> Fn(usize, &'r FnMut())
-}
-
-fn main() {
-}
-
diff --git a/src/test/ui/issue-53565.rs b/src/test/ui/issue-53565.rs
deleted file mode 100644 (file)
index 2bf3829..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-use std::time::{foo, bar, buzz};
-use std::time::{abc, def};
-fn main(){
-   println!("Hello World!");
-}
diff --git a/src/test/ui/issue-53565.stderr b/src/test/ui/issue-53565.stderr
deleted file mode 100644 (file)
index 945f5ef..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0432]: unresolved imports `std::time::foo`, `std::time::bar`, `std::time::buzz`
-  --> $DIR/issue-53565.rs:10:17
-   |
-LL | use std::time::{foo, bar, buzz};
-   |                 ^^^  ^^^  ^^^^ no `buzz` in `time`
-   |                 |    |
-   |                 |    no `bar` in `time`
-   |                 no `foo` in `time`
-
-error[E0432]: unresolved imports `std::time::abc`, `std::time::def`
-  --> $DIR/issue-53565.rs:11:17
-   |
-LL | use std::time::{abc, def};
-   |                 ^^^  ^^^ no `def` in `time`
-   |                 |
-   |                 no `abc` in `time`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/issue-53568.rs b/src/test/ui/issue-53568.rs
deleted file mode 100644 (file)
index 6b479f7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for an NLL-related ICE (#53568) -- we failed to
-// resolve inference variables in "custom type-ops".
-//
-// compile-pass
-
-#![feature(nll)]
-#![allow(dead_code)]
-
-trait Future {
-    type Item;
-}
-
-impl<F, T> Future for F
-where F: Fn() -> T
-{
-    type Item = T;
-}
-
-trait Connect {}
-
-struct Connector<H> {
-    handler: H,
-}
-
-impl<H, T> Connect for Connector<H>
-where
-    T: 'static,
-    H: Future<Item = T>
-{
-}
-
-struct Client<C> {
-    connector: C,
-}
-
-fn build<C>(_connector: C) -> Client<C> {
-    unimplemented!()
-}
-
-fn client<H>(handler: H) -> Client<impl Connect>
-where H: Fn() + Copy
-{
-    let connector = Connector {
-        handler,
-    };
-    let client = build(connector);
-    client
-}
-
-fn main() { }
-
diff --git a/src/test/ui/issue-53692.rs b/src/test/ui/issue-53692.rs
deleted file mode 100644 (file)
index 0b6cc36..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-fn main() {
-        let items = vec![1, 2, 3];
-        let ref_items: &[i32] = &items;
-        let items_clone: Vec<i32> = ref_items.clone();
-
-        // in that case no suggestion will be triggered
-        let items_clone_2:Vec<i32> = items.clone();
-
-        let s = "hi";
-        let string: String = s.clone();
-
-        // in that case no suggestion will be triggered
-        let s2 = "hi";
-        let string_2: String = s2.to_string();
-}
diff --git a/src/test/ui/issue-53692.stderr b/src/test/ui/issue-53692.stderr
deleted file mode 100644 (file)
index 9cd8a53..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/issue-53692.rs:13:37
-   |
-LL |         let items_clone: Vec<i32> = ref_items.clone();
-   |                                     ^^^^^^^^^^^^^^^^^
-   |                                     |
-   |                                     expected struct `std::vec::Vec`, found &[i32]
-   |                                     help: try using a conversion method: `ref_items.to_vec()`
-   |
-   = note: expected type `std::vec::Vec<i32>`
-              found type `&[i32]`
-
-error[E0308]: mismatched types
-  --> $DIR/issue-53692.rs:19:30
-   |
-LL |         let string: String = s.clone();
-   |                              ^^^^^^^^^
-   |                              |
-   |                              expected struct `std::string::String`, found &str
-   |                              help: try using a conversion method: `s.to_string()`
-   |
-   = note: expected type `std::string::String`
-              found type `&str`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/issue-53840.rs b/src/test/ui/issue-53840.rs
deleted file mode 100644 (file)
index ece3caf..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-enum E {
-    Foo(String, String, String),
-}
-
-struct Bar {
-    a: String,
-    b: String,
-}
-
-fn main() {
-    let bar = Bar { a: "1".to_string(), b: "2".to_string() };
-    match E::Foo("".into(), "".into(), "".into()) {
-        E::Foo(a, b, ref c) => {}
-    }
-    match bar {
-        Bar {a, ref b} => {}
-    }
-}
diff --git a/src/test/ui/issue-53840.stderr b/src/test/ui/issue-53840.stderr
deleted file mode 100644 (file)
index 961e4c0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0009]: cannot bind by-move and by-ref in the same pattern
-  --> $DIR/issue-53840.rs:22:16
-   |
-LL |         E::Foo(a, b, ref c) => {}
-   |                ^  ^  ----- both by-ref and by-move used
-   |                |  |
-   |                |  by-move pattern here
-   |                by-move pattern here
-
-error[E0009]: cannot bind by-move and by-ref in the same pattern
-  --> $DIR/issue-53840.rs:25:14
-   |
-LL |         Bar {a, ref b} => {}
-   |              ^  ----- both by-ref and by-move used
-   |              |
-   |              by-move pattern here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0009`.
diff --git a/src/test/ui/issue-54302-cases.rs b/src/test/ui/issue-54302-cases.rs
deleted file mode 100644 (file)
index 6d1c61c..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Mirror {
-    type Image;
-    fn coerce(self) -> Self::Image;
-}
-
-impl<T> Mirror for T {
-    type Image = T;
-    fn coerce(self) -> Self { self }
-}
-
-trait Foo<'x, T> {
-    fn foo(self) -> &'x T;
-}
-
-impl<'s, 'x, T: 'x> Foo<'x, T> for &'s T where &'s T: Foo2<'x, T> {
-    fn foo(self) -> &'x T { self.foo2() }
-}
-
-trait Foo2<'x, T> {
-    fn foo2(self) -> &'x T;
-}
-
-// example 1 - fails leak check
-impl<'x> Foo2<'x, u32> for &'x u32
-{
-    fn foo2(self) -> &'x u32 { self }
-}
-
-// example 2 - OK with this issue
-impl<'x, 'a: 'x> Foo2<'x, i32> for &'a i32
-{
-    fn foo2(self) -> &'x i32 { self }
-}
-
-// example 3 - fails due to issue #XYZ + Leak-check
-impl<'x, T> Foo2<'x, u64> for T
-    where T: Mirror<Image=&'x u64>
-{
-    fn foo2(self) -> &'x u64 { self.coerce() }
-}
-
-// example 4 - fails due to issue #XYZ
-impl<'x, 'a: 'x, T> Foo2<'x, i64> for T
-    where T: Mirror<Image=&'a i64>
-{
-    fn foo2(self) -> &'x i64 { self.coerce() }
-}
-
-
-trait RefFoo<T> {
-    fn ref_foo(&self) -> &'static T;
-}
-
-impl<T> RefFoo<T> for T where for<'a> &'a T: Foo<'static, T> {
-    fn ref_foo(&self) -> &'static T {
-        self.foo()
-    }
-}
-
-
-fn coerce_lifetime1(a: &u32) -> &'static u32
-{
-    <u32 as RefFoo<u32>>::ref_foo(a)
-    //~^ ERROR the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied
-}
-
-fn coerce_lifetime2(a: &i32) -> &'static i32
-{
-    <i32 as RefFoo<i32>>::ref_foo(a)
-    //~^ ERROR the requirement `for<'a> 'a : ` is not satisfied
-}
-
-fn coerce_lifetime3(a: &u64) -> &'static u64
-{
-    <u64 as RefFoo<u64>>::ref_foo(a)
-    //~^ ERROR type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64`
-}
-
-fn coerce_lifetime4(a: &i64) -> &'static i64
-{
-    <i64 as RefFoo<i64>>::ref_foo(a)
-    //~^ ERROR type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64`
-}
-
-fn main() {}
diff --git a/src/test/ui/issue-54302-cases.stderr b/src/test/ui/issue-54302-cases.stderr
deleted file mode 100644 (file)
index 9603f7a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-error[E0277]: the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied
-  --> $DIR/issue-54302-cases.rs:73:5
-   |
-LL |     <u32 as RefFoo<u32>>::ref_foo(a)
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo2<'_, u32>` is not implemented for `&'a u32`
-   |
-   = help: the following implementations were found:
-             <&'x u32 as Foo2<'x, u32>>
-   = note: required because of the requirements on the impl of `for<'a> Foo<'static, u32>` for `&'a u32`
-   = note: required because of the requirements on the impl of `RefFoo<u32>` for `u32`
-note: required by `RefFoo::ref_foo`
-  --> $DIR/issue-54302-cases.rs:61:5
-   |
-LL |     fn ref_foo(&self) -> &'static T;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0279]: the requirement `for<'a> 'a : ` is not satisfied (`expected bound lifetime parameter 'a, found concrete lifetime`)
-  --> $DIR/issue-54302-cases.rs:79:5
-   |
-LL |     <i32 as RefFoo<i32>>::ref_foo(a)
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: required because of the requirements on the impl of `for<'a> Foo2<'_, i32>` for `&'a i32`
-   = note: required because of the requirements on the impl of `for<'a> Foo<'static, i32>` for `&'a i32`
-   = note: required because of the requirements on the impl of `RefFoo<i32>` for `i32`
-note: required by `RefFoo::ref_foo`
-  --> $DIR/issue-54302-cases.rs:61:5
-   |
-LL |     fn ref_foo(&self) -> &'static T;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0271]: type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64`
-  --> $DIR/issue-54302-cases.rs:85:5
-   |
-LL |     <u64 as RefFoo<u64>>::ref_foo(a)
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime
-   |
-   = note: required because of the requirements on the impl of `for<'a> Foo2<'_, u64>` for `&'a u64`
-   = note: required because of the requirements on the impl of `for<'a> Foo<'static, u64>` for `&'a u64`
-   = note: required because of the requirements on the impl of `RefFoo<u64>` for `u64`
-note: required by `RefFoo::ref_foo`
-  --> $DIR/issue-54302-cases.rs:61:5
-   |
-LL |     fn ref_foo(&self) -> &'static T;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0271]: type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64`
-  --> $DIR/issue-54302-cases.rs:91:5
-   |
-LL |     <i64 as RefFoo<i64>>::ref_foo(a)
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime
-   |
-   = note: required because of the requirements on the impl of `for<'a> Foo2<'_, i64>` for `&'a i64`
-   = note: required because of the requirements on the impl of `for<'a> Foo<'static, i64>` for `&'a i64`
-   = note: required because of the requirements on the impl of `RefFoo<i64>` for `i64`
-note: required by `RefFoo::ref_foo`
-  --> $DIR/issue-54302-cases.rs:61:5
-   |
-LL |     fn ref_foo(&self) -> &'static T;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 4 previous errors
-
-Some errors occurred: E0271, E0277, E0279.
-For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/issue-54302.rs b/src/test/ui/issue-54302.rs
deleted file mode 100644 (file)
index 969d19c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Deserialize<'de> {}
-
-trait DeserializeOwned: for<'de> Deserialize<'de> {}
-impl<T> DeserializeOwned for T where T: for<'de> Deserialize<'de> {}
-
-// Based on this impl, `&'static str` only implements Deserialize<'static>.
-// It does not implement for<'de> Deserialize<'de>.
-impl<'de: 'a, 'a> Deserialize<'de> for &'a str {}
-
-fn main() {
-    // Then why does it implement DeserializeOwned? This compiles.
-    fn assert_deserialize_owned<T: DeserializeOwned>() {}
-    assert_deserialize_owned::<&'static str>();
-    //~^ ERROR the requirement `for<'de> 'de : ` is not satisfied
-
-    // It correctly does not implement for<'de> Deserialize<'de>.
-    //fn assert_hrtb<T: for<'de> Deserialize<'de>>() {}
-    //assert_hrtb::<&'static str>();
-}
diff --git a/src/test/ui/issue-54302.stderr b/src/test/ui/issue-54302.stderr
deleted file mode 100644 (file)
index f122dae..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0279]: the requirement `for<'de> 'de : ` is not satisfied (`expected bound lifetime parameter 'de, found concrete lifetime`)
-  --> $DIR/issue-54302.rs:23:5
-   |
-LL |     assert_deserialize_owned::<&'static str>();
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: required because of the requirements on the impl of `for<'de> Deserialize<'de>` for `&'static str`
-   = note: required because of the requirements on the impl of `DeserializeOwned` for `&'static str`
-note: required by `main::assert_deserialize_owned`
-  --> $DIR/issue-54302.rs:22:5
-   |
-LL |     fn assert_deserialize_owned<T: DeserializeOwned>() {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0279`.
diff --git a/src/test/ui/issues/auxiliary/issue-11680.rs b/src/test/ui/issues/auxiliary/issue-11680.rs
new file mode 100644 (file)
index 0000000..18f7875
--- /dev/null
@@ -0,0 +1,19 @@
+// 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.
+
+enum Foo {
+    Bar(isize)
+}
+
+pub mod test {
+    enum Foo {
+        Bar(isize)
+    }
+}
diff --git a/src/test/ui/issues/auxiliary/issue-16725.rs b/src/test/ui/issues/auxiliary/issue-16725.rs
new file mode 100644 (file)
index 0000000..b3b04b4
--- /dev/null
@@ -0,0 +1,13 @@
+// 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.
+
+extern {
+    fn bar();
+}
diff --git a/src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs b/src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs
new file mode 100644 (file)
index 0000000..3901d73
--- /dev/null
@@ -0,0 +1,18 @@
+// 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.
+
+pub use foo::FOO2;
+
+pub const FOO: usize = 3;
+const BAR: usize = 3;
+
+mod foo {
+    pub const FOO2: usize = 3;
+}
diff --git a/src/test/ui/issues/auxiliary/issue-1920.rs b/src/test/ui/issues/auxiliary/issue-1920.rs
new file mode 100644 (file)
index 0000000..5506517
--- /dev/null
@@ -0,0 +1,14 @@
+// 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.
+
+// Just exporting some type to test for correct diagnostics when this
+// crate is pulled in at a non-root location in client crate.
+
+pub struct S;
diff --git a/src/test/ui/issues/auxiliary/issue-21202.rs b/src/test/ui/issues/auxiliary/issue-21202.rs
new file mode 100644 (file)
index 0000000..afdbf78
--- /dev/null
@@ -0,0 +1,16 @@
+// 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 mod A {
+    pub struct Foo;
+    impl Foo {
+        fn foo(&self) { }
+    }
+}
diff --git a/src/test/ui/issues/auxiliary/issue-30123-aux.rs b/src/test/ui/issues/auxiliary/issue-30123-aux.rs
new file mode 100644 (file)
index 0000000..f60311a
--- /dev/null
@@ -0,0 +1,33 @@
+// 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.
+
+use std::marker::PhantomData;
+
+pub struct Directed;
+pub struct Undirected;
+
+pub struct Graph<N, E, Ty = Directed> {
+    nodes: Vec<PhantomData<N>>,
+    edges: Vec<PhantomData<E>>,
+    ty: PhantomData<Ty>,
+}
+
+
+impl<N, E> Graph<N, E, Directed> {
+    pub fn new() -> Self {
+        Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData}
+    }
+}
+
+impl<N, E> Graph<N, E, Undirected> {
+    pub fn new_undirected() -> Self {
+        Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData}
+    }
+}
diff --git a/src/test/ui/issues/auxiliary/issue-41549.rs b/src/test/ui/issues/auxiliary/issue-41549.rs
new file mode 100644 (file)
index 0000000..5a6db78
--- /dev/null
@@ -0,0 +1,14 @@
+// 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.
+
+
+pub trait Trait {
+    const CONST: u32;
+}
diff --git a/src/test/ui/issues/auxiliary/issue-5844-aux.rs b/src/test/ui/issues/auxiliary/issue-5844-aux.rs
new file mode 100644 (file)
index 0000000..7fa937e
--- /dev/null
@@ -0,0 +1,13 @@
+// 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.
+
+extern "C" {
+    pub fn rand() -> u32;
+}
diff --git a/src/test/ui/issues/auxiliary/issue_11680.rs b/src/test/ui/issues/auxiliary/issue_11680.rs
deleted file mode 100644 (file)
index 18f7875..0000000
+++ /dev/null
@@ -1,19 +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.
-
-enum Foo {
-    Bar(isize)
-}
-
-pub mod test {
-    enum Foo {
-        Bar(isize)
-    }
-}
diff --git a/src/test/ui/issues/auxiliary/issue_16725.rs b/src/test/ui/issues/auxiliary/issue_16725.rs
deleted file mode 100644 (file)
index b3b04b4..0000000
+++ /dev/null
@@ -1,13 +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.
-
-extern {
-    fn bar();
-}
diff --git a/src/test/ui/issues/auxiliary/issue_17718_const_privacy.rs b/src/test/ui/issues/auxiliary/issue_17718_const_privacy.rs
deleted file mode 100644 (file)
index 3901d73..0000000
+++ /dev/null
@@ -1,18 +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.
-
-pub use foo::FOO2;
-
-pub const FOO: usize = 3;
-const BAR: usize = 3;
-
-mod foo {
-    pub const FOO2: usize = 3;
-}
diff --git a/src/test/ui/issues/auxiliary/issue_1920.rs b/src/test/ui/issues/auxiliary/issue_1920.rs
deleted file mode 100644 (file)
index 5506517..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Just exporting some type to test for correct diagnostics when this
-// crate is pulled in at a non-root location in client crate.
-
-pub struct S;
diff --git a/src/test/ui/issues/auxiliary/issue_21202.rs b/src/test/ui/issues/auxiliary/issue_21202.rs
deleted file mode 100644 (file)
index afdbf78..0000000
+++ /dev/null
@@ -1,16 +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 mod A {
-    pub struct Foo;
-    impl Foo {
-        fn foo(&self) { }
-    }
-}
diff --git a/src/test/ui/issues/auxiliary/issue_30123_aux.rs b/src/test/ui/issues/auxiliary/issue_30123_aux.rs
deleted file mode 100644 (file)
index f60311a..0000000
+++ /dev/null
@@ -1,33 +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.
-
-use std::marker::PhantomData;
-
-pub struct Directed;
-pub struct Undirected;
-
-pub struct Graph<N, E, Ty = Directed> {
-    nodes: Vec<PhantomData<N>>,
-    edges: Vec<PhantomData<E>>,
-    ty: PhantomData<Ty>,
-}
-
-
-impl<N, E> Graph<N, E, Directed> {
-    pub fn new() -> Self {
-        Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData}
-    }
-}
-
-impl<N, E> Graph<N, E, Undirected> {
-    pub fn new_undirected() -> Self {
-        Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData}
-    }
-}
diff --git a/src/test/ui/issues/auxiliary/issue_41549.rs b/src/test/ui/issues/auxiliary/issue_41549.rs
deleted file mode 100644 (file)
index 5a6db78..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-pub trait Trait {
-    const CONST: u32;
-}
diff --git a/src/test/ui/issues/auxiliary/issue_5844_aux.rs b/src/test/ui/issues/auxiliary/issue_5844_aux.rs
deleted file mode 100644 (file)
index 7fa937e..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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.
-
-extern "C" {
-    pub fn rand() -> u32;
-}
diff --git a/src/test/ui/issues/auxiliary/lint-stability.rs b/src/test/ui/issues/auxiliary/lint-stability.rs
new file mode 100644 (file)
index 0000000..5547458
--- /dev/null
@@ -0,0 +1,198 @@
+// 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.
+
+#![crate_name="lint_stability"]
+#![crate_type = "lib"]
+#![feature(staged_api)]
+#![feature(associated_type_defaults)]
+#![stable(feature = "lint_stability", since = "1.0.0")]
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub fn deprecated() {}
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub fn deprecated_text() {}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "99.99.99", reason = "text")]
+pub fn deprecated_future() {}
+
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub fn deprecated_unstable() {}
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub fn deprecated_unstable_text() {}
+
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+pub fn unstable() {}
+#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
+pub fn unstable_text() {}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+pub fn stable() {}
+#[stable(feature = "rust1", since = "1.0.0")]
+pub fn stable_text() {}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct MethodTester;
+
+impl MethodTester {
+    #[stable(feature = "stable_test_feature", since = "1.0.0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub fn method_deprecated(&self) {}
+    #[stable(feature = "stable_test_feature", since = "1.0.0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub fn method_deprecated_text(&self) {}
+
+    #[unstable(feature = "unstable_test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub fn method_deprecated_unstable(&self) {}
+    #[unstable(feature = "unstable_test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub fn method_deprecated_unstable_text(&self) {}
+
+    #[unstable(feature = "unstable_test_feature", issue = "0")]
+    pub fn method_unstable(&self) {}
+    #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
+    pub fn method_unstable_text(&self) {}
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub fn method_stable(&self) {}
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub fn method_stable_text(&self) {}
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub trait Trait {
+    #[stable(feature = "stable_test_feature", since = "1.0.0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    fn trait_deprecated(&self) {}
+    #[stable(feature = "stable_test_feature", since = "1.0.0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    fn trait_deprecated_text(&self) {}
+
+    #[unstable(feature = "unstable_test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    fn trait_deprecated_unstable(&self) {}
+    #[unstable(feature = "unstable_test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    fn trait_deprecated_unstable_text(&self) {}
+
+    #[unstable(feature = "unstable_test_feature", issue = "0")]
+    fn trait_unstable(&self) {}
+    #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
+    fn trait_unstable_text(&self) {}
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    fn trait_stable(&self) {}
+    #[stable(feature = "rust1", since = "1.0.0")]
+    fn trait_stable_text(&self) {}
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub trait TraitWithAssociatedTypes {
+    #[unstable(feature = "unstable_test_feature", issue = "0")]
+    type TypeUnstable = u8;
+    #[stable(feature = "stable_test_feature", since = "1.0.0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    type TypeDeprecated = u8;
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+impl Trait for MethodTester {}
+
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+pub trait UnstableTrait { fn dummy(&self) { } }
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub trait DeprecatedTrait {
+    #[stable(feature = "stable_test_feature", since = "1.0.0")] fn dummy(&self) { }
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedStruct {
+    #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
+}
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedUnstableStruct {
+    #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
+}
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+pub struct UnstableStruct {
+    #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
+}
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct StableStruct {
+    #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
+}
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+pub enum UnstableEnum {}
+#[stable(feature = "rust1", since = "1.0.0")]
+pub enum StableEnum {}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedUnitStruct;
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedUnstableUnitStruct;
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+pub struct UnstableUnitStruct;
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct StableUnitStruct;
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub enum Enum {
+    #[stable(feature = "stable_test_feature", since = "1.0.0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    DeprecatedVariant,
+    #[unstable(feature = "unstable_test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    DeprecatedUnstableVariant,
+    #[unstable(feature = "unstable_test_feature", issue = "0")]
+    UnstableVariant,
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    StableVariant,
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+#[unstable(feature = "unstable_test_feature", issue = "0")]
+pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[macro_export]
+macro_rules! macro_test {
+    () => (deprecated());
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[macro_export]
+macro_rules! macro_test_arg {
+    ($func:expr) => ($func);
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[macro_export]
+macro_rules! macro_test_arg_nested {
+    ($func:ident) => (macro_test_arg!($func()));
+}
diff --git a/src/test/ui/issues/auxiliary/lint_stability.rs b/src/test/ui/issues/auxiliary/lint_stability.rs
deleted file mode 100644 (file)
index 5547458..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-// 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.
-
-#![crate_name="lint_stability"]
-#![crate_type = "lib"]
-#![feature(staged_api)]
-#![feature(associated_type_defaults)]
-#![stable(feature = "lint_stability", since = "1.0.0")]
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub fn deprecated() {}
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub fn deprecated_text() {}
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "99.99.99", reason = "text")]
-pub fn deprecated_future() {}
-
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub fn deprecated_unstable() {}
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub fn deprecated_unstable_text() {}
-
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-pub fn unstable() {}
-#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
-pub fn unstable_text() {}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-pub fn stable() {}
-#[stable(feature = "rust1", since = "1.0.0")]
-pub fn stable_text() {}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct MethodTester;
-
-impl MethodTester {
-    #[stable(feature = "stable_test_feature", since = "1.0.0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    pub fn method_deprecated(&self) {}
-    #[stable(feature = "stable_test_feature", since = "1.0.0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    pub fn method_deprecated_text(&self) {}
-
-    #[unstable(feature = "unstable_test_feature", issue = "0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    pub fn method_deprecated_unstable(&self) {}
-    #[unstable(feature = "unstable_test_feature", issue = "0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    pub fn method_deprecated_unstable_text(&self) {}
-
-    #[unstable(feature = "unstable_test_feature", issue = "0")]
-    pub fn method_unstable(&self) {}
-    #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
-    pub fn method_unstable_text(&self) {}
-
-    #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn method_stable(&self) {}
-    #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn method_stable_text(&self) {}
-}
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-pub trait Trait {
-    #[stable(feature = "stable_test_feature", since = "1.0.0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    fn trait_deprecated(&self) {}
-    #[stable(feature = "stable_test_feature", since = "1.0.0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    fn trait_deprecated_text(&self) {}
-
-    #[unstable(feature = "unstable_test_feature", issue = "0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    fn trait_deprecated_unstable(&self) {}
-    #[unstable(feature = "unstable_test_feature", issue = "0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    fn trait_deprecated_unstable_text(&self) {}
-
-    #[unstable(feature = "unstable_test_feature", issue = "0")]
-    fn trait_unstable(&self) {}
-    #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
-    fn trait_unstable_text(&self) {}
-
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn trait_stable(&self) {}
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn trait_stable_text(&self) {}
-}
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-pub trait TraitWithAssociatedTypes {
-    #[unstable(feature = "unstable_test_feature", issue = "0")]
-    type TypeUnstable = u8;
-    #[stable(feature = "stable_test_feature", since = "1.0.0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    type TypeDeprecated = u8;
-}
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-impl Trait for MethodTester {}
-
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-pub trait UnstableTrait { fn dummy(&self) { } }
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub trait DeprecatedTrait {
-    #[stable(feature = "stable_test_feature", since = "1.0.0")] fn dummy(&self) { }
-}
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedStruct {
-    #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
-}
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedUnstableStruct {
-    #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
-}
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-pub struct UnstableStruct {
-    #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
-}
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct StableStruct {
-    #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
-}
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-pub enum UnstableEnum {}
-#[stable(feature = "rust1", since = "1.0.0")]
-pub enum StableEnum {}
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedUnitStruct;
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedUnstableUnitStruct;
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-pub struct UnstableUnitStruct;
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct StableUnitStruct;
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-pub enum Enum {
-    #[stable(feature = "stable_test_feature", since = "1.0.0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    DeprecatedVariant,
-    #[unstable(feature = "unstable_test_feature", issue = "0")]
-    #[rustc_deprecated(since = "1.0.0", reason = "text")]
-    DeprecatedUnstableVariant,
-    #[unstable(feature = "unstable_test_feature", issue = "0")]
-    UnstableVariant,
-
-    #[stable(feature = "rust1", since = "1.0.0")]
-    StableVariant,
-}
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[macro_export]
-macro_rules! macro_test {
-    () => (deprecated());
-}
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[macro_export]
-macro_rules! macro_test_arg {
-    ($func:expr) => ($func);
-}
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[macro_export]
-macro_rules! macro_test_arg_nested {
-    ($func:ident) => (macro_test_arg!($func()));
-}
diff --git a/src/test/ui/issues/auxiliary/private-trait-xc.rs b/src/test/ui/issues/auxiliary/private-trait-xc.rs
new file mode 100644 (file)
index 0000000..37ee10c
--- /dev/null
@@ -0,0 +1,11 @@
+// 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.
+
+trait Foo {}
diff --git a/src/test/ui/issues/auxiliary/private_trait_xc.rs b/src/test/ui/issues/auxiliary/private_trait_xc.rs
deleted file mode 100644 (file)
index 37ee10c..0000000
+++ /dev/null
@@ -1,11 +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.
-
-trait Foo {}
diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs b/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs
new file mode 100644 (file)
index 0000000..95b2d62
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type="lib"]
+
+
+pub trait A {
+    fn a(&self) {}
+}
+impl A for () {}
diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs b/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs
new file mode 100644 (file)
index 0000000..a396c31
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type="lib"]
+
+pub extern crate xcrate_issue_43189_a;
diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs b/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs
new file mode 100644 (file)
index 0000000..80f877f
--- /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.
+
+#![crate_type="lib"]
+
+pub extern crate core;
diff --git a/src/test/ui/issues/auxiliary/xcrate_issue_43189_a.rs b/src/test/ui/issues/auxiliary/xcrate_issue_43189_a.rs
deleted file mode 100644 (file)
index 95b2d62..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![crate_type="lib"]
-
-
-pub trait A {
-    fn a(&self) {}
-}
-impl A for () {}
diff --git a/src/test/ui/issues/auxiliary/xcrate_issue_43189_b.rs b/src/test/ui/issues/auxiliary/xcrate_issue_43189_b.rs
deleted file mode 100644 (file)
index a396c31..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![crate_type="lib"]
-
-pub extern crate xcrate_issue_43189_a;
diff --git a/src/test/ui/issues/auxiliary/xcrate_issue_46112_rexport_core.rs b/src/test/ui/issues/auxiliary/xcrate_issue_46112_rexport_core.rs
deleted file mode 100644 (file)
index 80f877f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![crate_type="lib"]
-
-pub extern crate core;
index 2749438433d16fd150e063a693c7a5cb408e3a48..f962704dc75a5755d00bc004275f1e92b67fe230 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:private_trait_xc.rs
+// aux-build:private-trait-xc.rs
 
 extern crate private_trait_xc;
 
index 7dccd7811066e3843393d6354f16dc8adc5620f0..209b63104fa02876154b05c34f8a46bf5a156335 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:issue_11680.rs
+// aux-build:issue-11680.rs
 
 extern crate issue_11680 as other;
 
index 0bda06be9e8ca964575185441d3beff9f5d526f2..b41d81f332c7921fd3e9ebe7affe41ad1ba65ed9 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(warnings)]
-
 struct Attr {
     name: String,
     value: String,
@@ -31,8 +31,8 @@ pub unsafe fn get_attr<'a>(&'a self, name: &str) {
     }
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let element = Element { attrs: Vec::new() };
     let _ = unsafe { element.get_attr("foo") };
 }
diff --git a/src/test/ui/issues/issue-11740.stderr b/src/test/ui/issues/issue-11740.stderr
deleted file mode 100644 (file)
index a1913e0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-11740.rs:35:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let element = Element { attrs: Vec::new() };
-LL | |     let _ = unsafe { element.get_attr("foo") };
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index cadf602a4cfc4aa962c34d062c130b721c7c7610..659ffb2c98408a9c950a6030c0117f6a59b7bc60 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:issue_16725.rs
+// aux-build:issue-16725.rs
 
 extern crate issue_16725 as foo;
 
index ae4e8ce1df8ffd87db4ae2da5a0432e6218e363b..d1d129c918a7c54e09f661fada4adaa31e59b73f 100644 (file)
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
-
+// compile-pass
+// skip-codegen
 fn cb<'a,T>(_x: Box<Fn((&'a i32, &'a (Vec<&'static i32>, bool))) -> T>) -> T {
     panic!()
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     cb(Box::new(|(k, &(ref v, b))| (*k, v.clone(), b)));
 }
diff --git a/src/test/ui/issues/issue-16994.stderr b/src/test/ui/issues/issue-16994.stderr
deleted file mode 100644 (file)
index 8392b9d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-16994.rs:18:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     cb(Box::new(|(k, &(ref v, b))| (*k, v.clone(), b)));
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-17263.ast.stderr b/src/test/ui/issues/issue-17263.ast.stderr
new file mode 100644 (file)
index 0000000..3d42dcb
--- /dev/null
@@ -0,0 +1,26 @@
+error[E0499]: cannot borrow `x` (via `x.b`) as mutable more than once at a time
+  --> $DIR/issue-17263.rs:17:34
+   |
+LL |     let (a, b) = (&mut x.a, &mut x.b);
+   |                        ---       ^^^ second mutable borrow occurs here (via `x.b`)
+   |                        |
+   |                        first mutable borrow occurs here (via `x.a`)
+...
+LL | }
+   | - first borrow ends here
+
+error[E0502]: cannot borrow `foo` (via `foo.b`) as immutable because `foo` is also borrowed as mutable (via `foo.a`)
+  --> $DIR/issue-17263.rs:21:32
+   |
+LL |     let (c, d) = (&mut foo.a, &foo.b);
+   |                        -----   ^^^^^ immutable borrow occurs here (via `foo.b`)
+   |                        |
+   |                        mutable borrow occurs here (via `foo.a`)
+...
+LL | }
+   | - mutable borrow ends here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
index d6009e8078dceb204102b6f977f68de9cbb4fd21..cdb574b8b9f942f8e3d069b5a3051660d89b25af 100644 (file)
@@ -1,12 +1,12 @@
 error: compilation successful
   --> $DIR/issue-17263.rs:15:1
    |
-LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
+LL | / fn main() { //[nll]~ ERROR compilation successful
 LL | |     let mut x: Box<_> = box Foo { a: 1, b: 2 };
 LL | |     let (a, b) = (&mut x.a, &mut x.b);
-LL | |     //~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
+LL | |     //[ast]~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
 ...  |
-LL | |     //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
+LL | |     use_mut(a);
 LL | | }
    | |_^
 
index b251f9a415253eab1a1f71908a854bb4dc83e122..754f3b90aacf1f47de9ce15674126dc94370edf6 100644 (file)
@@ -1,23 +1,35 @@
-// 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 checks diagnostic quality for cases where AST-borrowck treated
+// `Box<T>` as other types (see rust-lang/rfcs#130). NLL again treats
+// `Box<T>` specially. We capture the differences via revisions.
 
+// revisions: ast nll
+//[ast]compile-flags: -Z borrowck=ast
+//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+
+// don't worry about the --compare-mode=nll on this test.
+// ignore-compare-mode-nll
 #![feature(box_syntax, rustc_attrs)]
 
 struct Foo { a: isize, b: isize }
-
-fn main() { #![rustc_error] // rust-lang/rust#49855
+#[rustc_error] // rust-lang/rust#49855
+fn main() { //[nll]~ ERROR compilation successful
     let mut x: Box<_> = box Foo { a: 1, b: 2 };
     let (a, b) = (&mut x.a, &mut x.b);
-    //~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
+    //[ast]~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
 
     let mut foo: Box<_> = box Foo { a: 1, b: 2 };
     let (c, d) = (&mut foo.a, &foo.b);
-    //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
+    //[ast]~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
+
+    // We explicitly use the references created above to illustrate
+    // that NLL is accepting this code *not* because of artificially
+    // short lifetimes, but rather because it understands that all the
+    // references are of disjoint parts of memory.
+    use_imm(d);
+    use_mut(c);
+    use_mut(b);
+    use_mut(a);
 }
+
+fn use_mut<T>(_: &mut T) { }
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/issues/issue-17263.stderr b/src/test/ui/issues/issue-17263.stderr
deleted file mode 100644 (file)
index 4767fbb..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0499]: cannot borrow `x` (via `x.b`) as mutable more than once at a time
-  --> $DIR/issue-17263.rs:17:34
-   |
-LL |     let (a, b) = (&mut x.a, &mut x.b);
-   |                        ---       ^^^ second mutable borrow occurs here (via `x.b`)
-   |                        |
-   |                        first mutable borrow occurs here (via `x.a`)
-...
-LL | }
-   | - first borrow ends here
-
-error[E0502]: cannot borrow `foo` (via `foo.b`) as immutable because `foo` is also borrowed as mutable (via `foo.a`)
-  --> $DIR/issue-17263.rs:21:32
-   |
-LL |     let (c, d) = (&mut foo.a, &foo.b);
-   |                        -----   ^^^^^ immutable borrow occurs here (via `foo.b`)
-   |                        |
-   |                        mutable borrow occurs here (via `foo.a`)
-LL |     //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
-LL | }
-   | - mutable borrow ends here
-
-error: aborting due to 2 previous errors
-
-Some errors occurred: E0499, E0502.
-For more information about an error, try `rustc --explain E0499`.
index 523a387956a32e7e93b4f6175e588c6ce0d14b08..60eb4b7126dae753768edfb9361b9bc5c6fcd35e 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:issue_17718_const_privacy.rs
+// aux-build:issue-17718-const-privacy.rs
 
 extern crate issue_17718_const_privacy as other;
 
index 97dd290a45bc83f7d961f61c67e99c5d63e23e45..7ba655805829aa59857066c5e0b727ac98689eef 100644 (file)
@@ -10,7 +10,7 @@
 
 //! Test that absolute path names are correct when a crate is not linked into the root namespace
 
-// aux-build:issue_1920.rs
+// aux-build:issue-1920.rs
 
 mod foo {
     pub extern crate issue_1920;
index 2af6e2cc991faa98447b0619dbeb99d1f5db8a76..bf4817aaf34dc067c22ffac27172e3757a1b6a12 100644 (file)
@@ -10,7 +10,7 @@
 
 //! Test that when a crate is linked under another name that name is used in global paths
 
-// aux-build:issue_1920.rs
+// aux-build:issue-1920.rs
 
 extern crate issue_1920 as bar;
 
index fa6efea845fce2e80df9823e0cee75c7b8d22adf..a70e958630f28e1bcfe7d69363049efe5f4e2ae0 100644 (file)
@@ -10,7 +10,7 @@
 
 //! Test that when a crate is linked multiple times that the shortest absolute path name is used
 
-// aux-build:issue_1920.rs
+// aux-build:issue-1920.rs
 
 mod foo {
     pub extern crate issue_1920;
index 02b4932cea8c9c12e0cdba0c28c7247976d2380b..d76ded9e679a6eb23df94327b5d7a77dc5542e60 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(warnings)]
-
 trait A<T> {}
 struct B<T> where B<T>: A<B<T>> { t: T }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
 }
diff --git a/src/test/ui/issues/issue-19601.stderr b/src/test/ui/issues/issue-19601.stderr
deleted file mode 100644 (file)
index 594d766..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-19601.rs:18:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 2bce838c1cfdc926bc32f1643b67666322a16a71..fa4b515c81c00c5f3e89c5a0e1fa45c6d7abbb00 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:issue_21202.rs
+// aux-build:issue-21202.rs
 
 extern crate issue_21202 as crate1;
 
index d08f916b870c1159bf0c79bb03011b0842131aff..271230ee4279e2de0de30b722cbd70ba57f61e82 100644 (file)
@@ -7,9 +7,9 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-
-#![feature(unboxed_closures, fn_traits, rustc_attrs)]
-
+// skip-codegen
+// compile-pass
+#![feature(unboxed_closures, fn_traits)]
 struct Foo;
 
 impl<A> FnOnce<(A,)> for Foo {
@@ -17,7 +17,7 @@ impl<A> FnOnce<(A,)> for Foo {
     extern "rust-call" fn call_once(self, (_,): (A,)) {
     }
 }
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     println!("{:?}", Foo("bar"));
 }
diff --git a/src/test/ui/issues/issue-22603.stderr b/src/test/ui/issues/issue-22603.stderr
deleted file mode 100644 (file)
index b50a5a2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-22603.rs:21:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     println!("{:?}", Foo("bar"));
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index cba1c367bb9b2792b7d382fe4619c90e7e9e9e46..9b4c9eb2d43e0258a7d7c4ec75eb037cd6da3f46 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(unboxed_closures, fn_traits, rustc_attrs)]
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+// compile-pass
+// skip-codegen
+#![feature(unboxed_closures, fn_traits)]
+fn main() {
     let k = |x: i32| { x + 1 };
     Fn::call(&k, (0,));
 }
diff --git a/src/test/ui/issues/issue-22789.stderr b/src/test/ui/issues/issue-22789.stderr
deleted file mode 100644 (file)
index afeae9c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-22789.rs:14:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let k = |x: i32| { x + 1 };
-LL | |     Fn::call(&k, (0,));
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index afb972faaca0ef71c24ad9d3dfab828e16da98ca..41bd5d7188fbfee05ba3b1647696bd1bea1c7be5 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(warnings)]
-
 struct CNFParser {
     token: char,
 }
@@ -31,5 +31,5 @@ fn consume_while(&mut self, p: &Fn(char) -> bool) {
     }
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-22933-1.stderr b/src/test/ui/issues/issue-22933-1.stderr
deleted file mode 100644 (file)
index eaebebe..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-22933-1.rs:35:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 097f2a5630cfa36976d069ba96a2ce3f4a2c7813..f047d6e7fffd03ced8ad54825b268aa5c6fdf86e 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
-
+// compile-pass
+// skip-codegen
 mod a {
     pub mod b { pub struct Foo; }
 
@@ -21,8 +21,8 @@ pub mod c {
     pub use self::c::*;
 }
 
-#[rustc_error]
-fn main() {  //~ ERROR compilation successful
+
+fn main() {
     let _ = a::c::Bar(a::b::Foo);
     let _ = a::Bar(a::b::Foo);
 }
diff --git a/src/test/ui/issues/issue-24883.stderr b/src/test/ui/issues/issue-24883.stderr
deleted file mode 100644 (file)
index 4b17747..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-24883.rs:25:1
-   |
-LL | / fn main() {  //~ ERROR compilation successful
-LL | |     let _ = a::c::Bar(a::b::Foo);
-LL | |     let _ = a::Bar(a::b::Foo);
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index c128fb3b47959bb04cb7c64144192045b91efe4d..c930f26acf4c6e9e9b18883758357bcb5cee8a9d 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(warnings)]
-
 trait Mirror {
     type It;
 }
@@ -20,8 +20,8 @@ impl<T> Mirror for T {
 }
 
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let c: <u32 as Mirror>::It = 5;
     const CCCC: <u32 as Mirror>::It = 5;
 }
diff --git a/src/test/ui/issues/issue-26614.stderr b/src/test/ui/issues/issue-26614.stderr
deleted file mode 100644 (file)
index 1752d80..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-26614.rs:24:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let c: <u32 as Mirror>::It = 5;
-LL | |     const CCCC: <u32 as Mirror>::It = 5;
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 6c98f3e856023f1286075f16cf1923009609877e..9751dae26be05fb3ea5524edf718d3d60e94eef2 100644 (file)
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(unused)]
-
 extern crate core;
 use core as core_export;
 use self::x::*;
 mod x {}
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-26930.stderr b/src/test/ui/issues/issue-26930.stderr
deleted file mode 100644 (file)
index f962f4c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-26930.rs:20:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 0f6b9d1b5dc4fc5a6c6a893b440090b02b267f57..494b446dd3ff2cb4a97188b1c4bb31a66dae3fd1 100644 (file)
@@ -10,7 +10,7 @@
 
 // Unstable entities should be caught in import lists
 
-// aux-build:lint_stability.rs
+// aux-build:lint-stability.rs
 
 #![allow(warnings)]
 
index 12e3457ef9e34c0b5817a34a7ee98dccd0178710..7593bb35add097969de0bbe89e6996be611b9df7 100644 (file)
@@ -10,7 +10,7 @@
 
 // Prefix in imports with empty braces should be resolved and checked privacy, stability, etc.
 
-// aux-build:lint_stability.rs
+// aux-build:lint-stability.rs
 
 extern crate lint_stability;
 
index 661579f52b6845e902544481cd873bfc03e76b0e..be28bf0d272ce8ffa44bfee1049cc0f129ce8589 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 
 use std::marker::PhantomData;
 
@@ -27,5 +27,5 @@ pub trait Bar {
 
 impl<T: 'static, W: Bar<Output = T>> Foo<*mut T> for W {}
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-29857.stderr b/src/test/ui/issues/issue-29857.stderr
deleted file mode 100644 (file)
index d5ba942..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-29857.rs:31:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 653097ad69f726bdf297fb07040b2197c5f1ba67..39278cffa122a431e962273afa2ba091be29ad2a 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:issue_30123_aux.rs
+// aux-build:issue-30123-aux.rs
 
 extern crate issue_30123_aux;
 use issue_30123_aux::*;
index 783e831a2a523cb51b5b6121702177f6de2afcef..b2bfe6b5e8c0778b854feb39d74e5b40cdd0b190 100644 (file)
@@ -4,7 +4,7 @@ error[E0004]: non-exhaustive patterns: type () is non-empty
 LL |     match () { } //~ ERROR non-exhaustive
    |           ^^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/issue-3096-1.rs:12:11
    |
 LL |     match () { } //~ ERROR non-exhaustive
index 6031f25c03dff6bcf10abedc6ea8ce4fcdbd3504..bb9dfabe7be0338189591ce1461364200135c1c2 100644 (file)
@@ -4,7 +4,7 @@ error[E0004]: non-exhaustive patterns: type *const bottom is non-empty
 LL |     match x { } //~ ERROR non-exhaustive patterns
    |           ^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/issue-3096-2.rs:15:11
    |
 LL |     match x { } //~ ERROR non-exhaustive patterns
diff --git a/src/test/ui/issues/issue-31076.rs b/src/test/ui/issues/issue-31076.rs
new file mode 100644 (file)
index 0000000..e453107
--- /dev/null
@@ -0,0 +1,17 @@
+#![feature(no_core, lang_items)]
+#![no_core]
+
+#[lang="sized"]
+trait Sized {}
+
+#[lang="add"]
+trait Add<T> {}
+
+impl Add<i32> for i32 {}
+
+fn main() {
+    let x = 5 + 6;
+    //~^ ERROR binary operation `+` cannot be applied to type `{integer}`
+    let y = 5i32 + 6i32;
+    //~^ ERROR binary operation `+` cannot be applied to type `i32`
+}
diff --git a/src/test/ui/issues/issue-31076.stderr b/src/test/ui/issues/issue-31076.stderr
new file mode 100644 (file)
index 0000000..3a13f02
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0369]: binary operation `+` cannot be applied to type `{integer}`
+  --> $DIR/issue-31076.rs:13:13
+   |
+LL |     let x = 5 + 6;
+   |             ^^^^^
+   |
+   = note: an implementation of `std::ops::Add` might be missing for `{integer}`
+
+error[E0369]: binary operation `+` cannot be applied to type `i32`
+  --> $DIR/issue-31076.rs:15:13
+   |
+LL |     let y = 5i32 + 6i32;
+   |             ^^^^^^^^^^^
+   |
+   = note: an implementation of `std::ops::Add` might be missing for `i32`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0369`.
index d9ce1159c0ece6af7f40706a8d2e3008536f06f3..f869c89b79cfdc19d197cf333b60f806e81f3344 100644 (file)
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![deny(non_snake_case)]
-
 #[no_mangle]
 pub extern "C" fn SparklingGenerationForeignFunctionInterface() {}
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-31924-non-snake-ffi.stderr b/src/test/ui/issues/issue-31924-non-snake-ffi.stderr
deleted file mode 100644 (file)
index 2aaaa15..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-31924-non-snake-ffi.rs:18:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index e630a01a59300f8edb415e383579c64d922af608..f96f1ae69214bbda519e7b47354ba5a8001d85d9 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(dead_code)]
-
 pub type T = ();
 mod foo { pub use super::T; }
 mod bar { pub use super::T; }
@@ -25,5 +25,5 @@ mod baz {
     pub use self::bar::*;
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-32119.stderr b/src/test/ui/issues/issue-32119.stderr
deleted file mode 100644 (file)
index 04276ec..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-32119.rs:29:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index b3b34f4b0efda37b4096eabfef8ceaeaf6bef729..c4e8450fabc1782c5c0dc5302417ae97922c2a85 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(warnings)]
 
 mod foo {
@@ -30,5 +31,5 @@ mod b {
     pub use a::bar;
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-32222.stderr b/src/test/ui/issues/issue-32222.stderr
deleted file mode 100644 (file)
index ba2c539..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-32222.rs:34:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 2c54ed3e857e93130c5456b62fd54417b7214945..1061ffe11e1c41194ca5c494d49ee668a186ac14 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 
 pub use bar::*;
 mod bar {
@@ -20,5 +21,5 @@ mod baz {
     pub use main as f;
 }
 
-#[rustc_error]
-pub fn main() {} //~ ERROR compilation successful
+
+pub fn main() {}
diff --git a/src/test/ui/issues/issue-32797.stderr b/src/test/ui/issues/issue-32797.stderr
deleted file mode 100644 (file)
index 8e1430e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-32797.rs:24:1
-   |
-LL | pub fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-32829-2.rs b/src/test/ui/issues/issue-32829-2.rs
new file mode 100644 (file)
index 0000000..2b223ba
--- /dev/null
@@ -0,0 +1,94 @@
+// 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.
+
+// ignore-tidy-linelength
+
+#![feature(const_fn)]
+
+const bad : u32 = {
+    {
+        5;
+        //~^ ERROR statements in constants are unstable
+        0
+    }
+};
+
+const bad_two : u32 = {
+    {
+        invalid();
+        //~^ ERROR statements in constants are unstable
+        //~^^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants
+        0
+    }
+};
+
+const bad_three : u32 = {
+    {
+        valid();
+        //~^ ERROR statements in constants are unstable
+        0
+    }
+};
+
+static bad_four : u32 = {
+    {
+        5;
+        //~^ ERROR statements in statics are unstable
+        0
+    }
+};
+
+static bad_five : u32 = {
+    {
+        invalid();
+        //~^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants
+        //~| ERROR statements in statics are unstable
+        0
+    }
+};
+
+static bad_six : u32 = {
+    {
+        valid();
+        //~^ ERROR statements in statics are unstable
+        0
+    }
+};
+
+static mut bad_seven : u32 = {
+    {
+        5;
+        //~^ ERROR statements in statics are unstable
+        0
+    }
+};
+
+static mut bad_eight : u32 = {
+    {
+        invalid();
+        //~^ ERROR statements in statics are unstable
+        //~| ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants
+        0
+    }
+};
+
+static mut bad_nine : u32 = {
+    {
+        valid();
+        //~^ ERROR statements in statics are unstable
+        0
+    }
+};
+
+
+fn invalid() {}
+const fn valid() {}
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-32829-2.stderr b/src/test/ui/issues/issue-32829-2.stderr
new file mode 100644 (file)
index 0000000..6d6b94c
--- /dev/null
@@ -0,0 +1,94 @@
+error[E0658]: statements in constants are unstable (see issue #48821)
+  --> $DIR/issue-32829-2.rs:17:9
+   |
+LL |         5;
+   |         ^
+   |
+   = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
+  --> $DIR/issue-32829-2.rs:25:9
+   |
+LL |         invalid();
+   |         ^^^^^^^^^
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+  --> $DIR/issue-32829-2.rs:25:9
+   |
+LL |         invalid();
+   |         ^^^^^^^^^
+   |
+   = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+  --> $DIR/issue-32829-2.rs:34:9
+   |
+LL |         valid();
+   |         ^^^^^^^
+   |
+   = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+  --> $DIR/issue-32829-2.rs:42:9
+   |
+LL |         5;
+   |         ^
+   |
+   = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
+  --> $DIR/issue-32829-2.rs:50:9
+   |
+LL |         invalid();
+   |         ^^^^^^^^^
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+  --> $DIR/issue-32829-2.rs:50:9
+   |
+LL |         invalid();
+   |         ^^^^^^^^^
+   |
+   = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+  --> $DIR/issue-32829-2.rs:59:9
+   |
+LL |         valid();
+   |         ^^^^^^^
+   |
+   = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+  --> $DIR/issue-32829-2.rs:67:9
+   |
+LL |         5;
+   |         ^
+   |
+   = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
+  --> $DIR/issue-32829-2.rs:75:9
+   |
+LL |         invalid();
+   |         ^^^^^^^^^
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+  --> $DIR/issue-32829-2.rs:75:9
+   |
+LL |         invalid();
+   |         ^^^^^^^^^
+   |
+   = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+  --> $DIR/issue-32829-2.rs:84:9
+   |
+LL |         valid();
+   |         ^^^^^^^
+   |
+   = help: add #![feature(const_let)] to the crate attributes to enable
+
+error: aborting due to 12 previous errors
+
+Some errors occurred: E0015, E0658.
+For more information about an error, try `rustc --explain E0015`.
index 317a47156c1ac072c877554ad136d1b92429c78b..c0b14da9b2cd109e0796d91aa77a9b5e22f4f586 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(warnings)]
 
 macro_rules! foo { () => {
@@ -31,8 +32,8 @@ macro_rules! baz {
     }
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     foo! {};
     bar! {};
 
diff --git a/src/test/ui/issues/issue-32922.stderr b/src/test/ui/issues/issue-32922.stderr
deleted file mode 100644 (file)
index c1e80b0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-32922.rs:35:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     foo! {};
-LL | |     bar! {};
-LL | |
-LL | |     let mut a = true;
-LL | |     baz!(a);
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 6a411b4c59c6885278f055742a3949699b42351c..858c9f4ae3f35fa2b1b42eea8bf09d55a81b443a 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 
 use std::fmt;
 
@@ -16,8 +17,8 @@
 // an unsized tuple by transmuting a trait object.
 fn any<T>() -> T { unreachable!() }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let t: &(u8, fmt::Debug) = any();
     println!("{:?}", &t.1);
 }
diff --git a/src/test/ui/issues/issue-33241.stderr b/src/test/ui/issues/issue-33241.stderr
deleted file mode 100644 (file)
index 1b6577d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-33241.rs:20:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let t: &(u8, fmt::Debug) = any();
-LL | |     println!("{:?}", &t.1);
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 117ab18a1158af6d2451e236170b4f37bed1c8cf..10ae2b8e6dc167adabf61d1a76ac3e9ceb72526e 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 
 macro_rules! m {
     () => { #[cfg(any())] fn f() {} }
@@ -17,5 +18,5 @@ macro_rules! m {
 trait T {}
 impl T for () { m!(); }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-34028.stderr b/src/test/ui/issues/issue-34028.stderr
deleted file mode 100644 (file)
index b715fa8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-34028.rs:21:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 30dd34ae9a0292442239cbab1fd08597aba49d2f..55fec30cdde71966a69fe156b3f88f9fcdf025b1 100644 (file)
@@ -8,14 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 
 macro_rules! null { ($i:tt) => {} }
 macro_rules! apply_null {
     ($i:item) => { null! { $i } }
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     apply_null!(#[cfg(all())] fn f() {});
 }
diff --git a/src/test/ui/issues/issue-34171.stderr b/src/test/ui/issues/issue-34171.stderr
deleted file mode 100644 (file)
index cb8cfbd..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-34171.rs:19:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     apply_null!(#[cfg(all())] fn f() {});
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 6bc0add2205175d48846f91ec0971971238b21ca..394a85f8c89324e2864b9225fb6cea895cce689c 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(unused)]
 
 macro_rules! make_item {
@@ -27,5 +28,5 @@ fn g() {
     make_stmt! {}
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-34418.stderr b/src/test/ui/issues/issue-34418.stderr
deleted file mode 100644 (file)
index 4cb5ec1..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-34418.rs:31:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index be7e78200204842cb37388a1c84ecf0f9eeb19d5..8aad248dc50f5bf249831cfba23697668b067ac7 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(dead_code)]
 
 trait RegularExpression: Sized {
@@ -27,5 +28,5 @@ enum FindCapturesInner<'r, 't> {
     Dynamic(FindCaptures<'t, ExecNoSyncStr<'r>>),
 }
 
-#[rustc_error]
-fn main() {}    //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-34839.stderr b/src/test/ui/issues/issue-34839.stderr
deleted file mode 100644 (file)
index 538cc7a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-34839.rs:31:1
-   |
-LL | fn main() {}    //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 092bf00ddd6a4fd91bd309a8264eb9417ead3ae2..57ca2c73d8e47a4fe1338a9b238e7db156e9f981 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 
 use std::mem;
 
@@ -34,7 +35,7 @@ fn foo<'a>(x: &'a ()) -> <() as Lifetime<'a>>::Out {
 fn takes_lifetime(_f: for<'a> fn(&'a ()) -> <() as Lifetime<'a>>::Out) {
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     takes_lifetime(foo);
 }
diff --git a/src/test/ui/issues/issue-35570.stderr b/src/test/ui/issues/issue-35570.stderr
deleted file mode 100644 (file)
index 349693f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-35570.rs:38:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     takes_lifetime(foo);
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 3afbfa61984b566456317591534df18c0a5571ef..d16aa1acee09c2417bea9e00b8f032b6f5584fc8 100644 (file)
@@ -10,9 +10,9 @@
 
 // Unnecessary path disambiguator is ok
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(unused)]
-
 macro_rules! m {
     ($p: path) => {
         let _ = $p(0);
@@ -33,5 +33,5 @@ fn f() {
     m!(S::<u8>); // OK, no warning
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
index df69dcb0d92c6be41a796ef0ec43b04381d3066f..5819ea78e2455f53079a0917e8663801d48e57af 100644 (file)
@@ -10,11 +10,3 @@ warning: unnecessary path disambiguator
 LL |     let g: Foo::<i32> = Foo { _a: 42 }; //~ WARN unnecessary path disambiguator
    |               ^^ try removing `::`
 
-error: compilation successful
-  --> $DIR/issue-36116.rs:37:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index b20765815e0b2e10aa2cb3b126c7edbbdd9f2587..e2f8c00dfb9bd5311c3fc26b3d1d641f2bcc181e 100644 (file)
@@ -8,9 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 
 fn _test() -> impl Default { }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/issues/issue-36379.stderr b/src/test/ui/issues/issue-36379.stderr
deleted file mode 100644 (file)
index b06591f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-36379.rs:16:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 3e34b250672798c0df93abdc263f061ec9c86e90..9396b7ad1b1eba7fd47145dbb88d3caafb3b9cab 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 
 pub trait Foo {
     type Bar;
@@ -26,7 +27,7 @@ fn broken(&self) where Self::Assoc: Foo {
     }
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let _m: &Broken<Assoc=()> = &();
 }
diff --git a/src/test/ui/issues/issue-36839.stderr b/src/test/ui/issues/issue-36839.stderr
deleted file mode 100644 (file)
index dd78668..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-36839.rs:30:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let _m: &Broken<Assoc=()> = &();
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index ab08e1899a0ee6b28d149ea36025e88acb81e7a7..adbd0c4b7abe5591bf0699f7f8dded8badb4c07a 100644 (file)
@@ -8,9 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs, associated_type_defaults)]
+// compile-pass
+// skip-codegen
+#![feature(associated_type_defaults)]
 #![allow(warnings)]
-
 trait State: Sized {
     type NextState: State = StateMachineEnded;
     fn execute(self) -> Option<Self::NextState>;
@@ -24,6 +25,6 @@ fn execute(self) -> Option<Self::NextState> {
     }
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
 }
diff --git a/src/test/ui/issues/issue-37051.stderr b/src/test/ui/issues/issue-37051.stderr
deleted file mode 100644 (file)
index b040408..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-37051.rs:28:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 2a4808fb186bb7d81ecf154c869e97d04dcbcb8b..3486403f54a9f286f7155829792034a5182c7f51 100644 (file)
@@ -9,8 +9,9 @@
 // except according to those terms.
 
 // ignore-emscripten
-
-#![feature(rustc_attrs, asm)]
+// compile-pass
+// skip-codegen
+#![feature(asm)]
 
 macro_rules! interrupt_handler {
     () => {
@@ -21,6 +22,6 @@ unsafe fn _interrupt_handler() {
 }
 interrupt_handler!{}
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
 }
diff --git a/src/test/ui/issues/issue-37366.stderr b/src/test/ui/issues/issue-37366.stderr
deleted file mode 100644 (file)
index 8667fec..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-37366.rs:25:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 53c91f323d0811d292aa0a54175b01ef801bf55f..44fcc89983751037244fdef8ab3da38fcd19103c 100644 (file)
@@ -8,12 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 
 fn foo(_: &mut i32) -> bool { true }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let opt = Some(92);
     let mut x = 62;
 
diff --git a/src/test/ui/issues/issue-37510.stderr b/src/test/ui/issues/issue-37510.stderr
deleted file mode 100644 (file)
index 48db0d5..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-37510.rs:16:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let opt = Some(92);
-LL | |     let mut x = 62;
-LL | |
-...  |
-LL | |     }
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index d5733f98193874735004ab2e09bfdf5dc1514176..9ceefaf57b75205ae96a3babf10c3776d7313b09 100644 (file)
@@ -7,13 +7,13 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-
-#![feature(rustc_attrs)]
+// skip-codegen
+// compile-pass
 #![warn(unused)]
 
 type Z = for<'x> Send;
 //~^ WARN type alias is never used
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
 }
index 68e983f23b03459c7d4c7b1869853912a6c24127..3a6e35bb12e0476897e77a28515766d20d4fa775 100644 (file)
@@ -11,12 +11,3 @@ LL | #![warn(unused)]
    |         ^^^^^^
    = note: #[warn(dead_code)] implied by #[warn(unused)]
 
-error: compilation successful
-  --> $DIR/issue-37515.rs:18:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 311d0ceb4d37bc30853b432a169badb79c040357..30552c03cde0e470acfb10c1dcf2b361986ecb9e 100644 (file)
@@ -8,9 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(associated_consts, rustc_attrs)]
+// compile-pass
+// skip-codegen
+#![feature(associated_consts)]
 #![allow(warnings)]
-
 trait MyTrait {
     const MY_CONST: &'static str;
 }
@@ -27,5 +28,5 @@ impl MyTrait for MyStruct {
 
 my_macro!();
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-38160.stderr b/src/test/ui/issues/issue-38160.stderr
deleted file mode 100644 (file)
index 1277d84..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-38160.rs:31:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 6b7dde117dfd6d3252b840e0c024652b2be987f3..b0b79c1f49d3ef7f6640013d446a28f3e976d1a7 100644 (file)
@@ -8,11 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 
 use std::ops::Deref;
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let _x: fn(&i32) -> <&i32 as Deref>::Target = unimplemented!();
 }
diff --git a/src/test/ui/issues/issue-38381.stderr b/src/test/ui/issues/issue-38381.stderr
deleted file mode 100644 (file)
index baa6338..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-38381.rs:16:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let _x: fn(&i32) -> <&i32 as Deref>::Target = unimplemented!();
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs b/src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs
new file mode 100644 (file)
index 0000000..dd58735
--- /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.
+
+pub const FOO: usize = *&0;
diff --git a/src/test/ui/issues/issue-38875/auxiliary/issue_38875_b.rs b/src/test/ui/issues/issue-38875/auxiliary/issue_38875_b.rs
deleted file mode 100644 (file)
index dd58735..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub const FOO: usize = *&0;
diff --git a/src/test/ui/issues/issue-38875/issue-38875.rs b/src/test/ui/issues/issue-38875/issue-38875.rs
new file mode 100644 (file)
index 0000000..74db92c
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-38875-b.rs
+// compile-pass
+
+extern crate issue_38875_b;
+
+fn main() {
+    let test_x = [0; issue_38875_b::FOO];
+}
diff --git a/src/test/ui/issues/issue-38875/issue_38875.rs b/src/test/ui/issues/issue-38875/issue_38875.rs
deleted file mode 100644 (file)
index d9debe3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// aux-build:issue_38875_b.rs
-// compile-pass
-
-extern crate issue_38875_b;
-
-fn main() {
-    let test_x = [0; issue_38875_b::FOO];
-}
index 39249ee4718b1017553fc3dff98b9e5570e8dd06..0d4ba99c45f0e2fad735ce9cfc1dbe40d14b723d 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
+// skip-codegen
 #![allow(warnings)]
 
 enum E {
@@ -18,7 +19,5 @@ enum F { B }
     }
 }
 
-#[rustc_error]
-fn main() {}
-//~^ ERROR compilation successful
 
+fn main() {}
diff --git a/src/test/ui/issues/issue-40350.stderr b/src/test/ui/issues/issue-40350.stderr
deleted file mode 100644 (file)
index ad85bf2..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-40350.rs:22:1
-   |
-LL | fn main() {}
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index ee8fdc16a06f421d550ea3deb01b3c2c7ea01a08..723b6f3111c62230a3505767818ed5d3392657e2 100644 (file)
@@ -12,11 +12,3 @@ LL |         &mut x
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.
 
-error: compilation successful
-  --> $DIR/issue-40510-1.rs:23:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 142092ff41eb33e30ba42dfa866f412b61b7dc8c..b053f8e7d807a5cf7f78df14aa8b8b2f9277898e 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(unused)]
 
 fn f() {
@@ -19,5 +19,5 @@ fn f() {
     };
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-40510-1.stderr b/src/test/ui/issues/issue-40510-1.stderr
deleted file mode 100644 (file)
index 1f5a41f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-40510-1.rs:23:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 0fe56584822635607e7c1d2bb3473f497a1031c1..74c855476f2f56c5aabee0c4a762254e695f56c0 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(unused)]
 
 fn f() {
@@ -19,5 +19,5 @@ fn f() {
     };
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-40510-2.stderr b/src/test/ui/issues/issue-40510-2.stderr
deleted file mode 100644 (file)
index 03998af..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-40510-2.rs:23:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 37a00746a88c23704ab76f44910c3f6353e11ad2..e8e82ee8fdae26a5d606e12fb1b68040c35346f2 100644 (file)
@@ -14,11 +14,3 @@ LL | |         }
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.
 
-error: compilation successful
-  --> $DIR/issue-40510-3.rs:25:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index afa8f15ee570af35b622c007b8049da3bce9b9c7..d4d1d28a1376aeb09fef18dab17066faab13b464 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(unused)]
 
 fn f() {
@@ -21,5 +21,5 @@ fn f() {
     };
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-40510-3.stderr b/src/test/ui/issues/issue-40510-3.stderr
deleted file mode 100644 (file)
index c77b5cc..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-40510-3.rs:25:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index a39c500225b9bfd148dce3ffe48ed6cf97dca349..6059f2b82c1b5166705860412735a16705f09c91 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(unused)]
 
 fn f() {
@@ -21,5 +21,5 @@ fn f() {
     };
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-40510-4.stderr b/src/test/ui/issues/issue-40510-4.stderr
deleted file mode 100644 (file)
index 1f3cd00..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-40510-4.rs:25:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-40827.rs b/src/test/ui/issues/issue-40827.rs
new file mode 100644 (file)
index 0000000..4b079ac
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::rc::Rc;
+use std::sync::Arc;
+
+struct Foo(Arc<Bar>);
+
+enum Bar {
+    A(Rc<Foo>),
+    B(Option<Foo>),
+}
+
+fn f<T: Send>(_: T) {}
+
+fn main() {
+    f(Foo(Arc::new(Bar::B(None))));
+    //~^ ERROR E0277
+    //~| ERROR E0277
+}
diff --git a/src/test/ui/issues/issue-40827.stderr b/src/test/ui/issues/issue-40827.stderr
new file mode 100644 (file)
index 0000000..dd0ebf9
--- /dev/null
@@ -0,0 +1,35 @@
+error[E0277]: `std::rc::Rc<Foo>` cannot be sent between threads safely
+  --> $DIR/issue-40827.rs:24:5
+   |
+LL |     f(Foo(Arc::new(Bar::B(None))));
+   |     ^ `std::rc::Rc<Foo>` cannot be sent between threads safely
+   |
+   = help: within `Bar`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<Foo>`
+   = note: required because it appears within the type `Bar`
+   = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<Bar>`
+   = note: required because it appears within the type `Foo`
+note: required by `f`
+  --> $DIR/issue-40827.rs:21:1
+   |
+LL | fn f<T: Send>(_: T) {}
+   | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `std::rc::Rc<Foo>` cannot be shared between threads safely
+  --> $DIR/issue-40827.rs:24:5
+   |
+LL |     f(Foo(Arc::new(Bar::B(None))));
+   |     ^ `std::rc::Rc<Foo>` cannot be shared between threads safely
+   |
+   = help: within `Bar`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc<Foo>`
+   = note: required because it appears within the type `Bar`
+   = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<Bar>`
+   = note: required because it appears within the type `Foo`
+note: required by `f`
+  --> $DIR/issue-40827.rs:21:1
+   |
+LL | fn f<T: Send>(_: T) {}
+   | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
index 67be194c8ed2a76fd03b9b8dc69a07f3fc753a41..de52fcfe327227b82a6a0bb8ee71e4b6f0192b84 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:issue_41549.rs
+// aux-build:issue-41549.rs
 
 
 extern crate issue_41549;
diff --git a/src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs b/src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs
new file mode 100644 (file)
index 0000000..0b71443
--- /dev/null
@@ -0,0 +1,16 @@
+// 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.
+
+pub trait Tr {
+    // Note: The function needs to be declared over multiple lines to reproduce
+    // the crash. DO NOT reformat.
+    fn f()
+        where Self: Sized;
+}
diff --git a/src/test/ui/issues/issue-41652/auxiliary/issue_41652_b.rs b/src/test/ui/issues/issue-41652/auxiliary/issue_41652_b.rs
deleted file mode 100644 (file)
index 0b71443..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait Tr {
-    // Note: The function needs to be declared over multiple lines to reproduce
-    // the crash. DO NOT reformat.
-    fn f()
-        where Self: Sized;
-}
diff --git a/src/test/ui/issues/issue-41652/issue-41652.rs b/src/test/ui/issues/issue-41652/issue-41652.rs
new file mode 100644 (file)
index 0000000..4b42c04
--- /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.
+
+// aux-build:issue-41652-b.rs
+
+extern crate issue_41652_b;
+
+struct S;
+
+impl issue_41652_b::Tr for S {
+    fn f() {
+        3.f()
+        //~^ ERROR can't call method `f` on ambiguous numeric type `{integer}`
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-41652/issue-41652.stderr b/src/test/ui/issues/issue-41652/issue-41652.stderr
new file mode 100644 (file)
index 0000000..ed5eb36
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0689]: can't call method `f` on ambiguous numeric type `{integer}`
+  --> $DIR/issue-41652.rs:19:11
+   |
+LL |         3.f()
+   |           ^
+help: you must specify a concrete type for this numeric value, like `i32`
+   |
+LL |         3_i32.f()
+   |         ^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0689`.
diff --git a/src/test/ui/issues/issue-41652/issue_41652.rs b/src/test/ui/issues/issue-41652/issue_41652.rs
deleted file mode 100644 (file)
index a4e9282..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// aux-build:issue_41652_b.rs
-
-extern crate issue_41652_b;
-
-struct S;
-
-impl issue_41652_b::Tr for S {
-    fn f() {
-        3.f()
-        //~^ ERROR can't call method `f` on ambiguous numeric type `{integer}`
-    }
-}
-
-fn main() {}
diff --git a/src/test/ui/issues/issue-41652/issue_41652.stderr b/src/test/ui/issues/issue-41652/issue_41652.stderr
deleted file mode 100644 (file)
index 3f76b25..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0689]: can't call method `f` on ambiguous numeric type `{integer}`
-  --> $DIR/issue_41652.rs:19:11
-   |
-LL |         3.f()
-   |           ^
-help: you must specify a concrete type for this numeric value, like `i32`
-   |
-LL |         3_i32.f()
-   |         ^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0689`.
index 406aadcd2129d8291b93c6bea55059ccef8ec8e0..57af617c5ff811e6fa6f28451b69a8dee4a50423 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     if ('x' as char) < ('y' as char) {
         print!("x");
     } else {
diff --git a/src/test/ui/issues/issue-41998.stderr b/src/test/ui/issues/issue-41998.stderr
deleted file mode 100644 (file)
index e757c7f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-error: compilation successful
-  --> $DIR/issue-41998.rs:14:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     if ('x' as char) < ('y' as char) {
-LL | |         print!("x");
-LL | |     } else {
-LL | |         print!("y");
-LL | |     }
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 154bee5d1d4f377649653942a0f64ebcb3a4597b..7018198aff55b270173a37d8f6a6baa8f203deb5 100644 (file)
@@ -12,8 +12,8 @@
 // paths rooted from `std` to be misrendered in the diagnostic output.
 
 // ignore-windows
-// aux-build:xcrate_issue_43189_a.rs
-// aux-build:xcrate_issue_43189_b.rs
+// aux-build:xcrate-issue-43189-a.rs
+// aux-build:xcrate-issue-43189-b.rs
 
 extern crate xcrate_issue_43189_b;
 fn main() {
diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs
new file mode 100644 (file)
index 0000000..56eb154
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub const FOO: usize = *&0;
diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs
new file mode 100644 (file)
index 0000000..56eb154
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub const FOO: usize = *&0;
diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue_45829_a.rs b/src/test/ui/issues/issue-45829/auxiliary/issue_45829_a.rs
deleted file mode 100644 (file)
index 56eb154..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub const FOO: usize = *&0;
diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue_45829_b.rs b/src/test/ui/issues/issue-45829/auxiliary/issue_45829_b.rs
deleted file mode 100644 (file)
index 56eb154..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub const FOO: usize = *&0;
index 5230cadf604304ee6ddfa4401061add0af9c0e52..6befee331d5ae4da33d7c160195e6f6de565e470 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:issue_45829_b.rs
+// aux-build:issue-45829-b.rs
 
 mod foo {
     pub mod bar {}
index 7066ed65c78c30e02184670df0ed8623e35eead4..61c7e915fe88c6495d337a37de8814bb7dcee66c 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:issue_45829_a.rs
-// aux-build:issue_45829_b.rs
+// aux-build:issue-45829-a.rs
+// aux-build:issue-45829-b.rs
 
 extern crate issue_45829_a;
 extern  crate    issue_45829_b  as  issue_45829_a;
index 7c3d97240057462b082f0803f5b9c652bf3ddb67..41e3e8bbe1452ca915bcfb4507138dd0933b8344 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:issue_45829_a.rs
-// aux-build:issue_45829_b.rs
+// aux-build:issue-45829-a.rs
+// aux-build:issue-45829-b.rs
 
 extern crate issue_45829_a;
 extern crate issue_45829_b as issue_45829_a;
index 1cc261ed922eb522c89a19a5ecac29754c636b58..9a2ec7a527326e02489790f3857ce8d41d5ac20e 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// aux-build:issue_45829_b.rs
+// aux-build:issue-45829-b.rs
 
 extern crate issue_45829_b;
 use std as issue_45829_b;
index 698005b5d3068a10ddae00340a5e79ffd3f1bc8b..202c67e584c5dfa5000c286e8e374fb78b685737 100644 (file)
@@ -12,7 +12,7 @@
 // paths rooted from `std` to be misrendered in the diagnostic output.
 
 // ignore-windows
-// aux-build:xcrate_issue_46112_rexport_core.rs
+// aux-build:xcrate-issue-46112-rexport-core.rs
 
 extern crate xcrate_issue_46112_rexport_core;
 fn test(r: Result<Option<()>, &'static str>) { }
diff --git a/src/test/ui/issues/issue-49556.rs b/src/test/ui/issues/issue-49556.rs
new file mode 100644 (file)
index 0000000..7f7b349
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-pass
+fn iter<'a>(data: &'a [usize]) -> impl Iterator<Item = usize> + 'a {
+    data.iter()
+        .map(
+            |x| x // fn(&'a usize) -> &'(ReScope) usize
+        )
+        .map(
+            |x| *x // fn(&'(ReScope) usize) -> usize
+        )
+}
+
+fn main() {
+}
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs
new file mode 100644 (file)
index 0000000..4c67fb3
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(inner_deref)]
+
+fn main() {
+    let _result = &Some(42).deref();
+//~^ ERROR no method named `deref` found for type `std::option::Option<{integer}>`
+}
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr
new file mode 100644 (file)
index 0000000..3e255ca
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0599]: no method named `deref` found for type `std::option::Option<{integer}>` in the current scope
+  --> $DIR/option-deref.rs:14:29
+   |
+LL |     let _result = &Some(42).deref();
+   |                             ^^^^^
+   |
+   = note: the method `deref` exists but the following trait bounds were not satisfied:
+           `{integer} : std::ops::Deref`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.rs
deleted file mode 100644 (file)
index 4c67fb3..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(inner_deref)]
-
-fn main() {
-    let _result = &Some(42).deref();
-//~^ ERROR no method named `deref` found for type `std::option::Option<{integer}>`
-}
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr
deleted file mode 100644 (file)
index a56cd6e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0599]: no method named `deref` found for type `std::option::Option<{integer}>` in the current scope
-  --> $DIR/option_deref.rs:14:29
-   |
-LL |     let _result = &Some(42).deref();
-   |                             ^^^^^
-   |
-   = note: the method `deref` exists but the following trait bounds were not satisfied:
-           `{integer} : std::ops::Deref`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs
new file mode 100644 (file)
index 0000000..5d1e747
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(inner_deref)]
+
+fn main() {
+    let _result = &Err(41).deref_err();
+//~^ ERROR no method named `deref_err` found
+}
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr
new file mode 100644 (file)
index 0000000..57b5d07
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0599]: no method named `deref_err` found for type `std::result::Result<_, {integer}>` in the current scope
+  --> $DIR/result-deref-err.rs:14:28
+   |
+LL |     let _result = &Err(41).deref_err();
+   |                            ^^^^^^^^^
+   |
+   = note: the method `deref_err` exists but the following trait bounds were not satisfied:
+           `{integer} : std::ops::Deref`
+   = help: did you mean `deref_ok`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs
new file mode 100644 (file)
index 0000000..bee8e0c
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(inner_deref)]
+
+fn main() {
+    let _result = &Ok(42).deref_ok();
+//~^ ERROR no method named `deref_ok` found
+}
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr
new file mode 100644 (file)
index 0000000..ee0c439
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0599]: no method named `deref_ok` found for type `std::result::Result<{integer}, _>` in the current scope
+  --> $DIR/result-deref-ok.rs:14:27
+   |
+LL |     let _result = &Ok(42).deref_ok();
+   |                           ^^^^^^^^
+   |
+   = note: the method `deref_ok` exists but the following trait bounds were not satisfied:
+           `{integer} : std::ops::Deref`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs
new file mode 100644 (file)
index 0000000..73bdf0b
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(inner_deref)]
+
+fn main() {
+    let _result = &Ok(42).deref();
+//~^ ERROR no method named `deref` found
+}
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr
new file mode 100644 (file)
index 0000000..46fee66
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0599]: no method named `deref` found for type `std::result::Result<{integer}, _>` in the current scope
+  --> $DIR/result-deref.rs:14:27
+   |
+LL |     let _result = &Ok(42).deref();
+   |                           ^^^^^
+   |
+   = note: the method `deref` exists but the following trait bounds were not satisfied:
+           `{integer} : std::ops::Deref`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.rs
deleted file mode 100644 (file)
index 73bdf0b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(inner_deref)]
-
-fn main() {
-    let _result = &Ok(42).deref();
-//~^ ERROR no method named `deref` found
-}
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr
deleted file mode 100644 (file)
index d3d7c19..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0599]: no method named `deref` found for type `std::result::Result<{integer}, _>` in the current scope
-  --> $DIR/result_deref.rs:14:27
-   |
-LL |     let _result = &Ok(42).deref();
-   |                           ^^^^^
-   |
-   = note: the method `deref` exists but the following trait bounds were not satisfied:
-           `{integer} : std::ops::Deref`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.rs
deleted file mode 100644 (file)
index 5d1e747..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(inner_deref)]
-
-fn main() {
-    let _result = &Err(41).deref_err();
-//~^ ERROR no method named `deref_err` found
-}
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr
deleted file mode 100644 (file)
index bf75687..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0599]: no method named `deref_err` found for type `std::result::Result<_, {integer}>` in the current scope
-  --> $DIR/result_deref_err.rs:14:28
-   |
-LL |     let _result = &Err(41).deref_err();
-   |                            ^^^^^^^^^
-   |
-   = note: the method `deref_err` exists but the following trait bounds were not satisfied:
-           `{integer} : std::ops::Deref`
-   = help: did you mean `deref_ok`?
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.rs
deleted file mode 100644 (file)
index bee8e0c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(inner_deref)]
-
-fn main() {
-    let _result = &Ok(42).deref_ok();
-//~^ ERROR no method named `deref_ok` found
-}
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr
deleted file mode 100644 (file)
index a77333a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0599]: no method named `deref_ok` found for type `std::result::Result<{integer}, _>` in the current scope
-  --> $DIR/result_deref_ok.rs:14:27
-   |
-LL |     let _result = &Ok(42).deref_ok();
-   |                           ^^^^^^^^
-   |
-   = note: the method `deref_ok` exists but the following trait bounds were not satisfied:
-           `{integer} : std::ops::Deref`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issues/issue-51602.rs b/src/test/ui/issues/issue-51602.rs
new file mode 100644 (file)
index 0000000..a3edecb
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main(){
+    if i in 1..10 {
+        break;
+    }
+}
diff --git a/src/test/ui/issues/issue-51602.stderr b/src/test/ui/issues/issue-51602.stderr
new file mode 100644 (file)
index 0000000..d50ee64
--- /dev/null
@@ -0,0 +1,10 @@
+error: expected `{`, found keyword `in`
+  --> $DIR/issue-51602.rs:12:10
+   |
+LL |     if i in 1..10 {
+   |     --   ^^ expected `{`
+   |     |
+   |     this `if` statement has a condition, but no block
+
+error: aborting due to previous error
+
index b25b063f3b6fbbf2379676795aa42a94f61416d0..2165d951102c2d565f16a9842380c9c126e6c374 100644 (file)
@@ -3,9 +3,9 @@ error[E0597]: `line` does not live long enough
    |
 LL |         let v: Vec<&str> = line.split_whitespace().collect();
    |                            ^^^^ borrowed value does not live long enough
-LL |         //~^ ERROR `line` does not live long enough
-LL |         println!("accumulator before add_assign {:?}", acc.map);
-   |                                                        ------- borrow used here, in later iteration of loop
+...
+LL |         acc += cnt2;
+   |         --- borrow used here, in later iteration of loop
 ...
 LL |     }
    |     - `line` dropped here while still borrowed
index b26ad9bc37dd15dea784869e38dd967175c24259..1a353f9ea7cd37f56f558122116009f3818fe7e4 100644 (file)
@@ -43,7 +43,7 @@ pub fn panics() {
     for line in vec!["123456789".to_string(), "12345678".to_string()] {
         let v: Vec<&str> = line.split_whitespace().collect();
         //~^ ERROR `line` does not live long enough
-        println!("accumulator before add_assign {:?}", acc.map);
+        // println!("accumulator before add_assign {:?}", acc.map);
         let mut map = HashMap::new();
         for str_ref in v {
             let e = map.entry(str_ref);
@@ -53,7 +53,7 @@ pub fn panics() {
         }
         let cnt2 = Counter{map};
         acc += cnt2;
-        println!("accumulator after add_assign {:?}", acc.map);
+        // println!("accumulator after add_assign {:?}", acc.map);
         // line gets dropped here but references are kept in acc.map
     }
 }
diff --git a/src/test/ui/issues/issue-52717.rs b/src/test/ui/issues/issue-52717.rs
new file mode 100644 (file)
index 0000000..d40e2bd
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+enum A {
+  A {
+    foo: usize,
+  }
+}
+
+fn main() {
+  let x = A::A { foo: 3 };
+  match x {
+    A::A { fob } => { println!("{}", fob); }
+  }
+}
diff --git a/src/test/ui/issues/issue-52717.stderr b/src/test/ui/issues/issue-52717.stderr
new file mode 100644 (file)
index 0000000..0ef5a84
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0026]: variant `A::A` does not have a field named `fob`
+  --> $DIR/issue-52717.rs:19:12
+   |
+LL |     A::A { fob } => { println!("{}", fob); }
+   |            ^^^
+   |            |
+   |            variant `A::A` does not have this field
+   |            help: did you mean: `foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0026`.
diff --git a/src/test/ui/issues/issue-52992.rs b/src/test/ui/issues/issue-52992.rs
new file mode 100644 (file)
index 0000000..2ece0ee
--- /dev/null
@@ -0,0 +1,37 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for an NLL-related ICE (#52992) -- computing
+// implied bounds was causing outlives relations that were not
+// properly handled.
+//
+// compile-pass
+
+#![feature(nll)]
+
+fn main() {}
+
+fn fail<'a>() -> Struct<'a, Generic<()>> {
+    Struct(&Generic(()))
+}
+
+struct Struct<'a, T>(&'a T) where
+    T: Trait + 'a,
+    T::AT: 'a; // only fails with this bound
+
+struct Generic<T>(T);
+
+trait Trait {
+    type AT;
+}
+
+impl<T> Trait for Generic<T> {
+    type AT = T; // only fails with a generic AT
+}
diff --git a/src/test/ui/issues/issue-53251.rs b/src/test/ui/issues/issue-53251.rs
new file mode 100644 (file)
index 0000000..8c75ea4
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct S;
+
+impl S {
+    fn f() {}
+}
+
+macro_rules! impl_add {
+    ($($n:ident)*) => {
+        $(
+            fn $n() {
+                S::f::<i64>();
+                //~^ ERROR wrong number of type arguments
+            }
+        )*
+    }
+}
+
+impl_add!(a b);
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-53251.stderr b/src/test/ui/issues/issue-53251.stderr
new file mode 100644 (file)
index 0000000..51ea745
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0107]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/issue-53251.rs:21:24
+   |
+LL |                 S::f::<i64>();
+   |                        ^^^ unexpected type argument
+...
+LL | impl_add!(a b);
+   | --------------- in this macro invocation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/src/test/ui/issues/issue-53300.rs b/src/test/ui/issues/issue-53300.rs
new file mode 100644 (file)
index 0000000..d055a6f
--- /dev/null
@@ -0,0 +1,22 @@
+// 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.
+
+// issue 53300
+
+pub trait A {
+    fn add(&self, b: i32) -> i32;
+}
+
+fn addition() -> Wrapper<impl A> {}
+//~^ ERROR cannot find type `Wrapper` in this scope [E0412]
+
+fn main() {
+    let res = addition();
+}
diff --git a/src/test/ui/issues/issue-53300.stderr b/src/test/ui/issues/issue-53300.stderr
new file mode 100644 (file)
index 0000000..920287a
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `Wrapper` in this scope
+  --> $DIR/issue-53300.rs:17:18
+   |
+LL | fn addition() -> Wrapper<impl A> {}
+   |                  ^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/issues/issue-53419.rs b/src/test/ui/issues/issue-53419.rs
new file mode 100644 (file)
index 0000000..0dd5a85
--- /dev/null
@@ -0,0 +1,19 @@
+// 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.
+
+//compile-pass
+
+struct Foo {
+    bar: for<'r> Fn(usize, &'r FnMut())
+}
+
+fn main() {
+}
+
diff --git a/src/test/ui/issues/issue-53565.rs b/src/test/ui/issues/issue-53565.rs
new file mode 100644 (file)
index 0000000..2bf3829
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+use std::time::{foo, bar, buzz};
+use std::time::{abc, def};
+fn main(){
+   println!("Hello World!");
+}
diff --git a/src/test/ui/issues/issue-53565.stderr b/src/test/ui/issues/issue-53565.stderr
new file mode 100644 (file)
index 0000000..945f5ef
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0432]: unresolved imports `std::time::foo`, `std::time::bar`, `std::time::buzz`
+  --> $DIR/issue-53565.rs:10:17
+   |
+LL | use std::time::{foo, bar, buzz};
+   |                 ^^^  ^^^  ^^^^ no `buzz` in `time`
+   |                 |    |
+   |                 |    no `bar` in `time`
+   |                 no `foo` in `time`
+
+error[E0432]: unresolved imports `std::time::abc`, `std::time::def`
+  --> $DIR/issue-53565.rs:11:17
+   |
+LL | use std::time::{abc, def};
+   |                 ^^^  ^^^ no `def` in `time`
+   |                 |
+   |                 no `abc` in `time`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/issues/issue-53568.rs b/src/test/ui/issues/issue-53568.rs
new file mode 100644 (file)
index 0000000..6b479f7
--- /dev/null
@@ -0,0 +1,61 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for an NLL-related ICE (#53568) -- we failed to
+// resolve inference variables in "custom type-ops".
+//
+// compile-pass
+
+#![feature(nll)]
+#![allow(dead_code)]
+
+trait Future {
+    type Item;
+}
+
+impl<F, T> Future for F
+where F: Fn() -> T
+{
+    type Item = T;
+}
+
+trait Connect {}
+
+struct Connector<H> {
+    handler: H,
+}
+
+impl<H, T> Connect for Connector<H>
+where
+    T: 'static,
+    H: Future<Item = T>
+{
+}
+
+struct Client<C> {
+    connector: C,
+}
+
+fn build<C>(_connector: C) -> Client<C> {
+    unimplemented!()
+}
+
+fn client<H>(handler: H) -> Client<impl Connect>
+where H: Fn() + Copy
+{
+    let connector = Connector {
+        handler,
+    };
+    let client = build(connector);
+    client
+}
+
+fn main() { }
+
diff --git a/src/test/ui/issues/issue-53692.rs b/src/test/ui/issues/issue-53692.rs
new file mode 100644 (file)
index 0000000..0b6cc36
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+fn main() {
+        let items = vec![1, 2, 3];
+        let ref_items: &[i32] = &items;
+        let items_clone: Vec<i32> = ref_items.clone();
+
+        // in that case no suggestion will be triggered
+        let items_clone_2:Vec<i32> = items.clone();
+
+        let s = "hi";
+        let string: String = s.clone();
+
+        // in that case no suggestion will be triggered
+        let s2 = "hi";
+        let string_2: String = s2.to_string();
+}
diff --git a/src/test/ui/issues/issue-53692.stderr b/src/test/ui/issues/issue-53692.stderr
new file mode 100644 (file)
index 0000000..9cd8a53
--- /dev/null
@@ -0,0 +1,27 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-53692.rs:13:37
+   |
+LL |         let items_clone: Vec<i32> = ref_items.clone();
+   |                                     ^^^^^^^^^^^^^^^^^
+   |                                     |
+   |                                     expected struct `std::vec::Vec`, found &[i32]
+   |                                     help: try using a conversion method: `ref_items.to_vec()`
+   |
+   = note: expected type `std::vec::Vec<i32>`
+              found type `&[i32]`
+
+error[E0308]: mismatched types
+  --> $DIR/issue-53692.rs:19:30
+   |
+LL |         let string: String = s.clone();
+   |                              ^^^^^^^^^
+   |                              |
+   |                              expected struct `std::string::String`, found &str
+   |                              help: try using a conversion method: `s.to_string()`
+   |
+   = note: expected type `std::string::String`
+              found type `&str`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/issues/issue-53840.rs b/src/test/ui/issues/issue-53840.rs
new file mode 100644 (file)
index 0000000..ece3caf
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+enum E {
+    Foo(String, String, String),
+}
+
+struct Bar {
+    a: String,
+    b: String,
+}
+
+fn main() {
+    let bar = Bar { a: "1".to_string(), b: "2".to_string() };
+    match E::Foo("".into(), "".into(), "".into()) {
+        E::Foo(a, b, ref c) => {}
+    }
+    match bar {
+        Bar {a, ref b} => {}
+    }
+}
diff --git a/src/test/ui/issues/issue-53840.stderr b/src/test/ui/issues/issue-53840.stderr
new file mode 100644 (file)
index 0000000..961e4c0
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0009]: cannot bind by-move and by-ref in the same pattern
+  --> $DIR/issue-53840.rs:22:16
+   |
+LL |         E::Foo(a, b, ref c) => {}
+   |                ^  ^  ----- both by-ref and by-move used
+   |                |  |
+   |                |  by-move pattern here
+   |                by-move pattern here
+
+error[E0009]: cannot bind by-move and by-ref in the same pattern
+  --> $DIR/issue-53840.rs:25:14
+   |
+LL |         Bar {a, ref b} => {}
+   |              ^  ----- both by-ref and by-move used
+   |              |
+   |              by-move pattern here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0009`.
diff --git a/src/test/ui/issues/issue-54302-cases.rs b/src/test/ui/issues/issue-54302-cases.rs
new file mode 100644 (file)
index 0000000..6d1c61c
--- /dev/null
@@ -0,0 +1,95 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Mirror {
+    type Image;
+    fn coerce(self) -> Self::Image;
+}
+
+impl<T> Mirror for T {
+    type Image = T;
+    fn coerce(self) -> Self { self }
+}
+
+trait Foo<'x, T> {
+    fn foo(self) -> &'x T;
+}
+
+impl<'s, 'x, T: 'x> Foo<'x, T> for &'s T where &'s T: Foo2<'x, T> {
+    fn foo(self) -> &'x T { self.foo2() }
+}
+
+trait Foo2<'x, T> {
+    fn foo2(self) -> &'x T;
+}
+
+// example 1 - fails leak check
+impl<'x> Foo2<'x, u32> for &'x u32
+{
+    fn foo2(self) -> &'x u32 { self }
+}
+
+// example 2 - OK with this issue
+impl<'x, 'a: 'x> Foo2<'x, i32> for &'a i32
+{
+    fn foo2(self) -> &'x i32 { self }
+}
+
+// example 3 - fails due to issue #XYZ + Leak-check
+impl<'x, T> Foo2<'x, u64> for T
+    where T: Mirror<Image=&'x u64>
+{
+    fn foo2(self) -> &'x u64 { self.coerce() }
+}
+
+// example 4 - fails due to issue #XYZ
+impl<'x, 'a: 'x, T> Foo2<'x, i64> for T
+    where T: Mirror<Image=&'a i64>
+{
+    fn foo2(self) -> &'x i64 { self.coerce() }
+}
+
+
+trait RefFoo<T> {
+    fn ref_foo(&self) -> &'static T;
+}
+
+impl<T> RefFoo<T> for T where for<'a> &'a T: Foo<'static, T> {
+    fn ref_foo(&self) -> &'static T {
+        self.foo()
+    }
+}
+
+
+fn coerce_lifetime1(a: &u32) -> &'static u32
+{
+    <u32 as RefFoo<u32>>::ref_foo(a)
+    //~^ ERROR the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied
+}
+
+fn coerce_lifetime2(a: &i32) -> &'static i32
+{
+    <i32 as RefFoo<i32>>::ref_foo(a)
+    //~^ ERROR the requirement `for<'a> 'a : ` is not satisfied
+}
+
+fn coerce_lifetime3(a: &u64) -> &'static u64
+{
+    <u64 as RefFoo<u64>>::ref_foo(a)
+    //~^ ERROR type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64`
+}
+
+fn coerce_lifetime4(a: &i64) -> &'static i64
+{
+    <i64 as RefFoo<i64>>::ref_foo(a)
+    //~^ ERROR type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64`
+}
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-54302-cases.stderr b/src/test/ui/issues/issue-54302-cases.stderr
new file mode 100644 (file)
index 0000000..9603f7a
--- /dev/null
@@ -0,0 +1,65 @@
+error[E0277]: the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied
+  --> $DIR/issue-54302-cases.rs:73:5
+   |
+LL |     <u32 as RefFoo<u32>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo2<'_, u32>` is not implemented for `&'a u32`
+   |
+   = help: the following implementations were found:
+             <&'x u32 as Foo2<'x, u32>>
+   = note: required because of the requirements on the impl of `for<'a> Foo<'static, u32>` for `&'a u32`
+   = note: required because of the requirements on the impl of `RefFoo<u32>` for `u32`
+note: required by `RefFoo::ref_foo`
+  --> $DIR/issue-54302-cases.rs:61:5
+   |
+LL |     fn ref_foo(&self) -> &'static T;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0279]: the requirement `for<'a> 'a : ` is not satisfied (`expected bound lifetime parameter 'a, found concrete lifetime`)
+  --> $DIR/issue-54302-cases.rs:79:5
+   |
+LL |     <i32 as RefFoo<i32>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: required because of the requirements on the impl of `for<'a> Foo2<'_, i32>` for `&'a i32`
+   = note: required because of the requirements on the impl of `for<'a> Foo<'static, i32>` for `&'a i32`
+   = note: required because of the requirements on the impl of `RefFoo<i32>` for `i32`
+note: required by `RefFoo::ref_foo`
+  --> $DIR/issue-54302-cases.rs:61:5
+   |
+LL |     fn ref_foo(&self) -> &'static T;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0271]: type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64`
+  --> $DIR/issue-54302-cases.rs:85:5
+   |
+LL |     <u64 as RefFoo<u64>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime
+   |
+   = note: required because of the requirements on the impl of `for<'a> Foo2<'_, u64>` for `&'a u64`
+   = note: required because of the requirements on the impl of `for<'a> Foo<'static, u64>` for `&'a u64`
+   = note: required because of the requirements on the impl of `RefFoo<u64>` for `u64`
+note: required by `RefFoo::ref_foo`
+  --> $DIR/issue-54302-cases.rs:61:5
+   |
+LL |     fn ref_foo(&self) -> &'static T;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0271]: type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64`
+  --> $DIR/issue-54302-cases.rs:91:5
+   |
+LL |     <i64 as RefFoo<i64>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime
+   |
+   = note: required because of the requirements on the impl of `for<'a> Foo2<'_, i64>` for `&'a i64`
+   = note: required because of the requirements on the impl of `for<'a> Foo<'static, i64>` for `&'a i64`
+   = note: required because of the requirements on the impl of `RefFoo<i64>` for `i64`
+note: required by `RefFoo::ref_foo`
+  --> $DIR/issue-54302-cases.rs:61:5
+   |
+LL |     fn ref_foo(&self) -> &'static T;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0271, E0277, E0279.
+For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/issues/issue-54302.rs b/src/test/ui/issues/issue-54302.rs
new file mode 100644 (file)
index 0000000..969d19c
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Deserialize<'de> {}
+
+trait DeserializeOwned: for<'de> Deserialize<'de> {}
+impl<T> DeserializeOwned for T where T: for<'de> Deserialize<'de> {}
+
+// Based on this impl, `&'static str` only implements Deserialize<'static>.
+// It does not implement for<'de> Deserialize<'de>.
+impl<'de: 'a, 'a> Deserialize<'de> for &'a str {}
+
+fn main() {
+    // Then why does it implement DeserializeOwned? This compiles.
+    fn assert_deserialize_owned<T: DeserializeOwned>() {}
+    assert_deserialize_owned::<&'static str>();
+    //~^ ERROR the requirement `for<'de> 'de : ` is not satisfied
+
+    // It correctly does not implement for<'de> Deserialize<'de>.
+    //fn assert_hrtb<T: for<'de> Deserialize<'de>>() {}
+    //assert_hrtb::<&'static str>();
+}
diff --git a/src/test/ui/issues/issue-54302.stderr b/src/test/ui/issues/issue-54302.stderr
new file mode 100644 (file)
index 0000000..f122dae
--- /dev/null
@@ -0,0 +1,17 @@
+error[E0279]: the requirement `for<'de> 'de : ` is not satisfied (`expected bound lifetime parameter 'de, found concrete lifetime`)
+  --> $DIR/issue-54302.rs:23:5
+   |
+LL |     assert_deserialize_owned::<&'static str>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: required because of the requirements on the impl of `for<'de> Deserialize<'de>` for `&'static str`
+   = note: required because of the requirements on the impl of `DeserializeOwned` for `&'static str`
+note: required by `main::assert_deserialize_owned`
+  --> $DIR/issue-54302.rs:22:5
+   |
+LL |     fn assert_deserialize_owned<T: DeserializeOwned>() {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0279`.
index 02e5b9b092197f94b08fe0a7452081a22002fe78..329bfd1dde0f963676680b57d7c94c8eae953f2a 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//aux-build:issue_5844_aux.rs
+//aux-build:issue-5844-aux.rs
 
 extern crate issue_5844_aux;
 
diff --git a/src/test/ui/issues/issue32829.rs b/src/test/ui/issues/issue32829.rs
deleted file mode 100644 (file)
index 2b223ba..0000000
+++ /dev/null
@@ -1,94 +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.
-
-// ignore-tidy-linelength
-
-#![feature(const_fn)]
-
-const bad : u32 = {
-    {
-        5;
-        //~^ ERROR statements in constants are unstable
-        0
-    }
-};
-
-const bad_two : u32 = {
-    {
-        invalid();
-        //~^ ERROR statements in constants are unstable
-        //~^^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants
-        0
-    }
-};
-
-const bad_three : u32 = {
-    {
-        valid();
-        //~^ ERROR statements in constants are unstable
-        0
-    }
-};
-
-static bad_four : u32 = {
-    {
-        5;
-        //~^ ERROR statements in statics are unstable
-        0
-    }
-};
-
-static bad_five : u32 = {
-    {
-        invalid();
-        //~^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants
-        //~| ERROR statements in statics are unstable
-        0
-    }
-};
-
-static bad_six : u32 = {
-    {
-        valid();
-        //~^ ERROR statements in statics are unstable
-        0
-    }
-};
-
-static mut bad_seven : u32 = {
-    {
-        5;
-        //~^ ERROR statements in statics are unstable
-        0
-    }
-};
-
-static mut bad_eight : u32 = {
-    {
-        invalid();
-        //~^ ERROR statements in statics are unstable
-        //~| ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants
-        0
-    }
-};
-
-static mut bad_nine : u32 = {
-    {
-        valid();
-        //~^ ERROR statements in statics are unstable
-        0
-    }
-};
-
-
-fn invalid() {}
-const fn valid() {}
-
-fn main() {}
diff --git a/src/test/ui/issues/issue32829.stderr b/src/test/ui/issues/issue32829.stderr
deleted file mode 100644 (file)
index dad0880..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-error[E0658]: statements in constants are unstable (see issue #48821)
-  --> $DIR/issue32829.rs:17:9
-   |
-LL |         5;
-   |         ^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/issue32829.rs:25:9
-   |
-LL |         invalid();
-   |         ^^^^^^^^^
-
-error[E0658]: statements in constants are unstable (see issue #48821)
-  --> $DIR/issue32829.rs:25:9
-   |
-LL |         invalid();
-   |         ^^^^^^^^^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0658]: statements in constants are unstable (see issue #48821)
-  --> $DIR/issue32829.rs:34:9
-   |
-LL |         valid();
-   |         ^^^^^^^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0658]: statements in statics are unstable (see issue #48821)
-  --> $DIR/issue32829.rs:42:9
-   |
-LL |         5;
-   |         ^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/issue32829.rs:50:9
-   |
-LL |         invalid();
-   |         ^^^^^^^^^
-
-error[E0658]: statements in statics are unstable (see issue #48821)
-  --> $DIR/issue32829.rs:50:9
-   |
-LL |         invalid();
-   |         ^^^^^^^^^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0658]: statements in statics are unstable (see issue #48821)
-  --> $DIR/issue32829.rs:59:9
-   |
-LL |         valid();
-   |         ^^^^^^^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0658]: statements in statics are unstable (see issue #48821)
-  --> $DIR/issue32829.rs:67:9
-   |
-LL |         5;
-   |         ^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/issue32829.rs:75:9
-   |
-LL |         invalid();
-   |         ^^^^^^^^^
-
-error[E0658]: statements in statics are unstable (see issue #48821)
-  --> $DIR/issue32829.rs:75:9
-   |
-LL |         invalid();
-   |         ^^^^^^^^^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0658]: statements in statics are unstable (see issue #48821)
-  --> $DIR/issue32829.rs:84:9
-   |
-LL |         valid();
-   |         ^^^^^^^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error: aborting due to 12 previous errors
-
-Some errors occurred: E0015, E0658.
-For more information about an error, try `rustc --explain E0015`.
diff --git a/src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.rs b/src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.rs
new file mode 100644 (file)
index 0000000..4a71932
--- /dev/null
@@ -0,0 +1,15 @@
+trait Foo {
+    type T;
+    fn foo(&self, t: Self::T);
+//~^ NOTE expected 0 type parameters
+}
+
+impl Foo for u32 {
+    type T = ();
+
+    fn foo(&self, t: impl Clone) {}
+//~^ ERROR method `foo` has 1 type parameter but its trait declaration has 0 type parameters
+//~| NOTE found 1 type parameter
+}
+
+fn main() {}
diff --git a/src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.stderr b/src/test/ui/issues/type-arg-mismatch-due-to-impl-trait.stderr
new file mode 100644 (file)
index 0000000..af7fdde
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters
+  --> $DIR/type-arg-mismatch-due-to-impl-trait.rs:10:5
+   |
+LL |     fn foo(&self, t: Self::T);
+   |     -------------------------- expected 0 type parameters
+...
+LL |     fn foo(&self, t: impl Clone) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found 1 type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0049`.
index 7e9a4f82478bd707569997a432f814e1902e85df..cd0ba5e4a0a5946f41b573fbc2efd59215c60360 100644 (file)
@@ -15,7 +15,7 @@
 
 #![allow(dead_code)]
 #![allow(unused_variables)]
-#![feature(rustc_attrs)]
+
 
 extern crate lifetime_bound_will_change_warning_lib as lib;
 
@@ -59,6 +59,6 @@ fn test3cc<'a>(x: &'a Box<Fn()+'static>) {
     lib::ref_obj(x)
 }
 
-#[rustc_error]
+
 fn main() {
 }
index e87ddde7413d2a45fb81c0c1868eace7ea320a47..d29019309abadd9c9822dc0aaebd95553f716202 100644 (file)
 // aux-build:lint_output_format.rs
 
 #![feature(unstable_test_feature)]
-#![feature(rustc_attrs)]
+// compile-pass
 
 extern crate lint_output_format;
 use lint_output_format::{foo, bar};
 //~^ WARNING use of deprecated item 'lint_output_format::foo': text
 
-#[rustc_error]
-fn main() { //~ ERROR: compilation successful
+
+fn main() {
     let _x = foo();
     //~^ WARNING use of deprecated item 'lint_output_format::foo': text
     let _y = bar();
index 8c6247688e80cc5ff1b1bcdf4cc78810d8e956d1..a5718fd74b379a3c2f0f2fa37dabee0b6f1bd649 100644 (file)
@@ -12,15 +12,3 @@ warning: use of deprecated item 'lint_output_format::foo': text
 LL |     let _x = foo();
    |              ^^^
 
-error: compilation successful
-  --> $DIR/lint-output-format-2.rs:21:1
-   |
-LL | / fn main() { //~ ERROR: compilation successful
-LL | |     let _x = foo();
-LL | |     //~^ WARNING use of deprecated item 'lint_output_format::foo': text
-LL | |     let _y = bar();
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index de2c27bdcbcca690fc1c03337780db68b29566ce..459eaa14737ac4990a6c023ba3e6f649a0700f58 100644 (file)
@@ -8,15 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// compile-pass
 // aux-build:lint_stability.rs
 // aux-build:inherited_stability.rs
 // aux-build:stability_cfg1.rs
 // aux-build:stability_cfg2.rs
 // ignore-tidy-linelength
-
 #![warn(deprecated)]
 #![allow(dead_code, unused_extern_crates)]
-#![feature(staged_api, unstable_test_feature, rustc_attrs)]
+#![feature(staged_api, unstable_test_feature)]
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
@@ -470,4 +470,4 @@ impl DeprecatedTrait for S { } //~ WARN use of deprecated item 'this_crate::Depr
     trait LocalTrait : DeprecatedTrait { } //~ WARN use of deprecated item 'this_crate::DeprecatedTrait'
 }
 
-#[rustc_error] fn main() {} //~ ERROR: compilation successful
+fn main() {}
index afebb4f36a4ad6c79a433c1ca21c65ae6811827b..a763a994a884b0ea3db2345555a028a56d3d553c 100644 (file)
@@ -634,11 +634,3 @@ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
 LL |         foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
    |             ^^^^^^^^^^^^^^^^^^^^^
 
-error: compilation successful
-  --> $DIR/lint-stability-deprecated.rs:473:16
-   |
-LL | #[rustc_error] fn main() {} //~ ERROR: compilation successful
-   |                ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index f7cf8a68d568446119a63c5b9d74cd05794589d7..82ec3be15969a3b3be39a520b1839b5db5152450 100644 (file)
@@ -7,15 +7,15 @@
 // <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: -O
 #![warn(overflowing_literals)]
 #![warn(const_err)]
-#![feature(rustc_attrs)]
+// compile-pass
 
 #[allow(unused_variables)]
-#[rustc_error]
-fn main() { //~ ERROR: compilation successful
+
+fn main() {
     let x2: i8 = --128; //~ warn: literal out of range for i8
 
     let x = -3.40282357e+38_f32; //~ warn: literal out of range for f32
index ecfd2584bba4274683890a03ee8dff5aaa40d48e..1fb63ac75957983ba70760c4bcdf45ec51198d83 100644 (file)
@@ -34,17 +34,15 @@ warning: literal out of range for f64
 LL |     let x =  1.7976931348623159e+308_f64; //~ warn: literal out of range for f64
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: compilation successful
-  --> $DIR/lint-type-overflow2.rs:18:1
-   |
-LL | / fn main() { //~ ERROR: compilation successful
-LL | |     let x2: i8 = --128; //~ warn: literal out of range for i8
-LL | |
-LL | |     let x = -3.40282357e+38_f32; //~ warn: literal out of range for f32
-...  |
-LL | |     let x =  1.7976931348623159e+308_f64; //~ warn: literal out of range for f64
-LL | | }
-   | |_^
-
-error: aborting due to previous error
+warning: this expression will panic at runtime
+  --> $DIR/lint-type-overflow2.rs:19:18
+   |
+LL |     let x2: i8 = --128; //~ warn: literal out of range for i8
+   |                  ^^^^^ attempt to negate with overflow
+   |
+note: lint level defined here
+  --> $DIR/lint-type-overflow2.rs:13:9
+   |
+LL | #![warn(const_err)]
+   |         ^^^^^^^^^
 
index 5a0568f05e6e154fd28fabed515b688736a41ac4..cfab640ad4e899dbf83dbea3b15a6e88949ec223 100644 (file)
@@ -14,7 +14,7 @@
 // FIXME(#44232) we should warn that this isn't used.
 #![feature(rust1)]
 
-#![feature(rustc_attrs)]
+// compile-pass
 
-#[rustc_error]
-fn main() { } //~ ERROR: compilation successful
+
+fn main() { }
diff --git a/src/test/ui/lint/lint-unknown-feature-default.stderr b/src/test/ui/lint/lint-unknown-feature-default.stderr
deleted file mode 100644 (file)
index bd4079f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/lint-unknown-feature-default.rs:20:1
-   |
-LL | fn main() { } //~ ERROR: compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 81f99f9949284b0823069c292d1b819da44a926a..7c5878e1729b958a9b928ebee64f0ddedb30b3bd 100644 (file)
@@ -14,7 +14,7 @@
 // FIXME(#44232) we should warn that this isn't used.
 #![feature(rust1)]
 
-#![feature(rustc_attrs)]
+// compile-pass
 
-#[rustc_error]
-fn main() {} //~ ERROR: compilation successful
+
+fn main() {}
diff --git a/src/test/ui/lint/lint-unknown-feature.stderr b/src/test/ui/lint/lint-unknown-feature.stderr
deleted file mode 100644 (file)
index e2744c0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/lint-unknown-feature.rs:20:1
-   |
-LL | fn main() {} //~ ERROR: compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index b273e7a0c7c9e750e02fc085d2ef8c31603b70d9..42b4a72a46c1133f775171c5057430097270df2e 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
 // ignore-tidy-linelength
 
@@ -39,7 +39,7 @@ pub fn foo() {
                                          //~^ WARN label name `'lt` shadows a label name that is already in scope
 }
 
-#[rustc_error]
-pub fn main() { //~ ERROR compilation successful
+
+pub fn main() {
     foo();
 }
index 41b4a850f1bfb28c5c426665c45ad2b494e88b52..442f1918bd15430a446021e1823711dcdbdbdf57 100644 (file)
@@ -62,13 +62,3 @@ LL |     { 'lt: loop { break; } }
 LL |     { 'lt: while let Some(_) = None::<i32> { break; } }
    |       ^^^ lifetime 'lt already in scope
 
-error: compilation successful
-  --> $DIR/loops-reject-duplicate-labels-2.rs:43:1
-   |
-LL | / pub fn main() { //~ ERROR compilation successful
-LL | |     foo();
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index ad24f69871c85cdf3bd4e1076d4e4a4dac401695..63cb947b49b522672d25bc2dba8dcc56df7ec656 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
 // ignore-tidy-linelength
 
@@ -46,8 +46,8 @@ impl S {
     fn m2(&self) { 'okay: loop { break 'okay; } }
 }
 
-#[rustc_error]
-pub fn main() { //~ ERROR compilation successful
+
+pub fn main() {
     let s = S;
     s.m1();
     s.m2();
index d0cb81544f8280840c91e866b01c3bc00f7af807..7d556f4f227d44597ae1a098a3df120f25186051 100644 (file)
@@ -62,16 +62,3 @@ LL |     'lt: loop { break; }
 LL |     'lt: while let Some(_) = None::<i32> { break; }
    |     ^^^ lifetime 'lt already in scope
 
-error: compilation successful
-  --> $DIR/loops-reject-duplicate-labels.rs:50:1
-   |
-LL | / pub fn main() { //~ ERROR compilation successful
-LL | |     let s = S;
-LL | |     s.m1();
-LL | |     s.m2();
-LL | |     foo();
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 74da125d575a0e7ef23989d04ee2edb239bccaa1..56f8288fa2f2d0574eb5666550373017a6b8dbaa 100644 (file)
@@ -11,7 +11,7 @@
 // Issue #21633: reject duplicate loop labels in function bodies.
 // This is testing interaction between lifetime-params and labels.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
 #![allow(dead_code, unused_variables)]
 
@@ -113,7 +113,7 @@ fn meth_bad<'bad>(&self) {
     }
 }
 
-#[rustc_error]
-pub fn main() { //~ ERROR compilation successful
+
+pub fn main() {
     foo();
 }
index af524d5b01766e283937f36b9227509420acf6a1..d7d3cdb78e14abbab2f1c71907e67ed8fdd48435 100644 (file)
@@ -100,13 +100,3 @@ LL |         fn meth_bad<'bad>(&self) {
 LL |             'bad: loop { break 'bad; }
    |             ^^^^ lifetime 'bad already in scope
 
-error: compilation successful
-  --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:117:1
-   |
-LL | / pub fn main() { //~ ERROR compilation successful
-LL | |     foo();
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 077e57c9579e36de8ea02792453f08994ec721ec..09b2c24e2a6a3e98324a789e00f4450be6bfdd48 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
 #![allow(dead_code, unused_variables)]
 
@@ -35,7 +35,7 @@ struct S1<'a> { x: &'a i8 } impl<'a> S1<'a> { fn m(&self) {} }
     }
 }
 
-#[rustc_error]
-pub fn main() { //~ ERROR compilation successful
+
+pub fn main() {
     foo();
 }
index 999cfb9cc3c6b62b83825531f4e9bb7d96930030..ac5c59c044aae09bac150af4be13bc5e827f6c37 100644 (file)
@@ -6,13 +6,3 @@ LL |     'a: loop {
 LL |         let b = Box::new(|x: &i8| *x) as Box<for <'a> Fn(&'a i8) -> i8>;
    |                                                   ^^ lifetime 'a already in scope
 
-error: compilation successful
-  --> $DIR/loops-reject-lifetime-shadowing-label.rs:39:1
-   |
-LL | / pub fn main() { //~ ERROR compilation successful
-LL | |     foo();
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 4afb61ab76cf7357a2be4e1d0010a54beedfc343..fa3737d6911ab5ea5d050eb96ade0c082ca0fde2 100644 (file)
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 // ignore-emscripten no asm! support
-
-#![feature(asm, rustc_attrs)]
+// compile-pass
+#![feature(asm)]
 #![allow(unused)]
 
 #[macro_use]
@@ -19,5 +19,5 @@
 m!();
 fn f() { n!(); }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/macros/macro-expanded-include/test.stderr b/src/test/ui/macros/macro-expanded-include/test.stderr
deleted file mode 100644 (file)
index 3ef0275..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/test.rs:23:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 8f46d3301eb370a411d94ec078340841a89e3eb1..a1d77515f29d8b78b7e152ba9a05f8f2b092ed75 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     macro_rules! m { ($s:stmt;) => { $s } }
     m!(vec![].push(0););
 }
diff --git a/src/test/ui/macros/macro-stmt-matchers.stderr b/src/test/ui/macros/macro-stmt-matchers.stderr
deleted file mode 100644 (file)
index ef6210b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: compilation successful
-  --> $DIR/macro-stmt-matchers.rs:14:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     macro_rules! m { ($s:stmt;) => { $s } }
-LL | |     m!(vec![].push(0););
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 7255e7d00b6115c1a60caa9f279a969fb3c9cfe1..90ac95d54d7d58e0fd9ecd3d208bd8a7e2312c02 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 
 macro_rules! foo {
@@ -17,5 +17,5 @@ macro_rules! foo {
 
 foo!(Box);
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/macros/macro-tt-matchers.stderr b/src/test/ui/macros/macro-tt-matchers.stderr
deleted file mode 100644 (file)
index b7551c1..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/macro-tt-matchers.rs:21:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 9d389413ba9adb0319e964d7cd3fae7bfd883aa6..b594085333beacbbf4fe0d39f23ef58a5a176c57 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:two_macros.rs
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(unused)]
 
 fn f() {
@@ -28,5 +28,5 @@ macro_rules! m { () => {
 } }
 m!();
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/macros/macro-use-scope.stderr b/src/test/ui/macros/macro-use-scope.stderr
deleted file mode 100644 (file)
index 2e81750..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/macro-use-scope.rs:32:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/match/match-fn-call.rs b/src/test/ui/match/match-fn-call.rs
new file mode 100644 (file)
index 0000000..d9c50e7
--- /dev/null
@@ -0,0 +1,12 @@
+use std::path::Path;
+
+fn main() {
+    let path = Path::new("foo");
+    match path {
+        Path::new("foo") => println!("foo"),
+        //~^ ERROR expected tuple struct/variant
+        Path::new("bar") => println!("bar"),
+        //~^ ERROR expected tuple struct/variant
+        _ => (),
+    }
+}
diff --git a/src/test/ui/match/match-fn-call.stderr b/src/test/ui/match/match-fn-call.stderr
new file mode 100644 (file)
index 0000000..4e24621
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0164]: expected tuple struct/variant, found method `<Path>::new`
+  --> $DIR/match-fn-call.rs:6:9
+   |
+LL |         Path::new("foo") => println!("foo"),
+   |         ^^^^^^^^^^^^^^^^ not a tuple variant or struct
+
+error[E0164]: expected tuple struct/variant, found method `<Path>::new`
+  --> $DIR/match-fn-call.rs:8:9
+   |
+LL |         Path::new("bar") => println!("bar"),
+   |         ^^^^^^^^^^^^^^^^ not a tuple variant or struct
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0164`.
index f10526200ff141c675cda3b11162dff196f11ba7..8ba6863167b87230328fbf472f14ea436391093d 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
 struct S<T>(*const T) where T: ?Sized;
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let u = vec![1, 2, 3];
     let _s: S<[u8]> = S(&u[..]);
 }
diff --git a/src/test/ui/maybe-bounds-where-cpass.stderr b/src/test/ui/maybe-bounds-where-cpass.stderr
deleted file mode 100644 (file)
index d60e4cd..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: compilation successful
-  --> $DIR/maybe-bounds-where-cpass.rs:16:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let u = vec![1, 2, 3];
-LL | |     let _s: S<[u8]> = S(&u[..]);
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index a9505e4f936a1b5bfe89ab821225fdc4002ced45..43a18fba9b89faa72582f9bfd167b6f0be1b143d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(unused)]
 
 struct S;
@@ -21,5 +21,5 @@ fn test() {
     S.early_and_type::<u16>();
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/methods/method-call-lifetime-args-subst-index.stderr b/src/test/ui/methods/method-call-lifetime-args-subst-index.stderr
deleted file mode 100644 (file)
index 2848ff8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/method-call-lifetime-args-subst-index.rs:25:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index bbc958b87a571724e93134e4d1599e3c116a0817..219f68877be52b68a65885f5449b413aa519198e 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(unused)]
 
 macro_rules! m {
@@ -18,5 +18,5 @@ macro_rules! m {
     }
 }
 
-#[rustc_error]
-fn main() { m!(0, 0; 0, 0); } //~ ERROR compilation successful
+
+fn main() { m!(0, 0; 0, 0); }
index b4427565a8649162336462c800f6f2994bfff2bb..c294e3eaf9c832f72f794a6bf434335e2bcd4244 100644 (file)
@@ -4,7 +4,7 @@ warning: expected `;`, found keyword `let`
 LL |         $( let x = $e1 )*; //~ WARN expected `;`
    |            ^^^
 ...
-LL | fn main() { m!(0, 0; 0, 0); } //~ ERROR compilation successful
+LL | fn main() { m!(0, 0; 0, 0); }
    |             --------------- in this macro invocation
    |
    = note: This was erroneously allowed and will become a hard error in a future release
@@ -15,16 +15,8 @@ warning: expected `;`, found `println`
 LL |         $( println!("{}", $e2) )*; //~ WARN expected `;`
    |            ^^^^^^^
 ...
-LL | fn main() { m!(0, 0; 0, 0); } //~ ERROR compilation successful
+LL | fn main() { m!(0, 0; 0, 0); }
    |             --------------- in this macro invocation
    |
    = note: This was erroneously allowed and will become a hard error in a future release
 
-error: compilation successful
-  --> $DIR/missing-semicolon-warning.rs:22:1
-   |
-LL | fn main() { m!(0, 0; 0, 0); } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 0fb75b535c6bcd5df32de572ee474ba824089747..0762e872072277966647104f1483f9f78cd93462 100644 (file)
 // Test that an assignment of type ! makes the rest of the block dead code.
 
 #![feature(never_type)]
-#![feature(rustc_attrs)]
+// compile-pass
 #![warn(unused)]
 
-#[rustc_error]
-fn main() { //~ ERROR: compilation successful
+
+fn main() {
     let x: ! = panic!("aah"); //~ WARN unused
     drop(x); //~ WARN unreachable
     //~^ WARN unreachable
index 7c7126c93c6731b9e61ac5ebdb65eda3cb50d262..a4fd7b1b29681921eeea6f270e76bf89f5aafdf1 100644 (file)
@@ -30,15 +30,3 @@ LL | #![warn(unused)]
    |         ^^^^^^
    = note: #[warn(unused_variables)] implied by #[warn(unused)]
 
-error: compilation successful
-  --> $DIR/never-assign-dead-code.rs:18:1
-   |
-LL | / fn main() { //~ ERROR: compilation successful
-LL | |     let x: ! = panic!("aah"); //~ WARN unused
-LL | |     drop(x); //~ WARN unreachable
-LL | |     //~^ WARN unreachable
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 2940b891534d39f29d6f3967b92a264f08e8ec05..891512c9653be861b8f2bb3facf8857429a1e9b7 100644 (file)
 // even though the compiler should enforce an invariant that any drop
 // flag for such subcontent of `Foo` will always have the same value
 // as the drop flag for `Foo` itself.
-//
-// This test is structured in a funny way; we cannot test for emission
-// of the warning in question via the lint system, and therefore
-// `#![deny(warnings)]` does nothing to detect it.
-//
-// So instead we use `#[rustc_error]` and put the test into
-// `compile_fail`, where the emitted warning *will* be caught.
 
-#![feature(rustc_attrs)]
+
+
+
+
+
+
+
+// compile-pass
 
 struct Foo(String);
 
@@ -49,8 +49,8 @@ fn outline() {
     f.0 = String::from("bar");
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     inline();
     outline();
 }
diff --git a/src/test/ui/no-warn-on-field-replace-issue-34101.stderr b/src/test/ui/no-warn-on-field-replace-issue-34101.stderr
deleted file mode 100644 (file)
index 91a9026..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: compilation successful
-  --> $DIR/no-warn-on-field-replace-issue-34101.rs:53:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     inline();
-LL | |     outline();
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 5a8772d61425fcb9176c7c69abe6368a900c34c1..6ec2ecba8cf32ba4e0a211aee4499ea8deaae3c5 100644 (file)
@@ -10,7 +10,7 @@
 
 // Check that a trait with by-value self is considered object-safe.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 #![allow(trivial_casts)]
 
@@ -51,6 +51,6 @@ fn make_quux_explicit<T:Quux>(t: &T) -> &Quux {
     t as &Quux
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
 }
diff --git a/src/test/ui/object-safety/object-safety-by-value-self.stderr b/src/test/ui/object-safety/object-safety-by-value-self.stderr
deleted file mode 100644 (file)
index 6125964..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error: compilation successful
-  --> $DIR/object-safety-by-value-self.rs:55:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 518c45ac9dff6d65a2f79f7464d45538557965bd..34b66b15e572b2789c4e8bfab2858753bea43969 100644 (file)
@@ -10,7 +10,7 @@
 
 // Check that `Self` appearing in a phantom fn does not make a trait not object safe.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 
 trait Baz {
@@ -27,6 +27,6 @@ fn make_baz<T:Baz>(t: &T) -> &Baz {
     t
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
 }
diff --git a/src/test/ui/object-safety/object-safety-phantom-fn.stderr b/src/test/ui/object-safety/object-safety-phantom-fn.stderr
deleted file mode 100644 (file)
index 645867f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error: compilation successful
-  --> $DIR/object-safety-phantom-fn.rs:31:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 539f5d63c0b3bcc5a7a9d8dd3b78a8fe9bcc179f..4467ac4356b6eb5fe77c11d464a8649e171e4df0 100644 (file)
@@ -11,7 +11,7 @@
 // Test if the on_unimplemented message override works
 
 #![feature(on_unimplemented)]
-#![feature(rustc_attrs)]
+
 
 struct Foo<T>(T);
 struct Bar<T>(T);
@@ -38,7 +38,7 @@ fn index(&self, _index: Bar<usize>) -> &i32 {
     }
 }
 
-#[rustc_error]
+
 fn main() {
     Index::index(&[] as &[i32], 2u32);
     //~^ ERROR E0277
index da56ae649934434e1dec568a3deaaf290ddcdb79..d104d1ed033eaa1b05c74a9cb55b3be89c7cff72 100644 (file)
@@ -11,7 +11,7 @@
 // Test if the on_unimplemented message override works
 
 #![feature(on_unimplemented)]
-#![feature(rustc_attrs)]
+
 
 #[rustc_on_unimplemented = "invalid"]
 trait Index<Idx: ?Sized> {
@@ -27,7 +27,7 @@ fn index(&self, index: usize) -> &i32 {
     }
 }
 
-#[rustc_error]
+
 fn main() {
     Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
     //~^ ERROR E0277
index 7d67e89a78e36ab97b3afb7a6a8b2b1e7fe0a79e..79bb277d2c1e6fbbfcd67d74d5e298f1cea946c3 100644 (file)
 // Test new Index error message for slices
 // ignore-tidy-linelength
 
-#![feature(rustc_attrs)]
+
 
 use std::ops::Index;
 
-#[rustc_error]
+
 fn main() {
     let x = &[1, 2, 3] as &[i32];
     x[1i32]; //~ ERROR E0277
diff --git a/src/test/ui/panic-implementation/panic-implementation-deprecated.rs b/src/test/ui/panic-implementation/panic-implementation-deprecated.rs
deleted file mode 100644 (file)
index c4bec01..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags:-C panic=abort
-
-#![deny(deprecated)]
-#![feature(panic_implementation)]
-#![no_std]
-
-use core::panic::PanicInfo;
-
-#[panic_implementation]
-fn panic(info: &PanicInfo) -> ! {
-    loop {}
-}
-
-fn main() {}
diff --git a/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr b/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr
deleted file mode 100644 (file)
index fabfba9..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-error: use of deprecated attribute `panic_implementation`: this attribute was renamed to `panic_handler`. See https://github.com/rust-lang/rust/issues/44489#issuecomment-415140224
-  --> $DIR/panic-implementation-deprecated.rs:19:1
-   |
-LL | #[panic_implementation]
-   | ^^^^^^^^^^^^^^^^^^^^^^^ help: replace this attribute with `#[panic_handler]`
-   |
-note: lint level defined here
-  --> $DIR/panic-implementation-deprecated.rs:13:9
-   |
-LL | #![deny(deprecated)]
-   |         ^^^^^^^^^^
-
-error: aborting due to previous error
-
index 96b025128ee9ac1be8086c3a50f1245a1881a6ab..31123410481c33d2f65809c92b57dc42c146dca2 100644 (file)
@@ -11,7 +11,8 @@
 #![crate_name="foo"]
 #![allow(dead_code)]
 
-// compile-flags: -Z print-fuel=foo
+// (#55495: The --error-format is to sidestep an issue in our test harness)
+// compile-flags: --error-format human -Z print-fuel=foo
 // compile-pass
 
 struct S1(u8, u16, u8);
diff --git a/src/test/ui/print-fuel/print-fuel.stderr b/src/test/ui/print-fuel/print-fuel.stderr
new file mode 100644 (file)
index 0000000..cc88cc0
--- /dev/null
@@ -0,0 +1 @@
+Fuel used by foo: 3
diff --git a/src/test/ui/print-fuel/print-fuel.stdout b/src/test/ui/print-fuel/print-fuel.stdout
deleted file mode 100644 (file)
index cc88cc0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Fuel used by foo: 3
index abd71b9c90b22ac357267a33f6995cc8acd58e2c..1eda959e3f634104433c11def48aa1fac6fd6a7d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(warnings)]
 
 mod foo {
@@ -36,8 +36,8 @@ fn deref(&self) -> &S2 { unimplemented!() }
     }
 }
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let s = foo::S::default();
     let _: bool = s.x;
     let _: bool = s.f();
diff --git a/src/test/ui/privacy/restricted/lookup-ignores-private.stderr b/src/test/ui/privacy/restricted/lookup-ignores-private.stderr
deleted file mode 100644 (file)
index 7fc53e8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error: compilation successful
-  --> $DIR/lookup-ignores-private.rs:40:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let s = foo::S::default();
-LL | |     let _: bool = s.x;
-LL | |     let _: bool = s.f();
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 630969bdbdf72caa4d1f14233564f0ac0892cdd3..24a1bcb37cf06208c2e08352f83173aacb93e432 100644 (file)
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
 use std::ops::*;
 
 #[derive(Copy, Clone)]
 struct R(RangeTo<usize>);
 
-#[rustc_error]
-fn main() {} //~ ERROR success
+
+fn main() {}
 
diff --git a/src/test/ui/range/range_traits-4.stderr b/src/test/ui/range/range_traits-4.stderr
deleted file mode 100644 (file)
index cf8ae67..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/range_traits-4.rs:19:1
-   |
-LL | fn main() {} //~ ERROR success
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 5963c4a9496cb7875ee761bc8d59c03a4d549693..033f06f9cd16ae343dd190540465a142a7b52a17 100644 (file)
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
 use std::ops::*;
 
 #[derive(Copy, Clone)]
 struct R(RangeFull);
 
-#[rustc_error]
-fn main() {} //~ ERROR success
+
+fn main() {}
 
diff --git a/src/test/ui/range/range_traits-5.stderr b/src/test/ui/range/range_traits-5.stderr
deleted file mode 100644 (file)
index eadb3a0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/range_traits-5.rs:19:1
-   |
-LL | fn main() {} //~ ERROR success
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 871b55b85cf88a0194f8d208141c3459f94b4ec6..23fb0a1fc5e1b43ad83bf1a12130d413c7899972 100644 (file)
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
 use std::ops::*;
 
 #[derive(Copy, Clone)]
 struct R(RangeToInclusive<usize>);
 
-#[rustc_error]
-fn main() {} //~ ERROR success
+
+fn main() {}
 
diff --git a/src/test/ui/range/range_traits-7.stderr b/src/test/ui/range/range_traits-7.stderr
deleted file mode 100644 (file)
index 516667a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/range_traits-7.rs:19:1
-   |
-LL | fn main() {} //~ ERROR success
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index c1df057b396095784fcabb52c6c7d5d92880bfae..00ca2c7da67191900b3b2192aa9d982f4455ea74 100644 (file)
@@ -11,7 +11,7 @@
 // Test related to #22779. In this case, the impl is an inherent impl,
 // so it doesn't have to match any trait, so no error results.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 
 struct MySlice<'a, T:'a>(&'a mut [T]);
@@ -22,5 +22,5 @@ fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
     }
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.stderr b/src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.stderr
deleted file mode 100644 (file)
index 585ccf4..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/region-bound-extra-bound-in-inherent-impl.rs:26:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 3115e5a9a437645d0c53ac8fa4e8b4363e27c24c..ff1b74fa020c74fa34de01214fff763d27a57753 100644 (file)
@@ -11,7 +11,7 @@
 // Test related to #22779, but where the `'a:'b` relation
 // appears in the trait too. No error here.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
 trait Tr<'a, T> {
     fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b;
@@ -23,5 +23,5 @@ fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
     }
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.stderr b/src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.stderr
deleted file mode 100644 (file)
index ce9dd59..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/region-bound-same-bounds-in-trait-and-impl.rs:27:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 1e615be9d6acc57a452f69059a0cda171c0697dc..36c87b729d8424f3d06bd986a78a5a6f05e03c8c 100644 (file)
@@ -11,7 +11,7 @@
 // Various tests related to testing how region inference works
 // with respect to the object receivers.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(warnings)]
 
 trait Foo {
@@ -24,5 +24,5 @@ fn borrowed_receiver_same_lifetime<'a>(x: &'a Foo) -> &'a () {
     x.borrowed()
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/regions/region-object-lifetime-1.stderr b/src/test/ui/regions/region-object-lifetime-1.stderr
deleted file mode 100644 (file)
index 39deed3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/region-object-lifetime-1.rs:28:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 84dd97643a107ab88370cd4eaf1dee394d3873ca..d7bfb735e00fd0cf393ce5ac0b2321db5033d802 100644 (file)
@@ -11,7 +11,7 @@
 // Various tests related to testing how region inference works
 // with respect to the object receivers.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(warnings)]
 
 trait Foo {
@@ -24,5 +24,5 @@ fn borrowed_receiver_related_lifetimes<'a,'b>(x: &'a (Foo+'b)) -> &'a () {
     x.borrowed()
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/regions/region-object-lifetime-3.stderr b/src/test/ui/regions/region-object-lifetime-3.stderr
deleted file mode 100644 (file)
index 9431e8f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/region-object-lifetime-3.rs:28:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index b3037a1e187f4ca9f33062b662cbff7444bbc953..09e1634381fed18e4a5d6725e73784c8da879650 100644 (file)
@@ -12,7 +12,7 @@
 // "projection gap": in this test, we know that `T: 'x`, and that is
 // enough to conclude that `T::Foo: 'x`.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 #![allow(unused_variables)]
 
@@ -29,5 +29,5 @@ fn func<'x, T:Trait1<'x>>(t: &'x T)
     wf::<&'x T::Foo>();
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-2.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-2.stderr
deleted file mode 100644 (file)
index 7a38797..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/regions-implied-bounds-projection-gap-2.rs:33:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index a2e6de2137696f98e0009cdc5cf7d07580c6b06d..be1987fe87c2d9fd77b63432d7a2db9e4c3b0081 100644 (file)
@@ -12,7 +12,7 @@
 // "projection gap": in this test, we know that `T::Foo: 'x`, and that
 // is (naturally) enough to conclude that `T::Foo: 'x`.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 #![allow(unused_variables)]
 
@@ -29,5 +29,5 @@ fn func<'x, T:Trait1<'x>>(t: &'x T::Foo)
     wf::<&'x T::Foo>();
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-3.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-3.stderr
deleted file mode 100644 (file)
index 1a12697..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/regions-implied-bounds-projection-gap-3.rs:33:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index b8582f8c26b3147b3e991a9cf1a970e19b043b7a..d0560d4cd90846765354955de75149c4d7f22c2c 100644 (file)
@@ -12,7 +12,7 @@
 // "projection gap": in this test, we know that `T: 'x`, and that
 // is (naturally) enough to conclude that `T: 'x`.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 #![allow(unused_variables)]
 
@@ -29,5 +29,5 @@ fn func<'x, T:Trait1<'x>>(t: &'x T)
     wf::<&'x T>();
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-4.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-4.stderr
deleted file mode 100644 (file)
index 85b1702..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/regions-implied-bounds-projection-gap-4.rs:33:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index ec0631a881a37bdaee81aaae3e1bcfd227f1d1f8..270e20f2e6dce4954bba4fc77bb283e9e512e8f6 100644 (file)
@@ -12,7 +12,7 @@
 // "outlives" requirements. Issue #22246.
 
 #![allow(dead_code)]
-#![feature(rustc_attrs)]
+
 
 ///////////////////////////////////////////////////////////////////////////
 
@@ -64,6 +64,6 @@ fn with_assoc_sub<'a,'b>() {
     //~^ ERROR reference has a longer lifetime
 }
 
-#[rustc_error]
+
 fn main() {
 }
index 2d271b7be73e083a064e816dd374cffe9b72a231..d6d4e2b0529067f21b46660af8682bc37c375aa0 100644 (file)
@@ -15,7 +15,7 @@
 // `'r` is bound, that leads to badness. This test checks that
 // everything works.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 
 trait TheTrait {
@@ -32,5 +32,5 @@ fn foo<'a,'b,T>()
     wf::< <FnType<T> as TheTrait>::TheType >();
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/regions/regions-outlives-projection-hrtype.stderr b/src/test/ui/regions/regions-outlives-projection-hrtype.stderr
deleted file mode 100644 (file)
index ba4e318..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/regions-outlives-projection-hrtype.rs:36:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 04682a7729735121e61b4424e2a5077bd63de8e4..b05788dc4136bcf9f70a5fbf29dc73e37aa2aadb 100644 (file)
@@ -11,7 +11,7 @@
 // Test that `<F as Foo<'a>>::Type: 'b`, where `trait Foo<'a> { Type:
 // 'a; }`, does not require that `F: 'b`.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 
 trait SomeTrait<'a> {
@@ -27,5 +27,5 @@ impl<'a: 'c, 'c, T> SomeTrait<'a> for &'c T where T: SomeTrait<'a> {
     // here, then we would require that `T:'a`, which is too strong.
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/regions/regions-outlives-projection-trait-def.stderr b/src/test/ui/regions/regions-outlives-projection-trait-def.stderr
deleted file mode 100644 (file)
index 0a4cbe6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/regions-outlives-projection-trait-def.rs:31:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 94f7a350cf787789b16f959666a663e28e92d94f..a203ebd919d7df84fb36d6c7cc5fd80eb8567119 100644 (file)
@@ -11,7 +11,7 @@
 // Test that scalar values outlive all regions.
 // Rule OutlivesScalar from RFC 1214.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 
 struct Foo<'a> {
@@ -19,5 +19,5 @@ struct Foo<'a> {
     y: &'static i32
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/regions/regions-outlives-scalar.stderr b/src/test/ui/regions/regions-outlives-scalar.stderr
deleted file mode 100644 (file)
index d754bdd..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/regions-outlives-scalar.rs:23:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index c5e26a26744df659742c97c58d2c5c46bfe3d2fa..a4681633326472a2527a8a1ff0d294148e4d27f1 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+
 #![allow(warnings)]
 
 pub fn fail(x: Option<&(Iterator<Item=()>+Send)>)
@@ -29,5 +29,5 @@ pub fn inner(x: Option<&(Iterator<Item=()>+Send)>)
     x
 }
 
-#[rustc_error]
+
 fn main() {}
index 44af621ef24dc8b7ca649828db6408b14d2b4386..77b5b401c42f15afe9363f8c105d18ed8f14a7ad 100644 (file)
@@ -13,7 +13,7 @@
 //
 // Rule OutlivesNominalType from RFC 1214.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 mod rev_variant_struct_region {
@@ -28,5 +28,5 @@ impl<'a, 'b> Trait<'a, 'b> for usize {
     }
 }
 
-#[rustc_error]
+
 fn main() { }
index 93f16350a7b4dcb7a7e70d59c7f3c580aa28bf30..b6ac7aa3a9cd2ac46ab677592ee6f587f58d9856 100644 (file)
@@ -13,7 +13,7 @@
 //
 // Rule OutlivesNominalType from RFC 1214.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 mod variant_struct_region {
@@ -28,5 +28,5 @@ impl<'a, 'b> Trait<'a, 'b> for usize {
     }
 }
 
-#[rustc_error]
+
 fn main() { }
index e44e049a9e5dc3a3cf5ec123420917eaa5898369..3f7d086a6ae19c4347ceab84de8fa4d6e17b2487 100644 (file)
@@ -13,7 +13,7 @@
 //
 // Rule OutlivesNominalType from RFC 1214.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 mod variant_struct_type {
@@ -28,5 +28,5 @@ impl<'a, 'b> Trait<'a, 'b> for usize {
     }
 }
 
-#[rustc_error]
+
 fn main() { }
index 1293e6c234bc14de26722937d2b2cc12d63e314e..dff9b8a862f6c74ab8270eb0aee090bbb60de799 100644 (file)
@@ -13,7 +13,7 @@
 //
 // Rule OutlivesNominalType from RFC 1214.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 mod variant_struct_type {
@@ -28,5 +28,5 @@ impl<'a, 'b> Trait<'a, 'b> for usize {
     }
 }
 
-#[rustc_error]
+
 fn main() { }
index 4a693a3b05d4ea1f38770055e1a9857d8b71b25f..389a1116c163ace63616dedc196c9467c8334fd9 100644 (file)
@@ -14,6 +14,16 @@ LL | fn deref_extend_mut_field1(x: &Own<Point>) -> &mut isize {
 LL |     &mut x.y //~ ERROR cannot borrow
    |          ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
 
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+  --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:88:19
+   |
+LL |     let _x = &mut x.x;
+   |                   - first mutable borrow occurs here
+LL |     let _y = &mut x.y; //~ ERROR cannot borrow
+   |                   ^ second mutable borrow occurs here
+LL |     use_mut(_x);
+   |             -- first borrow later used here
+
 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:98:5
    |
@@ -30,6 +40,16 @@ LL | fn assign_field2<'a>(x: &'a Own<Point>) {
 LL |     x.y = 3; //~ ERROR cannot borrow
    |     ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
 
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+  --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:111:5
+   |
+LL |     let _p: &mut Point = &mut **x;
+   |                                -- first mutable borrow occurs here
+LL |     x.y = 3; //~ ERROR cannot borrow
+   |     ^ second mutable borrow occurs here
+LL |     use_mut(_p);
+   |             -- first borrow later used here
+
 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:119:5
    |
@@ -62,6 +82,7 @@ LL | fn assign_method2<'a>(x: &'a Own<Point>) {
 LL |     *x.y_mut() = 3; //~ ERROR cannot borrow
    |      ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
 
-error: aborting due to 8 previous errors
+error: aborting due to 10 previous errors
 
-For more information about this error, try `rustc --explain E0596`.
+Some errors occurred: E0499, E0596.
+For more information about an error, try `rustc --explain E0499`.
index 764d05be879b8be674f3e9c3adba83e924c051a8..48eb2e239f7cdc6a46ff85170949b339c8ed6128 100644 (file)
@@ -86,8 +86,8 @@ fn deref_extend_mut_field3(x: &mut Own<Point>) {
 
     let _x = &mut x.x;
     let _y = &mut x.y; //~ ERROR cannot borrow
+    use_mut(_x);
 }
-
 fn deref_extend_mut_field4<'a>(x: &'a mut Own<Point>) {
     let p = &mut **x;
     let _x = &mut p.x;
@@ -109,8 +109,8 @@ fn assign_field3<'a>(x: &'a mut Own<Point>) {
 fn assign_field4<'a>(x: &'a mut Own<Point>) {
     let _p: &mut Point = &mut **x;
     x.y = 3; //~ ERROR cannot borrow
+    use_mut(_p);
 }
-
 fn deref_imm_method(x: Own<Point>) {
     let __isize = x.get();
 }
@@ -148,3 +148,5 @@ fn assign_method3<'a>(x: &'a mut Own<Point>) {
 }
 
 pub fn main() {}
+
+fn use_mut<T>(_: &mut T) {}
index d91ff6964237b2c65e5c116ec9b02b5463707b12..864357fee9f0cbbb59ac9bb328e3ee10c920dda4 100644 (file)
@@ -21,6 +21,7 @@ LL |     let _x = &mut x.x;
    |                   - first mutable borrow occurs here
 LL |     let _y = &mut x.y; //~ ERROR cannot borrow
    |                   ^ second mutable borrow occurs here
+LL |     use_mut(_x);
 LL | }
    | - first borrow ends here
 
@@ -47,6 +48,7 @@ LL |     let _p: &mut Point = &mut **x;
    |                                -- first mutable borrow occurs here
 LL |     x.y = 3; //~ ERROR cannot borrow
    |     ^ second mutable borrow occurs here
+LL |     use_mut(_p);
 LL | }
    | - first borrow ends here
 
index 041ca6c426c1f40cfb20336456b10b69b0953565..b19461b03a0d59c05a1cd761cad83f44f24b8541 100644 (file)
 //! A test to ensure that helpful `note` messages aren't emitted more often
 //! than necessary.
 
-#![feature(rustc_attrs)]
+// compile-pass
 
 // Although there are three warnings, we should only get two "lint level defined
 // here" notes pointing at the `warnings` span, one for each error type.
 #![warn(unused)]
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
+
+fn main() {
     let theTwo = 2; //~ WARN should have a snake case name
     let theOtherTwo = 2; //~ WARN should have a snake case name
     //~^ WARN unused variable
index b496a1a76c017424252b586fa89452001f6cfb0a..723b7e2c0aaf51515ca73a7daa872ef898101b1a 100644 (file)
@@ -25,16 +25,3 @@ warning: variable `theOtherTwo` should have a snake case name such as `the_other
 LL |     let theOtherTwo = 2; //~ WARN should have a snake case name
    |         ^^^^^^^^^^^
 
-error: compilation successful
-  --> $DIR/issue-24690.rs:21:1
-   |
-LL | / fn main() { //~ ERROR compilation successful
-LL | |     let theTwo = 2; //~ WARN should have a snake case name
-LL | |     let theOtherTwo = 2; //~ WARN should have a snake case name
-LL | |     //~^ WARN unused variable
-LL | |     println!("{}", theTwo);
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index 5f9e8ba6c0a4acabe06f2ce599c4f501b8600b11..85001fc0ff6e9257417d774192c5ef3e9abcc818 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs, get_type_id)]
+// compile-pass
+#![feature(get_type_id)]
 #![allow(dead_code)]
-
 mod foo {
     pub use self::bar::T;
     mod bar {
@@ -31,5 +31,5 @@ fn f() {
     error.get_type_id(); // Regression test for #21670
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+
+fn main() {}
diff --git a/src/test/ui/traits/trait-privacy.stderr b/src/test/ui/traits/trait-privacy.stderr
deleted file mode 100644 (file)
index d38e869..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/trait-privacy.rs:35:1
-   |
-LL | fn main() {} //~ ERROR compilation successful
-   | ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index 80d2884ee60aaaa84ea870748a70a295cd98f7e9..2f694e3ca7c5ec962e27cb69386cf6615d511712 100644 (file)
@@ -12,7 +12,7 @@
 // types are required. This test now just compiles fine, since the
 // relevant rules that triggered the overflow were removed.
 
-#![feature(rustc_attrs)]
+// compile-pass
 #![allow(dead_code)]
 
 use std::marker::PhantomData;
@@ -35,5 +35,5 @@ impl<B> Async for Complete<B> {
 
 fn foo(_: Receipt<Complete<()>>) { }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/traits/traits-issue-23003-overflow.stderr b/src/test/ui/traits/traits-issue-23003-overflow.stderr
deleted file mode 100644 (file)
index 3c26e42..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/traits-issue-23003-overflow.rs:39:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index d86ebda027efb21271895eda30b99f3ee485940b..83fd736a997a98ff686b277e885c5afd6f7b9974 100644 (file)
@@ -10,7 +10,7 @@ error[E0004]: non-exhaustive patterns: type &Void is non-empty
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
    |                   ^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/uninhabited-matches-feature-gated.rs:20:19
    |
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
@@ -22,7 +22,7 @@ error[E0004]: non-exhaustive patterns: type (Void,) is non-empty
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
    |                   ^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/uninhabited-matches-feature-gated.rs:23:19
    |
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
@@ -34,7 +34,7 @@ error[E0004]: non-exhaustive patterns: type [Void; 1] is non-empty
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
    |                   ^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/uninhabited-matches-feature-gated.rs:26:19
    |
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
index a4f5e41b5291c7e57db7eae26469bdf0712eddab..6b18aff9f6b830caa18e310f006a2a0832d78c69 100644 (file)
@@ -1,33 +1,64 @@
+error[E0502]: cannot borrow `u.y` as immutable because it is also borrowed as mutable
+  --> $DIR/union-borrow-move-parent-sibling.rs:25:13
+   |
+LL |     let a = &mut u.x.0;
+   |             ---------- mutable borrow occurs here
+LL |     let b = &u.y; //~ ERROR cannot borrow `u.y`
+   |             ^^^^ immutable borrow occurs here
+LL |     use_borrow(a);
+   |                - mutable borrow later used here
+
 error[E0382]: use of moved value: `u`
-  --> $DIR/union-borrow-move-parent-sibling.rs:29:13
+  --> $DIR/union-borrow-move-parent-sibling.rs:32:13
    |
 LL |     let a = u.x.0;
    |             ----- value moved here
-LL |     let a = u.y; //~ ERROR use of moved value: `u.y`
+LL |     let b = u.y; //~ ERROR use of moved value: `u.y`
    |             ^^^ value used here after move
    |
    = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
 
+error[E0502]: cannot borrow `u.y` as immutable because it is also borrowed as mutable
+  --> $DIR/union-borrow-move-parent-sibling.rs:38:13
+   |
+LL |     let a = &mut (u.x.0).0;
+   |             -------------- mutable borrow occurs here
+LL |     let b = &u.y; //~ ERROR cannot borrow `u.y`
+   |             ^^^^ immutable borrow occurs here
+LL |     use_borrow(a);
+   |                - mutable borrow later used here
+
 error[E0382]: use of moved value: `u`
-  --> $DIR/union-borrow-move-parent-sibling.rs:41:13
+  --> $DIR/union-borrow-move-parent-sibling.rs:45:13
    |
 LL |     let a = (u.x.0).0;
    |             --------- value moved here
-LL |     let a = u.y; //~ ERROR use of moved value: `u.y`
+LL |     let b = u.y; //~ ERROR use of moved value: `u.y`
    |             ^^^ value used here after move
    |
    = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
 
+error[E0502]: cannot borrow `u.x` as immutable because it is also borrowed as mutable
+  --> $DIR/union-borrow-move-parent-sibling.rs:51:13
+   |
+LL |     let a = &mut *u.y;
+   |             --------- mutable borrow occurs here
+LL |     let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
+   |             ^^^^ immutable borrow occurs here
+LL |     use_borrow(a);
+   |                - mutable borrow later used here
+
 error[E0382]: use of moved value: `u`
-  --> $DIR/union-borrow-move-parent-sibling.rs:53:13
+  --> $DIR/union-borrow-move-parent-sibling.rs:58:13
    |
 LL |     let a = *u.y;
    |             ---- value moved here
-LL |     let a = u.x; //~ ERROR use of moved value: `u.x`
+LL |     let b = u.x; //~ ERROR use of moved value: `u.x`
    |             ^^^ value used here after move
    |
    = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
 
-error: aborting due to 3 previous errors
+error: aborting due to 6 previous errors
 
-For more information about this error, try `rustc --explain E0382`.
+Some errors occurred: E0382, E0502.
+For more information about an error, try `rustc --explain E0382`.
index 5f504feabb266bab2a7eadf0cfb3746dc9d06d78..99a073b838ca91482e91eff5f9ad4174e8acd929 100644 (file)
@@ -17,40 +17,45 @@ union U {
     y: Box<Vec<u8>>,
 }
 
+fn use_borrow<T>(_: &T) {}
+
 unsafe fn parent_sibling_borrow() {
     let mut u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
     let a = &mut u.x.0;
-    let a = &u.y; //~ ERROR cannot borrow `u.y`
+    let b = &u.y; //~ ERROR cannot borrow `u.y`
+    use_borrow(a);
 }
 
 unsafe fn parent_sibling_move() {
     let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
     let a = u.x.0;
-    let a = u.y; //~ ERROR use of moved value: `u.y`
+    let b = u.y; //~ ERROR use of moved value: `u.y`
 }
 
 unsafe fn grandparent_sibling_borrow() {
     let mut u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
     let a = &mut (u.x.0).0;
-    let a = &u.y; //~ ERROR cannot borrow `u.y`
+    let b = &u.y; //~ ERROR cannot borrow `u.y`
+    use_borrow(a);
 }
 
 unsafe fn grandparent_sibling_move() {
     let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
     let a = (u.x.0).0;
-    let a = u.y; //~ ERROR use of moved value: `u.y`
+    let b = u.y; //~ ERROR use of moved value: `u.y`
 }
 
 unsafe fn deref_sibling_borrow() {
     let mut u = U { y: Box::default() };
     let a = &mut *u.y;
-    let a = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
+    let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
+    use_borrow(a);
 }
 
 unsafe fn deref_sibling_move() {
     let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
     let a = *u.y;
-    let a = u.x; //~ ERROR use of moved value: `u.x`
+    let b = u.x; //~ ERROR use of moved value: `u.x`
 }
 
 
index d855435416e5dc1ae6b36b196df4217b98d78a01..daf5a4f4fccaa4262b9dcf91fb22352e6118cf4b 100644 (file)
@@ -1,59 +1,62 @@
 error[E0502]: cannot borrow `u.y` as immutable because `u.x.0` is also borrowed as mutable
-  --> $DIR/union-borrow-move-parent-sibling.rs:23:14
+  --> $DIR/union-borrow-move-parent-sibling.rs:25:14
    |
 LL |     let a = &mut u.x.0;
    |                  ----- mutable borrow occurs here
-LL |     let a = &u.y; //~ ERROR cannot borrow `u.y`
+LL |     let b = &u.y; //~ ERROR cannot borrow `u.y`
    |              ^^^ immutable borrow occurs here
+LL |     use_borrow(a);
 LL | }
    | - mutable borrow ends here
 
 error[E0382]: use of moved value: `u.y`
-  --> $DIR/union-borrow-move-parent-sibling.rs:29:9
+  --> $DIR/union-borrow-move-parent-sibling.rs:32:9
    |
 LL |     let a = u.x.0;
    |         - value moved here
-LL |     let a = u.y; //~ ERROR use of moved value: `u.y`
+LL |     let b = u.y; //~ ERROR use of moved value: `u.y`
    |         ^ value used here after move
    |
    = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait
 
 error[E0502]: cannot borrow `u.y` as immutable because `u.x.0.0` is also borrowed as mutable
-  --> $DIR/union-borrow-move-parent-sibling.rs:35:14
+  --> $DIR/union-borrow-move-parent-sibling.rs:38:14
    |
 LL |     let a = &mut (u.x.0).0;
    |                  --------- mutable borrow occurs here
-LL |     let a = &u.y; //~ ERROR cannot borrow `u.y`
+LL |     let b = &u.y; //~ ERROR cannot borrow `u.y`
    |              ^^^ immutable borrow occurs here
+LL |     use_borrow(a);
 LL | }
    | - mutable borrow ends here
 
 error[E0382]: use of moved value: `u.y`
-  --> $DIR/union-borrow-move-parent-sibling.rs:41:9
+  --> $DIR/union-borrow-move-parent-sibling.rs:45:9
    |
 LL |     let a = (u.x.0).0;
    |         - value moved here
-LL |     let a = u.y; //~ ERROR use of moved value: `u.y`
+LL |     let b = u.y; //~ ERROR use of moved value: `u.y`
    |         ^ value used here after move
    |
    = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait
 
 error[E0502]: cannot borrow `u` (via `u.x`) as immutable because `u` is also borrowed as mutable (via `*u.y`)
-  --> $DIR/union-borrow-move-parent-sibling.rs:47:14
+  --> $DIR/union-borrow-move-parent-sibling.rs:51:14
    |
 LL |     let a = &mut *u.y;
    |                  ---- mutable borrow occurs here (via `*u.y`)
-LL |     let a = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
+LL |     let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
    |              ^^^ immutable borrow occurs here (via `u.x`)
+LL |     use_borrow(a);
 LL | }
    | - mutable borrow ends here
 
 error[E0382]: use of moved value: `u.x`
-  --> $DIR/union-borrow-move-parent-sibling.rs:53:9
+  --> $DIR/union-borrow-move-parent-sibling.rs:58:9
    |
 LL |     let a = *u.y;
    |         - value moved here
-LL |     let a = u.x; //~ ERROR use of moved value: `u.x`
+LL |     let b = u.x; //~ ERROR use of moved value: `u.x`
    |         ^ value used here after move
    |
    = note: move occurs because `u.x` has type `[type error]`, which does not implement the `Copy` trait
index 111940aab2c322764150b4a5be8539b966a6a6ad..bfc7736b2f32cd7f66b59646931677c257b303ac 100644 (file)
@@ -9,6 +9,29 @@ LL |     x.clone();  //~ ERROR: use of moved value
    |
    = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
 
+error[E0505]: cannot move out of `x` because it is borrowed
+  --> $DIR/unop-move-semantics.rs:25:6
+   |
+LL |     let m = &x;
+   |             -- borrow of `x` occurs here
+...
+LL |     !x;  //~ ERROR: cannot move out of `x` because it is borrowed
+   |      ^ move out of `x` occurs here
+...
+LL |     use_mut(n); use_imm(m);
+   |                         - borrow later used here
+
+error[E0505]: cannot move out of `y` because it is borrowed
+  --> $DIR/unop-move-semantics.rs:27:6
+   |
+LL |     let n = &mut y;
+   |             ------ borrow of `y` occurs here
+...
+LL |     !y;  //~ ERROR: cannot move out of `y` because it is borrowed
+   |      ^ move out of `y` occurs here
+LL |     use_mut(n); use_imm(m);
+   |             - borrow later used here
+
 error[E0507]: cannot move out of borrowed content
   --> $DIR/unop-move-semantics.rs:34:6
    |
@@ -21,7 +44,7 @@ error[E0507]: cannot move out of borrowed content
 LL |     !*n;  //~ ERROR: cannot move out of borrowed content
    |      ^^ cannot move out of borrowed content
 
-error: aborting due to 3 previous errors
+error: aborting due to 5 previous errors
 
-Some errors occurred: E0382, E0507.
+Some errors occurred: E0382, E0505, E0507.
 For more information about an error, try `rustc --explain E0382`.
index 946566675981e7020327aa8aca735f9e14490e75..fcbbe546a316446deedae6db6d929515cbcab52b 100644 (file)
@@ -25,8 +25,8 @@ fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
     !x;  //~ ERROR: cannot move out of `x` because it is borrowed
 
     !y;  //~ ERROR: cannot move out of `y` because it is borrowed
+    use_mut(n); use_imm(m);
 }
-
 fn illegal_dereference<T: Not<Output=T>>(mut x: T, y: T) {
     let m = &mut x;
     let n = &y;
@@ -34,6 +34,9 @@ fn illegal_dereference<T: Not<Output=T>>(mut x: T, y: T) {
     !*m;  //~ ERROR: cannot move out of borrowed content
 
     !*n;  //~ ERROR: cannot move out of borrowed content
+    use_imm(n); use_mut(m);
 }
-
 fn main() {}
+
+fn use_mut<T>(_: &mut T) { }
+fn use_imm<T>(_: &T) { }
index df340095bb433477cbe3ddef4476a5decc89e70f..2c0690881a1cd4853bbfa5034cb1fdcaad90389a 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(never_type)]
-#![feature(exhaustive_patterns, rustc_attrs)]
+// compile-pass
+#![feature(never_type, exhaustive_patterns)]
 #![warn(unreachable_code)]
 #![warn(unreachable_patterns)]
 
@@ -42,8 +42,8 @@ fn vom(x: Result<u32, Void>) -> Result<u32, i32> {
     Ok(y)
 }
 
-#[rustc_error]
-fn main() { //~ ERROR: compilation successful
+
+fn main() {
     let _ = bar(Err(123));
     let _ = foo(Err(123));
     let _ = qux(Ok(123));
index a8a0ed3d03b849956e938242f39971e78b2ab16d..1916174142fde50ccad6f1fc3007b7a46c4bacd1 100644 (file)
@@ -28,16 +28,3 @@ warning: unreachable pattern
 LL |     let y = (match x { Ok(n) => Ok(n), Err(e) => Err(e) })?;
    |                                        ^^^^^^
 
-error: compilation successful
-  --> $DIR/unreachable-try-pattern.rs:46:1
-   |
-LL | / fn main() { //~ ERROR: compilation successful
-LL | |     let _ = bar(Err(123));
-LL | |     let _ = foo(Err(123));
-LL | |     let _ = qux(Ok(123));
-LL | |     let _ = vom(Ok(123));
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
index e9607de00a34f0bac195bd437dea2ec5948d9f11..59fc0136612dd9d5c0c79740b68a128ab73963d1 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
+
 
 use std::collections::btree_map::{IterMut, OccupiedEntry, VacantEntry};
 
@@ -59,5 +59,5 @@ fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
     v //~ ERROR mismatched types
 }
 
-#[rustc_error]
+
 fn main() { }
index d2fd2978750e7c922b26f139ee8bd27bec982c9d..47ecec5a1124e00496c7bd1c65a656ce17326e46 100644 (file)
@@ -11,7 +11,7 @@
 // Test various uses of structs with distint variances to make sure
 // they permit lifetimes to be approximated as expected.
 
-#![feature(rustc_attrs)]
+
 
 struct SomeStruct<T>(fn(T));
 
@@ -22,5 +22,5 @@ fn foo<'min,'max>(v: SomeStruct<&'max ()>)
     v //~ ERROR mismatched types
 }
 
-#[rustc_error]
+
 fn main() { }
index b38fd0e9ffcc6e8882093e95245648f58fe438b9..88585373847ddbf52f1275b9ba8ca85d834cc3d8 100644 (file)
@@ -12,7 +12,7 @@
 // they permit lifetimes to be approximated as expected.
 
 #![allow(dead_code)]
-#![feature(rustc_attrs)]
+// compile-pass
 
 struct SomeStruct<T>(fn(T));
 
@@ -23,5 +23,5 @@ fn bar<'min,'max>(v: SomeStruct<&'min ()>)
     v
 }
 
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+
+fn main() { }
diff --git a/src/test/ui/variance/variance-use-contravariant-struct-2.stderr b/src/test/ui/variance/variance-use-contravariant-struct-2.stderr
deleted file mode 100644 (file)
index e3663eb..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/variance-use-contravariant-struct-2.rs:27:1
-   |
-LL | fn main() { } //~ ERROR compilation successful
-   | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index d8e1a5f5f1c54f127282d3c4e02aff0c41ce4c7c..245e21511a6f898d6cb7b922026b21de7028714c 100644 (file)
@@ -12,7 +12,7 @@
 // be shortened.
 
 #![allow(dead_code)]
-#![feature(rustc_attrs)]
+// compile-pass
 
 struct SomeStruct<T>(T);
 
@@ -23,4 +23,4 @@ fn foo<'min,'max>(v: SomeStruct<&'max ()>)
     v
 }
 
-#[rustc_error] fn main() { } //~ ERROR compilation successful
+fn main() { }
diff --git a/src/test/ui/variance/variance-use-covariant-struct-2.stderr b/src/test/ui/variance/variance-use-covariant-struct-2.stderr
deleted file mode 100644 (file)
index 9c3a1cf..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: compilation successful
-  --> $DIR/variance-use-covariant-struct-2.rs:26:16
-   |
-LL | #[rustc_error] fn main() { } //~ ERROR compilation successful
-   |                ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
index c89436b20949c571a260c11e937ab7ebb74ef1d8..2e6c0c16dcd0d04a50a5ba58d9f0f2aa5c8b2d1b 100644 (file)
@@ -11,7 +11,7 @@
 // Test various uses of structs with distint variances to make sure
 // they permit lifetimes to be approximated as expected.
 
-#![feature(rustc_attrs)]
+
 
 struct SomeStruct<T>(*mut T);
 
@@ -29,5 +29,5 @@ fn bar<'min,'max>(v: SomeStruct<&'min ()>)
     v //~ ERROR mismatched types
 }
 
-#[rustc_error]
+
 fn main() { }
index 946341a1a75bb7d0dae60c4ce7ed6c47a04f5ae5..36e9226ae3f8106712aa832989c9b102bfea59a4 100644 (file)
 
 // Check that array elemen types must be Sized. Issue #25692.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 struct Foo {
     foo: [[u8]], //~ ERROR E0277
 }
 
-#[rustc_error]
+
 fn main() { }
index c3015afd8dd0d95f00f8ae6841b61a831f9104a0..bc14ce46ff1992e2309a44296807b54c3b8e2a7a 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check the types of constants are well-formed.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 struct IsCopy<T:Copy> { t: T }
@@ -20,5 +20,5 @@ struct IsCopy<T:Copy> { t: T }
 const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
 //~^ ERROR E0277
 
-#[rustc_error]
+
 fn main() { }
index e3e79fdd940af47cc88842fb0efb45a6b355fe09..6c08f5a4a547e1cc15129f652d6cc8a69e265282 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check enum bounds for WFedness.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 trait ExtraCopy<T:Copy> { }
@@ -22,5 +22,5 @@ enum SomeEnum<T,U> //~ ERROR E0277
     SomeVariant(T,U)
 }
 
-#[rustc_error]
+
 fn main() { }
index 5eb53e7edde6b8634bdb2f993da98fba90ae8cf1..572b609fe2ef225908f1bc680a1d2b277c12233b 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check struct fields for WFedness.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 struct IsCopy<T:Copy> {
@@ -24,5 +24,5 @@ enum AnotherEnum<A> {
     }
 }
 
-#[rustc_error]
+
 fn main() { }
index 76ad40f845768280ca2b39a22d1d43aa8efcdea0..32e870e9e1b5b586c4d987ab0c8254cbb249c5f2 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check struct fields for WFedness.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 struct IsCopy<T:Copy> {
@@ -22,5 +22,5 @@ enum SomeEnum<A> {
     SomeVariant(IsCopy<A>) //~ ERROR E0277
 }
 
-#[rustc_error]
+
 fn main() { }
index 59bb8326ddbf5ba07fe69d3785d38fff5f95e5e1..3d97bdb521fa8c32bab88bb9023bc98907d42152 100644 (file)
@@ -10,7 +10,7 @@
 
 // Test that we check where-clauses on fn items.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 trait ExtraCopy<T:Copy> { }
@@ -23,5 +23,5 @@ fn bar() where Vec<dyn Copy>:, {}
 //~^ ERROR E0277
 //~| ERROR E0038
 
-#[rustc_error]
+
 fn main() { }
index a319b676eeb880cf660434e616a5e7212ad60638..aa88b3d7377e0cea80c37cca00eabde7764b3fdb 100644 (file)
@@ -10,7 +10,7 @@
 
 // Check that we require that associated types in an impl are well-formed.
 
-#![feature(rustc_attrs)]
+
 
 pub trait Foo<'a> {
     type Bar;
@@ -20,5 +20,5 @@ impl<'a, T> Foo<'a> for T {
     type Bar = &'a T; //~ ERROR E0309
 }
 
-#[rustc_error]
+
 fn main() { }
index 1e82f609d2a7f7e91a0cf4a329137f449c120ef6..0b5a76db262668ee13bd478bb86ddbfe2c2a6833 100644 (file)
@@ -10,7 +10,7 @@
 
 // Check that we require that associated types in an impl are well-formed.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 pub trait MyHash { }
@@ -28,5 +28,5 @@ impl<T> Foo for T {
     //~^ ERROR the trait bound `T: MyHash` is not satisfied
 }
 
-#[rustc_error]
+
 fn main() { }
index 8e3bca09758139ac179680b3ca2ddfa771ef01eb..dfe6688c0b7f2080142e14f695d4bc177a8001c5 100644 (file)
@@ -12,7 +12,7 @@
 // types in fns.
 
 #![allow(dead_code)]
-#![feature(rustc_attrs)]
+
 
 struct MustBeCopy<T:Copy> {
     t: T
@@ -28,5 +28,5 @@ struct Bar<T> {
     x: fn(&'static T) //~ ERROR E0310
 }
 
-#[rustc_error]
+
 fn main() { }
index c2f66a2a460c5690c72905c93b65771aabb73173..f6f14099e738ea8078beb211ffd51b0efb169667 100644 (file)
@@ -10,7 +10,7 @@
 
 // Check that we enforce WF conditions also for where clauses in fn items.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 trait MustBeCopy<T:Copy> {
@@ -21,5 +21,5 @@ fn bar<T,U>() //~ ERROR E0277
 {
 }
 
-#[rustc_error]
+
 fn main() { }
index 11535fb9f9e45685a710d2ac452f4ca4481cf19a..7cbcf99af3c680ff37c6ba208105b4f70780ff70 100644 (file)
@@ -10,7 +10,7 @@
 
 // Check that we enforce WF conditions also for types in fns.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 trait Object<T> { }
@@ -24,5 +24,5 @@ struct Foo<T> {
     x: Object<&'static T> //~ ERROR E0310
 }
 
-#[rustc_error]
+
 fn main() { }
index 78e12c47e24debc7b8f631ece604c86003d5783d..8b65b2e1626679c62e59ad9a8b0524122291a2ea 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check where-clauses on inherent impl methods.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 trait ExtraCopy<T:Copy> { }
@@ -23,5 +23,5 @@ fn foo(self) where T: ExtraCopy<U> //~ ERROR E0277
     {}
 }
 
-#[rustc_error]
+
 fn main() { }
index 7edbb11e245200270033c8db2d6446d0867cfce0..ee929282849026103ca3b336c20897316e92091d 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check where-clauses on inherent impls.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 trait ExtraCopy<T:Copy> { }
@@ -22,5 +22,5 @@ impl<T,U> Foo<T,U> where T: ExtraCopy<U> //~ ERROR E0277
 {
 }
 
-#[rustc_error]
+
 fn main() { }
index ba02c5dca3e6d7d49635fb92edacae2a88c5dfca..91943b44d97adc8f99618d81f7bb35226bf278a0 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check the types of statics are well-formed.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 struct IsCopy<T:Copy> { t: T }
@@ -20,5 +20,5 @@ struct IsCopy<T:Copy> { t: T }
 static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
 //~^ ERROR E0277
 
-#[rustc_error]
+
 fn main() { }
index e263b251aa379eb58bf5f12a21ebd7a1d47bf20b..c4a15bbe5407c589c4672c94dd272d26ad5772c8 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check struct bounds for WFedness.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 trait ExtraCopy<T:Copy> { }
@@ -22,5 +22,5 @@ struct SomeStruct<T,U> //~ ERROR E0277
     data: (T,U)
 }
 
-#[rustc_error]
+
 fn main() { }
index 8a631a6c335a050598492ad1e5663006edd5e60f..4d1e42829d88bfd31b5bead839472ba040aa91a8 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check struct fields for WFedness.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 struct IsCopy<T:Copy> {
@@ -22,5 +22,5 @@ struct SomeStruct<A> {
     data: IsCopy<A> //~ ERROR E0277
 }
 
-#[rustc_error]
+
 fn main() { }
index 8420edd66a1809dcaa92f1fe5448fe09b43d518b..eaeffa017400e75a8975514a777b2bfdc7805f8d 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check associated type bounds for WFedness.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 trait ExtraCopy<T:Copy> { }
@@ -20,5 +20,5 @@ trait SomeTrait<T> { //~ ERROR E0277
     type Type1: ExtraCopy<T>;
 }
 
-#[rustc_error]
+
 fn main() { }
index 95d9ffdf9d35958782c0ab8ad105aa2dfc6f5021..61cdbe5e49128d2afb0004a4e14a1d3d448fd21e 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check associated type default values for WFedness.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 trait SomeTrait<'a> {
@@ -20,5 +20,5 @@ trait SomeTrait<'a> {
     //~^ ERROR E0309
 }
 
-#[rustc_error]
+
 fn main() { }
index 902cbe2676b06a5995ccd67137a695831c1ec096..e752c0a9077ce1c1672a94fa1eed8f510433f5c5 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check associated type default values for WFedness.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 struct IsCopy<T:Copy> { x: T }
@@ -22,5 +22,5 @@ trait SomeTrait {
     //~^ ERROR E0277
 }
 
-#[rustc_error]
+
 fn main() { }
index ca15a6ab648630d17c15f2502463fa1c7ec80ae8..c02281ab4f9502215c3bf4b0b71050155f4765ef 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we check supertrait bounds for WFedness.
 
 #![feature(associated_type_defaults)]
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 
 trait ExtraCopy<T:Copy> { }
@@ -21,5 +21,5 @@ trait SomeTrait<T,U> //~ ERROR E0277
 {
 }
 
-#[rustc_error]
+
 fn main() { }
index 453aa2428ce5d1ee94dcf0f5236e524a15ea4970..8577bc8963826b6c595f862f138323541a5e803f 100644 (file)
@@ -11,7 +11,7 @@
 // Check that we test WF conditions for fn arguments. Because the
 // current code is so goofy, this is only a warning for now.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 #![allow(unused_variables)]
 
@@ -25,5 +25,5 @@ fn bar(&self, x: &Bar<Self>) {
     }
 }
 
-#[rustc_error]
+
 fn main() { }
index 29c85250583c7900c8d90875bc9711b83cc7d674..b15767198704182fe2959d2c3264156358d53f87 100644 (file)
@@ -11,7 +11,7 @@
 // Check that we test WF conditions for fn arguments. Because the
 // current code is so goofy, this is only a warning for now.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 #![allow(unused_variables)]
 
@@ -25,5 +25,5 @@ fn bar<A>(&self) where A: Bar<Self> {
     }
 }
 
-#[rustc_error]
+
 fn main() { }
index f46a54504a0b5cd7c50835eb4dacf0165d0ad412..44e3d6bda5cd8b782ecd36199aea119714d70ae9 100644 (file)
@@ -10,7 +10,7 @@
 
 // Check that we test WF conditions for fn where clauses in a trait definition.
 
-#![feature(rustc_attrs)]
+
 #![allow(dead_code)]
 #![allow(unused_variables)]
 
@@ -23,5 +23,5 @@ trait Foo {
         // Here, Eq ought to be implemented.
 }
 
-#[rustc_error]
+
 fn main() { }
index f81964ccbc23c6405d4533fe5bd06865004bcd34..8781542ae044a0286b70e5dada4ee53e479be191 100644 (file)
@@ -48,6 +48,7 @@
     "aarch64-apple-ios",
     "aarch64-fuchsia",
     "aarch64-linux-android",
+    "aarch64-pc-windows-msvc",
     "aarch64-unknown-cloudabi",
     "aarch64-unknown-linux-gnu",
     "aarch64-unknown-linux-musl",
@@ -60,7 +61,6 @@
     "armv5te-unknown-linux-musleabi",
     "armv7-apple-ios",
     "armv7-linux-androideabi",
-    "armv7-unknown-cloudabi-eabihf",
     "armv7-unknown-linux-gnueabihf",
     "armv7-unknown-linux-musleabihf",
     "armebv7r-none-eabi",
@@ -77,7 +77,6 @@
     "i686-linux-android",
     "i686-pc-windows-gnu",
     "i686-pc-windows-msvc",
-    "i686-unknown-cloudabi",
     "i686-unknown-freebsd",
     "i686-unknown-linux-gnu",
     "i686-unknown-linux-musl",
     "mipsel-unknown-linux-gnu",
     "mipsel-unknown-linux-musl",
     "powerpc-unknown-linux-gnu",
-    "powerpc-unknown-linux-gnuspe",
     "powerpc64-unknown-linux-gnu",
     "powerpc64le-unknown-linux-gnu",
-    "powerpc64le-unknown-linux-musl",
     "riscv32imc-unknown-none-elf",
     "riscv32imac-unknown-none-elf",
     "s390x-unknown-linux-gnu",
-    "sparc-unknown-linux-gnu",
     "sparc64-unknown-linux-gnu",
     "sparcv9-sun-solaris",
     "thumbv6m-none-eabi",
     "x86_64-sun-solaris",
     "x86_64-unknown-cloudabi",
     "x86_64-unknown-freebsd",
-    "x86_64-unknown-hermit",
     "x86_64-unknown-linux-gnu",
     "x86_64-unknown-linux-gnux32",
     "x86_64-unknown-linux-musl",
index 29bf48582812212450f4caf7da1af3f18c52bfef..fdea743be550ed8d7b61b2c908944cdd1290a6ad 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 29bf48582812212450f4caf7da1af3f18c52bfef
+Subproject commit fdea743be550ed8d7b61b2c908944cdd1290a6ad