]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #60982 - estebank:fix-60976, r=petrochenkov
authorMazdak Farrokhzad <twingoow@gmail.com>
Wed, 22 May 2019 01:47:35 +0000 (03:47 +0200)
committerGitHub <noreply@github.com>
Wed, 22 May 2019 01:47:35 +0000 (03:47 +0200)
Do not fail on child without DefId

Addresses https://github.com/rust-lang/rust/issues/60976, leaving open to come up with a repro case.

906 files changed:
Cargo.lock
RELEASES.md
src/bootstrap/compile.rs
src/bootstrap/test.rs
src/ci/docker/x86_64-gnu-tools/checktools.sh
src/doc/book
src/doc/edition-guide
src/doc/embedded-book
src/doc/nomicon
src/doc/reference
src/doc/rust-by-example
src/doc/rustc-guide
src/doc/rustc/src/lints/groups.md
src/doc/rustc/src/lints/listing/deny-by-default.md
src/doc/rustdoc/src/the-doc-attribute.md
src/doc/rustdoc/src/what-is-rustdoc.md
src/etc/natvis/liballoc.natvis
src/etc/natvis/libcore.natvis
src/liballoc/Cargo.toml
src/liballoc/alloc.rs
src/liballoc/boxed.rs
src/liballoc/collections/binary_heap.rs
src/liballoc/collections/vec_deque.rs
src/liballoc/lib.rs
src/liballoc/tests/btree/set.rs
src/liballoc/tests/lib.rs
src/libcore/alloc.rs
src/libcore/fmt/mod.rs
src/libcore/iter/traits/iterator.rs
src/libcore/lib.rs
src/libcore/mem.rs
src/libcore/ptr.rs
src/libcore/task/wake.rs
src/libcore/tests/alloc.rs [new file with mode: 0644]
src/libcore/tests/lib.rs
src/librustc/hir/def_id.rs
src/librustc/hir/lowering.rs
src/librustc/hir/map/collector.rs
src/librustc/hir/map/definitions.rs
src/librustc/hir/map/mod.rs
src/librustc/hir/mod.rs
src/librustc/infer/error_reporting/mod.rs
src/librustc/infer/error_reporting/nice_region_error/util.rs
src/librustc/infer/lexical_region_resolve/graphviz.rs
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/librustc/lint/mod.rs
src/librustc/middle/region.rs
src/librustc/mir/interpret/pointer.rs
src/librustc/mir/interpret/value.rs
src/librustc/mir/mod.rs
src/librustc/mir/mono.rs
src/librustc/mir/tcx.rs
src/librustc/session/config.rs
src/librustc/traits/error_reporting.rs
src/librustc/traits/object_safety.rs
src/librustc/traits/project.rs
src/librustc/traits/specialize/mod.rs
src/librustc/traits/structural_impls.rs
src/librustc/ty/mod.rs
src/librustc/ty/print/pretty.rs
src/librustc/ty/query/values.rs
src/librustc/ty/sty.rs
src/librustc/util/common.rs
src/librustc_allocator/expand.rs
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/debuginfo/metadata.rs
src/librustc_codegen_llvm/debuginfo/mod.rs
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_ssa/back/write.rs
src/librustc_codegen_ssa/mir/analyze.rs
src/librustc_codegen_ssa/mir/block.rs
src/librustc_codegen_utils/symbol_names.rs
src/librustc_data_structures/macros.rs
src/librustc_data_structures/stable_hasher.rs
src/librustc_driver/pretty.rs
src/librustc_interface/interface.rs
src/librustc_interface/passes.rs
src/librustc_interface/util.rs
src/librustc_lint/lib.rs
src/librustc_metadata/creader.rs
src/librustc_metadata/decoder.rs
src/librustc_metadata/encoder.rs
src/librustc_metadata/index.rs
src/librustc_metadata/locator.rs
src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
src/librustc_mir/interpret/eval_context.rs
src/librustc_mir/monomorphize/item.rs
src/librustc_mir/transform/check_unsafety.rs
src/librustc_mir/transform/const_prop.rs
src/librustc_mir/util/graphviz.rs
src/librustc_plugin/registry.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/librustc_resolve/resolve_imports.rs
src/librustc_save_analysis/lib.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/intrinsic.rs
src/librustc_typeck/check/op.rs
src/librustc_typeck/check_unused.rs
src/librustc_typeck/coherence/inherent_impls_overlap.rs
src/librustc_typeck/collect.rs
src/librustdoc/clean/cfg.rs
src/librustdoc/clean/mod.rs
src/librustdoc/config.rs
src/librustdoc/core.rs
src/librustdoc/externalfiles.rs
src/librustdoc/html/format.rs
src/librustdoc/html/layout.rs
src/librustdoc/html/markdown.rs
src/librustdoc/html/render.rs
src/librustdoc/html/static/main.js
src/librustdoc/html/static/rustdoc.css
src/librustdoc/html/static/themes/dark.css
src/librustdoc/html/static/themes/light.css
src/librustdoc/lib.rs
src/librustdoc/markdown.rs
src/librustdoc/passes/collect_intra_doc_links.rs
src/librustdoc/passes/mod.rs
src/librustdoc/test.rs
src/libstd/Cargo.toml
src/libstd/alloc.rs
src/libstd/collections/hash/map.rs
src/libstd/collections/hash/set.rs
src/libstd/error.rs
src/libstd/ffi/os_str.rs
src/libstd/fs.rs
src/libstd/io/buffered.rs
src/libstd/io/mod.rs
src/libstd/keyword_docs.rs
src/libstd/lib.rs
src/libstd/macros.rs
src/libstd/net/addr.rs
src/libstd/sync/mpsc/mod.rs
src/libstd/sync/mpsc/oneshot.rs
src/libstd/sync/mpsc/select.rs [deleted file]
src/libstd/sync/mpsc/select_tests.rs [deleted file]
src/libstd/sync/mpsc/shared.rs
src/libstd/sync/mpsc/stream.rs
src/libstd/sync/mpsc/sync.rs
src/libstd/sync/mutex.rs
src/libstd/sync/rwlock.rs
src/libstd/sys/redox/process.rs
src/libstd/sys/unix/process/process_unix.rs
src/libstd/sys/unix/rand.rs
src/libstd/thread/mod.rs
src/libsyntax/ast.rs
src/libsyntax/attr/mod.rs
src/libsyntax/diagnostics/plugin.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/derive.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/feature_gate.rs
src/libsyntax/lib.rs
src/libsyntax/mut_visit.rs
src/libsyntax/parse/diagnostics.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pprust.rs
src/libsyntax/source_map.rs
src/libsyntax/std_inject.rs
src/libsyntax/test.rs
src/libsyntax/test_snippet.rs
src/libsyntax/tokenstream.rs
src/libsyntax/util/lev_distance.rs
src/libsyntax_ext/env.rs
src/libsyntax_ext/lib.rs
src/libsyntax_ext/proc_macro_decls.rs
src/libsyntax_ext/test.rs
src/libsyntax_ext/test_case.rs
src/libsyntax_pos/edition.rs
src/libsyntax_pos/hygiene.rs
src/libsyntax_pos/lib.rs
src/libsyntax_pos/symbol.rs
src/libtest/lib.rs
src/libunwind/build.rs
src/llvm-project
src/test/codegen/box-maybe-uninit.rs
src/test/codegen/dllimports/main.rs
src/test/codegen/enum-debug-niche-2.rs
src/test/codegen/panic-abort-windows.rs
src/test/incremental/foreign.rs
src/test/incremental/hashes/closure_expressions.rs
src/test/incremental/no_mangle.rs [new file with mode: 0644]
src/test/mir-opt/const_prop/array_index.rs [new file with mode: 0644]
src/test/mir-opt/const_prop/checked_add.rs [new file with mode: 0644]
src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs [new file with mode: 0644]
src/test/mir-opt/const_prop/slice_len.rs [new file with mode: 0644]
src/test/mir-opt/const_prop/switch_int.rs [new file with mode: 0644]
src/test/mir-opt/remove_fake_borrows.rs
src/test/mir-opt/simplify_if.rs
src/test/run-fail/issue-51345.rs
src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs
src/test/run-pass-fulldeps/auxiliary/plugin-args.rs
src/test/run-pass-fulldeps/mod_dir_path_canonicalized.rs
src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs
src/test/run-pass-valgrind/exit-flushes.rs
src/test/run-pass/abort-on-c-abi.rs
src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs [deleted file]
src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs [deleted file]
src/test/run-pass/atomic-print.rs
src/test/run-pass/backtrace-debuginfo.rs
src/test/run-pass/backtrace.rs
src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs
src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs
src/test/run-pass/borrowck/two-phase-bin-ops.rs
src/test/run-pass/c-stack-returning-int64.rs
src/test/run-pass/cfg/cfg-family.rs
src/test/run-pass/cfg/cfg-target-family.rs
src/test/run-pass/command-exec.rs
src/test/run-pass/command-pre-exec.rs
src/test/run-pass/core-run-destroy.rs
src/test/run-pass/default-alloc-error-hook.rs
src/test/run-pass/env-args-reverse-iterator.rs
src/test/run-pass/env-funky-keys.rs
src/test/run-pass/env-home-dir.rs
src/test/run-pass/exec-env.rs
src/test/run-pass/fds-are-cloexec.rs
src/test/run-pass/foreign/foreign-fn-linkname.rs
src/test/run-pass/inherit-env.rs
src/test/run-pass/intrinsics/intrinsic-alignment.rs
src/test/run-pass/invalid_const_promotion.rs
src/test/run-pass/issue-59020.rs
src/test/run-pass/issues/issue-10626.rs
src/test/run-pass/issues/issue-12133-3.rs
src/test/run-pass/issues/issue-12699.rs
src/test/run-pass/issues/issue-13304.rs
src/test/run-pass/issues/issue-13494.rs [deleted file]
src/test/run-pass/issues/issue-14456.rs
src/test/run-pass/issues/issue-14940.rs
src/test/run-pass/issues/issue-16272.rs
src/test/run-pass/issues/issue-2214.rs
src/test/run-pass/issues/issue-24313.rs
src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs
src/test/run-pass/issues/issue-30490.rs
src/test/run-pass/issues/issue-33770.rs
src/test/run-pass/issues/issue-48962.rs
src/test/run-pass/issues/issue-51345.rs
src/test/run-pass/issues/issue-9396.rs
src/test/run-pass/linkage1.rs
src/test/run-pass/macros/macro-comma-support.rs
src/test/run-pass/mpsc_stress.rs
src/test/run-pass/multi-panic.rs
src/test/run-pass/nll/issue-47153-generic-const.rs
src/test/run-pass/nll/issue-47589.rs
src/test/run-pass/nll/issue-48623-closure.rs
src/test/run-pass/nll/issue-48623-generator.rs
src/test/run-pass/nll/issue-50343.rs
src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs
src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs
src/test/run-pass/nll/mutating_references.rs
src/test/run-pass/nll/process_or_insert_default.rs
src/test/run-pass/nll/rc-loop.rs
src/test/run-pass/no-stdio.rs
src/test/run-pass/out-of-stack.rs
src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs
src/test/run-pass/panic-runtime/abort.rs
src/test/run-pass/panic-runtime/lto-abort.rs
src/test/run-pass/panic-runtime/lto-unwind.rs
src/test/run-pass/panic-uninitialized-zeroed.rs
src/test/run-pass/paths-containing-nul.rs
src/test/run-pass/print-stdout-eprint-stderr.rs
src/test/run-pass/process/process-envs.rs
src/test/run-pass/process/process-exit.rs
src/test/run-pass/process/process-remove-from-env.rs
src/test/run-pass/process/process-spawn-nonexistent.rs
src/test/run-pass/process/process-spawn-with-unicode-params.rs
src/test/run-pass/process/process-status-inherits-stdin.rs
src/test/run-pass/rfcs/rfc-1014.rs
src/test/run-pass/running-with-no-runtime.rs
src/test/run-pass/segfault-no-out-of-stack.rs
src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs [deleted file]
src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs [deleted file]
src/test/run-pass/self/arbitrary_self_types_silly.rs [deleted file]
src/test/run-pass/self/arbitrary_self_types_struct.rs [deleted file]
src/test/run-pass/self/arbitrary_self_types_trait.rs [deleted file]
src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs [deleted file]
src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs [deleted file]
src/test/run-pass/self/builtin-superkinds-self-type.rs [deleted file]
src/test/run-pass/self/by-value-self-in-mut-slot.rs [deleted file]
src/test/run-pass/self/explicit-self-closures.rs [deleted file]
src/test/run-pass/self/explicit-self-generic.rs [deleted file]
src/test/run-pass/self/explicit-self-objects-uniq.rs [deleted file]
src/test/run-pass/self/explicit-self.rs [deleted file]
src/test/run-pass/self/explicit_self_xcrate_exe.rs [deleted file]
src/test/run-pass/self/move-self.rs [deleted file]
src/test/run-pass/self/object-safety-sized-self-by-value-self.rs [deleted file]
src/test/run-pass/self/object-safety-sized-self-generic-method.rs [deleted file]
src/test/run-pass/self/object-safety-sized-self-return-Self.rs [deleted file]
src/test/run-pass/self/self-impl.rs [deleted file]
src/test/run-pass/self/self-in-mut-slot-default-method.rs [deleted file]
src/test/run-pass/self/self-in-mut-slot-immediate-value.rs [deleted file]
src/test/run-pass/self/self-in-typedefs.rs [deleted file]
src/test/run-pass/self/self-re-assign.rs [deleted file]
src/test/run-pass/self/self-shadowing-import.rs [deleted file]
src/test/run-pass/self/self-type-param.rs [deleted file]
src/test/run-pass/self/string-self-append.rs [deleted file]
src/test/run-pass/self/ufcs-explicit-self.rs [deleted file]
src/test/run-pass/self/uniq-self-in-mut-slot.rs [deleted file]
src/test/run-pass/self/where-for-self.rs [deleted file]
src/test/run-pass/signal-alternate-stack-cleanup.rs
src/test/run-pass/signal-exit-status.rs
src/test/run-pass/sigpipe-should-be-ignored.rs
src/test/run-pass/simd/simd-target-feature-mixup.rs
src/test/run-pass/sleep.rs
src/test/run-pass/stack-probes-lto.rs
src/test/run-pass/stack-probes.rs
src/test/run-pass/stdio-is-blocking.rs
src/test/run-pass/structs-enums/rec-align-u64.rs
src/test/run-pass/tcp-stress.rs
src/test/run-pass/threads-sendsync/sync-send-in-std.rs
src/test/run-pass/try-wait.rs
src/test/run-pass/union/union-nonzero.rs [new file with mode: 0644]
src/test/run-pass/wait-forked-but-failed-child.rs
src/test/run-pass/x86stdcall.rs
src/test/rustdoc-ui/doc-without-codeblock.rs
src/test/rustdoc-ui/doc-without-codeblock.stderr
src/test/rustdoc-ui/failed-doctest-output.stdout
src/test/rustdoc-ui/lint-missing-doc-code-example.rs [new file with mode: 0644]
src/test/rustdoc-ui/lint-missing-doc-code-example.stderr [new file with mode: 0644]
src/test/rustdoc-ui/unparseable-doc-test.stdout
src/test/rustdoc/async-move-doctest.rs [new file with mode: 0644]
src/test/rustdoc/attributes.rs
src/test/rustdoc/generic-const.rs [new file with mode: 0644]
src/test/rustdoc/intra-link-libstd-re-export.rs [new file with mode: 0644]
src/test/rustdoc/playground-arg.rs
src/test/rustdoc/playground.rs
src/test/ui/arbitrary-self-types-not-object-safe.rs [deleted file]
src/test/ui/arbitrary-self-types-not-object-safe.stderr [deleted file]
src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr [new file with mode: 0644]
src/test/ui/await-keyword/2018-edition-error-in-non-macro-position.rs
src/test/ui/await-keyword/2018-edition-error-in-non-macro-position.stderr
src/test/ui/await-keyword/2018-edition-error.rs
src/test/ui/await-keyword/2018-edition-error.stderr
src/test/ui/await-keyword/incorrect-syntax-suggestions.rs [new file with mode: 0644]
src/test/ui/await-keyword/incorrect-syntax-suggestions.stderr [new file with mode: 0644]
src/test/ui/await-keyword/post_expansion_error.stderr
src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-describe-lvalue.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-issue-48962.rs
src/test/ui/borrowck/borrowck-issue-48962.stderr
src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/issue-10876.rs
src/test/ui/borrowck/issue-51348-multi-ref-mut-in-guard.rs
src/test/ui/borrowck/issue-52713-bug.rs
src/test/ui/borrowck/issue-52713-bug.stderr
src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs
src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr
src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr [deleted file]
src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs
src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr [new file with mode: 0644]
src/test/ui/borrowck/issue-7573.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/two-phase-across-loop.rs
src/test/ui/borrowck/two-phase-across-loop.stderr
src/test/ui/borrowck/two-phase-multi-mut.rs
src/test/ui/borrowck/two-phase-multi-mut.stderr
src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.nll.stderr [new file with mode: 0644]
src/test/ui/c-variadic/variadic-ffi-4.nll.stderr [new file with mode: 0644]
src/test/ui/c-variadic/variadic-ffi-5.rs [deleted file]
src/test/ui/c-variadic/variadic-ffi-5.stderr [deleted file]
src/test/ui/cdylib-deps-must-be-static.rs
src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr [new file with mode: 0644]
src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr [new file with mode: 0644]
src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr [new file with mode: 0644]
src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs
src/test/ui/consts/const_let_refutable.nll.stderr [new file with mode: 0644]
src/test/ui/consts/issue-54224.rs
src/test/ui/consts/issue-54224.stderr
src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr [new file with mode: 0644]
src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr [new file with mode: 0644]
src/test/ui/consts/promote_evaluation_unused_result.rs
src/test/ui/consts/promote_fn_calls.rs
src/test/ui/consts/promote_fn_calls_std.rs
src/test/ui/consts/std/alloc.rs [new file with mode: 0644]
src/test/ui/consts/std/alloc.stderr [new file with mode: 0644]
src/test/ui/continue-after-missing-main.nll.stderr [new file with mode: 0644]
src/test/ui/empty/empty-never-array.nll.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0502.nll.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr [new file with mode: 0644]
src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr [new file with mode: 0644]
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/generator/auto-trait-regions.nll.stderr [new file with mode: 0644]
src/test/ui/generator/generator-region-requirements.nll.stderr [deleted file]
src/test/ui/generator/generator-region-requirements.rs
src/test/ui/generator/generator-region-requirements.stderr [new file with mode: 0644]
src/test/ui/generator/generator-with-nll.rs
src/test/ui/generator/generator-with-nll.stderr
src/test/ui/hashmap-iter-value-lifetime.nll.stderr [new file with mode: 0644]
src/test/ui/hashmap-lifetimes.nll.stderr [new file with mode: 0644]
src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr [new file with mode: 0644]
src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr [new file with mode: 0644]
src/test/ui/hrtb/hrtb-cache-issue-54302.nll.stderr [new file with mode: 0644]
src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr [new file with mode: 0644]
src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr [new file with mode: 0644]
src/test/ui/impl-trait/closure-calling-parent-fn.rs
src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr [new file with mode: 0644]
src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs
src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs
src/test/ui/impl-trait/region-escape-via-bound.rs
src/test/ui/impl-trait/region-escape-via-bound.stderr
src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr [new file with mode: 0644]
src/test/ui/impl-trait/type_parameters_captured.nll.stderr [new file with mode: 0644]
src/test/ui/imports/extern-crate-used.rs
src/test/ui/imports/extern-crate-used.stderr
src/test/ui/in-band-lifetimes/mismatched.nll.stderr [new file with mode: 0644]
src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr [new file with mode: 0644]
src/test/ui/issue-60622.rs [new file with mode: 0644]
src/test/ui/issue-60622.stderr [new file with mode: 0644]
src/test/ui/issues/issue-10291.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-13058.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-15034.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-15381.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-16683.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-17728.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-17758.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-20091.rs
src/test/ui/issues/issue-26217.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-28848.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-32709.stderr
src/test/ui/issues/issue-34721.rs
src/test/ui/issues/issue-34721.stderr
src/test/ui/issues/issue-39175.rs
src/test/ui/issues/issue-39175.stderr
src/test/ui/issues/issue-40510-1.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-1.migrate.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-1.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-1.rs
src/test/ui/issues/issue-40510-1.stderr [deleted file]
src/test/ui/issues/issue-40510-3.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-3.migrate.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-3.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-3.rs
src/test/ui/issues/issue-40510-3.stderr [deleted file]
src/test/ui/issues/issue-43355.rs
src/test/ui/issues/issue-43355.stderr
src/test/ui/issues/issue-45696-no-variant-box-recur.rs
src/test/ui/issues/issue-46036.rs
src/test/ui/issues/issue-46036.stderr
src/test/ui/issues/issue-46983.rs
src/test/ui/issues/issue-46983.stderr
src/test/ui/issues/issue-47184.rs
src/test/ui/issues/issue-47184.stderr
src/test/ui/issues/issue-47377.stderr
src/test/ui/issues/issue-47380.stderr
src/test/ui/issues/issue-47646.rs
src/test/ui/issues/issue-47646.stderr
src/test/ui/issues/issue-47703-1.rs
src/test/ui/issues/issue-47703-tuple.rs
src/test/ui/issues/issue-47703.rs
src/test/ui/issues/issue-47722.rs
src/test/ui/issues/issue-47789.rs
src/test/ui/issues/issue-48132.rs
src/test/ui/issues/issue-48179.rs
src/test/ui/issues/issue-48803.rs
src/test/ui/issues/issue-48803.stderr
src/test/ui/issues/issue-49579.rs
src/test/ui/issues/issue-49824.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-51515.rs
src/test/ui/issues/issue-51515.stderr
src/test/ui/issues/issue-51719.rs
src/test/ui/issues/issue-51719.stderr
src/test/ui/issues/issue-51751.stderr
src/test/ui/issues/issue-52057.rs
src/test/ui/issues/issue-52213.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-52533-1.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-52533.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-52992.rs
src/test/ui/issues/issue-53568.rs
src/test/ui/issues/issue-54302-cases.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-54302.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-54943-1.rs
src/test/ui/issues/issue-54943-2.rs
src/test/ui/issues/issue-54943.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-54943.rs
src/test/ui/issues/issue-54943.stderr
src/test/ui/issues/issue-55731.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-55796.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-57843.nll.stderr [new file with mode: 0644]
src/test/ui/kindck/kindck-impl-type-params.nll.stderr [new file with mode: 0644]
src/test/ui/kindck/kindck-send-object1.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr [new file with mode: 0644]
src/test/ui/linkage2.rs
src/test/ui/linkage2.stderr
src/test/ui/lub-if.nll.stderr [new file with mode: 0644]
src/test/ui/lub-match.nll.stderr [new file with mode: 0644]
src/test/ui/match/match-ref-mut-invariance.nll.stderr [new file with mode: 0644]
src/test/ui/match/match-ref-mut-let-invariance.nll.stderr [new file with mode: 0644]
src/test/ui/mir-dataflow/def-inits-1.rs
src/test/ui/mir-dataflow/def-inits-1.stderr
src/test/ui/mir-dataflow/inits-1.rs
src/test/ui/mir-dataflow/inits-1.stderr
src/test/ui/mir-dataflow/uninits-1.rs
src/test/ui/mir-dataflow/uninits-1.stderr
src/test/ui/mir-dataflow/uninits-2.rs
src/test/ui/mir-dataflow/uninits-2.stderr
src/test/ui/nll/borrow-use-issue-46875.rs
src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs
src/test/ui/nll/borrowed-local-error.rs
src/test/ui/nll/borrowed-local-error.stderr
src/test/ui/nll/borrowed-referent-issue-38899.rs
src/test/ui/nll/borrowed-referent-issue-38899.stderr
src/test/ui/nll/borrowed-temporary-error.rs
src/test/ui/nll/borrowed-temporary-error.stderr
src/test/ui/nll/borrowed-universal-error-2.rs
src/test/ui/nll/borrowed-universal-error-2.stderr
src/test/ui/nll/borrowed-universal-error.rs
src/test/ui/nll/borrowed-universal-error.stderr
src/test/ui/nll/capture-mut-ref.rs
src/test/ui/nll/capture-mut-ref.stderr
src/test/ui/nll/capture-ref-in-struct.rs
src/test/ui/nll/capture-ref-in-struct.stderr
src/test/ui/nll/closure-access-spans.rs
src/test/ui/nll/closure-access-spans.stderr
src/test/ui/nll/closure-borrow-spans.rs
src/test/ui/nll/closure-borrow-spans.stderr
src/test/ui/nll/closure-captures.rs
src/test/ui/nll/closure-captures.stderr
src/test/ui/nll/closure-move-spans.rs
src/test/ui/nll/closure-move-spans.stderr
src/test/ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs
src/test/ui/nll/closure-requirements/propagate-multiple-requirements.rs
src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr
src/test/ui/nll/closure-use-spans.rs
src/test/ui/nll/closure-use-spans.stderr
src/test/ui/nll/closures-in-loops.rs
src/test/ui/nll/closures-in-loops.stderr
src/test/ui/nll/constant-thread-locals-issue-47053.rs
src/test/ui/nll/constant-thread-locals-issue-47053.stderr
src/test/ui/nll/decl-macro-illegal-copy.rs
src/test/ui/nll/decl-macro-illegal-copy.stderr
src/test/ui/nll/get_default.nll.stderr [new file with mode: 0644]
src/test/ui/nll/issue-16223.rs
src/test/ui/nll/issue-21114-ebfull.rs
src/test/ui/nll/issue-21114-kixunil.rs
src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.rs
src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr
src/test/ui/nll/issue-22323-temp-destruction.rs
src/test/ui/nll/issue-30104.rs
src/test/ui/nll/issue-32382-index-assoc-type-with-lifetime.rs
src/test/ui/nll/issue-43058.rs
src/test/ui/nll/issue-46589.rs
src/test/ui/nll/issue-46589.stderr
src/test/ui/nll/issue-47022.rs
src/test/ui/nll/issue-47388.rs
src/test/ui/nll/issue-47388.stderr
src/test/ui/nll/issue-47470.rs
src/test/ui/nll/issue-47470.stderr
src/test/ui/nll/issue-48070.rs
src/test/ui/nll/issue-48697.rs
src/test/ui/nll/issue-48697.stderr
src/test/ui/nll/issue-50716-1.rs
src/test/ui/nll/issue-50716.nll.stderr [new file with mode: 0644]
src/test/ui/nll/issue-50716.rs
src/test/ui/nll/issue-50716.stderr
src/test/ui/nll/issue-51191.rs
src/test/ui/nll/issue-51191.stderr
src/test/ui/nll/issue-51244.rs
src/test/ui/nll/issue-51244.stderr
src/test/ui/nll/issue-51268.rs
src/test/ui/nll/issue-51268.stderr
src/test/ui/nll/issue-51351.rs
src/test/ui/nll/issue-51512.rs
src/test/ui/nll/issue-51512.stderr
src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.rs
src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr
src/test/ui/nll/issue-52078.rs
src/test/ui/nll/issue-52086.rs
src/test/ui/nll/issue-52086.stderr
src/test/ui/nll/issue-52113.rs
src/test/ui/nll/issue-52113.stderr
src/test/ui/nll/issue-52534-1.rs
src/test/ui/nll/issue-52534-1.stderr
src/test/ui/nll/issue-52534-2.rs
src/test/ui/nll/issue-52534-2.stderr
src/test/ui/nll/issue-52534.rs
src/test/ui/nll/issue-52534.stderr
src/test/ui/nll/issue-52663-span-decl-captured-variable.rs
src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr
src/test/ui/nll/issue-52663-trait-object.rs
src/test/ui/nll/issue-52663-trait-object.stderr
src/test/ui/nll/issue-52669.rs
src/test/ui/nll/issue-52669.stderr
src/test/ui/nll/issue-52742.nll.stderr [new file with mode: 0644]
src/test/ui/nll/issue-52742.rs
src/test/ui/nll/issue-52742.stderr
src/test/ui/nll/issue-53119.rs
src/test/ui/nll/issue-53570.rs
src/test/ui/nll/issue-55288.rs
src/test/ui/nll/issue-55344.rs
src/test/ui/nll/issue-55394.nll.stderr [new file with mode: 0644]
src/test/ui/nll/issue-55394.rs
src/test/ui/nll/issue-55394.stderr
src/test/ui/nll/issue-55401.nll.stderr [new file with mode: 0644]
src/test/ui/nll/issue-55401.rs
src/test/ui/nll/issue-55401.stderr
src/test/ui/nll/issue-57265-return-type-wf-check.rs
src/test/ui/nll/issue-57265-return-type-wf-check.stderr
src/test/ui/nll/issue-57280-1.rs
src/test/ui/nll/issue-57280.rs
src/test/ui/nll/issue-57989.rs
src/test/ui/nll/issue-57989.stderr
src/test/ui/nll/issue-58053.rs
src/test/ui/nll/issue-58053.stderr
src/test/ui/nll/issue-58299.rs
src/test/ui/nll/issue-58299.stderr
src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs
src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr
src/test/ui/nll/move-errors.rs
src/test/ui/nll/move-errors.stderr
src/test/ui/nll/move-subpaths-moves-root.rs
src/test/ui/nll/move-subpaths-moves-root.stderr
src/test/ui/nll/normalization-bounds-error.rs
src/test/ui/nll/normalization-bounds-error.stderr
src/test/ui/nll/normalization-bounds.rs
src/test/ui/nll/promotable-mutable-zst-doesnt-conflict.rs
src/test/ui/nll/promoted-bounds.rs
src/test/ui/nll/promoted-bounds.stderr
src/test/ui/nll/promoted-closure-pair.rs
src/test/ui/nll/promoted-closure-pair.stderr
src/test/ui/nll/region-ends-after-if-condition.nll.stderr [new file with mode: 0644]
src/test/ui/nll/relate_tys/issue-48071.rs
src/test/ui/nll/relate_tys/var-appears-twice.rs
src/test/ui/nll/relate_tys/var-appears-twice.stderr
src/test/ui/nll/return-ref-mut-issue-46557.rs
src/test/ui/nll/return-ref-mut-issue-46557.stderr
src/test/ui/nll/ty-outlives/issue-53789-1.rs
src/test/ui/nll/ty-outlives/issue-53789-2.rs
src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.nll.stderr [new file with mode: 0644]
src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs
src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr
src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr [new file with mode: 0644]
src/test/ui/nll/ty-outlives/projection-where-clause-env.rs
src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs [deleted file]
src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr [deleted file]
src/test/ui/nll/type-alias-free-regions.nll.stderr [new file with mode: 0644]
src/test/ui/nll/type-alias-free-regions.rs
src/test/ui/nll/type-alias-free-regions.stderr
src/test/ui/nll/unused-mut-issue-50343.rs
src/test/ui/nll/unused-mut-issue-50343.stderr
src/test/ui/nll/user-annotations/adt-brace-enums.rs
src/test/ui/nll/user-annotations/adt-brace-enums.stderr
src/test/ui/nll/user-annotations/adt-brace-structs.rs
src/test/ui/nll/user-annotations/adt-brace-structs.stderr
src/test/ui/nll/user-annotations/adt-nullary-enums.rs
src/test/ui/nll/user-annotations/adt-nullary-enums.stderr
src/test/ui/nll/user-annotations/adt-tuple-enums.rs
src/test/ui/nll/user-annotations/adt-tuple-enums.stderr
src/test/ui/nll/user-annotations/adt-tuple-struct.rs
src/test/ui/nll/user-annotations/adt-tuple-struct.stderr
src/test/ui/nll/user-annotations/cast_static_lifetime.rs
src/test/ui/nll/user-annotations/cast_static_lifetime.stderr
src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr [new file with mode: 0644]
src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs
src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr
src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs
src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr
src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr [new file with mode: 0644]
src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs
src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr
src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr [new file with mode: 0644]
src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs
src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr
src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr [new file with mode: 0644]
src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs
src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr
src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr [new file with mode: 0644]
src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs
src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr
src/test/ui/nll/user-annotations/fns.rs
src/test/ui/nll/user-annotations/fns.stderr
src/test/ui/nll/user-annotations/issue-54570-bootstrapping.rs
src/test/ui/nll/user-annotations/issue-55219.rs
src/test/ui/nll/user-annotations/issue-55241.rs
src/test/ui/nll/user-annotations/method-call.rs
src/test/ui/nll/user-annotations/method-call.stderr
src/test/ui/nll/user-annotations/method-ufcs-1.rs
src/test/ui/nll/user-annotations/method-ufcs-1.stderr
src/test/ui/nll/user-annotations/method-ufcs-2.rs
src/test/ui/nll/user-annotations/method-ufcs-2.stderr
src/test/ui/nll/user-annotations/method-ufcs-3.rs
src/test/ui/nll/user-annotations/method-ufcs-3.stderr
src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs
src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr
src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs
src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr
src/test/ui/nll/user-annotations/normalization.rs
src/test/ui/nll/user-annotations/normalization.stderr
src/test/ui/nll/user-annotations/normalize-self-ty.rs
src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs
src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr
src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.rs
src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr
src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.rs
src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr
src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.rs
src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr
src/test/ui/nll/user-annotations/promoted-annotation.rs
src/test/ui/nll/user-annotations/promoted-annotation.stderr
src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs
src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr
src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr [new file with mode: 0644]
src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr [new file with mode: 0644]
src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr [new file with mode: 0644]
src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr [new file with mode: 0644]
src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr [new file with mode: 0644]
src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs
src/test/ui/pattern/pattern-bindings-after-at.nll.stderr [new file with mode: 0644]
src/test/ui/print_type_sizes/niche-filling.rs
src/test/ui/print_type_sizes/niche-filling.stdout
src/test/ui/recursion/recursive-types-are-not-uninhabited.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-object-lifetime-2.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-object-lifetime-4.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-addr-of-self.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-bounds.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-object-into-object-2.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-object-into-object-4.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-object-into-object-5.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-param-into-object.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-creating-enums3.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-creating-enums4.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-early-bound-error-method.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-early-bound-error.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-escape-method.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-call-3.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-not-param.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-nested-fns.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-outlives-projection-container.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-ret-borrowed-1.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-ret-borrowed.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-static-bound.ll.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-static-bound.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-trait-object-subtyping.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr [new file with mode: 0644]
src/test/ui/rfc-0107-bind-by-move-pattern-guards/bind-by-move-no-guards.rs
src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-basic-examples.rs
src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr [new file with mode: 0644]
src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs
src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed
src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.rs
src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr
src/test/ui/rust-2018/remove-extern-crate.fixed
src/test/ui/rust-2018/remove-extern-crate.rs
src/test/ui/rust-2018/remove-extern-crate.stderr
src/test/ui/self/arbitrary-self-types-not-object-safe.rs [new file with mode: 0644]
src/test/ui/self/arbitrary-self-types-not-object-safe.stderr [new file with mode: 0644]
src/test/ui/self/arbitrary_self_types_pointers_and_wrappers.rs [new file with mode: 0644]
src/test/ui/self/arbitrary_self_types_raw_pointer_struct.rs [new file with mode: 0644]
src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs [new file with mode: 0644]
src/test/ui/self/arbitrary_self_types_silly.rs [new file with mode: 0644]
src/test/ui/self/arbitrary_self_types_stdlib_pointers.rs [new file with mode: 0644]
src/test/ui/self/arbitrary_self_types_struct.rs [new file with mode: 0644]
src/test/ui/self/arbitrary_self_types_trait.rs [new file with mode: 0644]
src/test/ui/self/arbitrary_self_types_unsized_struct.rs [new file with mode: 0644]
src/test/ui/self/auxiliary/explicit_self_xcrate.rs [new file with mode: 0644]
src/test/ui/self/builtin-superkinds-self-type.rs [new file with mode: 0644]
src/test/ui/self/by-value-self-in-mut-slot.rs [new file with mode: 0644]
src/test/ui/self/explicit-self-closures.rs [new file with mode: 0644]
src/test/ui/self/explicit-self-generic.rs [new file with mode: 0644]
src/test/ui/self/explicit-self-objects-uniq.rs [new file with mode: 0644]
src/test/ui/self/explicit-self.rs [new file with mode: 0644]
src/test/ui/self/explicit_self_xcrate_exe.rs [new file with mode: 0644]
src/test/ui/self/move-self.rs [new file with mode: 0644]
src/test/ui/self/object-safety-sized-self-by-value-self.rs [new file with mode: 0644]
src/test/ui/self/object-safety-sized-self-generic-method.rs [new file with mode: 0644]
src/test/ui/self/object-safety-sized-self-return-Self.rs [new file with mode: 0644]
src/test/ui/self/self-impl-2.rs [new file with mode: 0644]
src/test/ui/self/self-in-mut-slot-default-method.rs [new file with mode: 0644]
src/test/ui/self/self-in-mut-slot-immediate-value.rs [new file with mode: 0644]
src/test/ui/self/self-in-typedefs.rs [new file with mode: 0644]
src/test/ui/self/self-re-assign.rs [new file with mode: 0644]
src/test/ui/self/self-shadowing-import.rs [new file with mode: 0644]
src/test/ui/self/self-type-param.rs [new file with mode: 0644]
src/test/ui/self/string-self-append.rs [new file with mode: 0644]
src/test/ui/self/ufcs-explicit-self.rs [new file with mode: 0644]
src/test/ui/self/uniq-self-in-mut-slot.rs [new file with mode: 0644]
src/test/ui/self/where-for-self.rs [new file with mode: 0644]
src/test/ui/span/issue-39018.rs
src/test/ui/span/issue-39018.stderr
src/test/ui/str/str-concat-on-double-ref.stderr
src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs
src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr
src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs
src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr
src/test/ui/suggestions/dont-suggest-ref/simple.rs
src/test/ui/suggestions/dont-suggest-ref/simple.stderr
src/test/ui/suggestions/issue-57672.rs [new file with mode: 0644]
src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr [new file with mode: 0644]
src/test/ui/suggestions/suggest-ref-mut.rs
src/test/ui/suggestions/suggest-ref-mut.stderr
src/test/ui/thread-local-in-ctfe.nll.stderr [new file with mode: 0644]
src/test/ui/try-block/try-block-bad-type.stderr
src/test/ui/try-on-option.stderr
src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr [new file with mode: 0644]
src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr [new file with mode: 0644]
src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-btree-invariant-types.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-cell-is-invariant.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-contravariant-arg-object.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-covariant-arg-object.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-invariant-arg-object.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-trait-matching.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr [new file with mode: 0644]
src/test/ui/wf/wf-static-method.nll.stderr [new file with mode: 0644]
src/tools/cargo
src/tools/clippy
src/tools/compiletest/Cargo.toml
src/tools/compiletest/src/main.rs
src/tools/compiletest/src/runtest.rs
src/tools/error_index_generator/main.rs
src/tools/miri
src/tools/rls
src/tools/rustbook/Cargo.toml
src/tools/rustc-std-workspace-alloc/Cargo.toml
src/tools/rustc-std-workspace-core/Cargo.toml
src/tools/rustc-workspace-hack/Cargo.toml
src/tools/unstable-book-gen/Cargo.toml
triagebot.toml

index 4417c25abcb4eaac7951d944540cbd586fdbd8f0..db9f0069ced0c1c41f107d2625a618fdc23944d9 100644 (file)
@@ -13,11 +13,19 @@ dependencies = [
  "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "aho-corasick"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "alloc"
 version = "0.0.0"
 dependencies = [
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
  "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -115,7 +123,7 @@ version = "0.1.27"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-std-workspace-core 1.0.0",
 ]
@@ -181,6 +189,14 @@ dependencies = [
  "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "bstr"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "bufstream"
 version = "0.1.4"
@@ -246,7 +262,7 @@ dependencies = [
  "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "crates-io 0.25.0",
- "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "curl 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)",
  "curl-sys 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -261,7 +277,7 @@ dependencies = [
  "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "ignore 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ignore 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "im-rc 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "jobserver 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -373,7 +389,7 @@ dependencies = [
  "compiletest_rs 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
  "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-workspace-hack 1.0.0",
  "rustc_tools_util 0.1.1",
  "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -395,7 +411,7 @@ dependencies = [
  "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "pulldown-cmark 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -446,7 +462,7 @@ dependencies = [
 
 [[package]]
 name = "compiler_builtins"
-version = "0.1.12"
+version = "0.1.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -459,13 +475,12 @@ version = "0.0.0"
 dependencies = [
  "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
- "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "getopts 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustfix 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -484,7 +499,7 @@ dependencies = [
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustfix 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -551,13 +566,10 @@ dependencies = [
 
 [[package]]
 name = "crossbeam-channel"
-version = "0.3.4"
+version = "0.3.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -576,7 +588,7 @@ version = "0.6.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -600,7 +612,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -616,10 +628,11 @@ dependencies = [
 
 [[package]]
 name = "crossbeam-utils"
-version = "0.6.2"
+version = "0.6.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -731,7 +744,7 @@ name = "dlmalloc"
 version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-std-workspace-core 1.0.0",
 ]
@@ -747,7 +760,7 @@ version = "2.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -779,7 +792,7 @@ dependencies = [
  "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -791,7 +804,7 @@ dependencies = [
  "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -897,7 +910,7 @@ name = "fortanix-sgx-abi"
 version = "0.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-std-workspace-core 1.0.0",
 ]
 
@@ -1008,14 +1021,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "globset"
-version = "0.4.2"
+version = "0.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "bstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1032,7 +1045,7 @@ dependencies = [
  "pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -1047,7 +1060,7 @@ dependencies = [
  "pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
  "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1058,7 +1071,7 @@ name = "hashbrown"
 version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-std-workspace-alloc 1.0.0",
  "rustc-std-workspace-core 1.0.0",
 ]
@@ -1133,19 +1146,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "ignore"
-version = "0.4.6"
+version = "0.4.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "crossbeam-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "globset 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1469,7 +1482,7 @@ dependencies = [
  "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1759,7 +1772,7 @@ dependencies = [
 name = "panic_abort"
 version = "0.0.0"
 dependencies = [
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -1769,7 +1782,7 @@ name = "panic_unwind"
 version = "0.0.0"
 dependencies = [
  "alloc 0.0.0",
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
  "unwind 0.0.0",
@@ -1954,7 +1967,7 @@ name = "profiler_builtins"
 version = "0.0.0"
 dependencies = [
  "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
 
@@ -1972,7 +1985,7 @@ dependencies = [
  "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "rusty-fork 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -2180,12 +2193,12 @@ dependencies = [
 
 [[package]]
 name = "regex"
-version = "1.1.0"
+version = "1.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -2200,7 +2213,7 @@ dependencies = [
 
 [[package]]
 name = "regex-syntax"
-version = "0.6.4"
+version = "0.6.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2229,7 +2242,7 @@ dependencies = [
  "cargo 0.37.0",
  "cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "clippy_lints 0.0.212",
- "crossbeam-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2247,7 +2260,7 @@ dependencies = [
  "racer 2.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-analysis 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-data 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2479,7 +2492,7 @@ name = "rustc-demangle"
 version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-std-workspace-core 1.0.0",
 ]
 
@@ -2607,7 +2620,7 @@ dependencies = [
  "alloc 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
 
@@ -2837,7 +2850,7 @@ dependencies = [
  "alloc 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
 
@@ -2899,7 +2912,7 @@ dependencies = [
  "alloc 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
 
@@ -3016,7 +3029,7 @@ dependencies = [
  "alloc 0.0.0",
  "build_helper 0.1.0",
  "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
 
@@ -3090,11 +3103,11 @@ dependencies = [
  "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "getopts 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "ignore 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ignore 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-ap-rustc_target 407.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-ap-syntax 407.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-ap-syntax_pos 407.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3130,7 +3143,7 @@ name = "same-file"
 version = "1.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -3285,7 +3298,7 @@ dependencies = [
  "alloc 0.0.0",
  "backtrace-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
  "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
  "dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3551,7 +3564,7 @@ dependencies = [
 name = "tidy"
 version = "0.1.0"
 dependencies = [
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -3612,7 +3625,7 @@ name = "tokio-executor"
 version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -3656,7 +3669,7 @@ name = "tokio-reactor"
 version = "0.1.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3702,9 +3715,9 @@ name = "tokio-threadpool"
 version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "crossbeam-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3717,7 +3730,7 @@ name = "tokio-timer"
 version = "0.2.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
  "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3790,7 +3803,7 @@ dependencies = [
  "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -3876,7 +3889,7 @@ name = "unwind"
 version = "0.0.0"
 dependencies = [
  "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
- "compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
  "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -3955,7 +3968,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -3984,7 +3997,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "winapi-util"
-version = "0.1.1"
+version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -4001,7 +4014,7 @@ version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -4037,6 +4050,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 [metadata]
 "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
 "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
+"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c"
 "checksum ammonia 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd4c682378117e4186a492b2252b9537990e1617f44aed9788b9a1149de45477"
 "checksum annotate-snippets 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e8bcdcd5b291ce85a78f2b9d082a8de9676c12b1840d386d67bc5eea6f9d2b4e"
 "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
@@ -4053,6 +4067,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
 "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400"
 "checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab"
+"checksum bstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "853b090ce0f45d0265902666bf88039ea3da825e33796716c511a1ec9c170036"
 "checksum bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8"
 "checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39"
 "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40"
@@ -4072,20 +4087,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc"
 "checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007"
 "checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2"
-"checksum compiler_builtins 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "6549720ae78db799196d4af8f719facb4c7946710b4b64148482553e54b56d15"
+"checksum compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "e3f235c329e5cb9fa3d2ca2cc36256ba9a7f23fa76e0f4db6f68c23b73b2ac69"
 "checksum compiletest_rs 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "f40ecc9332b68270998995c00f8051ee856121764a0d3230e64c9efd059d27b6"
 "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e"
 "checksum core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887"
 "checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
 "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
 "checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192"
-"checksum crossbeam-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5b2a9ea8f77c7f9efd317a8a5645f515d903a2d86ee14d2337a5facd1bd52c12"
+"checksum crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0f0ed1a4de2235cabda8558ff5840bffb97fcb64c97827f354a451307df5f72b"
 "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
 "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13"
 "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150"
 "checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c"
 "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
-"checksum crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e07fc155212827475223f0bcfae57e945e694fc90950ddf3f6695bbfd5555c72"
+"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c"
 "checksum crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "09de9ee0fc255ace04c7fa0763c9395a945c37c8292bb554f8d48361d1dcf1b4"
 "checksum curl 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)" = "a85f2f95f2bd277d316d1aa8a477687ab4a6942258c7db7c89c187534669979c"
 "checksum curl-sys 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)" = "9d91a0052d5b982887d8e829bee0faffc7218ea3c6ebd3d6c2c8f678a93c9a42"
@@ -4129,7 +4144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum git2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7339329bfa14a00223244311560d11f8f489b453fb90092af97f267a6090ab0"
 "checksum git2-curl 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d58551e903ed7e2d6fe3a2f3c7efa3a784ec29b19d0fbb035aaf0497c183fbdd"
 "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
-"checksum globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4743617a7464bbda3c8aec8558ff2f9429047e025771037df561d383337ff865"
+"checksum globset 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef4feaabe24a0a658fd9cf4a9acf6ed284f045c77df0f49020ba3245cfb7b454"
 "checksum handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d89ec99d1594f285d4590fc32bac5f75cdab383f1123d504d27862c644a807dd"
 "checksum handlebars 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d82e5750d8027a97b9640e3fefa66bbaf852a35228e1c90790efd13c4b09c166"
 "checksum hashbrown 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "570178d5e4952010d138b0f1d581271ff3a02406d990f887d1e87e3d6e43b0ac"
@@ -4141,7 +4156,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114"
 "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
 "checksum if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4bac95d9aa0624e7b78187d6fb8ab012b41d9f6f54b1bcb61e61c4845f8357ec"
-"checksum ignore 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ad03ca67dc12474ecd91fdb94d758cbd20cb4e7a78ebe831df26a9b7511e1162"
+"checksum ignore 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8dc57fa12805f367736a38541ac1a9fc6a52812a0ca959b1d4d4b640a89eb002"
 "checksum im-rc 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9460397452f537fd51808056ff209f4c4c4c9d20d42ae952f517708726284972"
 "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
 "checksum is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5b386aef33a1c677be65237cb9d32c3f3ef56bd035949710c4bb13083eb053"
@@ -4247,9 +4262,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
 "checksum redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "214a97e49be64fd2c86f568dd0cb2c757d2cc53de95b273b6ad0a1c908482f26"
 "checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384"
-"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f"
+"checksum regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58"
 "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7"
-"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1"
+"checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96"
 "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
 "checksum rls-analysis 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d53d49a28f75da9d02790d9256fecf6c0481e0871374326023c7a33131295579"
 "checksum rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ce1fdac03e138c4617ff87b194e1ff57a39bb985a044ccbd8673d30701e411"
@@ -4363,7 +4378,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
 "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
 "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab"
+"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba"
 "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
index 48bd13105bbea92a5b431359095b3863c908cbb5..4185961187b395d277272a31763c25d22662df16 100644 (file)
+Version 1.35.0 (2019-05-23)
+==========================
+
+Language
+--------
+- [`FnOnce`, `FnMut`, and the `Fn` traits are now implemented for `Box<FnOnce>`,
+  `Box<FnMut>`, and `Box<Fn>` respectively.][59500]
+- [You can now coerce closures into unsafe function pointers.][59580] e.g.
+  ```rust
+  unsafe fn call_unsafe(func: unsafe fn()) {
+      func()
+  }
+
+  pub fn main() {
+      unsafe { call_unsafe(|| {}); }
+  }
+  ```
+
+
+Compiler
+--------
+- [Added the `armv6-unknown-freebsd-gnueabihf` and
+  `armv7-unknown-freebsd-gnueabihf` targets.][58080]
+- [Added the `wasm32-unknown-wasi` target.][59464]
+
+
+Libraries
+---------
+- [`Thread` will now show its ID in `Debug` output.][59460]
+- [`StdinLock`, `StdoutLock`, and `StderrLock` now implement `AsRawFd`.][59512]
+- [`alloc::System` now implements `Default`.][59451]
+- [Expanded `Debug` output (`{:#?}`) for structs now has a trailing comma on the
+  last field.][59076]
+- [`char::{ToLowercase, ToUppercase}` now
+  implement `ExactSizeIterator`.][58778]
+- [All `NonZero` numeric types now implement `FromStr`.][58717]
+- [Removed the `Read` trait bounds
+  on the `BufReader::{get_ref, get_mut, into_inner}` methods.][58423]
+- [You can now call the `dbg!` macro without any parameters to print the file
+  and line where it is called.][57847]
+- [In place ASCII case conversions are now up to 4× faster.][59283]
+  e.g. `str::make_ascii_lowercase`
+- [`hash_map::{OccupiedEntry, VacantEntry}` now implement `Sync`
+  and `Send`.][58369]
+
+Stabilized APIs
+---------------
+- [`f32::copysign`]
+- [`f64::copysign`]
+- [`RefCell::replace_with`]
+- [`RefCell::map_split`]
+- [`ptr::hash`]
+- [`Range::contains`]
+- [`RangeFrom::contains`]
+- [`RangeTo::contains`]
+- [`RangeInclusive::contains`]
+- [`RangeToInclusive::contains`]
+- [`Option::copied`]
+
+Cargo
+-----
+- [You can now set `cargo:rustc-cdylib-link-arg` at build time to pass custom
+  linker arguments when building a `cdylib`.][cargo/6298] Its usage is highly
+  platform specific.
+  
+Misc
+----
+- [The Rust toolchain is now available natively for musl based distros.][58575]
+
+[59460]: https://github.com/rust-lang/rust/pull/59460/
+[59464]: https://github.com/rust-lang/rust/pull/59464/
+[59500]: https://github.com/rust-lang/rust/pull/59500/
+[59512]: https://github.com/rust-lang/rust/pull/59512/
+[59580]: https://github.com/rust-lang/rust/pull/59580/
+[59283]: https://github.com/rust-lang/rust/pull/59283/
+[59451]: https://github.com/rust-lang/rust/pull/59451/
+[59076]: https://github.com/rust-lang/rust/pull/59076/
+[58778]: https://github.com/rust-lang/rust/pull/58778/
+[58717]: https://github.com/rust-lang/rust/pull/58717/
+[58369]: https://github.com/rust-lang/rust/pull/58369/
+[58423]: https://github.com/rust-lang/rust/pull/58423/
+[58080]: https://github.com/rust-lang/rust/pull/58080/
+[57847]: https://github.com/rust-lang/rust/pull/57847/
+[58575]: https://github.com/rust-lang/rust/pull/58575
+[cargo/6298]: https://github.com/rust-lang/cargo/pull/6298/
+[`f32::copysign`]: https://doc.rust-lang.org/stable/std/primitive.f32.html#method.copysign
+[`f64::copysign`]: https://doc.rust-lang.org/stable/std/primitive.f64.html#method.copysign
+[`RefCell::replace_with`]: https://doc.rust-lang.org/stable/std/cell/struct.RefCell.html#method.replace_with
+[`RefCell::map_split`]: https://doc.rust-lang.org/stable/std/cell/struct.RefCell.html#method.map_split
+[`ptr::hash`]: https://doc.rust-lang.org/stable/std/ptr/fn.hash.html
+[`Range::contains`]: https://doc.rust-lang.org/std/ops/struct.Range.html#method.contains
+[`RangeFrom::contains`]: https://doc.rust-lang.org/std/ops/struct.RangeFrom.html#method.contains
+[`RangeTo::contains`]: https://doc.rust-lang.org/std/ops/struct.RangeTo.html#method.contains
+[`RangeInclusive::contains`]: https://doc.rust-lang.org/std/ops/struct.RangeInclusive.html#method.contains
+[`RangeToInclusive::contains`]: https://doc.rust-lang.org/std/ops/struct.RangeToInclusive.html#method.contains
+[`Option::copied`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.copied
+
 Version 1.34.2 (2019-05-14)
 ===========================
 
 * [Destabilize the `Error::type_id` function due to a security
-   vulnerability][60785]
+   vulnerability][60785] ([CVE-2019-12083])
 
 [60785]: https://github.com/rust-lang/rust/pull/60785
+[CVE-2019-12083]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-12083
 
 Version 1.34.1 (2019-04-25)
 ===========================
index 9c4e856f0b88b3a34da0ab7ce45a59452a080400..e1cdd226fd6e5ba3e78152d43fec41f0ba257358 100644 (file)
@@ -168,7 +168,7 @@ pub fn std_cargo(builder: &Builder<'_>,
             .arg("--manifest-path")
             .arg(builder.src.join("src/liballoc/Cargo.toml"))
             .arg("--features")
-            .arg("compiler-builtins-mem");
+            .arg("compiler-builtins-mem compiler-builtins-c");
     } else {
         let features = builder.std_features();
 
index 7826ac9471806043c1b00505e13cbe9ffab424c6..be0af8be7b272bc615aab84985faa07db286c449 100644 (file)
@@ -683,7 +683,7 @@ fn run(self, builder: &Builder<'_>) {
             target: self.target,
             mode: "ui",
             suite: "rustdoc-ui",
-            path: None,
+            path: Some("src/test/rustdoc-ui"),
             compare_mode: None,
         })
     }
index af0198705a2fefda34bf4f1ea5efc881078d2081..a0fe307cffcdb2187cfef2bace1998f6592b9bff 100755 (executable)
@@ -74,7 +74,9 @@ status_check() {
     check_dispatch $1 beta nomicon src/doc/nomicon
     check_dispatch $1 beta reference src/doc/reference
     check_dispatch $1 beta rust-by-example src/doc/rust-by-example
-    check_dispatch $1 beta edition-guide src/doc/edition-guide
+    # Temporarily disabled until
+    # https://github.com/rust-lang/rust/issues/60459 is fixed.
+    # check_dispatch $1 beta edition-guide src/doc/edition-guide
     check_dispatch $1 beta rls src/tools/rls
     check_dispatch $1 beta rustfmt src/tools/rustfmt
     check_dispatch $1 beta clippy-driver src/tools/clippy
index db919bc6bb9071566e9c4f05053672133eaac33e..29fe982990e43b9367be0ff47abc82fb2123fd03 160000 (submodule)
@@ -1 +1 @@
-Subproject commit db919bc6bb9071566e9c4f05053672133eaac33e
+Subproject commit 29fe982990e43b9367be0ff47abc82fb2123fd03
index c413d42a207bd082f801ec0137c31b71e4bfed4c..581c6cccfaf995394ea9dcac362dc8e731c18558 160000 (submodule)
@@ -1 +1 @@
-Subproject commit c413d42a207bd082f801ec0137c31b71e4bfed4c
+Subproject commit 581c6cccfaf995394ea9dcac362dc8e731c18558
index de3d55f521e657863df45260ebbca1b10527f662..9858872bd1b7dbba5ec27dc30d34eba00acd7ef9 160000 (submodule)
@@ -1 +1 @@
-Subproject commit de3d55f521e657863df45260ebbca1b10527f662
+Subproject commit 9858872bd1b7dbba5ec27dc30d34eba00acd7ef9
index fb29b147be4d9a1f8e24aba753a7e1de537abf61..c656171b749b7307f21371dd0d3278efee5573b8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit fb29b147be4d9a1f8e24aba753a7e1de537abf61
+Subproject commit c656171b749b7307f21371dd0d3278efee5573b8
index 2a2de9ce095979978ad7b582daecf94e4070b916..862b669c395822bb0938781d74f860e5762ad4fb 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 2a2de9ce095979978ad7b582daecf94e4070b916
+Subproject commit 862b669c395822bb0938781d74f860e5762ad4fb
index 1ff0f8e018838a710ebc0cc1a7bf74ebe73ad9f1..811c697b232c611ed754d279ed20643a0c4096f6 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 1ff0f8e018838a710ebc0cc1a7bf74ebe73ad9f1
+Subproject commit 811c697b232c611ed754d279ed20643a0c4096f6
index 99e1b1d53656be08654df399fc200584aebb50e4..3cb727b62b953d59b4360d39aa68b6dc8f157655 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 99e1b1d53656be08654df399fc200584aebb50e4
+Subproject commit 3cb727b62b953d59b4360d39aa68b6dc8f157655
index 46b717f3387d2ce95cb4c0d4d7f25ed0c1deac78..049e59b651722ab029e25365d6fc93e2c665cf57 100644 (file)
@@ -21,9 +21,9 @@ Here's a list of each lint group, and the lints that they are made up of:
 | edition-2018        | Lints that will be turned into errors in Rust 2018            | tyvar-behind-raw-pointer                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
 | rust-2018-idioms    | Lints to nudge you toward idiomatic features of Rust 2018     | bare-trait-object, unreachable-pub                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
 | unused              | These lints detect things being declared but not used         | unused-imports, unused-variables, unused-assignments, dead-code, unused-mut, unreachable-code, unreachable-patterns, unused-must-use, unused-unsafe, path-statements, unused-attributes, unused-macros, unused-allocation, unused-doc-comment, unused-extern-crates, unused-features, unused-parens                                                                                                                                                                                    |
-| future-incompatible | Lints that detect code that has future-compatibility problems | private-in-public, pub-use-of-private-extern-crate, patterns-in-fns-without-body, safe-extern-statics, invalid-type-param-default, legacy-directory-ownership, legacy-imports, legacy-constructor-visibility, missing-fragment-specifier, illegal-floating-point-literal-pattern, anonymous-parameters, parenthesized-params-in-types-and-modules, late-bound-lifetime-arguments, safe-packed-borrows, incoherent-fundamental-impls, tyvar-behind-raw-pointer, unstable-name-collision |
+| future-incompatible | Lints that detect code that has future-compatibility problems | private-in-public, pub-use-of-private-extern-crate, patterns-in-fns-without-body, safe-extern-statics, invalid-type-param-default, legacy-directory-ownership, legacy-imports, legacy-constructor-visibility, missing-fragment-specifier, illegal-floating-point-literal-pattern, anonymous-parameters, parenthesized-params-in-types-and-modules, late-bound-lifetime-arguments, safe-packed-borrows, tyvar-behind-raw-pointer, unstable-name-collision |
 
 Additionally, there's a `bad-style` lint group that's a deprecated alias for `nonstandard-style`.
 
 Finally, you can also see the table above by invoking `rustc -W help`. This will give you the exact values for the specific
-compiler you have installed.
\ No newline at end of file
+compiler you have installed.
index fa62d1a03f53b5d2f761bde3dae9bee3bf8e234e..c1740f272ed26d7c5dd2b1f103655d57617539ea 100644 (file)
@@ -222,44 +222,3 @@ error: invalid `crate_type` value
   | ^^^^^^^^^^^^^^^^^^^^
   |
 ```
-
-## incoherent-fundamental-impls
-
-This lint detects potentially-conflicting impls that were erroneously allowed. Some
-example code that triggers this lint:
-
-```rust,ignore
-pub trait Trait1<X> {
-    type Output;
-}
-
-pub trait Trait2<X> {}
-
-pub struct A;
-
-impl<X, T> Trait1<X> for T where T: Trait2<X> {
-    type Output = ();
-}
-
-impl<X> Trait1<Box<X>> for A {
-    type Output = i32;
-}
-```
-
-This will produce:
-
-```text
-error: conflicting implementations of trait `Trait1<std::boxed::Box<_>>` for type `A`: (E0119)
-  --> src/main.rs:13:1
-   |
-9  | impl<X, T> Trait1<X> for T where T: Trait2<X> {
-   | --------------------------------------------- first implementation here
-...
-13 | impl<X> Trait1<Box<X>> for A {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`
-   |
-   = note: #[deny(incoherent_fundamental_impls)] on by default
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #46205 <https://github.com/rust-lang/rust/issues/46205>
-   = note: downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A`
-```
index 61e5b3d0133ff6980bd886d17070197b34f3eace..b165c5a6b3b937fa6cd3ca1c5925e15cad6b06ef 100644 (file)
@@ -92,6 +92,21 @@ the tracking issue.
 #![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
 ```
 
+### `html_root_url`
+
+The `#[doc(html_root_url = "…")]` attribute value indicates the URL for
+generating links to external crates. When rustdoc needs to generate a link to
+an item in an external crate, it will first check if the extern crate has been
+documented locally on-disk, and if so link directly to it. Failing that, it
+will use the URL given by the `--extern-html-root-url` command-line flag if
+available. If that is not available, then it will use the `html_root_url`
+value in the extern crate if it is available. If that is not available, then
+the extern items will not be linked.
+
+```rust,ignore
+#![doc(html_root_url = "https://docs.rs/serde/1.0")]
+```
+
 ### `html_no_source`
 
 By default, `rustdoc` will include the source code of your program, with links
index 54472e35b1b2c426951cb949bf4e5ac2b062c1fb..bbcacb7f3d5d9b05111fb1e2a1c52e105e2111c5 100644 (file)
@@ -98,21 +98,21 @@ documentation for them as well!
 `rustdoc` can also generate HTML from standalone Markdown files. Let's
 give it a try: create a `README.md` file with these contents:
 
-```text
-    # Docs
+````text
+# Docs
 
-    This is a project to test out `rustdoc`.
+This is a project to test out `rustdoc`.
 
-    [Here is a link!](https://www.rust-lang.org)
+[Here is a link!](https://www.rust-lang.org)
 
-    ## Subheading
+## Subheading
 
-    ```rust
-    fn foo() -> i32 {
-        1 + 1
-    }
-    ```
+```rust
+fn foo() -> i32 {
+    1 + 1
+}
 ```
+````
 
 And call `rustdoc` on it:
 
index e3d99e34b3579c6daca67fa1acbe11d0f6db420b..de30b58526a138eef01dd532d0bdb66b0dbd3a8d 100644 (file)
@@ -7,11 +7,11 @@
       <Item Name="[capacity]" ExcludeView="simple">buf.cap</Item>
       <ArrayItems>
         <Size>len</Size>
-        <ValuePointer>buf.ptr.pointer.__0</ValuePointer>
+        <ValuePointer>buf.ptr.pointer</ValuePointer>
       </ArrayItems>
     </Expand>
   </Type>
-  <Type Name="alloc::vec_deque::VecDeque&lt;*&gt;">
+  <Type Name="alloc::collections::vec_deque::VecDeque&lt;*&gt;">
     <DisplayString>{{ size={tail &lt;= head ? head - tail : buf.cap - tail + head} }}</DisplayString>
     <Expand>
       <Item Name="[size]" ExcludeView="simple">tail &lt;= head ? head - tail : buf.cap - tail + head</Item>
           <If Condition="i == head">
             <Break/>
           </If>
-          <Item>buf.ptr.pointer.__0 + i</Item>
+          <Item>buf.ptr.pointer[i]</Item>
           <Exec>i = (i + 1 == buf.cap ? 0 : i + 1)</Exec>
         </Loop>
       </CustomListItems>
     </Expand>
   </Type>
-  <Type Name="alloc::linked_list::LinkedList&lt;*&gt;">
+  <Type Name="alloc::collections::linked_list::LinkedList&lt;*&gt;">
     <DisplayString>{{ size={len} }}</DisplayString>
     <Expand>
       <LinkedListItems>
         <Size>len</Size>
-        <HeadPointer>*(alloc::linked_list::Node&lt;$T1&gt; **)&amp;head</HeadPointer>
-        <NextPointer>*(alloc::linked_list::Node&lt;$T1&gt; **)&amp;next</NextPointer>
+        <HeadPointer>*(alloc::collections::linked_list::Node&lt;$T1&gt; **)&amp;head</HeadPointer>
+        <NextPointer>*(alloc::collections::linked_list::Node&lt;$T1&gt; **)&amp;next</NextPointer>
         <ValueNode>element</ValueNode>
       </LinkedListItems>
     </Expand>
index 37d64be1ce963946b34650299101899e99387e85..0e703b3b9502644e30dd527895736e874ba006bb 100644 (file)
@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
 <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
   <Type Name="core::ptr::Unique&lt;*&gt;">
-    <DisplayString>{{ Unique {*pointer.__0} }}</DisplayString>
+    <DisplayString>{{ Unique {pointer} }}</DisplayString>
     <Expand>
-      <Item Name="[ptr]">pointer.__0</Item>
+      <Item Name="[ptr]">pointer</Item>
     </Expand>
   </Type>
   <Type Name="core::ptr::Shared&lt;*&gt;">
-    <DisplayString>{{ Shared {*pointer.__0} }}</DisplayString>
+    <DisplayString>{{ Shared {pointer} }}</DisplayString>
     <Expand>
-      <Item Name="[ptr]">pointer.__0</Item>
+      <Item Name="[ptr]">pointer</Item>
     </Expand>
   </Type>
   <Type Name="core::option::Option&lt;*&gt;">
index ddf0044c506f825f63ea11d4f6239d8e2f5983a5..bcb27bb5161e2d4bfe791164586a9fe537b93517 100644 (file)
@@ -33,3 +33,4 @@ harness = false
 
 [features]
 compiler-builtins-mem = ['compiler_builtins/mem']
+compiler-builtins-c = ["compiler_builtins/c"]
index ddc6481eec78e9d703b4a26499cd60cac93b8cca..41ff06d70ff09eb7897af0f71c5385e42807483d 100644 (file)
@@ -37,6 +37,8 @@ fn __rust_realloc(ptr: *mut u8,
 ///
 /// Note: while this type is unstable, the functionality it provides can be
 /// accessed through the [free functions in `alloc`](index.html#functions).
+///
+/// [`Alloc`]: trait.Alloc.html
 #[unstable(feature = "allocator_api", issue = "32838")]
 #[derive(Copy, Clone, Default, Debug)]
 pub struct Global;
@@ -54,6 +56,10 @@ fn __rust_realloc(ptr: *mut u8,
 ///
 /// See [`GlobalAlloc::alloc`].
 ///
+/// [`Global`]: struct.Global.html
+/// [`Alloc`]: trait.Alloc.html
+/// [`GlobalAlloc::alloc`]: trait.GlobalAlloc.html#tymethod.alloc
+///
 /// # Examples
 ///
 /// ```
@@ -87,6 +93,10 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
 /// # Safety
 ///
 /// See [`GlobalAlloc::dealloc`].
+///
+/// [`Global`]: struct.Global.html
+/// [`Alloc`]: trait.Alloc.html
+/// [`GlobalAlloc::dealloc`]: trait.GlobalAlloc.html#tymethod.dealloc
 #[stable(feature = "global_alloc", since = "1.28.0")]
 #[inline]
 pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
@@ -105,6 +115,10 @@ pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
 /// # Safety
 ///
 /// See [`GlobalAlloc::realloc`].
+///
+/// [`Global`]: struct.Global.html
+/// [`Alloc`]: trait.Alloc.html
+/// [`GlobalAlloc::realloc`]: trait.GlobalAlloc.html#method.realloc
 #[stable(feature = "global_alloc", since = "1.28.0")]
 #[inline]
 pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
@@ -124,6 +138,10 @@ pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
 ///
 /// See [`GlobalAlloc::alloc_zeroed`].
 ///
+/// [`Global`]: struct.Global.html
+/// [`Alloc`]: trait.Alloc.html
+/// [`GlobalAlloc::alloc_zeroed`]: trait.GlobalAlloc.html#method.alloc_zeroed
+///
 /// # Examples
 ///
 /// ```
index 207359ed6968f029879a267b042d0d7244cc7561..024594517d9884bfa636789086d6e570c44d4611 100644 (file)
@@ -4,16 +4,6 @@
 //! heap allocation in Rust. Boxes provide ownership for this allocation, and
 //! drop their contents when they go out of scope.
 //!
-//! For non-zero-sized values, a [`Box`] will use the [`Global`] allocator for
-//! its allocation. It is valid to convert both ways between a [`Box`] and a
-//! raw pointer allocated with the [`Global`] allocator, given that the
-//! [`Layout`] used with the allocator is correct for the type. More precisely,
-//! a `value: *mut T` that has been allocated with the [`Global`] allocator
-//! with `Layout::for_value(&*value)` may be converted into a box using
-//! `Box::<T>::from_raw(value)`. Conversely, the memory backing a `value: *mut
-//! T` obtained from `Box::<T>::into_raw` may be deallocated using the
-//! [`Global`] allocator with `Layout::for_value(&*value)`.
-//!
 //! # Examples
 //!
 //! Move a value from the stack to the heap by creating a [`Box`]:
 //! for a `Cons`. By introducing a `Box`, which has a defined size, we know how
 //! big `Cons` needs to be.
 //!
+//! # Memory layout
+//!
+//! For non-zero-sized values, a [`Box`] will use the [`Global`] allocator for
+//! its allocation. It is valid to convert both ways between a [`Box`] and a
+//! raw pointer allocated with the [`Global`] allocator, given that the
+//! [`Layout`] used with the allocator is correct for the type. More precisely,
+//! a `value: *mut T` that has been allocated with the [`Global`] allocator
+//! with `Layout::for_value(&*value)` may be converted into a box using
+//! `Box::<T>::from_raw(value)`. Conversely, the memory backing a `value: *mut
+//! T` obtained from `Box::<T>::into_raw` may be deallocated using the
+//! [`Global`] allocator with `Layout::for_value(&*value)`.
+//!
+//!
 //! [dereferencing]: ../../std/ops/trait.Deref.html
 //! [`Box`]: struct.Box.html
 //! [`Global`]: ../alloc/struct.Global.html
@@ -127,24 +130,38 @@ impl<T: ?Sized> Box<T> {
     ///
     /// After calling this function, the raw pointer is owned by the
     /// resulting `Box`. Specifically, the `Box` destructor will call
-    /// the destructor of `T` and free the allocated memory. Since the
-    /// way `Box` allocates and releases memory is unspecified, the
-    /// only valid pointer to pass to this function is the one taken
-    /// from another `Box` via the [`Box::into_raw`] function.
+    /// the destructor of `T` and free the allocated memory. For this
+    /// to be safe, the memory must have been allocated in accordance
+    /// with the [memory layout] used by `Box` .
+    ///
+    /// # Safety
     ///
     /// This function is unsafe because improper use may lead to
     /// memory problems. For example, a double-free may occur if the
     /// function is called twice on the same raw pointer.
     ///
-    /// [`Box::into_raw`]: struct.Box.html#method.into_raw
-    ///
     /// # Examples
-    ///
+    /// Recreate a `Box` which was previously converted to a raw pointer
+    /// using [`Box::into_raw`]:
     /// ```
     /// let x = Box::new(5);
     /// let ptr = Box::into_raw(x);
     /// let x = unsafe { Box::from_raw(ptr) };
     /// ```
+    /// Manually create a `Box` from scratch by using the global allocator:
+    /// ```
+    /// use std::alloc::{alloc, Layout};
+    ///
+    /// unsafe {
+    ///     let ptr = alloc(Layout::new::<i32>()) as *mut i32;
+    ///     *ptr = 5;
+    ///     let x = Box::from_raw(ptr);
+    /// }
+    /// ```
+    ///
+    /// [memory layout]: index.html#memory-layout
+    /// [`Layout`]: ../alloc/struct.Layout.html
+    /// [`Box::into_raw`]: struct.Box.html#method.into_raw
     #[stable(feature = "box_raw", since = "1.4.0")]
     #[inline]
     pub unsafe fn from_raw(raw: *mut T) -> Self {
@@ -157,22 +174,40 @@ pub unsafe fn from_raw(raw: *mut T) -> Self {
     ///
     /// After calling this function, the caller is responsible for the
     /// memory previously managed by the `Box`. In particular, the
-    /// caller should properly destroy `T` and release the memory. The
-    /// proper way to do so is to convert the raw pointer back into a
-    /// `Box` with the [`Box::from_raw`] function.
+    /// caller should properly destroy `T` and release the memory, taking
+    /// into account the [memory layout] used by `Box`. The easiest way to
+    /// do this is to convert the raw pointer back into a `Box` with the
+    /// [`Box::from_raw`] function, allowing the `Box` destructor to perform
+    /// the cleanup.
     ///
     /// Note: this is an associated function, which means that you have
     /// to call it as `Box::into_raw(b)` instead of `b.into_raw()`. This
     /// is so that there is no conflict with a method on the inner type.
     ///
-    /// [`Box::from_raw`]: struct.Box.html#method.from_raw
-    ///
     /// # Examples
-    ///
+    /// Converting the raw pointer back into a `Box` with [`Box::from_raw`]
+    /// for automatic cleanup:
     /// ```
-    /// let x = Box::new(5);
+    /// let x = Box::new(String::from("Hello"));
     /// let ptr = Box::into_raw(x);
+    /// let x = unsafe { Box::from_raw(ptr) };
+    /// ```
+    /// Manual cleanup by explicitly running the destructor and deallocating
+    /// the memory:
     /// ```
+    /// use std::alloc::{dealloc, Layout};
+    /// use std::ptr;
+    ///
+    /// let x = Box::new(String::from("Hello"));
+    /// let p = Box::into_raw(x);
+    /// unsafe {
+    ///     ptr::drop_in_place(p);
+    ///     dealloc(p as *mut u8, Layout::new::<String>());
+    /// }
+    /// ```
+    ///
+    /// [memory layout]: index.html#memory-layout
+    /// [`Box::from_raw`]: struct.Box.html#method.from_raw
     #[stable(feature = "box_raw", since = "1.4.0")]
     #[inline]
     pub fn into_raw(b: Box<T>) -> *mut T {
@@ -184,7 +219,7 @@ pub fn into_raw(b: Box<T>) -> *mut T {
     /// After calling this function, the caller is responsible for the
     /// memory previously managed by the `Box`. In particular, the
     /// caller should properly destroy `T` and release the memory. The
-    /// proper way to do so is to convert the `NonNull<T>` pointer
+    /// easiest way to do so is to convert the `NonNull<T>` pointer
     /// into a raw pointer and back into a `Box` with the [`Box::from_raw`]
     /// function.
     ///
@@ -203,6 +238,10 @@ pub fn into_raw(b: Box<T>) -> *mut T {
     /// fn main() {
     ///     let x = Box::new(5);
     ///     let ptr = Box::into_raw_non_null(x);
+    ///
+    ///     // Clean up the memory by converting the NonNull pointer back
+    ///     // into a Box and letting the Box be dropped.
+    ///     let x = unsafe { Box::from_raw(ptr.as_ptr()) };
     /// }
     /// ```
     #[unstable(feature = "box_into_raw_non_null", issue = "47336")]
index 39fcfaa789377bb575fabda5be8fccc790468885..c5a0b6e877b65f124f61e925ab8989c5e02547e1 100644 (file)
 /// assert_eq!(heap.pop(), Some(Reverse(5)));
 /// assert_eq!(heap.pop(), None);
 /// ```
+///
+/// # Time complexity
+///
+/// | [push] | [pop]    | [peek]/[peek\_mut] |
+/// |--------|----------|--------------------|
+/// | O(1)~  | O(log n) | O(1)               |
+///
+/// The value for `push` is an expected cost; the method documentation gives a
+/// more detailed analysis.
+///
+/// [push]: #method.push
+/// [pop]: #method.pop
+/// [peek]: #method.peek
+/// [peek\_mut]: #method.peek_mut
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct BinaryHeap<T> {
     data: Vec<T>,
@@ -384,6 +398,10 @@ pub fn with_capacity(capacity: usize) -> BinaryHeap<T> {
     /// }
     /// assert_eq!(heap.peek(), Some(&2));
     /// ```
+    ///
+    /// # Time complexity
+    ///
+    /// Cost is O(1) in the worst case.
     #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
     pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T>> {
         if self.is_empty() {
@@ -411,6 +429,11 @@ pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T>> {
     /// assert_eq!(heap.pop(), Some(1));
     /// assert_eq!(heap.pop(), None);
     /// ```
+    ///
+    /// # Time complexity
+    ///
+    /// The worst case cost of `pop` on a heap containing *n* elements is O(log
+    /// n).
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn pop(&mut self) -> Option<T> {
         self.data.pop().map(|mut item| {
@@ -438,6 +461,22 @@ pub fn pop(&mut self) -> Option<T> {
     /// assert_eq!(heap.len(), 3);
     /// assert_eq!(heap.peek(), Some(&5));
     /// ```
+    ///
+    /// # Time complexity
+    ///
+    /// The expected cost of `push`, averaged over every possible ordering of
+    /// the elements being pushed, and over a sufficiently large number of
+    /// pushes, is O(1). This is the most meaningful cost metric when pushing
+    /// elements that are *not* already in any sorted pattern.
+    ///
+    /// The time complexity degrades if elements are pushed in predominantly
+    /// ascending order. In the worst case, elements are pushed in ascending
+    /// sorted order and the amortized cost per push is O(log n) against a heap
+    /// containing *n* elements.
+    ///
+    /// The worst case cost of a *single* call to `push` is O(n). The worst case
+    /// occurs when capacity is exhausted and needs a resize. The resize cost
+    /// has been amortized in the previous figures.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn push(&mut self, item: T) {
         let old_len = self.len();
@@ -650,6 +689,10 @@ pub fn iter(&self) -> Iter<'_, T> {
     /// assert_eq!(heap.peek(), Some(&5));
     ///
     /// ```
+    ///
+    /// # Time complexity
+    ///
+    /// Cost is O(1) in the worst case.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn peek(&self) -> Option<&T> {
         self.data.get(0)
index 9a8d48083e67c676e2fffbfc7f32f9ef53e461ef..31e49d06a7b5a963d3701ed6123ea50f8c792bf8 100644 (file)
@@ -1948,8 +1948,6 @@ pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) {
     /// # Examples
     ///
     /// ```
-    /// #![feature(vecdeque_rotate)]
-    ///
     /// use std::collections::VecDeque;
     ///
     /// let mut buf: VecDeque<_> = (0..10).collect();
@@ -1963,7 +1961,7 @@ pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) {
     /// }
     /// assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
     /// ```
-    #[unstable(feature = "vecdeque_rotate", issue = "56686")]
+    #[stable(feature = "vecdeque_rotate", since = "1.36.0")]
     pub fn rotate_left(&mut self, mid: usize) {
         assert!(mid <= self.len());
         let k = self.len() - mid;
@@ -1993,8 +1991,6 @@ pub fn rotate_left(&mut self, mid: usize) {
     /// # Examples
     ///
     /// ```
-    /// #![feature(vecdeque_rotate)]
-    ///
     /// use std::collections::VecDeque;
     ///
     /// let mut buf: VecDeque<_> = (0..10).collect();
@@ -2008,7 +2004,7 @@ pub fn rotate_left(&mut self, mid: usize) {
     /// }
     /// assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
     /// ```
-    #[unstable(feature = "vecdeque_rotate", issue = "56686")]
+    #[stable(feature = "vecdeque_rotate", since = "1.36.0")]
     pub fn rotate_right(&mut self, k: usize) {
         assert!(k <= self.len());
         let mid = self.len() - k;
index 2edd946ff11cfa91ce2c397ec2edd85df0a81582..d90036eaf49b8f3da6389d23e8f978f69fe5984e 100644 (file)
 #![feature(rustc_const_unstable)]
 #![feature(const_vec_new)]
 #![feature(slice_partition_dedup)]
-#![feature(maybe_uninit, maybe_uninit_slice, maybe_uninit_array)]
+#![feature(maybe_uninit_extra, maybe_uninit_slice, maybe_uninit_array)]
 #![feature(alloc_layout_extra)]
 #![feature(try_trait)]
 #![feature(iter_nth_back)]
index d52814118b3c7de7c74c47f1d8700a6299be55f6..989beb3b1bfd90afbfd55626953080d31016bb39 100644 (file)
@@ -143,8 +143,8 @@ fn check_union(a: &[i32], b: &[i32], expected: &[i32]) {
 #[test]
 // Only tests the simple function definition with respect to intersection
 fn test_is_disjoint() {
-    let one = [1].into_iter().collect::<BTreeSet<_>>();
-    let two = [2].into_iter().collect::<BTreeSet<_>>();
+    let one = [1].iter().collect::<BTreeSet<_>>();
+    let two = [2].iter().collect::<BTreeSet<_>>();
     assert!(one.is_disjoint(&two));
 }
 
index b736750c57601e5b1798d871837b90910f1bad40..ddb3120e89d781635645c424a9eba34d803e85d2 100644 (file)
@@ -6,7 +6,6 @@
 #![feature(repeat_generic_slice)]
 #![feature(try_reserve)]
 #![feature(unboxed_closures)]
-#![feature(vecdeque_rotate)]
 #![deny(rust_2018_idioms)]
 
 use std::hash::{Hash, Hasher};
index c124457118cb97768a98b181f70be07ad85e7dd9..f25631e028eecb15506ddf803c80482fb4b411c4 100644 (file)
@@ -99,7 +99,7 @@ pub fn from_size_align(size: usize, align: usize) -> Result<Self, LayoutErr> {
     /// [`Layout::from_size_align`](#method.from_size_align).
     #[stable(feature = "alloc_layout", since = "1.28.0")]
     #[inline]
-    pub unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
+    pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
         Layout { size_: size, align_: NonZeroUsize::new_unchecked(align) }
     }
 
@@ -480,7 +480,7 @@ pub unsafe trait GlobalAlloc {
     ///   this allocator,
     ///
     /// * `layout` must be the same layout that was used
-    ///   to allocated that block of memory,
+    ///   to allocate that block of memory,
     #[stable(feature = "global_alloc", since = "1.28.0")]
     unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout);
 
@@ -535,7 +535,7 @@ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
     /// * `ptr` must be currently allocated via this allocator,
     ///
     /// * `layout` must be the same layout that was used
-    ///   to allocated that block of memory,
+    ///   to allocate that block of memory,
     ///
     /// * `new_size` must be greater than zero.
     ///
index 43c1a3b7767ab647838c9f4f3702e0a29271a881..2f6d745d146d647d3fd5716e57db7dc020964b39 100644 (file)
@@ -886,7 +886,7 @@ pub trait Pointer {
 ///
 /// # Examples
 ///
-/// Basic usage with `i32`:
+/// Basic usage with `f64`:
 ///
 /// ```
 /// let x = 42.0; // 42.0 is '4.2e1' in scientific notation
@@ -929,7 +929,7 @@ pub trait LowerExp {
 ///
 /// # Examples
 ///
-/// Basic usage with `f32`:
+/// Basic usage with `f64`:
 ///
 /// ```
 /// let x = 42.0; // 42.0 is '4.2E1' in scientific notation
index 403f3358105325c917fae4fa0277f4dc7be5700e..38c7c9bc4d086c53e9e27eed48168dff5670b4ef 100644 (file)
@@ -356,7 +356,7 @@ fn nth(&mut self, mut n: usize) -> Option<Self::Item> {
     ///
     /// ```
     /// let a = [0, 1, 2, 3, 4, 5];
-    /// let mut iter = a.into_iter().step_by(2);
+    /// let mut iter = a.iter().step_by(2);
     ///
     /// assert_eq!(iter.next(), Some(&0));
     /// assert_eq!(iter.next(), Some(&2));
@@ -531,7 +531,7 @@ fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where
     /// ```
     /// let a = [1, 2, 3];
     ///
-    /// let mut iter = a.into_iter().map(|x| 2 * x);
+    /// let mut iter = a.iter().map(|x| 2 * x);
     ///
     /// assert_eq!(iter.next(), Some(2));
     /// assert_eq!(iter.next(), Some(4));
@@ -620,7 +620,7 @@ fn for_each<F>(self, mut f: F) where
     /// ```
     /// let a = [0i32, 1, 2];
     ///
-    /// let mut iter = a.into_iter().filter(|x| x.is_positive());
+    /// let mut iter = a.iter().filter(|x| x.is_positive());
     ///
     /// assert_eq!(iter.next(), Some(&1));
     /// assert_eq!(iter.next(), Some(&2));
@@ -634,7 +634,7 @@ fn for_each<F>(self, mut f: F) where
     /// ```
     /// let a = [0, 1, 2];
     ///
-    /// let mut iter = a.into_iter().filter(|x| **x > 1); // need two *s!
+    /// let mut iter = a.iter().filter(|x| **x > 1); // need two *s!
     ///
     /// assert_eq!(iter.next(), Some(&2));
     /// assert_eq!(iter.next(), None);
@@ -646,7 +646,7 @@ fn for_each<F>(self, mut f: F) where
     /// ```
     /// let a = [0, 1, 2];
     ///
-    /// let mut iter = a.into_iter().filter(|&x| *x > 1); // both & and *
+    /// let mut iter = a.iter().filter(|&x| *x > 1); // both & and *
     ///
     /// assert_eq!(iter.next(), Some(&2));
     /// assert_eq!(iter.next(), None);
@@ -657,7 +657,7 @@ fn for_each<F>(self, mut f: F) where
     /// ```
     /// let a = [0, 1, 2];
     ///
-    /// let mut iter = a.into_iter().filter(|&&x| x > 1); // two &s
+    /// let mut iter = a.iter().filter(|&&x| x > 1); // two &s
     ///
     /// assert_eq!(iter.next(), Some(&2));
     /// assert_eq!(iter.next(), None);
@@ -837,7 +837,7 @@ fn peekable(self) -> Peekable<Self> where Self: Sized {
     /// ```
     /// let a = [-1i32, 0, 1];
     ///
-    /// let mut iter = a.into_iter().skip_while(|x| x.is_negative());
+    /// let mut iter = a.iter().skip_while(|x| x.is_negative());
     ///
     /// assert_eq!(iter.next(), Some(&0));
     /// assert_eq!(iter.next(), Some(&1));
@@ -851,7 +851,7 @@ fn peekable(self) -> Peekable<Self> where Self: Sized {
     /// ```
     /// let a = [-1, 0, 1];
     ///
-    /// let mut iter = a.into_iter().skip_while(|x| **x < 0); // need two *s!
+    /// let mut iter = a.iter().skip_while(|x| **x < 0); // need two *s!
     ///
     /// assert_eq!(iter.next(), Some(&0));
     /// assert_eq!(iter.next(), Some(&1));
@@ -863,7 +863,7 @@ fn peekable(self) -> Peekable<Self> where Self: Sized {
     /// ```
     /// let a = [-1, 0, 1, -2];
     ///
-    /// let mut iter = a.into_iter().skip_while(|x| **x < 0);
+    /// let mut iter = a.iter().skip_while(|x| **x < 0);
     ///
     /// assert_eq!(iter.next(), Some(&0));
     /// assert_eq!(iter.next(), Some(&1));
@@ -898,7 +898,7 @@ fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
     /// ```
     /// let a = [-1i32, 0, 1];
     ///
-    /// let mut iter = a.into_iter().take_while(|x| x.is_negative());
+    /// let mut iter = a.iter().take_while(|x| x.is_negative());
     ///
     /// assert_eq!(iter.next(), Some(&-1));
     /// assert_eq!(iter.next(), None);
@@ -911,7 +911,7 @@ fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
     /// ```
     /// let a = [-1, 0, 1];
     ///
-    /// let mut iter = a.into_iter().take_while(|x| **x < 0); // need two *s!
+    /// let mut iter = a.iter().take_while(|x| **x < 0); // need two *s!
     ///
     /// assert_eq!(iter.next(), Some(&-1));
     /// assert_eq!(iter.next(), None);
@@ -922,7 +922,7 @@ fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
     /// ```
     /// let a = [-1, 0, 1, -2];
     ///
-    /// let mut iter = a.into_iter().take_while(|x| **x < 0);
+    /// let mut iter = a.iter().take_while(|x| **x < 0);
     ///
     /// assert_eq!(iter.next(), Some(&-1));
     ///
@@ -937,7 +937,7 @@ fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
     ///
     /// ```
     /// let a = [1, 2, 3, 4];
-    /// let mut iter = a.into_iter();
+    /// let mut iter = a.iter();
     ///
     /// let result: Vec<i32> = iter.by_ref()
     ///                            .take_while(|n| **n != 3)
@@ -1321,7 +1321,7 @@ fn inspect<F>(self, f: F) -> Inspect<Self, F> where
     /// ```
     /// let a = [1, 2, 3];
     ///
-    /// let iter = a.into_iter();
+    /// let iter = a.iter();
     ///
     /// let sum: i32 = iter.take(5).fold(0, |acc, i| acc + i );
     ///
@@ -1334,7 +1334,7 @@ fn inspect<F>(self, f: F) -> Inspect<Self, F> where
     /// // let's try that again
     /// let a = [1, 2, 3];
     ///
-    /// let mut iter = a.into_iter();
+    /// let mut iter = a.iter();
     ///
     /// // instead, we add in a .by_ref()
     /// let sum: i32 = iter.by_ref().take(2).fold(0, |acc, i| acc + i );
@@ -1479,7 +1479,7 @@ fn collect<B: FromIterator<Self::Item>>(self) -> B where Self: Sized {
     /// let a = [1, 2, 3];
     ///
     /// let (even, odd): (Vec<i32>, Vec<i32>) = a
-    ///     .into_iter()
+    ///     .iter()
     ///     .partition(|&n| n % 2 == 0);
     ///
     /// assert_eq!(even, vec![2]);
index 28db55578c3de7972a2d19b1795a337675e925b3..4a70329b64bc983a7d43b0b4214be77d892c8447 100644 (file)
 #![feature(structural_match)]
 #![feature(abi_unadjusted)]
 #![feature(adx_target_feature)]
-#![feature(maybe_uninit, maybe_uninit_slice, maybe_uninit_array)]
+#![feature(maybe_uninit_slice, maybe_uninit_array)]
 #![feature(external_doc)]
 
 #[prelude_import]
index 9fb071d29524bee5abfc0694c77f155da4a1b405..24bee6355a7ccfe41f9e868b32a71718b52a2fcb 100644 (file)
 /// The practical use cases for `forget` are rather specialized and mainly come
 /// up in unsafe or FFI code.
 ///
-/// ## Use case 1
-///
-/// You have created an uninitialized value using [`mem::uninitialized`][uninit].
-/// You must either initialize or `forget` it on every computation path before
-/// Rust drops it automatically, like at the end of a scope or after a panic.
-/// Running the destructor on an uninitialized value would be [undefined behavior][ub].
-///
-/// ```
-/// use std::mem;
-/// use std::ptr;
-///
-/// # let some_condition = false;
-/// unsafe {
-///     let mut uninit_vec: Vec<u32> = mem::uninitialized();
-///
-///     if some_condition {
-///         // Initialize the variable.
-///         ptr::write(&mut uninit_vec, Vec::new());
-///     } else {
-///         // Forget the uninitialized value so its destructor doesn't run.
-///         mem::forget(uninit_vec);
-///     }
-/// }
-/// ```
-///
-/// ## Use case 2
-///
-/// You have duplicated the bytes making up a value, without doing a proper
-/// [`Clone`][clone]. You need the value's destructor to run only once,
-/// because a double `free` is undefined behavior.
-///
-/// An example is a possible implementation of [`mem::swap`][swap]:
-///
-/// ```
-/// use std::mem;
-/// use std::ptr;
-///
-/// # #[allow(dead_code)]
-/// fn swap<T>(x: &mut T, y: &mut T) {
-///     unsafe {
-///         // Give ourselves some scratch space to work with
-///         let mut t: T = mem::uninitialized();
-///
-///         // Perform the swap, `&mut` pointers never alias
-///         ptr::copy_nonoverlapping(&*x, &mut t, 1);
-///         ptr::copy_nonoverlapping(&*y, x, 1);
-///         ptr::copy_nonoverlapping(&t, y, 1);
-///
-///         // y and t now point to the same thing, but we need to completely
-///         // forget `t` because we do not want to run the destructor for `T`
-///         // on its value, which is still owned somewhere outside this function.
-///         mem::forget(t);
-///     }
-/// }
-/// ```
-///
 /// [drop]: fn.drop.html
 /// [uninit]: fn.uninitialized.html
 /// [clone]: ../clone/trait.Clone.html
@@ -465,29 +409,37 @@ pub const fn needs_drop<T>() -> bool {
 
 /// Creates a value whose bytes are all zero.
 ///
-/// This has the same effect as allocating space with
-/// [`mem::uninitialized`][uninit] and then zeroing it out. It is useful for
-/// FFI sometimes, but should generally be avoided.
+/// This has the same effect as [`MaybeUninit::zeroed().assume_init()`][zeroed].
+/// It is useful for FFI sometimes, but should generally be avoided.
 ///
 /// There is no guarantee that an all-zero byte-pattern represents a valid value of
-/// some type `T`. If `T` has a destructor and the value is destroyed (due to
-/// a panic or the end of a scope) before being initialized, then the destructor
-/// will run on zeroed data, likely leading to [undefined behavior][ub].
-///
-/// See also the documentation for [`mem::uninitialized`][uninit], which has
-/// many of the same caveats.
+/// some type `T`. For example, the all-zero byte-pattern is not a valid value
+/// for reference types (`&T` and `&mut T`). Using `zeroed` on such types
+/// causes immediate [undefined behavior][ub] because [the Rust compiler assumes][inv]
+/// that there always is a valid value in a variable it considers initialized.
 ///
-/// [uninit]: fn.uninitialized.html
+/// [zeroed]: union.MaybeUninit.html#method.zeroed
 /// [ub]: ../../reference/behavior-considered-undefined.html
+/// [inv]: union.MaybeUninit.html#initialization-invariant
 ///
 /// # Examples
 ///
+/// Correct usage of this function: initializing an integer with zero.
+///
 /// ```
 /// use std::mem;
 ///
 /// let x: i32 = unsafe { mem::zeroed() };
 /// assert_eq!(0, x);
 /// ```
+///
+/// *Incorrect* usage of this function: initializing a reference with zero.
+///
+/// ```no_run
+/// use std::mem;
+///
+/// let _x: &i32 = unsafe { mem::zeroed() }; // Undefined behavior!
+/// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub unsafe fn zeroed<T>() -> T {
@@ -498,130 +450,23 @@ pub unsafe fn zeroed<T>() -> T {
 /// Bypasses Rust's normal memory-initialization checks by pretending to
 /// produce a value of type `T`, while doing nothing at all.
 ///
-/// **This is incredibly dangerous and should not be done lightly. Deeply
-/// consider initializing your memory with a default value instead.**
-///
-/// This is useful for FFI functions and initializing arrays sometimes,
-/// but should generally be avoided.
-///
-/// # Undefined behavior
-///
-/// It is [undefined behavior][ub] to read uninitialized memory, even just an
-/// uninitialized boolean. For instance, if you branch on the value of such
-/// a boolean, your program may take one, both, or neither of the branches.
-///
-/// Writing to the uninitialized value is similarly dangerous. Rust believes the
-/// value is initialized, and will therefore try to [`Drop`] the uninitialized
-/// value and its fields if you try to overwrite it in a normal manner. The only way
-/// to safely initialize an uninitialized value is with [`ptr::write`][write],
-/// [`ptr::copy`][copy], or [`ptr::copy_nonoverlapping`][copy_no].
-///
-/// If the value does implement [`Drop`], it must be initialized before
-/// it goes out of scope (and therefore would be dropped). Note that this
-/// includes a `panic` occurring and unwinding the stack suddenly.
+/// **This functon is deprecated.** Use [`MaybeUninit<T>`] instead.
 ///
-/// If you partially initialize an array, you may need to use
-/// [`ptr::drop_in_place`][drop_in_place] to remove the elements you have fully
-/// initialized followed by [`mem::forget`][mem_forget] to prevent drop running
-/// on the array. If a partially allocated array is dropped this will lead to
-/// undefined behaviour.
-///
-/// # Examples
-///
-/// Here's how to safely initialize an array of [`Vec`]s.
-///
-/// ```
-/// use std::mem;
-/// use std::ptr;
-///
-/// // Only declare the array. This safely leaves it
-/// // uninitialized in a way that Rust will track for us.
-/// // However we can't initialize it element-by-element
-/// // safely, and we can't use the `[value; 1000]`
-/// // constructor because it only works with `Copy` data.
-/// let mut data: [Vec<u32>; 1000];
-///
-/// unsafe {
-///     // So we need to do this to initialize it.
-///     data = mem::uninitialized();
-///
-///     // DANGER ZONE: if anything panics or otherwise
-///     // incorrectly reads the array here, we will have
-///     // Undefined Behavior.
-///
-///     // It's ok to mutably iterate the data, since this
-///     // doesn't involve reading it at all.
-///     // (ptr and len are statically known for arrays)
-///     for elem in &mut data[..] {
-///         // *elem = Vec::new() would try to drop the
-///         // uninitialized memory at `elem` -- bad!
-///         //
-///         // Vec::new doesn't allocate or do really
-///         // anything. It's only safe to call here
-///         // because we know it won't panic.
-///         ptr::write(elem, Vec::new());
-///     }
-///
-///     // SAFE ZONE: everything is initialized.
-/// }
-///
-/// println!("{:?}", &data[0]);
-/// ```
-///
-/// This example emphasizes exactly how delicate and dangerous using `mem::uninitialized`
-/// can be. Note that the [`vec!`] macro *does* let you initialize every element with a
-/// value that is only [`Clone`], so the following is semantically equivalent and
-/// vastly less dangerous, as long as you can live with an extra heap
-/// allocation:
-///
-/// ```
-/// let data: Vec<Vec<u32>> = vec![Vec::new(); 1000];
-/// println!("{:?}", &data[0]);
-/// ```
-///
-/// This example shows how to handle partially initialized arrays, which could
-/// be found in low-level datastructures.
-///
-/// ```
-/// use std::mem;
-/// use std::ptr;
-///
-/// // Count the number of elements we have assigned.
-/// let mut data_len: usize = 0;
-/// let mut data: [String; 1000];
-///
-/// unsafe {
-///     data = mem::uninitialized();
-///
-///     for elem in &mut data[0..500] {
-///         ptr::write(elem, String::from("hello"));
-///         data_len += 1;
-///     }
-///
-///     // For each item in the array, drop if we allocated it.
-///     for i in &mut data[0..data_len] {
-///         ptr::drop_in_place(i);
-///     }
-/// }
-/// // Forget the data. If this is allowed to drop, you may see a crash such as:
-/// // 'mem_uninit_test(2457,0x7fffb55dd380) malloc: *** error for object
-/// // 0x7ff3b8402920: pointer being freed was not allocated'
-/// mem::forget(data);
-/// ```
+/// The reason for deprecation is that the function basically cannot be used
+/// correctly: [the Rust compiler assumes][inv] that values are properly initialized.
+/// As a consequence, calling e.g. `mem::uninitialized::<bool>()` causes immediate
+/// undefined behavior for returning a `bool` that is not definitely either `true`
+/// or `false`. Worse, truly uninitialized memory like what gets returned here
+/// is special in that the compiler knows that it does not have a fixed value.
+/// This makes it undefined behavior to have uninitialized data in a variable even
+/// if that variable has an integer type.
+/// (Notice that the rules around uninitialized integers are not finalized yet, but
+/// until they are, it is advisable to avoid them.)
 ///
-/// [`Vec`]: ../../std/vec/struct.Vec.html
-/// [`vec!`]: ../../std/macro.vec.html
-/// [`Clone`]: ../../std/clone/trait.Clone.html
-/// [ub]: ../../reference/behavior-considered-undefined.html
-/// [write]: ../ptr/fn.write.html
-/// [drop_in_place]: ../ptr/fn.drop_in_place.html
-/// [mem_zeroed]: fn.zeroed.html
-/// [mem_forget]: fn.forget.html
-/// [copy]: ../intrinsics/fn.copy.html
-/// [copy_no]: ../intrinsics/fn.copy_nonoverlapping.html
-/// [`Drop`]: ../ops/trait.Drop.html
+/// [`MaybeUninit<T>`]: union.MaybeUninit.html
+/// [inv]: union.MaybeUninit.html#initialization-invariant
 #[inline]
-#[rustc_deprecated(since = "2.0.0", reason = "use `mem::MaybeUninit::uninit` instead")]
+#[rustc_deprecated(since = "1.40.0", reason = "use `mem::MaybeUninit` instead")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub unsafe fn uninitialized<T>() -> T {
     intrinsics::panic_if_uninhabited::<T>();
@@ -899,7 +744,6 @@ pub fn discriminant<T>(v: &T) -> Discriminant<T> {
     }
 }
 
-// FIXME: Reference `MaybeUninit` from these docs, once that is stable.
 /// A wrapper to inhibit compiler from automatically calling `T`’s destructor.
 ///
 /// This wrapper is 0-cost.
@@ -908,6 +752,7 @@ pub fn discriminant<T>(v: &T) -> Discriminant<T> {
 /// As a consequence, it has *no effect* on the assumptions that the compiler makes
 /// about all values being initialized at their type.  In particular, initializing
 /// a `ManuallyDrop<&mut T>` with [`mem::zeroed`] is undefined behavior.
+/// If you need to handle uninitialized data, use [`MaybeUninit<T>`] instead.
 ///
 /// # Examples
 ///
@@ -942,6 +787,7 @@ pub fn discriminant<T>(v: &T) -> Discriminant<T> {
 /// ```
 ///
 /// [`mem::zeroed`]: fn.zeroed.html
+/// [`MaybeUninit<T>`]: union.MaybeUninit.html
 #[stable(feature = "manually_drop", since = "1.20.0")]
 #[lang = "manually_drop"]
 #[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -1042,17 +888,18 @@ fn deref_mut(&mut self) -> &mut T {
     }
 }
 
-/// A wrapper to construct uninitialized instances of `T`.
+/// A wrapper type to construct uninitialized instances of `T`.
+///
+/// # Initialization invariant
 ///
 /// The compiler, in general, assumes that variables are properly initialized
 /// at their respective type. For example, a variable of reference type must
 /// be aligned and non-NULL. This is an invariant that must *always* be upheld,
 /// even in unsafe code. As a consequence, zero-initializing a variable of reference
-/// type causes instantaneous undefined behavior, no matter whether that reference
+/// type causes instantaneous [undefined behavior][ub], no matter whether that reference
 /// ever gets used to access memory:
 ///
 /// ```rust,no_run
-/// #![feature(maybe_uninit)]
 /// use std::mem::{self, MaybeUninit};
 ///
 /// let x: &i32 = unsafe { mem::zeroed() }; // undefined behavior!
@@ -1067,7 +914,6 @@ fn deref_mut(&mut self) -> &mut T {
 /// always be `true` or `false`. Hence, creating an uninitialized `bool` is undefined behavior:
 ///
 /// ```rust,no_run
-/// #![feature(maybe_uninit)]
 /// use std::mem::{self, MaybeUninit};
 ///
 /// let b: bool = unsafe { mem::uninitialized() }; // undefined behavior!
@@ -1078,10 +924,9 @@ fn deref_mut(&mut self) -> &mut T {
 /// Moreover, uninitialized memory is special in that the compiler knows that
 /// it does not have a fixed value. This makes it undefined behavior to have
 /// uninitialized data in a variable even if that variable has an integer type,
-/// which otherwise can hold any bit pattern:
+/// which otherwise can hold any *fixed* bit pattern:
 ///
 /// ```rust,no_run
-/// #![feature(maybe_uninit)]
 /// use std::mem::{self, MaybeUninit};
 ///
 /// let x: i32 = unsafe { mem::uninitialized() }; // undefined behavior!
@@ -1091,37 +936,154 @@ fn deref_mut(&mut self) -> &mut T {
 /// (Notice that the rules around uninitialized integers are not finalized yet, but
 /// until they are, it is advisable to avoid them.)
 ///
+/// On top of that, remember that most types have additional invariants beyond merely
+/// being considered initialized at the type level. For example, a `1`-initialized [`Vec<T>`]
+/// is considered initialized because the only requirement the compiler knows about it
+/// is that the data pointer must be non-null. Creating such a `Vec<T>` does not cause
+/// *immediate* undefined behavior, but will cause undefined behavior with most
+/// safe operations (including dropping it).
+///
+/// [`Vec<T>`]: ../../std/vec/struct.Vec.html
+///
+/// # Examples
+///
 /// `MaybeUninit<T>` serves to enable unsafe code to deal with uninitialized data.
 /// It is a signal to the compiler indicating that the data here might *not*
 /// be initialized:
 ///
 /// ```rust
-/// #![feature(maybe_uninit)]
 /// use std::mem::MaybeUninit;
 ///
 /// // Create an explicitly uninitialized reference. The compiler knows that data inside
 /// // a `MaybeUninit<T>` may be invalid, and hence this is not UB:
 /// let mut x = MaybeUninit::<&i32>::uninit();
 /// // Set it to a valid value.
-/// x.write(&0);
+/// unsafe { x.as_mut_ptr().write(&0); }
 /// // Extract the initialized data -- this is only allowed *after* properly
 /// // initializing `x`!
 /// let x = unsafe { x.assume_init() };
 /// ```
 ///
 /// The compiler then knows to not make any incorrect assumptions or optimizations on this code.
-//
-// FIXME before stabilizing, explain how to initialize a struct field-by-field.
+///
+/// ## out-pointers
+///
+/// You can use `MaybeUninit<T>` to implement "out-pointers": instead of returning data
+/// from a function, pass it a pointer to some (uninitialized) memory to put the
+/// result into. This can be useful when it is important for the caller to control
+/// how the memory the result is stored in gets allocated, and you want to avoid
+/// unnecessary moves.
+///
+/// ```
+/// use std::mem::MaybeUninit;
+///
+/// unsafe fn make_vec(out: *mut Vec<i32>) {
+///     // `write` does not drop the old contents, which is important.
+///     out.write(vec![1, 2, 3]);
+/// }
+///
+/// let mut v: MaybeUninit<Vec<i32>> = MaybeUninit::uninit();
+/// unsafe { make_vec(v.as_mut_ptr()); }
+/// // Now we know `v` is initialized! This also makes sure the vector gets
+/// // properly dropped.
+/// let v = unsafe { v.assume_init() };
+/// assert_eq!(&v, &[1, 2, 3]);
+/// ```
+///
+/// ## Initializing an array element-by-element
+///
+/// `MaybeUninit<T>` can be used to initialize a large array element-by-element:
+///
+/// ```
+/// use std::mem::{self, MaybeUninit};
+/// use std::ptr;
+///
+/// let data = {
+///     // Create an uninitialized array of `MaybeUninit`. The `assume_init` is
+///     // safe because the type we are claiming to have initialized here is a
+///     // bunch of `MaybeUninit`s, which do not require initialization.
+///     let mut data: [MaybeUninit<Vec<u32>>; 1000] = unsafe {
+///         MaybeUninit::uninit().assume_init()
+///     };
+///
+///     // Dropping a `MaybeUninit` does nothing, so if there is a panic during this loop,
+///     // we have a memory leak, but there is no memory safety issue.
+///     for elem in &mut data[..] {
+///         unsafe { ptr::write(elem.as_mut_ptr(), vec![42]); }
+///     }
+///
+///     // Everything is initialized. Transmute the array to the
+///     // initialized type.
+///     unsafe { mem::transmute::<_, [Vec<u32>; 1000]>(data) }
+/// };
+///
+/// assert_eq!(&data[0], &[42]);
+/// ```
+///
+/// You can also work with partially initialized arrays, which could
+/// be found in low-level datastructures.
+///
+/// ```
+/// use std::mem::MaybeUninit;
+/// use std::ptr;
+///
+/// // Create an uninitialized array of `MaybeUninit`. The `assume_init` is
+/// // safe because the type we are claiming to have initialized here is a
+/// // bunch of `MaybeUninit`s, which do not require initialization.
+/// let mut data: [MaybeUninit<String>; 1000] = unsafe { MaybeUninit::uninit().assume_init() };
+/// // Count the number of elements we have assigned.
+/// let mut data_len: usize = 0;
+///
+/// for elem in &mut data[0..500] {
+///     unsafe { ptr::write(elem.as_mut_ptr(), String::from("hello")); }
+///     data_len += 1;
+/// }
+///
+/// // For each item in the array, drop if we allocated it.
+/// for elem in &mut data[0..data_len] {
+///     unsafe { ptr::drop_in_place(elem.as_mut_ptr()); }
+/// }
+/// ```
+///
+/// ## Initializing a struct field-by-field
+///
+/// There is currently no supported way to create a raw pointer or reference
+/// to a field of a struct inside `MaybeUninit<Struct>`. That means it is not possible
+/// to create a struct by calling `MaybeUninit::uninit::<Struct>()` and then writing
+/// to its fields.
+///
+/// [ub]: ../../reference/behavior-considered-undefined.html
+///
+/// # Layout
+///
+/// `MaybeUninit<T>` is guaranteed to have the same size and alignment as `T`:
+///
+/// ```rust
+/// use std::mem::{MaybeUninit, size_of, align_of};
+/// assert_eq!(size_of::<MaybeUninit<u64>>(), size_of::<u64>());
+/// assert_eq!(align_of::<MaybeUninit<u64>>(), align_of::<u64>());
+/// ```
+///
+/// However remember that a type *containing* a `MaybeUninit<T>` is not necessarily the same
+/// layout; Rust does not in general guarantee that the fields of a `Foo<T>` have the same order as
+/// a `Foo<U>` even if `T` and `U` have the same size and alignment. Furthermore because any bit
+/// value is valid for a `MaybeUninit<T>` the compiler can't apply non-zero/niche-filling
+/// optimizations, potentially resulting in a larger size:
+///
+/// ```rust
+/// # use std::mem::{MaybeUninit, size_of, align_of};
+/// assert_eq!(size_of::<Option<bool>>(), 1);
+/// assert_eq!(size_of::<Option<MaybeUninit<bool>>>(), 2);
+/// ```
 #[allow(missing_debug_implementations)]
-#[unstable(feature = "maybe_uninit", issue = "53491")]
+#[stable(feature = "maybe_uninit", since = "1.36.0")]
 #[derive(Copy)]
-// NOTE: after stabilizing `MaybeUninit`, proceed to deprecate `mem::uninitialized`.
 pub union MaybeUninit<T> {
     uninit: (),
     value: ManuallyDrop<T>,
 }
 
-#[unstable(feature = "maybe_uninit", issue = "53491")]
+#[stable(feature = "maybe_uninit", since = "1.36.0")]
 impl<T: Copy> Clone for MaybeUninit<T> {
     #[inline(always)]
     fn clone(&self) -> Self {
@@ -1132,10 +1094,13 @@ fn clone(&self) -> Self {
 
 impl<T> MaybeUninit<T> {
     /// Creates a new `MaybeUninit<T>` initialized with the given value.
+    /// It is safe to call [`assume_init`] on the return value of this function.
     ///
     /// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
     /// It is your responsibility to make sure `T` gets dropped if it got initialized.
-    #[unstable(feature = "maybe_uninit", issue = "53491")]
+    ///
+    /// [`assume_init`]: #method.assume_init
+    #[stable(feature = "maybe_uninit", since = "1.36.0")]
     #[inline(always)]
     pub const fn new(val: T) -> MaybeUninit<T> {
         MaybeUninit { value: ManuallyDrop::new(val) }
@@ -1145,7 +1110,11 @@ pub const fn new(val: T) -> MaybeUninit<T> {
     ///
     /// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
     /// It is your responsibility to make sure `T` gets dropped if it got initialized.
-    #[unstable(feature = "maybe_uninit", issue = "53491")]
+    ///
+    /// See the [type-level documentation][type] for some examples.
+    ///
+    /// [type]: union.MaybeUninit.html
+    #[stable(feature = "maybe_uninit", since = "1.36.0")]
     #[inline(always)]
     pub const fn uninit() -> MaybeUninit<T> {
         MaybeUninit { uninit: () }
@@ -1166,7 +1135,6 @@ pub const fn uninit() -> MaybeUninit<T> {
     /// fields of the struct can hold the bit-pattern 0 as a valid value.
     ///
     /// ```rust
-    /// #![feature(maybe_uninit)]
     /// use std::mem::MaybeUninit;
     ///
     /// let x = MaybeUninit::<(u8, bool)>::zeroed();
@@ -1178,7 +1146,6 @@ pub const fn uninit() -> MaybeUninit<T> {
     /// cannot hold 0 as a valid value.
     ///
     /// ```rust,no_run
-    /// #![feature(maybe_uninit)]
     /// use std::mem::MaybeUninit;
     ///
     /// enum NotZero { One = 1, Two = 2 };
@@ -1188,7 +1155,7 @@ pub const fn uninit() -> MaybeUninit<T> {
     /// // Inside a pair, we create a `NotZero` that does not have a valid discriminant.
     /// // This is undefined behavior.
     /// ```
-    #[unstable(feature = "maybe_uninit", issue = "53491")]
+    #[stable(feature = "maybe_uninit", since = "1.36.0")]
     #[inline]
     pub fn zeroed() -> MaybeUninit<T> {
         let mut u = MaybeUninit::<T>::uninit();
@@ -1202,7 +1169,7 @@ pub fn zeroed() -> MaybeUninit<T> {
     /// without dropping it, so be careful not to use this twice unless you want to
     /// skip running the destructor. For your convenience, this also returns a mutable
     /// reference to the (now safely initialized) contents of `self`.
-    #[unstable(feature = "maybe_uninit", issue = "53491")]
+    #[unstable(feature = "maybe_uninit_extra", issue = "53491")]
     #[inline(always)]
     pub fn write(&mut self, val: T) -> &mut T {
         unsafe {
@@ -1213,13 +1180,14 @@ pub fn write(&mut self, val: T) -> &mut T {
 
     /// Gets a pointer to the contained value. Reading from this pointer or turning it
     /// into a reference is undefined behavior unless the `MaybeUninit<T>` is initialized.
+    /// Writing to memory that this pointer (non-transitively) points to is undefined behavior
+    /// (except inside an `UnsafeCell<T>`).
     ///
     /// # Examples
     ///
     /// Correct usage of this method:
     ///
     /// ```rust
-    /// #![feature(maybe_uninit)]
     /// use std::mem::MaybeUninit;
     ///
     /// let mut x = MaybeUninit::<Vec<u32>>::uninit();
@@ -1232,7 +1200,6 @@ pub fn write(&mut self, val: T) -> &mut T {
     /// *Incorrect* usage of this method:
     ///
     /// ```rust,no_run
-    /// #![feature(maybe_uninit)]
     /// use std::mem::MaybeUninit;
     ///
     /// let x = MaybeUninit::<Vec<u32>>::uninit();
@@ -1242,7 +1209,7 @@ pub fn write(&mut self, val: T) -> &mut T {
     ///
     /// (Notice that the rules around references to uninitialized data are not finalized yet, but
     /// until they are, it is advisable to avoid them.)
-    #[unstable(feature = "maybe_uninit", issue = "53491")]
+    #[stable(feature = "maybe_uninit", since = "1.36.0")]
     #[inline(always)]
     pub fn as_ptr(&self) -> *const T {
         unsafe { &*self.value as *const T }
@@ -1256,7 +1223,6 @@ pub fn as_ptr(&self) -> *const T {
     /// Correct usage of this method:
     ///
     /// ```rust
-    /// #![feature(maybe_uninit)]
     /// use std::mem::MaybeUninit;
     ///
     /// let mut x = MaybeUninit::<Vec<u32>>::uninit();
@@ -1271,7 +1237,6 @@ pub fn as_ptr(&self) -> *const T {
     /// *Incorrect* usage of this method:
     ///
     /// ```rust,no_run
-    /// #![feature(maybe_uninit)]
     /// use std::mem::MaybeUninit;
     ///
     /// let mut x = MaybeUninit::<Vec<u32>>::uninit();
@@ -1281,7 +1246,7 @@ pub fn as_ptr(&self) -> *const T {
     ///
     /// (Notice that the rules around references to uninitialized data are not finalized yet, but
     /// until they are, it is advisable to avoid them.)
-    #[unstable(feature = "maybe_uninit", issue = "53491")]
+    #[stable(feature = "maybe_uninit", since = "1.36.0")]
     #[inline(always)]
     pub fn as_mut_ptr(&mut self) -> *mut T {
         unsafe { &mut *self.value as *mut T }
@@ -1294,15 +1259,17 @@ pub fn as_mut_ptr(&mut self) -> *mut T {
     /// # Safety
     ///
     /// It is up to the caller to guarantee that the `MaybeUninit<T>` really is in an initialized
-    /// state. Calling this when the content is not yet fully initialized causes undefined
-    /// behavior.
+    /// state. Calling this when the content is not yet fully initialized causes immediate undefined
+    /// behavior. The [type-level documentation][inv] contains more information about
+    /// this initialization invariant.
+    ///
+    /// [inv]: #initialization-invariant
     ///
     /// # Examples
     ///
     /// Correct usage of this method:
     ///
     /// ```rust
-    /// #![feature(maybe_uninit)]
     /// use std::mem::MaybeUninit;
     ///
     /// let mut x = MaybeUninit::<bool>::uninit();
@@ -1314,14 +1281,13 @@ pub fn as_mut_ptr(&mut self) -> *mut T {
     /// *Incorrect* usage of this method:
     ///
     /// ```rust,no_run
-    /// #![feature(maybe_uninit)]
     /// use std::mem::MaybeUninit;
     ///
     /// let x = MaybeUninit::<Vec<u32>>::uninit();
     /// let x_init = unsafe { x.assume_init() };
     /// // `x` had not been initialized yet, so this last line caused undefined behavior.
     /// ```
-    #[unstable(feature = "maybe_uninit", issue = "53491")]
+    #[stable(feature = "maybe_uninit", since = "1.36.0")]
     #[inline(always)]
     pub unsafe fn assume_init(self) -> T {
         intrinsics::panic_if_uninhabited::<T>();
@@ -1338,13 +1304,15 @@ pub unsafe fn assume_init(self) -> T {
     ///
     /// It is up to the caller to guarantee that the `MaybeUninit<T>` really is in an initialized
     /// state. Calling this when the content is not yet fully initialized causes undefined
-    /// behavior.
+    /// behavior. The [type-level documentation][inv] contains more information about
+    /// this initialization invariant.
     ///
     /// Moreover, this leaves a copy of the same data behind in the `MaybeUninit<T>`. When using
     /// multiple copies of the data (by calling `read` multiple times, or first
     /// calling `read` and then [`assume_init`]), it is your responsibility
     /// to ensure that that data may indeed be duplicated.
     ///
+    /// [inv]: #initialization-invariant
     /// [`assume_init`]: #method.assume_init
     ///
     /// # Examples
@@ -1352,7 +1320,7 @@ pub unsafe fn assume_init(self) -> T {
     /// Correct usage of this method:
     ///
     /// ```rust
-    /// #![feature(maybe_uninit)]
+    /// #![feature(maybe_uninit_extra)]
     /// use std::mem::MaybeUninit;
     ///
     /// let mut x = MaybeUninit::<u32>::uninit();
@@ -1373,7 +1341,7 @@ pub unsafe fn assume_init(self) -> T {
     /// *Incorrect* usage of this method:
     ///
     /// ```rust,no_run
-    /// #![feature(maybe_uninit)]
+    /// #![feature(maybe_uninit_extra)]
     /// use std::mem::MaybeUninit;
     ///
     /// let mut x = MaybeUninit::<Option<Vec<u32>>>::uninit();
@@ -1383,7 +1351,7 @@ pub unsafe fn assume_init(self) -> T {
     /// // We now created two copies of the same vector, leading to a double-free when
     /// // they both get dropped!
     /// ```
-    #[unstable(feature = "maybe_uninit", issue = "53491")]
+    #[unstable(feature = "maybe_uninit_extra", issue = "53491")]
     #[inline(always)]
     pub unsafe fn read(&self) -> T {
         intrinsics::panic_if_uninhabited::<T>();
index b6de9f57b0110439227d2ba8ae5797761595b922..006b1e143eeec54772b4f7d06c385ad3b6c53c3f 100644 (file)
 /// location first:
 /// ```
 /// use std::ptr;
-/// use std::mem;
+/// use std::mem::{self, MaybeUninit};
 ///
 /// unsafe fn drop_after_copy<T>(to_drop: *mut T) {
-///     let mut copy: T = mem::uninitialized();
-///     ptr::copy(to_drop, &mut copy, 1);
-///     drop(copy);
+///     let mut copy: MaybeUninit<T> = MaybeUninit::uninit();
+///     ptr::copy(to_drop, copy.as_mut_ptr(), 1);
+///     drop(copy.assume_init());
 /// }
 ///
 /// #[repr(packed, C)]
@@ -810,9 +810,6 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
 /// to not be elided or reordered by the compiler across other volatile
 /// operations.
 ///
-/// Memory accessed with `read_volatile` or [`write_volatile`] should not be
-/// accessed with non-volatile operations.
-///
 /// [`write_volatile`]: ./fn.write_volatile.html
 ///
 /// # Notes
@@ -837,7 +834,7 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
 ///
 /// * `src` must be properly aligned.
 ///
-/// Like [`read`], `read_unaligned` creates a bitwise copy of `T`, regardless of
+/// Like [`read`], `read_volatile` creates a bitwise copy of `T`, regardless of
 /// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned
 /// value and the value at `*src` can [violate memory safety][read-ownership].
 /// However, storing non-[`Copy`] types in volatile memory is almost certainly
@@ -881,9 +878,6 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
 /// to not be elided or reordered by the compiler across other volatile
 /// operations.
 ///
-/// Memory accessed with [`read_volatile`] or `write_volatile` should not be
-/// accessed with non-volatile operations.
-///
 /// `write_volatile` does not drop the contents of `dst`. This is safe, but it
 /// could leak allocations or resources, so care should be taken not to overwrite
 /// an object that should be dropped.
index b4e91249832051d7d6fa7482669c6f5bfbb186e7..a6d611d2e93c4b83847a9791a39a28bb1a270e14 100644 (file)
@@ -10,6 +10,8 @@
 ///
 /// It consists of a data pointer and a [virtual function pointer table (vtable)][vtable] that
 /// customizes the behavior of the `RawWaker`.
+///
+/// [`Waker`]: struct.Waker.html
 #[derive(PartialEq, Debug)]
 #[stable(feature = "futures_api", since = "1.36.0")]
 pub struct RawWaker {
@@ -55,6 +57,8 @@ pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker {
 /// pointer of a properly constructed [`RawWaker`] object from inside the
 /// [`RawWaker`] implementation. Calling one of the contained functions using
 /// any other `data` pointer will cause undefined behavior.
+///
+/// [`RawWaker`]: struct.RawWaker.html
 #[stable(feature = "futures_api", since = "1.36.0")]
 #[derive(PartialEq, Copy, Clone, Debug)]
 pub struct RawWakerVTable {
@@ -65,6 +69,9 @@ pub struct RawWakerVTable {
     /// required for this additional instance of a [`RawWaker`] and associated
     /// task. Calling `wake` on the resulting [`RawWaker`] should result in a wakeup
     /// of the same task that would have been awoken by the original [`RawWaker`].
+    ///
+    /// [`Waker`]: struct.Waker.html
+    /// [`RawWaker`]: struct.RawWaker.html
     clone: unsafe fn(*const ()) -> RawWaker,
 
     /// This function will be called when `wake` is called on the [`Waker`].
@@ -73,6 +80,9 @@ pub struct RawWakerVTable {
     /// The implementation of this function must make sure to release any
     /// resources that are associated with this instance of a [`RawWaker`] and
     /// associated task.
+    ///
+    /// [`Waker`]: struct.Waker.html
+    /// [`RawWaker`]: struct.RawWaker.html
     wake: unsafe fn(*const ()),
 
     /// This function will be called when `wake_by_ref` is called on the [`Waker`].
@@ -80,6 +90,9 @@ pub struct RawWakerVTable {
     ///
     /// This function is similar to `wake`, but must not consume the provided data
     /// pointer.
+    ///
+    /// [`Waker`]: struct.Waker.html
+    /// [`RawWaker`]: struct.RawWaker.html
     wake_by_ref: unsafe fn(*const ()),
 
     /// This function gets called when a [`RawWaker`] gets dropped.
@@ -87,6 +100,8 @@ pub struct RawWakerVTable {
     /// The implementation of this function must make sure to release any
     /// resources that are associated with this instance of a [`RawWaker`] and
     /// associated task.
+    ///
+    /// [`RawWaker`]: struct.RawWaker.html
     drop: unsafe fn(*const ()),
 }
 
@@ -128,6 +143,9 @@ impl RawWakerVTable {
     /// The implementation of this function must make sure to release any
     /// resources that are associated with this instance of a [`RawWaker`] and
     /// associated task.
+    ///
+    /// [`Waker`]: struct.Waker.html
+    /// [`RawWaker`]: struct.RawWaker.html
     #[rustc_promotable]
     #[cfg_attr(stage0, unstable(feature = "futures_api_const_fn_ptr", issue = "50547"))]
     #[cfg_attr(not(stage0), stable(feature = "futures_api", since = "1.36.0"))]
@@ -201,6 +219,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 /// executor-specific wakeup behavior.
 ///
 /// Implements [`Clone`], [`Send`], and [`Sync`].
+///
+/// [`RawWaker`]: struct.RawWaker.html
 #[repr(transparent)]
 #[stable(feature = "futures_api", since = "1.36.0")]
 pub struct Waker {
@@ -266,6 +286,9 @@ pub fn will_wake(&self, other: &Waker) -> bool {
     /// The behavior of the returned `Waker` is undefined if the contract defined
     /// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld.
     /// Therefore this method is unsafe.
+    ///
+    /// [`RawWaker`]: struct.RawWaker.html
+    /// [`RawWakerVTable`]: struct.RawWakerVTable.html
     #[inline]
     #[stable(feature = "futures_api", since = "1.36.0")]
     pub unsafe fn from_raw(waker: RawWaker) -> Waker {
diff --git a/src/libcore/tests/alloc.rs b/src/libcore/tests/alloc.rs
new file mode 100644 (file)
index 0000000..63537ba
--- /dev/null
@@ -0,0 +1,10 @@
+use core::alloc::Layout;
+
+#[test]
+fn const_unchecked_layout() {
+    const SIZE: usize = 0x2000;
+    const ALIGN: usize = 0x1000;
+    const LAYOUT: Layout = unsafe { Layout::from_size_align_unchecked(SIZE, ALIGN) };
+    assert_eq!(LAYOUT.size(), SIZE);
+    assert_eq!(LAYOUT.align(), ALIGN);
+}
index b8075ef2942e083d67d7af6f5778b68fcb7b648a..c617596aba80159af2ecb5f3c4967bc099897f8f 100644 (file)
 #![feature(slice_partition_dedup)]
 #![feature(copy_within)]
 #![feature(int_error_matching)]
+#![feature(const_fn)]
 #![warn(rust_2018_idioms)]
 
 extern crate test;
 
+mod alloc;
 mod any;
 mod array;
 mod ascii;
index b268a1a494d107cc92b1996b51374f89e61fd2e9..0c4f5fb3fc167bd701087e504c7fa5feab06c876 100644 (file)
@@ -96,34 +96,20 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 impl serialize::UseSpecializedEncodable for CrateNum {}
 impl serialize::UseSpecializedDecodable for CrateNum {}
 
-/// A DefIndex is an index into the hir-map for a crate, identifying a
-/// particular definition. It should really be considered an interned
-/// shorthand for a particular DefPath.
-#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)]
-pub struct DefIndex(u32);
-
-/// The crate root is always assigned index 0 by the AST Map code,
-/// thanks to `NodeCollector::new`.
-pub const CRATE_DEF_INDEX: DefIndex = DefIndex(0);
+newtype_index! {
+    /// A DefIndex is an index into the hir-map for a crate, identifying a
+    /// particular definition. It should really be considered an interned
+    /// shorthand for a particular DefPath.
+    pub struct DefIndex {
+        DEBUG_FORMAT = "DefIndex({})",
 
-impl fmt::Debug for DefIndex {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "DefIndex({})", self.as_array_index())
+        /// The crate root is always assigned index 0 by the AST Map code,
+        /// thanks to `NodeCollector::new`.
+        const CRATE_DEF_INDEX = 0,
     }
 }
 
 impl DefIndex {
-    /// Converts this DefIndex into a zero-based array index.
-    #[inline]
-    pub fn as_array_index(&self) -> usize {
-        self.0 as usize
-    }
-
-    #[inline]
-    pub fn from_array_index(i: usize) -> DefIndex {
-        DefIndex(i as u32)
-    }
-
     // Proc macros from a proc-macro crate have a kind of virtual DefIndex. This
     // function maps the index of the macro within the crate (which is also the
     // index of the macro in the CrateMetadata::proc_macros array) to the
@@ -132,7 +118,7 @@ pub fn from_proc_macro_index(proc_macro_index: usize) -> DefIndex {
         // DefIndex for proc macros start from FIRST_FREE_DEF_INDEX,
         // because the first FIRST_FREE_DEF_INDEX indexes are reserved
         // for internal use.
-        let def_index = DefIndex::from_array_index(
+        let def_index = DefIndex::from(
             proc_macro_index.checked_add(FIRST_FREE_DEF_INDEX)
                 .expect("integer overflow adding `proc_macro_index`"));
         assert!(def_index != CRATE_DEF_INDEX);
@@ -141,19 +127,11 @@ pub fn from_proc_macro_index(proc_macro_index: usize) -> DefIndex {
 
     // This function is the reverse of from_proc_macro_index() above.
     pub fn to_proc_macro_index(self: DefIndex) -> usize {
-        self.as_array_index().checked_sub(FIRST_FREE_DEF_INDEX)
+        self.index().checked_sub(FIRST_FREE_DEF_INDEX)
             .unwrap_or_else(|| {
                 bug!("using local index {:?} as proc-macro index", self)
             })
     }
-
-    pub fn from_raw_u32(x: u32) -> DefIndex {
-        DefIndex(x)
-    }
-
-    pub fn as_raw_u32(&self) -> u32 {
-        self.0
-    }
 }
 
 impl serialize::UseSpecializedEncodable for DefIndex {}
@@ -169,7 +147,7 @@ pub struct DefId {
 
 impl fmt::Debug for DefId {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "DefId({}:{}", self.krate, self.index.as_array_index())?;
+        write!(f, "DefId({}:{}", self.krate, self.index.index())?;
 
         ty::tls::with_opt(|opt_tcx| {
             if let Some(tcx) = opt_tcx {
index dd0d13d8f5a6aea74ae0498538285a36463d4209..3ec4d4e8cc8f68350eba397be435676d2c89fc91 100644 (file)
@@ -97,6 +97,10 @@ pub struct LoweringContext<'a> {
     is_generator: bool,
     is_async_body: bool,
 
+    /// Used to get the current `fn`'s def span to point to when using `await`
+    /// outside of an `async fn`.
+    current_item: Option<Span>,
+
     catch_scopes: Vec<NodeId>,
     loop_scopes: Vec<NodeId>,
     is_in_loop_condition: bool,
@@ -250,6 +254,7 @@ pub fn lower_crate(
         node_id_to_hir_id: IndexVec::new(),
         is_generator: false,
         is_async_body: false,
+        current_item: None,
         is_in_trait_impl: false,
         lifetimes_to_define: Vec::new(),
         is_collecting_in_band_lifetimes: false,
@@ -850,10 +855,6 @@ fn diagnostic(&self) -> &errors::Handler {
         self.sess.diagnostic()
     }
 
-    fn str_to_ident(&self, s: &'static str) -> Ident {
-        Ident::with_empty_ctxt(Symbol::gensym(s))
-    }
-
     fn with_anonymous_lifetime_mode<R>(
         &mut self,
         anonymous_lifetime_mode: AnonymousLifetimeMode,
@@ -2213,7 +2214,7 @@ fn lower_parenthesized_parameter_data(
                         bindings: hir_vec![
                             hir::TypeBinding {
                                 hir_id: this.next_id(),
-                                ident: Ident::from_str(FN_OUTPUT_NAME),
+                                ident: Ident::with_empty_ctxt(FN_OUTPUT_NAME),
                                 ty: output
                                     .as_ref()
                                     .map(|ty| this.lower_ty(&ty, ImplTraitContext::disallowed()))
@@ -2538,7 +2539,7 @@ fn lower_async_fn_output_type_to_future_bound(
         let future_params = P(hir::GenericArgs {
             args: hir_vec![],
             bindings: hir_vec![hir::TypeBinding {
-                ident: Ident::from_str(FN_OUTPUT_NAME),
+                ident: Ident::with_empty_ctxt(FN_OUTPUT_NAME),
                 ty: output_ty,
                 hir_id: self.next_id(),
                 span,
@@ -3116,6 +3117,7 @@ fn lower_item_kind(
             ItemKind::Fn(ref decl, ref header, ref generics, ref body) => {
                 let fn_def_id = self.resolver.definitions().local_def_id(id);
                 self.with_new_scopes(|this| {
+                    this.current_item = Some(ident.span);
                     let mut lower_fn = |decl: &FnDecl| {
                         // Note: we don't need to change the return type from `T` to
                         // `impl Future<Output = T>` here because lower_body
@@ -3654,6 +3656,7 @@ fn lower_impl_item(&mut self, i: &ImplItem) -> hir::ImplItem {
                 } else {
                     lower_method(sig)
                 };
+                self.current_item = Some(i.span);
 
                 (generics, hir::ImplItemKind::Method(sig, body_id))
             }
@@ -4270,6 +4273,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                     let fn_decl = self.lower_fn_decl(decl, None, false, None);
 
                     self.with_new_scopes(|this| {
+                        this.current_item = Some(fn_decl_span);
                         let mut is_generator = false;
                         let body_id = this.lower_body(Some(decl), |this| {
                             let e = this.lower_expr(body);
@@ -4613,18 +4617,18 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 );
                 head.span = desugared_span;
 
-                let iter = self.str_to_ident("iter");
+                let iter = Ident::with_empty_ctxt(sym::iter);
 
-                let next_ident = self.str_to_ident("__next");
+                let next_ident = Ident::with_empty_ctxt(sym::__next);
                 let (next_pat, next_pat_hid) = self.pat_ident_binding_mode(
                     desugared_span,
                     next_ident,
                     hir::BindingAnnotation::Mutable,
                 );
 
-                // `::std::option::Option::Some(val) => next = val`
+                // `::std::option::Option::Some(val) => __next = val`
                 let pat_arm = {
-                    let val_ident = self.str_to_ident("val");
+                    let val_ident = Ident::with_empty_ctxt(sym::val);
                     let (val_pat, val_pat_hid) = self.pat_ident(pat.span, val_ident);
                     let val_expr = P(self.expr_ident(pat.span, val_ident, val_pat_hid));
                     let next_expr = P(self.expr_ident(pat.span, next_ident, next_pat_hid));
@@ -4763,17 +4767,13 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 let unstable_span = self.sess.source_map().mark_span_with_reason(
                     CompilerDesugaringKind::QuestionMark,
                     e.span,
-                    Some(vec![
-                        Symbol::intern("try_trait")
-                    ].into()),
+                    Some(vec![sym::try_trait].into()),
                 );
                 let try_span = self.sess.source_map().end_point(e.span);
                 let try_span = self.sess.source_map().mark_span_with_reason(
                     CompilerDesugaringKind::QuestionMark,
                     try_span,
-                    Some(vec![
-                        Symbol::intern("try_trait")
-                    ].into()),
+                    Some(vec![sym::try_trait].into()),
                 );
 
                 // `Try::into_result(<expr>)`
@@ -4793,8 +4793,9 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 let attr = {
                     // `allow(unreachable_code)`
                     let allow = {
-                        let allow_ident = Ident::from_str("allow").with_span_pos(e.span);
-                        let uc_ident = Ident::from_str("unreachable_code").with_span_pos(e.span);
+                        let allow_ident = Ident::with_empty_ctxt(sym::allow).with_span_pos(e.span);
+                        let uc_ident = Ident::with_empty_ctxt(sym::unreachable_code)
+                            .with_span_pos(e.span);
                         let uc_nested = attr::mk_nested_word_item(uc_ident);
                         attr::mk_list_item(e.span, allow_ident, vec![uc_nested])
                     };
@@ -4804,7 +4805,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
 
                 // `Ok(val) => #[allow(unreachable_code)] val,`
                 let ok_arm = {
-                    let val_ident = self.str_to_ident("val");
+                    let val_ident = Ident::with_empty_ctxt(sym::val);
                     let (val_pat, val_pat_nid) = self.pat_ident(e.span, val_ident);
                     let val_expr = P(self.expr_ident_with_attrs(
                         e.span,
@@ -4820,7 +4821,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 // `Err(err) => #[allow(unreachable_code)]
                 //              return Try::from_error(From::from(err)),`
                 let err_arm = {
-                    let err_ident = self.str_to_ident("err");
+                    let err_ident = Ident::with_empty_ctxt(sym::err);
                     let (err_local, err_local_nid) = self.pat_ident(try_span, err_ident);
                     let from_expr = {
                         let from_path = &[sym::convert, sym::From, sym::from];
@@ -5544,20 +5545,25 @@ fn lower_await(
         //         match ::std::future::poll_with_tls_context(unsafe {
         //             ::std::pin::Pin::new_unchecked(&mut pinned)
         //         }) {
-        //             ::std::task::Poll::Ready(x) => break x,
+        //             ::std::task::Poll::Ready(result) => break result,
         //             ::std::task::Poll::Pending => {},
         //         }
         //         yield ();
         //     }
         // }
         if !self.is_async_body {
-            span_err!(
+            let mut err = struct_span_err!(
                 self.sess,
                 await_span,
                 E0728,
                 "`await` is only allowed inside `async` functions and blocks"
             );
-            self.sess.abort_if_errors();
+            err.span_label(await_span, "only allowed inside `async` functions and blocks");
+            if let Some(item_sp) = self.current_item {
+                err.span_label(item_sp, "this is not `async`");
+            }
+            err.emit();
+            return hir::ExprKind::Err;
         }
         let span = self.sess.source_map().mark_span_with_reason(
             CompilerDesugaringKind::Await,
@@ -5567,12 +5573,12 @@ fn lower_await(
         let gen_future_span = self.sess.source_map().mark_span_with_reason(
             CompilerDesugaringKind::Await,
             await_span,
-            Some(vec![Symbol::intern("gen_future")].into()),
+            Some(vec![sym::gen_future].into()),
         );
 
         // let mut pinned = <expr>;
         let expr = P(self.lower_expr(expr));
-        let pinned_ident = self.str_to_ident("pinned");
+        let pinned_ident = Ident::with_empty_ctxt(sym::pinned);
         let (pinned_pat, pinned_pat_hid) = self.pat_ident_binding_mode(
             span,
             pinned_ident,
@@ -5608,11 +5614,11 @@ fn lower_await(
             ))
         };
 
-        // `::std::task::Poll::Ready(x) => break x`
+        // `::std::task::Poll::Ready(result) => break result`
         let loop_node_id = self.sess.next_node_id();
         let loop_hir_id = self.lower_node_id(loop_node_id);
         let ready_arm = {
-            let x_ident = self.str_to_ident("x");
+            let x_ident = Ident::with_empty_ctxt(sym::result);
             let (x_pat, x_pat_hid) = self.pat_ident(span, x_ident);
             let x_expr = P(self.expr_ident(span, x_ident, x_pat_hid));
             let ready_pat = self.pat_std_enum(
index a1cf338bf12ea991e6199dc2363cafc34ffe6723..eeba628b3bf2168ad943ac41fe4cca076ed5bf72 100644 (file)
@@ -226,7 +226,7 @@ pub(super) fn finalize_and_compute_crate_hash(mut self,
 
     fn insert_entry(&mut self, id: HirId, entry: Entry<'hir>) {
         debug!("hir_map: {:?} => {:?}", id, entry);
-        let local_map = &mut self.map[id.owner.as_array_index()];
+        let local_map = &mut self.map[id.owner.index()];
         let i = id.local_id.as_u32() as usize;
         if local_map.is_none() {
             *local_map = Some(IndexVec::with_capacity(i + 1));
index dc6cddc89f9128e490dc49297553ffedae6916f5..1cc9a2c0e8a1b9d875b7f9a31520c5644f727e76 100644 (file)
@@ -17,7 +17,7 @@
 use std::hash::Hash;
 use syntax::ast;
 use syntax::ext::hygiene::Mark;
-use syntax::symbol::{Symbol, InternedString};
+use syntax::symbol::{Symbol, sym, InternedString};
 use syntax_pos::{Span, DUMMY_SP};
 use crate::util::nodemap::NodeMap;
 
@@ -38,7 +38,7 @@ fn allocate(&mut self,
                 def_path_hash: DefPathHash)
                 -> DefIndex {
         let index = {
-            let index = DefIndex::from_array_index(self.index_to_key.len());
+            let index = DefIndex::from(self.index_to_key.len());
             debug!("DefPathTable::insert() - {:?} <-> {:?}", key, index);
             self.index_to_key.push(key);
             index
@@ -49,17 +49,17 @@ fn allocate(&mut self,
     }
 
     pub fn next_id(&self) -> DefIndex {
-        DefIndex::from_array_index(self.index_to_key.len())
+        DefIndex::from(self.index_to_key.len())
     }
 
     #[inline(always)]
     pub fn def_key(&self, index: DefIndex) -> DefKey {
-        self.index_to_key[index.as_array_index()].clone()
+        self.index_to_key[index.index()].clone()
     }
 
     #[inline(always)]
     pub fn def_path_hash(&self, index: DefIndex) -> DefPathHash {
-        let ret = self.def_path_hashes[index.as_array_index()];
+        let ret = self.def_path_hashes[index.index()];
         debug!("def_path_hash({:?}) = {:?}", index, ret);
         return ret
     }
@@ -74,7 +74,7 @@ pub fn add_def_path_hashes_to(&self,
                 .map(|(index, &hash)| {
                     let def_id = DefId {
                         krate: cnum,
-                        index: DefIndex::from_array_index(index),
+                        index: DefIndex::from(index),
                     };
                     (hash, def_id)
                 })
@@ -387,7 +387,7 @@ pub fn local_def_id(&self, node: ast::NodeId) -> DefId {
     #[inline]
     pub fn as_local_node_id(&self, def_id: DefId) -> Option<ast::NodeId> {
         if def_id.krate == LOCAL_CRATE {
-            let node_id = self.def_index_to_node[def_id.index.as_array_index()];
+            let node_id = self.def_index_to_node[def_id.index.index()];
             if node_id != ast::DUMMY_NODE_ID {
                 return Some(node_id);
             }
@@ -417,7 +417,7 @@ pub fn node_to_hir_id(&self, node_id: ast::NodeId) -> hir::HirId {
 
     #[inline]
     pub fn def_index_to_hir_id(&self, def_index: DefIndex) -> hir::HirId {
-        let node_id = self.def_index_to_node[def_index.as_array_index()];
+        let node_id = self.def_index_to_node[def_index.index()];
         self.node_to_hir_id[node_id]
     }
 
@@ -508,7 +508,7 @@ pub fn create_def_with_parent(&mut self,
 
         // Create the definition.
         let index = self.table.allocate(key, def_path_hash);
-        assert_eq!(index.as_array_index(), self.def_index_to_node.len());
+        assert_eq!(index.index(), self.def_index_to_node.len());
         self.def_index_to_node.push(node_id);
 
         // Some things for which we allocate DefIndices don't correspond to
@@ -584,16 +584,16 @@ pub fn as_interned_str(&self) -> InternedString {
                 return name
             }
             // note that this does not show up in user printouts
-            CrateRoot => "{{crate}}",
-            Impl => "{{impl}}",
-            Misc => "{{misc}}",
-            ClosureExpr => "{{closure}}",
-            Ctor => "{{constructor}}",
-            AnonConst => "{{constant}}",
-            ImplTrait => "{{opaque}}",
+            CrateRoot => sym::double_braced_crate,
+            Impl => sym::double_braced_impl,
+            Misc => sym::double_braced_misc,
+            ClosureExpr => sym::double_braced_closure,
+            Ctor => sym::double_braced_constructor,
+            AnonConst => sym::double_braced_constant,
+            ImplTrait => sym::double_braced_opaque,
         };
 
-        Symbol::intern(s).as_interned_str()
+        s.as_interned_str()
     }
 
     pub fn to_string(&self) -> String {
@@ -653,7 +653,7 @@ pub fn def_index(&self, def_path_table: &DefPathTable) -> DefIndex {
                                           .position(|k| *k == def_key)
                                           .unwrap();
 
-                DefIndex::from_array_index(index)
+                DefIndex::from(index)
             }
 
             fn name(&self) -> Symbol {
index b8ee98551a20e758f4b025f7fc54167a87bd2309..4b94f772554e76910aa228856853fe0ad3e65cb0 100644 (file)
@@ -189,7 +189,7 @@ pub struct Map<'hir> {
 impl<'hir> Map<'hir> {
     #[inline]
     fn lookup(&self, id: HirId) -> Option<&Entry<'hir>> {
-        let local_map = self.map.get(id.owner.as_array_index())?;
+        let local_map = self.map.get(id.owner.index())?;
         local_map.as_ref()?.get(id.local_id)?.as_ref()
     }
 
@@ -1023,7 +1023,7 @@ fn all_ids<'a>(&'a self) -> impl Iterator<Item = HirId> + 'a {
             local_map.iter_enumerated().filter_map(move |(i, entry)| entry.map(move |_| {
                 // Reconstruct the HirId based on the 3 indices we used to find it
                 HirId {
-                    owner: DefIndex::from_array_index(array_index),
+                    owner: DefIndex::from(array_index),
                     local_id: i,
                 }
             }))
index f407be4e87b828390db961551aa7d19e24607e1d..57304c5ed37aec722b0f860cab48ff126235fb2f 100644 (file)
@@ -609,9 +609,9 @@ pub fn own_counts(&self) -> GenericParamCount {
         own_counts
     }
 
-    pub fn get_named(&self, name: &InternedString) -> Option<&GenericParam> {
+    pub fn get_named(&self, name: InternedString) -> Option<&GenericParam> {
         for param in &self.params {
-            if *name == param.name.ident().as_interned_str() {
+            if name == param.name.ident().as_interned_str() {
                 return Some(param);
             }
         }
@@ -1356,7 +1356,7 @@ pub struct Expr {
 
 // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
 #[cfg(target_arch = "x86_64")]
-static_assert!(MEM_SIZE_OF_EXPR: std::mem::size_of::<Expr>() == 72);
+static_assert_size!(Expr, 72);
 
 impl Expr {
     pub fn precedence(&self) -> ExprPrecedence {
index 4b6e7da333081891add336eb6ac22a3fd79f80b0..e4505a240379f0047bbde6f12e9f1e85c2f7612d 100644 (file)
@@ -194,20 +194,20 @@ fn msg_span_from_early_bound_and_free_regions(
                 let mut sp = cm.def_span(self.hir().span_by_hir_id(node));
                 if let Some(param) = self.hir()
                     .get_generics(scope)
-                    .and_then(|generics| generics.get_named(&br.name))
+                    .and_then(|generics| generics.get_named(br.name))
                 {
                     sp = param.span;
                 }
                 (format!("the lifetime {} as defined on", br.name), sp)
             }
             ty::ReFree(ty::FreeRegion {
-                bound_region: ty::BoundRegion::BrNamed(_, ref name),
+                bound_region: ty::BoundRegion::BrNamed(_, name),
                 ..
             }) => {
                 let mut sp = cm.def_span(self.hir().span_by_hir_id(node));
                 if let Some(param) = self.hir()
                     .get_generics(scope)
-                    .and_then(|generics| generics.get_named(&name))
+                    .and_then(|generics| generics.get_named(name))
                 {
                     sp = param.span;
                 }
index 3ed28a1f9882562f495db732b2052a5dc41f46b9..feade7a8f56f26d1c8b7e4b73e8bca45f4d8af60 100644 (file)
@@ -43,7 +43,7 @@ pub(super) fn find_arg_with_region(
     ) -> Option<AnonymousArgInfo<'_>> {
         let (id, bound_region) = match *anon_region {
             ty::ReFree(ref free_region) => (free_region.scope, free_region.bound_region),
-            ty::ReEarlyBound(ref ebr) => (
+            ty::ReEarlyBound(ebr) => (
                 self.tcx().parent(ebr.def_id).unwrap(),
                 ty::BoundRegion::BrNamed(ebr.def_id, ebr.name),
             ),
index 073a3f74422c6ff2bdf82ca62f0e3fe2f7b4ecc6..1878afd581dd48746bc6fd4a2512f39ba2848d00 100644 (file)
@@ -56,7 +56,7 @@ pub fn maybe_print_constraints_for<'a, 'gcx, 'tcx>(
     }
 
     let requested_node = env::var("RUST_REGION_GRAPH_NODE")
-        .ok().and_then(|s| s.parse().map(DefIndex::from_raw_u32).ok());
+        .ok().and_then(|s| s.parse().map(DefIndex::from_u32).ok());
 
     if requested_node.is_some() && requested_node != Some(context.index) {
         return;
@@ -90,7 +90,7 @@ pub fn maybe_print_constraints_for<'a, 'gcx, 'tcx>(
             let mut new_str = String::new();
             for c in output_template.chars() {
                 if c == '%' {
-                    new_str.push_str(&context.index.as_raw_u32().to_string());
+                    new_str.push_str(&context.index.as_u32().to_string());
                 } else {
                     new_str.push(c);
                 }
index 993e1aacb4e4d29386b1001bedd86fa2bdcf566a..69d865f53d469f3083a0bcd6abb6410947f3dc77 100644 (file)
     "detects generic lifetime arguments in path segments with late bound lifetime parameters"
 }
 
-declare_lint! {
-    pub INCOHERENT_FUNDAMENTAL_IMPLS,
-    Deny,
-    "potentially-conflicting impls were erroneously allowed"
-}
-
 declare_lint! {
     pub ORDER_DEPENDENT_TRAIT_OBJECTS,
     Deny,
@@ -428,7 +422,6 @@ pub mod parser {
         MISSING_FRAGMENT_SPECIFIER,
         PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
         LATE_BOUND_LIFETIME_ARGUMENTS,
-        INCOHERENT_FUNDAMENTAL_IMPLS,
         ORDER_DEPENDENT_TRAIT_OBJECTS,
         DEPRECATED,
         UNUSED_UNSAFE,
index e713cf8d805531669f4d6a4759d046986e0240f2..7e1e751e856478197de92a2e69dc2e2b86ebcea3 100644 (file)
@@ -828,8 +828,8 @@ fn path_qualified(
 
                 // This shouldn't ever be needed, but just in case:
                 Ok(vec![match trait_ref {
-                    Some(trait_ref) => Symbol::intern(&format!("{:?}", trait_ref)).as_str(),
-                    None => Symbol::intern(&format!("<{}>", self_ty)).as_str(),
+                    Some(trait_ref) => LocalInternedString::intern(&format!("{:?}", trait_ref)),
+                    None => LocalInternedString::intern(&format!("<{}>", self_ty)),
                 }])
             }
 
@@ -845,9 +845,10 @@ fn path_append_impl(
                 // This shouldn't ever be needed, but just in case:
                 path.push(match trait_ref {
                     Some(trait_ref) => {
-                        Symbol::intern(&format!("<impl {} for {}>", trait_ref, self_ty)).as_str()
+                        LocalInternedString::intern(&format!("<impl {} for {}>", trait_ref,
+                                                    self_ty))
                     },
-                    None => Symbol::intern(&format!("<impl {}>", self_ty)).as_str(),
+                    None => LocalInternedString::intern(&format!("<impl {}>", self_ty)),
                 });
 
                 Ok(path)
index 68b65f9b4a1ccfa9c948d76a4f1b8310e209f9a3..9c4683e094634eea384d348ff8c2b9785a6c6dfe 100644 (file)
@@ -778,6 +778,9 @@ fn lint_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, cnum: CrateNum)
 
     let push = builder.levels.push(&krate.attrs);
     builder.levels.register_id(hir::CRATE_HIR_ID);
+    for macro_def in &krate.exported_macros {
+       builder.levels.register_id(macro_def.hir_id);
+    }
     intravisit::walk_crate(&mut builder, krate);
     builder.levels.pop(push);
 
index 8ef4e9ac8f45faeb357b0a56aa5b172e84967c55..37681ad7fcdd2bc51708264a8246e7a8a3ede9f0 100644 (file)
@@ -158,7 +158,7 @@ pub struct FirstStatementIndex { .. }
 impl_stable_hash_for!(struct crate::middle::region::FirstStatementIndex { private });
 
 // compilation error if size of `ScopeData` is not the same as a `u32`
-static_assert!(ASSERT_SCOPE_DATA: mem::size_of::<ScopeData>() == 4);
+static_assert_size!(ScopeData, 4);
 
 impl Scope {
     /// Returns a item-local ID associated with this scope.
index 75e0f704a58545e239e05f14ba0ad9990cf8bb46..59b7891b90fde918284e32a82dfdf68ffa0aeeec 100644 (file)
@@ -78,7 +78,7 @@ pub struct Pointer<Tag=(),Id=AllocId> {
     pub tag: Tag,
 }
 
-static_assert!(POINTER_SIZE: ::std::mem::size_of::<Pointer>() == 16);
+static_assert_size!(Pointer, 16);
 
 /// Produces a `Pointer` which points to the beginning of the Allocation
 impl From<AllocId> for Pointer {
index 7e45568725f3557c67e0c021ee700881a6e14832..551b86390db4c43d1e0a3253cf2a16c11776c2ae 100644 (file)
@@ -54,7 +54,7 @@ pub enum ConstValue<'tcx> {
 }
 
 #[cfg(target_arch = "x86_64")]
-static_assert!(CONST_SIZE: ::std::mem::size_of::<ConstValue<'static>>() == 40);
+static_assert_size!(ConstValue<'_>, 40);
 
 impl<'tcx> ConstValue<'tcx> {
     #[inline]
@@ -111,7 +111,7 @@ pub enum Scalar<Tag=(), Id=AllocId> {
 }
 
 #[cfg(target_arch = "x86_64")]
-static_assert!(SCALAR_SIZE: ::std::mem::size_of::<Scalar>() == 24);
+static_assert_size!(Scalar, 24);
 
 impl<Tag> fmt::Display for Scalar<Tag> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
index bd67aabfe8e5f77b5688231077929dad626236f6..dd43cb2f18ece8d3c09ec480dc786b12f97c2295 100644 (file)
@@ -1738,7 +1738,7 @@ pub struct Statement<'tcx> {
 
 // `Statement` is used a lot. Make sure it doesn't unintentionally get bigger.
 #[cfg(target_arch = "x86_64")]
-static_assert!(MEM_SIZE_OF_STATEMENT: mem::size_of::<Statement<'_>>() == 56);
+static_assert_size!(Statement<'_>, 56);
 
 impl<'tcx> Statement<'tcx> {
     /// Changes a statement to a nop. This is both faster than deleting instructions and avoids
@@ -1997,10 +1997,9 @@ pub enum ProjectionElem<V, T> {
 /// and the index is a local.
 pub type PlaceElem<'tcx> = ProjectionElem<Local, Ty<'tcx>>;
 
-// at least on 64 bit systems, `PlaceElem` should not be larger than two pointers
-static_assert!(PROJECTION_ELEM_IS_2_PTRS_LARGE:
-    mem::size_of::<PlaceElem<'_>>() <= 16
-);
+// At least on 64 bit systems, `PlaceElem` should not be larger than two pointers.
+#[cfg(target_arch = "x86_64")]
+static_assert_size!(PlaceElem<'_>, 16);
 
 /// Alias for projections as they appear in `UserTypeProjection`, where we
 /// need neither the `V` parameter for `Index` nor the `T` for `Field`.
index e82e90ede8c103daf1c91cca1a5daa669612b3bc..a26468b0fb6ce0560bc1a1cb46c404dddd0a1872 100644 (file)
@@ -1,6 +1,6 @@
 use crate::hir::def_id::{DefId, CrateNum, LOCAL_CRATE};
 use crate::hir::HirId;
-use syntax::symbol::{Symbol, InternedString};
+use syntax::symbol::InternedString;
 use crate::ty::{Instance, TyCtxt};
 use crate::util::nodemap::FxHashMap;
 use rustc_data_structures::base_n;
@@ -280,7 +280,7 @@ pub fn build_cgu_name<I, C, S>(&mut self,
             cgu_name
         } else {
             let cgu_name = &cgu_name.as_str()[..];
-            Symbol::intern(&CodegenUnit::mangle_name(cgu_name)).as_interned_str()
+            InternedString::intern(&CodegenUnit::mangle_name(cgu_name))
         }
     }
 
@@ -336,6 +336,6 @@ pub fn build_cgu_name_no_mangle<I, C, S>(&mut self,
             write!(cgu_name, ".{}", special_suffix).unwrap();
         }
 
-        Symbol::intern(&cgu_name[..]).as_interned_str()
+        InternedString::intern(&cgu_name[..])
     }
 }
index d3fa5e84b6ad1fde4e98cd251752e372587b1cf2..5135aeb2392cd85e054023c22c1cf6077a004bac 100644 (file)
@@ -17,9 +17,9 @@ pub struct PlaceTy<'tcx> {
     pub variant_index: Option<VariantIdx>,
 }
 
-static_assert!(PLACE_TY_IS_3_PTRS_LARGE:
-    mem::size_of::<PlaceTy<'_>>() <= 24
-);
+// At least on 64 bit systems, `PlaceTy` should not be larger than two or three pointers.
+#[cfg(target_arch = "x86_64")]
+static_assert_size!(PlaceTy<'_>, 16);
 
 impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> {
     pub fn from_ty(ty: Ty<'tcx>) -> PlaceTy<'tcx> {
index b5e3c4cda0a66f20d13297585046b7b35e5e1944..f16137bd2c27ade42d3d91d35403cbd5ae0b04d9 100644 (file)
@@ -1853,7 +1853,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
 
 // Convert strings provided as --cfg [cfgspec] into a crate_cfg
 pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String>)> {
-    syntax::with_globals(move || {
+    syntax::with_default_globals(move || {
         let cfg = cfgspecs.into_iter().map(|s| {
             let sess = parse::ParseSess::new(FilePathMapping::empty());
             let filename = FileName::cfg_spec_source_code(&s);
@@ -2735,7 +2735,7 @@ fn mk_map<K: Ord, V>(entries: Vec<(K, V)>) -> BTreeMap<K, V> {
     // When the user supplies --test we should implicitly supply --cfg test
     #[test]
     fn test_switch_implies_cfg_test() {
-        syntax::with_globals(|| {
+        syntax::with_default_globals(|| {
             let matches = &match optgroups().parse(&["--test".to_string()]) {
                 Ok(m) => m,
                 Err(f) => panic!("test_switch_implies_cfg_test: {}", f),
@@ -2753,7 +2753,7 @@ fn test_switch_implies_cfg_test() {
     #[test]
     fn test_switch_implies_cfg_test_unless_cfg_test() {
         use syntax::symbol::sym;
-        syntax::with_globals(|| {
+        syntax::with_default_globals(|| {
             let matches = &match optgroups().parse(&["--test".to_string(),
                                                      "--cfg=test".to_string()]) {
                 Ok(m) => m,
@@ -2771,7 +2771,7 @@ fn test_switch_implies_cfg_test_unless_cfg_test() {
 
     #[test]
     fn test_can_print_warnings() {
-        syntax::with_globals(|| {
+        syntax::with_default_globals(|| {
             let matches = optgroups().parse(&["-Awarnings".to_string()]).unwrap();
             let registry = errors::registry::Registry::new(&[]);
             let (sessopts, _) = build_session_options_and_crate_config(&matches);
@@ -2779,7 +2779,7 @@ fn test_can_print_warnings() {
             assert!(!sess.diagnostic().flags.can_emit_warnings);
         });
 
-        syntax::with_globals(|| {
+        syntax::with_default_globals(|| {
             let matches = optgroups()
                 .parse(&["-Awarnings".to_string(), "-Dwarnings".to_string()])
                 .unwrap();
@@ -2789,7 +2789,7 @@ fn test_can_print_warnings() {
             assert!(sess.diagnostic().flags.can_emit_warnings);
         });
 
-        syntax::with_globals(|| {
+        syntax::with_default_globals(|| {
             let matches = optgroups().parse(&["-Adead_code".to_string()]).unwrap();
             let registry = errors::registry::Registry::new(&[]);
             let (sessopts, _) = build_session_options_and_crate_config(&matches);
index df2688397102299ab0c1602a27fd53a27e714cea..9019c4a0575d40b9c5c12df1aa7fb6335cd946cf 100644 (file)
@@ -643,13 +643,16 @@ pub fn report_selection_error(
                             .map(|s| &s == "?")
                             .unwrap_or(false);
                         let is_from = format!("{}", trait_ref).starts_with("std::convert::From<");
-                        let message = if is_try && is_from {
-                            Some(format!(
+                        let (message, note) = if is_try && is_from {
+                            (Some(format!(
                                 "`?` couldn't convert the error to `{}`",
                                 trait_ref.self_ty(),
+                            )), Some(
+                                "the question mark operation (`?`) implicitly performs a \
+                                 conversion on the error value using the `From` trait".to_owned()
                             ))
                         } else {
-                            message
+                            (message, note)
                         };
 
                         let mut err = struct_span_err!(
index 1c8ea5c7b9c5b0dd437301f536a24c15e19472f9..55216f644a180626fdf1eb15369ce64999fe8c1a 100644 (file)
@@ -18,7 +18,8 @@
 use crate::ty::subst::{Subst, InternalSubsts};
 use std::borrow::Cow;
 use std::iter::{self};
-use syntax::ast::{self, Name};
+use syntax::ast::{self};
+use syntax::symbol::InternedString;
 use syntax_pos::Span;
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
@@ -539,7 +540,7 @@ fn receiver_is_dispatchable(
         // are implemented
         let unsized_self_ty: Ty<'tcx> = self.mk_ty_param(
             ::std::u32::MAX,
-            Name::intern("RustaceansAreAwesome").as_interned_str(),
+            InternedString::intern("RustaceansAreAwesome"),
         );
 
         // `Receiver[Self => U]`
index f05a19372918edd3e1b062d59fbefd20730af8d8..67e76f7625ceee237c6ef5f5018603365ad80f83 100644 (file)
@@ -1421,7 +1421,7 @@ fn confirm_callable_candidate<'cx, 'gcx, 'tcx>(
                 projection_ty: ty::ProjectionTy::from_ref_and_name(
                     tcx,
                     trait_ref,
-                    Ident::from_str(FN_OUTPUT_NAME),
+                    Ident::with_empty_ctxt(FN_OUTPUT_NAME),
                 ),
                 ty: ret_type
             }
index 2496419640c2e8e3a64e911add85efa14951f0dd..fdd1a821e31b56964bae3db7af15581bc05fd1a7 100644 (file)
@@ -298,7 +298,7 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(
     // negated `CrateNum` (so remote definitions are visited first) and then
     // by a flattened version of the `DefIndex`.
     trait_impls.sort_unstable_by_key(|def_id| {
-        (-(def_id.krate.as_u32() as i64), def_id.index.as_array_index())
+        (-(def_id.krate.as_u32() as i64), def_id.index.index())
     });
 
     for impl_def_id in trait_impls {
@@ -319,29 +319,34 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(
                         String::new(), |ty| {
                             format!(" for type `{}`", ty)
                         }),
-                    if used_to_be_allowed.is_some() { " (E0119)" } else { "" }
+                    match used_to_be_allowed {
+                        Some(FutureCompatOverlapErrorKind::Issue33140) => " (E0119)",
+                        _ => "",
+                    }
                 );
                 let impl_span = tcx.sess.source_map().def_span(
                     tcx.span_of_impl(impl_def_id).unwrap()
                 );
-                let mut err = if let Some(kind) = used_to_be_allowed {
-                    let lint = match kind {
-                        FutureCompatOverlapErrorKind::Issue43355 =>
-                            lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS,
-                        FutureCompatOverlapErrorKind::Issue33140 =>
-                            lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS,
-                    };
-                    tcx.struct_span_lint_hir(
-                        lint,
-                        tcx.hir().as_local_hir_id(impl_def_id).unwrap(),
-                        impl_span,
-                        &msg)
-                } else {
-                    struct_span_err!(tcx.sess,
-                                     impl_span,
-                                     E0119,
-                                     "{}",
-                                     msg)
+                let mut err = match used_to_be_allowed {
+                    Some(FutureCompatOverlapErrorKind::Issue43355) | None =>
+                        struct_span_err!(tcx.sess,
+                                         impl_span,
+                                         E0119,
+                                         "{}",
+                                         msg),
+                    Some(kind) => {
+                        let lint = match kind {
+                            FutureCompatOverlapErrorKind::Issue43355 =>
+                                unreachable!("converted to hard error above"),
+                            FutureCompatOverlapErrorKind::Issue33140 =>
+                                lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS,
+                        };
+                        tcx.struct_span_lint_hir(
+                            lint,
+                            tcx.hir().as_local_hir_id(impl_def_id).unwrap(),
+                            impl_span,
+                            &msg)
+                    }
                 };
 
                 match tcx.span_of_impl(overlap.with_impl) {
index 400a0f526c4ef887e3bdf7c8c7ade4816b4fa13d..404fadbc78afce2119335eff2afcfde7e9876c04 100644 (file)
@@ -312,17 +312,15 @@ fn visit_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> bool {
     }
 
     fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
-        use syntax::symbol::Symbol;
-
         match t.sty {
             ty::Bound(debruijn, bound_ty) if debruijn == self.binder_index => {
                 self.types.insert(
                     bound_ty.var.as_u32(),
                     match bound_ty.kind {
                         ty::BoundTyKind::Param(name) => name,
-                        ty::BoundTyKind::Anon => Symbol::intern(
-                            &format!("^{}", bound_ty.var.as_u32())
-                        ).as_interned_str(),
+                        ty::BoundTyKind::Anon =>
+                            InternedString::intern(&format!("^{}", bound_ty.var.as_u32()),
+                        ),
                     }
                 );
             }
@@ -334,8 +332,6 @@ fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
     }
 
     fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
-        use syntax::symbol::Symbol;
-
         match r {
             ty::ReLateBound(index, br) if *index == self.binder_index => {
                 match br {
@@ -344,9 +340,7 @@ fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
                     }
 
                     ty::BoundRegion::BrAnon(var) => {
-                        self.regions.insert(Symbol::intern(
-                            &format!("'^{}", var)
-                        ).as_interned_str());
+                        self.regions.insert(InternedString::intern(&format!("'^{}", var)));
                     }
 
                     _ => (),
index 2f71861d4dc0df57d8de5e9e87da1036af49eec2..91e996178e7d54904cbdde900e8524bf60d1f5da 100644 (file)
@@ -510,7 +510,7 @@ pub struct TyS<'tcx> {
 
 // `TyS` is used a lot. Make sure it doesn't unintentionally get bigger.
 #[cfg(target_arch = "x86_64")]
-static_assert!(MEM_SIZE_OF_TY_S: ::std::mem::size_of::<TyS<'_>>() == 32);
+static_assert_size!(TyS<'_>, 32);
 
 impl<'tcx> Ord for TyS<'tcx> {
     fn cmp(&self, other: &TyS<'tcx>) -> Ordering {
@@ -3405,7 +3405,7 @@ pub struct SymbolName {
 impl SymbolName {
     pub fn new(name: &str) -> SymbolName {
         SymbolName {
-            name: Symbol::intern(name).as_interned_str()
+            name: InternedString::intern(name)
         }
     }
 
index 8e98d4d85b9cc04d437fc2d24d014575ae819de4..91b708d7dbe10339d00813f79f85cfd108a4f57b 100644 (file)
@@ -7,10 +7,8 @@
 use crate::ty::{self, DefIdTree, ParamConst, Ty, TyCtxt, TypeFoldable};
 use crate::ty::subst::{Kind, Subst, UnpackedKind};
 use crate::mir::interpret::ConstValue;
-use syntax::symbol::{keywords, Symbol};
-
 use rustc_target::spec::abi::Abi;
-use syntax::symbol::InternedString;
+use syntax::symbol::{keywords, InternedString};
 
 use std::cell::Cell;
 use std::fmt::{self, Write as _};
@@ -1285,10 +1283,10 @@ pub fn pretty_in_binder<T>(
     {
         fn name_by_region_index(index: usize) -> InternedString {
             match index {
-                0 => Symbol::intern("'r"),
-                1 => Symbol::intern("'s"),
-                i => Symbol::intern(&format!("'t{}", i-2)),
-            }.as_interned_str()
+                0 => InternedString::intern("'r"),
+                1 => InternedString::intern("'s"),
+                i => InternedString::intern(&format!("'t{}", i-2)),
+            }
         }
 
         // Replace any anonymous late-bound regions with named
index a4b8d365a12ef3b01c2e449973147a0bf9474d2b..2fb318a47befd80f6919cd0b22c9eb56bbe3f8f4 100644 (file)
@@ -1,7 +1,7 @@
 use crate::ty::{self, Ty, TyCtxt, AdtSizedConstraint};
 use crate::ty::util::NeedsDrop;
 
-use syntax::symbol::Symbol;
+use syntax::symbol::InternedString;
 
 pub(super) trait Value<'tcx>: Sized {
     fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self;
@@ -28,7 +28,7 @@ fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> {
 
 impl<'tcx> Value<'tcx> for ty::SymbolName {
     fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
-        ty::SymbolName { name: Symbol::intern("<error>").as_interned_str() }
+        ty::SymbolName { name: InternedString::intern("<error>") }
     }
 }
 
index 760f3d60d0571c3a6c8a375fc203a65269d0c901..e8f3bad4d3ee32832666fd66f72f4cc502707da8 100644 (file)
@@ -211,7 +211,7 @@ pub enum TyKind<'tcx> {
 
 // `TyKind` is used a lot. Make sure it doesn't unintentionally get bigger.
 #[cfg(target_arch = "x86_64")]
-static_assert!(MEM_SIZE_OF_TY_KIND: ::std::mem::size_of::<TyKind<'_>>() == 24);
+static_assert_size!(TyKind<'_>, 24);
 
 /// A closure can be modeled as a struct that looks like:
 ///
@@ -1136,7 +1136,7 @@ pub fn is_self(&self) -> bool {
         // FIXME(#50125): Ignoring `Self` with `index != 0` might lead to weird behavior elsewhere,
         // but this should only be possible when using `-Z continue-parse-after-error` like
         // `compile-fail/issue-36638.rs`.
-        self.name == keywords::SelfUpper.name().as_str() && self.index == 0
+        self.name.as_symbol() == keywords::SelfUpper.name() && self.index == 0
     }
 }
 
@@ -2207,7 +2207,7 @@ pub struct Const<'tcx> {
 }
 
 #[cfg(target_arch = "x86_64")]
-static_assert!(CONST_SIZE: ::std::mem::size_of::<Const<'static>>() == 48);
+static_assert_size!(Const<'_>, 48);
 
 impl<'tcx> Const<'tcx> {
     #[inline]
index 26194176350ac2a177e36a8c61649675d2a5db38..67eaa19c080b5ec80d7976f2ca1ee2a2194f1081 100644 (file)
@@ -11,6 +11,7 @@
 
 use std::sync::mpsc::{Sender};
 use syntax_pos::{SpanData};
+use syntax::symbol::{Symbol, sym};
 use rustc_macros::HashStable;
 use crate::ty::TyCtxt;
 use crate::dep_graph::{DepNode};
@@ -18,7 +19,7 @@
 use crate::session::Session;
 
 // The name of the associated type for `Fn` return types
-pub const FN_OUTPUT_NAME: &str = "Output";
+pub const FN_OUTPUT_NAME: Symbol = sym::Output;
 
 // Useful type to use with `Result<>` indicate that an error has already
 // been reported to the user, so no need to continue checking.
index 0200e6c53b69cc1742bdbfae1379654e8ff1a218..0c19d770194b2ea486f268ab30e526bdb9259451 100644 (file)
         base::{ExtCtxt, Resolver},
         build::AstBuilder,
         expand::ExpansionConfig,
-        hygiene::{self, Mark, SyntaxContext},
+        hygiene::{Mark, SyntaxContext},
     },
     mut_visit::{self, MutVisitor},
     parse::ParseSess,
     ptr::P,
-    symbol::{Symbol, sym}
+    symbol::{keywords, Symbol, sym}
 };
 use syntax_pos::Span;
 
@@ -96,7 +96,7 @@ impl MutVisitor for ExpandAllocatorDirectives<'_> {
             ].into()),
             allow_internal_unsafe: false,
             local_inner_macros: false,
-            edition: hygiene::default_edition(),
+            edition: self.sess.edition,
         });
 
         // Tie the span to the macro expansion info we just created
@@ -110,13 +110,14 @@ impl MutVisitor for ExpandAllocatorDirectives<'_> {
             span,
             kind: AllocatorKind::Global,
             global: item.ident,
-            core: Ident::from_str("core"),
+            core: Ident::with_empty_ctxt(sym::core),
             cx: ExtCtxt::new(self.sess, ecfg, self.resolver),
         };
 
         // We will generate a new submodule. To `use` the static from that module, we need to get
         // the `super::...` path.
-        let super_path = f.cx.path(f.span, vec![Ident::from_str("super"), f.global]);
+        let super_path =
+            f.cx.path(f.span, vec![Ident::with_empty_ctxt(keywords::Super.name()), f.global]);
 
         // Generate the items in the submodule
         let mut items = vec![
@@ -139,7 +140,7 @@ impl MutVisitor for ExpandAllocatorDirectives<'_> {
 
         // Generate the submodule itself
         let name = f.kind.fn_name("allocator_abi");
-        let allocator_abi = Ident::with_empty_ctxt(Symbol::gensym(&name));
+        let allocator_abi = Ident::from_str(&name).gensym();
         let module = f.cx.item_mod(span, span, allocator_abi, Vec::new(), items);
         let module = f.cx.monotonic_expander().flat_map_item(module).pop().unwrap();
 
@@ -236,7 +237,7 @@ fn arg_ty(
     ) -> P<Expr> {
         match *ty {
             AllocatorTy::Layout => {
-                let usize = self.cx.path_ident(self.span, Ident::from_str("usize"));
+                let usize = self.cx.path_ident(self.span, Ident::with_empty_ctxt(sym::usize));
                 let ty_usize = self.cx.ty_path(usize);
                 let size = ident();
                 let align = ident();
@@ -298,12 +299,12 @@ fn ret_ty(&self, ty: &AllocatorTy, expr: P<Expr>) -> (P<Ty>, P<Expr>) {
     }
 
     fn usize(&self) -> P<Ty> {
-        let usize = self.cx.path_ident(self.span, Ident::from_str("usize"));
+        let usize = self.cx.path_ident(self.span, Ident::with_empty_ctxt(sym::usize));
         self.cx.ty_path(usize)
     }
 
     fn ptr_u8(&self) -> P<Ty> {
-        let u8 = self.cx.path_ident(self.span, Ident::from_str("u8"));
+        let u8 = self.cx.path_ident(self.span, Ident::with_empty_ctxt(sym::u8));
         let ty_u8 = self.cx.ty_path(u8);
         self.cx.ty_ptr(self.span, ty_u8, Mutability::Mutable)
     }
index cb59cf41a3ca531a8adeecac42debee4d6279ed1..66ba95810a62516a109462f740955fed5c54afb8 100644 (file)
@@ -795,10 +795,10 @@ fn create_msvc_imps(
         return
     }
     // The x86 ABI seems to require that leading underscores are added to symbol
-    // names, so we need an extra underscore on 32-bit. There's also a leading
+    // names, so we need an extra underscore on x86. There's also a leading
     // '\x01' here which disables LLVM's symbol mangling (e.g., no extra
     // underscores added in front).
-    let prefix = if cgcx.target_pointer_width == "32" {
+    let prefix = if cgcx.target_arch == "x86" {
         "\x01__imp__"
     } else {
         "\x01__imp_"
index 9bdce37b8baec1f09bc83124137d186727a66910..b000628a3f70653e9653e519cf47b61cf71aff88 100644 (file)
 use rustc::ty::layout::{self, Align, Integer, IntegerExt, LayoutOf,
                         PrimitiveExt, Size, TyLayout, VariantIdx};
 use rustc::ty::subst::UnpackedKind;
-use rustc::session::config;
+use rustc::session::config::{self, DebugInfo};
 use rustc::util::nodemap::FxHashMap;
 use rustc_fs_util::path_to_c_string;
 use rustc_data_structures::small_c_str::SmallCStr;
 use rustc_target::abi::HasDataLayout;
 
 use libc::{c_uint, c_longlong};
+use std::collections::hash_map::Entry;
 use std::ffi::CString;
 use std::fmt::{self, Write};
 use std::hash::{Hash, Hasher};
@@ -45,7 +46,7 @@
 use std::ptr;
 use std::path::{Path, PathBuf};
 use syntax::ast;
-use syntax::symbol::{Interner, InternedString, Symbol};
+use syntax::symbol::{Interner, InternedString};
 use syntax_pos::{self, Span, FileName};
 
 impl PartialEq for llvm::Metadata {
@@ -787,49 +788,48 @@ pub fn file_metadata(cx: &CodegenCx<'ll, '_>,
            file_name,
            defining_crate);
 
-    let file_name = &file_name.to_string();
-    let file_name_symbol = Symbol::intern(file_name);
-    if defining_crate == LOCAL_CRATE {
-        let directory = &cx.sess().working_dir.0.to_string_lossy();
-        file_metadata_raw(cx, file_name, Some(file_name_symbol),
-                          directory, Some(Symbol::intern(directory)))
+    let file_name = Some(file_name.to_string());
+    let directory = if defining_crate == LOCAL_CRATE {
+        Some(cx.sess().working_dir.0.to_string_lossy().to_string())
     } else {
         // If the path comes from an upstream crate we assume it has been made
         // independent of the compiler's working directory one way or another.
-        file_metadata_raw(cx, file_name, Some(file_name_symbol), "", None)
-    }
+        None
+    };
+    file_metadata_raw(cx, file_name, directory)
 }
 
 pub fn unknown_file_metadata(cx: &CodegenCx<'ll, '_>) -> &'ll DIFile {
-    file_metadata_raw(cx, "<unknown>", None, "", None)
+    file_metadata_raw(cx, None, None)
 }
 
 fn file_metadata_raw(cx: &CodegenCx<'ll, '_>,
-                     file_name: &str,
-                     file_name_symbol: Option<Symbol>,
-                     directory: &str,
-                     directory_symbol: Option<Symbol>)
+                     file_name: Option<String>,
+                     directory: Option<String>)
                      -> &'ll DIFile {
-    let key = (file_name_symbol, directory_symbol);
+    let key = (file_name, directory);
+
+    match debug_context(cx).created_files.borrow_mut().entry(key) {
+        Entry::Occupied(o) => return o.get(),
+        Entry::Vacant(v) => {
+            let (file_name, directory) = v.key();
+            debug!("file_metadata: file_name: {:?}, directory: {:?}", file_name, directory);
+
+            let file_name = SmallCStr::new(
+                if let Some(file_name) = file_name { &file_name } else { "<unknown>" });
+            let directory = SmallCStr::new(
+                if let Some(directory) = directory { &directory } else { "" });
+
+            let file_metadata = unsafe {
+                llvm::LLVMRustDIBuilderCreateFile(DIB(cx),
+                                                  file_name.as_ptr(),
+                                                  directory.as_ptr())
+            };
 
-    if let Some(file_metadata) = debug_context(cx).created_files.borrow().get(&key) {
-        return *file_metadata;
+            v.insert(file_metadata);
+            file_metadata
+        }
     }
-
-    debug!("file_metadata: file_name: {}, directory: {}", file_name, directory);
-
-    let file_name = SmallCStr::new(file_name);
-    let directory = SmallCStr::new(directory);
-
-    let file_metadata = unsafe {
-        llvm::LLVMRustDIBuilderCreateFile(DIB(cx),
-                                          file_name.as_ptr(),
-                                          directory.as_ptr())
-    };
-
-    let mut created_files = debug_context(cx).created_files.borrow_mut();
-    created_files.insert(key, file_metadata);
-    file_metadata
 }
 
 fn basic_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
@@ -925,7 +925,26 @@ pub fn compile_unit_metadata(tcx: TyCtxt<'_, '_, '_>,
     let producer = CString::new(producer).unwrap();
     let flags = "\0";
     let split_name = "\0";
-    let kind = DebugEmissionKind::from_generic(tcx.sess.opts.debuginfo);
+
+    // FIXME(#60020):
+    //
+    //    This should actually be
+    //
+    //    ```
+    //      let kind = DebugEmissionKind::from_generic(tcx.sess.opts.debuginfo);
+    //    ```
+    //
+    //    that is, we should set LLVM's emission kind to `LineTablesOnly` if
+    //    we are compiling with "limited" debuginfo. However, some of the
+    //    existing tools relied on slightly more debuginfo being generated than
+    //    would be the case with `LineTablesOnly`, and we did not want to break
+    //    these tools in a "drive-by fix", without a good idea or plan about
+    //    what limited debuginfo should exactly look like. So for now we keep
+    //    the emission kind as `FullDebug`.
+    //
+    //    See https://github.com/rust-lang/rust/issues/60020 for details.
+    let kind = DebugEmissionKind::FullDebug;
+    assert!(tcx.sess.opts.debuginfo != DebugInfo::None);
 
     unsafe {
         let file_metadata = llvm::LLVMRustDIBuilderCreateFile(
index f3070a03b4ed523520abd34f1de0a648300edbfd..527290392fff45a27f73ef22404f7d37f6d22f5a 100644 (file)
@@ -37,7 +37,7 @@
 
 use syntax_pos::{self, Span, Pos};
 use syntax::ast;
-use syntax::symbol::{Symbol, InternedString};
+use syntax::symbol::InternedString;
 use rustc::ty::layout::{self, LayoutOf, HasTyCtxt};
 use rustc_codegen_ssa::traits::*;
 
@@ -63,7 +63,7 @@ pub struct CrateDebugContext<'a, 'tcx> {
     llcontext: &'a llvm::Context,
     llmod: &'a llvm::Module,
     builder: &'a mut DIBuilder<'a>,
-    created_files: RefCell<FxHashMap<(Option<Symbol>, Option<Symbol>), &'a DIFile>>,
+    created_files: RefCell<FxHashMap<(Option<String>, Option<String>), &'a DIFile>>,
     created_enum_disr_types: RefCell<FxHashMap<(DefId, layout::Primitive), &'a DIType>>,
 
     type_map: RefCell<TypeMap<'a, 'tcx>>,
index ceb08f943678b15a97aa5273effc4741dd962229..9ae0e26196d94fb142ef516b6a2942fca28c5cb9 100644 (file)
@@ -20,7 +20,7 @@
 use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
 use rustc::hir;
 use syntax::ast::{self, FloatTy};
-use syntax::symbol::Symbol;
+use syntax::symbol::LocalInternedString;
 
 use rustc_codegen_ssa::traits::*;
 
@@ -213,7 +213,7 @@ fn codegen_intrinsic_call(
             }
             "type_name" => {
                 let tp_ty = substs.type_at(0);
-                let ty_name = Symbol::intern(&tp_ty.to_string()).as_str();
+                let ty_name = LocalInternedString::intern(&tp_ty.to_string());
                 self.const_str_slice(ty_name)
             }
             "type_id" => {
index 6320d8a671ddbfd66f87de8060b86e9641839956..1c793996c83db65cc1cc2960546f358197812253 100644 (file)
@@ -248,6 +248,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
     pub tm_factory: TargetMachineFactory<B>,
     pub msvc_imps_needed: bool,
     pub target_pointer_width: String,
+    pub target_arch: String,
     pub debuginfo: config::DebugInfo,
 
     // Number of cgus excluding the allocator/metadata modules
@@ -1103,6 +1104,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
         total_cgus,
         msvc_imps_needed: msvc_imps_needed(tcx),
         target_pointer_width: tcx.sess.target.target.target_pointer_width.clone(),
+        target_arch: tcx.sess.target.target.arch.clone(),
         debuginfo: tcx.sess.opts.debuginfo,
         assembler_cmd,
     };
index 8021d4b11d0cf7a638d204b1695cec152d64af74..06d7b6c78f14bffa866945f2a03f251030180e73 100644 (file)
@@ -243,9 +243,8 @@ fn visit_local(&mut self,
             }
 
             PlaceContext::MutatingUse(MutatingUseContext::Drop) => {
-                let ty = mir::Place::Base(mir::PlaceBase::Local(local)).ty(self.fx.mir,
-                                                                           self.fx.cx.tcx());
-                let ty = self.fx.monomorphize(&ty.ty);
+                let ty = self.fx.mir.local_decls[local].ty;
+                let ty = self.fx.monomorphize(&ty);
 
                 // Only need the place if we're actually dropping it.
                 if self.fx.cx.type_needs_drop(ty) {
index 96b8558c1d2c447f2b8149f6d71cf647f5696260..c7dd019fc3eb8abb464c0bcca87e15059a312c76 100644 (file)
@@ -15,7 +15,7 @@
 
 use std::borrow::Cow;
 
-use syntax::symbol::Symbol;
+use syntax::symbol::LocalInternedString;
 use syntax_pos::Pos;
 
 use super::{FunctionCx, LocalRef};
@@ -401,7 +401,7 @@ fn codegen_assert_terminator<'b>(
 
         // Get the location information.
         let loc = bx.sess().source_map().lookup_char_pos(span.lo());
-        let filename = Symbol::intern(&loc.file.name.to_string()).as_str();
+        let filename = LocalInternedString::intern(&loc.file.name.to_string());
         let line = bx.const_u32(loc.line as u32);
         let col = bx.const_u32(loc.col.to_usize() as u32 + 1);
 
@@ -423,7 +423,7 @@ fn codegen_assert_terminator<'b>(
             }
             _ => {
                 let str = msg.description();
-                let msg_str = Symbol::intern(str).as_str();
+                let msg_str = LocalInternedString::intern(str);
                 let msg_file_line_col = bx.static_panic_msg(
                     Some(msg_str),
                     filename,
@@ -535,7 +535,7 @@ fn codegen_call_terminator<'b>(
             let layout = bx.layout_of(ty);
             if layout.abi.is_uninhabited() {
                 let loc = bx.sess().source_map().lookup_char_pos(span.lo());
-                let filename = Symbol::intern(&loc.file.name.to_string()).as_str();
+                let filename = LocalInternedString::intern(&loc.file.name.to_string());
                 let line = bx.const_u32(loc.line as u32);
                 let col = bx.const_u32(loc.col.to_usize() as u32 + 1);
 
@@ -543,7 +543,7 @@ fn codegen_call_terminator<'b>(
                     "Attempted to instantiate uninhabited type {}",
                     ty
                 );
-                let msg_str = Symbol::intern(&str).as_str();
+                let msg_str = LocalInternedString::intern(&str);
                 let msg_file_line_col = bx.static_panic_msg(
                     Some(msg_str),
                     filename,
index d50a9a1607b240da1f7c3b2fceb125c3e2148162..6915687ceba930d0bde8a5844293a7e7465ca89e 100644 (file)
 use rustc_mir::monomorphize::item::{InstantiationMode, MonoItem, MonoItemExt};
 use rustc_mir::monomorphize::Instance;
 
-use syntax_pos::symbol::{Symbol, InternedString};
+use syntax_pos::symbol::InternedString;
 
 use log::debug;
 
@@ -238,13 +238,13 @@ fn compute_symbol_name(tcx: TyCtxt<'_, 'tcx, 'tcx>, instance: Instance<'tcx>) ->
     if def_id.is_local() {
         if tcx.plugin_registrar_fn(LOCAL_CRATE) == Some(def_id) {
             let disambiguator = tcx.sess.local_crate_disambiguator();
-            return Symbol::intern(&tcx.sess.generate_plugin_registrar_symbol(disambiguator))
-                .as_interned_str();
+            return
+                InternedString::intern(&tcx.sess.generate_plugin_registrar_symbol(disambiguator));
         }
         if tcx.proc_macro_decls_static(LOCAL_CRATE) == Some(def_id) {
             let disambiguator = tcx.sess.local_crate_disambiguator();
-            return Symbol::intern(&tcx.sess.generate_proc_macro_decls_symbol(disambiguator))
-                .as_interned_str();
+            return
+                InternedString::intern(&tcx.sess.generate_proc_macro_decls_symbol(disambiguator));
         }
     }
 
@@ -322,7 +322,7 @@ fn compute_symbol_name(tcx: TyCtxt<'_, 'tcx, 'tcx>, instance: Instance<'tcx>) ->
         let _ = printer.write_str("{{vtable-shim}}");
     }
 
-    Symbol::intern(&printer.path.finish(hash)).as_interned_str()
+    InternedString::intern(&printer.path.finish(hash))
 }
 
 // Follow C++ namespace-mangling style, see
index 029e7267c8247d40e0e5c91e4292a57966aef2ee..7fc23999284a71681dc53506aba56a12bc42f526 100644 (file)
@@ -10,3 +10,12 @@ macro_rules! static_assert {
         static $name: () = [()][!($test: bool) as usize];
     }
 }
+
+/// Type size assertion. The first argument is a type and the second argument is its expected size.
+#[macro_export]
+#[allow_internal_unstable(underscore_const_names)]
+macro_rules! static_assert_size {
+    ($ty:ty, $size:expr) => {
+        const _: [(); $size] = [(); ::std::mem::size_of::<$ty>()];
+    }
+}
index fa573907d4c735a68752bc5c59076b67e3c0c676..2b844aa24d49c92a6d5bdbd165762f5a00908b31 100644 (file)
@@ -15,7 +15,6 @@
 /// extended to 64 bits if needed.
 pub struct StableHasher<W> {
     state: SipHasher128,
-    bytes_hashed: u64,
     width: PhantomData<W>,
 }
 
@@ -33,7 +32,6 @@ impl<W: StableHasherResult> StableHasher<W> {
     pub fn new() -> Self {
         StableHasher {
             state: SipHasher128::new_with_keys(0, 0),
-            bytes_hashed: 0,
             width: PhantomData,
         }
     }
@@ -61,11 +59,6 @@ impl<W> StableHasher<W> {
     pub fn finalize(self) -> (u64, u64) {
         self.state.finish128()
     }
-
-    #[inline]
-    pub fn bytes_hashed(&self) -> u64 {
-        self.bytes_hashed
-    }
 }
 
 impl<W> Hasher for StableHasher<W> {
@@ -76,37 +69,31 @@ fn finish(&self) -> u64 {
     #[inline]
     fn write(&mut self, bytes: &[u8]) {
         self.state.write(bytes);
-        self.bytes_hashed += bytes.len() as u64;
     }
 
     #[inline]
     fn write_u8(&mut self, i: u8) {
         self.state.write_u8(i);
-        self.bytes_hashed += 1;
     }
 
     #[inline]
     fn write_u16(&mut self, i: u16) {
         self.state.write_u16(i.to_le());
-        self.bytes_hashed += 2;
     }
 
     #[inline]
     fn write_u32(&mut self, i: u32) {
         self.state.write_u32(i.to_le());
-        self.bytes_hashed += 4;
     }
 
     #[inline]
     fn write_u64(&mut self, i: u64) {
         self.state.write_u64(i.to_le());
-        self.bytes_hashed += 8;
     }
 
     #[inline]
     fn write_u128(&mut self, i: u128) {
         self.state.write_u128(i.to_le());
-        self.bytes_hashed += 16;
     }
 
     #[inline]
@@ -115,37 +102,31 @@ fn write_usize(&mut self, i: usize) {
         // platforms. This is important for symbol hashes when cross compiling,
         // for example.
         self.state.write_u64((i as u64).to_le());
-        self.bytes_hashed += 8;
     }
 
     #[inline]
     fn write_i8(&mut self, i: i8) {
         self.state.write_i8(i);
-        self.bytes_hashed += 1;
     }
 
     #[inline]
     fn write_i16(&mut self, i: i16) {
         self.state.write_i16(i.to_le());
-        self.bytes_hashed += 2;
     }
 
     #[inline]
     fn write_i32(&mut self, i: i32) {
         self.state.write_i32(i.to_le());
-        self.bytes_hashed += 4;
     }
 
     #[inline]
     fn write_i64(&mut self, i: i64) {
         self.state.write_i64(i.to_le());
-        self.bytes_hashed += 8;
     }
 
     #[inline]
     fn write_i128(&mut self, i: i128) {
         self.state.write_i128(i.to_le());
-        self.bytes_hashed += 16;
     }
 
     #[inline]
@@ -154,12 +135,35 @@ fn write_isize(&mut self, i: isize) {
         // platforms. This is important for symbol hashes when cross compiling,
         // for example.
         self.state.write_i64((i as i64).to_le());
-        self.bytes_hashed += 8;
     }
 }
 
 /// Something that implements `HashStable<CTX>` can be hashed in a way that is
 /// stable across multiple compilation sessions.
+///
+/// Note that `HashStable` imposes rather more strict requirements than usual
+/// hash functions:
+///
+/// - Stable hashes are sometimes used as identifiers. Therefore they must
+///   conform to the corresponding `PartialEq` implementations:
+///
+///     - `x == y` implies `hash_stable(x) == hash_stable(y)`, and
+///     - `x != y` implies `hash_stable(x) != hash_stable(y)`.
+///
+///   That second condition is usually not required for hash functions
+///   (e.g. `Hash`). In practice this means that `hash_stable` must feed any
+///   information into the hasher that a `PartialEq` comparision takes into
+///   account. See [#49300](https://github.com/rust-lang/rust/issues/49300)
+///   for an example where violating this invariant has caused trouble in the
+///   past.
+///
+/// - `hash_stable()` must be independent of the current
+///    compilation session. E.g. they must not hash memory addresses or other
+///    things that are "randomly" assigned per compilation session.
+///
+/// - `hash_stable()` must be independent of the host architecture. The
+///   `StableHasher` takes care of endianness and `isize`/`usize` platform
+///   differences.
 pub trait HashStable<CTX> {
     fn hash_stable<W: StableHasherResult>(&self,
                                           hcx: &mut CTX,
index c74ed5ec30c3cade8d6b7b91cbf1dedc92a4af44..812321ff5e6c36f8fd16f772752f03b6d25eb5c2 100644 (file)
@@ -648,7 +648,7 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec<borrowck_dot::Variant>,
     // have to be user friendly.
     let name = format!(
         "hir_id_{}_{}",
-        hir_id.owner.as_array_index(),
+        hir_id.owner.index(),
         hir_id.local_id.index(),
     );
     let lcfg = LabelledCFG {
index f2a21d61aed4a478259ec2595faa3d497878b776..674b2b60e44a2520dcfe81209b47399b61863b46 100644 (file)
@@ -18,6 +18,7 @@
 use std::sync::{Arc, Mutex};
 use syntax;
 use syntax::source_map::{FileLoader, SourceMap};
+use syntax_pos::edition;
 
 pub type Result<T> = result::Result<T, ErrorReported>;
 
@@ -135,16 +136,17 @@ pub fn run_compiler<F, R>(mut config: Config, f: F) -> R
 {
     let stderr = config.stderr.take();
     util::spawn_thread_pool(
+        config.opts.edition,
         config.opts.debugging_opts.threads,
         &stderr,
         || run_compiler_in_existing_thread_pool(config, f),
     )
 }
 
-pub fn default_thread_pool<F, R>(f: F) -> R
+pub fn default_thread_pool<F, R>(edition: edition::Edition, f: F) -> R
 where
     F: FnOnce() -> R + Send,
     R: Send,
 {
-    util::spawn_thread_pool(None, &None, f)
+    util::spawn_thread_pool(edition, None, &None, f)
 }
index c5ac8860ccd9b079db0146dc386df0c92fa398f8..04041f88344204bf20efc4efda72f004d97d2ed3 100644 (file)
@@ -48,7 +48,7 @@
 use syntax::util::lev_distance::find_best_match_for_name;
 use syntax::symbol::Symbol;
 use syntax::feature_gate::AttributeType;
-use syntax_pos::{FileName, hygiene};
+use syntax_pos::{FileName, edition::Edition, hygiene};
 use syntax_ext;
 
 use serialize::json;
@@ -70,8 +70,6 @@
 pub fn parse<'a>(sess: &'a Session, input: &Input) -> PResult<'a, ast::Crate> {
     sess.diagnostic()
         .set_continue_after_error(sess.opts.debugging_opts.continue_parse_after_error);
-    hygiene::set_default_edition(sess.edition());
-
     sess.profiler(|p| p.start_activity("parsing"));
     let krate = time(sess, "parsing", || match *input {
         Input::File(ref file) => parse::parse_crate_from_file(file, &sess.parse_sess),
@@ -375,7 +373,7 @@ fn configure_and_expand_inner<'a>(
         crate_loader,
         &resolver_arenas,
     );
-    syntax_ext::register_builtins(&mut resolver, plugin_info.syntax_exts);
+    syntax_ext::register_builtins(&mut resolver, plugin_info.syntax_exts, sess.edition());
 
     // Expand all macros
     sess.profiler(|p| p.start_activity("macro expansion"));
index d2d0d19180783bfd5b8fc557553514bbf0fb6731..09bb547191f491f29d4dc42f74c7e3f043c5e419 100644 (file)
@@ -37,6 +37,7 @@
 use syntax::source_map::{FileLoader, RealFileLoader, SourceMap};
 use syntax::symbol::{Symbol, sym};
 use syntax::{self, ast, attr};
+use syntax_pos::edition::Edition;
 #[cfg(not(parallel_compiler))]
 use std::{thread, panic};
 
@@ -167,6 +168,7 @@ unsafe impl Sync for Ptr {}
 
 #[cfg(not(parallel_compiler))]
 pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
+    edition: Edition,
     _threads: Option<usize>,
     stderr: &Option<Arc<Mutex<Vec<u8>>>>,
     f: F,
@@ -178,7 +180,7 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
     }
 
     scoped_thread(cfg, || {
-        syntax::with_globals( || {
+        syntax::with_globals(edition, || {
             ty::tls::GCX_PTR.set(&Lock::new(0), || {
                 if let Some(stderr) = stderr {
                     io::set_panic(Some(box Sink(stderr.clone())));
@@ -191,6 +193,7 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
 
 #[cfg(parallel_compiler)]
 pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
+    edition: Edition,
     threads: Option<usize>,
     stderr: &Option<Arc<Mutex<Vec<u8>>>>,
     f: F,
@@ -213,7 +216,7 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
 
     let with_pool = move |pool: &ThreadPool| pool.install(move || f());
 
-    syntax::with_globals(|| {
+    syntax::with_globals(edition, || {
         syntax::GLOBALS.with(|syntax_globals| {
             syntax_pos::GLOBALS.with(|syntax_pos_globals| {
                 // The main handler runs for each Rayon worker thread and sets up
index 0bb9d4389dd0b7eb0e773f1a34077b5ca590b2ab..ba72beecc1a1800204902670d19e725959355e24 100644 (file)
@@ -371,11 +371,6 @@ macro_rules! register_passes {
             reference: "issue #46043 <https://github.com/rust-lang/rust/issues/46043>",
             edition: None,
         },
-        FutureIncompatibleInfo {
-            id: LintId::of(INCOHERENT_FUNDAMENTAL_IMPLS),
-            reference: "issue #46205 <https://github.com/rust-lang/rust/issues/46205>",
-            edition: None,
-        },
         FutureIncompatibleInfo {
             id: LintId::of(ORDER_DEPENDENT_TRAIT_OBJECTS),
             reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
@@ -491,6 +486,8 @@ macro_rules! register_passes {
         "replaced with a generic attribute input check");
     store.register_removed("duplicate_matcher_binding_name",
         "converted into hard error, see https://github.com/rust-lang/rust/issues/57742");
+    store.register_removed("incoherent_fundamental_impls",
+        "converted into hard error, see https://github.com/rust-lang/rust/issues/46205");
 }
 
 pub fn register_internals(store: &mut lint::LintStore, sess: Option<&Session>) {
index 7f2a1c0b4b1d11d6f28a1fe96c60e1a920a23020..3e00ba3c62004bf435cea8598604e15a7a274b55 100644 (file)
@@ -95,7 +95,7 @@ enum LoadError<'a> {
 impl<'a> LoadError<'a> {
     fn report(self) -> ! {
         match self {
-            LoadError::LocatorError(mut locate_ctxt) => locate_ctxt.report_errs(),
+            LoadError::LocatorError(locate_ctxt) => locate_ctxt.report_errs(),
         }
     }
 }
@@ -365,8 +365,8 @@ fn resolve_crate<'b>(
                 span,
                 ident,
                 crate_name: name,
-                hash: hash.map(|a| &*a),
-                extra_filename: extra_filename,
+                hash,
+                extra_filename,
                 filesearch: self.sess.target_filesearch(path_kind),
                 target: &self.sess.target.target,
                 triple: self.sess.opts.target_triple.clone(),
index e950c2815e9b4547f60a0ecf25b4a9b0964bad76..d882fe6f27ecc7a8f115306a43066b0a428cbb73 100644 (file)
@@ -264,7 +264,7 @@ fn specialized_decode(&mut self) -> Result<DefId, Self::Error> {
 impl<'a, 'tcx> SpecializedDecoder<DefIndex> for DecodeContext<'a, 'tcx> {
     #[inline]
     fn specialized_decode(&mut self) -> Result<DefIndex, Self::Error> {
-        Ok(DefIndex::from_raw_u32(self.read_u32()?))
+        Ok(DefIndex::from_u32(self.read_u32()?))
     }
 }
 
index 0ac03526832b7506c969c00e20318f4008c64157..7f0993e799f5424031d143c432de3e0624cda489 100644 (file)
@@ -34,7 +34,7 @@
 use syntax::attr;
 use syntax::source_map::Spanned;
 use syntax::symbol::{keywords, sym};
-use syntax_pos::{self, hygiene, FileName, SourceFile, Span};
+use syntax_pos::{self, FileName, SourceFile, Span};
 use log::{debug, trace};
 
 use rustc::hir::{self, PatKind};
@@ -134,7 +134,7 @@ fn specialized_encode(&mut self, def_id: &DefId) -> Result<(), Self::Error> {
 impl<'a, 'tcx> SpecializedEncoder<DefIndex> for EncodeContext<'a, 'tcx> {
     #[inline]
     fn specialized_encode(&mut self, def_index: &DefIndex) -> Result<(), Self::Error> {
-        self.emit_u32(def_index.as_raw_u32())
+        self.emit_u32(def_index.as_u32())
     }
 }
 
@@ -480,7 +480,7 @@ fn encode_crate_root(&mut self) -> Lazy<CrateRoot> {
             hash: tcx.crate_hash(LOCAL_CRATE),
             disambiguator: tcx.sess.local_crate_disambiguator(),
             panic_strategy: tcx.sess.panic_strategy(),
-            edition: hygiene::default_edition(),
+            edition: tcx.sess.edition(),
             has_global_allocator: has_global_allocator,
             has_panic_handler: has_panic_handler,
             has_default_lib_allocator: has_default_lib_allocator,
index 4c1e39cd0a9e1a945c1ed3c18ebc8e8cdd1f0f45..934e871559c79939010ffb30377007afc5b96ba6 100644 (file)
@@ -93,7 +93,7 @@ pub fn record(&mut self, def_id: DefId, entry: Lazy<Entry<'_>>) {
     pub fn record_index(&mut self, item: DefIndex, entry: Lazy<Entry<'_>>) {
         assert!(entry.position < (u32::MAX as usize));
         let position = entry.position as u32;
-        let array_index = item.as_array_index();
+        let array_index = item.index();
 
         let positions = &mut self.positions;
         assert!(u32::read_from_bytes_at(positions, array_index) == u32::MAX,
@@ -126,7 +126,7 @@ pub fn lookup(&self, bytes: &[u8], def_index: DefIndex) -> Option<Lazy<Entry<'tc
                def_index,
                self.len);
 
-        let position = u32::read_from_bytes_at(bytes, 1 + def_index.as_array_index());
+        let position = u32::read_from_bytes_at(bytes, 1 + def_index.index());
         if position == u32::MAX {
             debug!("Index::lookup: position=u32::MAX");
             None
index 7d7dd1061a959db19aa1b8571db02167691c78a2..3832c8ee227de1208bab95dd5bf864d93ccc964f 100644 (file)
@@ -321,7 +321,7 @@ pub fn maybe_load_library_crate(&mut self) -> Option<Library> {
         }
     }
 
-    pub fn report_errs(&mut self) -> ! {
+    pub fn report_errs(self) -> ! {
         let add = match self.root {
             &None => String::new(),
             &Some(ref r) => format!(" which `{}` depends on", r.ident),
@@ -901,8 +901,7 @@ fn get_metadata_section_imp(target: &Target,
             let mut inflated = Vec::new();
             match DeflateDecoder::new(compressed_bytes).read_to_end(&mut inflated) {
                 Ok(_) => {
-                    let buf = unsafe { OwningRef::new_assert_stable_address(inflated) };
-                    rustc_erase_owner!(buf.map_owner_box())
+                    rustc_erase_owner!(OwningRef::new(inflated).map_owner_box())
                 }
                 Err(_) => {
                     return Err(format!("failed to decompress metadata: {}", filename.display()));
index 4ced31593b1ae6cc0264bcdb6bb160eb4c51eb99..4d8acd241acd893f17910c81d87d8b09d8b979b6 100644 (file)
@@ -12,7 +12,6 @@
 use rustc::ty::{self, RegionKind, RegionVid, Ty, TyCtxt};
 use rustc::ty::print::RegionHighlightMode;
 use rustc_errors::DiagnosticBuilder;
-use syntax::ast::Name;
 use syntax::symbol::keywords;
 use syntax_pos::Span;
 use syntax_pos::symbol::InternedString;
@@ -60,8 +59,8 @@ impl RegionName {
     }
 
     #[allow(dead_code)]
-    crate fn name(&self) -> &InternedString {
-        &self.name
+    crate fn name(&self) -> InternedString {
+        self.name
     }
 
     crate fn highlight_region_name(
@@ -206,7 +205,7 @@ fn give_name_from_error_region(
         match error_region {
             ty::ReEarlyBound(ebr) => {
                 if ebr.has_name() {
-                    let span = self.get_named_span(tcx, error_region, &ebr.name);
+                    let span = self.get_named_span(tcx, error_region, ebr.name);
                     Some(RegionName {
                         name: ebr.name,
                         source: RegionNameSource::NamedEarlyBoundRegion(span)
@@ -223,7 +222,7 @@ fn give_name_from_error_region(
 
             ty::ReFree(free_region) => match free_region.bound_region {
                 ty::BoundRegion::BrNamed(_, name) => {
-                    let span = self.get_named_span(tcx, error_region, &name);
+                    let span = self.get_named_span(tcx, error_region, name);
                     Some(RegionName {
                         name,
                         source: RegionNameSource::NamedFreeRegion(span),
@@ -306,7 +305,7 @@ fn get_named_span(
         &self,
         tcx: TyCtxt<'_, '_, 'tcx>,
         error_region: &RegionKind,
-        name: &InternedString,
+        name: InternedString,
     ) -> Span {
         let scope = error_region.free_region_binding_scope(tcx);
         let node = tcx.hir().as_local_hir_id(scope).unwrap_or(hir::DUMMY_HIR_ID);
@@ -791,6 +790,6 @@ fn synthesize_region_name(&self, counter: &mut usize) -> InternedString {
         let c = *counter;
         *counter += 1;
 
-        Name::intern(&format!("'{:?}", c)).as_interned_str()
+        InternedString::intern(&format!("'{:?}", c))
     }
 }
index db827afdb94f4481096d600aa8db0cd5ec599e9d..d4c1e5416d565c50232d271ac1ec800c2c899f3b 100644 (file)
@@ -613,7 +613,9 @@ pub fn storage_live(
         trace!("{:?} is now live", local);
 
         let local_val = LocalValue::Uninitialized;
-        // StorageLive *always* kills the value that's currently stored
+        // StorageLive *always* kills the value that's currently stored.
+        // However, we do not error if the variable already is live;
+        // see <https://github.com/rust-lang/rust/issues/42371>.
         Ok(mem::replace(&mut self.frame_mut().locals[local].value, local_val))
     }
 
index 999e7402afd93a57f64787feee4416534a6a2d33..6b40245d39a8eae5fb7c094cb85f3d8bd0d122d0 100644 (file)
@@ -10,7 +10,7 @@
 use std::fmt::{self, Write};
 use std::iter;
 use rustc::mir::mono::Linkage;
-use syntax_pos::symbol::Symbol;
+use syntax_pos::symbol::InternedString;
 use syntax::source_map::Span;
 pub use rustc::mir::mono::MonoItem;
 
@@ -61,7 +61,7 @@ fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> ty::SymbolName {
             MonoItem::GlobalAsm(hir_id) => {
                 let def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
                 ty::SymbolName {
-                    name: Symbol::intern(&format!("global_asm_{:?}", def_id)).as_interned_str()
+                    name: InternedString::intern(&format!("global_asm_{:?}", def_id))
                 }
             }
         }
index fab07a2290eb5a31efc5bebf8a33aede8a6c7269..394d1f06029cb6459f2e579b50d770d9dddbd32a 100644 (file)
@@ -12,7 +12,7 @@
 use rustc::mir::*;
 use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext};
 
-use syntax::symbol::{Symbol, sym};
+use syntax::symbol::{InternedString, sym};
 
 use std::ops::Bound;
 
@@ -167,9 +167,9 @@ fn visit_rvalue(&mut self,
                     (CastTy::FnPtr, CastTy::Int(_)) => {
                         self.register_violations(&[UnsafetyViolation {
                             source_info: self.source_info,
-                            description: Symbol::intern("cast of pointer to int").as_interned_str(),
-                            details: Symbol::intern("casting pointers to integers in constants")
-                                     .as_interned_str(),
+                            description: InternedString::intern("cast of pointer to int"),
+                            details: InternedString::intern(
+                                "casting pointers to integers in constants"),
                             kind: UnsafetyViolationKind::General,
                         }], &[]);
                     },
@@ -185,9 +185,8 @@ fn visit_rvalue(&mut self,
                 if let ty::RawPtr(_) | ty::FnPtr(..) = lhs.ty(self.mir, self.tcx).sty {
                     self.register_violations(&[UnsafetyViolation {
                         source_info: self.source_info,
-                        description: Symbol::intern("pointer operation").as_interned_str(),
-                        details: Symbol::intern("operations on pointers in constants")
-                                 .as_interned_str(),
+                        description: InternedString::intern("pointer operation"),
+                        details: InternedString::intern("operations on pointers in constants"),
                         kind: UnsafetyViolationKind::General,
                     }], &[]);
                 }
@@ -212,13 +211,11 @@ fn visit_place(&mut self,
                             self.source_scope_local_data[source_info.scope].lint_root;
                         self.register_violations(&[UnsafetyViolation {
                             source_info,
-                            description: Symbol::intern("borrow of packed field").as_interned_str(),
-                            details:
-                                Symbol::intern("fields of packed structs might be misaligned: \
-                                                dereferencing a misaligned pointer or even just \
-                                                creating a misaligned reference is undefined \
-                                                behavior")
-                                    .as_interned_str(),
+                            description: InternedString::intern("borrow of packed field"),
+                            details: InternedString::intern(
+                                "fields of packed structs might be misaligned: dereferencing a \
+                                misaligned pointer or even just creating a misaligned reference \
+                                is undefined behavior"),
                             kind: UnsafetyViolationKind::BorrowPacked(lint_root)
                         }], &[]);
                     }
@@ -315,12 +312,10 @@ fn visit_place(&mut self,
                         self.source_scope_local_data[source_info.scope].lint_root;
                     self.register_violations(&[UnsafetyViolation {
                         source_info,
-                        description: Symbol::intern("use of extern static").as_interned_str(),
-                        details:
-                            Symbol::intern("extern statics are not controlled by the Rust type \
-                                            system: invalid data, aliasing violations or data \
-                                            races will cause undefined behavior")
-                                .as_interned_str(),
+                        description: InternedString::intern("use of extern static"),
+                        details: InternedString::intern(
+                            "extern statics are not controlled by the Rust type system: invalid \
+                            data, aliasing violations or data races will cause undefined behavior"),
                         kind: UnsafetyViolationKind::ExternStatic(lint_root)
                     }], &[]);
                 }
@@ -340,8 +335,8 @@ fn require_unsafe(
         let source_info = self.source_info;
         self.register_violations(&[UnsafetyViolation {
             source_info,
-            description: Symbol::intern(description).as_interned_str(),
-            details: Symbol::intern(details).as_interned_str(),
+            description: InternedString::intern(description),
+            details: InternedString::intern(details),
             kind,
         }], &[]);
     }
@@ -441,8 +436,8 @@ fn check_mut_borrowing_layout_constrained_field(
                                 let source_info = self.source_info;
                                 self.register_violations(&[UnsafetyViolation {
                                     source_info,
-                                    description: Symbol::intern(description).as_interned_str(),
-                                    details: Symbol::intern(details).as_interned_str(),
+                                    description: InternedString::intern(description),
+                                    details: InternedString::intern(details),
                                     kind: UnsafetyViolationKind::GeneralAndConstFn,
                                 }], &[]);
                             }
index 72af02782010679c81cfa69e822e967c049515bb..8f3dd72c4f2450a82ca151b53d8ebbe9128b72d6 100644 (file)
@@ -3,15 +3,17 @@
 
 use rustc::hir::def::DefKind;
 use rustc::mir::{
-    Constant, Location, Place, PlaceBase, Mir, Operand, Rvalue, Local,
+    AggregateKind, Constant, Location, Place, PlaceBase, Mir, Operand, Rvalue, Local,
     NullOp, UnOp, StatementKind, Statement, LocalKind, Static, StaticKind,
     TerminatorKind, Terminator,  ClearCrossCrate, SourceInfo, BinOp, ProjectionElem,
     SourceScope, SourceScopeLocalData, LocalDecl, Promoted,
 };
-use rustc::mir::visit::{Visitor, PlaceContext, MutatingUseContext, NonMutatingUseContext};
+use rustc::mir::visit::{
+    Visitor, PlaceContext, MutatingUseContext, MutVisitor, NonMutatingUseContext,
+};
 use rustc::mir::interpret::{InterpError, Scalar, GlobalId, EvalResult};
 use rustc::ty::{self, Instance, ParamEnv, Ty, TyCtxt};
-use syntax::source_map::DUMMY_SP;
+use syntax_pos::{Span, DUMMY_SP};
 use rustc::ty::subst::InternalSubsts;
 use rustc_data_structures::indexed_vec::IndexVec;
 use rustc::ty::layout::{
@@ -19,7 +21,7 @@
     HasTyCtxt, TargetDataLayout, HasDataLayout,
 };
 
-use crate::interpret::{InterpretCx, ScalarMaybeUndef, Immediate, OpTy, ImmTy, MemoryKind};
+use crate::interpret::{self, InterpretCx, ScalarMaybeUndef, Immediate, OpTy, ImmTy, MemoryKind};
 use crate::const_eval::{
     CompileTimeInterpreter, error_to_const_error, eval_promoted, mk_eval_cx,
 };
@@ -497,6 +499,57 @@ fn const_prop(
             },
         }
     }
+
+    fn operand_from_scalar(&self, scalar: Scalar, ty: Ty<'tcx>, span: Span) -> Operand<'tcx> {
+        Operand::Constant(Box::new(
+            Constant {
+                span,
+                ty,
+                user_ty: None,
+                literal: self.tcx.mk_const(ty::Const::from_scalar(
+                    scalar,
+                    ty,
+                ))
+            }
+        ))
+    }
+
+    fn replace_with_const(&self, rval: &mut Rvalue<'tcx>, value: Const<'tcx>, span: Span) {
+        self.ecx.validate_operand(
+            value,
+            vec![],
+            None,
+            true,
+        ).expect("value should already be a valid const");
+
+        if let interpret::Operand::Immediate(im) = *value {
+            match im {
+                interpret::Immediate::Scalar(ScalarMaybeUndef::Scalar(scalar)) => {
+                    *rval = Rvalue::Use(self.operand_from_scalar(scalar, value.layout.ty, span));
+                },
+                Immediate::ScalarPair(
+                    ScalarMaybeUndef::Scalar(one),
+                    ScalarMaybeUndef::Scalar(two)
+                ) => {
+                    let ty = &value.layout.ty.sty;
+                    if let ty::Tuple(substs) = ty {
+                        *rval = Rvalue::Aggregate(
+                            Box::new(AggregateKind::Tuple),
+                            vec![
+                                self.operand_from_scalar(one, substs[0].expect_ty(), span),
+                                self.operand_from_scalar(two, substs[1].expect_ty(), span),
+                            ],
+                        );
+                    }
+                },
+                _ => { }
+            }
+        }
+    }
+
+    fn should_const_prop(&self) -> bool {
+        self.tcx.sess.opts.debugging_opts.mir_opt_level >= 2
+    }
 }
 
 fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
@@ -560,10 +613,10 @@ fn visit_local(
     }
 }
 
-impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> {
+impl<'b, 'a, 'tcx> MutVisitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> {
     fn visit_constant(
         &mut self,
-        constant: &Constant<'tcx>,
+        constant: &mut Constant<'tcx>,
         location: Location,
     ) {
         trace!("visit_constant: {:?}", constant);
@@ -573,11 +626,11 @@ fn visit_constant(
 
     fn visit_statement(
         &mut self,
-        statement: &Statement<'tcx>,
+        statement: &mut Statement<'tcx>,
         location: Location,
     ) {
         trace!("visit_statement: {:?}", statement);
-        if let StatementKind::Assign(ref place, ref rval) = statement.kind {
+        if let StatementKind::Assign(ref place, ref mut rval) = statement.kind {
             let place_ty: Ty<'tcx> = place
                 .ty(&self.local_decls, self.tcx)
                 .ty;
@@ -589,6 +642,10 @@ fn visit_statement(
                             trace!("storing {:?} to {:?}", value, local);
                             assert!(self.places[local].is_none());
                             self.places[local] = Some(value);
+
+                            if self.should_const_prop() {
+                                self.replace_with_const(rval, value, statement.source_info.span);
+                            }
                         }
                     }
                 }
@@ -599,79 +656,116 @@ fn visit_statement(
 
     fn visit_terminator(
         &mut self,
-        terminator: &Terminator<'tcx>,
+        terminator: &mut Terminator<'tcx>,
         location: Location,
     ) {
         self.super_terminator(terminator, location);
-        let source_info = terminator.source_info;;
-        if let TerminatorKind::Assert { expected, msg, cond, .. } = &terminator.kind {
-            if let Some(value) = self.eval_operand(&cond, source_info) {
-                trace!("assertion on {:?} should be {:?}", value, expected);
-                let expected = ScalarMaybeUndef::from(Scalar::from_bool(*expected));
-                if expected != self.ecx.read_scalar(value).unwrap() {
-                    // poison all places this operand references so that further code
-                    // doesn't use the invalid value
-                    match cond {
-                        Operand::Move(ref place) | Operand::Copy(ref place) => {
-                            let mut place = place;
-                            while let Place::Projection(ref proj) = *place {
-                                place = &proj.base;
-                            }
-                            if let Place::Base(PlaceBase::Local(local)) = *place {
-                                self.places[local] = None;
+        let source_info = terminator.source_info;
+        match &mut terminator.kind {
+            TerminatorKind::Assert { expected, msg, ref mut cond, .. } => {
+                if let Some(value) = self.eval_operand(&cond, source_info) {
+                    trace!("assertion on {:?} should be {:?}", value, expected);
+                    let expected = ScalarMaybeUndef::from(Scalar::from_bool(*expected));
+                    let value_const = self.ecx.read_scalar(value).unwrap();
+                    if expected != value_const {
+                        // poison all places this operand references so that further code
+                        // doesn't use the invalid value
+                        match cond {
+                            Operand::Move(ref place) | Operand::Copy(ref place) => {
+                                let mut place = place;
+                                while let Place::Projection(ref proj) = *place {
+                                    place = &proj.base;
+                                }
+                                if let Place::Base(PlaceBase::Local(local)) = *place {
+                                    self.places[local] = None;
+                                }
+                            },
+                            Operand::Constant(_) => {}
+                        }
+                        let span = terminator.source_info.span;
+                        let hir_id = self
+                            .tcx
+                            .hir()
+                            .as_local_hir_id(self.source.def_id())
+                            .expect("some part of a failing const eval must be local");
+                        use rustc::mir::interpret::InterpError::*;
+                        let msg = match msg {
+                            Overflow(_) |
+                            OverflowNeg |
+                            DivisionByZero |
+                            RemainderByZero => msg.description().to_owned(),
+                            BoundsCheck { ref len, ref index } => {
+                                let len = self
+                                    .eval_operand(len, source_info)
+                                    .expect("len must be const");
+                                let len = match self.ecx.read_scalar(len) {
+                                    Ok(ScalarMaybeUndef::Scalar(Scalar::Bits {
+                                        bits, ..
+                                    })) => bits,
+                                    other => bug!("const len not primitive: {:?}", other),
+                                };
+                                let index = self
+                                    .eval_operand(index, source_info)
+                                    .expect("index must be const");
+                                let index = match self.ecx.read_scalar(index) {
+                                    Ok(ScalarMaybeUndef::Scalar(Scalar::Bits {
+                                        bits, ..
+                                    })) => bits,
+                                    other => bug!("const index not primitive: {:?}", other),
+                                };
+                                format!(
+                                    "index out of bounds: \
+                                    the len is {} but the index is {}",
+                                    len,
+                                    index,
+                                )
+                            },
+                            // Need proper const propagator for these
+                            _ => return,
+                        };
+                        self.tcx.lint_hir(
+                            ::rustc::lint::builtin::CONST_ERR,
+                            hir_id,
+                            span,
+                            &msg,
+                        );
+                    } else {
+                        if self.should_const_prop() {
+                            if let ScalarMaybeUndef::Scalar(scalar) = value_const {
+                                *cond = self.operand_from_scalar(
+                                    scalar,
+                                    self.tcx.types.bool,
+                                    source_info.span,
+                                );
                             }
-                        },
-                        Operand::Constant(_) => {}
+                        }
                     }
-                    let span = terminator.source_info.span;
-                    let hir_id = self
-                        .tcx
-                        .hir()
-                        .as_local_hir_id(self.source.def_id())
-                        .expect("some part of a failing const eval must be local");
-                    use rustc::mir::interpret::InterpError::*;
-                    let msg = match msg {
-                        Overflow(_) |
-                        OverflowNeg |
-                        DivisionByZero |
-                        RemainderByZero => msg.description().to_owned(),
-                        BoundsCheck { ref len, ref index } => {
-                            let len = self
-                                .eval_operand(len, source_info)
-                                .expect("len must be const");
-                            let len = match self.ecx.read_scalar(len) {
-                                Ok(ScalarMaybeUndef::Scalar(Scalar::Bits {
-                                    bits, ..
-                                })) => bits,
-                                other => bug!("const len not primitive: {:?}", other),
-                            };
-                            let index = self
-                                .eval_operand(index, source_info)
-                                .expect("index must be const");
-                            let index = match self.ecx.read_scalar(index) {
-                                Ok(ScalarMaybeUndef::Scalar(Scalar::Bits {
-                                    bits, ..
-                                })) => bits,
-                                other => bug!("const index not primitive: {:?}", other),
-                            };
-                            format!(
-                                "index out of bounds: \
-                                the len is {} but the index is {}",
-                                len,
-                                index,
-                            )
-                        },
-                        // Need proper const propagator for these
-                        _ => return,
-                    };
-                    self.tcx.lint_hir(
-                        ::rustc::lint::builtin::CONST_ERR,
-                        hir_id,
-                        span,
-                        &msg,
-                    );
                 }
-            }
+            },
+            TerminatorKind::SwitchInt { ref mut discr, switch_ty, .. } => {
+                if self.should_const_prop() {
+                    if let Some(value) = self.eval_operand(&discr, source_info) {
+                        if let ScalarMaybeUndef::Scalar(scalar) =
+                                self.ecx.read_scalar(value).unwrap() {
+                            *discr = self.operand_from_scalar(scalar, switch_ty, source_info.span);
+                        }
+                    }
+                }
+            },
+            //none of these have Operands to const-propagate
+            TerminatorKind::Goto { .. } |
+            TerminatorKind::Resume |
+            TerminatorKind::Abort |
+            TerminatorKind::Return |
+            TerminatorKind::Unreachable |
+            TerminatorKind::Drop { .. } |
+            TerminatorKind::DropAndReplace { .. } |
+            TerminatorKind::Yield { .. } |
+            TerminatorKind::GeneratorDrop |
+            TerminatorKind::FalseEdges { .. } |
+            TerminatorKind::FalseUnwind { .. } => { }
+            //FIXME(wesleywiser) Call does have Operands that could be const-propagated
+            TerminatorKind::Call { .. } => { }
         }
     }
 }
index 188da9a82dc995a07c85e1119c51b3a3894a3807..fc4c6b3fd3f244afc5a41d37239e39c31ba8f987 100644 (file)
@@ -27,7 +27,7 @@ pub fn graphviz_safe_def_name(def_id: DefId) -> String {
     format!(
         "{}_{}",
         def_id.krate.index(),
-        def_id.index.as_array_index(),
+        def_id.index.index(),
     )
 }
 
index c2d1d5fa65af299b242b708009a9d0f0878499c8..2ed6f868fa1ee7cd818a675eaea810b59cbb5b1e 100644 (file)
@@ -6,7 +6,6 @@
 
 use syntax::ext::base::{SyntaxExtension, NamedSyntaxExtension, NormalTT, IdentTT};
 use syntax::ext::base::MacroExpanderFn;
-use syntax::ext::hygiene;
 use syntax::symbol::{Symbol, sym};
 use syntax::ast;
 use syntax::feature_gate::AttributeType;
@@ -130,7 +129,7 @@ pub fn register_macro(&mut self, name: &str, expander: MacroExpanderFn) {
             allow_internal_unsafe: false,
             local_inner_macros: false,
             unstable_feature: None,
-            edition: hygiene::default_edition(),
+            edition: self.sess.edition(),
         });
     }
 
index f70ca6f859b98b71a41ae308681d300f273079a6..3b58a99d19fe00b8389af4716511bd535327ec32 100644 (file)
@@ -314,7 +314,7 @@ fn build_reduced_graph_for_use_tree(
                             Ident::new(keywords::SelfLower.name(), new_span)
                         ),
                         kind: ast::UseTreeKind::Simple(
-                            Some(Ident::new(Name::gensym("__dummy"), new_span)),
+                            Some(Ident::from_str_and_span("__dummy", new_span).gensym()),
                             ast::DUMMY_NODE_ID,
                             ast::DUMMY_NODE_ID,
                         ),
index 678f4c23d3e9ebf8e6ca9622df91b0d6d957774a..c4a4dd306055bb92db05298eebe2bba46db2ef20 100644 (file)
@@ -1979,11 +1979,11 @@ pub fn new(session: &'a Session,
                                        .collect();
 
         if !attr::contains_name(&krate.attrs, sym::no_core) {
-            extern_prelude.insert(Ident::from_str("core"), Default::default());
+            extern_prelude.insert(Ident::with_empty_ctxt(sym::core), Default::default());
             if !attr::contains_name(&krate.attrs, sym::no_std) {
-                extern_prelude.insert(Ident::from_str("std"), Default::default());
+                extern_prelude.insert(Ident::with_empty_ctxt(sym::std), Default::default());
                 if session.rust_2018() {
-                    extern_prelude.insert(Ident::from_str("meta"), Default::default());
+                    extern_prelude.insert(Ident::with_empty_ctxt(sym::meta), Default::default());
                 }
             }
         }
@@ -3374,7 +3374,7 @@ fn smart_resolve_path_fragment(&mut self,
                     self.trait_map.insert(id, traits);
                 }
 
-                let mut std_path = vec![Segment::from_ident(Ident::from_str("std"))];
+                let mut std_path = vec![Segment::from_ident(Ident::with_empty_ctxt(sym::std))];
                 std_path.extend(path);
                 if self.primitive_type_table.primitive_types.contains_key(&path[0].ident.name) {
                     let cl = CrateLint::No;
@@ -4225,7 +4225,7 @@ fn lookup_typo_candidate<FilterFn>(
         let add_module_candidates = |module: Module<'_>, names: &mut Vec<TypoSuggestion>| {
             for (&(ident, _), resolution) in module.resolutions.borrow().iter() {
                 if let Some(binding) = resolution.borrow().binding {
-                    if !ident.name.is_gensymed() && filter_fn(binding.res()) {
+                    if !ident.is_gensymed() && filter_fn(binding.res()) {
                         names.push(TypoSuggestion {
                             candidate: ident.name,
                             article: binding.res().article(),
@@ -4243,7 +4243,7 @@ fn lookup_typo_candidate<FilterFn>(
             for rib in self.ribs[ns].iter().rev() {
                 // Locals and type parameters
                 for (ident, &res) in &rib.bindings {
-                    if !ident.name.is_gensymed() && filter_fn(res) {
+                    if !ident.is_gensymed() && filter_fn(res) {
                         names.push(TypoSuggestion {
                             candidate: ident.name,
                             article: res.article(),
@@ -4273,7 +4273,7 @@ fn lookup_typo_candidate<FilterFn>(
                                             },
                                         );
 
-                                        if !ident.name.is_gensymed() && filter_fn(crate_mod) {
+                                        if !ident.is_gensymed() && filter_fn(crate_mod) {
                                             Some(TypoSuggestion {
                                                 candidate: ident.name,
                                                 article: "a",
@@ -4298,7 +4298,6 @@ fn lookup_typo_candidate<FilterFn>(
                 names.extend(
                     self.primitive_type_table.primitive_types
                         .iter()
-                        .filter(|(name, _)| !name.is_gensymed())
                         .map(|(name, _)| {
                             TypoSuggestion {
                                 candidate: *name,
index 9f3e1c308f6379e9c591b7530381098459057b0a..d07f7b65275f19f3ac3f6e80083dd49b2d89d276 100644 (file)
@@ -17,7 +17,7 @@
 use syntax::ext::base::{self, Determinacy};
 use syntax::ext::base::{MacroKind, SyntaxExtension};
 use syntax::ext::expand::{AstFragment, Invocation, InvocationKind};
-use syntax::ext::hygiene::{self, Mark};
+use syntax::ext::hygiene::Mark;
 use syntax::ext::tt::macro_rules;
 use syntax::feature_gate::{
     feature_err, is_builtin_attr_name, AttributeGate, GateIssue, Stability, BUILTIN_ATTRIBUTES,
@@ -172,7 +172,7 @@ fn visit_ast_fragment_with_placeholders(&mut self, mark: Mark, fragment: &AstFra
     fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>) {
         let def_id = DefId {
             krate: CrateNum::BuiltinMacros,
-            index: DefIndex::from_array_index(self.macro_map.len()),
+            index: DefIndex::from(self.macro_map.len()),
         };
         let kind = ext.kind();
         self.macro_map.insert(def_id, ext);
@@ -1100,7 +1100,7 @@ pub fn define_macro(&mut self,
         let def_id = self.definitions.local_def_id(item.id);
         let ext = Lrc::new(macro_rules::compile(&self.session.parse_sess,
                                                &self.session.features_untracked(),
-                                               item, hygiene::default_edition()));
+                                               item, self.session.edition()));
         self.macro_map.insert(def_id, ext);
 
         let def = match item.node { ast::ItemKind::MacroDef(ref def) => def, _ => unreachable!() };
index 4058f0bce0f9544e1eceb207a647b102a080d932..3a6a8b56ff35d875b695f8d2c644ddaec78be745 100644 (file)
@@ -1395,7 +1395,7 @@ fn finalize_resolutions_in(&mut self, module: Module<'b>) {
             // so they can cause name conflict errors downstream.
             let is_good_import = binding.is_import() && !binding.is_ambiguity() &&
                                  // Note that as_str() de-gensyms the Symbol
-                                 !(ident.name.is_gensymed() && ident.name.as_str() != "_");
+                                 !(ident.is_gensymed() && ident.name.as_str() != "_");
             if is_good_import || binding.is_macro_def() {
                 let res = binding.res();
                 if res != Res::Err {
index e03da2ed608be02f02d3137dd1d9af17412ac6bb..d34f5633946bfa281773da81d21cab2b44013bcc 100644 (file)
@@ -1170,7 +1170,7 @@ fn generated_code(span: Span) -> bool {
 fn id_from_def_id(id: DefId) -> rls_data::Id {
     rls_data::Id {
         krate: id.krate.as_u32(),
-        index: id.index.as_raw_u32(),
+        index: id.index.as_u32(),
     }
 }
 
index caefe1242115508ddec3ef0c70499a83e6f1ea3e..4b052aec5fc2f3be0472421fb253bd40a803d394 100644 (file)
@@ -290,6 +290,7 @@ fn check_generic_arg_count(
         }
 
         // Prohibit explicit lifetime arguments if late-bound lifetime parameters are present.
+        let mut reported_late_bound_region_err = None;
         if !infer_lifetimes {
             if let Some(span_late) = def.has_late_bound_regions {
                 let msg = "cannot specify lifetime arguments explicitly \
@@ -301,13 +302,13 @@ fn check_generic_arg_count(
                     let mut err = tcx.sess.struct_span_err(span, msg);
                     err.span_note(span_late, note);
                     err.emit();
-                    return (true, None);
+                    reported_late_bound_region_err = Some(true);
                 } else {
                     let mut multispan = MultiSpan::from_span(span);
                     multispan.push_span_label(span_late, note.to_string());
                     tcx.lint_hir(lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS,
                                  args.args[0].id(), multispan, msg);
-                    return (false, None);
+                    reported_late_bound_region_err = Some(false);
                 }
             }
         }
@@ -325,7 +326,7 @@ fn check_generic_arg_count(
             // For kinds without defaults (i.e., lifetimes), `required == permitted`.
             // For other kinds (i.e., types), `permitted` may be greater than `required`.
             if required <= provided && provided <= permitted {
-                return (false, None);
+                return (reported_late_bound_region_err.unwrap_or(false), None);
             }
 
             // Unfortunately lifetime and type parameter mismatches are typically styled
@@ -380,7 +381,8 @@ fn check_generic_arg_count(
              potential_assoc_types)
         };
 
-        if !infer_lifetimes || arg_counts.lifetimes > param_counts.lifetimes {
+        if reported_late_bound_region_err.is_none()
+            && (!infer_lifetimes || arg_counts.lifetimes > param_counts.lifetimes) {
             check_kind_count(
                 "lifetime",
                 param_counts.lifetimes,
@@ -410,7 +412,7 @@ fn check_generic_arg_count(
                 arg_counts.lifetimes,
             )
         } else {
-            (false, None)
+            (reported_late_bound_region_err.unwrap_or(false), None)
         }
     }
 
index 40c60caffa42d8eb7dd81d67af010c49b924e428..c6191e6b579ce45c036876db9c47656585997c97 100644 (file)
@@ -7,7 +7,7 @@
 use crate::require_same_types;
 
 use rustc_target::spec::abi::Abi;
-use syntax::symbol::Symbol;
+use syntax::symbol::InternedString;
 
 use rustc::hir;
 
@@ -80,7 +80,7 @@ pub fn intrisic_operation_unsafety(intrinsic: &str) -> hir::Unsafety {
 /// and in libcore/intrinsics.rs
 pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                       it: &hir::ForeignItem) {
-    let param = |n| tcx.mk_ty_param(n, Symbol::intern(&format!("P{}", n)).as_interned_str());
+    let param = |n| tcx.mk_ty_param(n, InternedString::intern(&format!("P{}", n)));
     let name = it.ident.as_str();
 
     let mk_va_list_ty = || {
@@ -397,7 +397,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                                it: &hir::ForeignItem) {
     let param = |n| {
-        let name = Symbol::intern(&format!("P{}", n)).as_interned_str();
+        let name = InternedString::intern(&format!("P{}", n));
         tcx.mk_ty_param(n, name)
     };
 
index d1ca05780930aae22a28854174b9713195467b4d..cd207478f8f6f86e5c701df44e4257a01b2d7761 100644 (file)
@@ -305,8 +305,8 @@ fn check_overloaded_binop(&self,
                             };
                             if let Some(missing_trait) = missing_trait {
                                 if op.node == hir::BinOpKind::Add &&
-                                    self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty,
-                                                            rhs_ty, &mut err, true, op) {
+                                    self.check_str_addition(
+                                        lhs_expr, rhs_expr, lhs_ty, rhs_ty, &mut err, true, op) {
                                     // This has nothing here because it means we did string
                                     // concatenation (e.g., "Hello " += "World!"). This means
                                     // we don't want the note in the else clause to be emitted
@@ -400,8 +400,8 @@ fn check_overloaded_binop(&self,
                             };
                             if let Some(missing_trait) = missing_trait {
                                 if op.node == hir::BinOpKind::Add &&
-                                    self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty,
-                                                            rhs_ty, &mut err, false, op) {
+                                    self.check_str_addition(
+                                        lhs_expr, rhs_expr, lhs_ty, rhs_ty, &mut err, false, op) {
                                     // This has nothing here because it means we did string
                                     // concatenation (e.g., "Hello " + "World!"). This means
                                     // we don't want the note in the else clause to be emitted
@@ -502,9 +502,13 @@ fn add_type_neq_err_label(
         false
     }
 
+    /// Provide actionable suggestions when trying to add two strings with incorrect types,
+    /// like `&str + &str`, `String + String` and `&str + &String`.
+    ///
+    /// If this function returns `true` it means a note was printed, so we don't need
+    /// to print the normal "implementation of `std::ops::Add` might be missing" note
     fn check_str_addition(
         &self,
-        expr: &'gcx hir::Expr,
         lhs_expr: &'gcx hir::Expr,
         rhs_expr: &'gcx hir::Expr,
         lhs_ty: Ty<'tcx>,
@@ -514,45 +518,78 @@ fn check_str_addition(
         op: hir::BinOp,
     ) -> bool {
         let source_map = self.tcx.sess.source_map();
+        let remove_borrow_msg = "String concatenation appends the string on the right to the \
+                                 string on the left and may require reallocation. This \
+                                 requires ownership of the string on the left";
+
         let msg = "`to_owned()` can be used to create an owned `String` \
                    from a string reference. String concatenation \
                    appends the string on the right to the string \
                    on the left and may require reallocation. This \
                    requires ownership of the string on the left";
-        // If this function returns true it means a note was printed, so we don't need
-        // to print the normal "implementation of `std::ops::Add` might be missing" note
+
+        let is_std_string = |ty| &format!("{:?}", ty) == "std::string::String";
+
         match (&lhs_ty.sty, &rhs_ty.sty) {
-            (&Ref(_, l_ty, _), &Ref(_, r_ty, _))
-            if l_ty.sty == Str && r_ty.sty == Str => {
-                if !is_assign {
-                    err.span_label(op.span,
-                                   "`+` can't be used to concatenate two `&str` strings");
+            (&Ref(_, l_ty, _), &Ref(_, r_ty, _)) // &str or &String + &str, &String or &&str
+                if (l_ty.sty == Str || is_std_string(l_ty)) && (
+                        r_ty.sty == Str || is_std_string(r_ty) ||
+                        &format!("{:?}", rhs_ty) == "&&str"
+                    ) =>
+            {
+                if !is_assign { // Do not supply this message if `&str += &str`
+                    err.span_label(
+                        op.span,
+                        "`+` cannot be used to concatenate two `&str` strings",
+                    );
                     match source_map.span_to_snippet(lhs_expr.span) {
-                        Ok(lstring) => err.span_suggestion(
-                            lhs_expr.span,
-                            msg,
-                            format!("{}.to_owned()", lstring),
-                            Applicability::MachineApplicable,
-                        ),
+                        Ok(lstring) => {
+                            err.span_suggestion(
+                                lhs_expr.span,
+                                if lstring.starts_with("&") {
+                                    remove_borrow_msg
+                                } else {
+                                    msg
+                                },
+                                if lstring.starts_with("&") {
+                                    // let a = String::new();
+                                    // let _ = &a + "bar";
+                                    format!("{}", &lstring[1..])
+                                } else {
+                                    format!("{}.to_owned()", lstring)
+                                },
+                                Applicability::MachineApplicable,
+                            )
+                        }
                         _ => err.help(msg),
                     };
                 }
                 true
             }
-            (&Ref(_, l_ty, _), &Adt(..))
-            if l_ty.sty == Str && &format!("{:?}", rhs_ty) == "std::string::String" => {
-                err.span_label(expr.span,
-                    "`+` can't be used to concatenate a `&str` with a `String`");
+            (&Ref(_, l_ty, _), &Adt(..)) // Handle `&str` & `&String` + `String`
+                if (l_ty.sty == Str || is_std_string(l_ty)) && is_std_string(rhs_ty) =>
+            {
+                err.span_label(
+                    op.span,
+                    "`+` cannot be used to concatenate a `&str` with a `String`",
+                );
                 match (
                     source_map.span_to_snippet(lhs_expr.span),
                     source_map.span_to_snippet(rhs_expr.span),
                     is_assign,
                 ) {
                     (Ok(l), Ok(r), false) => {
+                        let to_string = if l.starts_with("&") {
+                            // let a = String::new(); let b = String::new();
+                            // let _ = &a + b;
+                            format!("{}", &l[1..])
+                        } else {
+                            format!("{}.to_owned()", l)
+                        };
                         err.multipart_suggestion(
                             msg,
                             vec![
-                                (lhs_expr.span, format!("{}.to_owned()", l)),
+                                (lhs_expr.span, to_string),
                                 (rhs_expr.span, format!("&{}", r)),
                             ],
                             Applicability::MachineApplicable,
index cbb6d9b29f59f7f642588ffbe18ae3e0e18d7d22..3c3509f24ce1eb97000433d6245363ec14f114dd 100644 (file)
@@ -158,6 +158,13 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) {
             continue;
         }
 
+        // If the extern crate is renamed, then we cannot suggest replacing it with a use as this
+        // would not insert the new name into the prelude, where other imports in the crate may be
+        // expecting it.
+        if extern_crate.orig_name.is_some() {
+            continue;
+        }
+
         // If the extern crate has any attributes, they may have funky
         // semantics we can't faithfully represent using `use` (most
         // notably `#[macro_use]`). Ignore it.
index d0156db32e9485cda1d790a90e9ef6fa229b272b..a9951c7fe447952616e1854e649f4f9ae2f92685 100644 (file)
@@ -5,8 +5,6 @@
 use rustc::traits::{self, IntercrateMode};
 use rustc::ty::TyCtxt;
 
-use crate::lint;
-
 pub fn crate_inherent_impls_overlap_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                                     crate_num: CrateNum) {
     assert_eq!(crate_num, LOCAL_CRATE);
@@ -20,8 +18,7 @@ struct InherentOverlapChecker<'a, 'tcx: 'a> {
 
 impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
     fn check_for_common_items_in_impls(&self, impl1: DefId, impl2: DefId,
-                                       overlap: traits::OverlapResult<'_>,
-                                       used_to_be_allowed: bool) {
+                                       overlap: traits::OverlapResult<'_>) {
 
         let name_and_namespace = |def_id| {
             let item = self.tcx.associated_item(def_id);
@@ -36,22 +33,12 @@ fn check_for_common_items_in_impls(&self, impl1: DefId, impl2: DefId,
 
             for &item2 in &impl_items2[..] {
                 if (name, namespace) == name_and_namespace(item2) {
-                    let hir_id = self.tcx.hir().as_local_hir_id(impl1);
-                    let mut err = if used_to_be_allowed && hir_id.is_some() {
-                        self.tcx.struct_span_lint_hir(
-                            lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS,
-                            hir_id.unwrap(),
-                            self.tcx.span_of_impl(item1).unwrap(),
-                            &format!("duplicate definitions with name `{}` (E0592)", name)
-                        )
-                    } else {
+                    let mut err =
                         struct_span_err!(self.tcx.sess,
                                          self.tcx.span_of_impl(item1).unwrap(),
                                          E0592,
                                          "duplicate definitions with name `{}`",
-                                         name)
-                    };
-
+                                         name);
                     err.span_label(self.tcx.span_of_impl(item1).unwrap(),
                                    format!("duplicate definitions for `{}`", name));
                     err.span_label(self.tcx.span_of_impl(item2).unwrap(),
@@ -76,7 +63,7 @@ fn check_for_overlapping_inherent_impls(&self, ty_def_id: DefId) {
 
         for (i, &impl1_def_id) in impls.iter().enumerate() {
             for &impl2_def_id in &impls[(i + 1)..] {
-                let used_to_be_allowed = traits::overlapping_impls(
+                traits::overlapping_impls(
                     self.tcx,
                     impl1_def_id,
                     impl2_def_id,
@@ -86,28 +73,11 @@ fn check_for_overlapping_inherent_impls(&self, ty_def_id: DefId) {
                             impl1_def_id,
                             impl2_def_id,
                             overlap,
-                            false,
                         );
                         false
                     },
                     || true,
                 );
-
-                if used_to_be_allowed {
-                    traits::overlapping_impls(
-                        self.tcx,
-                        impl1_def_id,
-                        impl2_def_id,
-                        IntercrateMode::Fixed,
-                        |overlap| self.check_for_common_items_in_impls(
-                            impl1_def_id,
-                            impl2_def_id,
-                            overlap,
-                            true,
-                        ),
-                        || (),
-                    );
-                }
             }
         }
     }
index 6527e8655b5ef21bb6d93a7b65f5fed7c8c098fa..711d79f95f53a658d42a1fff866a78c9a78ff4e5 100644 (file)
@@ -39,7 +39,7 @@
 use syntax::attr::{InlineAttr, OptimizeAttr, list_contains_name, mark_used};
 use syntax::source_map::Spanned;
 use syntax::feature_gate;
-use syntax::symbol::{keywords, Symbol, sym};
+use syntax::symbol::{InternedString, keywords, Symbol, sym};
 use syntax_pos::{Span, DUMMY_SP};
 
 use rustc::hir::def::{CtorKind, Res, DefKind};
@@ -1082,7 +1082,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
                 .enumerate()
                 .map(|(i, &arg)| ty::GenericParamDef {
                     index: type_start + i as u32,
-                    name: Symbol::intern(arg).as_interned_str(),
+                    name: InternedString::intern(arg),
                     def_id,
                     pure_wrt_drop: false,
                     kind: ty::GenericParamDefKind::Type {
@@ -1097,7 +1097,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
             params.extend(upvars.iter().zip((dummy_args.len() as u32)..).map(|(_, i)| {
                 ty::GenericParamDef {
                     index: type_start + i,
-                    name: Symbol::intern("<upvar>").as_interned_str(),
+                    name: InternedString::intern("<upvar>"),
                     def_id,
                     pure_wrt_drop: false,
                     kind: ty::GenericParamDefKind::Type {
index 61399e0568cb10bf2ca8406a7c1af04ca88c6854..67113787915a3e251b455c5d117d87faabbd219f 100644 (file)
@@ -418,7 +418,7 @@ mod test {
     use syntax::attr;
     use syntax::source_map::dummy_spanned;
     use syntax::symbol::Symbol;
-    use syntax::with_globals;
+    use syntax::with_default_globals;
 
     fn word_cfg(s: &str) -> Cfg {
         Cfg::Cfg(Symbol::intern(s), None)
@@ -466,7 +466,7 @@ macro_rules! dummy_meta_item_list {
 
     #[test]
     fn test_cfg_not() {
-        with_globals(|| {
+        with_default_globals(|| {
             assert_eq!(!Cfg::False, Cfg::True);
             assert_eq!(!Cfg::True, Cfg::False);
             assert_eq!(!word_cfg("test"), Cfg::Not(Box::new(word_cfg("test"))));
@@ -484,7 +484,7 @@ fn test_cfg_not() {
 
     #[test]
     fn test_cfg_and() {
-        with_globals(|| {
+        with_default_globals(|| {
             let mut x = Cfg::False;
             x &= Cfg::True;
             assert_eq!(x, Cfg::False);
@@ -536,7 +536,7 @@ fn test_cfg_and() {
 
     #[test]
     fn test_cfg_or() {
-        with_globals(|| {
+        with_default_globals(|| {
             let mut x = Cfg::True;
             x |= Cfg::False;
             assert_eq!(x, Cfg::True);
@@ -588,7 +588,7 @@ fn test_cfg_or() {
 
     #[test]
     fn test_parse_ok() {
-        with_globals(|| {
+        with_default_globals(|| {
             let mi = dummy_meta_item_word("all");
             assert_eq!(Cfg::parse(&mi), Ok(word_cfg("all")));
 
@@ -622,7 +622,7 @@ fn test_parse_ok() {
 
     #[test]
     fn test_parse_err() {
-        with_globals(|| {
+        with_default_globals(|| {
             let mi = attr::mk_name_value_item(
                 DUMMY_SP,
                 Ident::from_str("foo"),
@@ -661,7 +661,7 @@ fn test_parse_err() {
 
     #[test]
     fn test_render_short_html() {
-        with_globals(|| {
+        with_default_globals(|| {
             assert_eq!(
                 word_cfg("unix").render_short_html(),
                 "Unix"
@@ -741,7 +741,7 @@ fn test_render_short_html() {
 
     #[test]
     fn test_render_long_html() {
-        with_globals(|| {
+        with_default_globals(|| {
             assert_eq!(
                 word_cfg("unix").render_long_html(),
                 "This is supported on <strong>Unix</strong> only."
index f9a43ccfbace182f71b5e5f9dd824338d17f986a..e434623d4a12759fe3f1bb82cef4fa0cd11fca18 100644 (file)
@@ -929,8 +929,9 @@ pub fn from_ast(diagnostic: &::errors::Handler,
         for attr in attrs.lists(sym::target_feature) {
             if attr.check_name(sym::enable) {
                 if let Some(feat) = attr.value_str() {
-                    let meta = attr::mk_name_value_item_str(Ident::from_str("target_feature"),
-                                                            dummy_spanned(feat));
+                    let meta = attr::mk_name_value_item_str(
+                        Ident::with_empty_ctxt(sym::target_feature),
+                        dummy_spanned(feat));
                     if let Ok(feat_cfg) = Cfg::parse(&meta) {
                         cfg &= feat_cfg;
                     }
@@ -3148,7 +3149,10 @@ impl<'tcx> Clean<Constant> for ty::Const<'tcx> {
     fn clean(&self, cx: &DocContext<'_>) -> Constant {
         Constant {
             type_: self.ty.clean(cx),
-            expr: format!("{:?}", self.val), // FIXME(const_generics)
+            expr: match self.val {
+                ConstValue::Param(ty::ParamConst { name, .. }) => format!("{}", name),
+                e => format!("{:?}", e), // FIXME generic consts with expressions
+            },
         }
     }
 }
@@ -3404,6 +3408,7 @@ pub struct Span {
     pub locol: usize,
     pub hiline: usize,
     pub hicol: usize,
+    pub original: syntax_pos::Span,
 }
 
 impl Span {
@@ -3412,8 +3417,13 @@ pub fn empty() -> Span {
             filename: FileName::Anon(0),
             loline: 0, locol: 0,
             hiline: 0, hicol: 0,
+            original: syntax_pos::DUMMY_SP,
         }
     }
+
+    pub fn span(&self) -> syntax_pos::Span {
+        self.original
+    }
 }
 
 impl Clean<Span> for syntax_pos::Span {
@@ -3432,6 +3442,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Span {
             locol: lo.col.to_usize(),
             hiline: hi.line,
             hicol: hi.col.to_usize(),
+            original: *self,
         }
     }
 }
index 72421c9decc6febf4c10e40cfd56a42aec037783..6b490f730afa0c951cab05c7dd5fcb79841321a7 100644 (file)
@@ -13,7 +13,7 @@
 use rustc::session::search_paths::SearchPath;
 use rustc_driver;
 use rustc_target::spec::TargetTriple;
-use syntax::edition::Edition;
+use syntax::edition::{Edition, DEFAULT_EDITION};
 
 use crate::core::new_handler;
 use crate::externalfiles::ExternalHtml;
@@ -386,6 +386,18 @@ pub fn from_matches(matches: &getopts::Matches) -> Result<Options, i32> {
             }
         }
 
+        let edition = if let Some(e) = matches.opt_str("edition") {
+            match e.parse() {
+                Ok(e) => e,
+                Err(_) => {
+                    diag.struct_err("could not parse edition").emit();
+                    return Err(1);
+                }
+            }
+        } else {
+            DEFAULT_EDITION
+        };
+
         let mut id_map = html::markdown::IdMap::new();
         id_map.populate(html::render::initial_ids());
         let external_html = match ExternalHtml::load(
@@ -393,20 +405,12 @@ pub fn from_matches(matches: &getopts::Matches) -> Result<Options, i32> {
                 &matches.opt_strs("html-before-content"),
                 &matches.opt_strs("html-after-content"),
                 &matches.opt_strs("markdown-before-content"),
-                &matches.opt_strs("markdown-after-content"), &diag, &mut id_map) {
+                &matches.opt_strs("markdown-after-content"),
+                &diag, &mut id_map, edition) {
             Some(eh) => eh,
             None => return Err(3),
         };
 
-        let edition = matches.opt_str("edition").unwrap_or("2015".to_string());
-        let edition = match edition.parse() {
-            Ok(e) => e,
-            Err(_) => {
-                diag.struct_err("could not parse edition").emit();
-                return Err(1);
-            }
-        };
-
         match matches.opt_str("r").as_ref().map(|s| &**s) {
             Some("rust") | None => {}
             Some(s) => {
@@ -538,7 +542,7 @@ fn check_deprecated_options(matches: &getopts::Matches, diag: &errors::Handler)
        "passes",
     ];
 
-    for flag in deprecated_flags.into_iter() {
+    for flag in deprecated_flags.iter() {
         if matches.opt_present(flag) {
             let mut err = diag.struct_warn(&format!("the '{}' flag is considered deprecated",
                                                     flag));
index 428f4f328b907987356c418a09511b582e205c3b..2a3bc5e99617f468375a834110a7e7cf45e431ed 100644 (file)
@@ -143,7 +143,7 @@ pub fn next_def_id(&self, crate_num: CrateNum) -> DefId {
             crate_num,
             DefId {
                 krate: crate_num,
-                index: DefIndex::from_array_index(def_id.index.as_array_index() + 1),
+                index: DefIndex::from(def_id.index.index() + 1),
             },
         );
 
index 0378b12662da26fa5fd6ee525f7ae5d8b244d18a..d604ba11d41860fd39f0b70d56dd6051a9bb9424 100644 (file)
@@ -3,6 +3,7 @@
 use std::str;
 use errors;
 use crate::syntax::feature_gate::UnstableFeatures;
+use crate::syntax::edition::Edition;
 use crate::html::markdown::{IdMap, ErrorCodes, Markdown};
 
 use std::cell::RefCell;
@@ -23,7 +24,7 @@ pub struct ExternalHtml {
 impl ExternalHtml {
     pub fn load(in_header: &[String], before_content: &[String], after_content: &[String],
                 md_before_content: &[String], md_after_content: &[String], diag: &errors::Handler,
-                id_map: &mut IdMap)
+                id_map: &mut IdMap, edition: Edition)
             -> Option<ExternalHtml> {
         let codes = ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build());
         load_external_files(in_header, diag)
@@ -34,7 +35,8 @@ pub fn load(in_header: &[String], before_content: &[String], after_content: &[St
             .and_then(|(ih, bc)|
                 load_external_files(md_before_content, diag)
                     .map(|m_bc| (ih,
-                            format!("{}{}", bc, Markdown(&m_bc, &[], RefCell::new(id_map), codes))))
+                            format!("{}{}", bc, Markdown(&m_bc, &[], RefCell::new(id_map),
+                                    codes, edition))))
             )
             .and_then(|(ih, bc)|
                 load_external_files(after_content, diag)
@@ -43,7 +45,8 @@ pub fn load(in_header: &[String], before_content: &[String], after_content: &[St
             .and_then(|(ih, bc, ac)|
                 load_external_files(md_after_content, diag)
                     .map(|m_ac| (ih, bc,
-                            format!("{}{}", ac, Markdown(&m_ac, &[], RefCell::new(id_map), codes))))
+                            format!("{}{}", ac, Markdown(&m_ac, &[], RefCell::new(id_map),
+                                    codes, edition))))
             )
             .map(|(ih, bc, ac)|
                 ExternalHtml {
index 3d8af7c7716b1475439bd40ba3252c09d6ccdb3e..2784d5b3e10a0bbf85e5c46e9ea56afe54131c06 100644 (file)
@@ -262,9 +262,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 
 impl fmt::Display for clean::Constant {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        fmt::Display::fmt(&self.expr, f)?;
-        f.write_str(": ")?;
-        fmt::Display::fmt(&self.type_, f)
+        fmt::Display::fmt(&self.expr, f)
     }
 }
 
index acf019fd2254dfd52bf7804a66a708bfec525845..ae0bd1aafa8f159393fce8482bc54eb47e314e27 100644 (file)
@@ -182,14 +182,14 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
         let p = SlashChecker(&p);
         if layout.logo.is_empty() {
             format!("<a href='{path}index.html'>\
-                     <img src='{static_root_path}rust-logo{suffix}.png' \
-                          alt='logo' width='100'></a>",
+                     <div class='logo-container'>\
+                     <img src='{static_root_path}rust-logo{suffix}.png' alt='logo'></div></a>",
                     path=p,
                     static_root_path=static_root_path,
                     suffix=page.resource_suffix)
         } else {
             format!("<a href='{}index.html'>\
-                     <img src='{}' alt='logo' width='100'></a>",
+                     <div class='logo-container'><img src='{}' alt='logo'></div></a>",
                     p,
                     layout.logo)
         }
index a3b041c6954c58b7c93eb524971652b1d7781952..12d10254c4d09ecf7574ca63ed0d75643dd7c393 100644 (file)
@@ -8,12 +8,16 @@
 //! ```
 //! #![feature(rustc_private)]
 //!
+//! extern crate syntax;
+//!
+//! use syntax::edition::Edition;
 //! use rustdoc::html::markdown::{IdMap, Markdown, ErrorCodes};
 //! use std::cell::RefCell;
 //!
 //! let s = "My *markdown* _text_";
 //! let mut id_map = IdMap::new();
-//! let html = format!("{}", Markdown(s, &[], RefCell::new(&mut id_map), ErrorCodes::Yes));
+//! let html = format!("{}", Markdown(s, &[], RefCell::new(&mut id_map),
+//!                                   ErrorCodes::Yes, Edition::Edition2015));
 //! // ... something using html
 //! ```
 
@@ -42,14 +46,21 @@ fn opts() -> Options {
 /// A unit struct which has the `fmt::Display` trait implemented. When
 /// formatted, this struct will emit the HTML corresponding to the rendered
 /// version of the contained markdown string.
-/// The second parameter is a list of link replacements
+///
+/// The second parameter is a list of link replacements.
+///
+/// The third is the current list of used header IDs.
+///
+/// The fourth is whether to allow the use of explicit error codes in doctest lang strings.
+///
+/// The fifth is what default edition to use when parsing doctests (to add a `fn main`).
 pub struct Markdown<'a>(
-    pub &'a str, pub &'a [(String, String)], pub RefCell<&'a mut IdMap>, pub ErrorCodes);
+    pub &'a str, pub &'a [(String, String)], pub RefCell<&'a mut IdMap>, pub ErrorCodes, pub Edition);
 /// A unit struct like `Markdown`, that renders the markdown with a
 /// table of contents.
-pub struct MarkdownWithToc<'a>(pub &'a str, pub RefCell<&'a mut IdMap>, pub ErrorCodes);
+pub struct MarkdownWithToc<'a>(pub &'a str, pub RefCell<&'a mut IdMap>, pub ErrorCodes, pub Edition);
 /// A unit struct like `Markdown`, that renders the markdown escaping HTML tags.
-pub struct MarkdownHtml<'a>(pub &'a str, pub RefCell<&'a mut IdMap>, pub ErrorCodes);
+pub struct MarkdownHtml<'a>(pub &'a str, pub RefCell<&'a mut IdMap>, pub ErrorCodes, pub Edition);
 /// A unit struct like `Markdown`, that renders only the first paragraph.
 pub struct MarkdownSummaryLine<'a>(pub &'a str, pub &'a [(String, String)]);
 
@@ -146,13 +157,15 @@ fn slugify(c: char) -> Option<char> {
 struct CodeBlocks<'a, I: Iterator<Item = Event<'a>>> {
     inner: I,
     check_error_codes: ErrorCodes,
+    edition: Edition,
 }
 
 impl<'a, I: Iterator<Item = Event<'a>>> CodeBlocks<'a, I> {
-    fn new(iter: I, error_codes: ErrorCodes) -> Self {
+    fn new(iter: I, error_codes: ErrorCodes, edition: Edition) -> Self {
         CodeBlocks {
             inner: iter,
             check_error_codes: error_codes,
+            edition,
         }
     }
 }
@@ -177,6 +190,9 @@ fn next(&mut self) -> Option<Self::Item> {
             return event;
         }
 
+        let explicit_edition = edition.is_some();
+        let edition = edition.unwrap_or(self.edition);
+
         let mut origtext = String::new();
         for event in &mut self.inner {
             match event {
@@ -202,22 +218,14 @@ fn next(&mut self) -> Option<Self::Item> {
                     .collect::<Vec<Cow<'_, str>>>().join("\n");
                 let krate = krate.as_ref().map(|s| &**s);
                 let (test, _) = test::make_test(&test, krate, false,
-                                           &Default::default());
+                                           &Default::default(), edition);
                 let channel = if test.contains("#![feature(") {
                     "&amp;version=nightly"
                 } else {
                     ""
                 };
 
-                let edition_string = if let Some(e @ Edition::Edition2018) = edition {
-                    format!("&amp;edition={}{}", e,
-                            if channel == "&amp;version=nightly" { "" }
-                            else { "&amp;version=nightly" })
-                } else if let Some(e) = edition {
-                    format!("&amp;edition={}", e)
-                } else {
-                    "".to_owned()
-                };
+                let edition_string = format!("&amp;edition={}", edition);
 
                 // These characters don't need to be escaped in a URI.
                 // FIXME: use a library function for percent encoding.
@@ -247,8 +255,8 @@ fn dont_escape(c: u8) -> bool {
                 Some(("This example is not tested".to_owned(), "ignore"))
             } else if compile_fail {
                 Some(("This example deliberately fails to compile".to_owned(), "compile_fail"))
-            } else if let Some(e) = edition {
-                Some((format!("This code runs with edition {}", e), "edition"))
+            } else if explicit_edition {
+                Some((format!("This code runs with edition {}", edition), "edition"))
             } else {
                 None
             };
@@ -259,7 +267,7 @@ fn dont_escape(c: u8) -> bool {
                     Some(&format!("rust-example-rendered{}",
                                   if ignore { " ignore" }
                                   else if compile_fail { " compile_fail" }
-                                  else if edition.is_some() { " edition " }
+                                  else if explicit_edition { " edition " }
                                   else { "" })),
                     playground_button.as_ref().map(String::as_str),
                     Some((s1.as_str(), s2))));
@@ -270,7 +278,7 @@ fn dont_escape(c: u8) -> bool {
                     Some(&format!("rust-example-rendered{}",
                                   if ignore { " ignore" }
                                   else if compile_fail { " compile_fail" }
-                                  else if edition.is_some() { " edition " }
+                                  else if explicit_edition { " edition " }
                                   else { "" })),
                     playground_button.as_ref().map(String::as_str),
                     None));
@@ -659,7 +667,7 @@ fn parse(string: &str, allow_error_code_check: ErrorCodes) -> LangString {
 
 impl<'a> fmt::Display for Markdown<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
-        let Markdown(md, links, ref ids, codes) = *self;
+        let Markdown(md, links, ref ids, codes, edition) = *self;
         let mut ids = ids.borrow_mut();
 
         // This is actually common enough to special-case
@@ -678,7 +686,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
 
         let p = HeadingLinks::new(p, None, &mut ids);
         let p = LinkReplacer::new(p, links);
-        let p = CodeBlocks::new(p, codes);
+        let p = CodeBlocks::new(p, codes, edition);
         let p = Footnotes::new(p);
         html::push_html(&mut s, p);
 
@@ -688,7 +696,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
 
 impl<'a> fmt::Display for MarkdownWithToc<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
-        let MarkdownWithToc(md, ref ids, codes) = *self;
+        let MarkdownWithToc(md, ref ids, codes, edition) = *self;
         let mut ids = ids.borrow_mut();
 
         let p = Parser::new_ext(md, opts());
@@ -699,7 +707,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
 
         {
             let p = HeadingLinks::new(p, Some(&mut toc), &mut ids);
-            let p = CodeBlocks::new(p, codes);
+            let p = CodeBlocks::new(p, codes, edition);
             let p = Footnotes::new(p);
             html::push_html(&mut s, p);
         }
@@ -712,7 +720,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
 
 impl<'a> fmt::Display for MarkdownHtml<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
-        let MarkdownHtml(md, ref ids, codes) = *self;
+        let MarkdownHtml(md, ref ids, codes, edition) = *self;
         let mut ids = ids.borrow_mut();
 
         // This is actually common enough to special-case
@@ -728,7 +736,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         let mut s = String::with_capacity(md.len() * 3 / 2);
 
         let p = HeadingLinks::new(p, None, &mut ids);
-        let p = CodeBlocks::new(p, codes);
+        let p = CodeBlocks::new(p, codes, edition);
         let p = Footnotes::new(p);
         html::push_html(&mut s, p);
 
@@ -1046,7 +1054,7 @@ mod tests {
     use super::{ErrorCodes, LangString, Markdown, MarkdownHtml, IdMap};
     use super::plain_summary_line;
     use std::cell::RefCell;
-    use syntax::edition::Edition;
+    use syntax::edition::{Edition, DEFAULT_EDITION};
 
     #[test]
     fn test_lang_string_parse() {
@@ -1098,7 +1106,8 @@ fn v() -> Vec<String> {
     fn test_header() {
         fn t(input: &str, expect: &str) {
             let mut map = IdMap::new();
-            let output = Markdown(input, &[], RefCell::new(&mut map), ErrorCodes::Yes).to_string();
+            let output = Markdown(input, &[], RefCell::new(&mut map),
+                                  ErrorCodes::Yes, DEFAULT_EDITION).to_string();
             assert_eq!(output, expect, "original: {}", input);
         }
 
@@ -1120,7 +1129,8 @@ fn t(input: &str, expect: &str) {
     fn test_header_ids_multiple_blocks() {
         let mut map = IdMap::new();
         fn t(map: &mut IdMap, input: &str, expect: &str) {
-            let output = Markdown(input, &[], RefCell::new(map), ErrorCodes::Yes).to_string();
+            let output = Markdown(input, &[], RefCell::new(map),
+                                  ErrorCodes::Yes, DEFAULT_EDITION).to_string();
             assert_eq!(output, expect, "original: {}", input);
         }
 
@@ -1157,7 +1167,8 @@ fn t(input: &str, expect: &str) {
     fn test_markdown_html_escape() {
         fn t(input: &str, expect: &str) {
             let mut idmap = IdMap::new();
-            let output = MarkdownHtml(input, RefCell::new(&mut idmap), ErrorCodes::Yes).to_string();
+            let output = MarkdownHtml(input, RefCell::new(&mut idmap),
+                                      ErrorCodes::Yes, DEFAULT_EDITION).to_string();
             assert_eq!(output, expect, "original: {}", input);
         }
 
index 0207fcda9e880ea6525550ae6b8f3d8a176ca0b3..b628bd450d314b8a690dea5e0beae786db59a0ef 100644 (file)
@@ -47,6 +47,7 @@
 use errors;
 use serialize::json::{ToJson, Json, as_json};
 use syntax::ast;
+use syntax::edition::Edition;
 use syntax::ext::base::MacroKind;
 use syntax::source_map::FileName;
 use syntax::feature_gate::UnstableFeatures;
@@ -108,6 +109,8 @@ struct Context {
     /// publicly reused items to redirect to the right location.
     pub render_redirect_pages: bool,
     pub codes: ErrorCodes,
+    /// The default edition used to parse doctests.
+    pub edition: Edition,
     /// The map used to ensure all generated 'id=' attributes are unique.
     id_map: Rc<RefCell<IdMap>>,
     pub shared: Arc<SharedContext>,
@@ -506,7 +509,7 @@ pub fn initial_ids() -> Vec<String> {
      "methods",
      "deref-methods",
      "implementations",
-    ].into_iter().map(|id| (String::from(*id))).collect()
+    ].iter().map(|id| (String::from(*id))).collect()
 }
 
 /// Generates the documentation for `crate` into the directory `dst`
@@ -514,7 +517,8 @@ pub fn run(mut krate: clean::Crate,
            options: RenderOptions,
            passes: FxHashSet<String>,
            renderinfo: RenderInfo,
-           diag: &errors::Handler) -> Result<(), Error> {
+           diag: &errors::Handler,
+           edition: Edition) -> Result<(), Error> {
     // need to save a copy of the options for rendering the index page
     let md_opts = options.clone();
     let RenderOptions {
@@ -604,6 +608,7 @@ pub fn run(mut krate: clean::Crate,
         dst,
         render_redirect_pages: false,
         codes: ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build()),
+        edition,
         id_map: Rc::new(RefCell::new(id_map)),
         shared: Arc::new(scx),
     };
@@ -1128,7 +1133,7 @@ fn to_json_string(&self) -> String {
             md_opts.output = cx.dst.clone();
             md_opts.external_html = (*cx.shared).layout.external_html.clone();
 
-            crate::markdown::render(index_page, md_opts, diag);
+            crate::markdown::render(index_page, md_opts, diag, cx.edition);
         } else {
             let dst = cx.dst.join("index.html");
             let mut w = BufWriter::new(try_err!(File::create(&dst), &dst));
@@ -2553,7 +2558,7 @@ fn render_markdown(w: &mut fmt::Formatter<'_>,
            if is_hidden { " hidden" } else { "" },
            prefix,
            Markdown(md_text, &links, RefCell::new(&mut ids),
-           cx.codes))
+           cx.codes, cx.edition))
 }
 
 fn document_short(
@@ -2918,7 +2923,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
 
         if let Some(note) = note {
             let mut ids = cx.id_map.borrow_mut();
-            let html = MarkdownHtml(&note, RefCell::new(&mut ids), error_codes);
+            let html = MarkdownHtml(&note, RefCell::new(&mut ids), error_codes, cx.edition);
             message.push_str(&format!(": {}", html));
         }
         stability.push(format!("<div class='stab deprecated'>{}</div>", message));
@@ -2967,7 +2972,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
             message = format!(
                 "<details><summary>{}</summary>{}</details>",
                 message,
-                MarkdownHtml(&unstable_reason, RefCell::new(&mut ids), error_codes)
+                MarkdownHtml(&unstable_reason, RefCell::new(&mut ids), error_codes, cx.edition)
             );
         }
 
@@ -2992,7 +2997,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
 fn item_constant(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
                  c: &clean::Constant) -> fmt::Result {
     write!(w, "<pre class='rust const'>")?;
-    render_attributes(w, it)?;
+    render_attributes(w, it, false)?;
     write!(w, "{vis}const \
                {name}: {typ}</pre>",
            vis = VisSpace(&it.visibility),
@@ -3004,7 +3009,7 @@ fn item_constant(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
 fn item_static(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
                s: &clean::Static) -> fmt::Result {
     write!(w, "<pre class='rust static'>")?;
-    render_attributes(w, it)?;
+    render_attributes(w, it, false)?;
     write!(w, "{vis}static {mutability}\
                {name}: {typ}</pre>",
            vis = VisSpace(&it.visibility),
@@ -3027,7 +3032,7 @@ fn item_function(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
         f.generics
     ).len();
     write!(w, "{}<pre class='rust fn'>", render_spotlight_traits(it)?)?;
-    render_attributes(w, it)?;
+    render_attributes(w, it, false)?;
     write!(w,
            "{vis}{constness}{unsafety}{asyncness}{abi}fn \
            {name}{generics}{decl}{where_clause}</pre>",
@@ -3116,7 +3121,7 @@ fn item_trait(
     // Output the trait definition
     wrap_into_docblock(w, |w| {
         write!(w, "<pre class='rust trait'>")?;
-        render_attributes(w, it)?;
+        render_attributes(w, it, true)?;
         write!(w, "{}{}{}trait {}{}{}",
                VisSpace(&it.visibility),
                UnsafetySpace(t.unsafety),
@@ -3379,8 +3384,10 @@ fn assoc_const(w: &mut fmt::Formatter<'_>,
                it: &clean::Item,
                ty: &clean::Type,
                _default: Option<&String>,
-               link: AssocItemLink<'_>) -> fmt::Result {
-    write!(w, "{}const <a href='{}' class=\"constant\"><b>{}</b></a>: {}",
+               link: AssocItemLink<'_>,
+               extra: &str) -> fmt::Result {
+    write!(w, "{}{}const <a href='{}' class=\"constant\"><b>{}</b></a>: {}",
+           extra,
            VisSpace(&it.visibility),
            naive_assoc_href(it, link),
            it.name.as_ref().unwrap(),
@@ -3391,8 +3398,10 @@ fn assoc_const(w: &mut fmt::Formatter<'_>,
 fn assoc_type<W: fmt::Write>(w: &mut W, it: &clean::Item,
                              bounds: &[clean::GenericBound],
                              default: Option<&clean::Type>,
-                             link: AssocItemLink<'_>) -> fmt::Result {
-    write!(w, "type <a href='{}' class=\"type\">{}</a>",
+                             link: AssocItemLink<'_>,
+                             extra: &str) -> fmt::Result {
+    write!(w, "{}type <a href='{}' class=\"type\">{}</a>",
+           extra,
            naive_assoc_href(it, link),
            it.name.as_ref().unwrap())?;
     if !bounds.is_empty() {
@@ -3469,7 +3478,7 @@ fn method(w: &mut fmt::Formatter<'_>,
         } else {
             (0, true)
         };
-        render_attributes(w, meth)?;
+        render_attributes(w, meth, false)?;
         write!(w, "{}{}{}{}{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\
                    {generics}{decl}{where_clause}",
                if parent == ItemType::Trait { "    " } else { "" },
@@ -3503,10 +3512,12 @@ fn method(w: &mut fmt::Formatter<'_>,
             method(w, item, m.header, &m.generics, &m.decl, link, parent)
         }
         clean::AssociatedConstItem(ref ty, ref default) => {
-            assoc_const(w, item, ty, default.as_ref(), link)
+            assoc_const(w, item, ty, default.as_ref(), link,
+                        if parent == ItemType::Trait { "    " } else { "" })
         }
         clean::AssociatedTypeItem(ref bounds, ref default) => {
-            assoc_type(w, item, bounds, default.as_ref(), link)
+            assoc_type(w, item, bounds, default.as_ref(), link,
+                       if parent == ItemType::Trait { "    " } else { "" })
         }
         _ => panic!("render_assoc_item called on non-associated-item")
     }
@@ -3516,7 +3527,7 @@ fn item_struct(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
                s: &clean::Struct) -> fmt::Result {
     wrap_into_docblock(w, |w| {
         write!(w, "<pre class='rust struct'>")?;
-        render_attributes(w, it)?;
+        render_attributes(w, it, true)?;
         render_struct(w,
                       it,
                       Some(&s.generics),
@@ -3567,7 +3578,7 @@ fn item_union(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
                s: &clean::Union) -> fmt::Result {
     wrap_into_docblock(w, |w| {
         write!(w, "<pre class='rust union'>")?;
-        render_attributes(w, it)?;
+        render_attributes(w, it, true)?;
         render_union(w,
                      it,
                      Some(&s.generics),
@@ -3612,7 +3623,7 @@ fn item_enum(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
              e: &clean::Enum) -> fmt::Result {
     wrap_into_docblock(w, |w| {
         write!(w, "<pre class='rust enum'>")?;
-        render_attributes(w, it)?;
+        render_attributes(w, it, true)?;
         write!(w, "{}enum {}{}{}",
                VisSpace(&it.visibility),
                it.name.as_ref().unwrap(),
@@ -3773,7 +3784,15 @@ fn render_attribute(attr: &ast::MetaItem) -> Option<String> {
     sym::non_exhaustive
 ];
 
-fn render_attributes(w: &mut dyn fmt::Write, it: &clean::Item) -> fmt::Result {
+// The `top` parameter is used when generating the item declaration to ensure it doesn't have a
+// left padding. For example:
+//
+// #[foo] <----- "top" attribute
+// struct Foo {
+//     #[bar] <---- not "top" attribute
+//     bar: usize,
+// }
+fn render_attributes(w: &mut dyn fmt::Write, it: &clean::Item, top: bool) -> fmt::Result {
     let mut attrs = String::new();
 
     for attr in &it.attrs.other_attrs {
@@ -3785,7 +3804,8 @@ fn render_attributes(w: &mut dyn fmt::Write, it: &clean::Item) -> fmt::Result {
         }
     }
     if attrs.len() > 0 {
-        write!(w, "<div class=\"docblock attributes\">{}</div>", &attrs)?;
+        write!(w, "<div class=\"docblock attributes{}\">{}</div>",
+               if top { " top-attr" } else { "" }, &attrs)?;
     }
     Ok(())
 }
@@ -4118,7 +4138,8 @@ fn spotlight_decl(decl: &clean::FnDecl) -> Result<String, fmt::Error> {
                             out.push_str("<span class=\"where fmt-newline\">    ");
                             assoc_type(&mut out, it, &[],
                                        Some(&tydef.type_),
-                                       AssocItemLink::GotoSource(t_did, &FxHashSet::default()))?;
+                                       AssocItemLink::GotoSource(t_did, &FxHashSet::default()),
+                                       "")?;
                             out.push_str(";</span>");
                         }
                     }
@@ -4158,7 +4179,8 @@ fn render_impl(w: &mut fmt::Formatter<'_>, cx: &Context, i: &Impl, link: AssocIt
                     if let clean::TypedefItem(ref tydef, _) = it.inner {
                         write!(w, "<span class=\"where fmt-newline\">  ")?;
                         assoc_type(w, it, &vec![], Some(&tydef.type_),
-                                   AssocItemLink::Anchor(None))?;
+                                   AssocItemLink::Anchor(None),
+                                   "")?;
                         write!(w, ";</span>")?;
                     }
                 }
@@ -4180,7 +4202,8 @@ fn render_impl(w: &mut fmt::Formatter<'_>, cx: &Context, i: &Impl, link: AssocIt
         if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
             let mut ids = cx.id_map.borrow_mut();
             write!(w, "<div class='docblock'>{}</div>",
-                   Markdown(&*dox, &i.impl_item.links(), RefCell::new(&mut ids), cx.codes))?;
+                   Markdown(&*dox, &i.impl_item.links(), RefCell::new(&mut ids),
+                            cx.codes, cx.edition))?;
         }
     }
 
@@ -4228,7 +4251,7 @@ fn doc_impl_item(w: &mut fmt::Formatter<'_>, cx: &Context, item: &clean::Item,
                 let ns_id = cx.derive_id(format!("{}.{}", name, item_type.name_space()));
                 write!(w, "<h4 id='{}' class=\"{}{}\">", id, item_type, extra_class)?;
                 write!(w, "<code id='{}'>", ns_id)?;
-                assoc_type(w, item, &Vec::new(), Some(&tydef.type_), link.anchor(&id))?;
+                assoc_type(w, item, &Vec::new(), Some(&tydef.type_), link.anchor(&id), "")?;
                 write!(w, "</code></h4>")?;
             }
             clean::AssociatedConstItem(ref ty, ref default) => {
@@ -4236,7 +4259,7 @@ fn doc_impl_item(w: &mut fmt::Formatter<'_>, cx: &Context, item: &clean::Item,
                 let ns_id = cx.derive_id(format!("{}.{}", name, item_type.name_space()));
                 write!(w, "<h4 id='{}' class=\"{}{}\">", id, item_type, extra_class)?;
                 write!(w, "<code id='{}'>", ns_id)?;
-                assoc_const(w, item, ty, default.as_ref(), link.anchor(&id))?;
+                assoc_const(w, item, ty, default.as_ref(), link.anchor(&id), "")?;
                 write!(w, "</code>")?;
                 render_stability_since_raw(w, item.stable_since(), outer_version)?;
                 if let Some(l) = (Item { cx, item }).src_href() {
@@ -4250,7 +4273,7 @@ fn doc_impl_item(w: &mut fmt::Formatter<'_>, cx: &Context, item: &clean::Item,
                 let ns_id = cx.derive_id(format!("{}.{}", name, item_type.name_space()));
                 write!(w, "<h4 id='{}' class=\"{}{}\">", id, item_type, extra_class)?;
                 write!(w, "<code id='{}'>", ns_id)?;
-                assoc_type(w, item, bounds, default.as_ref(), link.anchor(&id))?;
+                assoc_type(w, item, bounds, default.as_ref(), link.anchor(&id), "")?;
                 write!(w, "</code></h4>")?;
             }
             clean::StrippedItem(..) => return Ok(()),
@@ -4338,7 +4361,7 @@ fn item_existential(
     t: &clean::Existential,
 ) -> fmt::Result {
     write!(w, "<pre class='rust existential'>")?;
-    render_attributes(w, it)?;
+    render_attributes(w, it, false)?;
     write!(w, "existential type {}{}{where_clause}: {bounds};</pre>",
            it.name.as_ref().unwrap(),
            t.generics,
@@ -4357,7 +4380,7 @@ fn item_existential(
 fn item_trait_alias(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
                     t: &clean::TraitAlias) -> fmt::Result {
     write!(w, "<pre class='rust trait-alias'>")?;
-    render_attributes(w, it)?;
+    render_attributes(w, it, false)?;
     write!(w, "trait {}{}{} = {};</pre>",
            it.name.as_ref().unwrap(),
            t.generics,
@@ -4376,7 +4399,7 @@ fn item_trait_alias(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
 fn item_typedef(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
                 t: &clean::Typedef) -> fmt::Result {
     write!(w, "<pre class='rust typedef'>")?;
-    render_attributes(w, it)?;
+    render_attributes(w, it, false)?;
     write!(w, "type {}{}{where_clause} = {type_};</pre>",
            it.name.as_ref().unwrap(),
            t.generics,
@@ -4394,7 +4417,7 @@ fn item_typedef(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
 
 fn item_foreign_type(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item) -> fmt::Result {
     writeln!(w, "<pre class='rust foreigntype'>extern {{")?;
-    render_attributes(w, it)?;
+    render_attributes(w, it, false)?;
     write!(
         w,
         "    {}type {};\n}}</pre>",
index 85ab0855f05e9511de9bbead3d194429f9b37c00..72a01a49bc66dc2d8ddaf1cda6195062f2bea2eb 100644 (file)
@@ -2325,7 +2325,11 @@ if (!DOMTokenList.prototype.remove) {
     }
     var attributesToggle = createToggleWrapper(createSimpleToggle(false));
     onEachLazy(main.getElementsByClassName("attributes"), function(i_e) {
-        i_e.parentNode.insertBefore(attributesToggle.cloneNode(true), i_e);
+        var attr_tog = attributesToggle.cloneNode(true);
+        if (hasClass(i_e, "top-attr") === true) {
+            addClass(attr_tog, "top-attr");
+        }
+        i_e.parentNode.insertBefore(attr_tog, i_e);
         itemAttributesFunc(i_e);
     });
 
index 880b824335517a63f76f98104c66836d1b62a110..0493bf7c5c0f51c9045f89337db911f0c1a2d0a6 100644 (file)
@@ -182,12 +182,25 @@ nav.sub {
        display: none !important;
 }
 
-.sidebar img {
+.logo-container {
+       height: 100px;
+       width: 100px;
+       position: relative;
        margin: 20px auto;
        display: block;
        margin-top: 10px;
 }
 
+.logo-container > img {
+       max-width: 100px;
+       max-height: 100px;
+       position: absolute;
+       left: 50%;
+       top: 50%;
+       transform: translate(-50%, -50%);
+       display: block;
+}
+
 .sidebar .location {
        border: 1px solid;
        font-size: 17px;
@@ -658,18 +671,18 @@ a {
        transition: border-color 300ms ease;
        transition: border-radius 300ms ease-in-out;
        transition: box-shadow 300ms ease-in-out;
-       width: calc(100% - 32px);
+       width: 100%;
 }
 
 #crate-search + .search-input {
        border-radius: 0 1px 1px 0;
+       width: calc(100% - 32px);
 }
 
 .search-input:focus {
        border-radius: 2px;
        border: 0;
        outline: 0;
-       box-shadow: 0 0 8px #078dd8;
 }
 
 .search-results .desc {
@@ -998,6 +1011,195 @@ h3 > .collapse-toggle, h4 > .collapse-toggle {
        opacity: 1;
 }
 
+.information {
+       position: absolute;
+       left: -20px;
+       margin-top: 7px;
+       z-index: 1;
+}
+
+.tooltip {
+       position: relative;
+       display: inline-block;
+       cursor: pointer;
+}
+
+.tooltip .tooltiptext {
+       width: 120px;
+       display: none;
+       text-align: center;
+       padding: 5px 3px;
+       border-radius: 6px;
+       margin-left: 5px;
+       top: -5px;
+       left: 105%;
+       z-index: 10;
+}
+
+.tooltip:hover .tooltiptext {
+       display: inline;
+}
+
+.tooltip .tooltiptext::after {
+       content: " ";
+       position: absolute;
+       top: 50%;
+       left: 11px;
+       margin-top: -5px;
+       border-width: 5px;
+       border-style: solid;
+}
+
+.important-traits .tooltip .tooltiptext {
+       border: 1px solid;
+}
+
+pre.rust {
+       position: relative;
+       tab-width: 4;
+       -moz-tab-width: 4;
+}
+
+.search-failed {
+       text-align: center;
+       margin-top: 20px;
+}
+
+.search-failed > ul {
+       text-align: left;
+       max-width: 570px;
+       margin-left: auto;
+       margin-right: auto;
+}
+
+#titles {
+       height: 35px;
+}
+
+#titles > div {
+       float: left;
+       width: 33.3%;
+       text-align: center;
+       font-size: 18px;
+       cursor: pointer;
+       border-top: 2px solid;
+}
+
+#titles > div:not(:last-child) {
+       margin-right: 1px;
+       width: calc(33.3% - 1px);
+}
+
+#titles > div > div.count {
+       display: inline-block;
+       font-size: 16px;
+}
+
+.important-traits {
+       cursor: pointer;
+       z-index: 2;
+}
+
+h4 > .important-traits {
+       position: absolute;
+       left: -44px;
+       top: 2px;
+}
+
+#all-types {
+       text-align: center;
+       border: 1px solid;
+       margin: 0 10px;
+       margin-bottom: 10px;
+       display: block;
+       border-radius: 7px;
+}
+#all-types > p {
+       margin: 5px 0;
+}
+
+#sidebar-toggle {
+       position: fixed;
+       top: 30px;
+       left: 300px;
+       z-index: 10;
+       padding: 3px;
+       border-top-right-radius: 3px;
+       border-bottom-right-radius: 3px;
+       cursor: pointer;
+       font-weight: bold;
+       transition: left .5s;
+       font-size: 1.2em;
+       border: 1px solid;
+       border-left: 0;
+}
+#source-sidebar {
+       position: fixed;
+       top: 0;
+       bottom: 0;
+       left: 0;
+       width: 300px;
+       z-index: 1;
+       overflow: auto;
+       transition: left .5s;
+       border-right: 1px solid;
+}
+#source-sidebar > .title {
+       font-size: 1.5em;
+       text-align: center;
+       border-bottom: 1px solid;
+       margin-bottom: 6px;
+}
+
+.theme-picker {
+       position: absolute;
+       left: 211px;
+       top: 19px;
+}
+
+.theme-picker button {
+       outline: none;
+}
+
+#settings-menu {
+       position: absolute;
+       right: 0;
+       top: 10px;
+       outline: none;
+}
+
+#theme-picker, #settings-menu {
+       padding: 4px;
+       width: 27px;
+       height: 29px;
+       border: 1px solid;
+       border-radius: 3px;
+       cursor: pointer;
+}
+
+#theme-choices {
+       display: none;
+       position: absolute;
+       left: 0;
+       top: 28px;
+       border: 1px solid;
+       border-radius: 3px;
+       z-index: 1;
+       cursor: pointer;
+}
+
+#theme-choices > button {
+       border: none;
+       width: 100%;
+       padding: 4px;
+       text-align: center;
+       background: rgba(0,0,0,0);
+}
+
+#theme-choices > button:not(:first-child) {
+       border-top: 1px solid;
+}
+
 /* Media Queries */
 
 @media (max-width: 700px) {
@@ -1030,14 +1232,20 @@ h3 > .collapse-toggle, h4 > .collapse-toggle {
                padding: 0;
        }
 
-       .sidebar img {
+       .sidebar .logo-container {
                width: 35px;
+               height: 35px;
                margin-top: 5px;
                margin-bottom: 5px;
                float: left;
                margin-left: 50px;
        }
 
+       .sidebar .logo-container > img {
+               max-width: 35px;
+               max-height: 35px;
+       }
+
        .sidebar-menu {
                position: fixed;
                z-index: 10;
@@ -1118,125 +1326,12 @@ h3 > .collapse-toggle, h4 > .collapse-toggle {
                overflow: initial;
        }
 
-       #main > .line-numbers {
-               margin-top: 0;
-       }
-}
-
-@media print {
-       nav.sub, .content .out-of-band, .collapse-toggle {
-               display: none;
+       .theme-picker {
+               left: 10px;
+               top: 54px;
+               z-index: 1;
        }
-}
 
-.information {
-       position: absolute;
-       left: -20px;
-       margin-top: 7px;
-       z-index: 1;
-}
-
-.tooltip {
-       position: relative;
-       display: inline-block;
-       cursor: pointer;
-}
-
-.tooltip .tooltiptext {
-       width: 120px;
-       display: none;
-       text-align: center;
-       padding: 5px 3px;
-       border-radius: 6px;
-       margin-left: 5px;
-       top: -5px;
-       left: 105%;
-       z-index: 10;
-}
-
-.tooltip:hover .tooltiptext {
-       display: inline;
-}
-
-.tooltip .tooltiptext::after {
-       content: " ";
-       position: absolute;
-       top: 50%;
-       left: 11px;
-       margin-top: -5px;
-       border-width: 5px;
-       border-style: solid;
-}
-
-.important-traits .tooltip .tooltiptext {
-       border: 1px solid;
-}
-
-pre.rust {
-       position: relative;
-       tab-width: 4;
-       -moz-tab-width: 4;
-}
-
-.search-failed {
-       text-align: center;
-       margin-top: 20px;
-}
-
-.search-failed > ul {
-       text-align: left;
-       max-width: 570px;
-       margin-left: auto;
-       margin-right: auto;
-}
-
-#titles {
-       height: 35px;
-}
-
-#titles > div {
-       float: left;
-       width: 33.3%;
-       text-align: center;
-       font-size: 18px;
-       cursor: pointer;
-       border-top: 2px solid;
-}
-
-#titles > div:not(:last-child) {
-       margin-right: 1px;
-       width: calc(33.3% - 1px);
-}
-
-#titles > div > div.count {
-       display: inline-block;
-       font-size: 16px;
-}
-
-.important-traits {
-       cursor: pointer;
-       z-index: 2;
-}
-
-h4 > .important-traits {
-       position: absolute;
-       left: -44px;
-       top: 2px;
-}
-
-#all-types {
-       text-align: center;
-       border: 1px solid;
-       margin: 0 10px;
-       margin-bottom: 10px;
-       display: block;
-       border-radius: 7px;
-}
-#all-types > p {
-       margin: 5px 0;
-}
-
-@media (max-width: 700px) {
        h4 > .important-traits {
                position: absolute;
                left: -22px;
@@ -1311,8 +1406,29 @@ h4 > .important-traits {
        #all-types {
                margin: 10px;
        }
+
+       #sidebar-toggle {
+               top: 100px;
+               width: 30px;
+               font-size: 1.5rem;
+               text-align: center;
+               padding: 0;
+       }
+
+       #source-sidebar {
+               z-index: 11;
+       }
+
+       #main > .line-numbers {
+               margin-top: 0;
+       }
 }
 
+@media print {
+       nav.sub, .content .out-of-band, .collapse-toggle {
+               display: none;
+       }
+}
 
 @media (max-width: 416px) {
        #titles {
@@ -1412,63 +1528,6 @@ kbd {
        cursor: default;
 }
 
-.theme-picker {
-       position: absolute;
-       left: 211px;
-       top: 19px;
-}
-
-.theme-picker button {
-       outline: none;
-}
-
-#settings-menu {
-       position: absolute;
-       right: 0;
-       top: 10px;
-       outline: none;
-}
-
-#theme-picker, #settings-menu {
-       padding: 4px;
-       width: 27px;
-       height: 29px;
-       border: 1px solid;
-       border-radius: 3px;
-       cursor: pointer;
-}
-
-#theme-choices {
-       display: none;
-       position: absolute;
-       left: 0;
-       top: 28px;
-       border: 1px solid;
-       border-radius: 3px;
-       z-index: 1;
-       cursor: pointer;
-}
-
-#theme-choices > button {
-       border: none;
-       width: 100%;
-       padding: 4px;
-       text-align: center;
-       background: rgba(0,0,0,0);
-}
-
-#theme-choices > button:not(:first-child) {
-       border-top: 1px solid;
-}
-
-@media (max-width: 700px) {
-       .theme-picker {
-               left: 10px;
-               top: 54px;
-               z-index: 1;
-       }
-}
-
 .hidden-by-impl-hider,
 .hidden-by-usual-hider {
        /* important because of conflicting rule for small screens */
@@ -1520,39 +1579,6 @@ kbd {
        margin-bottom: 1em;
 }
 
-#sidebar-toggle {
-       position: fixed;
-       top: 30px;
-       left: 300px;
-       z-index: 10;
-       padding: 3px;
-       border-top-right-radius: 3px;
-       border-bottom-right-radius: 3px;
-       cursor: pointer;
-       font-weight: bold;
-       transition: left .5s;
-       font-size: 1.2em;
-       border: 1px solid;
-       border-left: 0;
-}
-#source-sidebar {
-       position: fixed;
-       top: 0;
-       bottom: 0;
-       left: 0;
-       width: 300px;
-       z-index: 1;
-       overflow: auto;
-       transition: left .5s;
-       border-right: 1px solid;
-}
-#source-sidebar > .title {
-       font-size: 1.5em;
-       text-align: center;
-       border-bottom: 1px solid;
-       margin-bottom: 6px;
-}
-
 div.children {
        padding-left: 27px;
        display: none;
@@ -1587,10 +1613,10 @@ div.name.expand::before {
 }
 
 /* This part is to fix the "Expand attributes" part in the type declaration. */
-.type-decl > pre > :first-child {
+.type-decl > pre > .toggle-wrapper.toggle-attributes.top-attr {
        margin-left: 0 !important;
 }
-.type-decl > pre > :nth-child(2) {
+.type-decl > pre > .docblock.attributes.top-attr {
        margin-left: 1.8em !important;
 }
 .type-decl > pre > .toggle-attributes {
index f1255f52247376bd1e7f8285dd10bb695e33b592..e44ae2ad10cee286cba893f9ac63cffd2f96e6de 100644 (file)
@@ -164,20 +164,21 @@ a.test-arrow {
        color: #111;
        background-color: #f0f0f0;
        border-color: #000;
+       box-shadow: 0 0 0 1px #000, 0 0 0 2px transparent;
 }
 
 .search-input {
        color: #111;
-       box-shadow: 0 0 0 1px #000, 0 0 0 2px transparent;
        background-color: #f0f0f0;
+       box-shadow: 0 0 0 1px #000, 0 0 0 2px transparent;
 }
 
 .search-input:focus {
        border-color: #008dfd;
 }
 
-#crate-search + .search-input {
-       box-shadow: 1px 0 0 1px #000, 0 0 0 2px transparent;
+#crate-search + .search-input:focus {
+       box-shadow: 0 0 8px 4px #078dd8;
 }
 
 .module-item .stab {
index c052e6b37ade7a51e9ac9bfad44763811af9e74b..4c37000dde2c5e4f6840309b237eae17d85e0461 100644 (file)
@@ -164,21 +164,21 @@ a.test-arrow {
        color: #555;
        background-color: white;
        border-color: #e0e0e0;
-       box-shadow: 0px 0 0 1px #e0e0e0, 0 0 0 2px transparent;
+       box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent;
 }
 
 .search-input {
        color: #555;
-       box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent;
        background-color: white;
+       box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent;
 }
 
 .search-input:focus {
        border-color: #66afe9;
 }
 
-#crate-search + .search-input {
-       box-shadow: 1px 0 0 1px #e0e0e0, 0 0 0 2px transparent;
+#crate-search + .search-input:focus {
+       box-shadow: 0 0 8px #078dd8;
 }
 
 .module-item .stab {
index 5b76f6861de79b084739f850186c562626032695..ffe277ae50bdc39616b7230ba7b0f760f43712e1 100644 (file)
@@ -94,9 +94,7 @@ pub fn main() {
     rustc_driver::set_sigpipe_handler();
     env_logger::init();
     let res = std::thread::Builder::new().stack_size(thread_stack_size).spawn(move || {
-        rustc_interface::interface::default_thread_pool(move || {
-            get_args().map(|args| main_args(&args)).unwrap_or(1)
-        })
+        get_args().map(|args| main_args(&args)).unwrap_or(1)
     }).unwrap().join().unwrap_or(rustc_driver::EXIT_FAILURE);
     process::exit(res);
 }
@@ -382,7 +380,12 @@ fn main_args(args: &[String]) -> i32 {
         Ok(opts) => opts,
         Err(code) => return code,
     };
+    rustc_interface::interface::default_thread_pool(options.edition, move || {
+        main_options(options)
+    })
+}
 
+fn main_options(options: config::Options) -> i32 {
     let diag = core::new_handler(options.error_format,
                                  None,
                                  options.debugging_options.treat_err_as_bug,
@@ -391,7 +394,10 @@ fn main_args(args: &[String]) -> i32 {
     match (options.should_test, options.markdown_input()) {
         (true, true) => return markdown::test(options, &diag),
         (true, false) => return test::run(options),
-        (false, true) => return markdown::render(options.input, options.render_options, &diag),
+        (false, true) => return markdown::render(options.input,
+                                                 options.render_options,
+                                                 &diag,
+                                                 options.edition),
         (false, false) => {}
     }
 
@@ -399,7 +405,8 @@ fn main_args(args: &[String]) -> i32 {
     // but we can't crates the Handler ahead of time because it's not Send
     let diag_opts = (options.error_format,
                      options.debugging_options.treat_err_as_bug,
-                     options.debugging_options.ui_testing);
+                     options.debugging_options.ui_testing,
+                     options.edition);
     let show_coverage = options.show_coverage;
     rust_input(options, move |out| {
         if show_coverage {
@@ -410,7 +417,7 @@ fn main_args(args: &[String]) -> i32 {
 
         let Output { krate, passes, renderinfo, renderopts } = out;
         info!("going to format");
-        let (error_format, treat_err_as_bug, ui_testing) = diag_opts;
+        let (error_format, treat_err_as_bug, ui_testing, edition) = diag_opts;
         let diag = core::new_handler(error_format, None, treat_err_as_bug, ui_testing);
         match html::render::run(
             krate,
@@ -418,6 +425,7 @@ fn main_args(args: &[String]) -> i32 {
             passes.into_iter().collect(),
             renderinfo,
             &diag,
+            edition,
         ) {
             Ok(_) => rustc_driver::EXIT_SUCCESS,
             Err(e) => {
index c496dde8426c0fd8ba84bf64b8b43e0e5954fbe6..b0a37ea9c8081f50025fad2cfa5d50f5b0e80e1d 100644 (file)
@@ -5,6 +5,7 @@
 
 use errors;
 use testing;
+use syntax::edition::Edition;
 use syntax::source_map::DUMMY_SP;
 use syntax::feature_gate::UnstableFeatures;
 
@@ -36,7 +37,12 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
 
 /// Render `input` (e.g., "foo.md") into an HTML file in `output`
 /// (e.g., output = "bar" => "bar/foo.html").
-pub fn render(input: PathBuf, options: RenderOptions, diag: &errors::Handler) -> i32 {
+pub fn render(
+    input: PathBuf,
+    options: RenderOptions,
+    diag: &errors::Handler,
+    edition: Edition
+) -> i32 {
     let mut output = options.output;
     output.push(input.file_stem().unwrap());
     output.set_extension("html");
@@ -76,9 +82,9 @@ pub fn render(input: PathBuf, options: RenderOptions, diag: &errors::Handler) ->
     let mut ids = IdMap::new();
     let error_codes = ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build());
     let text = if !options.markdown_no_toc {
-        MarkdownWithToc(text, RefCell::new(&mut ids), error_codes).to_string()
+        MarkdownWithToc(text, RefCell::new(&mut ids), error_codes, edition).to_string()
     } else {
-        Markdown(text, &[], RefCell::new(&mut ids), error_codes).to_string()
+        Markdown(text, &[], RefCell::new(&mut ids), error_codes, edition).to_string()
     };
 
     let err = write!(
index 9e108e605c8bba9fc42a9f57cb2a22a519fe911d..2c382a1c1759632806bb316f621aa582564b9fe0 100644 (file)
@@ -321,7 +321,7 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
                         if let Ok(res) = self.resolve(path_str, ns, &current_item, parent_node) {
                             res
                         } else {
-                            resolution_failure(cx, &item.attrs, path_str, &dox, link_range);
+                            resolution_failure(cx, &item, path_str, &dox, link_range);
                             // This could just be a normal link or a broken link
                             // we could potentially check if something is
                             // "intra-doc-link-like" and warn in that case.
@@ -332,7 +332,7 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
                         if let Ok(res) = self.resolve(path_str, ns, &current_item, parent_node) {
                             res
                         } else {
-                            resolution_failure(cx, &item.attrs, path_str, &dox, link_range);
+                            resolution_failure(cx, &item, path_str, &dox, link_range);
                             // This could just be a normal link.
                             continue;
                         }
@@ -357,7 +357,7 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
                         };
 
                         if candidates.is_empty() {
-                            resolution_failure(cx, &item.attrs, path_str, &dox, link_range);
+                            resolution_failure(cx, &item, path_str, &dox, link_range);
                             // this could just be a normal link
                             continue;
                         }
@@ -368,7 +368,7 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
                         } else {
                             ambiguity_error(
                                 cx,
-                                &item.attrs,
+                                &item,
                                 path_str,
                                 &dox,
                                 link_range,
@@ -381,7 +381,7 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
                         if let Some(res) = macro_resolve(cx, path_str) {
                             (res, None)
                         } else {
-                            resolution_failure(cx, &item.attrs, path_str, &dox, link_range);
+                            resolution_failure(cx, &item, path_str, &dox, link_range);
                             continue
                         }
                     }
@@ -452,16 +452,24 @@ fn macro_resolve(cx: &DocContext<'_>, path_str: &str) -> Option<Res> {
 /// line containing the failure as a note as well.
 fn resolution_failure(
     cx: &DocContext<'_>,
-    attrs: &Attributes,
+    item: &Item,
     path_str: &str,
     dox: &str,
     link_range: Option<Range<usize>>,
 ) {
+    let hir_id = match cx.as_local_hir_id(item.def_id) {
+        Some(hir_id) => hir_id,
+        None => {
+            // If non-local, no need to check anything.
+            return;
+        }
+    };
+    let attrs = &item.attrs;
     let sp = span_of_attrs(attrs);
 
     let mut diag = cx.tcx.struct_span_lint_hir(
         lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE,
-        hir::CRATE_HIR_ID,
+        hir_id,
         sp,
         &format!("`[{}]` cannot be resolved, ignoring it...", path_str),
     );
@@ -495,12 +503,20 @@ fn resolution_failure(
 
 fn ambiguity_error(
     cx: &DocContext<'_>,
-    attrs: &Attributes,
+    item: &Item,
     path_str: &str,
     dox: &str,
     link_range: Option<Range<usize>>,
     candidates: PerNS<Option<Res>>,
 ) {
+    let hir_id = match cx.as_local_hir_id(item.def_id) {
+        Some(hir_id) => hir_id,
+        None => {
+            // If non-local, no need to check anything.
+            return;
+        }
+    };
+    let attrs = &item.attrs;
     let sp = span_of_attrs(attrs);
 
     let mut msg = format!("`{}` is ", path_str);
@@ -532,7 +548,7 @@ fn ambiguity_error(
 
     let mut diag = cx.tcx.struct_span_lint_hir(
         lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE,
-        hir::CRATE_HIR_ID,
+        hir_id,
         sp,
         &msg,
     );
index 99aca0634710fdc88ac688cf1ffb45bac9ce7cba..d9af33ac5b622a39f288c14b3eca760c02900245 100644 (file)
@@ -1,7 +1,6 @@
 //! Contains information about "passes", used to modify crate information during the documentation
 //! process.
 
-use rustc::hir;
 use rustc::hir::def_id::DefId;
 use rustc::lint as lint;
 use rustc::middle::privacy::AccessLevels;
@@ -314,10 +313,13 @@ pub fn look_for_tests<'tcx>(
     item: &Item,
     check_missing_code: bool,
 ) {
-    if cx.as_local_hir_id(item.def_id).is_none() {
-        // If non-local, no need to check anything.
-        return;
-    }
+    let hir_id = match cx.as_local_hir_id(item.def_id) {
+        Some(hir_id) => hir_id,
+        None => {
+            // If non-local, no need to check anything.
+            return;
+        }
+    };
 
     struct Tests {
         found_tests: usize,
@@ -336,10 +338,11 @@ fn add_test(&mut self, _: String, _: LangString, _: usize) {
     find_testable_code(&dox, &mut tests, ErrorCodes::No);
 
     if check_missing_code == true && tests.found_tests == 0 {
+        let sp = span_of_attrs(&item.attrs).substitute_dummy(item.source.span());
         let mut diag = cx.tcx.struct_span_lint_hir(
             lint::builtin::MISSING_DOC_CODE_EXAMPLES,
-            hir::CRATE_HIR_ID,
-            span_of_attrs(&item.attrs),
+            hir_id,
+            sp,
             "Missing code example in this documentation");
         diag.emit();
     } else if check_missing_code == false &&
@@ -347,7 +350,7 @@ fn add_test(&mut self, _: String, _: LangString, _: usize) {
               !cx.renderinfo.borrow().access_levels.is_doc_reachable(item.def_id) {
         let mut diag = cx.tcx.struct_span_lint_hir(
             lint::builtin::PRIVATE_DOC_TESTS,
-            hir::CRATE_HIR_ID,
+            hir_id,
             span_of_attrs(&item.attrs),
             "Documentation test in private item");
         diag.emit();
index e40dbe52ffe6423ecb9e259e7bfcd8b931a98088..d76d4380755f24b40b4d97e48f323663b53708c7 100644 (file)
@@ -8,6 +8,7 @@
 use rustc::session::search_paths::SearchPath;
 use rustc::util::common::ErrorReported;
 use syntax::ast;
+use syntax::with_globals;
 use syntax::source_map::SourceMap;
 use syntax::edition::Edition;
 use syntax::feature_gate::UnstableFeatures;
@@ -167,7 +168,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
             maybe_sysroot: Option<PathBuf>, linker: Option<PathBuf>, edition: Edition,
             persist_doctests: Option<PathBuf>) {
     let (test, line_offset) = match panic::catch_unwind(|| {
-        make_test(test, Some(cratename), as_test_harness, opts)
+        make_test(test, Some(cratename), as_test_harness, opts, edition)
     }) {
         Ok((test, line_offset)) => (test, line_offset),
         Err(cause) if cause.is::<errors::FatalErrorMarker>() => {
@@ -356,7 +357,8 @@ fn path(&self) -> &std::path::Path {
 pub fn make_test(s: &str,
                  cratename: Option<&str>,
                  dont_insert_main: bool,
-                 opts: &TestOptions)
+                 opts: &TestOptions,
+                 edition: Edition)
                  -> (String, usize) {
     let (crate_attrs, everything_else, crates) = partition_source(s);
     let everything_else = everything_else.trim();
@@ -385,7 +387,7 @@ pub fn make_test(s: &str,
 
     // Uses libsyntax to parse the doctest and find if there's a main fn and the extern
     // crate already is included.
-    let (already_has_main, already_has_extern_crate, found_macro) = crate::syntax::with_globals(|| {
+    let (already_has_main, already_has_extern_crate, found_macro) = with_globals(edition, || {
         use crate::syntax::{parse::{self, ParseSess}, source_map::FilePathMapping};
         use errors::emitter::EmitterWriter;
         use errors::Handler;
@@ -397,6 +399,7 @@ pub fn make_test(s: &str,
         // send all the errors that libsyntax emits directly into a `Sink` instead of stderr.
         let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
         let emitter = EmitterWriter::new(box io::sink(), None, false, false, false);
+        // FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser
         let handler = Handler::with_emitter(false, None, box emitter);
         let sess = ParseSess::with_span_handler(handler, cm);
 
@@ -880,6 +883,7 @@ fn visit_macro_def(&mut self, macro_def: &'hir hir::MacroDef) {
 #[cfg(test)]
 mod tests {
     use super::{TestOptions, make_test};
+    use syntax::edition::DEFAULT_EDITION;
 
     #[test]
     fn make_test_basic() {
@@ -892,7 +896,7 @@ fn make_test_basic() {
 fn main() {
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, None, false, &opts);
+        let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 2));
     }
 
@@ -908,7 +912,7 @@ fn make_test_crate_name_no_use() {
 fn main() {
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, Some("asdf"), false, &opts);
+        let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 2));
     }
 
@@ -927,7 +931,7 @@ fn main() {
 use asdf::qwop;
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, Some("asdf"), false, &opts);
+        let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 3));
     }
 
@@ -949,7 +953,7 @@ fn main() {
 use asdf::qwop;
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, Some("asdf"), false, &opts);
+        let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 2));
     }
 
@@ -968,7 +972,7 @@ fn main() {
 use std::*;
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, Some("std"), false, &opts);
+        let output = make_test(input, Some("std"), false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 2));
     }
 
@@ -988,7 +992,7 @@ fn main() {
 use asdf::qwop;
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, Some("asdf"), false, &opts);
+        let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 2));
     }
 
@@ -1006,7 +1010,7 @@ fn main() {
 use asdf::qwop;
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, Some("asdf"), false, &opts);
+        let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 2));
     }
 
@@ -1026,7 +1030,7 @@ fn main() {
 use asdf::qwop;
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, Some("asdf"), false, &opts);
+        let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 3));
 
         // Adding more will also bump the returned line offset.
@@ -1039,7 +1043,7 @@ fn main() {
 use asdf::qwop;
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, Some("asdf"), false, &opts);
+        let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 4));
     }
 
@@ -1057,7 +1061,7 @@ fn make_test_crate_attrs() {
 fn main() {
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, None, false, &opts);
+        let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 2));
     }
 
@@ -1074,7 +1078,7 @@ fn make_test_with_main() {
 fn main() {
     assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, None, false, &opts);
+        let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 1));
     }
 
@@ -1091,7 +1095,7 @@ fn make_test_fake_main() {
 fn main() {
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, None, false, &opts);
+        let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 2));
     }
 
@@ -1106,7 +1110,7 @@ fn make_test_dont_insert_main() {
 "#![allow(unused)]
 //Ceci n'est pas une `fn main`
 assert_eq!(2+2, 4);".to_string();
-        let output = make_test(input, None, true, &opts);
+        let output = make_test(input, None, true, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 1));
     }
 
@@ -1121,7 +1125,7 @@ fn make_test_display_warnings() {
 "fn main() {
 assert_eq!(2+2, 4);
 }".to_string();
-        let output = make_test(input, None, false, &opts);
+        let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 1));
     }
 
@@ -1140,7 +1144,7 @@ fn main() {
 assert_eq!(2+2, 4);
 }".to_string();
 
-        let output = make_test(input, None, false, &opts);
+        let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 2));
 
         let input =
@@ -1155,7 +1159,7 @@ fn main() {
 assert_eq!(asdf::foo, 4);
 }".to_string();
 
-        let output = make_test(input, Some("asdf"), false, &opts);
+        let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 3));
     }
 
@@ -1174,7 +1178,7 @@ fn main() {}
     fn main() {}
 }".to_string();
 
-        let output = make_test(input, Some("my_crate"), false, &opts);
+        let output = make_test(input, Some("my_crate"), false, &opts, DEFAULT_EDITION);
         assert_eq!(output, (expected, 1));
     }
 }
index ad5d62f667ac97648ca07e2dc2ac0041b682f3f0..55e8b39974e09be7611e658533fab45cae204b55 100644 (file)
@@ -3,7 +3,7 @@ authors = ["The Rust Project Developers"]
 name = "std"
 version = "0.0.0"
 build = "build.rs"
-license = "MIT/Apache-2.0"
+license = "MIT OR Apache-2.0"
 repository = "https://github.com/rust-lang/rust.git"
 description = "The Rust Standard Library"
 edition = "2018"
@@ -19,7 +19,7 @@ panic_unwind = { path = "../libpanic_unwind", optional = true }
 panic_abort = { path = "../libpanic_abort" }
 core = { path = "../libcore" }
 libc = { version = "0.2.51", default-features = false, features = ['rustc-dep-of-std'] }
-compiler_builtins = { version = "0.1.12" }
+compiler_builtins = { version = "0.1.14" }
 profiler_builtins = { path = "../libprofiler_builtins", optional = true }
 unwind = { path = "../libunwind" }
 hashbrown = { version = "0.3.0", features = ['rustc-dep-of-std'] }
@@ -54,7 +54,7 @@ default = ["compiler_builtins_c", "std_detect_file_io", "std_detect_dlsym_getaux
 backtrace = ["backtrace-sys"]
 panic-unwind = ["panic_unwind"]
 profiler = ["profiler_builtins"]
-compiler_builtins_c = ["compiler_builtins/c"]
+compiler_builtins_c = ["alloc/compiler-builtins-c"]
 llvm-libunwind = ["unwind/llvm-libunwind"]
 
 # Make panics and failed asserts immediately abort without formatting any message
index 4241f47b661d721b742a0b9bc8124592d7efeb8e..ff52974775b05268e1a4b3b49a704340a6f24d50 100644 (file)
@@ -173,6 +173,9 @@ unsafe fn realloc(&mut self,
 /// about the allocation that failed.
 ///
 /// The allocation error hook is a global resource.
+///
+/// [`set_alloc_error_hook`]: fn.set_alloc_error_hook.html
+/// [`take_alloc_error_hook`]: fn.take_alloc_error_hook.html
 #[unstable(feature = "alloc_error_hook", issue = "51245")]
 pub fn set_alloc_error_hook(hook: fn(Layout)) {
     HOOK.store(hook as *mut (), Ordering::SeqCst);
@@ -183,6 +186,8 @@ pub fn set_alloc_error_hook(hook: fn(Layout)) {
 /// *See also the function [`set_alloc_error_hook`].*
 ///
 /// If no custom hook is registered, the default hook will be returned.
+///
+/// [`set_alloc_error_hook`]: fn.set_alloc_error_hook.html
 #[unstable(feature = "alloc_error_hook", issue = "51245")]
 pub fn take_alloc_error_hook() -> fn(Layout) {
     let hook = HOOK.swap(ptr::null_mut(), Ordering::SeqCst);
index f9fb392f9f52b0edda3af97adfa3e88254629add..5a2fe2b244f556d16127daf3244da70fed785ecc 100644 (file)
@@ -1225,11 +1225,13 @@ pub struct RawEntryBuilderMut<'a, K: 'a, V: 'a, S: 'a> {
 ///
 /// This is a lower-level version of [`Entry`].
 ///
-/// This `enum` is constructed from the [`raw_entry`] method on [`HashMap`].
+/// This `enum` is constructed through the [`raw_entry_mut`] method on [`HashMap`],
+/// then calling one of the methods of that [`RawEntryBuilderMut`].
 ///
 /// [`HashMap`]: struct.HashMap.html
 /// [`Entry`]: enum.Entry.html
-/// [`raw_entry`]: struct.HashMap.html#method.raw_entry
+/// [`raw_entry_mut`]: struct.HashMap.html#method.raw_entry_mut
+/// [`RawEntryBuilderMut`]: struct.RawEntryBuilderMut.html
 #[unstable(feature = "hash_raw_entry", issue = "56167")]
 pub enum RawEntryMut<'a, K: 'a, V: 'a, S: 'a> {
     /// An occupied entry.
@@ -2492,7 +2494,10 @@ pub fn new() -> DefaultHasher {
 
 #[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
 impl Default for DefaultHasher {
-    /// Creates a new `DefaultHasher` using [`new`][DefaultHasher::new].
+    // FIXME: here should link `new` to [DefaultHasher::new], but it occurs intra-doc link
+    // resolution failure when re-exporting libstd items. When #56922 fixed,
+    // link `new` to [DefaultHasher::new] again.
+    /// Creates a new `DefaultHasher` using `new`.
     /// See its documentation for more.
     fn default() -> DefaultHasher {
         DefaultHasher::new()
index b56a27c80bc83163607b46a5a0bb1b3cd08a0452..403914c070780a4822f14afd9f7056c5c2251532 100644 (file)
@@ -618,6 +618,62 @@ pub fn get<Q: ?Sized>(&self, value: &Q) -> Option<&T>
         self.map.get_key_value(value).map(|(k, _)| k)
     }
 
+    /// Inserts the given `value` into the set if it is not present, then
+    /// returns a reference to the value in the set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(hash_set_entry)]
+    ///
+    /// use std::collections::HashSet;
+    ///
+    /// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
+    /// assert_eq!(set.len(), 3);
+    /// assert_eq!(set.get_or_insert(2), &2);
+    /// assert_eq!(set.get_or_insert(100), &100);
+    /// assert_eq!(set.len(), 4); // 100 was inserted
+    /// ```
+    #[inline]
+    #[unstable(feature = "hash_set_entry", issue = "60896")]
+    pub fn get_or_insert(&mut self, value: T) -> &T {
+        // Although the raw entry gives us `&mut T`, we only return `&T` to be consistent with
+        // `get`. Key mutation is "raw" because you're not supposed to affect `Eq` or `Hash`.
+        self.map.raw_entry_mut().from_key(&value).or_insert(value, ()).0
+    }
+
+    /// Inserts a value computed from `f` into the set if the given `value` is
+    /// not present, then returns a reference to the value in the set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(hash_set_entry)]
+    ///
+    /// use std::collections::HashSet;
+    ///
+    /// let mut set: HashSet<String> = ["cat", "dog", "horse"]
+    ///     .iter().map(|&pet| pet.to_owned()).collect();
+    ///
+    /// assert_eq!(set.len(), 3);
+    /// for &pet in &["cat", "dog", "fish"] {
+    ///     let value = set.get_or_insert_with(pet, str::to_owned);
+    ///     assert_eq!(value, pet);
+    /// }
+    /// assert_eq!(set.len(), 4); // a new "fish" was inserted
+    /// ```
+    #[inline]
+    #[unstable(feature = "hash_set_entry", issue = "60896")]
+    pub fn get_or_insert_with<Q: ?Sized, F>(&mut self, value: &Q, f: F) -> &T
+        where T: Borrow<Q>,
+              Q: Hash + Eq,
+              F: FnOnce(&Q) -> T
+    {
+        // Although the raw entry gives us `&mut T`, we only return `&T` to be consistent with
+        // `get`. Key mutation is "raw" because you're not supposed to affect `Eq` or `Hash`.
+        self.map.raw_entry_mut().from_key(value).or_insert_with(|| (f(value), ())).0
+    }
+
     /// Returns `true` if `self` has no elements in common with `other`.
     /// This is equivalent to checking for an empty intersection.
     ///
index 7cb830e751a77653295b4bcb0f6f6e8d9bb8d48c..aeb822fa99e66a6fd1920de1c16aea4203ff4677 100644 (file)
@@ -201,15 +201,25 @@ fn source(&self) -> Option<&(dyn Error + 'static)> { None }
     #[unstable(feature = "error_type_id",
                reason = "this is memory unsafe to override in user code",
                issue = "60784")]
-    fn type_id(&self) -> TypeId where Self: 'static {
+    fn type_id(&self, _: private::Internal) -> TypeId where Self: 'static {
         TypeId::of::<Self>()
     }
 }
 
+mod private {
+    // This is a hack to prevent `type_id` from being overridden by `Error`
+    // implementations, since that can enable unsound downcasting.
+    #[unstable(feature = "error_type_id", issue = "60784")]
+    #[derive(Debug)]
+    pub struct Internal;
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a> {
     /// Converts a type of [`Error`] into a box of dyn [`Error`].
     ///
+    /// [`Error`]: ../error/trait.Error.html
+    ///
     /// # Examples
     ///
     /// ```
@@ -247,6 +257,8 @@ impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync +
     /// Converts a type of [`Error`] + [`Send`] + [`Sync`] into a box of dyn [`Error`] +
     /// [`Send`] + [`Sync`].
     ///
+    /// [`Error`]: ../error/trait.Error.html
+    ///
     /// # Examples
     ///
     /// ```
@@ -288,6 +300,8 @@ fn from(err: E) -> Box<dyn Error + Send + Sync + 'a> {
 impl From<String> for Box<dyn Error + Send + Sync> {
     /// Converts a [`String`] into a box of dyn [`Error`] + [`Send`] + [`Sync`].
     ///
+    /// [`Error`]: ../error/trait.Error.html
+    ///
     /// # Examples
     ///
     /// ```
@@ -321,6 +335,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 impl From<String> for Box<dyn Error> {
     /// Converts a [`String`] into a box of dyn [`Error`].
     ///
+    /// [`Error`]: ../error/trait.Error.html
+    ///
     /// # Examples
     ///
     /// ```
@@ -342,6 +358,8 @@ fn from(str_err: String) -> Box<dyn Error> {
 impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
     /// Converts a [`str`] into a box of dyn [`Error`] + [`Send`] + [`Sync`].
     ///
+    /// [`Error`]: ../error/trait.Error.html
+    ///
     /// # Examples
     ///
     /// ```
@@ -362,6 +380,8 @@ fn from(err: &str) -> Box<dyn Error + Send + Sync + 'a> {
 impl From<&str> for Box<dyn Error> {
     /// Converts a [`str`] into a box of dyn [`Error`].
     ///
+    /// [`Error`]: ../error/trait.Error.html
+    ///
     /// # Examples
     ///
     /// ```
@@ -381,6 +401,9 @@ fn from(err: &str) -> Box<dyn Error> {
 impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a> {
     /// Converts a [`Cow`] into a box of dyn [`Error`] + [`Send`] + [`Sync`].
     ///
+    /// [`Cow`]: ../borrow/enum.Cow.html
+    /// [`Error`]: ../error/trait.Error.html
+    ///
     /// # Examples
     ///
     /// ```
@@ -402,6 +425,9 @@ fn from(err: Cow<'b, str>) -> Box<dyn Error + Send + Sync + 'a> {
 impl<'a> From<Cow<'a, str>> for Box<dyn Error> {
     /// Converts a [`Cow`] into a box of dyn [`Error`].
     ///
+    /// [`Cow`]: ../borrow/enum.Cow.html
+    /// [`Error`]: ../error/trait.Error.html
+    ///
     /// # Examples
     ///
     /// ```
@@ -575,7 +601,7 @@ pub fn is<T: Error + 'static>(&self) -> bool {
         let t = TypeId::of::<T>();
 
         // Get TypeId of the type in the trait object
-        let boxed = self.type_id();
+        let boxed = self.type_id(private::Internal);
 
         // Compare both TypeIds on equality
         t == boxed
index 13aee783750f1dfbb8a9cc81fcddcce61890baa0..c7c5849a00fa03e7ded2fe25de405f195575d0f2 100644 (file)
@@ -351,6 +351,8 @@ impl From<String> for OsString {
     /// Converts a [`String`] into a [`OsString`].
     ///
     /// The conversion copies the data, and includes an allocation on the heap.
+    ///
+    /// [`OsString`]: ../../std/ffi/struct.OsString.html
     fn from(s: String) -> OsString {
         OsString { inner: Buf::from_string(s) }
     }
index 991b45fd4a2ec2caf03b10b4d49237967226c7f2..616b5eb836ffd6c8c20163cd752790ade30ef170 100644 (file)
@@ -1812,6 +1812,8 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
 ///   function.)
 /// * `path` already exists.
 ///
+/// [`create_dir_all`]: fn.create_dir_all.html
+///
 /// # Examples
 ///
 /// ```no_run
index 5be2687d8f5ff3bb14af96ab9c413ec7d46d123e..e309f81192cf3ffb7322bd4540da7beb5c384461 100644 (file)
@@ -754,7 +754,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 /// completed, rather than the entire buffer at once. Enter `LineWriter`. It
 /// does exactly that.
 ///
-/// Like [`BufWriter`], a `LineWriter`’s buffer will also be flushed when the
+/// Like [`BufWriter`][bufwriter], a `LineWriter`’s buffer will also be flushed when the
 /// `LineWriter` goes out of scope or when its internal buffer is full.
 ///
 /// [bufwriter]: struct.BufWriter.html
index 8fea6251e652a143a2ae29aab6f616692f543080..917199f8ea8d03fe770c6a806a59d54ae207eac4 100644 (file)
@@ -1579,18 +1579,13 @@ pub trait BufRead: Read {
     /// let stdin = io::stdin();
     /// let mut stdin = stdin.lock();
     ///
-    /// // we can't have two `&mut` references to `stdin`, so use a block
-    /// // to end the borrow early.
-    /// let length = {
-    ///     let buffer = stdin.fill_buf().unwrap();
+    /// let buffer = stdin.fill_buf().unwrap();
     ///
-    ///     // work with buffer
-    ///     println!("{:?}", buffer);
-    ///
-    ///     buffer.len()
-    /// };
+    /// // work with buffer
+    /// println!("{:?}", buffer);
     ///
     /// // ensure the bytes we worked with aren't returned again later
+    /// let length = buffer.len();
     /// stdin.consume(length);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
index ffe50f11e8a50a5671067bef55def4530b664f45..d133c2f5cb11ca07c5797795696d02f4463e5474 100644 (file)
@@ -1,6 +1,6 @@
 #[doc(keyword = "as")]
 //
-/// The keyword for casting a value to a type.
+/// Cast between types, or rename an import.
 ///
 /// `as` is most commonly used to turn primitive types into other primitive types, but it has other
 /// uses that include turning pointers into addresses, addresses into pointers, and pointers into
 /// [`crate`]: keyword.crate.html
 mod as_keyword { }
 
+#[doc(keyword = "break")]
+//
+/// Exit early from a loop.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod break_keyword { }
+
 #[doc(keyword = "const")]
 //
-/// The keyword for defining constants.
+/// Compile-time constants and deterministic functions.
 ///
 /// Sometimes a certain value is used many times throughout a program, and it can become
 /// inconvenient to copy it over and over. What's more, it's not always possible or desirable to
@@ -83,9 +92,18 @@ mod as_keyword { }
 /// [Reference]: ../reference/items/constant-items.html
 mod const_keyword { }
 
+#[doc(keyword = "continue")]
+//
+/// Skip to the next iteration of a loop.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod continue_keyword { }
+
 #[doc(keyword = "crate")]
 //
-/// The `crate` keyword.
+/// A Rust binary or library.
 ///
 /// The primary use of the `crate` keyword is as a part of `extern crate` declarations, which are
 /// used to specify a dependency on a crate external to the one it's declared in. Crates are the
@@ -116,14 +134,24 @@ mod const_keyword { }
 /// [Reference]: ../reference/items/extern-crates.html
 mod crate_keyword { }
 
+#[doc(keyword = "else")]
+//
+/// What to do when an [`if`] condition does not hold.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [`if`]: keyword.if.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod else_keyword { }
+
 #[doc(keyword = "enum")]
 //
-/// For defining enumerations.
+/// A type that can be any one of several variants.
 ///
 /// Enums in Rust are similar to those of other compiled languages like C, but have important
 /// differences that make them considerably more powerful. What Rust calls enums are more commonly
-/// known as [Algebraic Data Types] if you're coming from a functional programming background. The
-/// important detail is that each enum variant can have data to go along with it.
+/// known as [Algebraic Data Types][ADT] if you're coming from a functional programming background.
+/// The important detail is that each enum variant can have data to go along with it.
 ///
 /// ```rust
 /// # struct Coord;
@@ -166,7 +194,7 @@ mod crate_keyword { }
 ///
 /// For more information, take a look at the [Rust Book] or the [Reference]
 ///
-/// [Algebraic Data Types]: https://en.wikipedia.org/wiki/Algebraic_data_type
+/// [ADT]: https://en.wikipedia.org/wiki/Algebraic_data_type
 /// [`Option`]: option/enum.Option.html
 /// [Rust Book]: ../book/ch06-01-defining-an-enum.html
 /// [Reference]: ../reference/items/enumerations.html
@@ -174,7 +202,7 @@ mod enum_keyword { }
 
 #[doc(keyword = "extern")]
 //
-/// For external connections in Rust code.
+/// Link to or import external code.
 ///
 /// The `extern` keyword is used in two places in Rust. One is in conjunction with the [`crate`]
 /// keyword to make your Rust code aware of other Rust crates in your project, i.e., `extern crate
@@ -214,9 +242,19 @@ mod enum_keyword { }
 /// [Reference]: ../reference/items/external-blocks.html
 mod extern_keyword { }
 
+#[doc(keyword = "false")]
+//
+/// A value of type [`bool`] representing logical **false**.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [`bool`]: primitive.bool.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod false_keyword { }
+
 #[doc(keyword = "fn")]
 //
-/// The keyword for defining functions.
+/// A function or function pointer.
 ///
 /// Functions are the primary way code is executed within Rust. Function blocks, usually just
 /// called functions, can be defined in a variety of different places and be assigned many
@@ -283,7 +321,8 @@ mod fn_keyword { }
 
 #[doc(keyword = "for")]
 //
-/// The `for` keyword.
+/// Iteration with [`in`], trait implementation with [`impl`], or [higher-ranked trait bounds]
+/// (`for<'a>`).
 ///
 /// The `for` keyword is used in many syntactic locations:
 ///
@@ -350,6 +389,7 @@ mod fn_keyword { }
 ///
 /// For more information on for-loops, see the [Rust book] or the [Reference].
 ///
+/// [`in`]: keyword.in.html
 /// [`impl`]: keyword.impl.html
 /// [higher-ranked trait bounds]: ../reference/trait-bounds.html#higher-ranked-trait-bounds
 /// [`IntoIterator`]: iter/trait.IntoIterator.html
@@ -360,7 +400,7 @@ mod for_keyword { }
 
 #[doc(keyword = "if")]
 //
-/// If statements and expressions.
+/// Evaluate a block if a condition holds.
 ///
 /// `if` is a familiar construct to most programmers, and is the main way you'll often do logic in
 /// your code. However, unlike in most languages, `if` blocks can also act as expressions.
@@ -434,7 +474,7 @@ mod if_keyword { }
 
 #[doc(keyword = "impl")]
 //
-/// The implementation-defining keyword.
+/// Implement some functionality for a type.
 ///
 /// The `impl` keyword is primarily used to define implementations on types. Inherent
 /// implementations are standalone, while trait implementations are used to implement traits for
@@ -495,9 +535,19 @@ mod if_keyword { }
 /// [book2]: ../book/ch10-02-traits.html#returning-types-that-implement-traits
 mod impl_keyword { }
 
+#[doc(keyword = "in")]
+//
+/// Iterate over a series of values with [`for`].
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [`for`]: keyword.for.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod in_keyword { }
+
 #[doc(keyword = "let")]
 //
-/// The variable binding keyword.
+/// Bind a value to a variable.
 ///
 /// The primary use for the `let` keyword is in `let` statements, which are used to introduce a new
 /// set of variables into the current scope, as given by a pattern.
@@ -560,7 +610,7 @@ mod let_keyword { }
 
 #[doc(keyword = "loop")]
 //
-/// The loop-defining keyword.
+/// Loop indefinitely.
 ///
 /// `loop` is used to define the simplest kind of loop supported in Rust. It runs the code inside
 /// it until the code uses `break` or the program exits.
@@ -603,9 +653,104 @@ mod let_keyword { }
 /// [Reference]: ../reference/expressions/loop-expr.html
 mod loop_keyword { }
 
+#[doc(keyword = "match")]
+//
+/// Control flow based on pattern matching.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod match_keyword { }
+
+#[doc(keyword = "mod")]
+//
+/// Organize code into [modules].
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [modules]: ../reference/items/modules.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod mod_keyword { }
+
+#[doc(keyword = "move")]
+//
+/// Capture a [closure]'s environment by value.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [closure]: ../book/second-edition/ch13-01-closures.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod move_keyword { }
+
+#[doc(keyword = "mut")]
+//
+/// A mutable binding, reference, or pointer.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod mut_keyword { }
+
+#[doc(keyword = "pub")]
+//
+/// Make an item visible to others.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod pub_keyword { }
+
+#[doc(keyword = "ref")]
+//
+/// Bind by reference during pattern matching.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod ref_keyword { }
+
+#[doc(keyword = "return")]
+//
+/// Return a value from a function.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod return_keyword { }
+
+#[doc(keyword = "self")]
+//
+/// The receiver of a method, or the current module.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod self_keyword { }
+
+#[doc(keyword = "Self")]
+//
+/// The implementing type within a [`trait`] or [`impl`] block, or the current type within a type
+/// definition.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [`impl`]: keyword.impl.html
+/// [`trait`]: keyword.trait.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod self_upper_keyword { }
+
+#[doc(keyword = "static")]
+//
+/// A place that is valid for the duration of a program.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod static_keyword { }
+
 #[doc(keyword = "struct")]
 //
-/// The keyword used to define structs.
+/// A type that is composed of other types.
 ///
 /// Structs in Rust come in three flavors: Structs with named fields, tuple structs, and unit
 /// structs.
@@ -710,3 +855,122 @@ mod loop_keyword { }
 /// [book]: ../book/ch05-01-defining-structs.html
 /// [reference]: ../reference/items/structs.html
 mod struct_keyword { }
+
+#[doc(keyword = "super")]
+//
+/// The parent of the current [module].
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [module]: ../reference/items/modules.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod super_keyword { }
+
+#[doc(keyword = "trait")]
+//
+/// A common interface for a class of types.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod trait_keyword { }
+
+#[doc(keyword = "true")]
+//
+/// A value of type [`bool`] representing logical **true**.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [`bool`]: primitive.bool.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod true_keyword { }
+
+#[doc(keyword = "type")]
+//
+/// Define an alias for an existing type.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod type_keyword { }
+
+#[doc(keyword = "unsafe")]
+//
+/// Code or interfaces whose [memory safety] cannot be verified by the type system.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [memory safety]: ../book/ch19-01-unsafe-rust.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod unsafe_keyword { }
+
+#[doc(keyword = "use")]
+//
+/// Import or rename items from other crates or modules.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod use_keyword { }
+
+#[doc(keyword = "where")]
+//
+/// Add constraints that must be upheld to use an item.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod where_keyword { }
+
+#[doc(keyword = "while")]
+//
+/// Loop while a condition is upheld.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod while_keyword { }
+
+// 2018 Edition keywords
+
+#[unstable(feature = "async_await", issue = "50547")]
+#[doc(keyword = "async")]
+//
+/// Return a [`Future`] instead of blocking the current thread.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [`Future`]: ./future/trait.Future.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod async_keyword { }
+
+#[unstable(feature = "async_await", issue = "50547")]
+#[doc(keyword = "await")]
+//
+/// Suspend execution until the result of a [`Future`] is ready.
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [`Future`]: ./future/trait.Future.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod await_keyword { }
+
+#[doc(keyword = "dyn")]
+//
+/// Name the type of a [trait object].
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [trait object]: ../book/ch17-02-trait-objects.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod dyn_keyword { }
+
+#[doc(keyword = "union")]
+//
+/// The [Rust equivalent of a C-style union][union].
+///
+/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+///
+/// [union]: ../reference/items/unions.html
+/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+mod union_keyword { }
index 2401946536ffa0f9af76ad43871d03ac4eb0aa12..e044b46e0d0763252baf5254a69fe57f88d1e5b8 100644 (file)
 #![feature(libc)]
 #![feature(link_args)]
 #![feature(linkage)]
-#![feature(maybe_uninit)]
 #![feature(needs_panic_runtime)]
 #![feature(never_type)]
 #![feature(nll)]
index 03aebeda47c4851f707c2d2ffb39682e166c4dcf..9af7bba97aa58de06daab2106874f17909a16cd6 100644 (file)
@@ -357,61 +357,6 @@ macro_rules! dbg {
     };
 }
 
-/// Selects the first successful receive event from a number of receivers.
-///
-/// This macro is used to wait for the first event to occur on a number of
-/// receivers. It places no restrictions on the types of receivers given to
-/// this macro, this can be viewed as a heterogeneous select.
-///
-/// # Examples
-///
-/// ```
-/// #![feature(mpsc_select)]
-///
-/// use std::thread;
-/// use std::sync::mpsc;
-///
-/// // two placeholder functions for now
-/// fn long_running_thread() {}
-/// fn calculate_the_answer() -> u32 { 42 }
-///
-/// let (tx1, rx1) = mpsc::channel();
-/// let (tx2, rx2) = mpsc::channel();
-///
-/// thread::spawn(move|| { long_running_thread(); tx1.send(()).unwrap(); });
-/// thread::spawn(move|| { tx2.send(calculate_the_answer()).unwrap(); });
-///
-/// select! {
-///     _ = rx1.recv() => println!("the long running thread finished first"),
-///     answer = rx2.recv() => {
-///         println!("the answer was: {}", answer.unwrap());
-///     }
-/// }
-/// # drop(rx1.recv());
-/// # drop(rx2.recv());
-/// ```
-///
-/// For more information about select, see the `std::sync::mpsc::Select` structure.
-#[macro_export]
-#[unstable(feature = "mpsc_select", issue = "27800")]
-#[rustc_deprecated(since = "1.32.0",
-                   reason = "channel selection will be removed in a future release")]
-macro_rules! select {
-    (
-        $($name:pat = $rx:ident.$meth:ident() => $code:expr),+
-    ) => ({
-        use $crate::sync::mpsc::Select;
-        let sel = Select::new();
-        $( let mut $rx = sel.handle(&$rx); )+
-        unsafe {
-            $( $rx.add(); )+
-        }
-        let ret = sel.wait();
-        $( if ret == $rx.id() { let $name = $rx.$meth(); $code } else )+
-        { unreachable!() }
-    })
-}
-
 #[cfg(test)]
 macro_rules! assert_approx_eq {
     ($a:expr, $b:expr) => ({
index e7923e381f1407205c647012acf15c81aab40644..ca86a175058b512dd2259349393a2c200565f920 100644 (file)
@@ -546,6 +546,9 @@ fn from_inner(addr: c::sockaddr_in6) -> SocketAddrV6 {
 #[stable(feature = "ip_from_ip", since = "1.16.0")]
 impl From<SocketAddrV4> for SocketAddr {
     /// Converts a [`SocketAddrV4`] into a [`SocketAddr::V4`].
+    ///
+    /// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html
+    /// [`SocketAddr::V4`]: ../../std/net/enum.SocketAddr.html#variant.V4
     fn from(sock4: SocketAddrV4) -> SocketAddr {
         SocketAddr::V4(sock4)
     }
@@ -554,6 +557,9 @@ fn from(sock4: SocketAddrV4) -> SocketAddr {
 #[stable(feature = "ip_from_ip", since = "1.16.0")]
 impl From<SocketAddrV6> for SocketAddr {
     /// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`].
+    ///
+    /// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
+    /// [`SocketAddr::V6`]: ../../std/net/enum.SocketAddr.html#variant.V6
     fn from(sock6: SocketAddrV6) -> SocketAddr {
         SocketAddr::V6(sock6)
     }
@@ -567,6 +573,13 @@ impl<I: Into<IpAddr>> From<(I, u16)> for SocketAddr {
     /// and creates a [`SocketAddr::V6`] for a [`IpAddr::V6`].
     ///
     /// `u16` is treated as port of the newly created [`SocketAddr`].
+    ///
+    /// [`IpAddr`]: ../../std/net/enum.IpAddr.html
+    /// [`IpAddr::V4`]: ../../std/net/enum.IpAddr.html#variant.V4
+    /// [`IpAddr::V6`]: ../../std/net/enum.IpAddr.html#variant.V6
+    /// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
+    /// [`SocketAddr::V4`]: ../../std/net/enum.SocketAddr.html#variant.V4
+    /// [`SocketAddr::V6`]: ../../std/net/enum.SocketAddr.html#variant.V6
     fn from(pieces: (I, u16)) -> SocketAddr {
         SocketAddr::new(pieces.0.into(), pieces.1)
     }
index 04353fde1b4d97620d17ad07702446d130dc5073..69ecd201063b034baf0f8d5df0074823a89ecda6 100644 (file)
 //! ```
 
 #![stable(feature = "rust1", since = "1.0.0")]
-#![allow(deprecated)] // for mpsc_select
 
 // A description of how Rust's channel implementation works
 //
 // believe that there is anything fundamental that needs to change about these
 // channels, however, in order to support a more efficient select().
 //
+// FIXME: Select is now removed, so these factors are ready to be cleaned up!
+//
 // # Conclusion
 //
 // And now that you've seen all the races that I found and attempted to fix,
 use crate::cell::UnsafeCell;
 use crate::time::{Duration, Instant};
 
-#[unstable(feature = "mpsc_select", issue = "27800")]
-pub use self::select::{Select, Handle};
-use self::select::StartResult;
-use self::select::StartResult::*;
-use self::blocking::SignalToken;
-
-#[cfg(all(test, not(target_os = "emscripten")))]
-mod select_tests;
-
 mod blocking;
 mod oneshot;
-mod select;
 mod shared;
 mod stream;
 mod sync;
@@ -1514,78 +1505,6 @@ pub fn try_iter(&self) -> TryIter<'_, T> {
 
 }
 
-impl<T> select::Packet for Receiver<T> {
-    fn can_recv(&self) -> bool {
-        loop {
-            let new_port = match *unsafe { self.inner() } {
-                Flavor::Oneshot(ref p) => {
-                    match p.can_recv() {
-                        Ok(ret) => return ret,
-                        Err(upgrade) => upgrade,
-                    }
-                }
-                Flavor::Stream(ref p) => {
-                    match p.can_recv() {
-                        Ok(ret) => return ret,
-                        Err(upgrade) => upgrade,
-                    }
-                }
-                Flavor::Shared(ref p) => return p.can_recv(),
-                Flavor::Sync(ref p) => return p.can_recv(),
-            };
-            unsafe {
-                mem::swap(self.inner_mut(),
-                          new_port.inner_mut());
-            }
-        }
-    }
-
-    fn start_selection(&self, mut token: SignalToken) -> StartResult {
-        loop {
-            let (t, new_port) = match *unsafe { self.inner() } {
-                Flavor::Oneshot(ref p) => {
-                    match p.start_selection(token) {
-                        oneshot::SelSuccess => return Installed,
-                        oneshot::SelCanceled => return Abort,
-                        oneshot::SelUpgraded(t, rx) => (t, rx),
-                    }
-                }
-                Flavor::Stream(ref p) => {
-                    match p.start_selection(token) {
-                        stream::SelSuccess => return Installed,
-                        stream::SelCanceled => return Abort,
-                        stream::SelUpgraded(t, rx) => (t, rx),
-                    }
-                }
-                Flavor::Shared(ref p) => return p.start_selection(token),
-                Flavor::Sync(ref p) => return p.start_selection(token),
-            };
-            token = t;
-            unsafe {
-                mem::swap(self.inner_mut(), new_port.inner_mut());
-            }
-        }
-    }
-
-    fn abort_selection(&self) -> bool {
-        let mut was_upgrade = false;
-        loop {
-            let result = match *unsafe { self.inner() } {
-                Flavor::Oneshot(ref p) => p.abort_selection(),
-                Flavor::Stream(ref p) => p.abort_selection(was_upgrade),
-                Flavor::Shared(ref p) => return p.abort_selection(was_upgrade),
-                Flavor::Sync(ref p) => return p.abort_selection(),
-            };
-            let new_port = match result { Ok(b) => return b, Err(p) => p };
-            was_upgrade = true;
-            unsafe {
-                mem::swap(self.inner_mut(),
-                          new_port.inner_mut());
-            }
-        }
-    }
-}
-
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Iterator for Iter<'a, T> {
     type Item = T;
index 5c516d5de0f176ed735d8e2cc7a6de488d5e83c2..e7a5cc46b31a857912e23bc880fac2c97d4580e2 100644 (file)
@@ -24,7 +24,6 @@
 
 pub use self::Failure::*;
 pub use self::UpgradeResult::*;
-pub use self::SelectionResult::*;
 use self::MyUpgrade::*;
 
 use crate::sync::mpsc::Receiver;
@@ -66,12 +65,6 @@ pub enum UpgradeResult {
     UpWoke(SignalToken),
 }
 
-pub enum SelectionResult<T> {
-    SelCanceled,
-    SelUpgraded(SignalToken, Receiver<T>),
-    SelSuccess,
-}
-
 enum MyUpgrade<T> {
     NothingSent,
     SendUsed,
@@ -264,71 +257,6 @@ pub fn drop_port(&self) {
     // select implementation
     ////////////////////////////////////////////////////////////////////////////
 
-    // If Ok, the value is whether this port has data, if Err, then the upgraded
-    // port needs to be checked instead of this one.
-    pub fn can_recv(&self) -> Result<bool, Receiver<T>> {
-        unsafe {
-            match self.state.load(Ordering::SeqCst) {
-                EMPTY => Ok(false), // Welp, we tried
-                DATA => Ok(true),   // we have some un-acquired data
-                DISCONNECTED if (*self.data.get()).is_some() => Ok(true), // we have data
-                DISCONNECTED => {
-                    match ptr::replace(self.upgrade.get(), SendUsed) {
-                        // The other end sent us an upgrade, so we need to
-                        // propagate upwards whether the upgrade can receive
-                        // data
-                        GoUp(upgrade) => Err(upgrade),
-
-                        // If the other end disconnected without sending an
-                        // upgrade, then we have data to receive (the channel is
-                        // disconnected).
-                        up => { ptr::write(self.upgrade.get(), up); Ok(true) }
-                    }
-                }
-                _ => unreachable!(), // we're the "one blocker"
-            }
-        }
-    }
-
-    // Attempts to start selection on this port. This can either succeed, fail
-    // because there is data, or fail because there is an upgrade pending.
-    pub fn start_selection(&self, token: SignalToken) -> SelectionResult<T> {
-        unsafe {
-            let ptr = token.cast_to_usize();
-            match self.state.compare_and_swap(EMPTY, ptr, Ordering::SeqCst) {
-                EMPTY => SelSuccess,
-                DATA => {
-                    drop(SignalToken::cast_from_usize(ptr));
-                    SelCanceled
-                }
-                DISCONNECTED if (*self.data.get()).is_some() => {
-                    drop(SignalToken::cast_from_usize(ptr));
-                    SelCanceled
-                }
-                DISCONNECTED => {
-                    match ptr::replace(self.upgrade.get(), SendUsed) {
-                        // The other end sent us an upgrade, so we need to
-                        // propagate upwards whether the upgrade can receive
-                        // data
-                        GoUp(upgrade) => {
-                            SelUpgraded(SignalToken::cast_from_usize(ptr), upgrade)
-                        }
-
-                        // If the other end disconnected without sending an
-                        // upgrade, then we have data to receive (the channel is
-                        // disconnected).
-                        up => {
-                            ptr::write(self.upgrade.get(), up);
-                            drop(SignalToken::cast_from_usize(ptr));
-                            SelCanceled
-                        }
-                    }
-                }
-                _ => unreachable!(), // we're the "one blocker"
-            }
-        }
-    }
-
     // Remove a previous selecting thread from this port. This ensures that the
     // blocked thread will no longer be visible to any other threads.
     //
diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs
deleted file mode 100644 (file)
index d1b5f2d..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-//! Selection over an array of receivers
-//!
-//! This module contains the implementation machinery necessary for selecting
-//! over a number of receivers. One large goal of this module is to provide an
-//! efficient interface to selecting over any receiver of any type.
-//!
-//! This is achieved through an architecture of a "receiver set" in which
-//! receivers are added to a set and then the entire set is waited on at once.
-//! The set can be waited on multiple times to prevent re-adding each receiver
-//! to the set.
-//!
-//! Usage of this module is currently encouraged to go through the use of the
-//! `select!` macro. This macro allows naturally binding of variables to the
-//! received values of receivers in a much more natural syntax then usage of the
-//! `Select` structure directly.
-//!
-//! # Examples
-//!
-//! ```rust
-//! #![feature(mpsc_select)]
-//!
-//! use std::sync::mpsc::channel;
-//!
-//! let (tx1, rx1) = channel();
-//! let (tx2, rx2) = channel();
-//!
-//! tx1.send(1).unwrap();
-//! tx2.send(2).unwrap();
-//!
-//! select! {
-//!     val = rx1.recv() => {
-//!         assert_eq!(val.unwrap(), 1);
-//!     },
-//!     val = rx2.recv() => {
-//!         assert_eq!(val.unwrap(), 2);
-//!     }
-//! }
-//! ```
-
-#![allow(dead_code)]
-#![unstable(feature = "mpsc_select",
-            reason = "This implementation, while likely sufficient, is unsafe and \
-                      likely to be error prone. At some point in the future this \
-                      module will be removed.",
-            issue = "27800")]
-#![rustc_deprecated(since = "1.32.0",
-                    reason = "channel selection will be removed in a future release")]
-
-use core::cell::{Cell, UnsafeCell};
-use core::marker;
-use core::ptr;
-use core::usize;
-
-use crate::fmt;
-use crate::sync::mpsc::{Receiver, RecvError};
-use crate::sync::mpsc::blocking::{self, SignalToken};
-
-/// The "receiver set" of the select interface. This structure is used to manage
-/// a set of receivers which are being selected over.
-pub struct Select {
-    inner: UnsafeCell<SelectInner>,
-    next_id: Cell<usize>,
-}
-
-struct SelectInner {
-    head: *mut Handle<'static, ()>,
-    tail: *mut Handle<'static, ()>,
-}
-
-impl !marker::Send for Select {}
-
-/// A handle to a receiver which is currently a member of a `Select` set of
-/// receivers. This handle is used to keep the receiver in the set as well as
-/// interact with the underlying receiver.
-pub struct Handle<'rx, T:Send+'rx> {
-    /// The ID of this handle, used to compare against the return value of
-    /// `Select::wait()`.
-    id: usize,
-    selector: *mut SelectInner,
-    next: *mut Handle<'static, ()>,
-    prev: *mut Handle<'static, ()>,
-    added: bool,
-    packet: &'rx (dyn Packet+'rx),
-
-    // due to our fun transmutes, we be sure to place this at the end. (nothing
-    // previous relies on T)
-    rx: &'rx Receiver<T>,
-}
-
-struct Packets { cur: *mut Handle<'static, ()> }
-
-#[doc(hidden)]
-#[derive(PartialEq, Eq)]
-pub enum StartResult {
-    Installed,
-    Abort,
-}
-
-#[doc(hidden)]
-pub trait Packet {
-    fn can_recv(&self) -> bool;
-    fn start_selection(&self, token: SignalToken) -> StartResult;
-    fn abort_selection(&self) -> bool;
-}
-
-impl Select {
-    /// Creates a new selection structure. This set is initially empty.
-    ///
-    /// Usage of this struct directly can sometimes be burdensome, and usage is much easier through
-    /// the `select!` macro.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// #![feature(mpsc_select)]
-    ///
-    /// use std::sync::mpsc::Select;
-    ///
-    /// let select = Select::new();
-    /// ```
-    pub fn new() -> Select {
-        Select {
-            inner: UnsafeCell::new(SelectInner {
-                head: ptr::null_mut(),
-                tail: ptr::null_mut(),
-            }),
-            next_id: Cell::new(1),
-        }
-    }
-
-    /// Creates a new handle into this receiver set for a new receiver. Note
-    /// that this does *not* add the receiver to the receiver set, for that you
-    /// must call the `add` method on the handle itself.
-    pub fn handle<'a, T: Send>(&'a self, rx: &'a Receiver<T>) -> Handle<'a, T> {
-        let id = self.next_id.get();
-        self.next_id.set(id + 1);
-        Handle {
-            id,
-            selector: self.inner.get(),
-            next: ptr::null_mut(),
-            prev: ptr::null_mut(),
-            added: false,
-            rx,
-            packet: rx,
-        }
-    }
-
-    /// Waits for an event on this receiver set. The returned value is *not* an
-    /// index, but rather an ID. This ID can be queried against any active
-    /// `Handle` structures (each one has an `id` method). The handle with
-    /// the matching `id` will have some sort of event available on it. The
-    /// event could either be that data is available or the corresponding
-    /// channel has been closed.
-    pub fn wait(&self) -> usize {
-        self.wait2(true)
-    }
-
-    /// Helper method for skipping the preflight checks during testing
-    pub(super) fn wait2(&self, do_preflight_checks: bool) -> usize {
-        // Note that this is currently an inefficient implementation. We in
-        // theory have knowledge about all receivers in the set ahead of time,
-        // so this method shouldn't really have to iterate over all of them yet
-        // again. The idea with this "receiver set" interface is to get the
-        // interface right this time around, and later this implementation can
-        // be optimized.
-        //
-        // This implementation can be summarized by:
-        //
-        //      fn select(receivers) {
-        //          if any receiver ready { return ready index }
-        //          deschedule {
-        //              block on all receivers
-        //          }
-        //          unblock on all receivers
-        //          return ready index
-        //      }
-        //
-        // Most notably, the iterations over all of the receivers shouldn't be
-        // necessary.
-        unsafe {
-            // Stage 1: preflight checks. Look for any packets ready to receive
-            if do_preflight_checks {
-                for handle in self.iter() {
-                    if (*handle).packet.can_recv() {
-                        return (*handle).id();
-                    }
-                }
-            }
-
-            // Stage 2: begin the blocking process
-            //
-            // Create a number of signal tokens, and install each one
-            // sequentially until one fails. If one fails, then abort the
-            // selection on the already-installed tokens.
-            let (wait_token, signal_token) = blocking::tokens();
-            for (i, handle) in self.iter().enumerate() {
-                match (*handle).packet.start_selection(signal_token.clone()) {
-                    StartResult::Installed => {}
-                    StartResult::Abort => {
-                        // Go back and abort the already-begun selections
-                        for handle in self.iter().take(i) {
-                            (*handle).packet.abort_selection();
-                        }
-                        return (*handle).id;
-                    }
-                }
-            }
-
-            // Stage 3: no messages available, actually block
-            wait_token.wait();
-
-            // Stage 4: there *must* be message available; find it.
-            //
-            // Abort the selection process on each receiver. If the abort
-            // process returns `true`, then that means that the receiver is
-            // ready to receive some data. Note that this also means that the
-            // receiver may have yet to have fully read the `to_wake` field and
-            // woken us up (although the wakeup is guaranteed to fail).
-            //
-            // This situation happens in the window of where a sender invokes
-            // increment(), sees -1, and then decides to wake up the thread. After
-            // all this is done, the sending thread will set `selecting` to
-            // `false`. Until this is done, we cannot return. If we were to
-            // return, then a sender could wake up a receiver which has gone
-            // back to sleep after this call to `select`.
-            //
-            // Note that it is a "fairly small window" in which an increment()
-            // views that it should wake a thread up until the `selecting` bit
-            // is set to false. For now, the implementation currently just spins
-            // in a yield loop. This is very distasteful, but this
-            // implementation is already nowhere near what it should ideally be.
-            // A rewrite should focus on avoiding a yield loop, and for now this
-            // implementation is tying us over to a more efficient "don't
-            // iterate over everything every time" implementation.
-            let mut ready_id = usize::MAX;
-            for handle in self.iter() {
-                if (*handle).packet.abort_selection() {
-                    ready_id = (*handle).id;
-                }
-            }
-
-            // We must have found a ready receiver
-            assert!(ready_id != usize::MAX);
-            return ready_id;
-        }
-    }
-
-    fn iter(&self) -> Packets { Packets { cur: unsafe { &*self.inner.get() }.head } }
-}
-
-impl<'rx, T: Send> Handle<'rx, T> {
-    /// Retrieves the ID of this handle.
-    #[inline]
-    pub fn id(&self) -> usize { self.id }
-
-    /// Blocks to receive a value on the underlying receiver, returning `Some` on
-    /// success or `None` if the channel disconnects. This function has the same
-    /// semantics as `Receiver.recv`
-    pub fn recv(&mut self) -> Result<T, RecvError> { self.rx.recv() }
-
-    /// Adds this handle to the receiver set that the handle was created from. This
-    /// method can be called multiple times, but it has no effect if `add` was
-    /// called previously.
-    ///
-    /// This method is unsafe because it requires that the `Handle` is not moved
-    /// while it is added to the `Select` set.
-    pub unsafe fn add(&mut self) {
-        if self.added { return }
-        let selector = &mut *self.selector;
-        let me = self as *mut Handle<'rx, T> as *mut Handle<'static, ()>;
-
-        if selector.head.is_null() {
-            selector.head = me;
-            selector.tail = me;
-        } else {
-            (*me).prev = selector.tail;
-            assert!((*me).next.is_null());
-            (*selector.tail).next = me;
-            selector.tail = me;
-        }
-        self.added = true;
-    }
-
-    /// Removes this handle from the `Select` set. This method is unsafe because
-    /// it has no guarantee that the `Handle` was not moved since `add` was
-    /// called.
-    pub unsafe fn remove(&mut self) {
-        if !self.added { return }
-
-        let selector = &mut *self.selector;
-        let me = self as *mut Handle<'rx, T> as *mut Handle<'static, ()>;
-
-        if self.prev.is_null() {
-            assert_eq!(selector.head, me);
-            selector.head = self.next;
-        } else {
-            (*self.prev).next = self.next;
-        }
-        if self.next.is_null() {
-            assert_eq!(selector.tail, me);
-            selector.tail = self.prev;
-        } else {
-            (*self.next).prev = self.prev;
-        }
-
-        self.next = ptr::null_mut();
-        self.prev = ptr::null_mut();
-
-        self.added = false;
-    }
-}
-
-impl Drop for Select {
-    fn drop(&mut self) {
-        unsafe {
-            assert!((&*self.inner.get()).head.is_null());
-            assert!((&*self.inner.get()).tail.is_null());
-        }
-    }
-}
-
-impl<T: Send> Drop for Handle<'_, T> {
-    fn drop(&mut self) {
-        unsafe { self.remove() }
-    }
-}
-
-impl Iterator for Packets {
-    type Item = *mut Handle<'static, ()>;
-
-    fn next(&mut self) -> Option<*mut Handle<'static, ()>> {
-        if self.cur.is_null() {
-            None
-        } else {
-            let ret = Some(self.cur);
-            unsafe { self.cur = (*self.cur).next; }
-            ret
-        }
-    }
-}
-
-impl fmt::Debug for Select {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.debug_struct("Select").finish()
-    }
-}
-
-impl<T: Send> fmt::Debug for Handle<'_, T> {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.debug_struct("Handle").finish()
-    }
-}
diff --git a/src/libstd/sync/mpsc/select_tests.rs b/src/libstd/sync/mpsc/select_tests.rs
deleted file mode 100644 (file)
index 18d9346..0000000
+++ /dev/null
@@ -1,413 +0,0 @@
-#![allow(unused_imports)]
-
-/// This file exists to hack around https://github.com/rust-lang/rust/issues/47238
-
-use crate::thread;
-use crate::sync::mpsc::*;
-
-// Don't use the libstd version so we can pull in the right Select structure
-// (std::comm points at the wrong one)
-macro_rules! select {
-    (
-        $($name:pat = $rx:ident.$meth:ident() => $code:expr),+
-    ) => ({
-        let sel = Select::new();
-        $( let mut $rx = sel.handle(&$rx); )+
-        unsafe {
-            $( $rx.add(); )+
-        }
-        let ret = sel.wait();
-        $( if ret == $rx.id() { let $name = $rx.$meth(); $code } else )+
-        { unreachable!() }
-    })
-}
-
-#[test]
-fn smoke() {
-    let (tx1, rx1) = channel::<i32>();
-    let (tx2, rx2) = channel::<i32>();
-    tx1.send(1).unwrap();
-    select! {
-        foo = rx1.recv() => { assert_eq!(foo.unwrap(), 1); },
-        _bar = rx2.recv() => { panic!() }
-    }
-    tx2.send(2).unwrap();
-    select! {
-        _foo = rx1.recv() => { panic!() },
-        bar = rx2.recv() => { assert_eq!(bar.unwrap(), 2) }
-    }
-    drop(tx1);
-    select! {
-        foo = rx1.recv() => { assert!(foo.is_err()); },
-        _bar = rx2.recv() => { panic!() }
-    }
-    drop(tx2);
-    select! {
-        bar = rx2.recv() => { assert!(bar.is_err()); }
-    }
-}
-
-#[test]
-fn smoke2() {
-    let (_tx1, rx1) = channel::<i32>();
-    let (_tx2, rx2) = channel::<i32>();
-    let (_tx3, rx3) = channel::<i32>();
-    let (_tx4, rx4) = channel::<i32>();
-    let (tx5, rx5) = channel::<i32>();
-    tx5.send(4).unwrap();
-    select! {
-        _foo = rx1.recv() => { panic!("1") },
-        _foo = rx2.recv() => { panic!("2") },
-        _foo = rx3.recv() => { panic!("3") },
-        _foo = rx4.recv() => { panic!("4") },
-        foo = rx5.recv() => { assert_eq!(foo.unwrap(), 4); }
-    }
-}
-
-#[test]
-fn closed() {
-    let (_tx1, rx1) = channel::<i32>();
-    let (tx2, rx2) = channel::<i32>();
-    drop(tx2);
-
-    select! {
-        _a1 = rx1.recv() => { panic!() },
-        a2 = rx2.recv() => { assert!(a2.is_err()); }
-    }
-}
-
-#[test]
-fn unblocks() {
-    let (tx1, rx1) = channel::<i32>();
-    let (_tx2, rx2) = channel::<i32>();
-    let (tx3, rx3) = channel::<i32>();
-
-    let _t = thread::spawn(move|| {
-        for _ in 0..20 { thread::yield_now(); }
-        tx1.send(1).unwrap();
-        rx3.recv().unwrap();
-        for _ in 0..20 { thread::yield_now(); }
-    });
-
-    select! {
-        a = rx1.recv() => { assert_eq!(a.unwrap(), 1); },
-        _b = rx2.recv() => { panic!() }
-    }
-    tx3.send(1).unwrap();
-    select! {
-        a = rx1.recv() => { assert!(a.is_err()) },
-        _b = rx2.recv() => { panic!() }
-    }
-}
-
-#[test]
-fn both_ready() {
-    let (tx1, rx1) = channel::<i32>();
-    let (tx2, rx2) = channel::<i32>();
-    let (tx3, rx3) = channel::<()>();
-
-    let _t = thread::spawn(move|| {
-        for _ in 0..20 { thread::yield_now(); }
-        tx1.send(1).unwrap();
-        tx2.send(2).unwrap();
-        rx3.recv().unwrap();
-    });
-
-    select! {
-        a = rx1.recv() => { assert_eq!(a.unwrap(), 1); },
-        a = rx2.recv() => { assert_eq!(a.unwrap(), 2); }
-    }
-    select! {
-        a = rx1.recv() => { assert_eq!(a.unwrap(), 1); },
-        a = rx2.recv() => { assert_eq!(a.unwrap(), 2); }
-    }
-    assert_eq!(rx1.try_recv(), Err(TryRecvError::Empty));
-    assert_eq!(rx2.try_recv(), Err(TryRecvError::Empty));
-    tx3.send(()).unwrap();
-}
-
-#[test]
-fn stress() {
-    const AMT: i32 = 10000;
-    let (tx1, rx1) = channel::<i32>();
-    let (tx2, rx2) = channel::<i32>();
-    let (tx3, rx3) = channel::<()>();
-
-    let _t = thread::spawn(move|| {
-        for i in 0..AMT {
-            if i % 2 == 0 {
-                tx1.send(i).unwrap();
-            } else {
-                tx2.send(i).unwrap();
-            }
-            rx3.recv().unwrap();
-        }
-    });
-
-    for i in 0..AMT {
-        select! {
-            i1 = rx1.recv() => { assert!(i % 2 == 0 && i == i1.unwrap()); },
-            i2 = rx2.recv() => { assert!(i % 2 == 1 && i == i2.unwrap()); }
-        }
-        tx3.send(()).unwrap();
-    }
-}
-
-#[allow(unused_must_use)]
-#[test]
-fn cloning() {
-    let (tx1, rx1) = channel::<i32>();
-    let (_tx2, rx2) = channel::<i32>();
-    let (tx3, rx3) = channel::<()>();
-
-    let _t = thread::spawn(move|| {
-        rx3.recv().unwrap();
-        tx1.clone();
-        assert_eq!(rx3.try_recv(), Err(TryRecvError::Empty));
-        tx1.send(2).unwrap();
-        rx3.recv().unwrap();
-    });
-
-    tx3.send(()).unwrap();
-    select! {
-        _i1 = rx1.recv() => {},
-        _i2 = rx2.recv() => panic!()
-    }
-    tx3.send(()).unwrap();
-}
-
-#[allow(unused_must_use)]
-#[test]
-fn cloning2() {
-    let (tx1, rx1) = channel::<i32>();
-    let (_tx2, rx2) = channel::<i32>();
-    let (tx3, rx3) = channel::<()>();
-
-    let _t = thread::spawn(move|| {
-        rx3.recv().unwrap();
-        tx1.clone();
-        assert_eq!(rx3.try_recv(), Err(TryRecvError::Empty));
-        tx1.send(2).unwrap();
-        rx3.recv().unwrap();
-    });
-
-    tx3.send(()).unwrap();
-    select! {
-        _i1 = rx1.recv() => {},
-        _i2 = rx2.recv() => panic!()
-    }
-    tx3.send(()).unwrap();
-}
-
-#[test]
-fn cloning3() {
-    let (tx1, rx1) = channel::<()>();
-    let (tx2, rx2) = channel::<()>();
-    let (tx3, rx3) = channel::<()>();
-    let _t = thread::spawn(move|| {
-        let s = Select::new();
-        let mut h1 = s.handle(&rx1);
-        let mut h2 = s.handle(&rx2);
-        unsafe { h2.add(); }
-        unsafe { h1.add(); }
-        assert_eq!(s.wait(), h2.id());
-        tx3.send(()).unwrap();
-    });
-
-    for _ in 0..1000 { thread::yield_now(); }
-    drop(tx1.clone());
-    tx2.send(()).unwrap();
-    rx3.recv().unwrap();
-}
-
-#[test]
-fn preflight1() {
-    let (tx, rx) = channel();
-    tx.send(()).unwrap();
-    select! {
-        _n = rx.recv() => {}
-    }
-}
-
-#[test]
-fn preflight2() {
-    let (tx, rx) = channel();
-    tx.send(()).unwrap();
-    tx.send(()).unwrap();
-    select! {
-        _n = rx.recv() => {}
-    }
-}
-
-#[test]
-fn preflight3() {
-    let (tx, rx) = channel();
-    drop(tx.clone());
-    tx.send(()).unwrap();
-    select! {
-        _n = rx.recv() => {}
-    }
-}
-
-#[test]
-fn preflight4() {
-    let (tx, rx) = channel();
-    tx.send(()).unwrap();
-    let s = Select::new();
-    let mut h = s.handle(&rx);
-    unsafe { h.add(); }
-    assert_eq!(s.wait2(false), h.id());
-}
-
-#[test]
-fn preflight5() {
-    let (tx, rx) = channel();
-    tx.send(()).unwrap();
-    tx.send(()).unwrap();
-    let s = Select::new();
-    let mut h = s.handle(&rx);
-    unsafe { h.add(); }
-    assert_eq!(s.wait2(false), h.id());
-}
-
-#[test]
-fn preflight6() {
-    let (tx, rx) = channel();
-    drop(tx.clone());
-    tx.send(()).unwrap();
-    let s = Select::new();
-    let mut h = s.handle(&rx);
-    unsafe { h.add(); }
-    assert_eq!(s.wait2(false), h.id());
-}
-
-#[test]
-fn preflight7() {
-    let (tx, rx) = channel::<()>();
-    drop(tx);
-    let s = Select::new();
-    let mut h = s.handle(&rx);
-    unsafe { h.add(); }
-    assert_eq!(s.wait2(false), h.id());
-}
-
-#[test]
-fn preflight8() {
-    let (tx, rx) = channel();
-    tx.send(()).unwrap();
-    drop(tx);
-    rx.recv().unwrap();
-    let s = Select::new();
-    let mut h = s.handle(&rx);
-    unsafe { h.add(); }
-    assert_eq!(s.wait2(false), h.id());
-}
-
-#[test]
-fn preflight9() {
-    let (tx, rx) = channel();
-    drop(tx.clone());
-    tx.send(()).unwrap();
-    drop(tx);
-    rx.recv().unwrap();
-    let s = Select::new();
-    let mut h = s.handle(&rx);
-    unsafe { h.add(); }
-    assert_eq!(s.wait2(false), h.id());
-}
-
-#[test]
-fn oneshot_data_waiting() {
-    let (tx1, rx1) = channel();
-    let (tx2, rx2) = channel();
-    let _t = thread::spawn(move|| {
-        select! {
-            _n = rx1.recv() => {}
-        }
-        tx2.send(()).unwrap();
-    });
-
-    for _ in 0..100 { thread::yield_now() }
-    tx1.send(()).unwrap();
-    rx2.recv().unwrap();
-}
-
-#[test]
-fn stream_data_waiting() {
-    let (tx1, rx1) = channel();
-    let (tx2, rx2) = channel();
-    tx1.send(()).unwrap();
-    tx1.send(()).unwrap();
-    rx1.recv().unwrap();
-    rx1.recv().unwrap();
-    let _t = thread::spawn(move|| {
-        select! {
-            _n = rx1.recv() => {}
-        }
-        tx2.send(()).unwrap();
-    });
-
-    for _ in 0..100 { thread::yield_now() }
-    tx1.send(()).unwrap();
-    rx2.recv().unwrap();
-}
-
-#[test]
-fn shared_data_waiting() {
-    let (tx1, rx1) = channel();
-    let (tx2, rx2) = channel();
-    drop(tx1.clone());
-    tx1.send(()).unwrap();
-    rx1.recv().unwrap();
-    let _t = thread::spawn(move|| {
-        select! {
-            _n = rx1.recv() => {}
-        }
-        tx2.send(()).unwrap();
-    });
-
-    for _ in 0..100 { thread::yield_now() }
-    tx1.send(()).unwrap();
-    rx2.recv().unwrap();
-}
-
-#[test]
-fn sync1() {
-    let (tx, rx) = sync_channel::<i32>(1);
-    tx.send(1).unwrap();
-    select! {
-        n = rx.recv() => { assert_eq!(n.unwrap(), 1); }
-    }
-}
-
-#[test]
-fn sync2() {
-    let (tx, rx) = sync_channel::<i32>(0);
-    let _t = thread::spawn(move|| {
-        for _ in 0..100 { thread::yield_now() }
-        tx.send(1).unwrap();
-    });
-    select! {
-        n = rx.recv() => { assert_eq!(n.unwrap(), 1); }
-    }
-}
-
-#[test]
-fn sync3() {
-    let (tx1, rx1) = sync_channel::<i32>(0);
-    let (tx2, rx2): (Sender<i32>, Receiver<i32>) = channel();
-    let _t = thread::spawn(move|| { tx1.send(1).unwrap(); });
-    let _t = thread::spawn(move|| { tx2.send(2).unwrap(); });
-    select! {
-        n = rx1.recv() => {
-            let n = n.unwrap();
-            assert_eq!(n, 1);
-            assert_eq!(rx2.recv().unwrap(), 2);
-        },
-        n = rx2.recv() => {
-            let n = n.unwrap();
-            assert_eq!(n, 2);
-            assert_eq!(rx1.recv().unwrap(), 1);
-        }
-    }
-}
index cc70a62036590b4b514fdbd0639dbf93d64e6f74..dbcdcdac9326855330847013db2d442e233e5623 100644 (file)
@@ -9,6 +9,7 @@
 /// channels are quite similar, and this is no coincidence!
 
 pub use self::Failure::*;
+use self::StartResult::*;
 
 use core::cmp;
 use core::intrinsics::abort;
@@ -19,8 +20,6 @@
 use crate::sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering};
 use crate::sync::mpsc::blocking::{self, SignalToken};
 use crate::sync::mpsc::mpsc_queue as mpsc;
-use crate::sync::mpsc::select::StartResult::*;
-use crate::sync::mpsc::select::StartResult;
 use crate::sync::{Mutex, MutexGuard};
 use crate::thread;
 use crate::time::Instant;
@@ -57,6 +56,12 @@ pub enum Failure {
     Disconnected,
 }
 
+#[derive(PartialEq, Eq)]
+enum StartResult {
+    Installed,
+    Abort,
+}
+
 impl<T> Packet<T> {
     // Creation of a packet *must* be followed by a call to postinit_lock
     // and later by inherit_blocker
@@ -394,16 +399,6 @@ fn take_to_wake(&self) -> SignalToken {
     // select implementation
     ////////////////////////////////////////////////////////////////////////////
 
-    // Helper function for select, tests whether this port can receive without
-    // blocking (obviously not an atomic decision).
-    //
-    // This is different than the stream version because there's no need to peek
-    // at the queue, we can just look at the local count.
-    pub fn can_recv(&self) -> bool {
-        let cnt = self.cnt.load(Ordering::SeqCst);
-        cnt == DISCONNECTED || cnt - unsafe { *self.steals.get() } > 0
-    }
-
     // increment the count on the channel (used for selection)
     fn bump(&self, amt: isize) -> isize {
         match self.cnt.fetch_add(amt, Ordering::SeqCst) {
@@ -415,22 +410,6 @@ fn bump(&self, amt: isize) -> isize {
         }
     }
 
-    // Inserts the signal token for selection on this port, returning true if
-    // blocking should proceed.
-    //
-    // The code here is the same as in stream.rs, except that it doesn't need to
-    // peek at the channel to see if an upgrade is pending.
-    pub fn start_selection(&self, token: SignalToken) -> StartResult {
-        match self.decrement(token) {
-            Installed => Installed,
-            Abort => {
-                let prev = self.bump(1);
-                assert!(prev == DISCONNECTED || prev >= 0);
-                Abort
-            }
-        }
-    }
-
     // Cancels a previous thread waiting on this port, returning whether there's
     // data on the port.
     //
index 7ae6f68b514595d305bb993f1a73896f622a4f49..40877282761790cd78c989d9eb37fad0cd92c181 100644 (file)
@@ -9,7 +9,6 @@
 
 pub use self::Failure::*;
 pub use self::UpgradeResult::*;
-pub use self::SelectionResult::*;
 use self::Message::*;
 
 use core::cmp;
@@ -60,12 +59,6 @@ pub enum UpgradeResult {
     UpWoke(SignalToken),
 }
 
-pub enum SelectionResult<T> {
-    SelSuccess,
-    SelCanceled,
-    SelUpgraded(SignalToken, Receiver<T>),
-}
-
 // Any message could contain an "upgrade request" to a new shared port, so the
 // internal queue it's a queue of T, but rather Message<T>
 enum Message<T> {
@@ -338,27 +331,6 @@ pub fn drop_port(&self) {
     // select implementation
     ////////////////////////////////////////////////////////////////////////////
 
-    // Tests to see whether this port can receive without blocking. If Ok is
-    // returned, then that's the answer. If Err is returned, then the returned
-    // port needs to be queried instead (an upgrade happened)
-    pub fn can_recv(&self) -> Result<bool, Receiver<T>> {
-        // We peek at the queue to see if there's anything on it, and we use
-        // this return value to determine if we should pop from the queue and
-        // upgrade this channel immediately. If it looks like we've got an
-        // upgrade pending, then go through the whole recv rigamarole to update
-        // the internal state.
-        match self.queue.peek() {
-            Some(&mut GoUp(..)) => {
-                match self.recv(None) {
-                    Err(Upgraded(port)) => Err(port),
-                    _ => unreachable!(),
-                }
-            }
-            Some(..) => Ok(true),
-            None => Ok(false)
-        }
-    }
-
     // increment the count on the channel (used for selection)
     fn bump(&self, amt: isize) -> isize {
         match self.queue.producer_addition().cnt.fetch_add(amt, Ordering::SeqCst) {
@@ -370,31 +342,6 @@ fn bump(&self, amt: isize) -> isize {
         }
     }
 
-    // Attempts to start selecting on this port. Like a oneshot, this can fail
-    // immediately because of an upgrade.
-    pub fn start_selection(&self, token: SignalToken) -> SelectionResult<T> {
-        match self.decrement(token) {
-            Ok(()) => SelSuccess,
-            Err(token) => {
-                let ret = match self.queue.peek() {
-                    Some(&mut GoUp(..)) => {
-                        match self.queue.pop() {
-                            Some(GoUp(port)) => SelUpgraded(token, port),
-                            _ => unreachable!(),
-                        }
-                    }
-                    Some(..) => SelCanceled,
-                    None => SelCanceled,
-                };
-                // Undo our decrement above, and we should be guaranteed that the
-                // previous value is positive because we're not going to sleep
-                let prev = self.bump(1);
-                assert!(prev == DISCONNECTED || prev >= 0);
-                ret
-            }
-        }
-    }
-
     // Removes a previous thread from being blocked in this port
     pub fn abort_selection(&self,
                            was_upgrade: bool) -> Result<bool, Receiver<T>> {
index b2d9f4c6491e4026c8429cd6ffa11b0d57cdb64c..3c4f8e077c922ee536340b607fc3e2c2b29179cc 100644 (file)
@@ -33,7 +33,6 @@
 
 use crate::sync::atomic::{Ordering, AtomicUsize};
 use crate::sync::mpsc::blocking::{self, WaitToken, SignalToken};
-use crate::sync::mpsc::select::StartResult::{self, Installed, Abort};
 use crate::sync::{Mutex, MutexGuard};
 use crate::time::Instant;
 
@@ -406,42 +405,6 @@ pub fn drop_port(&self) {
         while let Some(token) = queue.dequeue() { token.signal(); }
         waiter.map(|t| t.signal());
     }
-
-    ////////////////////////////////////////////////////////////////////////////
-    // select implementation
-    ////////////////////////////////////////////////////////////////////////////
-
-    // If Ok, the value is whether this port has data, if Err, then the upgraded
-    // port needs to be checked instead of this one.
-    pub fn can_recv(&self) -> bool {
-        let guard = self.lock.lock().unwrap();
-        guard.disconnected || guard.buf.size() > 0
-    }
-
-    // Attempts to start selection on this port. This can either succeed or fail
-    // because there is data waiting.
-    pub fn start_selection(&self, token: SignalToken) -> StartResult {
-        let mut guard = self.lock.lock().unwrap();
-        if guard.disconnected || guard.buf.size() > 0 {
-            Abort
-        } else {
-            match mem::replace(&mut guard.blocker, BlockedReceiver(token)) {
-                NoneBlocked => {}
-                BlockedSender(..) => unreachable!(),
-                BlockedReceiver(..) => unreachable!(),
-            }
-            Installed
-        }
-    }
-
-    // Remove a previous selecting thread from this port. This ensures that the
-    // blocked thread will no longer be visible to any other threads.
-    //
-    // The return value indicates whether there's data on this port.
-    pub fn abort_selection(&self) -> bool {
-        let mut guard = self.lock.lock().unwrap();
-        abort_selection(&mut guard)
-    }
 }
 
 impl<T> Drop for Packet<T> {
index 11ac34fcb24f6c9097fda20e33d6e944d74a6b3c..87c2318a9377c56ff3b3922915d664cd2aeaeaa8 100644 (file)
@@ -376,6 +376,8 @@ fn drop(&mut self) {
 impl<T> From<T> for Mutex<T> {
     /// Creates a new mutex in an unlocked state ready for use.
     /// This is equivalent to [`Mutex::new`].
+    ///
+    /// [`Mutex::new`]: ../../std/sync/struct.Mutex.html#method.new
     fn from(t: T) -> Self {
         Mutex::new(t)
     }
index 1299a74409560263edc6b5b3f7e71c8c6336b4fe..b1b56f321fc6b8fb162c68a7ba2362de91621ab3 100644 (file)
@@ -453,6 +453,8 @@ fn default() -> RwLock<T> {
 impl<T> From<T> for RwLock<T> {
     /// Creates a new instance of an `RwLock<T>` which is unlocked.
     /// This is equivalent to [`RwLock::new`].
+    ///
+    /// [`RwLock::new`]: ../../std/sync/struct.RwLock.html#method.new
     fn from(t: T) -> Self {
         RwLock::new(t)
     }
index 8e6f50773abfe37ee1496d78ee9ece62b16446a7..2a553b2c93bd3939b0b270d534a85555de7783a3 100644 (file)
@@ -150,7 +150,7 @@ pub fn spawn(&mut self, default: Stdio, needs_stdin: bool)
              match cvt(syscall::clone(0))? {
                  0 => {
                      drop(input);
-                     let err = self.do_exec(theirs);
+                     let Err(err) = self.do_exec(theirs);
                      let errno = err.raw_os_error().unwrap_or(syscall::EINVAL) as u32;
                      let bytes = [
                          (errno >> 24) as u8,
@@ -218,7 +218,10 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
         }
 
         match self.setup_io(default, true) {
-            Ok((_, theirs)) => unsafe { self.do_exec(theirs) },
+            Ok((_, theirs)) => unsafe {
+                let Err(e) = self.do_exec(theirs);
+                e
+            },
             Err(e) => e,
         }
     }
@@ -253,45 +256,38 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
     // allocation). Instead we just close it manually. This will never
     // have the drop glue anyway because this code never returns (the
     // child will either exec() or invoke syscall::exit)
-    unsafe fn do_exec(&mut self, stdio: ChildPipes) -> io::Error {
-        macro_rules! t {
-            ($e:expr) => (match $e {
-                Ok(e) => e,
-                Err(e) => return e,
-            })
-        }
-
+    unsafe fn do_exec(&mut self, stdio: ChildPipes) -> Result<!, io::Error> {
         if let Some(fd) = stdio.stderr.fd() {
-            t!(cvt(syscall::dup2(fd, 2, &[])));
-            let mut flags = t!(cvt(syscall::fcntl(2, syscall::F_GETFD, 0)));
+            cvt(syscall::dup2(fd, 2, &[]))?;
+            let mut flags = cvt(syscall::fcntl(2, syscall::F_GETFD, 0))?;
             flags &= ! syscall::O_CLOEXEC;
-            t!(cvt(syscall::fcntl(2, syscall::F_SETFD, flags)));
+            cvt(syscall::fcntl(2, syscall::F_SETFD, flags))?;
         }
         if let Some(fd) = stdio.stdout.fd() {
-            t!(cvt(syscall::dup2(fd, 1, &[])));
-            let mut flags = t!(cvt(syscall::fcntl(1, syscall::F_GETFD, 0)));
+            cvt(syscall::dup2(fd, 1, &[]))?;
+            let mut flags = cvt(syscall::fcntl(1, syscall::F_GETFD, 0))?;
             flags &= ! syscall::O_CLOEXEC;
-            t!(cvt(syscall::fcntl(1, syscall::F_SETFD, flags)));
+            cvt(syscall::fcntl(1, syscall::F_SETFD, flags))?;
         }
         if let Some(fd) = stdio.stdin.fd() {
-            t!(cvt(syscall::dup2(fd, 0, &[])));
-            let mut flags = t!(cvt(syscall::fcntl(0, syscall::F_GETFD, 0)));
+            cvt(syscall::dup2(fd, 0, &[]))?;
+            let mut flags = cvt(syscall::fcntl(0, syscall::F_GETFD, 0))?;
             flags &= ! syscall::O_CLOEXEC;
-            t!(cvt(syscall::fcntl(0, syscall::F_SETFD, flags)));
+            cvt(syscall::fcntl(0, syscall::F_SETFD, flags))?;
         }
 
         if let Some(g) = self.gid {
-            t!(cvt(syscall::setregid(g as usize, g as usize)));
+            cvt(syscall::setregid(g as usize, g as usize))?;
         }
         if let Some(u) = self.uid {
-            t!(cvt(syscall::setreuid(u as usize, u as usize)));
+            cvt(syscall::setreuid(u as usize, u as usize))?;
         }
         if let Some(ref cwd) = self.cwd {
-            t!(cvt(syscall::chdir(cwd)));
+            cvt(syscall::chdir(cwd))?;
         }
 
         for callback in self.closures.iter_mut() {
-            t!(callback());
+            callback()?;
         }
 
         self.env.apply();
@@ -313,9 +309,9 @@ macro_rules! t {
         };
 
         let mut file = if let Some(program) = program {
-            t!(File::open(program.as_os_str()))
+            File::open(program.as_os_str())?
         } else {
-            return io::Error::from_raw_os_error(syscall::ENOENT);
+            return Err(io::Error::from_raw_os_error(syscall::ENOENT));
         };
 
         // Push all the arguments
@@ -327,7 +323,7 @@ macro_rules! t {
             let mut shebang = [0; 2];
             let mut read = 0;
             loop {
-                match t!(reader.read(&mut shebang[read..])) {
+                match reader.read(&mut shebang[read..])? {
                     0 => break,
                     n => read += n,
                 }
@@ -338,9 +334,9 @@ macro_rules! t {
                 // First of all, since we'll be passing another file to
                 // fexec(), we need to manually check that we have permission
                 // to execute this file:
-                let uid = t!(cvt(syscall::getuid()));
-                let gid = t!(cvt(syscall::getgid()));
-                let meta = t!(file.metadata());
+                let uid = cvt(syscall::getuid())?;
+                let gid = cvt(syscall::getgid())?;
+                let meta = file.metadata()?;
 
                 let mode = if uid == meta.uid() as usize {
                     meta.mode() >> 3*2 & 0o7
@@ -350,12 +346,12 @@ macro_rules! t {
                     meta.mode() & 0o7
                 };
                 if mode & 1 == 0 {
-                    return io::Error::from_raw_os_error(syscall::EPERM);
+                    return Err(io::Error::from_raw_os_error(syscall::EPERM));
                 }
 
                 // Second of all, we need to actually read which interpreter it wants
                 let mut interpreter = Vec::new();
-                t!(reader.read_until(b'\n', &mut interpreter));
+                reader.read_until(b'\n', &mut interpreter)?;
                 // Pop one trailing newline, if any
                 if interpreter.ends_with(&[b'\n']) {
                     interpreter.pop().unwrap();
@@ -373,11 +369,11 @@ macro_rules! t {
         };
         if let Some(ref interpreter) = interpreter {
             let path: &OsStr = OsStr::from_bytes(&interpreter);
-            file = t!(File::open(path));
+            file = File::open(path)?;
 
             args.push([interpreter.as_ptr() as usize, interpreter.len()]);
         } else {
-            t!(file.seek(SeekFrom::Start(0)));
+            file.seek(SeekFrom::Start(0))?;
         }
 
         args.push([self.program.as_ptr() as usize, self.program.len()]);
@@ -396,13 +392,12 @@ macro_rules! t {
         }
 
         if let Err(err) = syscall::fexec(file.as_raw_fd(), &args, &vars) {
-            io::Error::from_raw_os_error(err.errno as i32)
+            Err(io::Error::from_raw_os_error(err.errno as i32))
         } else {
             panic!("return from exec without err");
         }
     }
 
-
     fn setup_io(&self, default: Stdio, needs_stdin: bool)
                 -> io::Result<(StdioPipes, ChildPipes)> {
         let null = Stdio::Null;
index 220b1fd453131e1ffd2cfb75c3867bd97b956266..80fe763aecc888266398d400e8ce0feb87895349 100644 (file)
@@ -47,7 +47,7 @@ pub fn spawn(&mut self, default: Stdio, needs_stdin: bool)
             match result {
                 0 => {
                     drop(input);
-                    let err = self.do_exec(theirs, envp.as_ref());
+                    let Err(err) = self.do_exec(theirs, envp.as_ref());
                     let errno = err.raw_os_error().unwrap_or(libc::EINVAL) as u32;
                     let bytes = [
                         (errno >> 24) as u8,
@@ -123,7 +123,8 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
                     // environment lock before we try to exec.
                     let _lock = sys::os::env_lock();
 
-                    self.do_exec(theirs, envp.as_ref())
+                    let Err(e) = self.do_exec(theirs, envp.as_ref());
+                    e
                 }
             }
             Err(e) => e,
@@ -164,29 +165,22 @@ unsafe fn do_exec(
         &mut self,
         stdio: ChildPipes,
         maybe_envp: Option<&CStringArray>
-    ) -> io::Error {
+    ) -> Result<!, io::Error> {
         use crate::sys::{self, cvt_r};
 
-        macro_rules! t {
-            ($e:expr) => (match $e {
-                Ok(e) => e,
-                Err(e) => return e,
-            })
-        }
-
         if let Some(fd) = stdio.stdin.fd() {
-            t!(cvt_r(|| libc::dup2(fd, libc::STDIN_FILENO)));
+            cvt_r(|| libc::dup2(fd, libc::STDIN_FILENO))?;
         }
         if let Some(fd) = stdio.stdout.fd() {
-            t!(cvt_r(|| libc::dup2(fd, libc::STDOUT_FILENO)));
+            cvt_r(|| libc::dup2(fd, libc::STDOUT_FILENO))?;
         }
         if let Some(fd) = stdio.stderr.fd() {
-            t!(cvt_r(|| libc::dup2(fd, libc::STDERR_FILENO)));
+            cvt_r(|| libc::dup2(fd, libc::STDERR_FILENO))?;
         }
 
         if cfg!(not(any(target_os = "l4re"))) {
             if let Some(u) = self.get_gid() {
-                t!(cvt(libc::setgid(u as gid_t)));
+                cvt(libc::setgid(u as gid_t))?;
             }
             if let Some(u) = self.get_uid() {
                 // When dropping privileges from root, the `setgroups` call
@@ -198,11 +192,11 @@ macro_rules! t {
                 // privilege dropping function.
                 let _ = libc::setgroups(0, ptr::null());
 
-                t!(cvt(libc::setuid(u as uid_t)));
+                cvt(libc::setuid(u as uid_t))?;
             }
         }
         if let Some(ref cwd) = *self.get_cwd() {
-            t!(cvt(libc::chdir(cwd.as_ptr())));
+            cvt(libc::chdir(cwd.as_ptr()))?;
         }
 
         // emscripten has no signal support.
@@ -225,18 +219,18 @@ macro_rules! t {
                              0,
                              mem::size_of::<libc::sigset_t>());
             } else {
-                t!(cvt(libc::sigemptyset(&mut set)));
+                cvt(libc::sigemptyset(&mut set))?;
             }
-            t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &set,
-                                         ptr::null_mut())));
+            cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &set,
+                                         ptr::null_mut()))?;
             let ret = sys::signal(libc::SIGPIPE, libc::SIG_DFL);
             if ret == libc::SIG_ERR {
-                return io::Error::last_os_error()
+                return Err(io::Error::last_os_error())
             }
         }
 
         for callback in self.get_closures().iter_mut() {
-            t!(callback());
+            callback()?;
         }
 
         // Although we're performing an exec here we may also return with an
@@ -261,7 +255,7 @@ fn drop(&mut self) {
         }
 
         libc::execvp(self.get_argv()[0], self.get_argv().as_ptr());
-        io::Error::last_os_error()
+        Err(io::Error::last_os_error())
     }
 
     #[cfg(not(any(target_os = "macos", target_os = "freebsd",
index 77f1439e17b10324c7d67d25ab036d7755a27922..71c62461ee9cb4aef5aa6e01652c37165842f25e 100644 (file)
@@ -47,7 +47,12 @@ fn getrandom_fill_bytes(v: &mut [u8]) -> bool {
                 let err = errno() as libc::c_int;
                 if err == libc::EINTR {
                     continue;
-                } else if err == libc::ENOSYS {
+                } else if err == libc::ENOSYS || err == libc::EPERM {
+                    // Fall back to reading /dev/urandom if `getrandom` is not
+                    // supported on the current kernel.
+                    //
+                    // Also fall back in case it is disabled by something like
+                    // seccomp or inside of virtual machines.
                     GETRANDOM_UNAVAILABLE.store(true, Ordering::Relaxed);
                     return false;
                 } else if err == libc::EAGAIN {
index fce28ffd9c3880714fab7b8727459e6efd74f5cf..35de4f4008b6723a67aa2c567ee4fde6987c0067 100644 (file)
@@ -443,6 +443,7 @@ pub fn spawn<F, T>(self, f: F) -> io::Result<JoinHandle<T>> where
     /// [`Builder::spawn`]: ../../std/thread/struct.Builder.html#method.spawn
     /// [`io::Result`]: ../../std/io/type.Result.html
     /// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html
+    /// [`JoinHandle::join`]: ../../std/thread/struct.JoinHandle.html#method.join
     #[unstable(feature = "thread_spawn_unchecked", issue = "55132")]
     pub unsafe fn spawn_unchecked<'a, F, T>(self, f: F) -> io::Result<JoinHandle<T>> where
         F: FnOnce() -> T, F: Send + 'a, T: Send + 'a
index d12240655e6289abf36f3ac437870eb4be5c4458..a6bb47bef87e0ad5a9fc20fd4bf4abc3bd9d5023 100644 (file)
@@ -16,7 +16,7 @@
 
 use rustc_data_structures::indexed_vec::Idx;
 #[cfg(target_arch = "x86_64")]
-use rustc_data_structures::static_assert;
+use rustc_data_structures::static_assert_size;
 use rustc_target::spec::abi::Abi;
 use syntax_pos::{Span, DUMMY_SP};
 
@@ -72,11 +72,7 @@ pub struct Path {
 impl PartialEq<Symbol> for Path {
     fn eq(&self, symbol: &Symbol) -> bool {
         self.segments.len() == 1 && {
-            let name = self.segments[0].ident.name;
-            // Make sure these symbols are pure strings
-            debug_assert!(!symbol.is_gensymed());
-            debug_assert!(!name.is_gensymed());
-            name == *symbol
+            self.segments[0].ident.name == *symbol
         }
     }
 }
@@ -964,7 +960,7 @@ pub struct Expr {
 
 // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
 #[cfg(target_arch = "x86_64")]
-static_assert!(MEM_SIZE_OF_EXPR: std::mem::size_of::<Expr>() == 96);
+static_assert_size!(Expr, 96);
 
 impl Expr {
     /// Whether this expression would be valid somewhere that expects a value; for example, an `if`
index d94a3165b0f1d1fdd50ca3da6f166ab28a56bec0..592b40df1764e36c8fec5a757481480bcbb1b5f2 100644 (file)
@@ -22,7 +22,7 @@
 use crate::parse::{self, ParseSess, PResult};
 use crate::parse::token::{self, Token};
 use crate::ptr::P;
-use crate::symbol::{keywords, Symbol};
+use crate::symbol::{keywords, Symbol, sym};
 use crate::ThinVec;
 use crate::tokenstream::{TokenStream, TokenTree, DelimSpan};
 use crate::GLOBALS;
@@ -323,7 +323,7 @@ pub fn with_desugared_doc<T, F>(&self, f: F) -> T where
         if self.is_sugared_doc {
             let comment = self.value_str().unwrap();
             let meta = mk_name_value_item_str(
-                Ident::from_str("doc"),
+                Ident::with_empty_ctxt(sym::doc),
                 dummy_spanned(Symbol::intern(&strip_doc_comment_decoration(&comment.as_str()))));
             let mut attr = if self.style == ast::AttrStyle::Outer {
                 mk_attr_outer(self.span, self.id, meta)
@@ -414,7 +414,7 @@ pub fn mk_sugared_doc_attr(id: AttrId, text: Symbol, span: Span) -> Attribute {
     Attribute {
         id,
         style,
-        path: Path::from_ident(Ident::from_str("doc").with_span_pos(span)),
+        path: Path::from_ident(Ident::with_empty_ctxt(sym::doc).with_span_pos(span)),
         tokens: MetaItemKind::NameValue(lit).tokens(span),
         is_sugared_doc: true,
         span,
index 21024eb41ef50bca6cff6a3cad733bd6d293e666..c988dc61bec449034082097b18c8ab4e7582a311 100644 (file)
@@ -7,7 +7,7 @@
 use crate::ext::build::AstBuilder;
 use crate::parse::token;
 use crate::ptr::P;
-use crate::symbol::{keywords, Symbol};
+use crate::symbol::keywords;
 use crate::tokenstream::{TokenTree};
 
 use smallvec::smallvec;
@@ -121,13 +121,13 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt<'_>,
 
     let span = span.apply_mark(ecx.current_expansion.mark);
 
-    let sym = Ident::new(Symbol::gensym(&format!("__register_diagnostic_{}", code)), span);
+    let name = Ident::from_str_and_span(&format!("__register_diagnostic_{}", code), span).gensym();
 
     MacEager::items(smallvec![
         ecx.item_mod(
             span,
             span,
-            sym,
+            name,
             vec![],
             vec![],
         )
index 0a88d2f8824d3f3d34ad908dff6c9ada3a299201..489fac4f1ca4c642d8a5c290d3e86391abc8afef 100644 (file)
@@ -5,7 +5,7 @@
 use crate::source_map::{SourceMap, Spanned, respan};
 use crate::edition::Edition;
 use crate::ext::expand::{self, AstFragment, Invocation};
-use crate::ext::hygiene::{self, Mark, SyntaxContext, Transparency};
+use crate::ext::hygiene::{Mark, SyntaxContext, Transparency};
 use crate::mut_visit::{self, MutVisitor};
 use crate::parse::{self, parser, DirectoryOwnership};
 use crate::parse::token;
@@ -713,7 +713,7 @@ pub fn default_transparency(&self) -> Transparency {
         }
     }
 
-    pub fn edition(&self) -> Edition {
+    pub fn edition(&self, default_edition: Edition) -> Edition {
         match *self {
             SyntaxExtension::NormalTT { edition, .. } |
             SyntaxExtension::DeclMacro { edition, .. } |
@@ -725,7 +725,7 @@ pub fn edition(&self) -> Edition {
             SyntaxExtension::IdentTT { .. } |
             SyntaxExtension::MultiDecorator(..) |
             SyntaxExtension::MultiModifier(..) |
-            SyntaxExtension::BuiltinDerive(..) => hygiene::default_edition(),
+            SyntaxExtension::BuiltinDerive(..) => default_edition,
         }
     }
 }
@@ -734,6 +734,7 @@ pub fn edition(&self) -> Edition {
 
 pub trait Resolver {
     fn next_node_id(&mut self) -> ast::NodeId;
+
     fn get_module_scope(&mut self, id: ast::NodeId) -> Mark;
 
     fn resolve_dollar_crates(&mut self, fragment: &AstFragment);
@@ -768,6 +769,7 @@ pub fn determined(determined: bool) -> Determinacy {
 
 impl Resolver for DummyResolver {
     fn next_node_id(&mut self) -> ast::NodeId { ast::DUMMY_NODE_ID }
+
     fn get_module_scope(&mut self, _id: ast::NodeId) -> Mark { Mark::root() }
 
     fn resolve_dollar_crates(&mut self, _fragment: &AstFragment) {}
index a24e09f127eaeef07012848accc355eb46d3951f..6e789c4c7086b71ad6036a0654573b2a02ee6b8e 100644 (file)
@@ -1,6 +1,6 @@
 use crate::attr::HasAttrs;
 use crate::ast;
-use crate::source_map::{hygiene, ExpnInfo, ExpnFormat};
+use crate::source_map::{ExpnInfo, ExpnFormat};
 use crate::ext::base::ExtCtxt;
 use crate::ext::build::AstBuilder;
 use crate::parse::parser::PathStyle;
@@ -64,7 +64,7 @@ pub fn add_derived_markers<T>(cx: &mut ExtCtxt<'_>, span: Span, traits: &[ast::P
         ].into()),
         allow_internal_unsafe: false,
         local_inner_macros: false,
-        edition: hygiene::default_edition(),
+        edition: cx.parse_sess.edition,
     });
 
     let span = span.with_ctxt(cx.backtrace());
index a286fd83e3c208ff8b5d802e816f188006241e48..478ae4de82b74958eb23ed5942171a7a25c47e76 100644 (file)
@@ -5,7 +5,7 @@
 use crate::config::StripUnconfigured;
 use crate::ext::base::*;
 use crate::ext::derive::{add_derived_markers, collect_derives};
-use crate::ext::hygiene::{self, Mark, SyntaxContext};
+use crate::ext::hygiene::{Mark, SyntaxContext};
 use crate::ext::placeholders::{placeholder, PlaceholderExpander};
 use crate::feature_gate::{self, Features, GateIssue, is_builtin_attr, emit_feature_err};
 use crate::mut_visit::*;
@@ -560,7 +560,7 @@ fn expand_attr_invoc(&mut self,
             allow_internal_unstable: None,
             allow_internal_unsafe: false,
             local_inner_macros: false,
-            edition: ext.edition(),
+            edition: ext.edition(self.cx.parse_sess.edition),
         });
 
         match *ext {
@@ -805,7 +805,7 @@ fn expand_bang_invoc(&mut self,
                         allow_internal_unstable: allow_internal_unstable.clone(),
                         allow_internal_unsafe: false,
                         local_inner_macros: false,
-                        edition: hygiene::default_edition(),
+                        edition: self.cx.parse_sess.edition,
                     });
 
                     let input: Vec<_> = mac.node.stream().into_trees().collect();
@@ -921,7 +921,7 @@ fn expand_derive_invoc(&mut self,
             allow_internal_unstable: None,
             allow_internal_unsafe: false,
             local_inner_macros: false,
-            edition: ext.edition(),
+            edition: ext.edition(self.cx.parse_sess.edition),
         };
 
         match *ext {
@@ -1522,19 +1522,19 @@ fn visit_attribute(&mut self, at: &mut ast::Attribute) {
                             let include_info = vec![
                                 ast::NestedMetaItem::MetaItem(
                                     attr::mk_name_value_item_str(
-                                        Ident::from_str("file"),
+                                        Ident::with_empty_ctxt(sym::file),
                                         dummy_spanned(file),
                                     ),
                                 ),
                                 ast::NestedMetaItem::MetaItem(
                                     attr::mk_name_value_item_str(
-                                        Ident::from_str("contents"),
+                                        Ident::with_empty_ctxt(sym::contents),
                                         dummy_spanned(src_interned),
                                     ),
                                 ),
                             ];
 
-                            let include_ident = Ident::from_str("include");
+                            let include_ident = Ident::with_empty_ctxt(sym::include);
                             let item = attr::mk_list_item(DUMMY_SP, include_ident, include_info);
                             items.push(ast::NestedMetaItem::MetaItem(item));
                         }
@@ -1600,7 +1600,7 @@ fn visit_attribute(&mut self, at: &mut ast::Attribute) {
                 }
             }
 
-            let meta = attr::mk_list_item(DUMMY_SP, Ident::from_str("doc"), items);
+            let meta = attr::mk_list_item(DUMMY_SP, Ident::with_empty_ctxt(sym::doc), items);
             match at.style {
                 ast::AttrStyle::Inner => *at = attr::mk_spanned_attr_inner(at.span, at.id, meta),
                 ast::AttrStyle::Outer => *at = attr::mk_spanned_attr_outer(at.span, at.id, meta),
index 06651750de74198c31ce8f66ea5cd88b3ea85969..672b7b4285522b1a13ba1911510257d0f80db99a 100644 (file)
@@ -252,8 +252,8 @@ pub fn compile(
     def: &ast::Item,
     edition: Edition
 ) -> SyntaxExtension {
-    let lhs_nm = ast::Ident::with_empty_ctxt(Symbol::gensym("lhs"));
-    let rhs_nm = ast::Ident::with_empty_ctxt(Symbol::gensym("rhs"));
+    let lhs_nm = ast::Ident::from_str("lhs").gensym();
+    let rhs_nm = ast::Ident::from_str("rhs").gensym();
 
     // Parse the macro_rules! invocation
     let body = match def.node {
index 8a066f3f4a093a82c2fd96c84727d31a166520c3..5b1a9bb739ff8346ec9e889b313d0bebf67129e2 100644 (file)
@@ -998,7 +998,7 @@ pub fn is_builtin_attr(attr: &ast::Attribute) -> bool {
     (sym::repr, Normal, template!(List: "C, packed, ..."), Ungated),
     (sym::path, Normal, template!(NameValueStr: "file"), Ungated),
     (sym::automatically_derived, Normal, template!(Word), Ungated),
-    (sym::no_mangle, Normal, template!(Word), Ungated),
+    (sym::no_mangle, Whitelisted, template!(Word), Ungated),
     (sym::no_link, Normal, template!(Word), Ungated),
     (sym::derive, Normal, template!(List: "Trait1, Trait2, ..."), Ungated),
     (
index db10ab7af5a72efac4abb98577202274b9233776..5eda975bc9ee464c62c8aafedcde336a1b5c0118 100644 (file)
@@ -29,6 +29,7 @@
 use rustc_data_structures::bit_set::GrowableBitSet;
 pub use rustc_data_structures::thin_vec::ThinVec;
 use ast::AttrId;
+use syntax_pos::edition::Edition;
 
 // A variant of 'try!' that panics on an Err. This is used as a crutch on the
 // way towards a non-panic!-prone parser. It should be used for fatal parsing
@@ -82,26 +83,32 @@ pub struct Globals {
 }
 
 impl Globals {
-    fn new() -> Globals {
+    fn new(edition: Edition) -> Globals {
         Globals {
             // We have no idea how many attributes their will be, so just
             // initiate the vectors with 0 bits. We'll grow them as necessary.
             used_attrs: Lock::new(GrowableBitSet::new_empty()),
             known_attrs: Lock::new(GrowableBitSet::new_empty()),
-            syntax_pos_globals: syntax_pos::Globals::new(),
+            syntax_pos_globals: syntax_pos::Globals::new(edition),
         }
     }
 }
 
-pub fn with_globals<F, R>(f: F) -> R
+pub fn with_globals<F, R>(edition: Edition, f: F) -> R
     where F: FnOnce() -> R
 {
-    let globals = Globals::new();
+    let globals = Globals::new(edition);
     GLOBALS.set(&globals, || {
         syntax_pos::GLOBALS.set(&globals.syntax_pos_globals, f)
     })
 }
 
+pub fn with_default_globals<F, R>(f: F) -> R
+    where F: FnOnce() -> R
+{
+    with_globals(edition::DEFAULT_EDITION, f)
+}
+
 scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals);
 
 #[macro_use]
index f587e63e12b94b428e663f79a97c71a65c3bc754..8fdd15a029f13808d002543c65656ee71884040c 100644 (file)
@@ -1305,7 +1305,7 @@ mod tests {
     use crate::util::parser_testing::{string_to_crate, matches_codepattern};
     use crate::print::pprust;
     use crate::mut_visit;
-    use crate::with_globals;
+    use crate::with_default_globals;
     use super::*;
 
     // this version doesn't care about getting comments or docstrings in.
@@ -1343,7 +1343,7 @@ macro_rules! assert_pred {
 
     // make sure idents get transformed everywhere
     #[test] fn ident_transformation () {
-        with_globals(|| {
+        with_default_globals(|| {
             let mut zz_visitor = ToZzIdentMutVisitor;
             let mut krate = string_to_crate(
                 "#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}".to_string());
@@ -1358,7 +1358,7 @@ macro_rules! assert_pred {
 
     // even inside macro defs....
     #[test] fn ident_transformation_in_defs () {
-        with_globals(|| {
+        with_default_globals(|| {
             let mut zz_visitor = ToZzIdentMutVisitor;
             let mut krate = string_to_crate(
                 "macro_rules! a {(b $c:expr $(d $e:token)f+ => \
index 32e1ee94f0dfb702f8ce3667b888e73a95c322d7..1a2393be806d55d037f2faef1ef558bcb0fe142b 100644 (file)
@@ -1,14 +1,16 @@
 use crate::ast;
-use crate::ast::{Expr, ExprKind, Item, ItemKind, Pat, PatKind, QSelf, Ty, TyKind};
-use crate::parse::parser::PathStyle;
+use crate::ast::{BlockCheckMode, Expr, ExprKind, Item, ItemKind, Pat, PatKind, QSelf, Ty, TyKind};
+use crate::parse::parser::{BlockMode, PathStyle, TokenType, SemiColonMode};
 use crate::parse::token;
 use crate::parse::PResult;
 use crate::parse::Parser;
 use crate::print::pprust;
 use crate::ptr::P;
+use crate::symbol::keywords;
 use crate::ThinVec;
-use errors::Applicability;
+use errors::{Applicability, DiagnosticBuilder};
 use syntax_pos::Span;
+use log::debug;
 
 pub trait RecoverQPath: Sized + 'static {
     const PATH_STYLE: PathStyle = PathStyle::Expr;
@@ -223,4 +225,300 @@ impl<'a> Parser<'a> {
             false
         }
     }
+
+    /// Consume alternative await syntaxes like `await <expr>`, `await? <expr>`, `await(<expr>)`
+    /// and `await { <expr> }`.
+    crate fn parse_incorrect_await_syntax(
+        &mut self,
+        lo: Span,
+        await_sp: Span,
+    ) -> PResult<'a, (Span, ExprKind)> {
+        let is_question = self.eat(&token::Question); // Handle `await? <expr>`.
+        let expr = if self.token == token::OpenDelim(token::Brace) {
+            // Handle `await { <expr> }`.
+            // This needs to be handled separatedly from the next arm to avoid
+            // interpreting `await { <expr> }?` as `<expr>?.await`.
+            self.parse_block_expr(
+                None,
+                self.span,
+                BlockCheckMode::Default,
+                ThinVec::new(),
+            )
+        } else {
+            self.parse_expr()
+        }.map_err(|mut err| {
+            err.span_label(await_sp, "while parsing this incorrect await expression");
+            err
+        })?;
+        let expr_str = self.sess.source_map().span_to_snippet(expr.span)
+            .unwrap_or_else(|_| pprust::expr_to_string(&expr));
+        let suggestion = format!("{}.await{}", expr_str, if is_question { "?" } else { "" });
+        let sp = lo.to(expr.span);
+        let app = match expr.node {
+            ExprKind::Try(_) => Applicability::MaybeIncorrect, // `await <expr>?`
+            _ => Applicability::MachineApplicable,
+        };
+        self.struct_span_err(sp, "incorrect use of `await`")
+            .span_suggestion(sp, "`await` is a postfix operation", suggestion, app)
+            .emit();
+        Ok((sp, ExprKind::Await(ast::AwaitOrigin::FieldLike, expr)))
+    }
+
+    /// If encountering `future.await()`, consume and emit error.
+    crate fn recover_from_await_method_call(&mut self) {
+        if self.token == token::OpenDelim(token::Paren) &&
+            self.look_ahead(1, |t| t == &token::CloseDelim(token::Paren))
+        {
+            // future.await()
+            let lo = self.span;
+            self.bump(); // (
+            let sp = lo.to(self.span);
+            self.bump(); // )
+            self.struct_span_err(sp, "incorrect use of `await`")
+                .span_suggestion(
+                    sp,
+                    "`await` is not a method call, remove the parentheses",
+                    String::new(),
+                    Applicability::MachineApplicable,
+                ).emit()
+        }
+    }
+
+    crate fn could_ascription_be_path(&self, node: &ast::ExprKind) -> bool {
+        self.token.is_ident() &&
+            if let ast::ExprKind::Path(..) = node { true } else { false } &&
+            !self.token.is_reserved_ident() &&           // v `foo:bar(baz)`
+            self.look_ahead(1, |t| t == &token::OpenDelim(token::Paren)) ||
+            self.look_ahead(1, |t| t == &token::Lt) &&     // `foo:bar<baz`
+            self.look_ahead(2, |t| t.is_ident()) ||
+            self.look_ahead(1, |t| t == &token::Colon) &&  // `foo:bar:baz`
+            self.look_ahead(2, |t| t.is_ident()) ||
+            self.look_ahead(1, |t| t == &token::ModSep) &&  // `foo:bar::baz`
+            self.look_ahead(2, |t| t.is_ident())
+    }
+
+    crate fn bad_type_ascription(
+        &self,
+        err: &mut DiagnosticBuilder<'a>,
+        lhs_span: Span,
+        cur_op_span: Span,
+        next_sp: Span,
+        maybe_path: bool,
+    ) {
+        err.span_label(self.span, "expecting a type here because of type ascription");
+        let cm = self.sess.source_map();
+        let next_pos = cm.lookup_char_pos(next_sp.lo());
+        let op_pos = cm.lookup_char_pos(cur_op_span.hi());
+        if op_pos.line != next_pos.line {
+            err.span_suggestion(
+                cur_op_span,
+                "try using a semicolon",
+                ";".to_string(),
+                Applicability::MaybeIncorrect,
+            );
+        } else {
+            if maybe_path {
+                err.span_suggestion(
+                    cur_op_span,
+                    "maybe you meant to write a path separator here",
+                    "::".to_string(),
+                    Applicability::MaybeIncorrect,
+                );
+            } else {
+                err.note("type ascription is a nightly-only feature that lets \
+                          you annotate an expression with a type: `<expr>: <type>`")
+                    .span_note(
+                        lhs_span,
+                        "this expression expects an ascribed type after the colon",
+                    )
+                    .help("this might be indicative of a syntax error elsewhere");
+            }
+        }
+    }
+
+    crate fn recover_seq_parse_error(
+        &mut self,
+        delim: token::DelimToken,
+        lo: Span,
+        result: PResult<'a, P<Expr>>,
+    ) -> P<Expr> {
+        match result {
+            Ok(x) => x,
+            Err(mut err) => {
+                err.emit();
+                // recover from parse error
+                self.consume_block(delim);
+                self.mk_expr(lo.to(self.prev_span), ExprKind::Err, ThinVec::new())
+            }
+        }
+    }
+
+    crate fn recover_closing_delimiter(
+        &mut self,
+        tokens: &[token::Token],
+        mut err: DiagnosticBuilder<'a>,
+    ) -> PResult<'a, bool> {
+        let mut pos = None;
+        // we want to use the last closing delim that would apply
+        for (i, unmatched) in self.unclosed_delims.iter().enumerate().rev() {
+            if tokens.contains(&token::CloseDelim(unmatched.expected_delim))
+                && Some(self.span) > unmatched.unclosed_span
+            {
+                pos = Some(i);
+            }
+        }
+        match pos {
+            Some(pos) => {
+                // Recover and assume that the detected unclosed delimiter was meant for
+                // this location. Emit the diagnostic and act as if the delimiter was
+                // present for the parser's sake.
+
+                 // Don't attempt to recover from this unclosed delimiter more than once.
+                let unmatched = self.unclosed_delims.remove(pos);
+                let delim = TokenType::Token(token::CloseDelim(unmatched.expected_delim));
+
+                 // We want to suggest the inclusion of the closing delimiter where it makes
+                // the most sense, which is immediately after the last token:
+                //
+                //  {foo(bar {}}
+                //      -      ^
+                //      |      |
+                //      |      help: `)` may belong here (FIXME: #58270)
+                //      |
+                //      unclosed delimiter
+                if let Some(sp) = unmatched.unclosed_span {
+                    err.span_label(sp, "unclosed delimiter");
+                }
+                err.span_suggestion_short(
+                    self.sess.source_map().next_point(self.prev_span),
+                    &format!("{} may belong here", delim.to_string()),
+                    delim.to_string(),
+                    Applicability::MaybeIncorrect,
+                );
+                err.emit();
+                self.expected_tokens.clear();  // reduce errors
+                Ok(true)
+            }
+            _ => Err(err),
+        }
+    }
+
+    /// Recover from `pub` keyword in places where it seems _reasonable_ but isn't valid.
+    crate fn eat_bad_pub(&mut self) {
+        if self.token.is_keyword(keywords::Pub) {
+            match self.parse_visibility(false) {
+                Ok(vis) => {
+                    self.diagnostic()
+                        .struct_span_err(vis.span, "unnecessary visibility qualifier")
+                        .span_label(vis.span, "`pub` not permitted here")
+                        .emit();
+                }
+                Err(mut err) => err.emit(),
+            }
+        }
+    }
+
+    // Eat tokens until we can be relatively sure we reached the end of the
+    // statement. This is something of a best-effort heuristic.
+    //
+    // We terminate when we find an unmatched `}` (without consuming it).
+    crate fn recover_stmt(&mut self) {
+        self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore)
+    }
+
+    // If `break_on_semi` is `Break`, then we will stop consuming tokens after
+    // finding (and consuming) a `;` outside of `{}` or `[]` (note that this is
+    // approximate - it can mean we break too early due to macros, but that
+    // should only lead to sub-optimal recovery, not inaccurate parsing).
+    //
+    // If `break_on_block` is `Break`, then we will stop consuming tokens
+    // after finding (and consuming) a brace-delimited block.
+    crate fn recover_stmt_(&mut self, break_on_semi: SemiColonMode, break_on_block: BlockMode) {
+        let mut brace_depth = 0;
+        let mut bracket_depth = 0;
+        let mut in_block = false;
+        debug!("recover_stmt_ enter loop (semi={:?}, block={:?})",
+               break_on_semi, break_on_block);
+        loop {
+            debug!("recover_stmt_ loop {:?}", self.token);
+            match self.token {
+                token::OpenDelim(token::DelimToken::Brace) => {
+                    brace_depth += 1;
+                    self.bump();
+                    if break_on_block == BlockMode::Break &&
+                       brace_depth == 1 &&
+                       bracket_depth == 0 {
+                        in_block = true;
+                    }
+                }
+                token::OpenDelim(token::DelimToken::Bracket) => {
+                    bracket_depth += 1;
+                    self.bump();
+                }
+                token::CloseDelim(token::DelimToken::Brace) => {
+                    if brace_depth == 0 {
+                        debug!("recover_stmt_ return - close delim {:?}", self.token);
+                        break;
+                    }
+                    brace_depth -= 1;
+                    self.bump();
+                    if in_block && bracket_depth == 0 && brace_depth == 0 {
+                        debug!("recover_stmt_ return - block end {:?}", self.token);
+                        break;
+                    }
+                }
+                token::CloseDelim(token::DelimToken::Bracket) => {
+                    bracket_depth -= 1;
+                    if bracket_depth < 0 {
+                        bracket_depth = 0;
+                    }
+                    self.bump();
+                }
+                token::Eof => {
+                    debug!("recover_stmt_ return - Eof");
+                    break;
+                }
+                token::Semi => {
+                    self.bump();
+                    if break_on_semi == SemiColonMode::Break &&
+                       brace_depth == 0 &&
+                       bracket_depth == 0 {
+                        debug!("recover_stmt_ return - Semi");
+                        break;
+                    }
+                }
+                token::Comma if break_on_semi == SemiColonMode::Comma &&
+                       brace_depth == 0 &&
+                       bracket_depth == 0 =>
+                {
+                    debug!("recover_stmt_ return - Semi");
+                    break;
+                }
+                _ => {
+                    self.bump()
+                }
+            }
+        }
+    }
+
+    crate fn consume_block(&mut self, delim: token::DelimToken) {
+        let mut brace_depth = 0;
+        loop {
+            if self.eat(&token::OpenDelim(delim)) {
+                brace_depth += 1;
+            } else if self.eat(&token::CloseDelim(delim)) {
+                if brace_depth == 0 {
+                    return;
+                } else {
+                    brace_depth -= 1;
+                    continue;
+                }
+            } else if self.token == token::Eof || self.eat(&token::CloseDelim(token::NoDelim)) {
+                return;
+            } else {
+                self.bump();
+            }
+        }
+    }
+
 }
index 47da3ee6a6c7817c1b770f9d2fd00cc884737db9..c97d804076157e039d827e66c61acd6a9f22adf0 100644 (file)
@@ -1558,10 +1558,10 @@ mod tests {
     use crate::feature_gate::UnstableFeatures;
     use crate::parse::token;
     use crate::diagnostics::plugin::ErrorMap;
-    use crate::with_globals;
+    use crate::with_default_globals;
     use std::io;
     use std::path::PathBuf;
-    use syntax_pos::{BytePos, Span, NO_EXPANSION};
+    use syntax_pos::{BytePos, Span, NO_EXPANSION, edition::Edition};
     use rustc_data_structures::fx::{FxHashSet, FxHashMap};
     use rustc_data_structures::sync::Lock;
 
@@ -1581,6 +1581,7 @@ fn mk_sess(sm: Lrc<SourceMap>) -> ParseSess {
             raw_identifier_spans: Lock::new(Vec::new()),
             registered_diagnostics: Lock::new(ErrorMap::new()),
             buffered_lints: Lock::new(vec![]),
+            edition: Edition::from_session(),
             ambiguous_block_expr_parse: Lock::new(FxHashMap::default()),
         }
     }
@@ -1601,7 +1602,7 @@ fn setup<'a>(sm: &SourceMap,
 
     #[test]
     fn t1() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             let mut string_reader = setup(&sm,
@@ -1649,7 +1650,7 @@ fn mk_ident(id: &str) -> token::Token {
 
     #[test]
     fn doublecolonparsing() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             check_tokenization(setup(&sm, &sh, "a b".to_string()),
@@ -1659,7 +1660,7 @@ fn doublecolonparsing() {
 
     #[test]
     fn dcparsing_2() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             check_tokenization(setup(&sm, &sh, "a::b".to_string()),
@@ -1669,7 +1670,7 @@ fn dcparsing_2() {
 
     #[test]
     fn dcparsing_3() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             check_tokenization(setup(&sm, &sh, "a ::b".to_string()),
@@ -1679,7 +1680,7 @@ fn dcparsing_3() {
 
     #[test]
     fn dcparsing_4() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             check_tokenization(setup(&sm, &sh, "a:: b".to_string()),
@@ -1689,7 +1690,7 @@ fn dcparsing_4() {
 
     #[test]
     fn character_a() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             assert_eq!(setup(&sm, &sh, "'a'".to_string()).next_token().tok,
@@ -1699,7 +1700,7 @@ fn character_a() {
 
     #[test]
     fn character_space() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             assert_eq!(setup(&sm, &sh, "' '".to_string()).next_token().tok,
@@ -1709,7 +1710,7 @@ fn character_space() {
 
     #[test]
     fn character_escaped() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             assert_eq!(setup(&sm, &sh, "'\\n'".to_string()).next_token().tok,
@@ -1719,7 +1720,7 @@ fn character_escaped() {
 
     #[test]
     fn lifetime_name() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             assert_eq!(setup(&sm, &sh, "'abc".to_string()).next_token().tok,
@@ -1729,7 +1730,7 @@ fn lifetime_name() {
 
     #[test]
     fn raw_string() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             assert_eq!(setup(&sm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string())
@@ -1741,7 +1742,7 @@ fn raw_string() {
 
     #[test]
     fn literal_suffixes() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             macro_rules! test {
@@ -1787,7 +1788,7 @@ fn line_doc_comments() {
 
     #[test]
     fn nested_block_comments() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             let mut lexer = setup(&sm, &sh, "/* /* */ */'a'".to_string());
@@ -1802,7 +1803,7 @@ fn nested_block_comments() {
 
     #[test]
     fn crlf_comments() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(sm.clone());
             let mut lexer = setup(&sm, &sh, "// test\r\n/// test\r\n".to_string());
index 0611c1d9b42a5a6dd88791c5809e6848d5b97556..d574626e6dbcc305dcbec2fcd9a85621c7899409 100644 (file)
@@ -13,6 +13,7 @@
 use errors::{Applicability, FatalError, Level, Handler, ColorConfig, Diagnostic, DiagnosticBuilder};
 use rustc_data_structures::sync::{Lrc, Lock};
 use syntax_pos::{Span, SourceFile, FileName, MultiSpan};
+use syntax_pos::edition::Edition;
 
 use rustc_data_structures::fx::{FxHashSet, FxHashMap};
 use std::borrow::Cow;
@@ -38,6 +39,7 @@ pub struct ParseSess {
     pub span_diagnostic: Handler,
     pub unstable_features: UnstableFeatures,
     pub config: CrateConfig,
+    pub edition: Edition,
     pub missing_fragment_specifiers: Lock<FxHashSet<Span>>,
     /// Places where raw identifiers were used. This is used for feature-gating raw identifiers.
     pub raw_identifier_spans: Lock<Vec<Span>>,
@@ -74,6 +76,7 @@ pub fn with_span_handler(handler: Handler, source_map: Lrc<SourceMap>) -> ParseS
             included_mod_stack: Lock::new(vec![]),
             source_map,
             buffered_lints: Lock::new(vec![]),
+            edition: Edition::from_session(),
             ambiguous_block_expr_parse: Lock::new(FxHashMap::default()),
         }
     }
@@ -363,7 +366,7 @@ mod tests {
     use crate::tokenstream::{DelimSpan, TokenTree};
     use crate::util::parser_testing::string_to_stream;
     use crate::util::parser_testing::{string_to_expr, string_to_item};
-    use crate::with_globals;
+    use crate::with_default_globals;
     use syntax_pos::{Span, BytePos, Pos, NO_EXPANSION};
 
     /// Parses an item.
@@ -382,7 +385,7 @@ fn sp(a: u32, b: u32) -> Span {
 
     #[should_panic]
     #[test] fn bad_path_expr_1() {
-        with_globals(|| {
+        with_default_globals(|| {
             string_to_expr("::abc::def::return".to_string());
         })
     }
@@ -390,7 +393,7 @@ fn sp(a: u32, b: u32) -> Span {
     // check the token-tree-ization of macros
     #[test]
     fn string_to_tts_macro () {
-        with_globals(|| {
+        with_default_globals(|| {
             use crate::symbol::sym;
 
             let tts: Vec<_> =
@@ -447,7 +450,7 @@ fn string_to_tts_macro () {
 
     #[test]
     fn string_to_tts_1() {
-        with_globals(|| {
+        with_default_globals(|| {
             let tts = string_to_stream("fn a (b : i32) { b; }".to_string());
 
             let expected = TokenStream::new(vec![
@@ -480,7 +483,7 @@ fn string_to_tts_1() {
     }
 
     #[test] fn parse_use() {
-        with_globals(|| {
+        with_default_globals(|| {
             let use_s = "use foo::bar::baz;";
             let vitem = string_to_item(use_s.to_string()).unwrap();
             let vitem_s = item_to_string(&vitem);
@@ -494,7 +497,7 @@ fn string_to_tts_1() {
     }
 
     #[test] fn parse_extern_crate() {
-        with_globals(|| {
+        with_default_globals(|| {
             let ex_s = "extern crate foo;";
             let vitem = string_to_item(ex_s.to_string()).unwrap();
             let vitem_s = item_to_string(&vitem);
@@ -531,7 +534,7 @@ fn visit_pat(&mut self, p: &'a ast::Pat) {
     }
 
     #[test] fn span_of_self_arg_pat_idents_are_correct() {
-        with_globals(|| {
+        with_default_globals(|| {
 
             let srcs = ["impl z { fn a (&self, &myarg: i32) {} }",
                         "impl z { fn a (&mut self, &myarg: i32) {} }",
@@ -551,7 +554,7 @@ fn visit_pat(&mut self, p: &'a ast::Pat) {
     }
 
     #[test] fn parse_exprs () {
-        with_globals(|| {
+        with_default_globals(|| {
             // just make sure that they parse....
             string_to_expr("3 + 4".to_string());
             string_to_expr("a::z.froob(b,&(987+3))".to_string());
@@ -559,7 +562,7 @@ fn visit_pat(&mut self, p: &'a ast::Pat) {
     }
 
     #[test] fn attrs_fix_bug () {
-        with_globals(|| {
+        with_default_globals(|| {
             string_to_item("pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
                    -> Result<Box<Writer>, String> {
     #[cfg(windows)]
@@ -576,7 +579,7 @@ fn wb() -> c_int { O_WRONLY as c_int }
     }
 
     #[test] fn crlf_doc_comments() {
-        with_globals(|| {
+        with_default_globals(|| {
             use crate::symbol::sym;
 
             let sess = ParseSess::new(FilePathMapping::empty());
@@ -613,7 +616,7 @@ fn parse_expr_from_source_str(
             new_parser_from_source_str(sess, name, source).parse_expr()
         }
 
-        with_globals(|| {
+        with_default_globals(|| {
             let sess = ParseSess::new(FilePathMapping::empty());
             let expr = parse_expr_from_source_str(PathBuf::from("foo").into(),
                 "foo!( fn main() { body } )".to_string(), &sess).unwrap();
@@ -637,7 +640,7 @@ fn parse_expr_from_source_str(
     // See `recurse_into_file_modules` in the parser.
     #[test]
     fn out_of_line_mod() {
-        with_globals(|| {
+        with_default_globals(|| {
             let sess = ParseSess::new(FilePathMapping::empty());
             let item = parse_item_from_source_str(
                 PathBuf::from("foo").into(),
index 99e8db9d8e6d2ec8fabc1f982c4176a8fbdb9181..24d120376def15092077d3b91594222bbcc8491d 100644 (file)
@@ -104,14 +104,14 @@ pub enum PathStyle {
 }
 
 #[derive(Clone, Copy, PartialEq, Debug)]
-enum SemiColonMode {
+crate enum SemiColonMode {
     Break,
     Ignore,
     Comma,
 }
 
 #[derive(Clone, Copy, PartialEq, Debug)]
-enum BlockMode {
+crate enum BlockMode {
     Break,
     Ignore,
 }
@@ -352,7 +352,7 @@ fn next_desugared(&mut self) -> TokenAndSpan {
         let body = TokenTree::Delimited(
             delim_span,
             token::Bracket,
-            [TokenTree::Token(sp, token::Ident(ast::Ident::from_str("doc"), false)),
+            [TokenTree::Token(sp, token::Ident(ast::Ident::with_empty_ctxt(sym::doc), false)),
              TokenTree::Token(sp, token::Eq),
              TokenTree::Token(sp, token::Literal(
                 token::StrRaw(Symbol::intern(&stripped), num_of_hashes), None))
@@ -389,7 +389,7 @@ fn next_desugared(&mut self) -> TokenAndSpan {
 }
 
 impl TokenType {
-    fn to_string(&self) -> String {
+    crate fn to_string(&self) -> String {
         match *self {
             TokenType::Token(ref t) => format!("`{}`", pprust::token_to_string(t)),
             TokenType::Keyword(kw) => format!("`{}`", kw.name()),
@@ -673,56 +673,6 @@ pub fn expect(&mut self, t: &token::Token) -> PResult<'a,  bool /* recovered */>
         }
     }
 
-    fn recover_closing_delimiter(
-        &mut self,
-        tokens: &[token::Token],
-        mut err: DiagnosticBuilder<'a>,
-    ) -> PResult<'a, bool> {
-        let mut pos = None;
-        // we want to use the last closing delim that would apply
-        for (i, unmatched) in self.unclosed_delims.iter().enumerate().rev() {
-            if tokens.contains(&token::CloseDelim(unmatched.expected_delim))
-                && Some(self.span) > unmatched.unclosed_span
-            {
-                pos = Some(i);
-            }
-        }
-        match pos {
-            Some(pos) => {
-                // Recover and assume that the detected unclosed delimiter was meant for
-                // this location. Emit the diagnostic and act as if the delimiter was
-                // present for the parser's sake.
-
-                 // Don't attempt to recover from this unclosed delimiter more than once.
-                let unmatched = self.unclosed_delims.remove(pos);
-                let delim = TokenType::Token(token::CloseDelim(unmatched.expected_delim));
-
-                 // We want to suggest the inclusion of the closing delimiter where it makes
-                // the most sense, which is immediately after the last token:
-                //
-                //  {foo(bar {}}
-                //      -      ^
-                //      |      |
-                //      |      help: `)` may belong here (FIXME: #58270)
-                //      |
-                //      unclosed delimiter
-                if let Some(sp) = unmatched.unclosed_span {
-                    err.span_label(sp, "unclosed delimiter");
-                }
-                err.span_suggestion_short(
-                    self.sess.source_map().next_point(self.prev_span),
-                    &format!("{} may belong here", delim.to_string()),
-                    delim.to_string(),
-                    Applicability::MaybeIncorrect,
-                );
-                err.emit();
-                self.expected_tokens.clear();  // reduce errors
-                Ok(true)
-            }
-            _ => Err(err),
-        }
-    }
-
     /// Expect next token to be edible or inedible token.  If edible,
     /// then consume it; if inedible, then return without consuming
     /// anything.  Signal a fatal error if next token is unexpected.
@@ -2343,7 +2293,7 @@ fn parse_field(&mut self) -> PResult<'a, Field> {
         })
     }
 
-    fn mk_expr(&self, span: Span, node: ExprKind, attrs: ThinVec<Attribute>) -> P<Expr> {
+    crate fn mk_expr(&self, span: Span, node: ExprKind, attrs: ThinVec<Attribute>) -> P<Expr> {
         P(Expr { node, span, attrs, id: ast::DUMMY_NODE_ID })
     }
 
@@ -2629,14 +2579,9 @@ fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>> {
                     db.note("variable declaration using `let` is a statement");
                     return Err(db);
                 } else if self.span.rust_2018() && self.eat_keyword(keywords::Await) {
-                    // FIXME: remove this branch when `await!` is no longer supported
-                    // https://github.com/rust-lang/rust/issues/60610
-                    self.expect(&token::Not)?;
-                    self.expect(&token::OpenDelim(token::Paren))?;
-                    let expr = self.parse_expr()?;
-                    self.expect(&token::CloseDelim(token::Paren))?;
-                    hi = self.prev_span;
-                    ex = ExprKind::Await(ast::AwaitOrigin::MacroLike, expr);
+                    let (await_hi, e_kind) = self.parse_await_macro_or_alt(lo, self.prev_span)?;
+                    hi = await_hi;
+                    ex = e_kind;
                 } else if self.token.is_path_start() {
                     let path = self.parse_path(PathStyle::Expr)?;
 
@@ -2701,6 +2646,31 @@ fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>> {
         self.maybe_recover_from_bad_qpath(expr, true)
     }
 
+    /// Parse `await!(<expr>)` calls, or alternatively recover from incorrect but reasonable
+    /// alternative syntaxes `await <expr>`, `await? <expr>`, `await(<expr>)` and
+    /// `await { <expr> }`.
+    fn parse_await_macro_or_alt(
+        &mut self,
+        lo: Span,
+        await_sp: Span,
+    ) -> PResult<'a, (Span, ExprKind)> {
+        if self.token == token::Not {
+            // Handle correct `await!(<expr>)`.
+            // FIXME: make this an error when `await!` is no longer supported
+            // https://github.com/rust-lang/rust/issues/60610
+            self.expect(&token::Not)?;
+            self.expect(&token::OpenDelim(token::Paren))?;
+            let expr = self.parse_expr().map_err(|mut err| {
+                err.span_label(await_sp, "while parsing this await macro call");
+                err
+            })?;
+            self.expect(&token::CloseDelim(token::Paren))?;
+            Ok((self.prev_span, ExprKind::Await(ast::AwaitOrigin::MacroLike, expr)))
+        } else { // Handle `await <expr>`.
+            self.parse_incorrect_await_syntax(lo, await_sp)
+        }
+    }
+
     fn maybe_parse_struct_expr(
         &mut self,
         lo: Span,
@@ -2849,10 +2819,13 @@ fn parse_or_use_outer_attributes(&mut self,
     }
 
     /// Parses a block or unsafe block.
-    fn parse_block_expr(&mut self, opt_label: Option<Label>,
-                            lo: Span, blk_mode: BlockCheckMode,
-                            outer_attrs: ThinVec<Attribute>)
-                            -> PResult<'a, P<Expr>> {
+    crate fn parse_block_expr(
+        &mut self,
+        opt_label: Option<Label>,
+        lo: Span,
+        blk_mode: BlockCheckMode,
+        outer_attrs: ThinVec<Attribute>,
+    ) -> PResult<'a, P<Expr>> {
         self.expect(&token::OpenDelim(token::Brace))?;
 
         let mut attrs = outer_attrs;
@@ -2913,6 +2886,7 @@ fn parse_dot_suffix(&mut self, self_arg: P<Expr>, lo: Span) -> PResult<'a, P<Exp
                 ExprKind::Await(ast::AwaitOrigin::FieldLike, self_arg),
                 ThinVec::new(),
             );
+            self.recover_from_await_method_call();
             return Ok(await_expr);
         }
         let segment = self.parse_path_segment(PathStyle::Expr)?;
@@ -3151,23 +3125,6 @@ fn parse_dot_or_call_expr_with_(&mut self, e0: P<Expr>, lo: Span) -> PResult<'a,
         return Ok(e);
     }
 
-    fn recover_seq_parse_error(
-        &mut self,
-        delim: token::DelimToken,
-        lo: Span,
-        result: PResult<'a, P<Expr>>,
-    ) -> P<Expr> {
-        match result {
-            Ok(x) => x,
-            Err(mut err) => {
-                err.emit();
-                // recover from parse error
-                self.consume_block(delim);
-                self.mk_expr(lo.to(self.prev_span), ExprKind::Err, ThinVec::new())
-            }
-        }
-    }
-
     crate fn process_potential_macro_variable(&mut self) {
         let (token, span) = match self.token {
             token::Dollar if self.span.ctxt() != syntax_pos::hygiene::SyntaxContext::empty() &&
@@ -3540,8 +3497,7 @@ fn parse_assoc_expr_with(&mut self,
                     let binary = self.mk_binary(source_map::respan(cur_op_span, ast_op), lhs, rhs);
                     self.mk_expr(span, binary, ThinVec::new())
                 }
-                AssocOp::Assign =>
-                    self.mk_expr(span, ExprKind::Assign(lhs, rhs), ThinVec::new()),
+                AssocOp::Assign => self.mk_expr(span, ExprKind::Assign(lhs, rhs), ThinVec::new()),
                 AssocOp::ObsoleteInPlace =>
                     self.mk_expr(span, ExprKind::ObsoleteInPlace(lhs, rhs), ThinVec::new()),
                 AssocOp::AssignOp(k) => {
@@ -3570,58 +3526,6 @@ fn parse_assoc_expr_with(&mut self,
         Ok(lhs)
     }
 
-    fn could_ascription_be_path(&self, node: &ast::ExprKind) -> bool {
-        self.token.is_ident() &&
-            if let ast::ExprKind::Path(..) = node { true } else { false } &&
-            !self.token.is_reserved_ident() &&           // v `foo:bar(baz)`
-            self.look_ahead(1, |t| t == &token::OpenDelim(token::Paren)) ||
-            self.look_ahead(1, |t| t == &token::Lt) &&     // `foo:bar<baz`
-            self.look_ahead(2, |t| t.is_ident()) ||
-            self.look_ahead(1, |t| t == &token::Colon) &&  // `foo:bar:baz`
-            self.look_ahead(2, |t| t.is_ident()) ||
-            self.look_ahead(1, |t| t == &token::ModSep) &&  // `foo:bar::baz`
-            self.look_ahead(2, |t| t.is_ident())
-    }
-
-    fn bad_type_ascription(
-        &self,
-        err: &mut DiagnosticBuilder<'a>,
-        lhs_span: Span,
-        cur_op_span: Span,
-        next_sp: Span,
-        maybe_path: bool,
-    ) {
-        err.span_label(self.span, "expecting a type here because of type ascription");
-        let cm = self.sess.source_map();
-        let next_pos = cm.lookup_char_pos(next_sp.lo());
-        let op_pos = cm.lookup_char_pos(cur_op_span.hi());
-        if op_pos.line != next_pos.line {
-            err.span_suggestion(
-                cur_op_span,
-                "try using a semicolon",
-                ";".to_string(),
-                Applicability::MaybeIncorrect,
-            );
-        } else {
-            if maybe_path {
-                err.span_suggestion(
-                    cur_op_span,
-                    "maybe you meant to write a path separator here",
-                    "::".to_string(),
-                    Applicability::MaybeIncorrect,
-                );
-            } else {
-                err.note("type ascription is a nightly-only feature that lets \
-                          you annotate an expression with a type: `<expr>: <type>`");
-                err.span_note(
-                    lhs_span,
-                    "this expression expects an ascribed type after the colon",
-                );
-                err.help("this might be indicative of a syntax error elsewhere");
-            }
-        }
-    }
-
     fn parse_assoc_op_cast(&mut self, lhs: P<Expr>, lhs_span: Span,
                            expr_kind: fn(P<Expr>, P<Ty>) -> ExprKind)
                            -> PResult<'a, P<Expr>> {
@@ -4903,92 +4807,6 @@ pub fn parse_stmt(&mut self) -> PResult<'a, Option<Stmt>> {
         Ok(self.parse_stmt_(true))
     }
 
-    // Eat tokens until we can be relatively sure we reached the end of the
-    // statement. This is something of a best-effort heuristic.
-    //
-    // We terminate when we find an unmatched `}` (without consuming it).
-    fn recover_stmt(&mut self) {
-        self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore)
-    }
-
-    // If `break_on_semi` is `Break`, then we will stop consuming tokens after
-    // finding (and consuming) a `;` outside of `{}` or `[]` (note that this is
-    // approximate - it can mean we break too early due to macros, but that
-    // should only lead to sub-optimal recovery, not inaccurate parsing).
-    //
-    // If `break_on_block` is `Break`, then we will stop consuming tokens
-    // after finding (and consuming) a brace-delimited block.
-    fn recover_stmt_(&mut self, break_on_semi: SemiColonMode, break_on_block: BlockMode) {
-        let mut brace_depth = 0;
-        let mut bracket_depth = 0;
-        let mut in_block = false;
-        debug!("recover_stmt_ enter loop (semi={:?}, block={:?})",
-               break_on_semi, break_on_block);
-        loop {
-            debug!("recover_stmt_ loop {:?}", self.token);
-            match self.token {
-                token::OpenDelim(token::DelimToken::Brace) => {
-                    brace_depth += 1;
-                    self.bump();
-                    if break_on_block == BlockMode::Break &&
-                       brace_depth == 1 &&
-                       bracket_depth == 0 {
-                        in_block = true;
-                    }
-                }
-                token::OpenDelim(token::DelimToken::Bracket) => {
-                    bracket_depth += 1;
-                    self.bump();
-                }
-                token::CloseDelim(token::DelimToken::Brace) => {
-                    if brace_depth == 0 {
-                        debug!("recover_stmt_ return - close delim {:?}", self.token);
-                        break;
-                    }
-                    brace_depth -= 1;
-                    self.bump();
-                    if in_block && bracket_depth == 0 && brace_depth == 0 {
-                        debug!("recover_stmt_ return - block end {:?}", self.token);
-                        break;
-                    }
-                }
-                token::CloseDelim(token::DelimToken::Bracket) => {
-                    bracket_depth -= 1;
-                    if bracket_depth < 0 {
-                        bracket_depth = 0;
-                    }
-                    self.bump();
-                }
-                token::Eof => {
-                    debug!("recover_stmt_ return - Eof");
-                    break;
-                }
-                token::Semi => {
-                    self.bump();
-                    if break_on_semi == SemiColonMode::Break &&
-                       brace_depth == 0 &&
-                       bracket_depth == 0 {
-                        debug!("recover_stmt_ return - Semi");
-                        break;
-                    }
-                }
-                token::Comma => {
-                    if break_on_semi == SemiColonMode::Comma &&
-                       brace_depth == 0 &&
-                       bracket_depth == 0 {
-                        debug!("recover_stmt_ return - Semi");
-                        break;
-                    } else {
-                        self.bump();
-                    }
-                }
-                _ => {
-                    self.bump()
-                }
-            }
-        }
-    }
-
     fn parse_stmt_(&mut self, macro_legacy_warnings: bool) -> Option<Stmt> {
         self.parse_stmt_without_recovery(macro_legacy_warnings).unwrap_or_else(|mut e| {
             e.emit();
@@ -6892,26 +6710,6 @@ fn parse_item_union(&mut self) -> PResult<'a, ItemInfo> {
         Ok((class_name, ItemKind::Union(vdata, generics), None))
     }
 
-    fn consume_block(&mut self, delim: token::DelimToken) {
-        let mut brace_depth = 0;
-        loop {
-            if self.eat(&token::OpenDelim(delim)) {
-                brace_depth += 1;
-            } else if self.eat(&token::CloseDelim(delim)) {
-                if brace_depth == 0 {
-                    return;
-                } else {
-                    brace_depth -= 1;
-                    continue;
-                }
-            } else if self.token == token::Eof || self.eat(&token::CloseDelim(token::NoDelim)) {
-                return;
-            } else {
-                self.bump();
-            }
-        }
-    }
-
     fn parse_record_struct_body(
         &mut self,
     ) -> PResult<'a, (Vec<StructField>, /* recovered */ bool)> {
@@ -7213,7 +7011,8 @@ fn parse_item_mod(&mut self, outer_attrs: &[Attribute]) -> PResult<'a, ItemInfo>
                     let attr = Attribute {
                         id: attr::mk_attr_id(),
                         style: ast::AttrStyle::Outer,
-                        path: ast::Path::from_ident(Ident::from_str("warn_directory_ownership")),
+                        path: ast::Path::from_ident(
+                            Ident::with_empty_ctxt(sym::warn_directory_ownership)),
                         tokens: TokenStream::empty(),
                         is_sugared_doc: false,
                         span: syntax_pos::DUMMY_SP,
@@ -8609,21 +8408,6 @@ fn report_invalid_macro_expansion_item(&self) {
         ).emit();
     }
 
-    /// Recover from `pub` keyword in places where it seems _reasonable_ but isn't valid.
-    fn eat_bad_pub(&mut self) {
-        if self.token.is_keyword(keywords::Pub) {
-            match self.parse_visibility(false) {
-                Ok(vis) => {
-                    let mut err = self.diagnostic()
-                        .struct_span_err(vis.span, "unnecessary visibility qualifier");
-                    err.span_label(vis.span, "`pub` not permitted here");
-                    err.emit();
-                }
-                Err(mut err) => err.emit(),
-            }
-        }
-    }
-
     /// When lowering a `async fn` to the HIR, we need to move all of the arguments of the function
     /// into the generated closure so that they are dropped when the future is polled and not when
     /// it is created.
index 049fb6cb78b84f241bc5144ae4771b2c6b5de822..068fc41c87a0baadcff9b67938019cef4880684b 100644 (file)
@@ -19,7 +19,7 @@
 use std::fmt;
 use std::mem;
 #[cfg(target_arch = "x86_64")]
-use rustc_data_structures::static_assert;
+use rustc_data_structures::static_assert_size;
 use rustc_data_structures::sync::Lrc;
 
 #[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
@@ -74,7 +74,7 @@ pub enum Lit {
 }
 
 #[cfg(target_arch = "x86_64")]
-static_assert!(MEM_SIZE_OF_LIT: mem::size_of::<Lit>() == 8);
+static_assert_size!(Lit, 8);
 
 impl Lit {
     crate fn literal_name(&self) -> &'static str {
@@ -220,7 +220,7 @@ pub enum Token {
 
 // `Token` is used a lot. Make sure it doesn't unintentionally get bigger.
 #[cfg(target_arch = "x86_64")]
-static_assert!(MEM_SIZE_OF_STATEMENT: mem::size_of::<Token>() == 16);
+static_assert_size!(Token, 16);
 
 impl Token {
     /// Recovers a `Token` from an `ast::Ident`. This creates a raw identifier if necessary.
index 86db7a673d471afb105089d2d4e9541029d790a8..ac240359b56b6f68387852472028a725640997e1 100644 (file)
@@ -13,7 +13,7 @@
 use crate::print::pp::Breaks::{Consistent, Inconsistent};
 use crate::ptr::P;
 use crate::std_inject;
-use crate::symbol::keywords;
+use crate::symbol::{keywords, sym};
 use crate::tokenstream::{self, TokenStream, TokenTree};
 
 use rustc_target::spec::abi::{self, Abi};
@@ -89,13 +89,14 @@ pub fn print_crate<'a>(cm: &'a SourceMap,
         // of the feature gate, so we fake them up here.
 
         // #![feature(prelude_import)]
-        let pi_nested = attr::mk_nested_word_item(ast::Ident::from_str("prelude_import"));
-        let list = attr::mk_list_item(DUMMY_SP, ast::Ident::from_str("feature"), vec![pi_nested]);
+        let pi_nested = attr::mk_nested_word_item(ast::Ident::with_empty_ctxt(sym::prelude_import));
+        let list = attr::mk_list_item(
+            DUMMY_SP, ast::Ident::with_empty_ctxt(sym::feature), vec![pi_nested]);
         let fake_attr = attr::mk_attr_inner(DUMMY_SP, attr::mk_attr_id(), list);
         s.print_attribute(&fake_attr)?;
 
         // #![no_std]
-        let no_std_meta = attr::mk_word_item(ast::Ident::from_str("no_std"));
+        let no_std_meta = attr::mk_word_item(ast::Ident::with_empty_ctxt(sym::no_std));
         let fake_attr = attr::mk_attr_inner(DUMMY_SP, attr::mk_attr_id(), no_std_meta);
         s.print_attribute(&fake_attr)?;
     }
@@ -3146,12 +3147,12 @@ mod tests {
 
     use crate::ast;
     use crate::source_map;
-    use crate::with_globals;
+    use crate::with_default_globals;
     use syntax_pos;
 
     #[test]
     fn test_fun_to_string() {
-        with_globals(|| {
+        with_default_globals(|| {
             let abba_ident = ast::Ident::from_str("abba");
 
             let decl = ast::FnDecl {
@@ -3179,7 +3180,7 @@ fn test_fun_to_string() {
 
     #[test]
     fn test_variant_to_string() {
-        with_globals(|| {
+        with_default_globals(|| {
             let ident = ast::Ident::from_str("principal_skinner");
 
             let var = source_map::respan(syntax_pos::DUMMY_SP, ast::Variant_ {
index 215618bd09ca375538e98701de332977dad45e3d..8a210db91858ebb046da7023e668b6886d1478f8 100644 (file)
@@ -947,7 +947,7 @@ pub fn mark_span_with_reason(
             allow_internal_unstable,
             allow_internal_unsafe: false,
             local_inner_macros: false,
-            edition: hygiene::default_edition(),
+            edition: edition::Edition::from_session(),
         });
         span.with_ctxt(SyntaxContext::empty().apply_mark(mark))
     }
index f08fdcc6fb53cd9a58b898b78a9000a9ece7532b..e01a3260d4993a5e878ef3bc8e92ca617eb0470b 100644 (file)
@@ -2,8 +2,8 @@
 use crate::attr;
 use crate::edition::Edition;
 use crate::ext::hygiene::{Mark, SyntaxContext};
-use crate::symbol::{Symbol, keywords, sym};
-use crate::source_map::{ExpnInfo, MacroAttribute, dummy_spanned, hygiene, respan};
+use crate::symbol::{Ident, Symbol, keywords, sym};
+use crate::source_map::{ExpnInfo, MacroAttribute, dummy_spanned, respan};
 use crate::ptr::P;
 use crate::tokenstream::TokenStream;
 
@@ -14,7 +14,7 @@
 /// Craft a span that will be ignored by the stability lint's
 /// call to source_map's `is_internal` check.
 /// The expanded code uses the unstable `#[prelude_import]` attribute.
-fn ignored_span(sp: Span) -> Span {
+fn ignored_span(sp: Span, edition: Edition) -> Span {
     let mark = Mark::fresh(Mark::root());
     mark.set_expn_info(ExpnInfo {
         call_site: DUMMY_SP,
@@ -25,7 +25,7 @@ fn ignored_span(sp: Span) -> Span {
         ].into()),
         allow_internal_unsafe: false,
         local_inner_macros: false,
-        edition: hygiene::default_edition(),
+        edition,
     });
     sp.with_ctxt(SyntaxContext::empty().apply_mark(mark))
 }
@@ -63,26 +63,25 @@ pub fn maybe_inject_crates_ref(
 
     // .rev() to preserve ordering above in combination with insert(0, ...)
     let alt_std_name = alt_std_name.map(Symbol::intern);
-    for orig_name in names.iter().rev() {
-        let orig_name = Symbol::intern(orig_name);
-        let mut rename = orig_name;
+    for orig_name_str in names.iter().rev() {
         // HACK(eddyb) gensym the injected crates on the Rust 2018 edition,
         // so they don't accidentally interfere with the new import paths.
-        if rust_2018 {
-            rename = orig_name.gensymed();
-        }
-        let orig_name = if rename != orig_name {
-            Some(orig_name)
+        let orig_name_sym = Symbol::intern(orig_name_str);
+        let orig_name_ident = Ident::with_empty_ctxt(orig_name_sym);
+        let (rename, orig_name) = if rust_2018 {
+            (orig_name_ident.gensym(), Some(orig_name_sym))
         } else {
-            None
+            (orig_name_ident, None)
         };
         krate.module.items.insert(0, P(ast::Item {
-            attrs: vec![attr::mk_attr_outer(DUMMY_SP,
-                                            attr::mk_attr_id(),
-                                            attr::mk_word_item(ast::Ident::from_str("macro_use")))],
+            attrs: vec![attr::mk_attr_outer(
+                DUMMY_SP,
+                attr::mk_attr_id(),
+                attr::mk_word_item(ast::Ident::with_empty_ctxt(sym::macro_use))
+            )],
             vis: dummy_spanned(ast::VisibilityKind::Inherited),
             node: ast::ItemKind::ExternCrate(alt_std_name.or(orig_name)),
-            ident: ast::Ident::with_empty_ctxt(rename),
+            ident: rename,
             id: ast::DUMMY_NODE_ID,
             span: DUMMY_SP,
             tokens: None,
@@ -95,7 +94,7 @@ pub fn maybe_inject_crates_ref(
 
     INJECTED_CRATE_NAME.with(|opt_name| opt_name.set(Some(name)));
 
-    let span = ignored_span(DUMMY_SP);
+    let span = ignored_span(DUMMY_SP, edition);
     krate.module.items.insert(0, P(ast::Item {
         attrs: vec![ast::Attribute {
             style: ast::AttrStyle::Outer,
index 21bc236d00e6b805dd62ec546460598d0c90849b..7cd83f3e495be5a1094b2a56f56b79c9124eea9b 100644 (file)
@@ -171,7 +171,7 @@ impl MutVisitor for EntryPointCleaner {
             EntryPointType::MainAttr |
             EntryPointType::Start =>
                 item.map(|ast::Item {id, ident, attrs, node, vis, span, tokens}| {
-                    let allow_ident = Ident::from_str("allow");
+                    let allow_ident = Ident::with_empty_ctxt(sym::allow);
                     let dc_nested = attr::mk_nested_word_item(Ident::from_str("dead_code"));
                     let allow_dead_code_item = attr::mk_list_item(DUMMY_SP, allow_ident,
                                                                   vec![dc_nested]);
@@ -215,7 +215,7 @@ fn mk_reexport_mod(cx: &mut TestCtxt<'_>,
                    tests: Vec<Ident>,
                    tested_submods: Vec<(Ident, Ident)>)
                    -> (P<ast::Item>, Ident) {
-    let super_ = Ident::from_str("super");
+    let super_ = Ident::with_empty_ctxt(keywords::Super.name());
 
     let items = tests.into_iter().map(|r| {
         cx.ext_cx.item_use_simple(DUMMY_SP, dummy_spanned(ast::VisibilityKind::Public),
@@ -232,11 +232,11 @@ fn mk_reexport_mod(cx: &mut TestCtxt<'_>,
         items,
     };
 
-    let sym = Ident::with_empty_ctxt(Symbol::gensym("__test_reexports"));
+    let name = Ident::from_str("__test_reexports").gensym();
     let parent = if parent == ast::DUMMY_NODE_ID { ast::CRATE_NODE_ID } else { parent };
     cx.ext_cx.current_expansion.mark = cx.ext_cx.resolver.get_module_scope(parent);
     let it = cx.ext_cx.monotonic_expander().flat_map_item(P(ast::Item {
-        ident: sym,
+        ident: name,
         attrs: Vec::new(),
         id: ast::DUMMY_NODE_ID,
         node: ast::ItemKind::Mod(reexport_mod),
@@ -245,7 +245,7 @@ fn mk_reexport_mod(cx: &mut TestCtxt<'_>,
         tokens: None,
     })).pop().unwrap();
 
-    (it, sym)
+    (it, name)
 }
 
 /// Crawl over the crate, inserting test reexports and the test main function
@@ -291,7 +291,7 @@ fn generate_test_harness(sess: &ParseSess,
         ].into()),
         allow_internal_unsafe: false,
         local_inner_macros: false,
-        edition: hygiene::default_edition(),
+        edition: sess.edition,
     });
 
     TestHarnessGenerator {
@@ -373,9 +373,10 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
                            main_body);
 
     // Honor the reexport_test_harness_main attribute
-    let main_id = Ident::new(
-        cx.reexport_test_harness_main.unwrap_or(Symbol::gensym("main")),
-        sp);
+    let main_id = match cx.reexport_test_harness_main {
+        Some(sym) => Ident::new(sym, sp),
+        None => Ident::from_str_and_span("main", sp).gensym(),
+    };
 
     P(ast::Item {
         ident: main_id,
index 3cf6699538de0cb59767d5eaa78602acf6b6afa2..107cbe70a23d7aef0d4a1058f41da25bf3bd9be2 100644 (file)
@@ -1,5 +1,5 @@
 use crate::source_map::{SourceMap, FilePathMapping};
-use crate::with_globals;
+use crate::with_default_globals;
 
 use errors::Handler;
 use errors::emitter::EmitterWriter;
@@ -39,7 +39,7 @@ fn flush(&mut self) -> io::Result<()> {
 }
 
 fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &str) {
-    with_globals(|| {
+    with_default_globals(|| {
         let output = Arc::new(Mutex::new(Vec::new()));
 
         let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
index 93b5ecadd148f1f64ec62b1ba666fc2f2829d44f..79efc6bf689c4c8b75f09fa1178ccc124124a67a 100644 (file)
@@ -21,7 +21,7 @@
 
 use syntax_pos::{BytePos, Mark, Span, DUMMY_SP};
 #[cfg(target_arch = "x86_64")]
-use rustc_data_structures::static_assert;
+use rustc_data_structures::static_assert_size;
 use rustc_data_structures::sync::Lrc;
 use serialize::{Decoder, Decodable, Encoder, Encodable};
 use smallvec::{SmallVec, smallvec};
@@ -158,7 +158,7 @@ pub fn close_tt(span: Span, delim: DelimToken) -> TokenTree {
 
 // `TokenStream` is used a lot. Make sure it doesn't unintentionally get bigger.
 #[cfg(target_arch = "x86_64")]
-static_assert!(MEM_SIZE_OF_TOKEN_STREAM: mem::size_of::<TokenStream>() == 8);
+static_assert_size!(TokenStream, 8);
 
 #[derive(Clone, Copy, Debug, PartialEq)]
 pub enum IsJoint {
@@ -557,7 +557,7 @@ pub fn apply_mark(self, mark: Mark) -> Self {
 mod tests {
     use super::*;
     use crate::syntax::ast::Ident;
-    use crate::with_globals;
+    use crate::with_default_globals;
     use crate::parse::token::Token;
     use crate::util::parser_testing::string_to_stream;
     use syntax_pos::{Span, BytePos, NO_EXPANSION};
@@ -572,7 +572,7 @@ fn sp(a: u32, b: u32) -> Span {
 
     #[test]
     fn test_concat() {
-        with_globals(|| {
+        with_default_globals(|| {
             let test_res = string_to_ts("foo::bar::baz");
             let test_fst = string_to_ts("foo::bar");
             let test_snd = string_to_ts("::baz");
@@ -585,7 +585,7 @@ fn test_concat() {
 
     #[test]
     fn test_to_from_bijection() {
-        with_globals(|| {
+        with_default_globals(|| {
             let test_start = string_to_ts("foo::bar(baz)");
             let test_end = test_start.trees().collect();
             assert_eq!(test_start, test_end)
@@ -594,7 +594,7 @@ fn test_to_from_bijection() {
 
     #[test]
     fn test_eq_0() {
-        with_globals(|| {
+        with_default_globals(|| {
             let test_res = string_to_ts("foo");
             let test_eqs = string_to_ts("foo");
             assert_eq!(test_res, test_eqs)
@@ -603,7 +603,7 @@ fn test_eq_0() {
 
     #[test]
     fn test_eq_1() {
-        with_globals(|| {
+        with_default_globals(|| {
             let test_res = string_to_ts("::bar::baz");
             let test_eqs = string_to_ts("::bar::baz");
             assert_eq!(test_res, test_eqs)
@@ -612,7 +612,7 @@ fn test_eq_1() {
 
     #[test]
     fn test_eq_3() {
-        with_globals(|| {
+        with_default_globals(|| {
             let test_res = string_to_ts("");
             let test_eqs = string_to_ts("");
             assert_eq!(test_res, test_eqs)
@@ -621,7 +621,7 @@ fn test_eq_3() {
 
     #[test]
     fn test_diseq_0() {
-        with_globals(|| {
+        with_default_globals(|| {
             let test_res = string_to_ts("::bar::baz");
             let test_eqs = string_to_ts("bar::baz");
             assert_eq!(test_res == test_eqs, false)
@@ -630,7 +630,7 @@ fn test_diseq_0() {
 
     #[test]
     fn test_diseq_1() {
-        with_globals(|| {
+        with_default_globals(|| {
             let test_res = string_to_ts("(bar,baz)");
             let test_eqs = string_to_ts("bar,baz");
             assert_eq!(test_res == test_eqs, false)
@@ -639,7 +639,7 @@ fn test_diseq_1() {
 
     #[test]
     fn test_is_empty() {
-        with_globals(|| {
+        with_default_globals(|| {
             let test0: TokenStream = Vec::<TokenTree>::new().into_iter().collect();
             let test1: TokenStream =
                 TokenTree::Token(sp(0, 1), Token::Ident(Ident::from_str("a"), false)).into();
@@ -653,12 +653,14 @@ fn test_is_empty() {
 
     #[test]
     fn test_dotdotdot() {
-        let mut builder = TokenStreamBuilder::new();
-        builder.push(TokenTree::Token(sp(0, 1), Token::Dot).joint());
-        builder.push(TokenTree::Token(sp(1, 2), Token::Dot).joint());
-        builder.push(TokenTree::Token(sp(2, 3), Token::Dot));
-        let stream = builder.build();
-        assert!(stream.eq_unspanned(&string_to_ts("...")));
-        assert_eq!(stream.trees().count(), 1);
+        with_default_globals(|| {
+            let mut builder = TokenStreamBuilder::new();
+            builder.push(TokenTree::Token(sp(0, 1), Token::Dot).joint());
+            builder.push(TokenTree::Token(sp(1, 2), Token::Dot).joint());
+            builder.push(TokenTree::Token(sp(2, 3), Token::Dot));
+            let stream = builder.build();
+            assert!(stream.eq_unspanned(&string_to_ts("...")));
+            assert_eq!(stream.trees().count(), 1);
+        })
     }
 }
index 2f150d22159fa85d610de19d34e8c6c9e10bd09d..885b5a4f333b8fc74177f76f3c118e31ac2a70e4 100644 (file)
@@ -101,8 +101,8 @@ fn test_lev_distance() {
 
 #[test]
 fn test_find_best_match_for_name() {
-    use crate::with_globals;
-    with_globals(|| {
+    use crate::with_default_globals;
+    with_default_globals(|| {
         let input = vec![Symbol::intern("aaab"), Symbol::intern("aaabc")];
         assert_eq!(
             find_best_match_for_name(input.iter(), "aaaa", None),
index ccff4aec2c8c77f0bf87af561dd475436a5c39df..2127179eecb5aaee64cc80bc76ef0bdb6bf3dce2 100644 (file)
@@ -6,7 +6,7 @@
 use syntax::ast::{self, Ident, GenericArg};
 use syntax::ext::base::{self, *};
 use syntax::ext::build::AstBuilder;
-use syntax::symbol::{keywords, Symbol};
+use syntax::symbol::{keywords, Symbol, sym};
 use syntax_pos::Span;
 use syntax::tokenstream;
 
@@ -29,7 +29,8 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt<'_>,
                                      true,
                                      cx.std_path(&["option", "Option", "None"]),
                                      vec![GenericArg::Type(cx.ty_rptr(sp,
-                                                     cx.ty_ident(sp, Ident::from_str("str")),
+                                                     cx.ty_ident(sp,
+                                                                 Ident::with_empty_ctxt(sym::str)),
                                                      Some(lt),
                                                      ast::Mutability::Immutable))],
                                      vec![]))
index 508f740cac927d020e6813cb2a96e72916e621bc..e5fc7aab61db41c57f995805e9ff512546223511 100644 (file)
 use rustc_data_structures::sync::Lrc;
 use syntax::ast;
 use syntax::ext::base::{MacroExpanderFn, NormalTT, NamedSyntaxExtension, MultiModifier};
-use syntax::ext::hygiene;
 use syntax::symbol::Symbol;
+use syntax::edition::Edition;
 
 pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
-                         user_exts: Vec<NamedSyntaxExtension>) {
+                         user_exts: Vec<NamedSyntaxExtension>,
+                         edition: Edition) {
     deriving::register_builtin_derives(resolver);
 
     let mut register = |name, ext| {
         resolver.add_builtin(ast::Ident::with_empty_ctxt(name), Lrc::new(ext));
     };
-
     macro_rules! register {
         ($( $name:ident: $f:expr, )*) => { $(
             register(Symbol::intern(stringify!($name)),
@@ -63,7 +63,7 @@ macro_rules! register {
                         allow_internal_unsafe: false,
                         local_inner_macros: false,
                         unstable_feature: None,
-                        edition: hygiene::default_edition(),
+                        edition,
                     });
         )* }
     }
@@ -108,7 +108,7 @@ macro_rules! register {
                 allow_internal_unsafe: false,
                 local_inner_macros: false,
                 unstable_feature: None,
-                edition: hygiene::default_edition(),
+                edition,
             });
     register(Symbol::intern("format_args_nl"),
              NormalTT {
@@ -120,7 +120,7 @@ macro_rules! register {
                  allow_internal_unsafe: false,
                  local_inner_macros: false,
                  unstable_feature: None,
-                 edition: hygiene::default_edition(),
+                 edition,
              });
 
     for (name, ext) in user_exts {
index 1eab739cf647064b292a83dc55de61bdbb1b61f4..a13fe65ca0ddf84435fad0d33d5dfd0e6a5ba189 100644 (file)
@@ -4,7 +4,7 @@
 
 use syntax::ast::{self, Ident};
 use syntax::attr;
-use syntax::source_map::{ExpnInfo, MacroAttribute, hygiene, respan};
+use syntax::source_map::{ExpnInfo, MacroAttribute, respan};
 use syntax::ext::base::ExtCtxt;
 use syntax::ext::build::AstBuilder;
 use syntax::ext::expand::ExpansionConfig;
@@ -358,15 +358,15 @@ fn mk_decls(
         ].into()),
         allow_internal_unsafe: false,
         local_inner_macros: false,
-        edition: hygiene::default_edition(),
+        edition: cx.parse_sess.edition,
     });
     let span = DUMMY_SP.apply_mark(mark);
 
-    let hidden = cx.meta_list_item_word(span, Symbol::intern("hidden"));
-    let doc = cx.meta_list(span, Symbol::intern("doc"), vec![hidden]);
+    let hidden = cx.meta_list_item_word(span, sym::hidden);
+    let doc = cx.meta_list(span, sym::doc, vec![hidden]);
     let doc_hidden = cx.attribute(span, doc);
 
-    let proc_macro = Ident::from_str("proc_macro");
+    let proc_macro = Ident::with_empty_ctxt(sym::proc_macro);
     let krate = cx.item(span,
                         proc_macro,
                         Vec::new(),
@@ -429,7 +429,7 @@ fn mk_decls(
     let module = cx.item_mod(
         span,
         span,
-        ast::Ident::with_empty_ctxt(Symbol::gensym("decls")),
+        ast::Ident::from_str("decls").gensym(),
         vec![doc_hidden],
         vec![krate, decls_static],
     ).map(|mut i| {
index 86ae6ab5fece5cbef9b2ae6be24e8dabed05799b..8ee61a3f67f591b890b728b20266f636e0a47a82 100644 (file)
@@ -3,7 +3,7 @@
 
 use syntax::ext::base::*;
 use syntax::ext::build::AstBuilder;
-use syntax::ext::hygiene::{self, Mark, SyntaxContext};
+use syntax::ext::hygiene::{Mark, SyntaxContext};
 use syntax::attr;
 use syntax::ast;
 use syntax::print::pprust;
@@ -72,7 +72,7 @@ pub fn expand_test_or_bench(
             ].into()),
             allow_internal_unsafe: false,
             local_inner_macros: false,
-            edition: hygiene::default_edition(),
+            edition: cx.parse_sess.edition,
         });
         (item.span.with_ctxt(SyntaxContext::empty().apply_mark(mark)),
          attr_sp.with_ctxt(SyntaxContext::empty().apply_mark(mark)))
@@ -127,7 +127,7 @@ pub fn expand_test_or_bench(
         ])
     };
 
-    let mut test_const = cx.item(sp, ast::Ident::new(item.ident.name.gensymed(), sp),
+    let mut test_const = cx.item(sp, ast::Ident::new(item.ident.name, sp).gensym(),
         vec![
             // #[cfg(test)]
             cx.attribute(attr_sp, cx.meta_list(attr_sp, Symbol::intern("cfg"), vec![
index 802037f6d22bbb16f7211268d6a91c9bca497213..5b1ae167ce31543850a1475dcf5f9379536baaa6 100644 (file)
@@ -11,7 +11,7 @@
 
 use syntax::ext::base::*;
 use syntax::ext::build::AstBuilder;
-use syntax::ext::hygiene::{self, Mark, SyntaxContext};
+use syntax::ext::hygiene::{Mark, SyntaxContext};
 use syntax::ast;
 use syntax::source_map::respan;
 use syntax::symbol::{Symbol, sym};
@@ -47,7 +47,7 @@ pub fn expand(
             ].into()),
             allow_internal_unsafe: false,
             local_inner_macros: false,
-            edition: hygiene::default_edition(),
+            edition: ecx.parse_sess.edition,
         });
         attr_sp.with_ctxt(SyntaxContext::empty().apply_mark(mark))
     };
index 00cd00f2837849b10cbe646f4b7fcfc28796fada..20216568426fed72d2938c8d0fdcbee129df52e7 100644 (file)
@@ -1,6 +1,7 @@
 use crate::symbol::{Symbol, sym};
 use std::fmt;
 use std::str::FromStr;
+use crate::GLOBALS;
 
 /// The edition of the compiler (RFC 2052)
 #[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Debug, RustcEncodable, RustcDecodable, Eq)]
@@ -38,6 +39,10 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 }
 
 impl Edition {
+    pub fn from_session() -> Edition {
+        GLOBALS.with(|globals| globals.edition)
+    }
+
     pub fn lint_name(&self) -> &'static str {
         match *self {
             Edition::Edition2015 => "rust_2015_compatibility",
index 1d9dc26bf609260fa9106903f0f0eb7e8dced8e3..6e787c08504f37872cf2203c889f1db72e06879a 100644 (file)
@@ -7,7 +7,7 @@
 
 use crate::GLOBALS;
 use crate::Span;
-use crate::edition::{Edition, DEFAULT_EDITION};
+use crate::edition::Edition;
 use crate::symbol::{keywords, Symbol};
 
 use serialize::{Encodable, Decodable, Encoder, Decoder};
@@ -174,7 +174,6 @@ pub fn looks_like_proc_macro_derive(self) -> bool {
     marks: Vec<MarkData>,
     syntax_contexts: Vec<SyntaxContextData>,
     markings: FxHashMap<(SyntaxContext, Mark, Transparency), SyntaxContext>,
-    default_edition: Edition,
 }
 
 impl HygieneData {
@@ -196,7 +195,6 @@ impl HygieneData {
                 dollar_crate_name: keywords::DollarCrate.name(),
             }],
             markings: FxHashMap::default(),
-            default_edition: DEFAULT_EDITION,
         }
     }
 
@@ -205,14 +203,6 @@ fn with<T, F: FnOnce(&mut HygieneData) -> T>(f: F) -> T {
     }
 }
 
-pub fn default_edition() -> Edition {
-    HygieneData::with(|data| data.default_edition)
-}
-
-pub fn set_default_edition(edition: Edition) {
-    HygieneData::with(|data| data.default_edition = edition);
-}
-
 pub fn clear_markings() {
     HygieneData::with(|data| data.markings = FxHashMap::default());
 }
index 39859f25f97fb87b867d3abff651dc808c18d8c1..cb5aaf7eb882ffba2f382f7ad2ebfedc12dc69e5 100644 (file)
@@ -26,6 +26,7 @@
 extern crate serialize as rustc_serialize; // used by deriving
 
 pub mod edition;
+use edition::Edition;
 pub mod hygiene;
 pub use hygiene::{Mark, SyntaxContext, ExpnInfo, ExpnFormat, CompilerDesugaringKind};
 
@@ -52,14 +53,16 @@ pub struct Globals {
     symbol_interner: Lock<symbol::Interner>,
     span_interner: Lock<span_encoding::SpanInterner>,
     hygiene_data: Lock<hygiene::HygieneData>,
+    edition: Edition,
 }
 
 impl Globals {
-    pub fn new() -> Globals {
+    pub fn new(edition: Edition) -> Globals {
         Globals {
             symbol_interner: Lock::new(symbol::Interner::fresh()),
             span_interner: Lock::new(span_encoding::SpanInterner::default()),
             hygiene_data: Lock::new(hygiene::HygieneData::new()),
+            edition,
         }
     }
 }
@@ -356,8 +359,9 @@ pub fn parent(self) -> Option<Span> {
 
     /// Edition of the crate from which this span came.
     pub fn edition(self) -> edition::Edition {
-        self.ctxt().outer().expn_info().map_or_else(|| hygiene::default_edition(),
-                                                    |einfo| einfo.edition)
+        self.ctxt().outer().expn_info().map_or_else(|| {
+            Edition::from_session()
+        }, |einfo| einfo.edition)
     }
 
     #[inline]
index c2a18c9df83babe5bf0b3c78ad04cd3b8ce0006e..e69a9a1c5cfc0dbd2a8b73a4f4eb53c6890e29c7 100644 (file)
         document_private_items,
         dotdoteq_in_patterns,
         dotdot_in_tuple_patterns,
+        double_braced_crate: "{{crate}}",
+        double_braced_impl: "{{impl}}",
+        double_braced_misc: "{{misc}}",
+        double_braced_closure: "{{closure}}",
+        double_braced_constructor: "{{constructor}}",
+        double_braced_constant: "{{constant}}",
+        double_braced_opaque: "{{opaque}}",
         dropck_eyepatch,
         dropck_parametricity,
         drop_types_in_const,
         eh_personality,
         eh_unwind_resume,
         enable,
+        err,
         Err,
         except,
         exclusive_range_pattern,
         fundamental,
         future,
         Future,
+        gen_future,
         generators,
         generic_associated_types,
         generic_param_attrs,
         match_default_bindings,
         may_dangle,
         message,
+        meta,
         min_const_fn,
         min_const_unsafe_fn,
         mips_target_feature,
         never,
         never_type,
         next,
+        __next,
         nll,
         no_builtins,
         no_core,
         option,
         Option,
         opt_out_copy,
+        Output,
         overlapping_marker_traits,
         packed,
         panic_handler,
         Pending,
         pin,
         Pin,
+        pinned,
         platform_intrinsics,
         plugin,
         plugin_registrar,
         static_nobundle,
         static_recursion,
         std,
+        str,
         stmt_expr_attributes,
         stop_after_dataflow,
         struct_field_attributes,
         trivial_bounds,
         Try,
         try_blocks,
+        try_trait,
         tuple_indexing,
         ty,
         type_alias_enum_variants,
         uniform_paths,
         universal_impl_trait,
         unmarked_api,
+        unreachable_code,
         unrestricted_attribute_tokens,
         unsafe_destructor_blind_to_params,
         unsafe_no_drop_flag,
         use_nested_groups,
         usize,
         v1,
+        val,
         vis,
         visible_private_types,
         volatile,
@@ -613,10 +630,12 @@ pub struct Ident {
 
 impl Ident {
     #[inline]
+    /// Constructs a new identifier from a symbol and a span.
     pub const fn new(name: Symbol, span: Span) -> Ident {
         Ident { name, span }
     }
 
+    /// Constructs a new identifier with an empty syntax context.
     #[inline]
     pub const fn with_empty_ctxt(name: Symbol) -> Ident {
         Ident::new(name, DUMMY_SP)
@@ -627,11 +646,16 @@ pub fn from_interned_str(string: InternedString) -> Ident {
         Ident::with_empty_ctxt(string.as_symbol())
     }
 
-    /// Maps a string to an identifier with an empty syntax context.
+    /// Maps a string to an identifier with an empty span.
     pub fn from_str(string: &str) -> Ident {
         Ident::with_empty_ctxt(Symbol::intern(string))
     }
 
+    /// Maps a string and a span to an identifier.
+    pub fn from_str_and_span(string: &str, span: Span) -> Ident {
+        Ident::new(Symbol::intern(string), span)
+    }
+
     /// Replaces `lo` and `hi` with those from `span`, but keep hygiene context.
     pub fn with_span_pos(self, span: Span) -> Ident {
         Ident::new(self.name, span.with_ctxt(self.span.ctxt()))
@@ -659,14 +683,23 @@ pub fn modern_and_legacy(self) -> Ident {
         Ident::new(self.name, self.span.modern_and_legacy())
     }
 
+    /// Transforms an identifier into one with the same name, but gensymed.
     pub fn gensym(self) -> Ident {
-        Ident::new(self.name.gensymed(), self.span)
+        let name = with_interner(|interner| interner.gensymed(self.name));
+        Ident::new(name, self.span)
     }
 
+    /// Transforms an underscore identifier into one with the same name, but
+    /// gensymed. Leaves non-underscore identifiers unchanged.
     pub fn gensym_if_underscore(self) -> Ident {
         if self.name == keywords::Underscore.name() { self.gensym() } else { self }
     }
 
+    // WARNING: this function is deprecated and will be removed in the future.
+    pub fn is_gensymed(self) -> bool {
+        with_interner(|interner| interner.is_gensymed(self.name))
+    }
+
     pub fn as_str(self) -> LocalInternedString {
         self.name.as_str()
     }
@@ -719,30 +752,34 @@ fn decode<D: Decoder>(d: &mut D) -> Result<Ident, D::Error> {
         Ok(if !string.starts_with('#') {
             Ident::from_str(&string)
         } else { // FIXME(jseyfried): intercrate hygiene
-            Ident::with_empty_ctxt(Symbol::gensym(&string[1..]))
+            Ident::from_str(&string[1..]).gensym()
         })
     }
 }
 
 /// A symbol is an interned or gensymed string. A gensym is a symbol that is
-/// never equal to any other symbol. E.g.:
-/// ```
-/// assert_eq!(Symbol::intern("x"), Symbol::intern("x"))
-/// assert_ne!(Symbol::gensym("x"), Symbol::intern("x"))
-/// assert_ne!(Symbol::gensym("x"), Symbol::gensym("x"))
-/// ```
+/// never equal to any other symbol.
+///
 /// Conceptually, a gensym can be thought of as a normal symbol with an
 /// invisible unique suffix. Gensyms are useful when creating new identifiers
 /// that must not match any existing identifiers, e.g. during macro expansion
-/// and syntax desugaring.
+/// and syntax desugaring. Because gensyms should always be identifiers, all
+/// gensym operations are on `Ident` rather than `Symbol`. (Indeed, in the
+/// future the gensym-ness may be moved from `Symbol` to hygiene data.)
 ///
-/// Internally, a Symbol is implemented as an index, and all operations
+/// Examples:
+/// ```
+/// assert_eq!(Ident::from_str("x"), Ident::from_str("x"))
+/// assert_ne!(Ident::from_str("x").gensym(), Ident::from_str("x"))
+/// assert_ne!(Ident::from_str("x").gensym(), Ident::from_str("x").gensym())
+/// ```
+/// Internally, a symbol is implemented as an index, and all operations
 /// (including hashing, equality, and ordering) operate on that index. The use
 /// of `newtype_index!` means that `Option<Symbol>` only takes up 4 bytes,
 /// because `newtype_index!` reserves the last 256 values for tagging purposes.
 ///
-/// Note that `Symbol` cannot directly be a `newtype_index!` because it implements
-/// `fmt::Debug`, `Encodable`, and `Decodable` in special ways.
+/// Note that `Symbol` cannot directly be a `newtype_index!` because it
+/// implements `fmt::Debug`, `Encodable`, and `Decodable` in special ways.
 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
 pub struct Symbol(SymbolIndex);
 
@@ -760,20 +797,6 @@ pub fn intern(string: &str) -> Self {
         with_interner(|interner| interner.intern(string))
     }
 
-    /// Gensyms a new `usize`, using the current interner.
-    pub fn gensym(string: &str) -> Self {
-        with_interner(|interner| interner.gensym(string))
-    }
-
-    pub fn gensymed(self) -> Self {
-        with_interner(|interner| interner.gensymed(self))
-    }
-
-    // WARNING: this function is deprecated and will be removed in the future.
-    pub fn is_gensymed(self) -> bool {
-        with_interner(|interner| interner.is_gensymed(self))
-    }
-
     pub fn as_str(self) -> LocalInternedString {
         with_interner(|interner| unsafe {
             LocalInternedString {
@@ -881,11 +904,6 @@ fn interned(&self, symbol: Symbol) -> Symbol {
         }
     }
 
-    fn gensym(&mut self, string: &str) -> Symbol {
-        let symbol = self.intern(string);
-        self.gensymed(symbol)
-    }
-
     fn gensymed(&mut self, symbol: Symbol) -> Symbol {
         self.gensyms.push(symbol);
         Symbol::new(SymbolIndex::MAX_AS_U32 - self.gensyms.len() as u32 + 1)
@@ -1019,6 +1037,17 @@ pub struct LocalInternedString {
 }
 
 impl LocalInternedString {
+    /// Maps a string to its interned representation.
+    pub fn intern(string: &str) -> Self {
+        let string = with_interner(|interner| {
+            let symbol = interner.intern(string);
+            interner.strings[symbol.0.as_usize()]
+        });
+        LocalInternedString {
+            string: unsafe { std::mem::transmute::<&str, &str>(string) }
+        }
+    }
+
     pub fn as_interned_str(self) -> InternedString {
         InternedString {
             symbol: Symbol::intern(self.string)
@@ -1095,7 +1124,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 
 impl Decodable for LocalInternedString {
     fn decode<D: Decoder>(d: &mut D) -> Result<LocalInternedString, D::Error> {
-        Ok(Symbol::intern(&d.read_str()?).as_str())
+        Ok(LocalInternedString::intern(&d.read_str()?))
     }
 }
 
@@ -1124,6 +1153,13 @@ pub struct InternedString {
 }
 
 impl InternedString {
+    /// Maps a string to its interned representation.
+    pub fn intern(string: &str) -> Self {
+        InternedString {
+            symbol: Symbol::intern(string)
+        }
+    }
+
     pub fn with<F: FnOnce(&str) -> R, R>(self, f: F) -> R {
         let str = with_interner(|interner| {
             interner.get(self.symbol) as *const str
@@ -1226,7 +1262,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 
 impl Decodable for InternedString {
     fn decode<D: Decoder>(d: &mut D) -> Result<InternedString, D::Error> {
-        Ok(Symbol::intern(&d.read_str()?).as_interned_str())
+        Ok(InternedString::intern(&d.read_str()?))
     }
 }
 
@@ -1240,6 +1276,7 @@ fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
 mod tests {
     use super::*;
     use crate::Globals;
+    use crate::edition;
 
     #[test]
     fn interner_tests() {
@@ -1253,16 +1290,18 @@ fn interner_tests() {
         assert_eq!(i.intern("cat"), Symbol::new(1));
         // dog is still at zero
         assert_eq!(i.intern("dog"), Symbol::new(0));
-        assert_eq!(i.gensym("zebra"), Symbol::new(SymbolIndex::MAX_AS_U32));
+        let z = i.intern("zebra");
+        assert_eq!(i.gensymed(z), Symbol::new(SymbolIndex::MAX_AS_U32));
         // gensym of same string gets new number:
-        assert_eq!(i.gensym("zebra"), Symbol::new(SymbolIndex::MAX_AS_U32 - 1));
+        assert_eq!(i.gensymed(z), Symbol::new(SymbolIndex::MAX_AS_U32 - 1));
         // gensym of *existing* string gets new number:
-        assert_eq!(i.gensym("dog"), Symbol::new(SymbolIndex::MAX_AS_U32 - 2));
+        let d = i.intern("dog");
+        assert_eq!(i.gensymed(d), Symbol::new(SymbolIndex::MAX_AS_U32 - 2));
     }
 
     #[test]
     fn without_first_quote_test() {
-        GLOBALS.set(&Globals::new(), || {
+        GLOBALS.set(&Globals::new(edition::DEFAULT_EDITION), || {
             let i = Ident::from_str("'break");
             assert_eq!(i.without_first_quote().name, keywords::Break.name());
         });
index c6afa90e4ee614d5c85d2961c8b1bff7424d955f..7f7db2a21251ac8864bcc07faf4a30001c2d6634 100644 (file)
 use term;
 
 // FIXME(#54291): rustc and/or LLVM don't yet support building with panic-unwind
-//                on aarch64-pc-windows-msvc, so we don't link libtest against
-//                libunwind (for the time being), even though it means that
-//                libtest won't be fully functional on this platform.
+//                on aarch64-pc-windows-msvc, or thumbv7a-pc-windows-msvc
+//                so we don't link libtest against libunwind (for the time being)
+//                even though it means that libtest won't be fully functional on
+//                these platforms.
 //
 // See also: https://github.com/rust-lang/rust/issues/54190#issuecomment-422904437
-#[cfg(not(all(windows, target_arch = "aarch64")))]
+#[cfg(not(all(windows, any(target_arch = "aarch64", target_arch = "arm"))))]
 extern crate panic_unwind;
 
 pub use self::ColorConfig::*;
index 70f591e653baf4ae139625a2ca253f77e221bc59..20280aa3c41300b96d90efe626d21e41f5c18bc4 100644 (file)
@@ -67,13 +67,10 @@ pub fn compile() {
             cfg.flag("-std=c99");
             cfg.flag("-std=c++11");
             cfg.flag("-nostdinc++");
-            if cfg.is_flag_supported("-funwind-tables").unwrap_or_default() &&
-               cfg.is_flag_supported("-fno-exceptions").unwrap_or_default() {
-                cfg.flag("-funwind-tables");
-                cfg.flag("-fno-exceptions");
-            }
+            cfg.flag("-fno-exceptions");
             cfg.flag("-fno-rtti");
             cfg.flag("-fstrict-aliasing");
+            cfg.flag("-funwind-tables");
         }
 
         let mut unwind_sources = vec![
index eb38a1888d1d29b2d2c6b31428a5201cd8fba0ff..2c5656ae593851d0b2336a727cc14b77a06b8ac0 160000 (submodule)
@@ -1 +1 @@
-Subproject commit eb38a1888d1d29b2d2c6b31428a5201cd8fba0ff
+Subproject commit 2c5656ae593851d0b2336a727cc14b77a06b8ac0
index 0dd67bb95ccaa5d500d2ef6157eedbfc933985d9..5004f787cde190725b2b5d3b69a117a319fcb0a6 100644 (file)
@@ -1,6 +1,5 @@
 // compile-flags: -O
 #![crate_type="lib"]
-#![feature(maybe_uninit)]
 
 use std::mem::MaybeUninit;
 
index 52543297ead647f1f6874204e3e0ec70b3b66b9f..73631b92c1f33463271646907d46abd71540a40b 100644 (file)
@@ -12,6 +12,7 @@
 // ignore-netbsd
 // ignore-openbsd
 // ignore-solaris
+// ignore-sgx no dynamic linking
 
 // aux-build:dummy.rs
 // aux-build:wrapper.rs
index aa6cbf66b4aa3bc24ad4334acecce3e4a64760e5..0f17976ef49653f872c87009ca6518c3d41dccf9 100644 (file)
@@ -13,7 +13,6 @@
 // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i64 0{{[,)].*}}
 
 #![feature(never_type)]
-#![feature(nll)]
 
 #[derive(Copy, Clone)]
 pub struct Entity {
index f2fd297dc70f77d37e24d61217575f35f9980b39..8e38245267d41381ae9bc6a3cb179dd79dbbf1f5 100644 (file)
@@ -11,6 +11,7 @@
 // ignore-netbsd
 // ignore-openbsd
 // ignore-solaris
+// ignore-sgx
 
 // compile-flags: -C no-prepopulate-passes -C panic=abort -O
 
index 0581cd799753ef3cb9561264ed040d59b098a0c0..498bf89225000a60a5a31fd2bd579a3a654150f7 100644 (file)
@@ -1,5 +1,6 @@
 // Test what happens we save incremental compilation state that makes
 // use of foreign items. This used to ICE (#34991).
+// ignore-sgx no libc
 
 // revisions: rpass1
 
index 5bfd540eca63ec7c9c5ebec63f3b525bc7599133..5165f9821fd88302c72db33115fe08fb4123f96b 100644 (file)
@@ -49,14 +49,14 @@ pub fn add_parameter() {
 // Change parameter pattern ----------------------------------------------------
 #[cfg(cfail1)]
 pub fn change_parameter_pattern() {
-    let _ = |x: &u32| x;
+    let _ = |x: (u32,)| x;
 }
 
 #[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody, mir_built, typeck_tables_of")]
 #[rustc_clean(cfg="cfail3")]
 pub fn change_parameter_pattern() {
-    let _ = |&x: &u32| x;
+    let _ = |(x,): (u32,)| x;
 }
 
 
diff --git a/src/test/incremental/no_mangle.rs b/src/test/incremental/no_mangle.rs
new file mode 100644 (file)
index 0000000..1b17886
--- /dev/null
@@ -0,0 +1,10 @@
+// revisions:rpass1 rpass2
+// compile-flags: --crate-type cdylib
+// skip-codegen
+
+#![deny(unused_attributes)]
+
+#[no_mangle]
+pub extern "C" fn rust_no_mangle() -> i32 {
+    42
+}
diff --git a/src/test/mir-opt/const_prop/array_index.rs b/src/test/mir-opt/const_prop/array_index.rs
new file mode 100644 (file)
index 0000000..dd22eb5
--- /dev/null
@@ -0,0 +1,33 @@
+fn main() {
+    let x: u32 = [0, 1, 2, 3][2];
+}
+
+// END RUST SOURCE
+// START rustc.main.ConstProp.before.mir
+//  bb0: {
+//      ...
+//      _2 = [const 0u32, const 1u32, const 2u32, const 3u32];
+//      ...
+//      _3 = const 2usize;
+//      _4 = const 4usize;
+//      _5 = Lt(_3, _4);
+//      assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1;
+//  }
+//  bb1: {
+//      _1 = _2[_3];
+//      ...
+//      return;
+//  }
+// END rustc.main.ConstProp.before.mir
+// START rustc.main.ConstProp.after.mir
+//  bb0: {
+//      ...
+//      _5 = const true;
+//      assert(const true, "index out of bounds: the len is move _4 but the index is _3") -> bb1;
+//  }
+//  bb1: {
+//      _1 = _2[_3];
+//      ...
+//      return;
+//  }
+// END rustc.main.ConstProp.after.mir
diff --git a/src/test/mir-opt/const_prop/checked_add.rs b/src/test/mir-opt/const_prop/checked_add.rs
new file mode 100644 (file)
index 0000000..fe98cf2
--- /dev/null
@@ -0,0 +1,21 @@
+// compile-flags: -C overflow-checks=on
+
+fn main() {
+    let x: u32 = 1 + 1;
+}
+
+// END RUST SOURCE
+// START rustc.main.ConstProp.before.mir
+//  bb0: {
+//      ...
+//      _2 = CheckedAdd(const 1u32, const 1u32);
+//      assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1;
+//  }
+// END rustc.main.ConstProp.before.mir
+// START rustc.main.ConstProp.after.mir
+//  bb0: {
+//      ...
+//      _2 = (const 2u32, const false);
+//      assert(!const false, "attempt to add with overflow") -> bb1;
+//  }
+// END rustc.main.ConstProp.after.mir
diff --git a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs b/src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs
new file mode 100644 (file)
index 0000000..97d3abd
--- /dev/null
@@ -0,0 +1,34 @@
+#[inline(never)]
+fn read(_: usize) { }
+
+fn main() {
+    const FOO: &i32 = &1;
+    let x = FOO as *const i32 as usize;
+    read(x);
+}
+
+// END RUST SOURCE
+// START rustc.main.ConstProp.before.mir
+//  bb0: {
+//      ...
+//      _3 = _4;
+//      _2 = move _3 as *const i32 (Misc);
+//      ...
+//      _1 = move _2 as usize (Misc);
+//      ...
+//      _6 = _1;
+//      _5 = const read(move _6) -> bb1;
+//  }
+// END rustc.main.ConstProp.before.mir
+// START rustc.main.ConstProp.after.mir
+//  bb0: {
+//      ...
+//      _3 = _4;
+//      _2 = move _3 as *const i32 (Misc);
+//      ...
+//      _1 = move _2 as usize (Misc);
+//      ...
+//      _6 = _1;
+//      _5 = const read(move _6) -> bb1;
+//  }
+// END rustc.main.ConstProp.after.mir
diff --git a/src/test/mir-opt/const_prop/slice_len.rs b/src/test/mir-opt/const_prop/slice_len.rs
new file mode 100644 (file)
index 0000000..3435ca0
--- /dev/null
@@ -0,0 +1,37 @@
+fn test() -> &'static [u32] {
+    &[1, 2]
+}
+
+fn main() {
+    let x = test()[0];
+}
+
+// END RUST SOURCE
+// START rustc.main.ConstProp.before.mir
+//  bb1: {
+//      ...
+//      _3 = const 0usize;
+//      _4 = Len((*_2));
+//      _5 = Lt(_3, _4);
+//      assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb2;
+//  }
+//  bb2: {
+//      _1 = (*_2)[_3];
+//      ...
+//      return;
+//  }
+// END rustc.main.ConstProp.before.mir
+// START rustc.main.ConstProp.after.mir
+//  bb0: {
+//      ...
+//      _3 = const 0usize;
+//      _4 = Len((*_2));
+//      _5 = Lt(_3, _4);
+//      assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb2;
+//  }
+//  bb2: {
+//      _1 = (*_2)[_3];
+//      ...
+//      return;
+//  }
+// END rustc.main.ConstProp.after.mir
diff --git a/src/test/mir-opt/const_prop/switch_int.rs b/src/test/mir-opt/const_prop/switch_int.rs
new file mode 100644 (file)
index 0000000..0df1112
--- /dev/null
@@ -0,0 +1,38 @@
+#[inline(never)]
+fn foo(_: i32) { }
+
+fn main() {
+    match 1 {
+        1 => foo(0),
+        _ => foo(-1),
+    }
+}
+
+// END RUST SOURCE
+// START rustc.main.ConstProp.before.mir
+//  bb0: {
+//      ...
+//      _1 = const 1i32;
+//      switchInt(_1) -> [1i32: bb1, otherwise: bb2];
+//  }
+// END rustc.main.ConstProp.before.mir
+// START rustc.main.ConstProp.after.mir
+//  bb0: {
+//      ...
+//      switchInt(const 1i32) -> [1i32: bb1, otherwise: bb2];
+//  }
+// END rustc.main.ConstProp.after.mir
+// START rustc.main.SimplifyBranches-after-const-prop.before.mir
+//  bb0: {
+//      ...
+//      _1 = const 1i32;
+//      switchInt(const 1i32) -> [1i32: bb1, otherwise: bb2];
+//  }
+// END rustc.main.SimplifyBranches-after-const-prop.before.mir
+// START rustc.main.SimplifyBranches-after-const-prop.after.mir
+//  bb0: {
+//      ...
+//      _1 = const 1i32;
+//      goto -> bb1;
+//  }
+// END rustc.main.SimplifyBranches-after-const-prop.after.mir
index 144348450a91b5aa34edce9ca7980e2d5afee8b7..8348f9a77467888fe5b7273d7e76790a33f5fad9 100644 (file)
@@ -2,8 +2,6 @@
 
 // ignore-wasm32-bare
 
-#![feature(nll)]
-
 fn match_guard(x: Option<&&i32>, c: bool) -> i32 {
     match x {
         Some(0) if c => 0,
index b2a99a6d446bbfe113c245ef2c0a33462371e38e..35512b94c0c8cf8f96c87db6ab2350ae51118525 100644 (file)
@@ -5,15 +5,15 @@ fn main() {
 }
 
 // END RUST SOURCE
-// START rustc.main.SimplifyBranches-after-copy-prop.before.mir
+// START rustc.main.SimplifyBranches-after-const-prop.before.mir
 // bb0: {
 //     ...
 //     switchInt(const false) -> [false: bb3, otherwise: bb1];
 // }
-// END rustc.main.SimplifyBranches-after-copy-prop.before.mir
-// START rustc.main.SimplifyBranches-after-copy-prop.after.mir
+// END rustc.main.SimplifyBranches-after-const-prop.before.mir
+// START rustc.main.SimplifyBranches-after-const-prop.after.mir
 // bb0: {
 //     ...
 //     goto -> bb3;
 // }
-// END rustc.main.SimplifyBranches-after-copy-prop.after.mir
+// END rustc.main.SimplifyBranches-after-const-prop.after.mir
index 3c7f6a68db545ee6ff42e09a097fd2fbe8e3e8ff..c62f98ea78d1ec1d460401bbfe9f0a3c5993073b 100644 (file)
@@ -1,7 +1,5 @@
 // error-pattern: thread 'main' panicked at 'explicit panic'
 
-#![feature(nll)]
-
 fn main() {
     let mut vec = vec![];
     vec.push((vec.len(), panic!()));
index d32fafd215c07c945fffaac1b2ad6d0d5d224685..49e137549c04978dd97d2192cbbb3403598ccc69 100644 (file)
@@ -105,7 +105,7 @@ fn reject_stmt_parse(es: &str) {
 }
 
 fn main() {
-    syntax::with_globals(|| run());
+    syntax::with_default_globals(|| run());
 }
 
 fn run() {
index 309acb25184a8f54b6c898c8bc19d2e7f4b60c65..096701bd9b3ed4b4a56157d833626f608fb75d9a 100644 (file)
@@ -47,6 +47,6 @@ pub fn plugin_registrar(reg: &mut Registry) {
             allow_internal_unsafe: false,
             local_inner_macros: false,
             unstable_feature: None,
-            edition: hygiene::default_edition(),
+            edition: reg.sess.edition(),
         });
 }
index 22a76a3d968aa5da92af18e7e3a6f7e81dd8b1f5..a0dca9b1da4d277a6ef8c3e00e0815b12bb15901 100644 (file)
@@ -13,7 +13,7 @@
 mod gravy;
 
 pub fn main() {
-    syntax::with_globals(|| parse());
+    syntax::with_default_globals(|| parse());
 
     assert_eq!(gravy::foo(), 10);
 }
index 80e0b0102af75f8ff8fd4af4eae9132ff3f75dcb..659de9cf6d51b616ba5597ff428dfd4c23b9a024 100644 (file)
@@ -189,7 +189,7 @@ fn visit_expr(&mut self, e: &mut P<Expr>) {
 }
 
 fn main() {
-    syntax::with_globals(|| run());
+    syntax::with_default_globals(|| run());
 }
 
 fn run() {
index c4d23c2938d6368a9d1ea9419f382208bdbf71e4..cd5edb84bdfe451787a472e9835c8dd23694d2b0 100644 (file)
@@ -1,6 +1,7 @@
 // no-prefer-dynamic
 // ignore-cloudabi
 // ignore-emscripten
+// ignore-sgx no processes
 // ignore-macos this needs valgrind 3.11 or higher; see
 // https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679
 
index df94cd5718631e4600a3937a80113689105b392d..110f3eee1ef81cd34fa26571a0f5db55923ba795 100644 (file)
@@ -4,6 +4,7 @@
 
 // ignore-cloudabi no env and process
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::{env, panic};
 use std::io::prelude::*;
diff --git a/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs b/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs
deleted file mode 100644 (file)
index 6904c29..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)]
-#![feature(rustc_attrs)]
-
-use std::{
-    ops::{Deref, CoerceUnsized, DispatchFromDyn},
-    marker::Unsize,
-};
-
-struct Ptr<T: ?Sized>(Box<T>);
-
-impl<T: ?Sized> Deref for Ptr<T> {
-    type Target = T;
-
-    fn deref(&self) -> &T {
-        &*self.0
-    }
-}
-
-impl<T: Unsize<U> + ?Sized, U: ?Sized> CoerceUnsized<Ptr<U>> for Ptr<T> {}
-impl<T: Unsize<U> + ?Sized, U: ?Sized> DispatchFromDyn<Ptr<U>> for Ptr<T> {}
-
-struct Wrapper<T: ?Sized>(T);
-
-impl<T: ?Sized> Deref for Wrapper<T> {
-    type Target = T;
-
-    fn deref(&self) -> &T {
-        &self.0
-    }
-}
-
-impl<T: CoerceUnsized<U>, U> CoerceUnsized<Wrapper<U>> for Wrapper<T> {}
-impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<Wrapper<U>> for Wrapper<T> {}
-
-
-trait Trait {
-    // This method isn't object-safe yet. Unsized by-value `self` is object-safe (but not callable
-    // without unsized_locals), but wrappers arond `Self` currently are not.
-    // FIXME (mikeyhew) uncomment this when unsized rvalues object-safety is implemented
-    // fn wrapper(self: Wrapper<Self>) -> i32;
-    fn ptr_wrapper(self: Ptr<Wrapper<Self>>) -> i32;
-    fn wrapper_ptr(self: Wrapper<Ptr<Self>>) -> i32;
-    fn wrapper_ptr_wrapper(self: Wrapper<Ptr<Wrapper<Self>>>) -> i32;
-}
-
-impl Trait for i32 {
-    fn ptr_wrapper(self: Ptr<Wrapper<Self>>) -> i32 {
-        **self
-    }
-    fn wrapper_ptr(self: Wrapper<Ptr<Self>>) -> i32 {
-        **self
-    }
-    fn wrapper_ptr_wrapper(self: Wrapper<Ptr<Wrapper<Self>>>) -> i32 {
-        ***self
-    }
-}
-
-fn main() {
-    let pw = Ptr(Box::new(Wrapper(5))) as Ptr<Wrapper<dyn Trait>>;
-    assert_eq!(pw.ptr_wrapper(), 5);
-
-    let wp = Wrapper(Ptr(Box::new(6))) as Wrapper<Ptr<dyn Trait>>;
-    assert_eq!(wp.wrapper_ptr(), 6);
-
-    let wpw = Wrapper(Ptr(Box::new(Wrapper(7)))) as Wrapper<Ptr<Wrapper<dyn Trait>>>;
-    assert_eq!(wpw.wrapper_ptr_wrapper(), 7);
-}
diff --git a/src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs b/src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs
deleted file mode 100644 (file)
index 9f6a647..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#![feature(arbitrary_self_types)]
-#![feature(rustc_attrs)]
-
-use std::{
-    rc::Rc,
-    sync::Arc,
-    pin::Pin,
-};
-
-trait Trait {
-    fn by_rc(self: Rc<Self>) -> i64;
-    fn by_arc(self: Arc<Self>) -> i64;
-    fn by_pin_mut(self: Pin<&mut Self>) -> i64;
-    fn by_pin_box(self: Pin<Box<Self>>) -> i64;
-    fn by_pin_pin_pin_ref(self: Pin<Pin<Pin<&Self>>>) -> i64;
-}
-
-impl Trait for i64 {
-    fn by_rc(self: Rc<Self>) -> i64 {
-        *self
-    }
-    fn by_arc(self: Arc<Self>) -> i64 {
-        *self
-    }
-    fn by_pin_mut(self: Pin<&mut Self>) -> i64 {
-        *self
-    }
-    fn by_pin_box(self: Pin<Box<Self>>) -> i64 {
-        *self
-    }
-    fn by_pin_pin_pin_ref(self: Pin<Pin<Pin<&Self>>>) -> i64 {
-        *self
-    }
-}
-
-fn main() {
-    let rc = Rc::new(1i64) as Rc<dyn Trait>;
-    assert_eq!(1, rc.by_rc());
-
-    let arc = Arc::new(2i64) as Arc<dyn Trait>;
-    assert_eq!(2, arc.by_arc());
-
-    let mut value = 3i64;
-    let pin_mut = Pin::new(&mut value) as Pin<&mut dyn Trait>;
-    assert_eq!(3, pin_mut.by_pin_mut());
-
-    let pin_box = Into::<Pin<Box<i64>>>::into(Box::new(4i64)) as Pin<Box<dyn Trait>>;
-    assert_eq!(4, pin_box.by_pin_box());
-
-    let value = 5i64;
-    let pin_pin_pin_ref = Pin::new(Pin::new(Pin::new(&value))) as Pin<Pin<Pin<&dyn Trait>>>;
-    assert_eq!(5, pin_pin_pin_ref.by_pin_pin_pin_ref());
-}
index 566aeeb2c395df576884b68c87fd28935b6a693c..ee76ef9b25fb8b82c00c0b8d757504ce9c087f36 100644 (file)
@@ -2,6 +2,7 @@
 #![allow(deprecated)]
 // ignore-cloudabi no process support
 // ignore-emscripten no threads support
+// ignore-sgx no processes
 
 use std::{env, fmt, process, sync, thread};
 
index 279a30d6c2eebcb7645f8820129016de73ef346b..69ce1f70322ab55079fca1834d7e9702cad963c4 100644 (file)
@@ -11,6 +11,7 @@
 // ignore-cloudabi spawning processes is not supported
 // ignore-emscripten spawning processes is not supported
 // normalize-stderr-test ".*\n" -> ""
+// ignore-sgx no processes
 
 // Note that above `-opt-bisect-limit=0` is used to basically disable
 // optimizations. It creates tons of output on stderr, hence we normalize
index da3871aba095c4f6ba35c98730fe6be44a8a638b..5f6198aff5009ab7f754ece044136c3518d69b64 100644 (file)
@@ -2,6 +2,7 @@
 // ignore-cloudabi spawning processes is not supported
 // ignore-emscripten spawning processes is not supported
 // ignore-openbsd no support for libbacktrace without filename
+// ignore-sgx no processes
 // compile-flags:-g
 
 use std::env;
index c953bed26f491058dd5079488165845aae0ed875..96d2663500ef0e9ab8e72d1537098f09f850727a 100644 (file)
@@ -3,8 +3,6 @@
 #![allow(unused_variables)]
 // Test case from #39963.
 
-#![feature(nll)]
-
 #[derive(Clone)]
 struct Foo(Option<Box<Foo>>, Option<Box<Foo>>);
 
index 8f0434c0e2b5800a66db75db7dd6e05a353ba0fd..fd0e346e2b42dee204376dcdd467c13bd0c46037 100644 (file)
@@ -1,5 +1,4 @@
 // run-pass
-#![feature(nll)]
 #![deny(unused_mut)]
 
 #[derive(Debug)]
index 5e1d436e31bf22888514d90a9c62843f8893dd8c..1242ae307d39c764fab8af0a1456eb3e4da0f732 100644 (file)
@@ -1,8 +1,4 @@
 // run-pass
-// revisions: lxl nll
-
-#![cfg_attr(nll, feature(nll))]
-
 use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
 use std::ops::{BitAndAssign, BitOrAssign, BitXorAssign, ShlAssign, ShrAssign};
 
index f376bb7fde2e511ebbac0dddfe4f198e3e337d66..ec162b40bf8b6790ddb2b2bfd10657b05790b4d1 100644 (file)
@@ -1,4 +1,5 @@
 // ignore-wasm32-bare no libc to test with
+// ignore-sgx no libc
 
 #![feature(rustc_private)]
 
index 282ac4abcee98c088571e652a77cd6f2034605d2..9fb7c7669219d2007fa7aa8a3770b52b7d401f2f 100644 (file)
@@ -2,6 +2,7 @@
 // pretty-expanded FIXME #23616
 // ignore-cloudabi no target_family
 // ignore-wasm32-bare no target_family
+// ignore-sgx
 
 #[cfg(windows)]
 pub fn main() {
index 2cd0ba5bf881c38e7fa1bd3d653ce79567922a03..ecf802f7281482d1a7381d97a809d667b42311f2 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no target_family
 // ignore-wasm32-bare no target_family
+// ignore-sgx
 
 // pretty-expanded FIXME #23616
 
index ab3d3ebbaad13b57d7e431fc021e97e75ef1a293..aa5a3a377058de1e8deb541e5bb8e74fe1e1a4f2 100644 (file)
@@ -3,6 +3,7 @@
 // ignore-pretty issue #37199
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 #![feature(process_exec)]
 
index 21783fedd39c9ada818cfe30db07fdc311919bfd..5c3cc31de58188d276db6a981fe25d1a602296e2 100644 (file)
@@ -2,6 +2,7 @@
 // ignore-windows - this is a unix-specific test
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 #![feature(process_exec, rustc_private)]
 
 extern crate libc;
index 55d389952cc4089459bf3cf558ea4b083b6226eb..625e51793814e6e7b90f8dcd272ee67202bd37f0 100644 (file)
@@ -5,6 +5,7 @@
 // compile-flags:--test
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 // N.B., these tests kill child processes. Valgrind sees these children as leaking
 // memory, which makes for some *confusing* logs. That's why these are here
index 8dcc8ad5433e0b2621d76100ecaeef8f0e96e11f..7d1624320e6798a6223445e588dc181ced68097a 100644 (file)
@@ -1,5 +1,6 @@
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::alloc::{Layout, handle_alloc_error};
 use std::env;
index 78548fd9bc57096be4eafadf271965f1fc418f47..d677aa850010376cc9e8c1f057e8cbce3ce44461 100644 (file)
@@ -1,5 +1,6 @@
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::env::args;
 use std::process::Command;
index 79f32bd6c29e3138cb4c3d29cc88a6e6634d98e0..3b236e2b3afbdfa2f2b8456a7221857d931a95b8 100644 (file)
@@ -4,6 +4,7 @@
 // ignore-windows
 // ignore-cloudabi no execve
 // ignore-emscripten no execve
+// ignore-sgx no execve
 // no-prefer-dynamic
 
 #![feature(rustc_private)]
index 90b753447308fcb395b9affed3f5205a196d7764..62f45d0a2eb2a364e296e0f6f3bdc9b070463dfe 100644 (file)
@@ -2,6 +2,7 @@
 #![allow(deprecated)]
 // ignore-cloudabi no environment variables present
 // ignore-emscripten env vars don't work?
+// ignore-sgx env vars cannot be modified
 
 use std::env::*;
 use std::path::PathBuf;
index 1327b558fc967d68569a3dddf9b1aa111ca6a6ea..c1b8e0825143bdb0845979e79b7bc80a5f80b8ac 100644 (file)
@@ -1,6 +1,7 @@
 // exec-env:TEST_EXEC_ENV=22
 // ignore-cloudabi no env vars
 // ignore-emscripten FIXME: issue #31622
+// ignore-sgx unsupported
 
 use std::env;
 
index 3bc0ceb5cf2fa76e2c5773e6a05da25047b182a0..c4091f84af98c6f53896976ef2b2b30ac928f7b8 100644 (file)
@@ -3,6 +3,7 @@
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
 // ignore-haiku
+// ignore-sgx no processes
 
 #![feature(rustc_private)]
 
index 5ed8d19bc5a42e43cbdb4f7c401fb1a4b97807f1..1f048159064b39da80bfcb8488c84eaf0a4dbc7d 100644 (file)
@@ -1,5 +1,6 @@
 // run-pass
 // ignore-wasm32-bare no libc to test ffi with
+// ignore-sgx no libc
 
 #![feature(rustc_private)]
 
index 8e2401d0c035620e1623429b6b51eac5c3ee561d..229953f1b18d4741f91fe845237b9136ec81587e 100644 (file)
@@ -1,5 +1,6 @@
 // ignore-emscripten
 // ignore-wasm32
+// ignore-sgx no processes
 
 use std::env;
 use std::process::Command;
index ac9fb94c37507c6f82a9b181eba6276e1232fda2..6a67d04a54cf4e1af19395afbd50e97bb5878527 100644 (file)
@@ -40,6 +40,18 @@ pub fn main() {
     }
 }
 
+#[cfg(target_env = "sgx")]
+mod m {
+    #[main]
+    #[cfg(target_arch = "x86_64")]
+    pub fn main() {
+        unsafe {
+            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(::rusti::min_align_of::<u64>(), 8);
+        }
+    }
+}
+
 #[cfg(target_os = "windows")]
 mod m {
     #[main]
index 2775aac015615ed0b7fa7c4744c9a6fd1865a6ae..ddf4dc42424dbe089892bd8a892b5d761edd2251 100644 (file)
@@ -1,6 +1,7 @@
 #![allow(unused_mut)]
 // ignore-wasm32
 // ignore-emscripten
+// ignore-sgx no processes
 
 // compile-flags: -C debug_assertions=yes
 
index a2b11764a2fc64cfd46297caa3ab313676789d93..e7544934da0c83e8c4e228f7a952b2a7d9c11b1d 100644 (file)
@@ -1,6 +1,7 @@
 // edition:2018
 // run-pass
 // ignore-emscripten no threads support
+// ignore-sgx no thread sleep support
 
 use std::thread;
 use std::time::Duration;
index 9c10fd2cea682c56ea8d2073dabea9bd2d670daf..78fa8b7c6fb0722e18b895fbc7b606e53cc70d95 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 // Make sure that if a process doesn't have its stdio/stderr descriptors set up
 // that we don't die in a large ball of fire
index c87a37ab6b787f8474ef185a8f394fb31b02131d..c8aa9bf46491faedd1c221f33124f7dae2e43182 100644 (file)
@@ -5,6 +5,7 @@
 // ignore-cloudabi no dylib support
 // ignore-emscripten no dylib support
 // ignore-musl
+// ignore-sgx no dylib support
 
 // pretty-expanded FIXME #23616
 
index b23853074fa3262ca8c6c2bb20f55e647734ae7b..e26c2d7cde23449043f8fdea2d20bf58b6493873 100644 (file)
@@ -1,5 +1,6 @@
 // run-pass
 // ignore-wasm32-bare can't block the thread
+// ignore-sgx not supported
 #![allow(deprecated)]
 
 use std::thread;
index cd74ce38dea6fdef1d5d9a18a7703e23716bc246..5698536ab5d050496835772c4cc93bd6ca33fad3 100644 (file)
@@ -2,6 +2,7 @@
 #![allow(unused_mut)]
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::env;
 use std::io::prelude::*;
diff --git a/src/test/run-pass/issues/issue-13494.rs b/src/test/run-pass/issues/issue-13494.rs
deleted file mode 100644 (file)
index 12be977..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// run-pass
-#![allow(unused_must_use)]
-// ignore-emscripten no threads support
-
-// This test may not always fail, but it can be flaky if the race it used to
-// expose is still present.
-
-#![feature(mpsc_select)]
-#![allow(deprecated)]
-
-use std::sync::mpsc::{channel, Sender, Receiver};
-use std::thread;
-
-fn helper(rx: Receiver<Sender<()>>) {
-    for tx in rx.iter() {
-        let _ = tx.send(());
-    }
-}
-
-fn main() {
-    let (tx, rx) = channel();
-    let t = thread::spawn(move|| { helper(rx) });
-    let (snd, rcv) = channel::<isize>();
-    for _ in 1..100000 {
-        snd.send(1).unwrap();
-        let (tx2, rx2) = channel();
-        tx.send(tx2).unwrap();
-        select! {
-            _ = rx2.recv() => (),
-            _ = rcv.recv() => ()
-        }
-    }
-    drop(tx);
-    t.join();
-}
index 23347d35178e020f4a2b02f9c449c6460bc47e24..164d7ef8af27d5bdb1f1aaac6ce33ce1252a107d 100644 (file)
@@ -2,6 +2,7 @@
 #![allow(unused_mut)]
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::env;
 use std::io::prelude::*;
index ce47a623f0011078b05818b021057fd5422182af..785ad6a2c49dae59818c0428150a947bdb295d5d 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::env;
 use std::process::Command;
index a2570e763f6da496c9552753a9570316bc13d76a..3ba2483f4306d7d146dc8ebbbd369f854afec9de 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::process::Command;
 use std::env;
index 6e538f711de7c0ccc139007b42357c3b9dbadb86..22f33545cb90958df6ced511feb57a0c3d3c3e3f 100644 (file)
@@ -1,6 +1,6 @@
 // run-pass
 // ignore-wasm32-bare no libc to test ffi with
-
+// ignore-sgx no libc
 #![feature(rustc_private)]
 
 extern crate libc;
index ddcf1d04511064eefbedc1ce2a9fadac8f2f26af..2c420dc056fdad4176eacfcbeef1899b7c8f59f8 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no threads
+// ignore-sgx no processes
 
 use std::thread;
 use std::env;
index 68f7dfd38f4f4059617e5dc996587249b0660197..48362d0bb62822273b7d63db9867635399d59921 100644 (file)
@@ -5,7 +5,6 @@
 // See further discussion on rust-lang/rust#24535,
 // rust-lang/rfcs#1006, and rust-lang/rfcs#107
 
-#![feature(nll)]
 #![feature(bind_by_move_pattern_guards)]
 
 fn main() {
index 231d41cd86a97d88783eff0bd196dbe1588ac7e3..76e72246887b6941c6bb183969e39f4d65a241f1 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 // Previously libstd would set stdio descriptors of a child process
 // by `dup`ing the requested descriptors to inherit directly into the
index 7962509003f50d21c9d27e8a5f99c66cbcc7a816..39ae009c99650f3e1c4e0437057f851cff592ed7 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::process::{Command, Stdio};
 use std::env;
index 7c644789834d46d9e170059ca84060fa6649cb04..80d815379bec2fa7b272fbc17bcda278ddf2e601 100644 (file)
@@ -1,7 +1,6 @@
 // run-pass
 #![allow(unused_must_use)]
 // Test that we are able to reinitialize box with moved referent
-#![feature(nll)]
 static mut ORDER: [usize; 3] = [0, 0, 0];
 static mut INDEX: usize = 0;
 
index 29a0a328503e1d98e9cad0cba0edae35acb87376..15571e8bf5b286441a26e1bb2e9abab697fb3f2e 100644 (file)
@@ -1,6 +1,5 @@
 // run-pass
 #![allow(unreachable_code)]
-#![feature(nll)]
 
 fn main() {
     let mut v = Vec::new();
index 3e7e9a51cdd3ad044d8bee4281abad20283c0345..27b5185377d97be2ef4fd6190189376504a12879 100644 (file)
@@ -2,6 +2,7 @@
 #![allow(unused_must_use)]
 #![allow(deprecated)]
 // ignore-emscripten no threads support
+// ignore-sgx no thread sleep support
 
 use std::sync::mpsc::{TryRecvError, channel};
 use std::thread;
index 4e404f26eec5e1ca99e9790520d2081c93fc34fc..da07385ead748644e65515569922119b012950c5 100644 (file)
@@ -1,6 +1,7 @@
 // ignore-windows
 // ignore-macos
 // ignore-emscripten doesn't support this linkage
+// ignore-sgx weak linkage not permitted
 // aux-build:linkage1.rs
 
 #![feature(linkage)]
index 904f2e2c7fd7eff21de27eb8080a4fc4455d7931..12a612c153ad62f085884b66c058e350a9dbeeb0 100644 (file)
@@ -233,8 +233,6 @@ fn println() {
     println!("hello {}", "world",);
 }
 
-// select! is too troublesome and unlikely to be stabilized
-
 // stringify! is N/A
 
 #[cfg(std)]
index cd30dd62bc4ce767ba40dab56f90f7b20ee569e3..cf8d92b227893dbd091074c17a98e2653d5b2aa0 100644 (file)
@@ -1,5 +1,6 @@
 // compile-flags:--test
 // ignore-emscripten
+// ignore-sgx no thread sleep support
 
 use std::sync::mpsc::channel;
 use std::sync::mpsc::TryRecvError;
index 3f24d989c8c3f6585a41d9693ce4a5f92d5e5e81..900b2b2206f480772620c5fe2c2d321b2b506061 100644 (file)
@@ -1,5 +1,6 @@
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 fn check_for_no_backtrace(test: std::process::Output) {
     assert!(!test.status.success());
index 4f021fda4e344bf1390a17fe070056c29f3b6b57..9f4d57111bbe982dc4bf816230583c0089a3d1d6 100644 (file)
@@ -3,7 +3,6 @@
 // Regression test for #47153: constants in a generic context (such as
 // a trait) used to ICE.
 
-#![feature(nll)]
 #![allow(warnings)]
 
 trait Foo {
index 5bbed3a85904c385920d4b58d0a1fcf39329f903..280bf081138cc96eacc943060a7a20fc19e21bce 100644 (file)
@@ -1,7 +1,5 @@
 // run-pass
 
-#![feature(nll)]
-
 pub struct DescriptorSet<'a> {
     pub slots: Vec<AttachInfo<'a, Resources>>
 }
index 5a41fff11a1f0c2dba7cd70898aee21cdad30d21..3f8587eed41b99aaaccd78a36353f45c2946c914 100644 (file)
@@ -2,8 +2,6 @@
 #![allow(path_statements)]
 #![allow(dead_code)]
 
-#![feature(nll)]
-
 struct WithDrop;
 
 impl Drop for WithDrop {
index b404daca725680a5565394a57ffb26c6d333cf14..ba3eccff495e5c1ba6b5c68578ea929c4ba6c8a1 100644 (file)
@@ -2,7 +2,6 @@
 #![allow(path_statements)]
 #![allow(dead_code)]
 
-#![feature(nll)]
 #![feature(generators, generator_trait)]
 
 struct WithDrop;
index 8d2992b3b4f88432bea417cb2d6d131850371713..55a2d231e19ff48922b5df0da4f85c04b735795c 100644 (file)
@@ -1,6 +1,5 @@
 // run-pass
 
-#![feature(nll)]
 #![deny(unused_mut)]
 
 fn main() {
index dc5257cfb92251caa4b91f21e6e533dbaf2e2a80..69d7cdd83a6a1023964889e9c20077daa2ac9e87 100644 (file)
@@ -1,6 +1,5 @@
 // run-pass
 
-#![feature(nll)]
 #![deny(unused_mut)]
 
 struct Foo {
index c3f818812aa5f8ef8ba1d5b37aa85bddd2b0d10d..941c9eeb411d9ca5866da76c08bb523a1dca401d 100644 (file)
@@ -1,6 +1,5 @@
 // run-pass
 
-#![feature(nll)]
 #![allow(unused_variables)]
 
 pub trait TryTransform {
index 0af8751494e0d376144eba3d48e89fdb1729eefd..eb46b30b6b94a16e8d148af8a8d68a8dbb4dda35 100644 (file)
@@ -1,7 +1,5 @@
 // run-pass
 
-#![feature(nll)]
-
 struct List<T> {
     value: T,
     next: Option<Box<List<T>>>,
index e9cd4014bc351ddacede2603d46ca6fd3740b460..84ac9bbd0ddc4246c9ef4025f289540093997f95 100644 (file)
@@ -1,7 +1,5 @@
 // run-pass
 
-#![feature(nll)]
-
 use std::collections::HashMap;
 
 fn process_or_insert_default(map: &mut HashMap<usize, String>, key: usize) {
index a4ef546c25f4afb7da7f593530e80408230ae35d..e59303d1f788f86dc10ff3095d2f2d4199676b9f 100644 (file)
@@ -6,8 +6,6 @@
 // `x`.  The lexical checker makes this very painful. The NLL checker
 // does not.
 
-#![feature(nll)]
-
 use std::rc::Rc;
 
 #[derive(Debug, PartialEq, Eq)]
index 005781e1d2f0f67eafc75f1b1d6388247c29d03c..aae1d0b7f81c7a9d65c15cfac142fac3e805f3e7 100644 (file)
@@ -1,6 +1,7 @@
 // ignore-android
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 #![feature(rustc_private)]
 
index 9f868d6e5c3e412422c8034416685f2a61a14fc5..f03935e3d27cc73431cb93acfb16a5177599ec19 100644 (file)
@@ -4,6 +4,7 @@
 // ignore-musl
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 #![feature(asm)]
 #![feature(rustc_private)]
index e2dbb0d175d01127cd45c363f2bd1797ec532a7e..9c099911eab4d39e578eddf4ba65f02cd1daee48 100644 (file)
@@ -5,6 +5,7 @@
 // no-prefer-dynamic
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 // ignore-macos
 
 extern crate exit_success_if_unwind;
index 719034bd11e78a0d0218587dbd024db31df2cc0e..f625fe35d7205367eb7dfe749ba31c97aa54ecc5 100644 (file)
@@ -4,6 +4,7 @@
 // no-prefer-dynamic
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 // ignore-macos
 
 use std::process::Command;
index 9015a8f25a9b6ac970190dc7a33222a3205fcb16..8fff71a629a49e00ff4afcf83d63c6ff5ff22518 100644 (file)
@@ -4,6 +4,7 @@
 // no-prefer-dynamic
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::process::Command;
 use std::env;
index b14cdfc193fa86524846801f9b082977d99cf2a2..94a0b596e4a7114da6e971c7cfdace2b857ad092 100644 (file)
@@ -5,6 +5,7 @@
 // no-prefer-dynamic
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::process::Command;
 use std::env;
index 3f6e489bb83275f6f7b7bbee03806579e91ea459..4ca4b407bd4ff2b70ca60e3aed042874bc8efcec 100644 (file)
@@ -2,7 +2,7 @@
 // This test checks that instantiating an uninhabited type via `mem::{uninitialized,zeroed}` results
 // in a runtime panic.
 
-#![feature(never_type, maybe_uninit)]
+#![feature(never_type)]
 
 use std::{mem, panic};
 
index dfcef59aa57825851f827159fb833cf12dfdfbb3..64ee7319fdde5aa8dc9267c3f9c68e34eb3aa5f4 100644 (file)
@@ -2,6 +2,7 @@
 // ignore-cloudabi no files or I/O
 // ignore-wasm32-bare no files or I/O
 // ignore-emscripten no files
+// ignore-sgx no files
 
 use std::fs;
 use std::io;
index 9c47a734d7b84c9ea050387e254c99b8b64baf3f..65130a1a9f2c095714065eb21451e0daa528e0eb 100644 (file)
@@ -1,5 +1,6 @@
 // ignore-cloudabi spawning processes is not supported
 // ignore-emscripten spawning processes is not supported
+// ignore-sgx no processes
 
 use std::{env, process};
 
index 1ff0fbbdd08df68da13c68c320fe45247e33089c..a7779c55f1f9256a12c70bd42ec6d35560393813 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::process::Command;
 use std::env;
index ecc7b72c0f3ee850a55976e54bf11b1a71bbce67..da3b4ca85c2a3076c8d16b54376ca58380b63608 100644 (file)
@@ -2,6 +2,7 @@
 #![allow(unused_imports)]
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::env;
 use std::process::{self, Command, Stdio};
index 9c2aa871e0dc5aad5989a746cbd4635a79ee09d1..32cbb6ac85ac86d73ffb0e19726c2f761b2c4742 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::process::Command;
 use std::env;
index 2fe9f33de38b7341e9b205d42e6438fe7f583e1b..182cf1748fec68e1d28fca99c4b652c13bb50c85 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::io::ErrorKind;
 use std::process::Command;
index e3508cb4e8fc9a542ae7f0d444a25047a65c0782..edd3cb26ec362919f6a46752d35ae51df5463d44 100644 (file)
@@ -9,6 +9,7 @@
 
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::io::prelude::*;
 use std::io;
index e2e17b7fb66c177a0b7bf82e695b22bfb2d5275f..f9b2da7e401eea35abcc32a60c357d331f4a8773 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::env;
 use std::io;
index 3b7b96d0d02070883a1a4128e313c1b5e77e821c..41a036958bfeab27fbda9acb11d285694a098e9f 100644 (file)
@@ -2,6 +2,7 @@
 #![allow(dead_code)]
 // ignore-cloudabi stdout does not map to file descriptor 1 by default
 // ignore-wasm32-bare no libc
+// ignore-sgx no libc
 
 #![feature(rustc_private)]
 
index 7f8a0f01dde04396a4ba622e977af1e6d8ad65dd..ab1bf3a5b91d6574b8933ee0a8ca8d4e8bc9a25a 100644 (file)
@@ -1,5 +1,6 @@
 // ignore-cloudabi spawning processes is not supported
 // ignore-emscripten spawning processes is not supported
+// ignore-sgx no processes
 
 #![feature(start)]
 
index ce485d771f01dda936a903ee169b0824e741798b..e90efface687bc6dcf57016e66737ec92bf48b79 100644 (file)
@@ -1,6 +1,7 @@
 #![allow(unused_imports)]
 // ignore-cloudabi can't run commands
 // ignore-emscripten can't run commands
+// ignore-sgx no processes
 
 #![feature(rustc_private)]
 
diff --git a/src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs b/src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs
deleted file mode 100644 (file)
index 0eab761..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// run-pass
-#![feature(arbitrary_self_types)]
-
-use std::rc::Rc;
-
-struct Foo(String);
-
-impl Foo {
-    unsafe fn foo(self: *const Self) -> *const str {
-        (*self).0.as_ref()
-    }
-
-    fn complicated_1(self: *const Rc<Self>) -> &'static str {
-        "Foo::complicated_1"
-    }
-
-    unsafe fn complicated_2(self: Rc<*const Self>) -> *const str {
-        (**self).0.as_ref()
-    }
-}
-
-fn main() {
-    let foo = Foo("abc123".into());
-    assert_eq!("abc123", unsafe { &*(&foo as *const Foo).foo() });
-    assert_eq!("Foo::complicated_1", std::ptr::null::<Rc<Foo>>().complicated_1());
-    let rc = Rc::new(&foo as *const Foo);
-    assert_eq!("abc123", unsafe { &*rc.complicated_2()});
-}
diff --git a/src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs b/src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs
deleted file mode 100644 (file)
index acbe896..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// run-pass
-#![feature(arbitrary_self_types)]
-
-use std::ptr;
-
-trait Foo {
-    fn foo(self: *const Self) -> &'static str;
-
-    unsafe fn bar(self: *const Self) -> i64;
-
-    unsafe fn complicated(self: *const *const Self) -> i64 where Self: Sized {
-        (*self).bar()
-    }
-}
-
-impl Foo for i32 {
-    fn foo(self: *const Self) -> &'static str {
-        "I'm an i32!"
-    }
-
-    unsafe fn bar(self: *const Self) -> i64 {
-        *self as i64
-    }
-}
-
-impl Foo for u32 {
-    fn foo(self: *const Self) -> &'static str {
-        "I'm a u32!"
-    }
-
-    unsafe fn bar(self: *const Self) -> i64 {
-        *self as i64
-    }
-}
-
-fn main() {
-    let null_i32 = ptr::null::<i32>() as *const Foo;
-    let null_u32 = ptr::null::<u32>() as *const Foo;
-
-    assert_eq!("I'm an i32!", null_i32.foo());
-    assert_eq!("I'm a u32!", null_u32.foo());
-
-    let valid_i32 = 5i32;
-    let valid_i32_thin = &valid_i32 as *const i32;
-    assert_eq!("I'm an i32!", valid_i32_thin.foo());
-    assert_eq!(5, unsafe { valid_i32_thin.bar() });
-    assert_eq!(5, unsafe { (&valid_i32_thin as *const *const i32).complicated() });
-    let valid_i32_fat = valid_i32_thin as *const Foo;
-    assert_eq!("I'm an i32!", valid_i32_fat.foo());
-    assert_eq!(5, unsafe { valid_i32_fat.bar() });
-
-    let valid_u32 = 18u32;
-    let valid_u32_thin = &valid_u32 as *const u32;
-    assert_eq!("I'm a u32!", valid_u32_thin.foo());
-    assert_eq!(18, unsafe { valid_u32_thin.bar() });
-    assert_eq!(18, unsafe { (&valid_u32_thin as *const *const u32).complicated() });
-    let valid_u32_fat = valid_u32_thin as *const Foo;
-    assert_eq!("I'm a u32!", valid_u32_fat.foo());
-    assert_eq!(18, unsafe { valid_u32_fat.bar() });
-
-}
diff --git a/src/test/run-pass/self/arbitrary_self_types_silly.rs b/src/test/run-pass/self/arbitrary_self_types_silly.rs
deleted file mode 100644 (file)
index fb5f901..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// run-pass
-#![feature(arbitrary_self_types)]
-
-struct Foo;
-struct Bar;
-
-impl std::ops::Deref for Bar {
-    type Target = Foo;
-
-    fn deref(&self) -> &Foo {
-        &Foo
-    }
-}
-
-impl Foo {
-    fn bar(self: Bar) -> i32 { 3 }
-}
-
-fn main() {
-    assert_eq!(3, Bar.bar());
-}
diff --git a/src/test/run-pass/self/arbitrary_self_types_struct.rs b/src/test/run-pass/self/arbitrary_self_types_struct.rs
deleted file mode 100644 (file)
index cf62cd3..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// run-pass
-#![feature(arbitrary_self_types)]
-
-use std::rc::Rc;
-
-struct Foo {
-    x: i32,
-    y: i32,
-}
-
-impl Foo {
-    fn x(self: &Rc<Self>) -> i32 {
-        self.x
-    }
-
-    fn y(self: Rc<Self>) -> i32 {
-        self.y
-    }
-}
-
-fn main() {
-    let foo = Rc::new(Foo {x: 3, y: 4});
-    assert_eq!(3, foo.x());
-    assert_eq!(4, foo.y());
-}
diff --git a/src/test/run-pass/self/arbitrary_self_types_trait.rs b/src/test/run-pass/self/arbitrary_self_types_trait.rs
deleted file mode 100644 (file)
index fb06344..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// run-pass
-#![feature(arbitrary_self_types)]
-
-use std::rc::Rc;
-
-trait Trait {
-    fn trait_method<'a>(self: &'a Box<Rc<Self>>) -> &'a [i32];
-}
-
-impl Trait for Vec<i32> {
-    fn trait_method<'a>(self: &'a Box<Rc<Self>>) -> &'a [i32] {
-        &***self
-    }
-}
-
-fn main() {
-    let v = vec![1,2,3];
-
-    assert_eq!(&[1,2,3], Box::new(Rc::new(v)).trait_method());
-}
diff --git a/src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs b/src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs
deleted file mode 100644 (file)
index b78223f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// run-pass
-#![feature(arbitrary_self_types)]
-
-use std::rc::Rc;
-
-struct Foo<T: ?Sized>(T);
-
-impl Foo<[u8]> {
-    fn len(self: Rc<Self>) -> usize {
-        self.0.len()
-    }
-}
-
-fn main() {
-    let rc = Rc::new(Foo([1u8,2,3])) as Rc<Foo<[u8]>>;
-    assert_eq!(3, rc.len());
-}
diff --git a/src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs b/src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs
deleted file mode 100644 (file)
index 25cdfa9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-pub trait Foo {
-    #[inline(always)]
-    fn f(&self);
-}
-
-pub struct Bar {
-    pub x: String
-}
-
-impl Foo for Bar {
-    #[inline(always)]
-    fn f(&self) {
-        println!("{}", (*self).x);
-    }
-}
diff --git a/src/test/run-pass/self/builtin-superkinds-self-type.rs b/src/test/run-pass/self/builtin-superkinds-self-type.rs
deleted file mode 100644 (file)
index c56542b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// run-pass
-// Tests the ability for the Self type in default methods to use
-// capabilities granted by builtin kinds as supertraits.
-
-
-use std::sync::mpsc::{Sender, channel};
-
-trait Foo : Send + Sized + 'static {
-    fn foo(self, tx: Sender<Self>) {
-        tx.send(self).unwrap();
-    }
-}
-
-impl <T: Send + 'static> Foo for T { }
-
-pub fn main() {
-    let (tx, rx) = channel();
-    1193182.foo(tx);
-    assert_eq!(rx.recv().unwrap(), 1193182);
-}
diff --git a/src/test/run-pass/self/by-value-self-in-mut-slot.rs b/src/test/run-pass/self/by-value-self-in-mut-slot.rs
deleted file mode 100644 (file)
index 267afd1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-pass
-
-struct X {
-    a: isize
-}
-
-trait Changer {
-    fn change(self) -> Self;
-}
-
-impl Changer for X {
-    fn change(mut self) -> X {
-        self.a = 55;
-        self
-    }
-}
-
-pub fn main() {
-    let x = X { a: 32 };
-    let new_x = x.change();
-    assert_eq!(new_x.a, 55);
-}
diff --git a/src/test/run-pass/self/explicit-self-closures.rs b/src/test/run-pass/self/explicit-self-closures.rs
deleted file mode 100644 (file)
index 61be98f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-// Test to make sure that explicit self params work inside closures
-
-// pretty-expanded FIXME #23616
-
-struct Box {
-    x: usize
-}
-
-impl Box {
-    pub fn set_many(&mut self, xs: &[usize]) {
-        for x in xs { self.x = *x; }
-    }
-}
-
-pub fn main() {}
diff --git a/src/test/run-pass/self/explicit-self-generic.rs b/src/test/run-pass/self/explicit-self-generic.rs
deleted file mode 100644 (file)
index 03f72a5..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-#![feature(box_syntax)]
-
-#[derive(Copy, Clone)]
-struct LM { resize_at: usize, size: usize }
-
-enum HashMap<K,V> {
-    HashMap_(LM, Vec<(K,V)>)
-}
-
-fn linear_map<K,V>() -> HashMap<K,V> {
-    HashMap::HashMap_(LM{
-        resize_at: 32,
-        size: 0}, Vec::new())
-}
-
-impl<K,V> HashMap<K,V> {
-    pub fn len(&mut self) -> usize {
-        match *self {
-            HashMap::HashMap_(ref l, _) => l.size
-        }
-    }
-}
-
-pub fn main() {
-    let mut m: Box<_> = box linear_map::<(),()>();
-    assert_eq!(m.len(), 0);
-}
diff --git a/src/test/run-pass/self/explicit-self-objects-uniq.rs b/src/test/run-pass/self/explicit-self-objects-uniq.rs
deleted file mode 100644 (file)
index f95686c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-pass
-#![feature(box_syntax)]
-
-trait Foo {
-    fn f(self: Box<Self>);
-}
-
-struct S {
-    x: isize
-}
-
-impl Foo for S {
-    fn f(self: Box<S>) {
-        assert_eq!(self.x, 3);
-    }
-}
-
-pub fn main() {
-    let x = box S { x: 3 };
-    let y = x as Box<Foo>;
-    y.f();
-}
diff --git a/src/test/run-pass/self/explicit-self.rs b/src/test/run-pass/self/explicit-self.rs
deleted file mode 100644 (file)
index 6d19d33..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-#![allow(non_camel_case_types)]
-#![allow(non_upper_case_globals)]
-
-#![feature(box_syntax)]
-
-static tau: f64 = 2.0*3.14159265358979323;
-
-struct Point {x: f64, y: f64}
-struct Size {w: f64, h: f64}
-enum shape {
-    circle(Point, f64),
-    rectangle(Point, Size)
-}
-
-
-fn compute_area(shape: &shape) -> f64 {
-    match *shape {
-        shape::circle(_, radius) => 0.5 * tau * radius * radius,
-        shape::rectangle(_, ref size) => size.w * size.h
-    }
-}
-
-impl shape {
-    // self is in the implicit self region
-    pub fn select<'r, T>(&self, threshold: f64, a: &'r T, b: &'r T)
-                         -> &'r T {
-        if compute_area(self) > threshold {a} else {b}
-    }
-}
-
-fn select_based_on_unit_circle<'r, T>(
-    threshold: f64, a: &'r T, b: &'r T) -> &'r T {
-
-    let shape = &shape::circle(Point{x: 0.0, y: 0.0}, 1.0);
-    shape.select(threshold, a, b)
-}
-
-#[derive(Clone)]
-struct thing {
-    x: A
-}
-
-#[derive(Clone)]
-struct A {
-    a: isize
-}
-
-fn thing(x: A) -> thing {
-    thing {
-        x: x
-    }
-}
-
-impl thing {
-    pub fn bar(self: Box<thing>) -> isize { self.x.a }
-    pub fn quux(&self) -> isize { self.x.a }
-    pub fn baz<'a>(&'a self) -> &'a A { &self.x }
-    pub fn spam(self) -> isize { self.x.a }
-}
-
-trait Nus { fn f(&self); }
-impl Nus for thing { fn f(&self) {} }
-
-pub fn main() {
-    let y: Box<_> = box thing(A {a: 10});
-    assert_eq!(y.clone().bar(), 10);
-    assert_eq!(y.quux(), 10);
-
-    let z = thing(A {a: 11});
-    assert_eq!(z.spam(), 11);
-}
diff --git a/src/test/run-pass/self/explicit_self_xcrate_exe.rs b/src/test/run-pass/self/explicit_self_xcrate_exe.rs
deleted file mode 100644 (file)
index c3796f7..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-pass
-// aux-build:explicit_self_xcrate.rs
-
-// pretty-expanded FIXME #23616
-
-extern crate explicit_self_xcrate;
-use explicit_self_xcrate::{Foo, Bar};
-
-pub fn main() {
-    let x = Bar { x: "hello".to_string() };
-    x.f();
-}
diff --git a/src/test/run-pass/self/move-self.rs b/src/test/run-pass/self/move-self.rs
deleted file mode 100644 (file)
index 6603278..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// run-pass
-struct S {
-    x: String
-}
-
-impl S {
-    pub fn foo(self) {
-        self.bar();
-    }
-
-    pub fn bar(self) {
-        println!("{}", self.x);
-    }
-}
-
-pub fn main() {
-    let x = S { x: "Hello!".to_string() };
-    x.foo();
-}
diff --git a/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs b/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs
deleted file mode 100644 (file)
index ae05126..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// run-pass
-#![allow(unused_mut)]
-// Check that a trait is still object-safe (and usable) if it has
-// methods with by-value self so long as they require `Self : Sized`.
-
-
-trait Counter {
-    fn tick(&mut self) -> u32;
-    fn get(self) -> u32 where Self : Sized;
-}
-
-struct CCounter {
-    c: u32
-}
-
-impl Counter for CCounter {
-    fn tick(&mut self) -> u32 { self.c += 1; self.c }
-    fn get(self) -> u32 where Self : Sized { self.c }
-}
-
-fn tick1<C:Counter>(mut c: C) -> u32 {
-    tick2(&mut c);
-    c.get()
-}
-
-fn tick2(c: &mut Counter) {
-    tick3(c);
-}
-
-fn tick3<C:?Sized+Counter>(c: &mut C) {
-    c.tick();
-    c.tick();
-}
-
-fn main() {
-    let mut c = CCounter { c: 0 };
-    let value = tick1(c);
-    assert_eq!(value, 2);
-}
diff --git a/src/test/run-pass/self/object-safety-sized-self-generic-method.rs b/src/test/run-pass/self/object-safety-sized-self-generic-method.rs
deleted file mode 100644 (file)
index 0b3f663..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// run-pass
-#![allow(unused_variables)]
-// Check that a trait is still object-safe (and usable) if it has
-// generic methods so long as they require `Self : Sized`.
-
-
-trait Counter {
-    fn tick(&mut self) -> u32;
-    fn with<F:FnOnce(u32)>(&self, f: F) where Self : Sized;
-}
-
-struct CCounter {
-    c: u32
-}
-
-impl Counter for CCounter {
-    fn tick(&mut self) -> u32 { self.c += 1; self.c }
-    fn with<F:FnOnce(u32)>(&self, f: F) { f(self.c); }
-}
-
-fn tick1<C:Counter>(c: &mut C) {
-    tick2(c);
-    c.with(|i| ());
-}
-
-fn tick2(c: &mut Counter) {
-    tick3(c);
-}
-
-fn tick3<C:?Sized+Counter>(c: &mut C) {
-    c.tick();
-    c.tick();
-}
-
-fn main() {
-    let mut c = CCounter { c: 0 };
-    tick1(&mut c);
-    assert_eq!(c.tick(), 3);
-}
diff --git a/src/test/run-pass/self/object-safety-sized-self-return-Self.rs b/src/test/run-pass/self/object-safety-sized-self-return-Self.rs
deleted file mode 100644 (file)
index e88dba0..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// run-pass
-// Check that a trait is still object-safe (and usable) if it has
-// methods that return `Self` so long as they require `Self : Sized`.
-
-
-trait Counter {
-    fn new() -> Self where Self : Sized;
-    fn tick(&mut self) -> u32;
-}
-
-struct CCounter {
-    c: u32
-}
-
-impl Counter for CCounter {
-    fn new() -> CCounter { CCounter { c: 0 } }
-    fn tick(&mut self) -> u32 { self.c += 1; self.c }
-}
-
-fn preticked<C:Counter>() -> C {
-    let mut c: C = Counter::new();
-    tick(&mut c);
-    c
-}
-
-fn tick(c: &mut Counter) {
-    tick_generic(c);
-}
-
-fn tick_generic<C:?Sized+Counter>(c: &mut C) {
-    c.tick();
-    c.tick();
-}
-
-fn main() {
-    let mut c = preticked::<CCounter>();
-    tick(&mut c);
-    assert_eq!(c.tick(), 5);
-}
diff --git a/src/test/run-pass/self/self-impl.rs b/src/test/run-pass/self/self-impl.rs
deleted file mode 100644 (file)
index 23d513e..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-#![allow(unused_variables)]
-// Test that we can use `Self` types in impls in the expected way.
-
-// pretty-expanded FIXME #23616
-
-#![feature(box_syntax)]
-
-struct Foo;
-
-// Test uses on inherent impl.
-impl Foo {
-    fn foo(_x: Self, _y: &Self, _z: Box<Self>) -> Self {
-        Foo
-    }
-
-    fn baz() {
-        // Test that Self cannot be shadowed.
-        type Foo = i32;
-        // There is no empty method on i32.
-        Self::empty();
-
-        let _: Self = Foo;
-    }
-
-    fn empty() {}
-}
-
-// Test uses when implementing a trait and with a type parameter.
-pub struct Baz<X> {
-    pub f: X,
-}
-
-trait SuperBar {
-    type SuperQux;
-}
-
-trait Bar<X>: SuperBar {
-    type Qux;
-
-    fn bar(x: Self, y: &Self, z: Box<Self>, _: Self::SuperQux) -> Self;
-    fn dummy(&self, x: X) { }
-}
-
-impl SuperBar for Box<Baz<isize>> {
-    type SuperQux = bool;
-}
-
-impl Bar<isize> for Box<Baz<isize>> {
-    type Qux = i32;
-
-    fn bar(_x: Self, _y: &Self, _z: Box<Self>, _: Self::SuperQux) -> Self {
-        let _: Self::Qux = 42;
-        let _: <Self as Bar<isize>>::Qux = 42;
-
-        let _: Self::SuperQux = true;
-        let _: <Self as SuperBar>::SuperQux = true;
-
-        box Baz { f: 42 }
-    }
-}
-
-fn main() {
-    let _: Foo = Foo::foo(Foo, &Foo, box Foo);
-    let _: Box<Baz<isize>> = Bar::bar(box Baz { f: 42 },
-                                      &box Baz { f: 42 },
-                                      box box Baz { f: 42 },
-                                      true);
-}
diff --git a/src/test/run-pass/self/self-in-mut-slot-default-method.rs b/src/test/run-pass/self/self-in-mut-slot-default-method.rs
deleted file mode 100644 (file)
index 82c5f58..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// run-pass
-#![feature(box_syntax)]
-
-struct X {
-    a: isize
-}
-
-trait Changer : Sized {
-    fn change(mut self) -> Self {
-        self.set_to(55);
-        self
-    }
-
-    fn change_again(mut self: Box<Self>) -> Box<Self> {
-        self.set_to(45);
-        self
-    }
-
-    fn set_to(&mut self, a: isize);
-}
-
-impl Changer for X {
-    fn set_to(&mut self, a: isize) {
-        self.a = a;
-    }
-}
-
-pub fn main() {
-    let x = X { a: 32 };
-    let new_x = x.change();
-    assert_eq!(new_x.a, 55);
-
-    let x: Box<_> = box new_x;
-    let new_x = x.change_again();
-    assert_eq!(new_x.a, 45);
-}
diff --git a/src/test/run-pass/self/self-in-mut-slot-immediate-value.rs b/src/test/run-pass/self/self-in-mut-slot-immediate-value.rs
deleted file mode 100644 (file)
index 6086530..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// run-pass
-// Assert that `mut self` on an immediate value doesn't
-// allow mutating the original - issue #10615.
-
-
-#[derive(Copy, Clone)]
-struct Value {
-    n: isize
-}
-
-impl Value {
-    fn squared(mut self) -> Value {
-        self.n *= self.n;
-        self
-    }
-}
-
-pub fn main() {
-    let x = Value { n: 3 };
-    let y = x.squared();
-    assert_eq!(x.n, 3);
-    assert_eq!(y.n, 9);
-}
diff --git a/src/test/run-pass/self/self-in-typedefs.rs b/src/test/run-pass/self/self-in-typedefs.rs
deleted file mode 100644 (file)
index 9c09060..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// run-pass
-
-#![feature(untagged_unions)]
-
-#![allow(dead_code)]
-#![allow(unions_with_drop_fields)]
-
-enum A<'a, T: 'a>
-where
-    Self: Send, T: PartialEq<Self>
-{
-    Foo(&'a Self),
-    Bar(T),
-}
-
-struct B<'a, T: 'a>
-where
-    Self: Send, T: PartialEq<Self>
-{
-    foo: &'a Self,
-    bar: T,
-}
-
-union C<'a, T: 'a>
-where
-    Self: Send, T: PartialEq<Self>
-{
-    foo: &'a Self,
-    bar: T,
-}
-
-fn main() {}
diff --git a/src/test/run-pass/self/self-re-assign.rs b/src/test/run-pass/self/self-re-assign.rs
deleted file mode 100644 (file)
index a7b089e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// run-pass
-// Ensure assigning an owned or managed variable to itself works. In particular,
-// that we do not glue_drop before we glue_take (#3290).
-
-#![feature(box_syntax)]
-
-use std::rc::Rc;
-
-pub fn main() {
-   let mut x: Box<_> = box 3;
-   x = x;
-   assert_eq!(*x, 3);
-
-   let mut x = Rc::new(3);
-   x = x;
-   assert_eq!(*x, 3);
-}
diff --git a/src/test/run-pass/self/self-shadowing-import.rs b/src/test/run-pass/self/self-shadowing-import.rs
deleted file mode 100644 (file)
index 1d60c6c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// run-pass
-
-mod a {
-    pub mod b {
-        pub mod a {
-            pub fn foo() -> isize { return 1; }
-        }
-    }
-}
-
-mod c {
-    use a::b::a;
-    pub fn bar() { assert_eq!(a::foo(), 1); }
-}
-
-pub fn main() { c::bar(); }
diff --git a/src/test/run-pass/self/self-type-param.rs b/src/test/run-pass/self/self-type-param.rs
deleted file mode 100644 (file)
index 6deae5f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-// pretty-expanded FIXME #23616
-
-trait MyTrait {
-    fn f(&self) -> Self;
-}
-
-struct S {
-    x: isize
-}
-
-impl MyTrait for S {
-    fn f(&self) -> S {
-        S { x: 3 }
-    }
-}
-
-pub fn main() {}
diff --git a/src/test/run-pass/self/string-self-append.rs b/src/test/run-pass/self/string-self-append.rs
deleted file mode 100644 (file)
index e63dc00..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// run-pass
-pub fn main() {
-    // Make sure we properly handle repeated self-appends.
-    let mut a: String = "A".to_string();
-    let mut i = 20;
-    let mut expected_len = 1;
-    while i > 0 {
-        println!("{}", a.len());
-        assert_eq!(a.len(), expected_len);
-        a = format!("{}{}", a, a);
-        i -= 1;
-        expected_len *= 2;
-    }
-}
diff --git a/src/test/run-pass/self/ufcs-explicit-self.rs b/src/test/run-pass/self/ufcs-explicit-self.rs
deleted file mode 100644 (file)
index 4e24055..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// run-pass
-#![feature(box_syntax)]
-
-#[derive(Copy, Clone)]
-struct Foo {
-    f: isize,
-}
-
-impl Foo {
-    fn foo(self: Foo, x: isize) -> isize {
-        self.f + x
-    }
-    fn bar(self: &Foo, x: isize) -> isize {
-        self.f + x
-    }
-    fn baz(self: Box<Foo>, x: isize) -> isize {
-        self.f + x
-    }
-}
-
-#[derive(Copy, Clone)]
-struct Bar<T> {
-    f: T,
-}
-
-impl<T> Bar<T> {
-    fn foo(self: Bar<T>, x: isize) -> isize {
-        x
-    }
-    fn bar<'a>(self: &'a Bar<T>, x: isize) -> isize {
-        x
-    }
-    fn baz(self: Bar<T>, x: isize) -> isize {
-        x
-    }
-}
-
-fn main() {
-    let foo: Box<_> = box Foo {
-        f: 1,
-    };
-    println!("{} {} {}", foo.foo(2), foo.bar(2), foo.baz(2));
-    let bar: Box<_> = box Bar {
-        f: 1,
-    };
-    println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2));
-    let bar: Box<Bar<isize>> = bar;
-    println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2));
-}
diff --git a/src/test/run-pass/self/uniq-self-in-mut-slot.rs b/src/test/run-pass/self/uniq-self-in-mut-slot.rs
deleted file mode 100644 (file)
index 695f06e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// run-pass
-#![feature(box_syntax)]
-
-struct X {
-    a: isize
-}
-
-trait Changer {
-    fn change(self: Box<Self>) -> Box<Self>;
-}
-
-impl Changer for X {
-    fn change(mut self: Box<X>) -> Box<X> {
-        self.a = 55;
-        self
-    }
-}
-
-pub fn main() {
-    let x: Box<_> = box X { a: 32 };
-    let new_x = x.change();
-    assert_eq!(new_x.a, 55);
-}
diff --git a/src/test/run-pass/self/where-for-self.rs b/src/test/run-pass/self/where-for-self.rs
deleted file mode 100644 (file)
index 76c592d..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// run-pass
-// Test that we can quantify lifetimes outside a constraint (i.e., including
-// the self type) in a where clause.
-
-
-static mut COUNT: u32 = 1;
-
-trait Bar<'a> {
-    fn bar(&self);
-}
-
-trait Baz<'a>
-{
-    fn baz(&self);
-}
-
-impl<'a, 'b> Bar<'b> for &'a u32 {
-    fn bar(&self) {
-        unsafe { COUNT *= 2; }
-    }
-}
-
-impl<'a, 'b> Baz<'b> for &'a u32 {
-    fn baz(&self) {
-        unsafe { COUNT *= 3; }
-    }
-}
-
-// Test we can use the syntax for HRL including the self type.
-fn foo1<T>(x: &T)
-    where for<'a, 'b> &'a T: Bar<'b>
-{
-    x.bar()
-}
-
-// Test we can quantify multiple bounds (i.e., the precedence is sensible).
-fn foo2<T>(x: &T)
-    where for<'a, 'b> &'a T: Bar<'b> + Baz<'b>
-{
-    x.baz();
-    x.bar()
-}
-
-fn main() {
-    let x = 42;
-    foo1(&x);
-    foo2(&x);
-    unsafe {
-        assert_eq!(COUNT, 12);
-    }
-}
index d11f3f5b5e66c69c25ead9cb9f0b00b3da698f25..6f2fa2a370dfeef78849f9700264edbbd30056d7 100644 (file)
@@ -5,6 +5,7 @@
 // ignore-cloudabi no signal handling support
 // ignore-wasm32-bare no libc
 // ignore-windows
+// ignore-sgx no libc
 
 #![feature(rustc_private)]
 extern crate libc;
index 9e1e55ad54d8a289dd1e91bf64b98aedf9e3bfdb..c22c0352286dc964a2a2a568fcfe61280b178b53 100644 (file)
@@ -1,5 +1,6 @@
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 // ignore-windows
 
 use std::env;
index 2ded71670d29a4f0c862e747b230f1e0c1046ef5..6c5bbd45a3c35e512c21998d132cfb5fb1802489 100644 (file)
@@ -4,6 +4,7 @@
 
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::env;
 use std::io::prelude::*;
index 5842a7fcdf7e34bdec77b925382ef7c47403c763..6d7688191b7f1047edbf5a93f190ee2a8ad17666 100644 (file)
@@ -4,6 +4,7 @@
 #![allow(overflowing_literals)]
 
 // ignore-emscripten
+// ignore-sgx no processes
 
 #![feature(repr_simd, target_feature, cfg_target_feature)]
 #![feature(avx512_target_feature)]
index f0411876c8a0ac35bb4f5bbddba0ebb47acee603..7128b3cc7c3ad02617d619536cd810a694efee5a 100644 (file)
@@ -1,4 +1,5 @@
 // ignore-emscripten no threads support
+// ignore-sgx no thread sleep support
 
 use std::thread::{self, sleep};
 use std::time::Duration;
index 2705950b014243cdf0336e8376039a82cf344548..1274f032a3e298fdaac584eecdd6c1dbc7a83d09 100644 (file)
@@ -9,6 +9,7 @@
 // ignore-wasm
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 // ignore-musl FIXME #31506
 // ignore-pretty
 // compile-flags: -C lto
index ff264421cfbcf9aa656ad6f0543ac28681da6e2e..92a0cc3a07b5211d629e9d23f5ed435f0e126a97 100644 (file)
@@ -9,6 +9,7 @@
 // ignore-wasm
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 // ignore-musl FIXME #31506
 
 use std::mem;
index 281c6a17aa997ceb1df44fddee45f6c2016f487f..1824162b8bac65c95774025655190314251b584d 100644 (file)
@@ -1,5 +1,6 @@
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 use std::env;
 use std::io::prelude::*;
index 07e60114018929b6694724f30891b994c7ec7b77..c4e9e9ea5ee1ab26118b791834086a427cec8dea 100644 (file)
@@ -55,6 +55,15 @@ pub fn size() -> usize { 16 }
     }
 }
 
+#[cfg(target_env = "sgx")]
+mod m {
+    #[cfg(target_arch = "x86_64")]
+    pub mod m {
+        pub fn align() -> usize { 8 }
+        pub fn size() -> usize { 16 }
+    }
+}
+
 #[cfg(target_os = "windows")]
 mod m {
     #[cfg(target_arch = "x86")]
index d4476ab0a310f02862b45737c7b5fe77b7d73420..391cbbdd42daff667066eca48bcfe11311264cd7 100644 (file)
@@ -3,6 +3,7 @@
 // ignore-emscripten no threads or sockets support
 // ignore-netbsd system ulimit (Too many open files)
 // ignore-openbsd system ulimit (Too many open files)
+// ignore-sgx no thread sleep support
 
 use std::io::prelude::*;
 use std::net::{TcpListener, TcpStream};
index 981ac1663560248d2359a9a57f9eb090caa99535..15e10dc250f19b87ac710c86aa023e19481ca9bb 100644 (file)
@@ -2,6 +2,7 @@
 
 // ignore-cloudabi networking not available
 // ignore-wasm32-bare networking not available
+// ignore-sgx ToSocketAddrs cannot be used for DNS Resolution
 
 use std::net::ToSocketAddrs;
 
index 05871ba7d4c606bf5c3532922d2b118014b369ef..97caddde41214756ea60c807dff1418f8aa721c3 100644 (file)
@@ -1,6 +1,7 @@
 #![allow(stable_features)]
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 #![feature(process_try_wait)]
 
diff --git a/src/test/run-pass/union/union-nonzero.rs b/src/test/run-pass/union/union-nonzero.rs
new file mode 100644 (file)
index 0000000..bd84b46
--- /dev/null
@@ -0,0 +1,51 @@
+// run-pass
+#![allow(dead_code)]
+
+// Tests that unions aren't subject to unsafe non-zero/niche-filling optimizations.
+//
+// For example, if a union `U` can contain both a `&T` and a `*const T`, there's definitely no
+// bit-value that an `Option<U>` could reuse as `None`; this test makes sure that isn't done.
+//
+// Secondly, this tests the status quo (not a guarantee; subject to change!) to not apply such
+// optimizations to types containing unions even if they're theoretically possible. (discussion:
+// https://github.com/rust-lang/rust/issues/36394)
+//
+// Notably this nails down part of the behavior that `MaybeUninit` assumes: that a
+// `Option<MaybeUninit<&u8>>` does not take advantage of non-zero optimization, and thus is a safe
+// construct.
+
+use std::mem::{size_of, transmute};
+
+union U1<A: Copy> {
+    a: A,
+}
+
+union U2<A: Copy, B: Copy> {
+    a: A,
+    b: B,
+}
+
+// Option<E> uses a value other than 0 and 1 as None
+#[derive(Clone,Copy)]
+enum E {
+    A = 0,
+    B = 1,
+}
+
+fn main() {
+    // Unions do not participate in niche-filling/non-zero optimization...
+    assert!(size_of::<Option<U2<&u8, u8>>>() > size_of::<U2<&u8, u8>>());
+    assert!(size_of::<Option<U2<&u8, ()>>>() > size_of::<U2<&u8, ()>>());
+    assert!(size_of::<Option<U2<u8, E>>>() > size_of::<U2<u8, E>>());
+
+    // ...even when theoretically possible:
+    assert!(size_of::<Option<U1<&u8>>>() > size_of::<U1<&u8>>());
+    assert!(size_of::<Option<U2<&u8, &u8>>>() > size_of::<U2<&u8, &u8>>());
+
+    // The unused bits of the () variant can have any value.
+    let zeroed: U2<&u8, ()> = unsafe { transmute(std::ptr::null::<u8>()) };
+
+    if let None = Some(zeroed) {
+        panic!()
+    }
+}
index e9869866a9bfcae54614f040270396c9c6f24dd4..1f32bd00a037ce991199cc5e396429eb90b0c3f4 100644 (file)
@@ -1,5 +1,6 @@
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 #![feature(rustc_private)]
 
index 1b6ffc4c2bfdac4fc16bb37596f5a0a3661d2647..cd9450a5697c6a8af03cd85354cfc56efad75507 100644 (file)
@@ -1,5 +1,5 @@
 // ignore-wasm32-bare no libc to test ffi with
-
+// ignore-sgx no libc
 // GetLastError doesn't seem to work with stack switching
 
 #[cfg(windows)]
index aa3f539ba32a314c3961181b4e54fabbbf807e67..4b2a91e9c812722f4a6f66beb1692e8ea56037a6 100644 (file)
@@ -1,6 +1,4 @@
-//~ ERROR Missing code example in this documentation
-
-#![deny(missing_doc_code_examples)]
+#![deny(missing_doc_code_examples)] //~ ERROR Missing code example in this documentation
 
 /// Some docs.
 //~^ ERROR Missing code example in this documentation
index 208bdedf24ddb6b10aebd044bdfc6b5118fb770e..23c07c4d32d64359d43a4a4ead40dbac4ba40050 100644 (file)
@@ -1,25 +1,35 @@
 error: Missing code example in this documentation
+  --> $DIR/doc-without-codeblock.rs:1:1
+   |
+LL | / #![deny(missing_doc_code_examples)]
+LL | |
+LL | | /// Some docs.
+LL | |
+...  |
+LL | |     pub fn bar() {}
+LL | | }
+   | |_^
    |
 note: lint level defined here
-  --> $DIR/doc-without-codeblock.rs:3:9
+  --> $DIR/doc-without-codeblock.rs:1:9
    |
 LL | #![deny(missing_doc_code_examples)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: Missing code example in this documentation
-  --> $DIR/doc-without-codeblock.rs:5:1
+  --> $DIR/doc-without-codeblock.rs:3:1
    |
 LL | /// Some docs.
    | ^^^^^^^^^^^^^^
 
 error: Missing code example in this documentation
-  --> $DIR/doc-without-codeblock.rs:9:1
+  --> $DIR/doc-without-codeblock.rs:7:1
    |
 LL | /// And then, the princess died.
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: Missing code example in this documentation
-  --> $DIR/doc-without-codeblock.rs:12:5
+  --> $DIR/doc-without-codeblock.rs:10:5
    |
 LL |     /// Or maybe not because she saved herself!
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index 7b1cd702731402003757e742d75bda70c775f63e..45efa30d9919c5b51977350700233a44d5fe6b90 100644 (file)
@@ -15,7 +15,7 @@ error[E0425]: cannot find value `no` in this scope
 error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0425`.
-thread '$DIR/failed-doctest-output.rs - OtherStruct (line 17)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:319:13
+thread '$DIR/failed-doctest-output.rs - OtherStruct (line 17)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:320:13
 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
 
 ---- $DIR/failed-doctest-output.rs - SomeStruct (line 11) stdout ----
@@ -24,7 +24,7 @@ thread '$DIR/failed-doctest-output.rs - SomeStruct (line 11)' panicked at 'test
 thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:3:1
 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
 
-', src/librustdoc/test.rs:341:17
+', src/librustdoc/test.rs:342:17
 
 
 failures:
diff --git a/src/test/rustdoc-ui/lint-missing-doc-code-example.rs b/src/test/rustdoc-ui/lint-missing-doc-code-example.rs
new file mode 100644 (file)
index 0000000..ffe0ddc
--- /dev/null
@@ -0,0 +1,40 @@
+#![deny(missing_docs)]
+#![deny(missing_doc_code_examples)]
+
+//! crate level doc
+//! ```
+//! println!("hello"):
+//! ```
+
+
+/// doc
+///
+/// ```
+/// println!("hello");
+/// ```
+fn test() {
+}
+
+#[allow(missing_docs)]
+mod module1 { //~ ERROR
+}
+
+#[allow(missing_doc_code_examples)]
+/// doc
+mod module2 {
+
+  /// doc
+  pub fn test() {}
+}
+
+/// doc
+///
+/// ```
+/// println!("hello");
+/// ```
+pub mod module3 {
+
+  /// doc
+  //~^ ERROR
+  pub fn test() {}
+}
diff --git a/src/test/rustdoc-ui/lint-missing-doc-code-example.stderr b/src/test/rustdoc-ui/lint-missing-doc-code-example.stderr
new file mode 100644 (file)
index 0000000..97a52a1
--- /dev/null
@@ -0,0 +1,21 @@
+error: Missing code example in this documentation
+  --> $DIR/lint-missing-doc-code-example.rs:19:1
+   |
+LL | / mod module1 {
+LL | | }
+   | |_^
+   |
+note: lint level defined here
+  --> $DIR/lint-missing-doc-code-example.rs:2:9
+   |
+LL | #![deny(missing_doc_code_examples)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Missing code example in this documentation
+  --> $DIR/lint-missing-doc-code-example.rs:37:3
+   |
+LL |   /// doc
+   |   ^^^^^^^
+
+error: aborting due to 2 previous errors
+
index 7048ef2c58977af8aec254ddcedfa92e9d065bcf..f31b64fbce36a9833696f4de00917060d1737477 100644 (file)
@@ -13,7 +13,7 @@ error: unterminated double quote string
 
 error: aborting due to previous error
 
-thread '$DIR/unparseable-doc-test.rs - foo (line 6)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:319:13
+thread '$DIR/unparseable-doc-test.rs - foo (line 6)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:320:13
 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
 
 
diff --git a/src/test/rustdoc/async-move-doctest.rs b/src/test/rustdoc/async-move-doctest.rs
new file mode 100644 (file)
index 0000000..4272313
--- /dev/null
@@ -0,0 +1,14 @@
+// compile-flags:--test
+// edition:2018
+
+// prior to setting the default edition for the doctest pre-parser, this doctest would fail due to
+// a fatal parsing error
+// see https://github.com/rust-lang/rust/issues/59313
+
+//! ```
+//! #![feature(async_await)]
+//!
+//! fn foo() {
+//!     drop(async move {});
+//! }
+//! ```
index eb0e3f065c7b3b50a4066fb4ed0b3cf7689e0039..6ecdad3ec0000aa04592ec1b0354e132198d5113 100644 (file)
@@ -8,8 +8,8 @@ pub extern "C" fn f() {}
 #[export_name = "bar"]
 pub extern "C" fn g() {}
 
-// @has foo/enum.Foo.html '//*[@class="docblock attributes"]' '#[repr(i64)]'
-// @has foo/enum.Foo.html '//*[@class="docblock attributes"]' '#[must_use]'
+// @has foo/enum.Foo.html '//*[@class="docblock attributes top-attr"]' '#[repr(i64)]'
+// @has foo/enum.Foo.html '//*[@class="docblock attributes top-attr"]' '#[must_use]'
 #[repr(i64)]
 #[must_use]
 pub enum Foo {
diff --git a/src/test/rustdoc/generic-const.rs b/src/test/rustdoc/generic-const.rs
new file mode 100644 (file)
index 0000000..d6794ac
--- /dev/null
@@ -0,0 +1,30 @@
+#![feature(const_generics)]
+#![crate_name = "foo"]
+
+// ignore-tidy-linelength
+
+pub enum Order {
+    Sorted,
+    Unsorted,
+}
+
+// @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
+// @has foo/struct.VSet.html '//h3[@id="impl-Send"]/code' 'impl<const ORDER: Order, T> Send for VSet<T, ORDER>'
+// @has foo/struct.VSet.html '//h3[@id="impl-Sync"]/code' 'impl<const ORDER: Order, T> Sync for VSet<T, ORDER>'
+pub struct VSet<T, const ORDER: Order> {
+    inner: Vec<T>,
+}
+
+// @has foo/struct.VSet.html '//h3[@id="impl"]/code' 'impl<T> VSet<T, { Order::Sorted }>'
+impl <T> VSet<T, {Order::Sorted}> {
+    pub fn new() -> Self {
+        Self { inner: Vec::new() }
+    }
+}
+
+// @has foo/struct.VSet.html '//h3[@id="impl-1"]/code' 'impl<T> VSet<T, { Order::Unsorted }>'
+impl <T> VSet<T, {Order::Unsorted}> {
+    pub fn new() -> Self {
+        Self { inner: Vec::new() }
+    }
+}
diff --git a/src/test/rustdoc/intra-link-libstd-re-export.rs b/src/test/rustdoc/intra-link-libstd-re-export.rs
new file mode 100644 (file)
index 0000000..6f23929
--- /dev/null
@@ -0,0 +1,3 @@
+#![deny(intra_doc_link_resolution_failure)]
+
+pub use std::*;
index fb1be7397e65d659875e7231a18fc77e3d81c5bb..018716ad45af344f5fafd908b9b6cbe97004379d 100644 (file)
@@ -11,4 +11,4 @@
 pub fn dummy() {}
 
 // ensure that `extern crate foo;` was inserted into code snips automatically:
-// @matches foo/index.html '//a[@class="test-arrow"][@href="https://example.com/?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20foo%3B%0Afn%20main()%20%7B%0Ause%20foo%3A%3Adummy%3B%0Adummy()%3B%0A%7D"]' "Run"
+// @matches foo/index.html '//a[@class="test-arrow"][@href="https://example.com/?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20foo%3B%0Afn%20main()%20%7B%0Ause%20foo%3A%3Adummy%3B%0Adummy()%3B%0A%7D&edition=2015"]' "Run"
index 1b76e6c885349c6bec037c1912f8ac89455f90f6..9971c7b4297a25d9162d580f6bb0097a279a028e 100644 (file)
@@ -24,6 +24,6 @@
 //! }
 //! ```
 
-// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D"]' "Run"
-// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aprintln!(%22Hello%2C%20world!%22)%3B%0A%7D"]' "Run"
-// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D&version=nightly"]' "Run"
+// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D&edition=2015"]' "Run"
+// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aprintln!(%22Hello%2C%20world!%22)%3B%0A%7D&edition=2015"]' "Run"
+// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D&version=nightly&edition=2015"]' "Run"
diff --git a/src/test/ui/arbitrary-self-types-not-object-safe.rs b/src/test/ui/arbitrary-self-types-not-object-safe.rs
deleted file mode 100644 (file)
index 2c1fd93..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#![feature(arbitrary_self_types)]
-
-use std::rc::Rc;
-
-trait Foo {
-    fn foo(self: &Rc<Self>) -> usize;
-}
-
-trait Bar {
-    fn foo(self: &Rc<Self>) -> usize where Self: Sized;
-    fn bar(self: Rc<Self>) -> usize;
-}
-
-impl Foo for usize {
-    fn foo(self: &Rc<Self>) -> usize {
-        **self
-    }
-}
-
-impl Bar for usize {
-    fn foo(self: &Rc<Self>) -> usize {
-        **self
-    }
-
-    fn bar(self: Rc<Self>) -> usize {
-        *self
-    }
-}
-
-fn make_foo() {
-    let x = Rc::new(5usize) as Rc<Foo>;
-    //~^ ERROR E0038
-    //~| ERROR E0038
-}
-
-fn make_bar() {
-    let x = Rc::new(5usize) as Rc<Bar>;
-    x.bar();
-}
-
-fn main() {}
diff --git a/src/test/ui/arbitrary-self-types-not-object-safe.stderr b/src/test/ui/arbitrary-self-types-not-object-safe.stderr
deleted file mode 100644 (file)
index dacab12..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0038]: the trait `Foo` cannot be made into an object
-  --> $DIR/arbitrary-self-types-not-object-safe.rs:31:32
-   |
-LL |     let x = Rc::new(5usize) as Rc<Foo>;
-   |                                ^^^^^^^ the trait `Foo` cannot be made into an object
-   |
-   = note: method `foo`'s receiver cannot be dispatched on
-
-error[E0038]: the trait `Foo` cannot be made into an object
-  --> $DIR/arbitrary-self-types-not-object-safe.rs:31:13
-   |
-LL |     let x = Rc::new(5usize) as Rc<Foo>;
-   |             ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
-   |
-   = note: method `foo`'s receiver cannot be dispatched on
-   = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::rc::Rc<dyn Foo>>` for `std::rc::Rc<usize>`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0038`.
diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr
new file mode 100644 (file)
index 0000000..ca99304
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:29
+   |
+LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
+   |        --  -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+...
+LL |     let z: I::A = if cond { x } else { y };
+   |                             ^ assignment requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40
+   |
+LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
+   |        --  -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+...
+LL |     let z: I::A = if cond { x } else { y };
+   |                                        ^ assignment requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr b/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr
new file mode 100644 (file)
index 0000000..d8506b9
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/associated-types-subtyping-1.rs:24:12
+   |
+LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
+   |            -- -- lifetime `'b` defined here
+   |            |
+   |            lifetime `'a` defined here
+...
+LL |     let a: <T as Trait<'a>>::Type = make_any();
+   |            ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/associated-types-subtyping-1.rs:35:13
+   |
+LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
+   |            -- -- lifetime `'b` defined here
+   |            |
+   |            lifetime `'a` defined here
+...
+LL |     let _c: <T as Trait<'a>>::Type = b;
+   |             ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr
new file mode 100644 (file)
index 0000000..779e6da
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-contravariant.rs:45:4
+   |
+LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
+   |              -- -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+...
+LL |    (a, b)
+   |    ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-contravariant.rs:45:4
+   |
+LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
+   |              -- -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+...
+LL |    (a, b)
+   |    ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr
new file mode 100644 (file)
index 0000000..f532c96
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-contravariant.rs:38:4
+   |
+LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
+   |        -- lifetime `'a` defined here
+LL |    bar(foo, x)
+   |    ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr
new file mode 100644 (file)
index 0000000..c45082f
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-invariant.rs:55:4
+   |
+LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+   |              -- -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+...
+LL |    (a, b)
+   |    ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-invariant.rs:55:4
+   |
+LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+   |              -- -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+...
+LL |    (a, b)
+   |    ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr
new file mode 100644 (file)
index 0000000..2c11e7f
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-invariant.rs:38:12
+   |
+LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+   |        -- -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+LL |    let f = foo; // <-- No consistent type can be inferred for `f` here.
+LL |    let a = bar(f, x);
+   |            ^^^^^^^^^ argument requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-invariant.rs:39:12
+   |
+LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+   |        -- -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+...
+LL |    let b = bar(f, y);
+   |            ^^^^^^^^^ argument requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr
new file mode 100644 (file)
index 0000000..8be0ad6
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-invariant.rs:48:4
+   |
+LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
+   |        -- lifetime `'a` defined here
+...
+LL |    bar(foo, x)
+   |    ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
index b2e8e4be172448ec1992086156e90fd13709e049..f59f1160e703e4bd82eec71654567c737666ee61 100644 (file)
@@ -22,6 +22,4 @@ macro_rules! await {
     () => {}
 }
 
-fn main() {
-    match await { await => () } //~ ERROR expected `!`, found `{`
-}
+fn main() {}
index 076a31bd9ced67fc1180c74ca2aab2ba2ec182b1..c4b82b29f0270f30da71337f84f335b0be32ec1b 100644 (file)
@@ -68,13 +68,5 @@ help: you can escape reserved keywords to use them as identifiers
 LL | macro_rules! r#await {
    |              ^^^^^^^
 
-error: expected `!`, found `{`
-  --> $DIR/2018-edition-error-in-non-macro-position.rs:26:17
-   |
-LL |     match await { await => () }
-   |     -----       ^ expected `!`
-   |     |
-   |     while parsing this match expression
-
-error: aborting due to 8 previous errors
+error: aborting due to 7 previous errors
 
index e0b2962ce9791975acab3dc4bb0d8f7c6c0fd71d..d856869684266c1927441a514bafc40f9a27644d 100644 (file)
@@ -9,6 +9,4 @@ pub mod await { //~ ERROR expected identifier
 use self::outer_mod::await::await; //~ ERROR expected identifier
     //~^ ERROR expected identifier, found reserved keyword `await`
 
-fn main() {
-    match await { await => () } //~ ERROR expected `!`, found `{`
-}
+fn main() {}
index c8bf9b42ca5459f1b28e86c23135ef44d39659c9..8afe5c1a36b36db695f0b341e01795a3a1f96822 100644 (file)
@@ -38,13 +38,5 @@ help: you can escape reserved keywords to use them as identifiers
 LL | use self::outer_mod::await::r#await;
    |                             ^^^^^^^
 
-error: expected `!`, found `{`
-  --> $DIR/2018-edition-error.rs:13:17
-   |
-LL |     match await { await => () }
-   |     -----       ^ expected `!`
-   |     |
-   |     while parsing this match expression
-
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/await-keyword/incorrect-syntax-suggestions.rs b/src/test/ui/await-keyword/incorrect-syntax-suggestions.rs
new file mode 100644 (file)
index 0000000..e1e5bdd
--- /dev/null
@@ -0,0 +1,111 @@
+// edition:2018
+
+#![feature(async_await)]
+
+async fn bar() -> Result<(), ()> {
+    Ok(())
+}
+
+async fn foo1() -> Result<(), ()> {
+    let _ = await bar(); //~ ERROR incorrect use of `await`
+    Ok(())
+}
+async fn foo2() -> Result<(), ()> {
+    let _ = await? bar(); //~ ERROR incorrect use of `await`
+    Ok(())
+}
+async fn foo3() -> Result<(), ()> {
+    let _ = await bar()?; //~ ERROR incorrect use of `await`
+    //~^ ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
+    Ok(())
+}
+async fn foo21() -> Result<(), ()> {
+    let _ = await { bar() }; //~ ERROR incorrect use of `await`
+    Ok(())
+}
+async fn foo22() -> Result<(), ()> {
+    let _ = await(bar()); //~ ERROR incorrect use of `await`
+    Ok(())
+}
+async fn foo23() -> Result<(), ()> {
+    let _ = await { bar() }?; //~ ERROR incorrect use of `await`
+    Ok(())
+}
+async fn foo4() -> Result<(), ()> {
+    let _ = (await bar())?; //~ ERROR incorrect use of `await`
+    Ok(())
+}
+async fn foo5() -> Result<(), ()> {
+    let _ = bar().await(); //~ ERROR incorrect use of `await`
+    Ok(())
+}
+async fn foo6() -> Result<(), ()> {
+    let _ = bar().await()?; //~ ERROR incorrect use of `await`
+    Ok(())
+}
+async fn foo7() -> Result<(), ()> {
+    let _ = bar().await; // OK
+    Ok(())
+}
+async fn foo8() -> Result<(), ()> {
+    let _ = bar().await?; // OK
+    Ok(())
+}
+fn foo9() -> Result<(), ()> {
+    let _ = await bar(); //~ ERROR `await` is only allowed inside `async` functions and blocks
+    //~^ ERROR incorrect use of `await`
+    Ok(())
+}
+fn foo10() -> Result<(), ()> {
+    let _ = await? bar(); //~ ERROR `await` is only allowed inside `async` functions and blocks
+    //~^ ERROR incorrect use of `await`
+    Ok(())
+}
+fn foo11() -> Result<(), ()> {
+    let _ = await bar()?; //~ ERROR `await` is only allowed inside `async` functions and blocks
+    //~^ ERROR incorrect use of `await`
+    Ok(())
+}
+fn foo12() -> Result<(), ()> {
+    let _ = (await bar())?; //~ ERROR `await` is only allowed inside `async` functions and blocks
+    //~^ ERROR incorrect use of `await`
+    Ok(())
+}
+fn foo13() -> Result<(), ()> {
+    let _ = bar().await(); //~ ERROR `await` is only allowed inside `async` functions and blocks
+    //~^ ERROR incorrect use of `await`
+    Ok(())
+}
+fn foo14() -> Result<(), ()> {
+    let _ = bar().await()?; //~ ERROR `await` is only allowed inside `async` functions and blocks
+    //~^ ERROR incorrect use of `await`
+    Ok(())
+}
+fn foo15() -> Result<(), ()> {
+    let _ = bar().await; //~ ERROR `await` is only allowed inside `async` functions and blocks
+    Ok(())
+}
+fn foo16() -> Result<(), ()> {
+    let _ = bar().await?; //~ ERROR `await` is only allowed inside `async` functions and blocks
+    Ok(())
+}
+fn foo24() -> Result<(), ()> {
+    fn foo() -> Result<(), ()> {
+        let _ = bar().await?; //~ ERROR `await` is only allowed inside `async` functions and blocks
+        Ok(())
+    }
+    foo()
+}
+fn foo25() -> Result<(), ()> {
+    let foo = || {
+        let _ = bar().await?; //~ ERROR `await` is only allowed inside `async` functions and blocks
+        Ok(())
+    };
+    foo()
+}
+
+fn main() {
+    match await { await => () }
+    //~^ ERROR expected expression, found `=>`
+    //~| ERROR incorrect use of `await`
+} //~ ERROR expected one of `.`, `?`, `{`, or an operator, found `}`
diff --git a/src/test/ui/await-keyword/incorrect-syntax-suggestions.stderr b/src/test/ui/await-keyword/incorrect-syntax-suggestions.stderr
new file mode 100644 (file)
index 0000000..380da44
--- /dev/null
@@ -0,0 +1,207 @@
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:10:13
+   |
+LL |     let _ = await bar();
+   |             ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:14:13
+   |
+LL |     let _ = await? bar();
+   |             ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await?`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:18:13
+   |
+LL |     let _ = await bar()?;
+   |             ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:23:13
+   |
+LL |     let _ = await { bar() };
+   |             ^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ bar() }.await`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:27:13
+   |
+LL |     let _ = await(bar());
+   |             ^^^^^^^^^^^^ help: `await` is a postfix operation: `(bar()).await`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:31:13
+   |
+LL |     let _ = await { bar() }?;
+   |             ^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ bar() }.await`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:35:14
+   |
+LL |     let _ = (await bar())?;
+   |              ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:39:24
+   |
+LL |     let _ = bar().await();
+   |                        ^^ help: `await` is not a method call, remove the parentheses
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:43:24
+   |
+LL |     let _ = bar().await()?;
+   |                        ^^ help: `await` is not a method call, remove the parentheses
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:55:13
+   |
+LL |     let _ = await bar();
+   |             ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:60:13
+   |
+LL |     let _ = await? bar();
+   |             ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await?`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:65:13
+   |
+LL |     let _ = await bar()?;
+   |             ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:70:14
+   |
+LL |     let _ = (await bar())?;
+   |              ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:75:24
+   |
+LL |     let _ = bar().await();
+   |                        ^^ help: `await` is not a method call, remove the parentheses
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:80:24
+   |
+LL |     let _ = bar().await()?;
+   |                        ^^ help: `await` is not a method call, remove the parentheses
+
+error: expected expression, found `=>`
+  --> $DIR/incorrect-syntax-suggestions.rs:108:25
+   |
+LL |     match await { await => () }
+   |                   ----- ^^ expected expression
+   |                   |
+   |                   while parsing this incorrect await expression
+
+error: incorrect use of `await`
+  --> $DIR/incorrect-syntax-suggestions.rs:108:11
+   |
+LL |     match await { await => () }
+   |           ^^^^^^^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ await => () }.await`
+
+error: expected one of `.`, `?`, `{`, or an operator, found `}`
+  --> $DIR/incorrect-syntax-suggestions.rs:111:1
+   |
+LL |     match await { await => () }
+   |     -----                      - expected one of `.`, `?`, `{`, or an operator here
+   |     |
+   |     while parsing this match expression
+...
+LL | }
+   | ^ unexpected token
+
+error[E0728]: `await` is only allowed inside `async` functions and blocks
+  --> $DIR/incorrect-syntax-suggestions.rs:55:13
+   |
+LL | fn foo9() -> Result<(), ()> {
+   |    ---- this is not `async`
+LL |     let _ = await bar();
+   |             ^^^^^^^^^^^ only allowed inside `async` functions and blocks
+
+error[E0728]: `await` is only allowed inside `async` functions and blocks
+  --> $DIR/incorrect-syntax-suggestions.rs:60:13
+   |
+LL | fn foo10() -> Result<(), ()> {
+   |    ----- this is not `async`
+LL |     let _ = await? bar();
+   |             ^^^^^^^^^^^^ only allowed inside `async` functions and blocks
+
+error[E0728]: `await` is only allowed inside `async` functions and blocks
+  --> $DIR/incorrect-syntax-suggestions.rs:65:13
+   |
+LL | fn foo11() -> Result<(), ()> {
+   |    ----- this is not `async`
+LL |     let _ = await bar()?;
+   |             ^^^^^^^^^^^^ only allowed inside `async` functions and blocks
+
+error[E0728]: `await` is only allowed inside `async` functions and blocks
+  --> $DIR/incorrect-syntax-suggestions.rs:70:14
+   |
+LL | fn foo12() -> Result<(), ()> {
+   |    ----- this is not `async`
+LL |     let _ = (await bar())?;
+   |              ^^^^^^^^^^^ only allowed inside `async` functions and blocks
+
+error[E0728]: `await` is only allowed inside `async` functions and blocks
+  --> $DIR/incorrect-syntax-suggestions.rs:75:13
+   |
+LL | fn foo13() -> Result<(), ()> {
+   |    ----- this is not `async`
+LL |     let _ = bar().await();
+   |             ^^^^^^^^^^^ only allowed inside `async` functions and blocks
+
+error[E0728]: `await` is only allowed inside `async` functions and blocks
+  --> $DIR/incorrect-syntax-suggestions.rs:80:13
+   |
+LL | fn foo14() -> Result<(), ()> {
+   |    ----- this is not `async`
+LL |     let _ = bar().await()?;
+   |             ^^^^^^^^^^^ only allowed inside `async` functions and blocks
+
+error[E0728]: `await` is only allowed inside `async` functions and blocks
+  --> $DIR/incorrect-syntax-suggestions.rs:85:13
+   |
+LL | fn foo15() -> Result<(), ()> {
+   |    ----- this is not `async`
+LL |     let _ = bar().await;
+   |             ^^^^^^^^^^^ only allowed inside `async` functions and blocks
+
+error[E0728]: `await` is only allowed inside `async` functions and blocks
+  --> $DIR/incorrect-syntax-suggestions.rs:89:13
+   |
+LL | fn foo16() -> Result<(), ()> {
+   |    ----- this is not `async`
+LL |     let _ = bar().await?;
+   |             ^^^^^^^^^^^ only allowed inside `async` functions and blocks
+
+error[E0728]: `await` is only allowed inside `async` functions and blocks
+  --> $DIR/incorrect-syntax-suggestions.rs:94:17
+   |
+LL |     fn foo() -> Result<(), ()> {
+   |        --- this is not `async`
+LL |         let _ = bar().await?;
+   |                 ^^^^^^^^^^^ only allowed inside `async` functions and blocks
+
+error[E0728]: `await` is only allowed inside `async` functions and blocks
+  --> $DIR/incorrect-syntax-suggestions.rs:101:17
+   |
+LL |     let foo = || {
+   |               -- this is not `async`
+LL |         let _ = bar().await?;
+   |                 ^^^^^^^^^^^ only allowed inside `async` functions and blocks
+
+error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
+  --> $DIR/incorrect-syntax-suggestions.rs:18:19
+   |
+LL |     let _ = await bar()?;
+   |                   ^^^^^^ the `?` operator cannot be applied to type `impl std::future::Future`
+   |
+   = help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
+   = note: required by `std::ops::Try::into_result`
+
+error: aborting due to 29 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
index 0996c38b3b6c61f18efcbefa970c498b3457bf8b..4e525974c2c6fbd521b03e8fbedcbbfc99a5cb7d 100644 (file)
@@ -2,7 +2,9 @@ error: expected expression, found `)`
   --> $DIR/post_expansion_error.rs:8:12
    |
 LL |     await!()
-   |            ^ expected expression
+   |     -----  ^ expected expression
+   |     |
+   |     while parsing this await macro call
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr
new file mode 100644 (file)
index 0000000..f66994b
--- /dev/null
@@ -0,0 +1,40 @@
+error[E0503]: cannot use `y` because it was mutably borrowed
+  --> $DIR/borrowck-anon-fields-variant.rs:17:7
+   |
+LL |       Foo::Y(ref mut a, _) => a,
+   |              --------- borrow of `y.0` occurs here
+...
+LL |       Foo::Y(_, ref mut b) => b,
+   |       ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
+...
+LL |     *a += 1;
+   |     ------- borrow later used here
+
+error[E0503]: cannot use `y` because it was mutably borrowed
+  --> $DIR/borrowck-anon-fields-variant.rs:37:7
+   |
+LL |       Foo::Y(ref mut a, _) => a,
+   |              --------- borrow of `y.0` occurs here
+...
+LL |       Foo::Y(ref mut b, _) => b,
+   |       ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
+...
+LL |     *a += 1;
+   |     ------- borrow later used here
+
+error[E0499]: cannot borrow `y.0` as mutable more than once at a time
+  --> $DIR/borrowck-anon-fields-variant.rs:37:14
+   |
+LL |       Foo::Y(ref mut a, _) => a,
+   |              --------- first mutable borrow occurs here
+...
+LL |       Foo::Y(ref mut b, _) => b,
+   |              ^^^^^^^^^ second mutable borrow occurs here
+...
+LL |     *a += 1;
+   |     ------- first borrow later used here
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0499, E0503.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.nll.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.nll.stderr
new file mode 100644 (file)
index 0000000..f1e1ae1
--- /dev/null
@@ -0,0 +1,366 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+  --> $DIR/borrowck-describe-lvalue.rs:262:13
+   |
+LL |             let y = &mut x;
+   |                     ------ first mutable borrow occurs here
+LL |             &mut x;
+   |             ^^^^^^ second mutable borrow occurs here
+LL |             *y = 1;
+   |             ------ first borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+  --> $DIR/borrowck-describe-lvalue.rs:272:20
+   |
+LL |                    let y = &mut x;
+   |                            ------ first mutable borrow occurs here
+LL |                    &mut x;
+   |                    ^^^^^^ second mutable borrow occurs here
+LL |                    *y = 1;
+   |                    ------ first borrow later used here
+
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/borrowck-describe-lvalue.rs:270:16
+   |
+LL |              || {
+   |               - inferred to be a `FnMut` closure
+LL | /                || {
+LL | |                    let y = &mut x;
+LL | |                    &mut x;
+LL | |                    *y = 1;
+LL | |                    drop(y);
+LL | |                 }
+   | |_________________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:41:9
+   |
+LL |         let x = f.x();
+   |                 - borrow of `f` occurs here
+LL |         f.x;
+   |         ^^^ use of borrowed `f`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:48:9
+   |
+LL |         let x = g.x();
+   |                 - borrow of `g` occurs here
+LL |         g.0;
+   |         ^^^ use of borrowed `g`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:55:9
+   |
+LL |         let x = &mut h.0;
+   |                 -------- borrow of `h.0` occurs here
+LL |         h.0;
+   |         ^^^ use of borrowed `h.0`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:63:20
+   |
+LL |         let x = e.x();
+   |                 - borrow of `e` occurs here
+LL |         match e {
+LL |             Baz::X(value) => value
+   |                    ^^^^^ use of borrowed `e`
+LL |         };
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:71:9
+   |
+LL |         let x = &mut u.a;
+   |                 -------- borrow of `u.a` occurs here
+LL |         u.a;
+   |         ^^^ use of borrowed `u.a`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:78:9
+   |
+LL |         let x = f.x();
+   |                 - borrow of `*f` occurs here
+LL |         f.x;
+   |         ^^^ use of borrowed `*f`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:85:9
+   |
+LL |         let x = g.x();
+   |                 - borrow of `*g` occurs here
+LL |         g.0;
+   |         ^^^ use of borrowed `*g`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:92:9
+   |
+LL |         let x = &mut h.0;
+   |                 -------- borrow of `h.0` occurs here
+LL |         h.0;
+   |         ^^^ use of borrowed `h.0`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:100:20
+   |
+LL |         let x = e.x();
+   |                 - borrow of `*e` occurs here
+LL |         match *e {
+LL |             Baz::X(value) => value
+   |                    ^^^^^ use of borrowed `*e`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:109:9
+   |
+LL |         let x = &mut u.a;
+   |                 -------- borrow of `u.a` occurs here
+LL |         u.a;
+   |         ^^^ use of borrowed `u.a`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:117:15
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+LL |         match v {
+LL |             &[x, _, .., _, _] => println!("{}", x),
+   |               ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:122:18
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[_, x, .., _, _] => println!("{}", x),
+   |                  ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:127:25
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[_, _, .., x, _] => println!("{}", x),
+   |                         ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:132:28
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[_, _, .., _, x] => println!("{}", x),
+   |                            ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:143:15
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+LL |         match v {
+LL |             &[x..] => println!("{:?}", x),
+   |               ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:148:18
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[_, x..] => println!("{:?}", x),
+   |                  ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:153:15
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[x.., _] => println!("{:?}", x),
+   |               ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:158:18
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[_, x.., _] => println!("{:?}", x),
+   |                  ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `e` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:171:13
+   |
+LL |         let x = &mut e;
+   |                 ------ borrow of `e` occurs here
+LL |         match e {
+LL |             E::A(ref ax) =>
+   |             ^^^^^^^^^^^^ use of borrowed `e`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:171:18
+   |
+LL |         let x = &mut e;
+   |                 ------ mutable borrow occurs here
+LL |         match e {
+LL |             E::A(ref ax) =>
+   |                  ^^^^^^ immutable borrow occurs here
+...
+LL |         drop(x);
+   |              - mutable borrow later used here
+
+error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:175:23
+   |
+LL |         let x = &mut e;
+   |                 ------ mutable borrow occurs here
+...
+LL |             E::B { x: ref bx } =>
+   |                       ^^^^^^ immutable borrow occurs here
+...
+LL |         drop(x);
+   |              - mutable borrow later used here
+
+error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:188:22
+   |
+LL |         let x = &mut s;
+   |                 ------ mutable borrow occurs here
+LL |         match s {
+LL |             S  { y: (ref y0, _), .. } =>
+   |                      ^^^^^^ immutable borrow occurs here
+...
+LL |         drop(x);
+   |              - mutable borrow later used here
+
+error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:194:28
+   |
+LL |         let x = &mut s;
+   |                 ------ mutable borrow occurs here
+...
+LL |             S  { x: F { y: ref x0, .. }, .. } =>
+   |                            ^^^^^^ immutable borrow occurs here
+...
+LL |         drop(x);
+   |              - mutable borrow later used here
+
+error[E0503]: cannot use `*v` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:240:9
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+LL |         v[0].y;
+   |         ^^^^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[_].y` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:240:9
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+LL |         v[0].y;
+   |         ^^^^^^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:251:24
+   |
+LL |         let x = &mut v;
+   |                 ------ mutable borrow occurs here
+LL |         match v {
+LL |             &[_, F {x: ref xf, ..}] => println!("{}", xf),
+   |                        ^^^^^^ immutable borrow occurs here
+...
+LL |         drop(x);
+   |              - mutable borrow later used here
+
+error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:210:29
+   |
+LL |             let x = &mut block;
+   |                     ---------- mutable borrow occurs here
+LL |             let p: &'a u8 = &*block.current;
+   |                             ^^^^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL |             drop(x);
+   |                  - mutable borrow later used here
+
+error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:227:33
+   |
+LL |             let x = &mut block;
+   |                     ---------- mutable borrow occurs here
+LL |             let p : *const u8 = &*(*block).current;
+   |                                 ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL |             drop(x);
+   |                  - mutable borrow later used here
+
+error[E0382]: use of moved value: `x`
+  --> $DIR/borrowck-describe-lvalue.rs:282:22
+   |
+LL |                 drop(x);
+   |                      - value moved here
+LL |                 drop(x);
+   |                      ^ value used here after move
+   |
+   = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 32 previous errors
+
+Some errors have detailed explanations: E0382, E0499, E0502, E0503.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr
new file mode 100644 (file)
index 0000000..3468f29
--- /dev/null
@@ -0,0 +1,27 @@
+error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-for-loop-head-linkage.rs:7:9
+   |
+LL |     for &x in &vector {
+   |               -------
+   |               |
+   |               immutable borrow occurs here
+   |               immutable borrow later used here
+LL |         let cap = vector.capacity();
+LL |         vector.extend(repeat(0));
+   |         ^^^^^^ mutable borrow occurs here
+
+error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-for-loop-head-linkage.rs:8:9
+   |
+LL |     for &x in &vector {
+   |               -------
+   |               |
+   |               immutable borrow occurs here
+   |               immutable borrow later used here
+...
+LL |         vector[1] = 5;
+   |         ^^^^^^ mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
index e7df319a0bb706cc770e6d5b5011eeca018f51cd..86061c8cd6e87de991958b3f6c5b9da565a03aca 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 struct Node {
     elem: i32,
     next: Option<Box<Node>>,
index a5462b41396854caa3062c1082c2c7d246ee198f..ee174f6736e1e72ebd85c94c4d432a0fdeecec0c 100644 (file)
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `src`
-  --> $DIR/borrowck-issue-48962.rs:16:5
+  --> $DIR/borrowck-issue-48962.rs:14:5
    |
 LL |     let mut src = &mut node;
    |         ------- move occurs because `src` has type `&mut Node`, which does not implement the `Copy` trait
@@ -9,7 +9,7 @@ LL |     src.next = None;
    |     ^^^^^^^^ value used here after move
 
 error[E0382]: use of moved value: `src`
-  --> $DIR/borrowck-issue-48962.rs:22:5
+  --> $DIR/borrowck-issue-48962.rs:20:5
    |
 LL |     let mut src = &mut (22, 44);
    |         ------- move occurs because `src` has type `&mut (i32, i32)`, which does not implement the `Copy` trait
diff --git a/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr b/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr
new file mode 100644 (file)
index 0000000..7e4a632
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0302]: cannot assign in a pattern guard
+  --> $DIR/borrowck-mutate-in-guard.rs:10:25
+   |
+LL |         Enum::A(_) if { x = Enum::B(false); false } => 1,
+   |                         ^^^^^^^^^^^^^^^^^^ assignment in pattern guard
+
+error[E0301]: cannot mutably borrow in a pattern guard
+  --> $DIR/borrowck-mutate-in-guard.rs:15:38
+   |
+LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
+   |                                      ^ borrowed mutably in pattern guard
+   |
+   = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
+
+error[E0302]: cannot assign in a pattern guard
+  --> $DIR/borrowck-mutate-in-guard.rs:15:41
+   |
+LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
+   |                                         ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
+
+error[E0510]: cannot assign `x` in match guard
+  --> $DIR/borrowck-mutate-in-guard.rs:10:25
+   |
+LL |     match x {
+   |           - value is immutable in match guard
+LL |         Enum::A(_) if { x = Enum::B(false); false } => 1,
+   |                         ^^^^^^^^^^^^^^^^^^ cannot assign
+
+error[E0510]: cannot mutably borrow `x` in match guard
+  --> $DIR/borrowck-mutate-in-guard.rs:15:33
+   |
+LL |     match x {
+   |           - value is immutable in match guard
+...
+LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
+   |                                 ^^^^^^ cannot mutably borrow
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0301, E0302, E0510.
+For more information about an error, try `rustc --explain E0301`.
diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr
new file mode 100644 (file)
index 0000000..49c3f86
--- /dev/null
@@ -0,0 +1,23 @@
+error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-object-lifetime.rs:20:13
+   |
+LL |     let y = x.borrowed();
+   |             - immutable borrow occurs here
+LL |     let z = x.mut_borrowed();
+   |             ^ mutable borrow occurs here
+LL |     y.use_ref();
+   |     - immutable borrow later used here
+
+error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-object-lifetime.rs:26:13
+   |
+LL |     let y = x.borrowed();
+   |             - immutable borrow occurs here
+LL |     let z = &mut x;
+   |             ^^^^^^ mutable borrow occurs here
+LL |     y.use_ref();
+   |     - immutable borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr
new file mode 100644 (file)
index 0000000..e6d0f88
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:9:5
+   |
+LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> {
+   |                      -- -- lifetime `'b` defined here
+   |                      |
+   |                      lifetime `'a` defined here
+LL |     S { pointer: &mut *p.pointer }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
index d8fff5f17760aab6783539732193647db8b1c08f..20ab905fec46e591df83e2f5021d6e67c75fcd35 100644 (file)
@@ -1,7 +1,5 @@
 // run-pass
 
-#![feature(nll)]
-
 enum Nat {
     S(Box<Nat>),
     Z
index a8bfdbad38ba423062edd89eae58d7c0ba878621..7d5acb95751ed99d467cfbb43e7cdb1838944316 100644 (file)
@@ -8,8 +8,6 @@
 
 // run-pass
 
-#![feature(nll)]
-
 fn foo(x: &mut Result<(u32, u32), (u32, u32)>) -> u32 {
     match *x {
         Ok((ref mut v, _)) | Err((_, ref mut v)) if *v > 0 => { *v }
index 460e6b4bbae4d9b2d8b7b52f4a5d74675ab13274..671e83dfadc8b326709adc993e0a298ca7f125f4 100644 (file)
@@ -2,8 +2,6 @@
 // computing liveness that wound up accidentally causing the program
 // below to be accepted.
 
-#![feature(nll)]
-
 fn foo<'a>(x: &'a mut u32) -> u32 {
     let mut x = 22;
     let y = &x;
index e3216f5d33f986d7f7c268cacef4306beecce7fc..4abb6fb2c71868674dbf2266cd1c3afae61c9c71 100644 (file)
@@ -1,5 +1,5 @@
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/issue-52713-bug.rs:14:5
+  --> $DIR/issue-52713-bug.rs:12:5
    |
 LL |     let y = &x;
    |             -- borrow of `x` occurs here
index ad4accbbeeef93ccc5454be23d5a0eee165fc5f8..51df40016d8a78032e9d21ea4da358ec1a502d0f 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 #![allow(dead_code)]
 
 #[derive(Debug)]
index 6a12016b2a5e3b62ea17f37ee673f340e1ae5468..519f1d6fb2791b3107f8530d56ea0b4456750dd9 100644 (file)
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:16:13
+  --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:14:13
    |
 LL |             *array
    |             ^^^^^^
diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr
deleted file mode 100644 (file)
index efd4e1a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-error[E0506]: cannot assign to `greeting` because it is borrowed
-  --> $DIR/issue-58776-borrowck-scans-children.rs:11:5
-   |
-LL |     let res = (|| (|| &greeting)())();
-   |                --      -------- borrow occurs due to use in closure
-   |                |
-   |                borrow of `greeting` occurs here
-LL | 
-LL |     greeting = "DEALLOCATED".to_string();
-   |     ^^^^^^^^ assignment to borrowed `greeting` occurs here
-...
-LL |     println!("thread result: {:?}", res);
-   |                                     --- borrow later used here
-
-error[E0505]: cannot move out of `greeting` because it is borrowed
-  --> $DIR/issue-58776-borrowck-scans-children.rs:14:10
-   |
-LL |     let res = (|| (|| &greeting)())();
-   |                --      -------- borrow occurs due to use in closure
-   |                |
-   |                borrow of `greeting` occurs here
-...
-LL |     drop(greeting);
-   |          ^^^^^^^^ move out of `greeting` occurs here
-...
-LL |     println!("thread result: {:?}", res);
-   |                                     --- borrow later used here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0505, E0506.
-For more information about an error, try `rustc --explain E0505`.
index 0f3f1a639f7e049af6713e8fb6cb70002ab9fe2a..efa313a9d23f4c2ec6ae533dc923e881d6f79944 100644 (file)
@@ -1,19 +1,11 @@
-// ignore-compare-mode-nll
-
-// revisions: migrate nll
-
-#![cfg_attr(nll, feature(nll))]
-
 fn main() {
     let mut greeting = "Hello world!".to_string();
     let res = (|| (|| &greeting)())();
 
     greeting = "DEALLOCATED".to_string();
-    //[migrate]~^ ERROR cannot assign
-    //[nll]~^^ ERROR cannot assign
+    //~^ ERROR cannot assign
     drop(greeting);
-    //[migrate]~^ ERROR cannot move
-    //[nll]~^^ ERROR cannot move
+    //~^ ERROR cannot move
 
     println!("thread result: {:?}", res);
 }
diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr
new file mode 100644 (file)
index 0000000..9b1d6fa
--- /dev/null
@@ -0,0 +1,32 @@
+error[E0506]: cannot assign to `greeting` because it is borrowed
+  --> $DIR/issue-58776-borrowck-scans-children.rs:5:5
+   |
+LL |     let res = (|| (|| &greeting)())();
+   |                --      -------- borrow occurs due to use in closure
+   |                |
+   |                borrow of `greeting` occurs here
+LL | 
+LL |     greeting = "DEALLOCATED".to_string();
+   |     ^^^^^^^^ assignment to borrowed `greeting` occurs here
+...
+LL |     println!("thread result: {:?}", res);
+   |                                     --- borrow later used here
+
+error[E0505]: cannot move out of `greeting` because it is borrowed
+  --> $DIR/issue-58776-borrowck-scans-children.rs:7:10
+   |
+LL |     let res = (|| (|| &greeting)())();
+   |                --      -------- borrow occurs due to use in closure
+   |                |
+   |                borrow of `greeting` occurs here
+...
+LL |     drop(greeting);
+   |          ^^^^^^^^ move out of `greeting` occurs here
+...
+LL |     println!("thread result: {:?}", res);
+   |                                     --- borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0505, E0506.
+For more information about an error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/issue-7573.nll.stderr b/src/test/ui/borrowck/issue-7573.nll.stderr
new file mode 100644 (file)
index 0000000..0da715b
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/issue-7573.rs:21:9
+   |
+LL |     let mut lines_to_use: Vec<&CrateId> = Vec::new();
+   |         ---------------- `lines_to_use` is declared here, outside of the closure body
+LL |
+LL |     let push_id = |installed_id: &CrateId| {
+   |                    ------------ `installed_id` is a reference that is only valid in the closure body
+...
+LL |         lines_to_use.push(installed_id);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `installed_id` escapes the closure body here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr
new file mode 100644 (file)
index 0000000..4797a9d
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/regions-escape-bound-fn-2.rs:8:18
+   |
+LL |     let mut x = None;
+   |         ----- `x` is declared here, outside of the closure body
+LL |     with_int(|y| x = Some(y));
+   |               -  ^^^^^^^^^^^ `y` escapes the closure body here
+   |               |
+   |               `y` is a reference that is only valid in the closure body
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr
new file mode 100644 (file)
index 0000000..2b3a981
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/regions-escape-bound-fn.rs:8:18
+   |
+LL |     let mut x: Option<&isize> = None;
+   |         ----- `x` is declared here, outside of the closure body
+LL |     with_int(|y| x = Some(y));
+   |               -  ^^^^^^^^^^^ `y` escapes the closure body here
+   |               |
+   |               `y` is a reference that is only valid in the closure body
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr b/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr
new file mode 100644 (file)
index 0000000..8ceefd2
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/regions-escape-unboxed-closure.rs:6:23
+   |
+LL |     let mut x: Option<&isize> = None;
+   |         ----- `x` is declared here, outside of the closure body
+LL |     with_int(&mut |y| x = Some(y));
+   |                    -  ^^^^^^^^^^^ `y` escapes the closure body here
+   |                    |
+   |                    `y` is a reference that is only valid in the closure body
+
+error: aborting due to previous error
+
index b1a4c54f49b1538486509d85ead2c0895ba04ea7..12222342c95a1d7fbca0ed24924ba2ed7fc09be8 100644 (file)
@@ -1,8 +1,6 @@
 // Test that a borrow which starts as a 2-phase borrow and gets
 // carried around a loop winds up conflicting with itself.
 
-#![feature(nll)]
-
 struct Foo { x: String }
 
 impl Foo {
index 933d3eb71117c647b8a7b127f5b0e206e1367ab4..38993a50bf6b20e84b192b15731e221c56a79c4c 100644 (file)
@@ -1,5 +1,5 @@
 error[E0499]: cannot borrow `foo` as mutable more than once at a time
-  --> $DIR/two-phase-across-loop.rs:19:22
+  --> $DIR/two-phase-across-loop.rs:17:22
    |
 LL |         strings.push(foo.get_string());
    |                      ^^^ mutable borrow starts here in previous iteration of loop
index ed3d257da9f0f4f469bcfe77786775490f8da40f..bb646d7caf1e2ea917270a3ec137d3fb6e5e9b38 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 struct Foo {
 }
 
index c4168503e4cca50fe049aba6e1201b48cd8f27a5..33fa4a3a15075ab5fc066359c21e5fe975634991 100644 (file)
@@ -1,5 +1,5 @@
 error[E0499]: cannot borrow `foo` as mutable more than once at a time
-  --> $DIR/two-phase-multi-mut.rs:13:5
+  --> $DIR/two-phase-multi-mut.rs:11:5
    |
 LL |     foo.method(&mut foo);
    |     ^^^^------^--------^
@@ -9,7 +9,7 @@ LL |     foo.method(&mut foo);
    |     second mutable borrow occurs here
 
 error[E0499]: cannot borrow `foo` as mutable more than once at a time
-  --> $DIR/two-phase-multi-mut.rs:13:16
+  --> $DIR/two-phase-multi-mut.rs:11:16
    |
 LL |     foo.method(&mut foo);
    |     --- ------ ^^^^^^^^ second mutable borrow occurs here
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.nll.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.nll.stderr
new file mode 100644 (file)
index 0000000..d2ea5ab
--- /dev/null
@@ -0,0 +1,36 @@
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+  --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:13:9
+   |
+LL |         let shared = &v;
+   |                      -- immutable borrow occurs here
+LL | 
+LL |         v.push(shared.len());
+   |         ^      ------ immutable borrow later used here
+   |         |
+   |         mutable borrow occurs here
+
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+  --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:24:9
+   |
+LL |         let shared = &v;
+   |                      -- immutable borrow occurs here
+LL | 
+LL |         v.push(shared.len());
+   |         ^      ------ immutable borrow later used here
+   |         |
+   |         mutable borrow occurs here
+
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+  --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:37:9
+   |
+LL |         let shared = &v;
+   |                      -- immutable borrow occurs here
+LL | 
+LL |         v.push(shared.len());
+   |         ^      ------ immutable borrow later used here
+   |         |
+   |         mutable borrow occurs here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/c-variadic/variadic-ffi-4.nll.stderr b/src/test/ui/c-variadic/variadic-ffi-4.nll.stderr
new file mode 100644 (file)
index 0000000..a1afbb0
--- /dev/null
@@ -0,0 +1,81 @@
+error[E0621]: explicit lifetime required in the type of `ap`
+  --> $DIR/variadic-ffi-4.rs:8:5
+   |
+LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> {
+   |                                                       --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>`
+LL |     ap
+   |     ^^ lifetime `'a` required
+
+error[E0621]: explicit lifetime required in the type of `ap`
+  --> $DIR/variadic-ffi-4.rs:12:5
+   |
+LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> {
+   |                                                   --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>`
+LL |     ap
+   |     ^^ lifetime `'static` required
+
+error: lifetime may not live long enough
+  --> $DIR/variadic-ffi-4.rs:16:33
+   |
+LL |     let _ = ap.with_copy(|ap| { ap });
+   |                           ---   ^^ returning this value requires that `'1` must outlive `'2`
+   |                           | |
+   |                           | return type of closure is core::ffi::VaList<'2>
+   |                           has type `core::ffi::VaList<'1>`
+
+error: lifetime may not live long enough
+  --> $DIR/variadic-ffi-4.rs:20:5
+   |
+LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
+   |                                               -------               ------- has type `core::ffi::VaList<'1>`
+   |                                               |
+   |                                               has type `&mut core::ffi::VaList<'2>`
+LL |     *ap0 = ap1;
+   |     ^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: lifetime may not live long enough
+  --> $DIR/variadic-ffi-4.rs:24:5
+   |
+LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
+   |                                               ---               ------- has type `core::ffi::VaList<'2>`
+   |                                               |
+   |                                               has type `&mut core::ffi::VaList<'1>`
+LL |     ap0 = &mut ap1;
+   |     ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: lifetime may not live long enough
+  --> $DIR/variadic-ffi-4.rs:24:5
+   |
+LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
+   |                                               ---               ------- has type `core::ffi::VaList<'1>`
+   |                                               |
+   |                                               has type `&mut core::ffi::VaList<'2>`
+LL |     ap0 = &mut ap1;
+   |     ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error[E0384]: cannot assign to immutable argument `ap0`
+  --> $DIR/variadic-ffi-4.rs:24:5
+   |
+LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
+   |                                               --- help: make this binding mutable: `mut ap0`
+LL |     ap0 = &mut ap1;
+   |     ^^^^^^^^^^^^^^ cannot assign to immutable argument
+
+error[E0597]: `ap1` does not live long enough
+  --> $DIR/variadic-ffi-4.rs:24:11
+   |
+LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
+   |                                                    - let's call the lifetime of this reference `'1`
+LL |     ap0 = &mut ap1;
+   |     ------^^^^^^^^
+   |     |     |
+   |     |     borrowed value does not live long enough
+   |     assignment requires that `ap1` is borrowed for `'1`
+...
+LL | }
+   |  - `ap1` dropped here while still borrowed
+
+error: aborting due to 8 previous errors
+
+Some errors have detailed explanations: E0384, E0597, E0621.
+For more information about an error, try `rustc --explain E0384`.
diff --git a/src/test/ui/c-variadic/variadic-ffi-5.rs b/src/test/ui/c-variadic/variadic-ffi-5.rs
deleted file mode 100644 (file)
index fcc80d9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#![crate_type="lib"]
-#![no_std]
-#![feature(c_variadic)]
-// The tests in this file are similar to that of variadic-ffi-4, but this
-// one enables nll.
-#![feature(nll)]
-
-use core::ffi::VaList;
-
-pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> {
-    ap //~ ERROR: explicit lifetime required
-}
-
-pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> {
-    ap //~ ERROR: explicit lifetime required
-}
-
-pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) {
-    let _ = ap.with_copy(|ap| { ap }); //~ ERROR: lifetime may not live long enough
-}
-
-pub unsafe extern "C" fn no_escape3(_: usize, ap0: &mut VaList, mut ap1: ...) {
-    *ap0 = ap1; //~ ERROR: lifetime may not live long enough
-}
-
-pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
-    ap0 = &mut ap1;
-    //~^ ERROR: lifetime may not live long enough
-    //~^^ ERROR: lifetime may not live long enough
-    //~^^^ ERROR: `ap1` does not live long enough
-}
diff --git a/src/test/ui/c-variadic/variadic-ffi-5.stderr b/src/test/ui/c-variadic/variadic-ffi-5.stderr
deleted file mode 100644 (file)
index 2742101..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-error[E0621]: explicit lifetime required in the type of `ap`
-  --> $DIR/variadic-ffi-5.rs:11:5
-   |
-LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> {
-   |                                                       --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>`
-LL |     ap
-   |     ^^ lifetime `'a` required
-
-error[E0621]: explicit lifetime required in the type of `ap`
-  --> $DIR/variadic-ffi-5.rs:15:5
-   |
-LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> {
-   |                                                   --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>`
-LL |     ap
-   |     ^^ lifetime `'static` required
-
-error: lifetime may not live long enough
-  --> $DIR/variadic-ffi-5.rs:19:33
-   |
-LL |     let _ = ap.with_copy(|ap| { ap });
-   |                           ---   ^^ returning this value requires that `'1` must outlive `'2`
-   |                           | |
-   |                           | return type of closure is core::ffi::VaList<'2>
-   |                           has type `core::ffi::VaList<'1>`
-
-error: lifetime may not live long enough
-  --> $DIR/variadic-ffi-5.rs:23:5
-   |
-LL | pub unsafe extern "C" fn no_escape3(_: usize, ap0: &mut VaList, mut ap1: ...) {
-   |                                               ---               ------- has type `core::ffi::VaList<'1>`
-   |                                               |
-   |                                               has type `&mut core::ffi::VaList<'2>`
-LL |     *ap0 = ap1;
-   |     ^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
-
-error: lifetime may not live long enough
-  --> $DIR/variadic-ffi-5.rs:27:5
-   |
-LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
-   |                                               -------               ------- has type `core::ffi::VaList<'2>`
-   |                                               |
-   |                                               has type `&mut core::ffi::VaList<'1>`
-LL |     ap0 = &mut ap1;
-   |     ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
-
-error: lifetime may not live long enough
-  --> $DIR/variadic-ffi-5.rs:27:5
-   |
-LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
-   |                                               -------               ------- has type `core::ffi::VaList<'1>`
-   |                                               |
-   |                                               has type `&mut core::ffi::VaList<'2>`
-LL |     ap0 = &mut ap1;
-   |     ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
-
-error[E0597]: `ap1` does not live long enough
-  --> $DIR/variadic-ffi-5.rs:27:11
-   |
-LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
-   |                                                        - let's call the lifetime of this reference `'1`
-LL |     ap0 = &mut ap1;
-   |     ------^^^^^^^^
-   |     |     |
-   |     |     borrowed value does not live long enough
-   |     assignment requires that `ap1` is borrowed for `'1`
-...
-LL | }
-   |  - `ap1` dropped here while still borrowed
-
-error: aborting due to 7 previous errors
-
-Some errors have detailed explanations: E0597, E0621.
-For more information about an error, try `rustc --explain E0597`.
index 241cc96fec04f1b6607a6627e07be1549b3be0bf..8530c9e24b2006398b535dc301c5c352a4b87ca0 100644 (file)
@@ -3,7 +3,7 @@
 // ignore-musl
 // ignore-cloudabi
 // ignore-emscripten
-
+// ignore-sgx no dynamic libraries
 #![crate_type = "cdylib"]
 
 extern crate cdylib_dep;
diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr
new file mode 100644 (file)
index 0000000..7e4ac4e
--- /dev/null
@@ -0,0 +1,53 @@
+error[E0631]: type mismatch in closure arguments
+  --> $DIR/expect-fn-supply-fn.rs:30:5
+   |
+LL |     with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _`
+   |     |
+   |     expected signature of `fn(fn(&'a u32), &i32) -> _`
+   |
+note: required by `with_closure_expecting_fn_with_free_region`
+  --> $DIR/expect-fn-supply-fn.rs:1:1
+   |
+LL | / fn with_closure_expecting_fn_with_free_region<F>(_: F)
+LL | |     where F: for<'a> FnOnce(fn(&'a u32), &i32)
+LL | | {
+LL | | }
+   | |_^
+
+error[E0631]: type mismatch in closure arguments
+  --> $DIR/expect-fn-supply-fn.rs:37:5
+   |
+LL |     with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _`
+   |     |
+   |     expected signature of `fn(for<'r> fn(&'r u32), &i32) -> _`
+   |
+note: required by `with_closure_expecting_fn_with_bound_region`
+  --> $DIR/expect-fn-supply-fn.rs:6:1
+   |
+LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
+LL | |     where F: FnOnce(fn(&u32), &i32)
+LL | | {
+LL | | }
+   | |_^
+
+error[E0631]: type mismatch in closure arguments
+  --> $DIR/expect-fn-supply-fn.rs:46:5
+   |
+LL |     with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _`
+   |     |
+   |     expected signature of `fn(for<'r> fn(&'r u32), &i32) -> _`
+   |
+note: required by `with_closure_expecting_fn_with_bound_region`
+  --> $DIR/expect-fn-supply-fn.rs:6:1
+   |
+LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
+LL | |     where F: FnOnce(fn(&u32), &i32)
+LL | | {
+LL | | }
+   | |_^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr
new file mode 100644 (file)
index 0000000..1d12e2f
--- /dev/null
@@ -0,0 +1,37 @@
+error[E0621]: explicit lifetime required in the type of `x`
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
+   |
+LL |   fn foo(x: &()) {
+   |             --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
+LL | /     bar(|| {
+LL | |
+LL | |         let _ = x;
+LL | |     })
+   | |______^ lifetime `'static` required
+
+error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:9
+   |
+LL |     bar(|| {
+   |         ^^ may outlive borrowed value `x`
+LL |
+LL |         let _ = x;
+   |                 - `x` is borrowed here
+   |
+note: function requires argument type to outlive `'static`
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
+   |
+LL | /     bar(|| {
+LL | |
+LL | |         let _ = x;
+LL | |     })
+   | |______^
+help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
+   |
+LL |     bar(move || {
+   |         ^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0373, E0621.
+For more information about an error, try `rustc --explain E0373`.
diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr
new file mode 100644 (file)
index 0000000..bbf7530
--- /dev/null
@@ -0,0 +1,42 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/expect-region-supply-region.rs:18:9
+   |
+LL |     let mut f: Option<&u32> = None;
+   |         ----- `f` is declared here, outside of the closure body
+LL |     closure_expecting_bound(|x| {
+   |                              - `x` is a reference that is only valid in the closure body
+LL |         f = Some(x);
+   |         ^^^^^^^^^^^ `x` escapes the closure body here
+
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/expect-region-supply-region.rs:28:9
+   |
+LL |     let mut f: Option<&u32> = None;
+   |         ----- `f` is declared here, outside of the closure body
+LL |     closure_expecting_bound(|x: &u32| {
+   |                              - `x` is a reference that is only valid in the closure body
+LL |         f = Some(x);
+   |         ^^^^^^^^^^^ `x` escapes the closure body here
+
+error: lifetime may not live long enough
+  --> $DIR/expect-region-supply-region.rs:37:30
+   |
+LL | fn expect_bound_supply_named<'x>() {
+   |                              -- lifetime `'x` defined here
+...
+LL |     closure_expecting_bound(|x: &'x u32| {
+   |                              ^  - let's call the lifetime of this reference `'1`
+   |                              |
+   |                              requires that `'1` must outlive `'x`
+
+error: lifetime may not live long enough
+  --> $DIR/expect-region-supply-region.rs:37:30
+   |
+LL | fn expect_bound_supply_named<'x>() {
+   |                              -- lifetime `'x` defined here
+...
+LL |     closure_expecting_bound(|x: &'x u32| {
+   |                              ^ requires that `'x` must outlive `'static`
+
+error: aborting due to 4 previous errors
+
index 06b1727258dc249791cd8094aeb4e4bd63320041..34f61ed5a347410315fd1b79154f36966b181ea7 100644 (file)
@@ -1,7 +1,5 @@
 // compile-pass
 
-#![feature(nll)]
-
 pub fn main() {
     let y: &'static mut [u8; 0] = &mut [];
 }
diff --git a/src/test/ui/consts/const_let_refutable.nll.stderr b/src/test/ui/consts/const_let_refutable.nll.stderr
new file mode 100644 (file)
index 0000000..30ab1f4
--- /dev/null
@@ -0,0 +1,31 @@
+error[E0005]: refutable pattern in function argument: `&[]` not covered
+  --> $DIR/const_let_refutable.rs:3:16
+   |
+LL | const fn slice([a, b]: &[i32]) -> i32 {
+   |                ^^^^^^ pattern `&[]` not covered
+
+error[E0723]: can only call other `const fn` within a `const fn`, but `const std::ops::Add::add` is not stable as `const fn`
+  --> $DIR/const_let_refutable.rs:4:5
+   |
+LL |     a + b
+   |     ^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0381]: use of possibly uninitialized variable: `a`
+  --> $DIR/const_let_refutable.rs:4:5
+   |
+LL |     a + b
+   |     ^ use of possibly uninitialized `a`
+
+error[E0381]: use of possibly uninitialized variable: `b`
+  --> $DIR/const_let_refutable.rs:4:9
+   |
+LL |     a + b
+   |         ^ use of possibly uninitialized `b`
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0005, E0381, E0723.
+For more information about an error, try `rustc --explain E0005`.
index b5a8fe8819cdd6091b2be1b41244549cd6aad7e2..f1947933d67074725646aec5cbfc339f5d461d4d 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]); //~ ERROR temporary value dropped while borrowed
 
 use std::borrow::Cow;
index 9b6638b228e755706c6ef03c6f02a970dad6f9ef..8dcb4daca3b707a564a8fc7f50bb13e6a2996299 100644 (file)
@@ -1,5 +1,5 @@
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/issue-54224.rs:3:39
+  --> $DIR/issue-54224.rs:1:39
    |
 LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]);
    |                                 ------^^^^^^^^^-
@@ -9,7 +9,7 @@ LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]);
    |                                 using this value as a constant requires that borrow lasts for `'static`
 
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/issue-54224.rs:11:57
+  --> $DIR/issue-54224.rs:9:57
    |
 LL | pub const Z: Cow<'static, [ [u8; 3] ]> = Cow::Borrowed(&[*b"ABC"]);
    |                                          ---------------^^^^^^^^^-
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr
new file mode 100644 (file)
index 0000000..8d96238
--- /dev/null
@@ -0,0 +1,328 @@
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:37:25
+   |
+LL |     const fn into_inner(self) -> T { self.0 }
+   |                         ^^^^ constant functions cannot evaluate destructors
+
+error[E0723]: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:39:36
+   |
+LL |     const fn get_mut(&mut self) -> &mut T { &mut self.0 }
+   |                                    ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:44:28
+   |
+LL |     const fn into_inner_lt(self) -> T { self.0 }
+   |                            ^^^^ constant functions cannot evaluate destructors
+
+error[E0723]: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:46:42
+   |
+LL |     const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
+   |                                          ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:51:27
+   |
+LL |     const fn into_inner_s(self) -> T { self.0 }
+   |                           ^^^^ constant functions cannot evaluate destructors
+
+error[E0723]: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:53:38
+   |
+LL |     const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
+   |                                      ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:58:39
+   |
+LL |     const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
+   |                                       ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:76:16
+   |
+LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
+   |                ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:78:18
+   |
+LL | const fn foo11_2<T: Send>(t: T) -> T { t }
+   |                  ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:80:33
+   |
+LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
+   |                                 ^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:82:35
+   |
+LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
+   |                                   ^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: only int and `bool` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:84:35
+   |
+LL | const fn foo19_3(f: f32) -> f32 { -f }
+   |                                   ^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:86:43
+   |
+LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
+   |                                           ^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: cannot access `static` items in const fn
+  --> $DIR/min_const_fn.rs:90:27
+   |
+LL | const fn foo25() -> u32 { BAR }
+   |                           ^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: cannot access `static` items in const fn
+  --> $DIR/min_const_fn.rs:91:36
+   |
+LL | const fn foo26() -> &'static u32 { &BAR }
+   |                                    ^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:92:42
+   |
+LL | const fn foo30(x: *const u32) -> usize { x as usize }
+   |                                          ^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:94:63
+   |
+LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }
+   |                                                               ^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:96:42
+   |
+LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
+   |                                          ^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:98:63
+   |
+LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
+   |                                                               ^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:100:38
+   |
+LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:102:29
+   |
+LL | const fn foo30_5(b: bool) { while b { } }
+   |                             ^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:104:44
+   |
+LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
+   |                                            ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:106:44
+   |
+LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
+   |                                            ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:108:14
+   |
+LL | const fn inc(x: &mut i32) { *x += 1 }
+   |              ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:113:6
+   |
+LL | impl<T: std::fmt::Debug> Foo<T> {
+   |      ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:118:6
+   |
+LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
+   |      ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:123:6
+   |
+LL | impl<T: Sync + Sized> Foo<T> {
+   |      ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `impl Trait` in const fn is unstable
+  --> $DIR/min_const_fn.rs:129:24
+   |
+LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
+   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:131:34
+   |
+LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
+   |                                  ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:133:22
+   |
+LL | const fn no_apit(_x: impl std::fmt::Debug) {}
+   |                      ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `impl Trait` in const fn is unstable
+  --> $DIR/min_const_fn.rs:134:23
+   |
+LL | const fn no_rpit() -> impl std::fmt::Debug {}
+   |                       ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:135:23
+   |
+LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
+   |                       ^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:136:32
+   |
+LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0515]: cannot return reference to temporary value
+  --> $DIR/min_const_fn.rs:136:63
+   |
+LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
+   |                                                               ^--
+   |                                                               ||
+   |                                                               |temporary value created here
+   |                                                               returns a reference to data owned by the current function
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:144:41
+   |
+LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
+   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: function pointers in const fn are unstable
+  --> $DIR/min_const_fn.rs:147:21
+   |
+LL | const fn no_fn_ptrs(_x: fn()) {}
+   |                     ^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: function pointers in const fn are unstable
+  --> $DIR/min_const_fn.rs:149:27
+   |
+LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
+   |                           ^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error: aborting due to 37 previous errors
+
+Some errors have detailed explanations: E0515, E0723.
+For more information about an error, try `rustc --explain E0515`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr
new file mode 100644 (file)
index 0000000..9ffb549
--- /dev/null
@@ -0,0 +1,31 @@
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn_dyn.rs:9:5
+   |
+LL |     x.0.field;
+   |     ^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn_dyn.rs:12:66
+   |
+LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
+   |                                                                  ^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0716]: temporary value dropped while borrowed
+  --> $DIR/min_const_fn_dyn.rs:12:67
+   |
+LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
+   |                                                                  -^    - temporary value is freed at the end of this statement
+   |                                                                  ||
+   |                                                                  |creates a temporary which is freed while still in use
+   |                                                                  cast requires that borrow lasts for `'static`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0716, E0723.
+For more information about an error, try `rustc --explain E0716`.
index d199e34775e4be1d9a871e831297f5408b6d491a..dc21b9fe8cd1b655d380ba2fd0a00a4dbf5c175a 100644 (file)
@@ -1,7 +1,5 @@
 //compile-pass
 
-#![feature(nll)]
-
 fn main() {
 
     let _: &'static usize = &(loop {}, 1).1;
index 045322de3470820ed61789bd5ddcf5d038d93b4d..6b6eea36361bf3fef2087c8123a5c34324c1fbad 100644 (file)
@@ -1,8 +1,6 @@
 // compile-pass
 // aux-build:promotable_const_fn_lib.rs
 
-#![feature(nll)]
-
 extern crate promotable_const_fn_lib;
 
 use promotable_const_fn_lib::{foo, Foo};
index 0350708d673d7d52a9558f76aaf806f6d6ea6a72..d982f350208e22ac7f1a87e587e3fab30c61c07e 100644 (file)
@@ -1,7 +1,5 @@
 // compile-pass
 
-#![feature(nll)]
-
 fn main() {
     let x: &'static u8 = &u8::max_value();
     let x: &'static u16 = &u16::max_value();
diff --git a/src/test/ui/consts/std/alloc.rs b/src/test/ui/consts/std/alloc.rs
new file mode 100644 (file)
index 0000000..65ac7e4
--- /dev/null
@@ -0,0 +1,10 @@
+use std::alloc::Layout;
+
+// ok
+const LAYOUT_VALID: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x08) };
+
+// not ok, since alignment needs to be non-zero.
+const LAYOUT_INVALID: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
+//~^ ERROR it is undefined behavior to use this value
+
+fn main() {}
diff --git a/src/test/ui/consts/std/alloc.stderr b/src/test/ui/consts/std/alloc.stderr
new file mode 100644 (file)
index 0000000..74a8f3d
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0080]: it is undefined behavior to use this value
+  --> $DIR/alloc.rs:7:1
+   |
+LL | const LAYOUT_INVALID: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0 at .align_, 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 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/continue-after-missing-main.nll.stderr b/src/test/ui/continue-after-missing-main.nll.stderr
new file mode 100644 (file)
index 0000000..aceabf3
--- /dev/null
@@ -0,0 +1,7 @@
+error[E0601]: `main` function not found in crate `continue_after_missing_main`
+   |
+   = note: consider adding a `main` function to `$DIR/continue-after-missing-main.rs`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/ui/empty/empty-never-array.nll.stderr b/src/test/ui/empty/empty-never-array.nll.stderr
new file mode 100644 (file)
index 0000000..01ee1c3
--- /dev/null
@@ -0,0 +1,23 @@
+error[E0005]: refutable pattern in local binding: `T(_, _)` not covered
+  --> $DIR/empty-never-array.rs:10:9
+   |
+LL | / enum Helper<T, U> {
+LL | |     T(T, [!; 0]),
+LL | |     #[allow(dead_code)]
+LL | |     U(U),
+LL | | }
+   | |_- `Helper<T, U>` defined here
+...
+LL |       let Helper::U(u) = Helper::T(t, []);
+   |           ^^^^^^^^^^^^ pattern `T(_, _)` not covered
+
+error[E0381]: use of possibly uninitialized variable: `u`
+  --> $DIR/empty-never-array.rs:12:5
+   |
+LL |     u
+   |     ^ use of possibly uninitialized `u`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0005, E0381.
+For more information about an error, try `rustc --explain E0005`.
diff --git a/src/test/ui/error-codes/E0502.nll.stderr b/src/test/ui/error-codes/E0502.nll.stderr
new file mode 100644 (file)
index 0000000..e5671ee
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immutable
+  --> $DIR/E0502.rs:4:9
+   |
+LL |     let ref y = a;
+   |         ----- immutable borrow occurs here
+LL |     bar(a);
+   |         ^ mutable borrow occurs here
+LL |     y.use_ref();
+   |     - immutable borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
new file mode 100644 (file)
index 0000000..5140d1a
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/E0621-does-not-trigger-for-closures.rs:15:45
+   |
+LL |     invoke(&x, |a, b| if a > b { a } else { b });
+   |                    --                       ^ returning this value requires that `'1` must outlive `'2`
+   |                    ||
+   |                    |return type of closure is &'2 i32
+   |                    has type `&'1 i32`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr
new file mode 100644 (file)
index 0000000..f316644
--- /dev/null
@@ -0,0 +1,18 @@
+error: at least one trait must be specified
+  --> $DIR/generic_type_does_not_live_long_enough.rs:9:35
+   |
+LL | existential type WrongGeneric<T>: 'static;
+   |                                   ^^^^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/generic_type_does_not_live_long_enough.rs:6:18
+   |
+LL |     let z: i32 = x;
+   |                  ^ expected i32, found opaque type
+   |
+   = note: expected type `i32`
+              found type `WrongGeneric::<&{integer}>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index 0129a3f72b2422d0b7c59ef6fd6ebc1b7c778f0d..ca0a432d3396e1a446f26c91c5018a5b000d115c 100644 (file)
@@ -52,7 +52,7 @@
 //~^ WARN unused attribute
 #![path = "3800"] //~ WARN unused attribute
 #![automatically_derived] //~ WARN unused attribute
-#![no_mangle] //~ WARN unused attribute
+#![no_mangle]
 #![no_link] //~ WARN unused attribute
 // see issue-43106-gating-of-derive.rs
 #![should_panic] //~ WARN unused attribute
index dcbe13a749f69b981661308165761959c3a26d47..c7081205e148195bdc5e2007bd025d2ffaf59a3f 100644 (file)
@@ -1152,12 +1152,6 @@ warning: unused attribute
 LL | #![automatically_derived]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:1
-   |
-LL | #![no_mangle]
-   | ^^^^^^^^^^^^^
-
 warning: unused attribute
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1
    |
diff --git a/src/test/ui/generator/auto-trait-regions.nll.stderr b/src/test/ui/generator/auto-trait-regions.nll.stderr
new file mode 100644 (file)
index 0000000..4c157a0
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0716]: temporary value dropped while borrowed
+  --> $DIR/auto-trait-regions.rs:44:24
+   |
+LL |         let a = A(&mut true, &mut true, No);
+   |                        ^^^^                - temporary value is freed at the end of this statement
+   |                        |
+   |                        creates a temporary which is freed while still in use
+LL |         yield;
+LL |         assert_foo(a);
+   |                    - borrow later used here
+   |
+   = note: consider using a `let` binding to create a longer lived value
+
+error[E0716]: temporary value dropped while borrowed
+  --> $DIR/auto-trait-regions.rs:44:35
+   |
+LL |         let a = A(&mut true, &mut true, No);
+   |                                   ^^^^     - temporary value is freed at the end of this statement
+   |                                   |
+   |                                   creates a temporary which is freed while still in use
+LL |         yield;
+LL |         assert_foo(a);
+   |                    - borrow later used here
+   |
+   = note: consider using a `let` binding to create a longer lived value
+
+error: higher-ranked subtype error
+  --> $DIR/auto-trait-regions.rs:30:5
+   |
+LL |     assert_foo(gen);
+   |     ^^^^^^^^^^^^^^^
+
+error: higher-ranked subtype error
+  --> $DIR/auto-trait-regions.rs:48:5
+   |
+LL |     assert_foo(gen);
+   |     ^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/generator/generator-region-requirements.nll.stderr b/src/test/ui/generator/generator-region-requirements.nll.stderr
deleted file mode 100644 (file)
index 8a96d18..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0621]: explicit lifetime required in the type of `x`
-  --> $DIR/generator-region-requirements.rs:16:51
-   |
-LL | fn dangle(x: &mut i32) -> &'static mut i32 {
-   |              -------- help: add explicit lifetime `'static` to the type of `x`: `&'static mut i32`
-...
-LL |             GeneratorState::Complete(c) => return c,
-   |                                                   ^ lifetime `'static` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
index cd9abaae056c1f879e43c084ac4123279e66df28..41cb339f459113313440b56421fb18a76dd1ad88 100644 (file)
@@ -1,8 +1,4 @@
-// revisions: migrate nll
-// ignore-compare-mode-nll
-
 #![feature(generators, generator_trait)]
-#![cfg_attr(nll, feature(nll))]
 use std::ops::{Generator, GeneratorState};
 use std::pin::Pin;
 
@@ -14,8 +10,7 @@ fn dangle(x: &mut i32) -> &'static mut i32 {
     loop {
         match Pin::new(&mut g).resume() {
             GeneratorState::Complete(c) => return c,
-//[nll]~^ ERROR explicit lifetime required
-//[migrate]~^^ ERROR explicit lifetime required
+            //~^ ERROR explicit lifetime required
             GeneratorState::Yielded(_) => (),
         }
     }
diff --git a/src/test/ui/generator/generator-region-requirements.stderr b/src/test/ui/generator/generator-region-requirements.stderr
new file mode 100644 (file)
index 0000000..53d48bc
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0621]: explicit lifetime required in the type of `x`
+  --> $DIR/generator-region-requirements.rs:12:51
+   |
+LL | fn dangle(x: &mut i32) -> &'static mut i32 {
+   |              -------- help: add explicit lifetime `'static` to the type of `x`: `&'static mut i32`
+...
+LL |             GeneratorState::Complete(c) => return c,
+   |                                                   ^ lifetime `'static` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
index 87afa57ab51989fd369a101bc1d15d940e3a00f7..cee3e6d226c12dc47eaa8e3261b94c9624d491e9 100644 (file)
@@ -1,5 +1,4 @@
 #![feature(generators)]
-#![feature(nll)]
 
 fn main() {
     || {
index bd5abb202068c59a0c119ebbb5a395f8f712e76e..14199aeb93056cb3671f7ad93fdb8b3ceb019c22 100644 (file)
@@ -1,5 +1,5 @@
 error[E0626]: borrow may still be in use when generator yields
-  --> $DIR/generator-with-nll.rs:8:17
+  --> $DIR/generator-with-nll.rs:7:17
    |
 LL |         let b = &mut true;
    |                 ^^^^^^^^^
diff --git a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr
new file mode 100644 (file)
index 0000000..312a91a
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
+  --> $DIR/hashmap-iter-value-lifetime.rs:7:5
+   |
+LL |     let (_, thing) = my_stuff.iter().next().unwrap();
+   |                      -------- immutable borrow occurs here
+LL | 
+LL |     my_stuff.clear();
+   |     ^^^^^^^^ mutable borrow occurs here
+LL | 
+LL |     println!("{}", *thing);
+   |                    ------ immutable borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/hashmap-lifetimes.nll.stderr b/src/test/ui/hashmap-lifetimes.nll.stderr
new file mode 100644 (file)
index 0000000..aa8e890
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
+  --> $DIR/hashmap-lifetimes.rs:6:5
+   |
+LL |     let mut it = my_stuff.iter();
+   |                  -------- immutable borrow occurs here
+LL |     my_stuff.insert(1, 43);
+   |     ^^^^^^^^ mutable borrow occurs here
+LL |     it;
+   |     -- immutable borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
new file mode 100644 (file)
index 0000000..070fe12
--- /dev/null
@@ -0,0 +1,30 @@
+error: lifetime may not live long enough
+  --> $DIR/hr-subtype.rs:33:13
+   |
+LL |           fn subtype<'x,'y:'x,'z:'y>() {
+   |                      -- -- lifetime `'y` defined here
+   |                      |
+   |                      lifetime `'x` defined here
+LL |               gimme::<$t2>(None::<$t1>);
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | |                                     fn(Inv<'y>)) }
+   | |__________________________________________________- in this macro invocation
+
+error: lifetime may not live long enough
+  --> $DIR/hr-subtype.rs:39:13
+   |
+LL |           fn supertype<'x,'y:'x,'z:'y>() {
+   |                        -- -- lifetime `'y` defined here
+   |                        |
+   |                        lifetime `'x` defined here
+LL |               gimme::<$t1>(None::<$t2>);
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | |                                     fn(Inv<'y>)) }
+   | |__________________________________________________- in this macro invocation
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
new file mode 100644 (file)
index 0000000..e140eaa
--- /dev/null
@@ -0,0 +1,16 @@
+error: lifetime may not live long enough
+  --> $DIR/hr-subtype.rs:39:13
+   |
+LL |           fn supertype<'x,'y:'x,'z:'y>() {
+   |                        -- -- lifetime `'y` defined here
+   |                        |
+   |                        lifetime `'x` defined here
+LL |               gimme::<$t1>(None::<$t2>);
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
+...
+LL | / check! { free_x_vs_free_y: (fn(&'x u32),
+LL | |                             fn(&'y u32)) }
+   | |__________________________________________- in this macro invocation
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.nll.stderr b/src/test/ui/hrtb/hrtb-cache-issue-54302.nll.stderr
new file mode 100644 (file)
index 0000000..4de35d7
--- /dev/null
@@ -0,0 +1,8 @@
+error: higher-ranked subtype error
+  --> $DIR/hrtb-cache-issue-54302.rs:19:5
+   |
+LL |     assert_deserialize_owned::<&'static str>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr
new file mode 100644 (file)
index 0000000..0522fc4
--- /dev/null
@@ -0,0 +1,77 @@
+warning: function cannot return without recursing
+  --> $DIR/hrtb-perfect-forwarding.rs:22:1
+   |
+LL | / fn no_hrtb<'b,T>(mut t: T)
+LL | |     where T : Bar<&'b isize>
+LL | | {
+LL | |     // OK -- `T : Bar<&'b isize>`, and thus the impl above ensures that
+LL | |     // `&mut T : Bar<&'b isize>`.
+LL | |     no_hrtb(&mut t);
+   | |     --------------- recursive call site
+LL | | }
+   | |_^ cannot return without recursing
+   |
+   = note: #[warn(unconditional_recursion)] on by default
+   = help: a `loop` may express intention better if this is on purpose
+
+warning: function cannot return without recursing
+  --> $DIR/hrtb-perfect-forwarding.rs:30:1
+   |
+LL | / fn bar_hrtb<T>(mut t: T)
+LL | |     where T : for<'b> Bar<&'b isize>
+LL | | {
+LL | |     // OK -- `T : for<'b> Bar<&'b isize>`, and thus the impl above
+...  |
+LL | |     bar_hrtb(&mut t);
+   | |     ---------------- recursive call site
+LL | | }
+   | |_^ cannot return without recursing
+   |
+   = help: a `loop` may express intention better if this is on purpose
+
+warning: function cannot return without recursing
+  --> $DIR/hrtb-perfect-forwarding.rs:39:1
+   |
+LL | / fn foo_hrtb_bar_not<'b,T>(mut t: T)
+LL | |     where T : for<'a> Foo<&'a isize> + Bar<&'b isize>
+LL | | {
+LL | |     // Not OK -- The forwarding impl for `Foo` requires that `Bar` also
+...  |
+LL | |     foo_hrtb_bar_not(&mut t);
+   | |     ------------------------ recursive call site
+LL | | }
+   | |_^ cannot return without recursing
+   |
+   = help: a `loop` may express intention better if this is on purpose
+
+error: higher-ranked subtype error
+  --> $DIR/hrtb-perfect-forwarding.rs:46:5
+   |
+LL |     foo_hrtb_bar_not(&mut t);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: lifetime may not live long enough
+  --> $DIR/hrtb-perfect-forwarding.rs:46:5
+   |
+LL | fn foo_hrtb_bar_not<'b,T>(mut t: T)
+   |                     -- lifetime `'b` defined here
+...
+LL |     foo_hrtb_bar_not(&mut t);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static`
+
+warning: function cannot return without recursing
+  --> $DIR/hrtb-perfect-forwarding.rs:49:1
+   |
+LL | / fn foo_hrtb_bar_hrtb<T>(mut t: T)
+LL | |     where T : for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>
+LL | | {
+LL | |     // OK -- now we have `T : for<'b> Bar&'b isize>`.
+LL | |     foo_hrtb_bar_hrtb(&mut t);
+   | |     ------------------------- recursive call site
+LL | | }
+   | |_^ cannot return without recursing
+   |
+   = help: a `loop` may express intention better if this is on purpose
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr
new file mode 100644 (file)
index 0000000..da30997
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/dyn-trait.rs:20:5
+   |
+LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
+   |                              - `x` is a reference that is only valid in the function body
+LL |     static_val(x);
+   |     ^^^^^^^^^^^^^ `x` escapes the function body here
+
+error: aborting due to previous error
+
index cb5f78bd6fc0f3c620795d8f6bbfdc4ec22671ef..58d7875ccd03422453d43b4125a183ab7e7e6ae0 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // Regression test for #54593: the MIR type checker was going wrong
 // when a closure returns the `impl Copy` from its parent fn. It was
 // (incorrectly) replacing the `impl Copy` in its return type with the
diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr
new file mode 100644 (file)
index 0000000..4b7c04f
--- /dev/null
@@ -0,0 +1,51 @@
+error: lifetime may not live long enough
+  --> $DIR/must_outlive_least_region_or_bound.rs:3:23
+   |
+LL | fn elided(x: &i32) -> impl Copy { x }
+   |              -        ^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
+   |              |
+   |              let's call the lifetime of this reference `'1`
+help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint
+   |
+LL | fn elided(x: &i32) -> impl Copy + '_ { x }
+   |                       ^^^^^^^^^^^^^^
+
+error: lifetime may not live long enough
+  --> $DIR/must_outlive_least_region_or_bound.rs:6:32
+   |
+LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
+   |             --                 ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
+   |             |
+   |             lifetime `'a` defined here
+help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
+   |
+LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
+   |                                ^^^^^^^^^^^^^^
+
+error: lifetime may not live long enough
+  --> $DIR/must_outlive_least_region_or_bound.rs:12:69
+   |
+LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
+   |               -- lifetime `'a` defined here                         ^ returning this value requires that `'a` must outlive `'static`
+   |
+   = help: consider replacing `'a` with `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/must_outlive_least_region_or_bound.rs:17:61
+   |
+LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
+   |                          --  -- lifetime `'b` defined here  ^^^^^^^^^^^^^^^^ opaque type requires that `'b` must outlive `'a`
+   |                          |
+   |                          lifetime `'a` defined here
+
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/must_outlive_least_region_or_bound.rs:22:51
+   |
+LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
+   |                                                   ^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0310`.
index cb40d90ae551a565e1888f2935bd31971c555c6b..adaa474474f674ec66ee2eb4ac7e961a0612021d 100644 (file)
@@ -9,7 +9,6 @@
 
 #![allow(dead_code)]
 #![feature(in_band_lifetimes)]
-#![feature(nll)]
 
 fn foo(x: &'x u32) -> impl Fn() -> &'y u32
 where 'x: 'y
index e2310a3907f7e69dccf05a3adf0a2ee06e336275..204c2ff304114de5beefd933118bcf39b26a5a70 100644 (file)
@@ -9,7 +9,6 @@
 
 #![allow(dead_code)]
 #![feature(in_band_lifetimes)]
-#![feature(nll)]
 
 trait Trait<'a> { }
 
index d62aec800e8ce7bcae2ef0ef38b70148d3f8ea08..29243699e44fd11a00e210259009f3654856f41b 100644 (file)
@@ -5,7 +5,6 @@
 
 #![allow(dead_code)]
 #![feature(in_band_lifetimes)]
-#![feature(nll)]
 
 use std::cell::Cell;
 
index 81b44b7eba7fdd43de6657d6015da8ba46c8f182..5c8e322f712d167f370846766c2b63649cfa8908 100644 (file)
@@ -1,11 +1,11 @@
 error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
-  --> $DIR/region-escape-via-bound.rs:16:29
+  --> $DIR/region-escape-via-bound.rs:15:29
    |
 LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y>
    |                             ^^^^^^^^^^^^^^
    |
-note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined on the function body at 18:7
-  --> $DIR/region-escape-via-bound.rs:18:7
+note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined on the function body at 17:7
+  --> $DIR/region-escape-via-bound.rs:17:7
    |
 LL | where 'x: 'y
    |       ^^
diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr
new file mode 100644 (file)
index 0000000..0bf120c
--- /dev/null
@@ -0,0 +1,26 @@
+error: lifetime may not live long enough
+  --> $DIR/static-return-lifetime-infered.rs:6:35
+   |
+LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
+   |                         -         ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
+   |                         |
+   |                         let's call the lifetime of this reference `'1`
+help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint
+   |
+LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: lifetime may not live long enough
+  --> $DIR/static-return-lifetime-infered.rs:10:37
+   |
+LL |     fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
+   |                    --               ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
+   |                    |
+   |                    lifetime `'a` defined here
+help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
+   |
+LL |     fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/impl-trait/type_parameters_captured.nll.stderr b/src/test/ui/impl-trait/type_parameters_captured.nll.stderr
new file mode 100644 (file)
index 0000000..039cb62
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/type_parameters_captured.rs:7:20
+   |
+LL | fn foo<T>(x: T) -> impl Any + 'static {
+   |                    ^^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
index 2d91cbc00f27d492bb11387582a0bd4b829c35c4..26150c7d4a16b77de5f4a76803006e4b48e3bf24 100644 (file)
@@ -5,10 +5,14 @@
 
 #![deny(unused_extern_crates)]
 
-extern crate core as iso1; //~ ERROR `extern crate` is not idiomatic in the new edition
-extern crate core as iso2; //~ ERROR `extern crate` is not idiomatic in the new edition
-extern crate core as iso3; //~ ERROR `extern crate` is not idiomatic in the new edition
-extern crate core as iso4; //~ ERROR `extern crate` is not idiomatic in the new edition
+// Shouldn't suggest changing to `use`, as new name
+// would no longer be added to the prelude which could cause
+// compilation errors for imports that use the new name in
+// other modules. See #57672.
+extern crate core as iso1;
+extern crate core as iso2;
+extern crate core as iso3;
+extern crate core as iso4;
 
 // Doesn't introduce its extern prelude entry, so it's still considered unused.
 extern crate core; //~ ERROR unused extern crate
index c0783feb7947d2366c5b0a51d11d6b140609023e..397bfa02902c94df7528429b07a8e60dfd17e853 100644 (file)
@@ -1,8 +1,8 @@
-error: `extern crate` is not idiomatic in the new edition
-  --> $DIR/extern-crate-used.rs:8:1
+error: unused extern crate
+  --> $DIR/extern-crate-used.rs:18:1
    |
-LL | extern crate core as iso1;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
+LL | extern crate core;
+   | ^^^^^^^^^^^^^^^^^^ help: remove it
    |
 note: lint level defined here
   --> $DIR/extern-crate-used.rs:6:9
@@ -10,29 +10,5 @@ note: lint level defined here
 LL | #![deny(unused_extern_crates)]
    |         ^^^^^^^^^^^^^^^^^^^^
 
-error: `extern crate` is not idiomatic in the new edition
-  --> $DIR/extern-crate-used.rs:9:1
-   |
-LL | extern crate core as iso2;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
-
-error: `extern crate` is not idiomatic in the new edition
-  --> $DIR/extern-crate-used.rs:10:1
-   |
-LL | extern crate core as iso3;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
-
-error: `extern crate` is not idiomatic in the new edition
-  --> $DIR/extern-crate-used.rs:11:1
-   |
-LL | extern crate core as iso4;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
-
-error: unused extern crate
-  --> $DIR/extern-crate-used.rs:14:1
-   |
-LL | extern crate core;
-   | ^^^^^^^^^^^^^^^^^^ help: remove it
-
-error: aborting due to 5 previous errors
+error: aborting due to previous error
 
diff --git a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr
new file mode 100644 (file)
index 0000000..f5aee2d
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0621]: explicit lifetime required in the type of `y`
+  --> $DIR/mismatched.rs:4:42
+   |
+LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y }
+   |                       ----               ^ lifetime `'a` required
+   |                       |
+   |                       help: add explicit lifetime `'a` to the type of `y`: `&'a u32`
+
+error: lifetime may not live long enough
+  --> $DIR/mismatched.rs:6:46
+   |
+LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y }
+   |             --          --                   ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+   |             |           |
+   |             |           lifetime `'b` defined here
+   |             lifetime `'a` defined here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr
new file mode 100644 (file)
index 0000000..cd65bab
--- /dev/null
@@ -0,0 +1,24 @@
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements
+  --> $DIR/mismatched_trait_impl.rs:9:5
+   |
+LL |     fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 9:5...
+  --> $DIR/mismatched_trait_impl.rs:9:5
+   |
+LL | /     fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+LL | |         x
+LL | |     }
+   | |_____^
+note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 9:32...
+  --> $DIR/mismatched_trait_impl.rs:9:32
+   |
+LL |     fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+   |                                ^^
+   = note: ...so that the method type is compatible with trait:
+           expected fn(&i32, &'a u32, &u32) -> &'a u32
+              found fn(&i32, &u32, &u32) -> &u32
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-60622.rs b/src/test/ui/issue-60622.rs
new file mode 100644 (file)
index 0000000..d6a0189
--- /dev/null
@@ -0,0 +1,18 @@
+// ignore-tidy-linelength
+
+#![deny(warnings)]
+
+struct Borked {}
+
+impl Borked {
+    fn a(&self) {}
+}
+
+fn run_wild<T>(b: &Borked) {
+    b.a::<'_, T>();
+    //~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+    //~^^ ERROR wrong number of type arguments: expected 0, found 1
+    //~^^^ WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
+
+fn main() {}
diff --git a/src/test/ui/issue-60622.stderr b/src/test/ui/issue-60622.stderr
new file mode 100644 (file)
index 0000000..0c337c3
--- /dev/null
@@ -0,0 +1,27 @@
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+  --> $DIR/issue-60622.rs:12:11
+   |
+LL |     fn a(&self) {}
+   |          - the late bound lifetime parameter is introduced here
+...
+LL |     b.a::<'_, T>();
+   |           ^^
+   |
+note: lint level defined here
+  --> $DIR/issue-60622.rs:3:9
+   |
+LL | #![deny(warnings)]
+   |         ^^^^^^^^
+   = note: #[deny(late_bound_lifetime_arguments)] implied by #[deny(warnings)]
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error[E0107]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/issue-60622.rs:12:15
+   |
+LL |     b.a::<'_, T>();
+   |               ^ unexpected type argument
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/src/test/ui/issues/issue-10291.nll.stderr b/src/test/ui/issues/issue-10291.nll.stderr
new file mode 100644 (file)
index 0000000..45f29fd
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-10291.rs:3:9
+   |
+LL | fn test<'x>(x: &'x isize) {
+   |         -- lifetime `'x` defined here
+LL |     drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
+LL |         x
+   |         ^ returning this value requires that `'x` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-13058.nll.stderr b/src/test/ui/issues/issue-13058.nll.stderr
new file mode 100644 (file)
index 0000000..8368978
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0621]: explicit lifetime required in the type of `cont`
+  --> $DIR/issue-13058.rs:14:21
+   |
+LL | fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
+   |                                                                     -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T`
+LL | {
+LL |     let cont_iter = cont.iter();
+   |                     ^^^^^^^^^^^ lifetime `'r` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/issues/issue-15034.nll.stderr b/src/test/ui/issues/issue-15034.nll.stderr
new file mode 100644 (file)
index 0000000..f142e26
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0621]: explicit lifetime required in the type of `lexer`
+  --> $DIR/issue-15034.rs:17:9
+   |
+LL |     pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
+   |                       ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>`
+LL |         Parser { lexer: lexer }
+   |         ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/issues/issue-15381.nll.stderr b/src/test/ui/issues/issue-15381.nll.stderr
new file mode 100644 (file)
index 0000000..a849584
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0005]: refutable pattern in `for` loop binding: `&[]` not covered
+  --> $DIR/issue-15381.rs:4:9
+   |
+LL |     for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
+   |         ^^^^^^^^ pattern `&[]` not covered
+
+error[E0381]: borrow of possibly uninitialized variable: `y`
+  --> $DIR/issue-15381.rs:6:26
+   |
+LL |         println!("y={}", y);
+   |                          ^ use of possibly uninitialized `y`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0005, E0381.
+For more information about an error, try `rustc --explain E0005`.
diff --git a/src/test/ui/issues/issue-16683.nll.stderr b/src/test/ui/issues/issue-16683.nll.stderr
new file mode 100644 (file)
index 0000000..ea6b69d
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/issue-16683.rs:4:9
+   |
+LL |     fn b(&self) {
+   |          ----- `self` is a reference that is only valid in the function body
+LL |         self.a();
+   |         ^^^^^^^^ `self` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-17728.nll.stderr b/src/test/ui/issues/issue-17728.nll.stderr
new file mode 100644 (file)
index 0000000..7436ebd
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0308]: match arms have incompatible types
+  --> $DIR/issue-17728.rs:109:14
+   |
+LL | /     match to_parse {
+LL | |         "w" | "west" => RoomDirection::West,
+LL | |         "e" | "east" => RoomDirection::East,
+LL | |         "n" | "north" => RoomDirection::North,
+...  |
+LL | |         "down" => RoomDirection::Down,
+   | |                   ------------------- this and all prior arms are found to be of type `RoomDirection`
+LL | |         _ => None
+   | |              ^^^^ expected enum `RoomDirection`, found enum `std::option::Option`
+LL | |     }
+   | |_____- `match` arms have incompatible types
+   |
+   = note: expected type `RoomDirection`
+              found type `std::option::Option<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/issues/issue-17758.nll.stderr b/src/test/ui/issues/issue-17758.nll.stderr
new file mode 100644 (file)
index 0000000..b9dc9da
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/issue-17758.rs:7:9
+   |
+LL |     fn bar(&self) {
+   |            ----- `self` is a reference that is only valid in the function body
+LL |         self.foo();
+   |         ^^^^^^^^^^ `self` escapes the function body here
+
+error: aborting due to previous error
+
index 4d86a17b6f1fbab6d3669cbfb7d151925f12686f..4ea567d25ca537bd3a328a74b2abeccd3ec5fe2d 100644 (file)
@@ -3,6 +3,7 @@
 
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 #![feature(os)]
 
diff --git a/src/test/ui/issues/issue-26217.nll.stderr b/src/test/ui/issues/issue-26217.nll.stderr
new file mode 100644 (file)
index 0000000..c7601ca
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-26217.rs:4:5
+   |
+LL | fn bar<'a>() {
+   |        -- lifetime `'a` defined here
+LL |     foo::<&'a i32>();
+   |     ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-28848.nll.stderr b/src/test/ui/issues/issue-28848.nll.stderr
new file mode 100644 (file)
index 0000000..5cf9856
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-28848.rs:10:5
+   |
+LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
+   |            --  -- lifetime `'b` defined here
+   |            |
+   |            lifetime `'a` defined here
+LL |     Foo::<'a, 'b>::xmute(u)
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
index 84cca5b20af472d800fcc13e5c2ce366ec000683..04b8c3aa35396374ba058fc471b989d485ae34eb 100644 (file)
@@ -4,6 +4,7 @@ error[E0277]: `?` couldn't convert the error to `()`
 LL |     Err(5)?;
    |           ^ the trait `std::convert::From<{integer}>` is not implemented for `()`
    |
+   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = note: required by `std::convert::From::from`
 
 error: aborting due to previous error
index 226c21446b1ed5022795e7c8445e6cf09a4d2d75..bdc9fe43a8bd961fc33dfbda3e8fe56574dfe353 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 pub trait Foo {
     fn zero(self) -> Self;
 }
index 2ed7b543e713c8b691e0e098b639793a995d9929..d5cede990a335116a3d8f631ae19745d6da8c0b7 100644 (file)
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `x`
-  --> $DIR/issue-34721.rs:27:9
+  --> $DIR/issue-34721.rs:25:9
    |
 LL |     pub fn baz<T: Foo>(x: T) -> T {
    |                -       - move occurs because `x` has type `T`, which does not implement the `Copy` trait
index 25225ca6e7c3a31639de25945af882629937f03d..3ba2a9d40bec4352cd58acacaa3ca6dedbd1cd23 100644 (file)
@@ -6,6 +6,7 @@
 // ignore-windows
 // ignore-cloudabi
 // ignore-emscripten
+// ignore-sgx no processes
 
 use std::process::Command;
 // use std::os::unix::process::CommandExt;
index 6aee474fe7435d02a0d2b5b7caef20c84aff7afe..108c969cdaddedfb445b22efd4179943e6039805 100644 (file)
@@ -1,5 +1,5 @@
 error[E0599]: no method named `exec` found for type `&mut std::process::Command` in the current scope
-  --> $DIR/issue-39175.rs:14:39
+  --> $DIR/issue-39175.rs:15:39
    |
 LL |     Command::new("echo").arg("hello").exec();
    |                                       ^^^^
diff --git a/src/test/ui/issues/issue-40510-1.migrate.nll.stderr b/src/test/ui/issues/issue-40510-1.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..776a724
--- /dev/null
@@ -0,0 +1,13 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-1.rs:11:9
+   |
+LL |     || {
+   |      - inferred to be a `FnMut` closure
+LL |         &mut x
+   |         ^^^^^^ returns a reference to a captured variable which escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-40510-1.migrate.stderr b/src/test/ui/issues/issue-40510-1.migrate.stderr
new file mode 100644 (file)
index 0000000..17d1c48
--- /dev/null
@@ -0,0 +1,21 @@
+warning: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-1.rs:11:9
+   |
+LL |     || {
+   |      - inferred to be a `FnMut` closure
+LL |         &mut x
+   |         ^^^^^^ returns a reference to a captured variable which escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+error: compilation successful
+  --> $DIR/issue-40510-1.rs:20:1
+   |
+LL | fn main() {}
+   | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-40510-1.nll.stderr b/src/test/ui/issues/issue-40510-1.nll.stderr
new file mode 100644 (file)
index 0000000..776a724
--- /dev/null
@@ -0,0 +1,13 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-1.rs:11:9
+   |
+LL |     || {
+   |      - inferred to be a `FnMut` closure
+LL |         &mut x
+   |         ^^^^^^ returns a reference to a captured variable which escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
index dd8a6bc5ab2bd73f0a2bdce2e0844dca22e09ab4..6ecbeefd88115801d2b6a5f9a5204ac886f5df7f 100644 (file)
@@ -1,13 +1,21 @@
-// compile-pass
+#![feature(rustc_attrs)]
 #![allow(unused)]
 
+// revisions: migrate nll
+#![cfg_attr(nll, feature(nll))]
+
 fn f() {
     let mut x: Box<()> = Box::new(());
 
     || {
         &mut x
     };
+    //[migrate]~^^ WARNING captured variable cannot escape `FnMut` closure body
+    //[migrate]~| WARNING this error has been downgraded to a warning
+    //[migrate]~| WARNING this warning will become a hard error in the future
+    //[nll]~^^^^^ ERROR captured variable cannot escape `FnMut` closure body
 }
 
-
+#[rustc_error]
 fn main() {}
+//[migrate]~^ ERROR
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 44234cb..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-warning: captured variable cannot escape `FnMut` closure body
-  --> $DIR/issue-40510-1.rs:8:9
-   |
-LL |     || {
-   |      - inferred to be a `FnMut` closure
-LL |         &mut x
-   |         ^^^^^^ returns a reference to a captured variable which escapes the closure body
-   |
-   = note: `FnMut` closures only have access to their captured variables while they are executing...
-   = note: ...therefore, they cannot allow references to captured variables to escape
-   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
-   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
diff --git a/src/test/ui/issues/issue-40510-3.migrate.nll.stderr b/src/test/ui/issues/issue-40510-3.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..a49475a
--- /dev/null
@@ -0,0 +1,15 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-3.rs:11:9
+   |
+LL |       || {
+   |        - inferred to be a `FnMut` closure
+LL | /         || {
+LL | |             x.push(())
+LL | |         }
+   | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-40510-3.migrate.stderr b/src/test/ui/issues/issue-40510-3.migrate.stderr
new file mode 100644 (file)
index 0000000..692aa10
--- /dev/null
@@ -0,0 +1,23 @@
+warning: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-3.rs:11:9
+   |
+LL |       || {
+   |        - inferred to be a `FnMut` closure
+LL | /         || {
+LL | |             x.push(())
+LL | |         }
+   | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+error: compilation successful
+  --> $DIR/issue-40510-3.rs:22:1
+   |
+LL | fn main() {}
+   | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-40510-3.nll.stderr b/src/test/ui/issues/issue-40510-3.nll.stderr
new file mode 100644 (file)
index 0000000..a49475a
--- /dev/null
@@ -0,0 +1,15 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-3.rs:11:9
+   |
+LL |       || {
+   |        - inferred to be a `FnMut` closure
+LL | /         || {
+LL | |             x.push(())
+LL | |         }
+   | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
index bc95c461d1e1eea30652bcdd07c35884a9a2e445..205d982363128d11d70c5d705580e2a3066284e5 100644 (file)
@@ -1,6 +1,9 @@
-// compile-pass
+#![feature(rustc_attrs)]
 #![allow(unused)]
 
+// revisions: migrate nll
+#![cfg_attr(nll, feature(nll))]
+
 fn f() {
     let mut x: Vec<()> = Vec::new();
 
@@ -8,8 +11,13 @@ fn f() {
         || {
             x.push(())
         }
+        //[migrate]~^^^ WARNING captured variable cannot escape `FnMut` closure body
+        //[migrate]~| WARNING this error has been downgraded to a warning
+        //[migrate]~| WARNING this warning will become a hard error in the future
+        //[nll]~^^^^^^ ERROR captured variable cannot escape `FnMut` closure body
     };
 }
 
-
+#[rustc_error]
 fn main() {}
+//[migrate]~^ ERROR
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 1297e14..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-warning: captured variable cannot escape `FnMut` closure body
-  --> $DIR/issue-40510-3.rs:8:9
-   |
-LL |       || {
-   |        - inferred to be a `FnMut` closure
-LL | /         || {
-LL | |             x.push(())
-LL | |         }
-   | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
-   |
-   = note: `FnMut` closures only have access to their captured variables while they are executing...
-   = note: ...therefore, they cannot allow references to captured variables to escape
-   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
-   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
index 809300d6d1968ea4008cf5bcf683c1e340e69b01..bf819af79625f0070cd57174584e11e96504a8d7 100644 (file)
@@ -12,7 +12,6 @@ impl<X, T> Trait1<X> for T where T: Trait2<X> {
 
 impl<X> Trait1<Box<X>> for A {
 //~^ ERROR conflicting implementations of trait
-//~| hard error
 //~| downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A`
     type Output = i32;
 }
index 039f10447c072770c31b9b1991e2809e6d8fce11..75c69e5b3e3f506866f7f4a0cd8f127af8401f1d 100644 (file)
@@ -1,4 +1,4 @@
-error: conflicting implementations of trait `Trait1<std::boxed::Box<_>>` for type `A`: (E0119)
+error[E0119]: conflicting implementations of trait `Trait1<std::boxed::Box<_>>` for type `A`:
   --> $DIR/issue-43355.rs:13:1
    |
 LL | impl<X, T> Trait1<X> for T where T: Trait2<X> {
@@ -7,10 +7,8 @@ LL | impl<X, T> Trait1<X> for T where T: Trait2<X> {
 LL | impl<X> Trait1<Box<X>> for A {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`
    |
-   = note: #[deny(incoherent_fundamental_impls)] on by default
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #46205 <https://github.com/rust-lang/rust/issues/46205>
    = note: downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A`
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0119`.
index b5d9036aba67cf3912f54a2dd65780b1d7c2a84d..c688261fa1cb1c3670eaf75011d99f03613d73ba 100644 (file)
@@ -6,11 +6,6 @@
 // We will explicitly test NLL, and migration modes; thus we will also skip the
 // automated compare-mode=nll.
 
-// revisions: nll migrate
-// ignore-compare-mode-nll
-
-#![cfg_attr(nll, feature(nll))]
-
 // run-pass
 
 // This test has structs and functions that are by definition unusable
index c517bbe57e82be38f563cc716cf9c8e23db6ba8e..18af33c1821c0d6c7dfa4ba27422643a8eb4b3ff 100644 (file)
@@ -1,6 +1,5 @@
 // Issue 46036: [NLL] false edges on infinite loops
 // Infinite loops should create false edges to the cleanup block.
-#![feature(nll)]
 
 struct Foo { x: &'static u32 }
 
index 9c1746e0fa1eeae6d896b3981c4a7d9d73c0d98e..49dd0e267b8ea8f187ad806f0cf1a23f4c34bf59 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `a` does not live long enough
-  --> $DIR/issue-46036.rs:9:24
+  --> $DIR/issue-46036.rs:8:24
    |
 LL |     let foo = Foo { x: &a };
    |                        ^^
index a5c1e17a58c3bebcc314d5d6c4053f1f692da627..c1fd7729bdefb6f3b36f739129321c7d4306b884 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn foo(x: &u32) -> &'static u32 {
     &*x
     //~^ ERROR explicit lifetime required in the type of `x` [E0621]
index 43d351ec905e3277174cf7592fd128c173b848a5..8a4a6bdb39fa4202a72193a357f84533dd88ac04 100644 (file)
@@ -1,5 +1,5 @@
 error[E0621]: explicit lifetime required in the type of `x`
-  --> $DIR/issue-46983.rs:4:5
+  --> $DIR/issue-46983.rs:2:5
    |
 LL | fn foo(x: &u32) -> &'static u32 {
    |           ---- help: add explicit lifetime `'static` to the type of `x`: `&'static u32`
index 04f1146a8f8ff45f5a2cb72b8964e24fd340bbd3..2f78ce0002ba3308bc713841993b9eccf873c3bd 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn main() {
     let _vec: Vec<&'static String> = vec![&String::new()];
     //~^ ERROR temporary value dropped while borrowed [E0716]
index 2b4d576e726f8aef4ee45a036027821524d89765..f97713b4ac438f4ca46858f42a63ffd3079ae69f 100644 (file)
@@ -1,5 +1,5 @@
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/issue-47184.rs:4:44
+  --> $DIR/issue-47184.rs:2:44
    |
 LL |     let _vec: Vec<&'static String> = vec![&String::new()];
    |               --------------------         ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
index 88466131e3144db988a478ad59b6dafd21d7b8b9..7d11a8c8021283fc54c8c3c89e5ca281a5bbe6f7 100644 (file)
@@ -4,7 +4,7 @@ error[E0369]: binary operation `+` cannot be applied to type `&str`
 LL |      let _a = b + ", World!";
    |               - ^ ---------- &str
    |               | |
-   |               | `+` can't be used to concatenate two `&str` strings
+   |               | `+` cannot be used to concatenate two `&str` strings
    |               &str
 help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
    |
index d69101eab4c46e2f5bd4e9e0aeb4b67eb55aa6c9..89a154c5109d80e0c4b02c28c77a0ff514205827 100644 (file)
@@ -4,7 +4,7 @@ error[E0369]: binary operation `+` cannot be applied to type `&str`
 LL |     println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
    |                                      - ^ ---------- &str
    |                                      | |
-   |                                      | `+` can't be used to concatenate two `&str` strings
+   |                                      | `+` cannot be used to concatenate two `&str` strings
    |                                      &str
 help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
    |
index c3c07bf641161d56667d2efebb3f384ac7bb3e5d..ace6cdce841a7db557b136fc4f59421da42981b8 100644 (file)
@@ -1,6 +1,3 @@
-#![allow(warnings)]
-#![feature(nll)]
-
 use std::collections::BinaryHeap;
 
 fn main() {
index db9f227d6b7762d79732e02246a3ad13a320428a..c0b876368480653e7468728e05694ed309945bc1 100644 (file)
@@ -1,5 +1,5 @@
 error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as mutable
-  --> $DIR/issue-47646.rs:12:30
+  --> $DIR/issue-47646.rs:9:30
    |
 LL |     let borrow = heap.peek_mut();
    |                  ---- mutable borrow occurs here
index 9add314fdaf0906f18d35bf1d90d886db214d83c..74323317f195643a2ca754fab96e935d8ea35de1 100644 (file)
@@ -1,6 +1,4 @@
 // compile-pass
-#![allow(dead_code)]
-#![feature(nll)]
 
 struct AtomicRefMut<'a> {
     value: &'a mut i32,
index 850771cffd0cfb1f627e7924aa51b646f1000424..377eeb67ae1b95d0f691faf7fde636a8a988ed6d 100644 (file)
@@ -1,6 +1,4 @@
 // compile-pass
-#![allow(dead_code)]
-#![feature(nll)]
 
 struct WithDrop;
 
index 06b17e931a9743d3db6481306e59109c59ddf9fe..22f2a1f364d1d21fb4777e0605422fb4f04e3ba5 100644 (file)
@@ -1,6 +1,4 @@
 // compile-pass
-#![allow(dead_code)]
-#![feature(nll)]
 
 struct MyStruct<'a> {
     field: &'a mut (),
index c9bc6147aa9ca421e39a46e4d41e0897059a5659..cefc872668cebd9c773753d08cf20fd9bd726522 100644 (file)
@@ -1,10 +1,8 @@
 // compile-pass
-#![allow(dead_code)]
 
 // Tests that automatic coercions from &mut T to *mut T
 // allow borrows of T to expire immediately - essentially, that
 // they work identically to 'foo as *mut T'
-#![feature(nll)]
 
 struct SelfReference {
     self_reference: *mut SelfReference,
index d15a27a2a2e65510f52bd47223f79fd738595f6a..334bd608add15afc59366363de6b1b4d33c608fe 100644 (file)
@@ -1,9 +1,6 @@
 // compile-pass
-#![allow(dead_code)]
 #![allow(non_upper_case_globals)]
 
-#![feature(nll)]
-
 static mut x: &'static u32 = &0;
 
 fn foo() {
index b3cef78f3e6b4b62b501c02f81b3308db613c0aa..ea325ea695f66a04c94b4eb8e00c7f783b228492 100644 (file)
@@ -3,9 +3,6 @@
 
 // run-pass
 
-#![feature(nll)]
-#![allow(warnings)]
-
 struct Inner<I, V> {
     iterator: I,
     item: V,
index 245f13b2b609d8e79f83f0fb79c35275c5c8f56e..90e9858d741972a353d48ee62989b2de60c60de5 100644 (file)
@@ -3,9 +3,6 @@
 
 // run-pass
 
-#![feature(nll)]
-#![allow(warnings)]
-
 pub struct Container<T: Iterator> {
     value: Option<T::Item>,
 }
index bc1bc29c98f2e967e123055b625b87550da5a498..f7fd04179f26e35e70216fb2fb87b3770c1d87d5 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn flatten<'a, 'b, T>(x: &'a &'b T) -> &'a T {
     x
 }
index 9a6da9e625da4bd0bec0118ebbe2ae7961f76a53..2f94039c0c3a934af7970fa24cc473ce8f4e8c8f 100644 (file)
@@ -1,5 +1,5 @@
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/issue-48803.rs:12:5
+  --> $DIR/issue-48803.rs:10:5
    |
 LL |     let y = &x;
    |             -- borrow of `x` occurs here
index 34f277af01e97b1e5e51774d1e2e0ff84b4105a2..dd7b9eeb8d54e65bb20898718f52199ffed886c7 100644 (file)
@@ -1,8 +1,6 @@
 // compile-pass
 // ignore-emscripten no i128 support
 
-#![feature(nll)]
-
 fn fibs(n: u32) -> impl Iterator<Item=u128> {
     (0 .. n)
     .scan((0, 1), |st, _| {
diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr
new file mode 100644 (file)
index 0000000..9c6f8d4
--- /dev/null
@@ -0,0 +1,18 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-49824.rs:10:9
+   |
+LL |       || {
+   |        - inferred to be a `FnMut` closure
+LL | /         || {
+LL | |
+LL | |
+LL | |
+LL | |             let _y = &mut x;
+LL | |         }
+   | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
index 64d9822bab4daadbdff8a2f5f6ea96acea1b2dfe..8eab7b2fa3ae9b215555e4633a4203d6619bee1b 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn main() {
     let foo = &16;
     //~^ HELP consider changing this to be a mutable reference
index 0e6c8fd48f19f73bf6459cd809e309ce1cef9f1d..827bb8fe2b8920e5d651faec472e06985ccd585e 100644 (file)
@@ -1,5 +1,5 @@
 error[E0594]: cannot assign to `*foo` which is behind a `&` reference
-  --> $DIR/issue-51515.rs:7:5
+  --> $DIR/issue-51515.rs:5:5
    |
 LL |     let foo = &16;
    |               --- help: consider changing this to be a mutable reference: `&mut 16`
@@ -8,7 +8,7 @@ LL |     *foo = 32;
    |     ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written
 
 error[E0594]: cannot assign to `*bar` which is behind a `&` reference
-  --> $DIR/issue-51515.rs:12:5
+  --> $DIR/issue-51515.rs:10:5
    |
 LL |     let bar = foo;
    |         --- help: consider changing this to be a mutable reference: `&mut i32`
index 2c02ac01142bb41bba228045bfae17087e1e9388..5966edd0bf09856643ee0d12b73aa2c2104a9b9f 100644 (file)
@@ -9,3 +9,5 @@ async fn foo() {}
 fn make_generator() {
     let _gen = || foo.await; //~ ERROR `await` is only allowed inside `async` functions and blocks
 }
+
+fn main() {}
index 768909b66ec7746d566cf387e8c05c0f1c812605..c06165b24468fb97f6b655d597336d699380c0e6 100644 (file)
@@ -2,7 +2,9 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks
   --> $DIR/issue-51719.rs:10:19
    |
 LL |     let _gen = || foo.await;
-   |                   ^^^^^^^^^
+   |                -- ^^^^^^^^^ only allowed inside `async` functions and blocks
+   |                |
+   |                this is not `async`
 
 error: aborting due to previous error
 
index 0c4cb034a9381df44ccd9a203ef73250ff7776f9..97b63d1590ec62bdd63511078c9a6f772860a76f 100644 (file)
@@ -1,8 +1,11 @@
 error[E0728]: `await` is only allowed inside `async` functions and blocks
   --> $DIR/issue-51751.rs:11:20
    |
+LL | fn main() {
+   |    ---- this is not `async`
+LL |     let result = inc(10000);
 LL |     let finished = result.await;
-   |                    ^^^^^^^^^^^^
+   |                    ^^^^^^^^^^^^ only allowed inside `async` functions and blocks
 
 error: aborting due to previous error
 
index 356efd5dfedbaec1c0365da391c801cbc6907e80..911983445e6d6f434b63c779c942a6fff7ddde0b 100644 (file)
@@ -4,8 +4,6 @@
 //
 // run-pass
 
-#![feature(nll)]
-
 pub trait Parser {
     type Input;
 
diff --git a/src/test/ui/issues/issue-52213.nll.stderr b/src/test/ui/issues/issue-52213.nll.stderr
new file mode 100644 (file)
index 0000000..eba875d
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-52213.rs:3:20
+   |
+LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
+   |                       --  -- lifetime `'b` defined here
+   |                       |
+   |                       lifetime `'a` defined here
+LL |     match (&t,) {
+LL |         ((u,),) => u,
+   |                    ^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-52533-1.nll.stderr b/src/test/ui/issues/issue-52533-1.nll.stderr
new file mode 100644 (file)
index 0000000..20f19b2
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-52533-1.rs:9:18
+   |
+LL |     gimme(|x, y| y)
+   |            -  -  ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+   |            |  |
+   |            |  has type `&Foo<'_, '1, u32>`
+   |            has type `&Foo<'_, '2, u32>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-52533.nll.stderr b/src/test/ui/issues/issue-52533.nll.stderr
new file mode 100644 (file)
index 0000000..c764736
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-52533.rs:5:16
+   |
+LL |     foo(|a, b| b)
+   |          -  -  ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+   |          |  |
+   |          |  has type `&'1 u32`
+   |          has type `&'2 u32`
+
+error: aborting due to previous error
+
index 0fdf077d2fc157953fd8bd2117c4e7ad84094455..c58656330e12b38981e72d260f2aadc5667efa7f 100644 (file)
@@ -4,8 +4,6 @@
 //
 // compile-pass
 
-#![feature(nll)]
-
 fn main() {}
 
 fn fail<'a>() -> Struct<'a, Generic<()>> {
index f04d861250b4044cdeee54c9e309a3b533544ee5..4d3b3f80a97e53f804ef0d18618d7ea26d50c161 100644 (file)
@@ -3,9 +3,6 @@
 //
 // compile-pass
 
-#![feature(nll)]
-#![allow(dead_code)]
-
 trait Future {
     type Item;
 }
diff --git a/src/test/ui/issues/issue-54302-cases.nll.stderr b/src/test/ui/issues/issue-54302-cases.nll.stderr
new file mode 100644 (file)
index 0000000..7463a3f
--- /dev/null
@@ -0,0 +1,26 @@
+error: higher-ranked subtype error
+  --> $DIR/issue-54302-cases.rs:63:5
+   |
+LL |     <u32 as RefFoo<u32>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: higher-ranked subtype error
+  --> $DIR/issue-54302-cases.rs:69:5
+   |
+LL |     <i32 as RefFoo<i32>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: higher-ranked subtype error
+  --> $DIR/issue-54302-cases.rs:75:5
+   |
+LL |     <u64 as RefFoo<u64>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: higher-ranked subtype error
+  --> $DIR/issue-54302-cases.rs:81:5
+   |
+LL |     <i64 as RefFoo<i64>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/issues/issue-54302.nll.stderr b/src/test/ui/issues/issue-54302.nll.stderr
new file mode 100644 (file)
index 0000000..e68de03
--- /dev/null
@@ -0,0 +1,8 @@
+error: higher-ranked subtype error
+  --> $DIR/issue-54302.rs:13:5
+   |
+LL |     assert_deserialize_owned::<&'static str>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
index 7750e3403619288b0f44a332799ebc97c7e25c80..8d3a4e72de411b88185c21909c5f404aa1030e43 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // This test is a minimal version of an ICE in the dropck-eyepatch tests
 // found in the fix for #54943.
 
index f829c38c35d23638963114e4bc92fbe043512d9f..41ca7c1498265b30c2be23281d86d1ea6dd900d9 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // This test is a minimal version of an ICE in the dropck-eyepatch tests
 // found in the fix for #54943. In particular, this test is in unreachable
 // code as the initial fix for this ICE only worked if the code was reachable.
diff --git a/src/test/ui/issues/issue-54943.nll.stderr b/src/test/ui/issues/issue-54943.nll.stderr
new file mode 100644 (file)
index 0000000..59be0f9
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-54943.rs:6:13
+   |
+LL | fn boo<'a>() {
+   |        -- lifetime `'a` defined here
+...
+LL |     let x = foo::<&'a u32>();
+   |             ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
index ce4e010674359670526297c83d84bef3cf11d4d9..85722300bf0064160093dcb2d0676d551eedaf23 100644 (file)
@@ -1,13 +1,10 @@
-#![feature(nll)]
-#![allow(warnings)]
-
 fn foo<T: 'static>() { }
 
 fn boo<'a>() {
     return;
 
     let x = foo::<&'a u32>();
-    //~^ ERROR lifetime may not live long enough
+    //~^ ERROR
 }
 
 fn main() {}
index aa68177bcdb58dd5a268d92d21192e24f5620181..d0f03f90c833013c3513bbd440e15cd5fab07a60 100644 (file)
@@ -1,11 +1,10 @@
-error: lifetime may not live long enough
-  --> $DIR/issue-54943.rs:9:13
+error[E0477]: the type `&'a u32` does not fulfill the required lifetime
+  --> $DIR/issue-54943.rs:6:13
    |
-LL | fn boo<'a>() {
-   |        -- lifetime `'a` defined here
-...
 LL |     let x = foo::<&'a u32>();
-   |             ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+   |             ^^^^^^^^^^^^^^
+   |
+   = note: type must satisfy the static lifetime
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-55731.nll.stderr b/src/test/ui/issues/issue-55731.nll.stderr
new file mode 100644 (file)
index 0000000..dd38bb6
--- /dev/null
@@ -0,0 +1,11 @@
+error: higher-ranked subtype error
+  --> $DIR/issue-55731.rs:48:5
+   |
+LL | /     multi(Map {
+LL | |         i: Cloned(PhantomData),
+LL | |         f: X,
+LL | |     });
+   | |______^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-55796.nll.stderr b/src/test/ui/issues/issue-55796.nll.stderr
new file mode 100644 (file)
index 0000000..5809a56
--- /dev/null
@@ -0,0 +1,20 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-55796.rs:16:9
+   |
+LL | pub trait Graph<'a> {
+   |                 -- lifetime `'a` defined here
+...
+LL |         Box::new(self.out_edges(u).map(|e| e.target()))
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/issue-55796.rs:21:9
+   |
+LL | pub trait Graph<'a> {
+   |                 -- lifetime `'a` defined here
+...
+LL |         Box::new(self.in_edges(u).map(|e| e.target()))
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/issues/issue-57843.nll.stderr b/src/test/ui/issues/issue-57843.nll.stderr
new file mode 100644 (file)
index 0000000..7031078
--- /dev/null
@@ -0,0 +1,8 @@
+error: higher-ranked subtype error
+  --> $DIR/issue-57843.rs:23:9
+   |
+LL |     Foo(Box::new(|_| ()));
+   |         ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr
new file mode 100644 (file)
index 0000000..c1f662f
--- /dev/null
@@ -0,0 +1,63 @@
+error[E0277]: `T` cannot be sent between threads safely
+  --> $DIR/kindck-impl-type-params.rs:18:13
+   |
+LL |     let a = &t as &Gettable<T>;
+   |             ^^ `T` cannot be sent between threads safely
+   |
+   = help: the trait `std::marker::Send` is not implemented for `T`
+   = help: consider adding a `where T: std::marker::Send` bound
+   = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+   = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+  --> $DIR/kindck-impl-type-params.rs:18:13
+   |
+LL |     let a = &t as &Gettable<T>;
+   |             ^^ the trait `std::marker::Copy` is not implemented for `T`
+   |
+   = help: consider adding a `where T: std::marker::Copy` bound
+   = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+   = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: `T` cannot be sent between threads safely
+  --> $DIR/kindck-impl-type-params.rs:25:27
+   |
+LL |     let a: &Gettable<T> = &t;
+   |                           ^^ `T` cannot be sent between threads safely
+   |
+   = help: the trait `std::marker::Send` is not implemented for `T`
+   = help: consider adding a `where T: std::marker::Send` bound
+   = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+   = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+  --> $DIR/kindck-impl-type-params.rs:25:27
+   |
+LL |     let a: &Gettable<T> = &t;
+   |                           ^^ the trait `std::marker::Copy` is not implemented for `T`
+   |
+   = help: consider adding a `where T: std::marker::Copy` bound
+   = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+   = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
+  --> $DIR/kindck-impl-type-params.rs:38:13
+   |
+LL |     let a = t as Box<Gettable<String>>;
+   |             ^ the trait `std::marker::Copy` is not implemented for `std::string::String`
+   |
+   = note: required because of the requirements on the impl of `Gettable<std::string::String>` for `S<std::string::String>`
+   = note: required for the cast to the object type `dyn Gettable<std::string::String>`
+
+error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied
+  --> $DIR/kindck-impl-type-params.rs:46:33
+   |
+LL |     let a: Box<Gettable<Foo>> = t;
+   |                                 ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo`
+   |
+   = note: required because of the requirements on the impl of `Gettable<foo3::Foo>` for `S<foo3::Foo>`
+   = note: required for the cast to the object type `dyn Gettable<foo3::Foo>`
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/kindck/kindck-send-object1.nll.stderr b/src/test/ui/kindck/kindck-send-object1.nll.stderr
new file mode 100644 (file)
index 0000000..1df7412
--- /dev/null
@@ -0,0 +1,32 @@
+error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely
+  --> $DIR/kindck-send-object1.rs:10:5
+   |
+LL |     assert_send::<&'a Dummy>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely
+   |
+   = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)`
+   = note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)`
+note: required by `assert_send`
+  --> $DIR/kindck-send-object1.rs:5:1
+   |
+LL | fn assert_send<T:Send+'static>() { }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely
+  --> $DIR/kindck-send-object1.rs:29:5
+   |
+LL |     assert_send::<Box<Dummy+'a>>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely
+   |
+   = help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)`
+   = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>`
+   = note: required because it appears within the type `std::boxed::Box<(dyn Dummy + 'a)>`
+note: required by `assert_send`
+  --> $DIR/kindck-send-object1.rs:5:1
+   |
+LL | fn assert_send<T:Send+'static>() { }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr
new file mode 100644 (file)
index 0000000..8b24563
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/lifetime-bound-will-change-warning.rs:34:5
+   |
+LL | fn test2<'a>(x: &'a Box<Fn()+'a>) {
+   |              - `x` is a reference that is only valid in the function body
+LL |     // but ref_obj will not, so warn.
+LL |     ref_obj(x)
+   |     ^^^^^^^^^^ `x` escapes the function body here
+
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/lifetime-bound-will-change-warning.rs:39:5
+   |
+LL | fn test2cc<'a>(x: &'a Box<Fn()+'a>) {
+   |                - `x` is a reference that is only valid in the function body
+LL |     // same as test2, but cross crate
+LL |     lib::ref_obj(x)
+   |     ^^^^^^^^^^^^^^^ `x` escapes the function body here
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr
new file mode 100644 (file)
index 0000000..fc9093b
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:11:20
+   |
+LL |     fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
+   |            --     - let's call the lifetime of this reference `'1`
+   |            |
+   |            lifetime `'a` defined here
+LL | 
+LL |         if x > y { x } else { y }
+   |                    ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr
new file mode 100644 (file)
index 0000000..3384c24
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:8:5
+   |
+LL |   fn foo<'a>(&self, x: &'a i32) -> &i32 {
+   |          --  - let's call the lifetime of this reference `'1`
+   |          |
+   |          lifetime `'a` defined here
+LL | 
+LL |     x
+   |     ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr
new file mode 100644 (file)
index 0000000..5ef2907
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:8:30
+   |
+LL |     fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
+   |            --  - let's call the lifetime of this reference `'1`
+   |            |
+   |            lifetime `'a` defined here
+LL | 
+LL |         if true { x } else { self }
+   |                              ^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr
new file mode 100644 (file)
index 0000000..90d4754
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0621]: explicit lifetime required in the type of `x`
+  --> $DIR/ex2a-push-one-existing-name-2.rs:6:5
+   |
+LL | fn foo<'a>(x: Ref<i32>, y: &mut Vec<Ref<'a, i32>>) {
+   |               -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>`
+LL |     y.push(x);
+   |     ^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr
new file mode 100644 (file)
index 0000000..a03e16b
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0621]: explicit lifetime required in the type of `y`
+  --> $DIR/ex2a-push-one-existing-name-early-bound.rs:8:5
+   |
+LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T)
+   |                                          -- help: add explicit lifetime `'a` to the type of `y`: `&'a T`
+...
+LL |     x.push(y);
+   |     ^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr
new file mode 100644 (file)
index 0000000..487b34e
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0621]: explicit lifetime required in the type of `y`
+  --> $DIR/ex2a-push-one-existing-name.rs:6:5
+   |
+LL | fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) {
+   |                                          -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>`
+LL |     x.push(y);
+   |     ^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr
new file mode 100644 (file)
index 0000000..735f7a0
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex2b-push-no-existing-names.rs:6:5
+   |
+LL | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
+   |        -                      - has type `Ref<'1, i32>`
+   |        |
+   |        has type `&mut std::vec::Vec<Ref<'2, i32>>`
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr
new file mode 100644 (file)
index 0000000..fbefa1f
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex2c-push-inference-variable.rs:7:5
+   |
+LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
+   |            --  -- lifetime `'c` defined here
+   |            |
+   |            lifetime `'b` defined here
+LL |     let z = Ref { data: y.data };
+LL |     x.push(z);
+   |     ^^^^^^^^^ argument requires that `'c` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr
new file mode 100644 (file)
index 0000000..d889eb4
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex2d-push-inference-variable-2.rs:8:5
+   |
+LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
+   |            --  -- lifetime `'c` defined here
+   |            |
+   |            lifetime `'b` defined here
+...
+LL |     a.push(b);
+   |     ^^^^^^^^^ argument requires that `'c` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr
new file mode 100644 (file)
index 0000000..39eb407
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex2e-push-inference-variable-3.rs:8:5
+   |
+LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
+   |            --  -- lifetime `'c` defined here
+   |            |
+   |            lifetime `'b` defined here
+...
+LL |     Vec::push(a, b);
+   |     ^^^^^^^^^^^^^^^ argument requires that `'c` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr
new file mode 100644 (file)
index 0000000..a94f9a7
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-2.rs:2:5
+   |
+LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) {
+   |                                   -             - let's call the lifetime of this reference `'1`
+   |                                   |
+   |                                   let's call the lifetime of this reference `'2`
+LL |     *v = x;
+   |     ^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr
new file mode 100644 (file)
index 0000000..779e2eb
--- /dev/null
@@ -0,0 +1,22 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-3.rs:2:5
+   |
+LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
+   |                     -                   - let's call the lifetime of this reference `'1`
+   |                     |
+   |                     let's call the lifetime of this reference `'2`
+LL |     z.push((x,y));
+   |     ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-3.rs:2:5
+   |
+LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
+   |                         -                    - let's call the lifetime of this reference `'1`
+   |                         |
+   |                         let's call the lifetime of this reference `'2`
+LL |     z.push((x,y));
+   |     ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr
new file mode 100644 (file)
index 0000000..4c0ffe5
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:5
+   |
+LL | fn foo(mut x: Ref, y: Ref) {
+   |        -----       - has type `Ref<'_, '1>`
+   |        |
+   |        has type `Ref<'_, '2>`
+LL |     x.b = y.b;
+   |     ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr
new file mode 100644 (file)
index 0000000..97c6653
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:7:5
+   |
+LL | fn foo(mut x: Ref) {
+   |        -----
+   |        |
+   |        has type `Ref<'_, '1>`
+   |        has type `Ref<'2, '_>`
+LL |     x.a = x.b;
+   |     ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr
new file mode 100644 (file)
index 0000000..a39bb16
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:9:5
+   |
+LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>)
+   |        --  -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+...
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr
new file mode 100644 (file)
index 0000000..48ce530
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:6:5
+   |
+LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) {
+   |        --  -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr
new file mode 100644 (file)
index 0000000..f9c33c2
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-both-are-structs.rs:6:5
+   |
+LL | fn foo(mut x: Vec<Ref>, y: Ref) {
+   |        -----            - has type `Ref<'1>`
+   |        |
+   |        has type `std::vec::Vec<Ref<'2>>`
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr
new file mode 100644 (file)
index 0000000..0996068
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-latebound-regions.rs:2:5
+   |
+LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
+   |        -- -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr
new file mode 100644 (file)
index 0000000..5751c31
--- /dev/null
@@ -0,0 +1,21 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5
+   |
+LL | fn foo(mut x: Ref, y: &u32) {
+   |        -----          - let's call the lifetime of this reference `'2`
+   |        |
+   |        has type `Ref<'_, '1>`
+LL |     y = x.b;
+   |     ^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error[E0384]: cannot assign to immutable argument `y`
+  --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5
+   |
+LL | fn foo(mut x: Ref, y: &u32) {
+   |                    - help: make this binding mutable: `mut y`
+LL |     y = x.b;
+   |     ^^^^^^^ cannot assign to immutable argument
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr
new file mode 100644 (file)
index 0000000..79e7e8e
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:4:5
+   |
+LL | fn foo(mut y: Ref, x: &u32) {
+   |        -----          - let's call the lifetime of this reference `'1`
+   |        |
+   |        has type `Ref<'_, '2>`
+LL |     y.b = x;
+   |     ^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr
new file mode 100644 (file)
index 0000000..53615fd
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:4:5
+   |
+LL | fn foo(mut y: Ref, x: &u32) {
+   |        -----          - let's call the lifetime of this reference `'1`
+   |        |
+   |        has type `Ref<'_, '2>`
+LL |     y.b = x;
+   |     ^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr
new file mode 100644 (file)
index 0000000..6ff4411
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-one-is-struct.rs:7:5
+   |
+LL | fn foo(mut x: Ref, y: &u32) {
+   |        -----          - let's call the lifetime of this reference `'1`
+   |        |
+   |        has type `Ref<'_, '2>`
+LL |     x.b = y;
+   |     ^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr
new file mode 100644 (file)
index 0000000..1c258ad
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:7:5
+   |
+LL |   fn foo<'a>(&self, x: &i32) -> &i32 {
+   |              -         - let's call the lifetime of this reference `'1`
+   |              |
+   |              let's call the lifetime of this reference `'2`
+LL |     x
+   |     ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr
new file mode 100644 (file)
index 0000000..ffe39fd
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-self-is-anon.rs:7:19
+   |
+LL |     fn foo<'a>(&self, x: &Foo) -> &Foo {
+   |                -         - let's call the lifetime of this reference `'1`
+   |                |
+   |                let's call the lifetime of this reference `'2`
+LL |         if true { x } else { self }
+   |                   ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr
new file mode 100644 (file)
index 0000000..33be98c
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
+  --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
+   |
+LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
+   |                        - help: consider changing this to be mutable: `mut y`
+LL |   y.push(z);
+   |   ^ cannot borrow as mutable
+
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
+   |
+LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
+   |                               -        - let's call the lifetime of this reference `'1`
+   |                               |
+   |                               let's call the lifetime of this reference `'2`
+LL |   y.push(z);
+   |   ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr
new file mode 100644 (file)
index 0000000..f350267
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-using-impl-items.rs:6:9
+   |
+LL |     fn foo(x: &mut Vec<&u8>, y: &u8) {
+   |                        -        - let's call the lifetime of this reference `'1`
+   |                        |
+   |                        let's call the lifetime of this reference `'2`
+LL |         x.push(y);
+   |         ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr
new file mode 100644 (file)
index 0000000..c4e7ff9
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
+  --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
+   |
+LL | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
+   |                              - help: consider changing this to be mutable: `mut y`
+LL |   y.push(z);
+   |   ^ cannot borrow as mutable
+
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
+   |
+LL | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
+   |                                     -        - let's call the lifetime of this reference `'1`
+   |                                     |
+   |                                     let's call the lifetime of this reference `'2`
+LL |   y.push(z);
+   |   ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr
new file mode 100644 (file)
index 0000000..6989acf
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions.rs:2:5
+   |
+LL | fn foo(x: &mut Vec<&u8>, y: &u8) {
+   |                    -        - let's call the lifetime of this reference `'1`
+   |                    |
+   |                    let's call the lifetime of this reference `'2`
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
index fa4221fb3392e2f31b35eb3153562a025e229cb9..f9ea5319d54c6ad26a91e3110dad5e64e8c995e0 100644 (file)
@@ -1,6 +1,7 @@
 // FIXME https://github.com/rust-lang/rust/issues/59774
 // normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
 // normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
+// ignore-sgx no weak linkages permitted
 
 #![feature(linkage)]
 
index c72978388ebfe232b90d1ccb25c1a274a77a2d4a..8326c0bacccb64ed4b0ffc9edbe6ea28b86ca0d7 100644 (file)
@@ -1,5 +1,5 @@
 error: must have type `*const T` or `*mut T`
-  --> $DIR/linkage2.rs:8:32
+  --> $DIR/linkage2.rs:9:32
    |
 LL |     #[linkage = "extern_weak"] static foo: i32;
    |                                ^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/lub-if.nll.stderr b/src/test/ui/lub-if.nll.stderr
new file mode 100644 (file)
index 0000000..832688f
--- /dev/null
@@ -0,0 +1,20 @@
+error: lifetime may not live long enough
+  --> $DIR/lub-if.rs:28:9
+   |
+LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 -- lifetime `'a` defined here
+...
+LL |         s
+   |         ^ returning this value requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/lub-if.rs:35:9
+   |
+LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 -- lifetime `'a` defined here
+...
+LL |         s
+   |         ^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/lub-match.nll.stderr b/src/test/ui/lub-match.nll.stderr
new file mode 100644 (file)
index 0000000..3a344a7
--- /dev/null
@@ -0,0 +1,20 @@
+error: lifetime may not live long enough
+  --> $DIR/lub-match.rs:30:13
+   |
+LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 -- lifetime `'a` defined here
+...
+LL |             s
+   |             ^ returning this value requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/lub-match.rs:39:13
+   |
+LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 -- lifetime `'a` defined here
+...
+LL |             s
+   |             ^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/match/match-ref-mut-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-invariance.nll.stderr
new file mode 100644 (file)
index 0000000..505b8db
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/match-ref-mut-invariance.rs:10:9
+   |
+LL | impl<'b> S<'b> {
+   |      -- lifetime `'b` defined here
+LL |     fn bar<'a>(&'a mut self) -> &'a mut &'a i32 {
+   |            -- lifetime `'a` defined here
+LL |         match self.0 { ref mut x => x }
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr
new file mode 100644 (file)
index 0000000..ab5f43d
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/match-ref-mut-let-invariance.rs:11:9
+   |
+LL | impl<'b> S<'b> {
+   |      -- lifetime `'b` defined here
+LL |     fn bar<'a>(&'a mut self) -> &'a mut &'a i32 {
+   |            -- lifetime `'a` defined here
+LL |         let ref mut x = self.0;
+LL |         x
+   |         ^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
index 07ac1900bc71c66e1192caad287bc66a21257236..91d41e9b5794e844451ae977e34acdd295b82d50 100644 (file)
@@ -1,6 +1,5 @@
 // General test of maybe_uninits state computed by MIR dataflow.
 
-#![feature(nll)]
 #![feature(core_intrinsics, rustc_attrs)]
 
 use std::intrinsics::rustc_peek;
index 6bc5f7dcb99fcad4f91ea6176678b7b8b7782ae7..48d8450489488823a0b51ac5a30cac8b3edd5591 100644 (file)
@@ -1,23 +1,23 @@
 error: rustc_peek: bit not set
-  --> $DIR/def-inits-1.rs:15:14
+  --> $DIR/def-inits-1.rs:14:14
    |
 LL |     unsafe { rustc_peek(&ret); }
    |              ^^^^^^^^^^^^^^^^
 
 error: rustc_peek: bit not set
-  --> $DIR/def-inits-1.rs:31:14
+  --> $DIR/def-inits-1.rs:30:14
    |
 LL |     unsafe { rustc_peek(&z); }
    |              ^^^^^^^^^^^^^^
 
 error: rustc_peek: bit not set
-  --> $DIR/def-inits-1.rs:34:14
+  --> $DIR/def-inits-1.rs:33:14
    |
 LL |     unsafe { rustc_peek(&y); }
    |              ^^^^^^^^^^^^^^
 
 error: rustc_peek: bit not set
-  --> $DIR/def-inits-1.rs:42:14
+  --> $DIR/def-inits-1.rs:41:14
    |
 LL |     unsafe { rustc_peek(&x); }
    |              ^^^^^^^^^^^^^^
index 13f900e4a75eeb7a8b0dd94373c92e89605102a4..4a4786a2a73783fd223564f9e418492f2def71a6 100644 (file)
@@ -1,6 +1,5 @@
 // General test of maybe_inits state computed by MIR dataflow.
 
-#![feature(nll)]
 #![feature(core_intrinsics, rustc_attrs)]
 
 use std::intrinsics::rustc_peek;
index 38a9c60b168d1886b249de94fa86d7527ece1bba..23d0679cb1ac180c30f583b78710fa609df69da2 100644 (file)
@@ -1,17 +1,17 @@
 error: rustc_peek: bit not set
-  --> $DIR/inits-1.rs:15:14
+  --> $DIR/inits-1.rs:14:14
    |
 LL |     unsafe { rustc_peek(&ret); }
    |              ^^^^^^^^^^^^^^^^
 
 error: rustc_peek: bit not set
-  --> $DIR/inits-1.rs:35:14
+  --> $DIR/inits-1.rs:34:14
    |
 LL |     unsafe { rustc_peek(&y); }
    |              ^^^^^^^^^^^^^^
 
 error: rustc_peek: bit not set
-  --> $DIR/inits-1.rs:43:14
+  --> $DIR/inits-1.rs:42:14
    |
 LL |     unsafe { rustc_peek(&x); }
    |              ^^^^^^^^^^^^^^
index 4c64359693296f810d3374a0daf7f28fe2868be1..66b3f458a5159f932f0e033fc358ee86d8b71995 100644 (file)
@@ -1,6 +1,5 @@
 // General test of maybe_uninits state computed by MIR dataflow.
 
-#![feature(nll)]
 #![feature(core_intrinsics, rustc_attrs)]
 
 use std::intrinsics::rustc_peek;
index c60987050e6385361a46aa4bbd354c430e8e48e4..5f6dbde212d0ae922896e41bfa70d97a94416cf2 100644 (file)
@@ -1,29 +1,29 @@
 error: rustc_peek: bit not set
-  --> $DIR/uninits-1.rs:19:14
+  --> $DIR/uninits-1.rs:18:14
    |
 LL |     unsafe { rustc_peek(&x) };
    |              ^^^^^^^^^^^^^^
 
 error: rustc_peek: bit not set
-  --> $DIR/uninits-1.rs:20:14
+  --> $DIR/uninits-1.rs:19:14
    |
 LL |     unsafe { rustc_peek(&y) };
    |              ^^^^^^^^^^^^^^
 
 error: rustc_peek: bit not set
-  --> $DIR/uninits-1.rs:21:14
+  --> $DIR/uninits-1.rs:20:14
    |
 LL |     unsafe { rustc_peek(&z) };
    |              ^^^^^^^^^^^^^^
 
 error: rustc_peek: bit not set
-  --> $DIR/uninits-1.rs:37:14
+  --> $DIR/uninits-1.rs:36:14
    |
 LL |     unsafe { rustc_peek(&x); }
    |              ^^^^^^^^^^^^^^
 
 error: rustc_peek: bit not set
-  --> $DIR/uninits-1.rs:45:14
+  --> $DIR/uninits-1.rs:44:14
    |
 LL |     unsafe { rustc_peek(&ret); }
    |              ^^^^^^^^^^^^^^^^
index 2247e68d097fc6d4dc769324abb656d99b509406..2ccf1c7f9d6c67e5fd7a365c2e80e8ebab90a7a9 100644 (file)
@@ -1,6 +1,5 @@
 // General test of maybe_uninits state computed by MIR dataflow.
 
-#![feature(nll)]
 #![feature(core_intrinsics, rustc_attrs)]
 
 use std::intrinsics::rustc_peek;
index de3e58e52de41512b6c3d46e03050bd52be008ee..dcb61371994db2ee303da2e9d217064577652f1d 100644 (file)
@@ -1,5 +1,5 @@
 error: rustc_peek: bit not set
-  --> $DIR/uninits-2.rs:15:14
+  --> $DIR/uninits-2.rs:14:14
    |
 LL |     unsafe { rustc_peek(&x) };
    |              ^^^^^^^^^^^^^^
index 03db28fc508b144717872bc953a7598a6835069d..42e28b9674b3097bc7cb340e2821ea3693d72b65 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // run-pass
 
 fn vec() {
index 59936a80925342717e6b2f388d0a71ee607c213e..7d3b00dfc716331612da2f98015de6795cf39957 100644 (file)
@@ -3,7 +3,6 @@
 //
 // FIXME(#54366) - We probably shouldn't allow #[thread_local] static mut to get a 'static lifetime.
 
-#![feature(nll)]
 #![feature(thread_local)]
 
 #[thread_local]
index d37e61b63a814d283b5a17dd8c6e59c9735e7523..d333356d964ce79e11411c81590c63410376f2ff 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn gimme(x: &(u32,)) -> &u32 {
     &x.0
 }
index 799eec9d3422c022a46570a876adfacd25be6a0f..d629caa435319c355347a94dabec6360edff860e 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `v` does not live long enough
-  --> $DIR/borrowed-local-error.rs:10:9
+  --> $DIR/borrowed-local-error.rs:8:9
    |
 LL |     let x = gimme({
    |             ----- borrow later used by call
index 7bad6dc2cd335d11dab582b0e2132394a7ab5f5b..d4b05fb79316084ab9477e25da42e79c42e3fb6b 100644 (file)
@@ -1,7 +1,6 @@
 // Regression test for issue #38899
 
 #![feature(nll)]
-#![allow(dead_code)]
 
 pub struct Block<'a> {
     current: &'a u8,
index 5c9c48f5b1d8379233b75c37f146bcf710ba18c4..38a6e27a0e5600ff199bfc8ea1bd9b199085ac85 100644 (file)
@@ -1,5 +1,5 @@
 error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
-  --> $DIR/borrowed-referent-issue-38899.rs:14:21
+  --> $DIR/borrowed-referent-issue-38899.rs:13:21
    |
 LL |     let x = &mut block;
    |             ---------- mutable borrow occurs here
index 5ad987c721470bbab08f411ca8da30687658adb7..37d0e670d350d1d7f9b47a5588307de541e32ce6 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn gimme(x: &(u32,)) -> &u32 {
     &x.0
 }
index c0d42312eb1adf90005df986c54d0203d8a2d90d..2c6bd92641f608c7e7947ef2d410de46deb4f6ce 100644 (file)
@@ -1,5 +1,5 @@
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/borrowed-temporary-error.rs:10:10
+  --> $DIR/borrowed-temporary-error.rs:8:10
    |
 LL |         &(v,)
    |          ^^^^ creates a temporary which is freed while still in use
index a10a62b470d76b1a2e02e41251034477f1f1456f..3f9b2f2924c2cf3d4c8a9c1bef71f0ccee5609f6 100644 (file)
@@ -1,6 +1,3 @@
-#![feature(nll)]
-#![allow(warnings)]
-
 fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
     let v = 22;
     &v
index e89a77a2d360fe909b8c7c5607a5528318f6022f..7213ed3bafb376062f20ade07dae380fefbcd88e 100644 (file)
@@ -1,5 +1,5 @@
 error[E0515]: cannot return reference to local variable `v`
-  --> $DIR/borrowed-universal-error-2.rs:6:5
+  --> $DIR/borrowed-universal-error-2.rs:3:5
    |
 LL |     &v
    |     ^^ returns a reference to data owned by the current function
index 18a0a72c4bb83592fffcd0117edea1c7ffacac0a..fc9ffd47061b4556ecd418eec42dd103c64f5764 100644 (file)
@@ -1,6 +1,3 @@
-#![feature(nll)]
-#![allow(warnings)]
-
 fn gimme(x: &(u32,)) -> &u32 {
     &x.0
 }
index 4b76795943e6466fe0a027db2cd9eb6304b11c92..88a2d8fcf8cc0eafe6c9393de9c303bbf653e973 100644 (file)
@@ -1,5 +1,5 @@
 error[E0515]: cannot return value referencing temporary value
-  --> $DIR/borrowed-universal-error.rs:10:5
+  --> $DIR/borrowed-universal-error.rs:7:5
    |
 LL |     gimme(&(v,))
    |     ^^^^^^^----^
index 222f4e71c52fee6b40065b3eca56d5aaa1699860..9d2624a9d6fa628b2710da6ec316f9a31385e578 100644 (file)
@@ -1,7 +1,6 @@
 // Check that capturing a mutable reference by move and assigning to its
 // referent doesn't make the unused mut lint think that it is mutable.
 
-#![feature(nll)]
 #![deny(unused_mut)]
 
 fn mutable_upvar() {
index 327ce0c6e81f00ce08b95a1897b5f194c3da7617..883b2d05a7f51b75f48fd8f3c122a072a611a046 100644 (file)
@@ -1,5 +1,5 @@
 error: variable does not need to be mutable
-  --> $DIR/capture-mut-ref.rs:8:9
+  --> $DIR/capture-mut-ref.rs:7:9
    |
 LL |     let mut x = &mut 0;
    |         ----^
@@ -7,7 +7,7 @@ LL |     let mut x = &mut 0;
    |         help: remove this `mut`
    |
 note: lint level defined here
-  --> $DIR/capture-mut-ref.rs:5:9
+  --> $DIR/capture-mut-ref.rs:4:9
    |
 LL | #![deny(unused_mut)]
    |         ^^^^^^^^^^
index bf2db32901e681687c80fe432f0f52732f720979..db6ac7d66ccc48363c8077f8802c4879a93bb6f6 100644 (file)
@@ -1,9 +1,6 @@
 // Test that a structure which tries to store a pointer to `y` into
 // `p` (indirectly) fails to compile.
 
-#![feature(rustc_attrs)]
-#![feature(nll)]
-
 struct SomeStruct<'a, 'b: 'a> {
     p: &'a mut &'b i32,
     y: &'b i32,
index 7fafb4474fdb3798ecdc138f4bee34d29946cd3a..521e543bd269310b22917e285efd0096b00d9a85 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `y` does not live long enough
-  --> $DIR/capture-ref-in-struct.rs:21:16
+  --> $DIR/capture-ref-in-struct.rs:18:16
    |
 LL |             y: &y,
    |                ^^ borrowed value does not live long enough
index 1e11b4818183b907c5a830e16d9f40caed1d78fc..2a59e80b25cd94903dd21fb3e1ce26f7c80a71a8 100644 (file)
@@ -1,7 +1,5 @@
 // check that accesses due to a closure capture give a special note
 
-#![feature(nll)]
-
 fn closure_imm_capture_conflict(mut x: i32) {
     let r = &mut x;
     || x; //~ ERROR
index 32958e28a3d08975c412c6123aea530c93095290..4a8086905b7df297696c96cf66c8b7dc04117952 100644 (file)
@@ -1,5 +1,5 @@
 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
-  --> $DIR/closure-access-spans.rs:7:5
+  --> $DIR/closure-access-spans.rs:5:5
    |
 LL |     let r = &mut x;
    |             ------ mutable borrow occurs here
@@ -11,7 +11,7 @@ LL |     r.use_mut();
    |     - mutable borrow later used here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time
-  --> $DIR/closure-access-spans.rs:13:5
+  --> $DIR/closure-access-spans.rs:11:5
    |
 LL |     let r = &mut x;
    |             ------ first mutable borrow occurs here
@@ -23,7 +23,7 @@ LL |     r.use_mut();
    |     - first borrow later used here
 
 error[E0500]: closure requires unique access to `x` but it is already borrowed
-  --> $DIR/closure-access-spans.rs:19:5
+  --> $DIR/closure-access-spans.rs:17:5
    |
 LL |     let r = &mut x;
    |             ------ borrow occurs here
@@ -35,7 +35,7 @@ LL |     r.use_mut();
    |     - first borrow later used here
 
 error[E0503]: cannot use `x` because it was mutably borrowed
-  --> $DIR/closure-access-spans.rs:25:13
+  --> $DIR/closure-access-spans.rs:23:13
    |
 LL |     let r = &mut x;
    |             ------ borrow of `x` occurs here
@@ -45,7 +45,7 @@ LL |     r.use_ref();
    |     - borrow later used here
 
 error[E0505]: cannot move out of `x` because it is borrowed
-  --> $DIR/closure-access-spans.rs:31:5
+  --> $DIR/closure-access-spans.rs:29:5
    |
 LL |     let r = &x;
    |             -- borrow of `x` occurs here
@@ -57,7 +57,7 @@ LL |     r.use_ref();
    |     - borrow later used here
 
 error[E0382]: borrow of moved value: `x`
-  --> $DIR/closure-access-spans.rs:37:5
+  --> $DIR/closure-access-spans.rs:35:5
    |
 LL | fn closure_imm_capture_moved(mut x: String) {
    |                              ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
@@ -69,7 +69,7 @@ LL |     || x.len();
    |     value borrowed here after move
 
 error[E0382]: borrow of moved value: `x`
-  --> $DIR/closure-access-spans.rs:42:5
+  --> $DIR/closure-access-spans.rs:40:5
    |
 LL | fn closure_mut_capture_moved(mut x: String) {
    |                              ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
@@ -81,7 +81,7 @@ LL |     || x = String::new();
    |     value borrowed here after move
 
 error[E0382]: borrow of moved value: `x`
-  --> $DIR/closure-access-spans.rs:47:5
+  --> $DIR/closure-access-spans.rs:45:5
    |
 LL | fn closure_unique_capture_moved(x: &mut String) {
    |                                 - move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait
@@ -93,7 +93,7 @@ LL |     || *x = String::new();
    |     value borrowed here after move
 
 error[E0382]: use of moved value: `x`
-  --> $DIR/closure-access-spans.rs:52:5
+  --> $DIR/closure-access-spans.rs:50:5
    |
 LL | fn closure_move_capture_moved(x: &mut String) {
    |                               - move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait
index 7fc301b70380b1da75c0d5ae5495aa3cb3c787db..b38f7900e8e5e89c7959ea6f85caedf40c77b9de 100644 (file)
@@ -1,7 +1,5 @@
 // check that existing borrows due to a closure capture give a special note
 
-#![feature(nll)]
-
 fn move_while_borrowed(x: String) {
     let f = || x.len();
     let y = x; //~ ERROR
index 30d99d56678ce0492245a1cfdfc31311528961c8..a3bcbbab3ec691214aaf7f9e946362a9b6683d8a 100644 (file)
@@ -1,5 +1,5 @@
 error[E0505]: cannot move out of `x` because it is borrowed
-  --> $DIR/closure-borrow-spans.rs:7:13
+  --> $DIR/closure-borrow-spans.rs:5:13
    |
 LL |     let f = || x.len();
    |             -- - borrow occurs due to use in closure
@@ -11,7 +11,7 @@ LL |     f.use_ref();
    |     - borrow later used here
 
 error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
-  --> $DIR/closure-borrow-spans.rs:13:13
+  --> $DIR/closure-borrow-spans.rs:11:13
    |
 LL |     let f = || x;
    |             -- - first borrow occurs due to use of `x` in closure
@@ -23,7 +23,7 @@ LL |     f.use_ref();
    |     - immutable borrow later used here
 
 error[E0597]: `x` does not live long enough
-  --> $DIR/closure-borrow-spans.rs:21:16
+  --> $DIR/closure-borrow-spans.rs:19:16
    |
 LL |         f = || x;
    |             -- ^ borrowed value does not live long enough
@@ -35,7 +35,7 @@ LL |     f.use_ref();
    |     - borrow later used here
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/closure-borrow-spans.rs:28:5
+  --> $DIR/closure-borrow-spans.rs:26:5
    |
 LL |     let f = || x;
    |             -- - borrow occurs due to use in closure
@@ -47,7 +47,7 @@ LL |     f.use_ref();
    |     - borrow later used here
 
 error[E0503]: cannot use `x` because it was mutably borrowed
-  --> $DIR/closure-borrow-spans.rs:34:13
+  --> $DIR/closure-borrow-spans.rs:32:13
    |
 LL |     let f = || x = 0;
    |             -- - borrow occurs due to use of `x` in closure
@@ -59,7 +59,7 @@ LL |     f.use_ref();
    |     - borrow later used here
 
 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
-  --> $DIR/closure-borrow-spans.rs:40:13
+  --> $DIR/closure-borrow-spans.rs:38:13
    |
 LL |     let f = || x = 0;
    |             -- - first borrow occurs due to use of `x` in closure
@@ -71,7 +71,7 @@ LL |     f.use_ref();
    |     - mutable borrow later used here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time
-  --> $DIR/closure-borrow-spans.rs:46:13
+  --> $DIR/closure-borrow-spans.rs:44:13
    |
 LL |     let f = || x = 0;
    |             -- - first borrow occurs due to use of `x` in closure
@@ -83,7 +83,7 @@ LL |     f.use_ref();
    |     - first borrow later used here
 
 error[E0597]: `x` does not live long enough
-  --> $DIR/closure-borrow-spans.rs:54:16
+  --> $DIR/closure-borrow-spans.rs:52:16
    |
 LL |         f = || x = 0;
    |             -- ^ borrowed value does not live long enough
@@ -95,7 +95,7 @@ LL |     f.use_ref();
    |     - borrow later used here
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/closure-borrow-spans.rs:61:5
+  --> $DIR/closure-borrow-spans.rs:59:5
    |
 LL |     let f = || x = 0;
    |             -- - borrow occurs due to use in closure
@@ -107,7 +107,7 @@ LL |     f.use_ref();
    |     - borrow later used here
 
 error[E0505]: cannot move out of `x` because it is borrowed
-  --> $DIR/closure-borrow-spans.rs:67:13
+  --> $DIR/closure-borrow-spans.rs:65:13
    |
 LL |     let f = || *x = 0;
    |             --  - borrow occurs due to use in closure
@@ -119,7 +119,7 @@ LL |     f.use_ref();
    |     - borrow later used here
 
 error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access
-  --> $DIR/closure-borrow-spans.rs:73:13
+  --> $DIR/closure-borrow-spans.rs:71:13
    |
 LL |     let f = || *x = 0;
    |             --  - first borrow occurs due to use of `x` in closure
@@ -131,7 +131,7 @@ LL |     f.use_ref();
    |     - first borrow later used here
 
 error[E0501]: cannot borrow `x` as mutable because previous closure requires unique access
-  --> $DIR/closure-borrow-spans.rs:79:13
+  --> $DIR/closure-borrow-spans.rs:77:13
    |
 LL |     let f = || *x = 0;
    |             --  - first borrow occurs due to use of `x` in closure
@@ -143,7 +143,7 @@ LL |     f.use_ref();
    |     - first borrow later used here
 
 error[E0597]: `x` does not live long enough
-  --> $DIR/closure-borrow-spans.rs:88:17
+  --> $DIR/closure-borrow-spans.rs:86:17
    |
 LL |         f = || *x = 0;
    |             --  ^ borrowed value does not live long enough
@@ -155,7 +155,7 @@ LL |     f.use_ref();
    |     - borrow later used here
 
 error[E0506]: cannot assign to `*x` because it is borrowed
-  --> $DIR/closure-borrow-spans.rs:95:5
+  --> $DIR/closure-borrow-spans.rs:93:5
    |
 LL |     let f = || *x = 0;
    |             --  - borrow occurs due to use in closure
index 3a01f86cad890692069d2c8da1cf20f82a282878..16d90b971745a70b86044dcdb7e4a6b0b6d84b65 100644 (file)
@@ -1,8 +1,5 @@
 // Some cases with closures that might be problems
 
-#![allow(unused)]
-#![feature(nll)]
-
 // Should have one error per assignment
 
 fn one_closure(x: i32) {
index fbd02bc8095a74dd5433dfa9894d99c5de73dc32..77f7d815eeb4c180122ccb2168ca6d81df092ce6 100644 (file)
@@ -1,5 +1,5 @@
 error[E0594]: cannot assign to `x`, as it is not declared as mutable
-  --> $DIR/closure-captures.rs:10:5
+  --> $DIR/closure-captures.rs:7:5
    |
 LL | fn one_closure(x: i32) {
    |                - help: consider changing this to be mutable: `mut x`
@@ -8,7 +8,7 @@ LL |     x = 1;
    |     ^^^^^ cannot assign
 
 error[E0594]: cannot assign to `x`, as it is not declared as mutable
-  --> $DIR/closure-captures.rs:12:5
+  --> $DIR/closure-captures.rs:9:5
    |
 LL | fn one_closure(x: i32) {
    |                - help: consider changing this to be mutable: `mut x`
@@ -17,7 +17,7 @@ LL |     x = 1;
    |     ^^^^^ cannot assign
 
 error[E0594]: cannot assign to `x`, as it is not declared as mutable
-  --> $DIR/closure-captures.rs:18:9
+  --> $DIR/closure-captures.rs:15:9
    |
 LL | fn two_closures(x: i32) {
    |                 - help: consider changing this to be mutable: `mut x`
@@ -26,7 +26,7 @@ LL |         x = 1;
    |         ^^^^^ cannot assign
 
 error[E0594]: cannot assign to `x`, as it is not declared as mutable
-  --> $DIR/closure-captures.rs:22:9
+  --> $DIR/closure-captures.rs:19:9
    |
 LL | fn two_closures(x: i32) {
    |                 - help: consider changing this to be mutable: `mut x`
@@ -35,7 +35,7 @@ LL |         x = 1;
    |         ^^^^^ cannot assign
 
 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
-  --> $DIR/closure-captures.rs:30:9
+  --> $DIR/closure-captures.rs:27:9
    |
 LL |         ||
    |         ^^ cannot borrow as mutable
@@ -43,7 +43,7 @@ LL |          x = 1;}
    |          - mutable borrow occurs due to use of `x` in closure
    |
 help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/closure-captures.rs:29:12
+  --> $DIR/closure-captures.rs:26:12
    |
 LL |       fn_ref(|| {
    |  ____________^
@@ -52,7 +52,7 @@ LL | |          x = 1;}
    | |________________^
 
 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
-  --> $DIR/closure-captures.rs:34:9
+  --> $DIR/closure-captures.rs:31:9
    |
 LL |         ||
    |         ^^ cannot borrow as mutable
@@ -60,7 +60,7 @@ LL |     x = 1;});
    |     - mutable borrow occurs due to use of `x` in closure
    |
 help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/closure-captures.rs:33:12
+  --> $DIR/closure-captures.rs:30:12
    |
 LL |       fn_ref(move || {
    |  ____________^
@@ -69,7 +69,7 @@ LL | |     x = 1;});
    | |___________^
 
 error[E0594]: cannot assign to `x`, as it is not declared as mutable
-  --> $DIR/closure-captures.rs:42:10
+  --> $DIR/closure-captures.rs:39:10
    |
 LL | fn two_closures_ref(x: i32) {
    |                     - help: consider changing this to be mutable: `mut x`
@@ -78,7 +78,7 @@ LL |          x = 1;}
    |          ^^^^^ cannot assign
 
 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
-  --> $DIR/closure-captures.rs:41:9
+  --> $DIR/closure-captures.rs:38:9
    |
 LL |         ||
    |         ^^ cannot borrow as mutable
@@ -86,7 +86,7 @@ LL |          x = 1;}
    |          - mutable borrow occurs due to use of `x` in closure
    |
 help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/closure-captures.rs:40:12
+  --> $DIR/closure-captures.rs:37:12
    |
 LL |       fn_ref(|| {
    |  ____________^
@@ -95,7 +95,7 @@ LL | |          x = 1;}
    | |________________^
 
 error[E0594]: cannot assign to `x`, as it is not declared as mutable
-  --> $DIR/closure-captures.rs:46:5
+  --> $DIR/closure-captures.rs:43:5
    |
 LL | fn two_closures_ref(x: i32) {
    |                     - help: consider changing this to be mutable: `mut x`
@@ -104,7 +104,7 @@ LL |     x = 1;});
    |     ^^^^^ cannot assign
 
 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
-  --> $DIR/closure-captures.rs:45:9
+  --> $DIR/closure-captures.rs:42:9
    |
 LL |         ||
    |         ^^ cannot borrow as mutable
@@ -112,7 +112,7 @@ LL |     x = 1;});
    |     - mutable borrow occurs due to use of `x` in closure
    |
 help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/closure-captures.rs:44:12
+  --> $DIR/closure-captures.rs:41:12
    |
 LL |       fn_ref(move || {
    |  ____________^
@@ -121,7 +121,7 @@ LL | |     x = 1;});
    | |___________^
 
 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
-  --> $DIR/closure-captures.rs:51:9
+  --> $DIR/closure-captures.rs:48:9
    |
 LL |         ||
    |         ^^ cannot borrow as mutable
@@ -129,7 +129,7 @@ LL |         *x = 1;});
    |          - mutable borrow occurs due to use of `x` in closure
    |
 help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/closure-captures.rs:50:12
+  --> $DIR/closure-captures.rs:47:12
    |
 LL |       fn_ref(|| {
    |  ____________^
@@ -138,7 +138,7 @@ LL | |         *x = 1;});
    | |________________^
 
 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
-  --> $DIR/closure-captures.rs:54:9
+  --> $DIR/closure-captures.rs:51:9
    |
 LL |         ||
    |         ^^ cannot borrow as mutable
@@ -146,7 +146,7 @@ LL |         *x = 1;});
    |          - mutable borrow occurs due to use of `x` in closure
    |
 help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/closure-captures.rs:53:12
+  --> $DIR/closure-captures.rs:50:12
    |
 LL |       fn_ref(move || {
    |  ____________^
index ffbfa9f8ae4835cf328c5aacd7a4dc022678dfbb..bf2431870a942cd27f31421fa0ef5616ea783dac 100644 (file)
@@ -1,7 +1,5 @@
 // check that moves due to a closure capture give a special note
 
-#![feature(nll)]
-
 fn move_after_move(x: String) {
     || x;
     let y = x; //~ ERROR
index 1cc4ca85b9ff340dc60beb50138f556e0293a5e2..972dbc6a61d089d518bfc97791efd2ce2044a953 100644 (file)
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `x`
-  --> $DIR/closure-move-spans.rs:7:13
+  --> $DIR/closure-move-spans.rs:5:13
    |
 LL | fn move_after_move(x: String) {
    |                    - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
@@ -11,7 +11,7 @@ LL |     let y = x;
    |             ^ value used here after move
 
 error[E0382]: borrow of moved value: `x`
-  --> $DIR/closure-move-spans.rs:12:13
+  --> $DIR/closure-move-spans.rs:10:13
    |
 LL | fn borrow_after_move(x: String) {
    |                      - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
@@ -23,7 +23,7 @@ LL |     let y = &x;
    |             ^^ value borrowed here after move
 
 error[E0382]: borrow of moved value: `x`
-  --> $DIR/closure-move-spans.rs:17:13
+  --> $DIR/closure-move-spans.rs:15:13
    |
 LL | fn borrow_mut_after_move(mut x: String) {
    |                          ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
index 71d5d4053ee252cbb89de224860fef2a146cdfc6..8ed6554877eaea039a9c22c7e334a1b519ce032d 100644 (file)
@@ -1,7 +1,3 @@
-// revisions: migrate nll
-//[migrate]compile-flags: -Z borrowck=migrate
-#![cfg_attr(nll, feature(nll))]
-
 // compile-pass
 
 // Test that we propagate region relations from closures precisely when there is
index dbc659b4aeef94c145180dcea3ff23a7148d7349..a9d2a07715d49532a5ad4da67f3d673169555992 100644 (file)
@@ -1,8 +1,6 @@
 // Test that we propagate *all* requirements to the caller, not just the first
 // one.
 
-#![feature(nll)]
-
 fn once<S, T, U, F: FnOnce(S, T) -> U>(f: F, s: S, t: T) -> U {
     f(s, t)
 }
index 332724daaa8bd4cc3c3e4fc1bd8d9c6ec31178db..2fec9bc62d1c7ecc9ba8374943141d0c4cd65c2f 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `local_arr` does not live long enough
-  --> $DIR/propagate-multiple-requirements.rs:17:14
+  --> $DIR/propagate-multiple-requirements.rs:15:14
    |
 LL |     let mut out: &mut &'static [i32] = &mut (&[1] as _);
    |                  ------------------- type annotation requires that `local_arr` is borrowed for `'static`
index c7cd519cffbceada5cb1d1022c065ea2c9c2178e..6768250dcbc0aa447a9aaa7b686b42c343e80c79 100644 (file)
@@ -1,7 +1,5 @@
 // check that liveness due to a closure capture gives a special note
 
-#![feature(nll)]
-
 fn use_as_borrow_capture(mut x: i32) {
     let y = &x;
     x = 0; //~ ERROR
index 20696da3b8e821c1b21140dc99fe690319f8374a..ec7e0f308557db1530cce191ae9a46bd8fe1af0e 100644 (file)
@@ -1,5 +1,5 @@
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/closure-use-spans.rs:7:5
+  --> $DIR/closure-use-spans.rs:5:5
    |
 LL |     let y = &x;
    |             -- borrow of `x` occurs here
@@ -9,7 +9,7 @@ LL |     || *y;
    |         - borrow later captured here by closure
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/closure-use-spans.rs:13:5
+  --> $DIR/closure-use-spans.rs:11:5
    |
 LL |     let y = &mut x;
    |             ------ borrow of `x` occurs here
@@ -19,7 +19,7 @@ LL |     || *y = 1;
    |         - borrow later captured here by closure
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/closure-use-spans.rs:19:5
+  --> $DIR/closure-use-spans.rs:17:5
    |
 LL |     let y = &x;
    |             -- borrow of `x` occurs here
index d2afa564734c8b6bdf5c847311c6de366b8abd8d..491c186ecb5a018b54fffd2704f93ead8c5109b9 100644 (file)
@@ -1,8 +1,6 @@
 // Test messages where a closure capture conflicts with itself because it's in
 // a loop.
 
-#![feature(nll)]
-
 fn repreated_move(x: String) {
     for i in 0..10 {
         || x; //~ ERROR
index 692eaea92b83bc6c641e07eedf8c98ce11bc52ef..7603f9650b54a3ab80a1996a46d5f803331c6bab 100644 (file)
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `x`
-  --> $DIR/closures-in-loops.rs:8:9
+  --> $DIR/closures-in-loops.rs:6:9
    |
 LL | fn repreated_move(x: String) {
    |                   - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
@@ -10,7 +10,7 @@ LL |         || x;
    |         value moved into closure here, in previous iteration of loop
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time
-  --> $DIR/closures-in-loops.rs:15:16
+  --> $DIR/closures-in-loops.rs:13:16
    |
 LL |         v.push(|| x = String::new());
    |                ^^ - borrows occur due to use of `x` in closure
@@ -18,7 +18,7 @@ LL |         v.push(|| x = String::new());
    |                mutable borrow starts here in previous iteration of loop
 
 error[E0524]: two closures require unique access to `x` at the same time
-  --> $DIR/closures-in-loops.rs:22:16
+  --> $DIR/closures-in-loops.rs:20:16
    |
 LL |         v.push(|| *x = String::new());
    |                ^^  - borrows occur due to use of `x` in closure
index 4dd01410c5e4db2fd39af58faa29d22ededcaf04..dde0ef7a5bb832fa55c00d8880e155ae0870bb6c 100644 (file)
@@ -1,6 +1,5 @@
 // Regression test for issue #47053
 
-#![feature(nll)]
 #![feature(thread_local)]
 
 #[thread_local]
index 16a6e59e4da3a38a3196f1e24fe7d8f8f14e49cb..8afb42d66a61a511e511b1a7ba5cff29e87b3e10 100644 (file)
@@ -1,5 +1,5 @@
 error[E0594]: cannot assign to immutable static item `FOO`
-  --> $DIR/constant-thread-locals-issue-47053.rs:10:5
+  --> $DIR/constant-thread-locals-issue-47053.rs:9:5
    |
 LL |     FOO = 6;
    |     ^^^^^^^ cannot assign
index 38bdb7dd270f8a3baa9de2ee6ef0072f9f7d178b..f7243294669a62134f356638e1165a45a9978885 100644 (file)
@@ -1,6 +1,5 @@
 // Regression test for #46314
 
-#![feature(nll)]
 #![feature(decl_macro)]
 
 struct NonCopy(String);
index 9232ff52393e134b1ec512e80a11d62b91f5bf99..7948485bd6866d6c5db220769a0b2ea14530addc 100644 (file)
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `wrapper.inner`
-  --> $DIR/decl-macro-illegal-copy.rs:22:9
+  --> $DIR/decl-macro-illegal-copy.rs:21:9
    |
 LL |     $wrapper.inner
    |     -------------- value moved here
diff --git a/src/test/ui/nll/get_default.nll.stderr b/src/test/ui/nll/get_default.nll.stderr
new file mode 100644 (file)
index 0000000..2791230
--- /dev/null
@@ -0,0 +1,48 @@
+error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
+  --> $DIR/get_default.rs:21:17
+   |
+LL | fn ok(map: &mut Map) -> &String {
+   |            - let's call the lifetime of this reference `'1`
+LL |     loop {
+LL |         match map.get() {
+   |               --- immutable borrow occurs here
+LL |             Some(v) => {
+LL |                 return v;
+   |                        - returning this value requires that `*map` is borrowed for `'1`
+...
+LL |                 map.set(String::new()); // Ideally, this would not error.
+   |                 ^^^ mutable borrow occurs here
+
+error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
+  --> $DIR/get_default.rs:32:17
+   |
+LL | fn err(map: &mut Map) -> &String {
+   |             - let's call the lifetime of this reference `'1`
+LL |     loop {
+LL |         match map.get() {
+   |               --- immutable borrow occurs here
+LL |             Some(v) => {
+LL |                 map.set(String::new()); // Both AST and MIR error here
+   |                 ^^^ mutable borrow occurs here
+LL |
+LL |                 return v;
+   |                        - returning this value requires that `*map` is borrowed for `'1`
+
+error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
+  --> $DIR/get_default.rs:37:17
+   |
+LL | fn err(map: &mut Map) -> &String {
+   |             - let's call the lifetime of this reference `'1`
+LL |     loop {
+LL |         match map.get() {
+   |               --- immutable borrow occurs here
+...
+LL |                 return v;
+   |                        - returning this value requires that `*map` is borrowed for `'1`
+...
+LL |                 map.set(String::new()); // Ideally, just AST would error here
+   |                 ^^^ mutable borrow occurs here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
index 881e202acf8d3e72e1d20f5c2b5c37741a06ca38..e75362750645ceb1a3e2899ea6203a86dc4c216e 100644 (file)
@@ -15,7 +15,6 @@
 
 // compile-pass
 
-#![feature(nll)]
 #![feature(box_patterns)]
 
 struct Root {
index f5738968746ee66a5687df782cf751fda6fd3ea7..1fe4fffa324a63617a82590c90e642187ba58606 100644 (file)
@@ -1,6 +1,4 @@
-// (this works, but only in NLL)
 // compile-pass
-#![feature(nll)]
 
 use std::collections::HashMap;
 use std::sync::Mutex;
index 2add951b70bc0a6f867a6d13272dbd50e5aa157c..80a85293e5a5cc165a303ec438bf4f9808d8cf0b 100644 (file)
@@ -1,6 +1,4 @@
-// (this works, but only in NLL)
 // compile-pass
-#![feature(nll)]
 
 fn from_stdin(min: u64) -> Vec<u64> {
     use std::io::BufRead;
index abafd330573ee8b8dba3e5f551e35d0691271b0e..906ea32b9c42d62fe8191c9fd0da05df89faaf59 100644 (file)
@@ -8,8 +8,6 @@
 // meant to compile and run successfully once rust-lang/rust#54987 is
 // implemented.
 
-#![feature(nll)]
-
 struct D {
     x: u32,
     s: S,
index 862432a5bc6af671152e812bc502c7d4087b2161..153d9bdf3215d01b70aa6901dea5aedadcfc19bf 100644 (file)
@@ -1,17 +1,17 @@
 error[E0381]: assign of possibly uninitialized variable: `d`
-  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:30:5
+  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:28:5
    |
 LL |     d.x = 10;
    |     ^^^^^^^^ use of possibly uninitialized `d`
 
 error[E0381]: assign of possibly uninitialized variable: `d`
-  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:36:5
+  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:34:5
    |
 LL |     d.x = 10;
    |     ^^^^^^^^ use of possibly uninitialized `d`
 
 error[E0382]: assign of moved value: `d`
-  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:43:5
+  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:41:5
    |
 LL |     let mut d = D { x: 0, s: S{ y: 0, z: 0 } };
    |         ----- move occurs because `d` has type `D`, which does not implement the `Copy` trait
@@ -21,19 +21,19 @@ LL |     d.x = 10;
    |     ^^^^^^^^ value assigned here after move
 
 error[E0381]: assign to part of possibly uninitialized variable: `d`
-  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:49:5
+  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:47:5
    |
 LL |     d.s.y = 20;
    |     ^^^^^^^^^^ use of possibly uninitialized `d.s`
 
 error[E0381]: assign to part of possibly uninitialized variable: `d`
-  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:55:5
+  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:53:5
    |
 LL |     d.s.y = 20;
    |     ^^^^^^^^^^ use of possibly uninitialized `d.s`
 
 error[E0382]: assign to part of moved value: `d`
-  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:62:5
+  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:60:5
    |
 LL |     let mut d = D { x: 0, s: S{ y: 0, z: 0} };
    |         ----- move occurs because `d` has type `D`, which does not implement the `Copy` trait
index 2c547fb7c7da73786fba5938dc9449ba1c6b7a0e..6357c3ccef1f8d515b45d30a2ed42217e31c2da3 100644 (file)
@@ -3,8 +3,6 @@
 
 // compile-pass
 
-#![feature(nll)]
-
 fn main() {
     let _s = construct().borrow().consume_borrowed();
 }
index 88e49bf8df70d857be1dd993b0d29f469c6be246..27e519005f62b473c49081e7fd9bcd8886f6c036 100644 (file)
@@ -2,8 +2,6 @@
 
 // compile-pass
 
-#![feature(nll)]
-
 use std::ops::{Deref, DerefMut};
 
 fn box_two_field(v: &mut Box<(i32, i32)>) {
index a114d7092ecf97a39010fea0427eb2e7e998e3d3..7e0ffd6cf36449353da44eda8d716969035062dc 100644 (file)
@@ -1,4 +1,3 @@
-#![feature(nll)]
 // compile-pass
 
 // rust-lang/rust#32382: Borrow checker used to complain about
index c5bae7a12d7e7b25597eeaa9f9800185ddc23975..c50473511f1168799d583879347b0c57c62411a1 100644 (file)
@@ -1,7 +1,5 @@
 // compile-pass
 
-#![feature(nll)]
-
 use std::borrow::Cow;
 
 #[derive(Clone, Debug)]
index 690f6f269ebcdb41e143fc321e41970d72d6fb96..8c0c356e967219ac62ab7c41f096d7845ecc1662 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 struct Foo;
 
 impl Foo {
index 7b02b905303f1c46d3772d6d0310f301f1c6a3a9..397909a4366100bb26c0243782091f04cb44522b 100644 (file)
@@ -1,5 +1,5 @@
 error[E0499]: cannot borrow `**other` as mutable more than once at a time
-  --> $DIR/issue-46589.rs:19:21
+  --> $DIR/issue-46589.rs:17:21
    |
 LL |         *other = match (*other).get_self() {
    |                        -------- first mutable borrow occurs here
index 1add2c334dae0786538d5380693c418e9a816fbb..3f8e0f5ad3d7a8859b3030e2bf27689efe481da1 100644 (file)
@@ -1,8 +1,5 @@
 // compile-pass
 
-#![allow(warnings)]
-#![feature(nll)]
-
 struct LoadedObject {
     bodies: Vec<Body>,
     color: Color,
index df47baa3c17f0ad767b9a844772dc7be2bac7823..207af380e62ddd58406a2b6391ada8725c30a968 100644 (file)
@@ -1,4 +1,3 @@
-#![feature(nll)]
 struct FancyNum {
     num: u8,
 }
index a5f5bf6ee2fdd0ab988dd7eb2768902648a272b6..d4064b3f50a341a9056c7509b6f1cb7190c38b4c 100644 (file)
@@ -1,5 +1,5 @@
 error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference
-  --> $DIR/issue-47388.rs:9:5
+  --> $DIR/issue-47388.rs:8:5
    |
 LL |     let fancy_ref = &(&mut fancy);
    |                     ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)`
index 67150b46c359964951268cc928d5f42bf67cf427..72ee7f88650e1b757c48594df8428f9ff28ac1ac 100644 (file)
@@ -2,8 +2,6 @@
 // causing region relations not to be enforced at all the places where
 // they have to be enforced.
 
-#![feature(nll)]
-
 struct Foo<'a>(&'a ());
 trait Bar {
     type Assoc;
index d23cee3fc7c4b69378321a2386125f8c712a5616..0b1247d60ec67ce9658c064e077482e667cf4b84 100644 (file)
@@ -1,5 +1,5 @@
 error[E0515]: cannot return reference to local variable `local`
-  --> $DIR/issue-47470.rs:17:9
+  --> $DIR/issue-47470.rs:15:9
    |
 LL |         &local
    |         ^^^^^^ returns a reference to data owned by the current function
index c69bd3dbe90a5ae6e2d5d6a6fc0df6a1fa8f5afe..47426cdfa57ef7a2745d815b42a5c748084d9c4e 100644 (file)
@@ -1,8 +1,6 @@
 // run-pass
 // revisions: lxl nll
 
-#![cfg_attr(nll, feature(nll))]
-
 struct Foo {
     x: u32
 }
index ececd6fccd84bc75dedc371a24f1e7ca864eff3a..16e29ab2a8ad2f6823d3c8b9ad3a65702b8abdbe 100644 (file)
@@ -1,7 +1,5 @@
 // Regression test for #48697
 
-#![feature(nll)]
-
 fn foo(x: &i32) -> &i32 {
     let z = 4;
     let f = &|y| y;
index 73832fd57879c47073cd6a77743fdb0f36fbc524..f0c29b72b4298c23b5a14726e0bdeaba17d36983 100644 (file)
@@ -1,5 +1,5 @@
 error[E0515]: cannot return value referencing local variable `z`
-  --> $DIR/issue-48697.rs:9:5
+  --> $DIR/issue-48697.rs:7:5
    |
 LL |     let k = f(&z);
    |               -- `z` is borrowed here
index d963a620c9ac76aed0ae71626667dc3eb1210f6a..ec992959a66ca7bb3975426e47bd30fdbd96631c 100644 (file)
@@ -3,12 +3,8 @@
 // bounds derived from `Sized` requirements” that checks that the fixed compiler
 // accepts this code fragment with both AST and MIR borrow checkers.
 //
-// revisions: migrate nll
-//
 // compile-pass
 
-#![cfg_attr(nll, feature(nll))]
-
 struct Qey<Q: ?Sized>(Q);
 
 fn main() {}
diff --git a/src/test/ui/nll/issue-50716.nll.stderr b/src/test/ui/nll/issue-50716.nll.stderr
new file mode 100644 (file)
index 0000000..38dd1b5
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-50716.rs:14:14
+   |
+LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
+   |        -- lifetime `'a` defined here
+...
+LL |     let _x = *s;
+   |              ^^ proving this value is `Sized` requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
index ce4bee366567c50c07560ba8944358895b83ee08..c2fc345fa2ba2e6e13ff41d509055b15fcc4613f 100644 (file)
@@ -2,8 +2,6 @@
 // Regression test for the issue #50716: NLL ignores lifetimes bounds
 // derived from `Sized` requirements
 
-#![feature(nll)]
-
 trait A {
     type X: ?Sized;
 }
index 7e5ffb515011bc6fae78e685230201d84afde469..b19e3a9dfb345604f9a107b444d2d4b10c3432d0 100644 (file)
@@ -1,11 +1,18 @@
-error: lifetime may not live long enough
-  --> $DIR/issue-50716.rs:16:14
+error[E0308]: mismatched types
+  --> $DIR/issue-50716.rs:14:9
    |
-LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
-   |        -- lifetime `'a` defined here
-...
 LL |     let _x = *s;
-   |              ^^ proving this value is `Sized` requires that `'a` must outlive `'static`
+   |         ^^ lifetime mismatch
+   |
+   = note: expected type `std::marker::Sized`
+              found type `std::marker::Sized`
+note: the lifetime 'a as defined on the function body at 9:8...
+  --> $DIR/issue-50716.rs:9:8
+   |
+LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
+   |        ^^
+   = note: ...does not necessarily outlive the static lifetime
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0308`.
index 6704b64869914afd369d7d25b00b11328c80b53f..747bfe3a8a575ae6bcabde2f48e1703afc357d8f 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 struct Struct;
 
 impl Struct {
index e80cd873d5acaf821b0e8bf7961aff150e730c8a..e226de15dc2f0b156013a0be8c77c41e77187015 100644 (file)
@@ -1,5 +1,5 @@
 warning: function cannot return without recursing
-  --> $DIR/issue-51191.rs:6:5
+  --> $DIR/issue-51191.rs:4:5
    |
 LL |     fn bar(self: &mut Self) {
    |     ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
@@ -11,7 +11,7 @@ LL |         (&mut self).bar();
    = help: a `loop` may express intention better if this is on purpose
 
 error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
-  --> $DIR/issue-51191.rs:8:9
+  --> $DIR/issue-51191.rs:6:9
    |
 LL |         (&mut self).bar();
    |         ^^^^^^^^^^^
@@ -20,7 +20,7 @@ LL |         (&mut self).bar();
    |         try removing `&mut` here
 
 error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
-  --> $DIR/issue-51191.rs:13:9
+  --> $DIR/issue-51191.rs:11:9
    |
 LL |     fn imm(self) {
    |            ---- help: consider changing this to be mutable: `mut self`
@@ -28,19 +28,19 @@ LL |         (&mut self).bar();
    |         ^^^^^^^^^^^ cannot borrow as mutable
 
 error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
-  --> $DIR/issue-51191.rs:22:9
+  --> $DIR/issue-51191.rs:20:9
    |
 LL |         (&mut self).bar();
    |         ^^^^^^^^^^^ cannot borrow as mutable
 
 error[E0596]: cannot borrow data in a `&` reference as mutable
-  --> $DIR/issue-51191.rs:22:9
+  --> $DIR/issue-51191.rs:20:9
    |
 LL |         (&mut self).bar();
    |         ^^^^^^^^^^^ cannot borrow as mutable
 
 error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
-  --> $DIR/issue-51191.rs:28:9
+  --> $DIR/issue-51191.rs:26:9
    |
 LL |         (&mut self).bar();
    |         ^^^^^^^^^^^
index aaf98ddfa27775be1a176ea73970118a2a5e3d9c..743415d58afadb3b01e53473bdf25210cf1742c7 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn main() {
     let ref my_ref @ _ = 0;
     *my_ref = 0;
index 6b543389af508bb4f68428fcea6455bb5984fa9b..8a7e71e0326a09540044b5757c38e898eae1cb3a 100644 (file)
@@ -1,5 +1,5 @@
 error[E0594]: cannot assign to `*my_ref` which is behind a `&` reference
-  --> $DIR/issue-51244.rs:5:5
+  --> $DIR/issue-51244.rs:3:5
    |
 LL |     let ref my_ref @ _ = 0;
    |         -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _`
index c14146a3de2a1d0b5864de21aa463d0add02e228..12d0449abb19be4c1bc7755ab3f20b859f481215 100644 (file)
@@ -1,7 +1,5 @@
 // ignore-tidy-linelength
 
-#![feature(nll)]
-
 struct Bar;
 
 impl Bar {
index 0be181745fde208c4ade7de5bbf3f9ce78d66a1d..420c94f8e1bd292b1f6806719aa475c5825eabe4 100644 (file)
@@ -1,5 +1,5 @@
 error[E0502]: cannot borrow `self.thing` as mutable because it is also borrowed as immutable
-  --> $DIR/issue-51268.rs:18:9
+  --> $DIR/issue-51268.rs:16:9
    |
 LL |           self.thing.bar(|| {
    |           ^          --- -- immutable borrow occurs here
index 939993f154f8f8be0453ccbb7bca942947724236..b45477c7fb10deb96bda96da36d6a3c41c7082bd 100644 (file)
@@ -8,8 +8,6 @@
 //
 // compile-pass
 
-#![feature(nll)]
-
 fn creash<'a>() {
     let x: &'a () = &();
 }
index 7e2e6e0a16cc0c836a52d4412d014d88f0751adf..691760eb91e52fb12816cf537af927283752867e 100644 (file)
@@ -1,6 +1,3 @@
-#![allow(warnings)]
-#![feature(nll)]
-
 fn main() {
     let range = 0..1;
     let r = range;
index a84a236ca77722995b7c5760985dc6f51d0d1236..e591ca08290ebf74a7c8e2689009e463b2306bcf 100644 (file)
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `range`
-  --> $DIR/issue-51512.rs:7:13
+  --> $DIR/issue-51512.rs:4:13
    |
 LL |     let range = 0..1;
    |         ----- move occurs because `range` has type `std::ops::Range<i32>`, which does not implement the `Copy` trait
index eaa809d2b37069da325023851cbc788138b237aa..58416c31edde75d92e67597dead873540270d83c 100644 (file)
@@ -4,7 +4,6 @@
 // of the fact that the type implements Drop.
 
 #![feature(nll)]
-#![allow(dead_code)]
 
 pub struct S<'a> { url: &'a mut String }
 
index e8741036e1d938dd51468c0c46916dad33c1c898..34259d06d38363e43ff342595f8956e65d5974b4 100644 (file)
@@ -1,5 +1,5 @@
 error[E0713]: borrow may still be in use when destructor runs
-  --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:14:5
+  --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:13:5
    |
 LL | fn finish_1(s: S) -> &mut String {
    |             - has type `S<'1>`
@@ -9,7 +9,7 @@ LL | }
    | - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait
 
 error[E0713]: borrow may still be in use when destructor runs
-  --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:19:13
+  --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:18:13
    |
 LL | fn finish_2(s: S) -> &mut String {
    |             - has type `S<'1>`
@@ -19,7 +19,7 @@ LL | }
    | - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait
 
 error[E0713]: borrow may still be in use when destructor runs
-  --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:24:21
+  --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:23:21
    |
 LL | fn finish_3(s: S) -> &mut String {
    |             - has type `S<'1>`
@@ -29,7 +29,7 @@ LL | }
    | - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait
 
 error[E0509]: cannot move out of type `S<'_>`, which implements the `Drop` trait
-  --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:29:13
+  --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:28:13
    |
 LL |     let p = s.url; p
    |             ^^^^^
index ebe442adbd945f1a88968849467553ac8ddfd67c..4b8e6c680753083bbed11e36234a7fe983e101fe 100644 (file)
@@ -1,6 +1,3 @@
-#![feature(nll)]
-#![allow(unused_variables)]
-
 // Regression test for #52078: we were failing to infer a relationship
 // between `'a` and `'b` below due to inference variables introduced
 // during the normalization process.
index 78765283ec29e786c9f3d962248ca3e2729847fe..0414428e48150ca498a9baca8a23e96823ecebb0 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 use std::rc::Rc;
 use std::sync::Arc;
 
index ed4171ff14261e4356de2ff27a5a91bc73f2c205..da453fb1f921fb69bd70a036ae0d934148b3b4ee 100644 (file)
@@ -1,11 +1,11 @@
 error[E0507]: cannot move out of an `Rc`
-  --> $DIR/issue-52086.rs:10:10
+  --> $DIR/issue-52086.rs:8:10
    |
 LL |     drop(x.field);
    |          ^^^^^^^ cannot move out of an `Rc`
 
 error[E0507]: cannot move out of an `Arc`
-  --> $DIR/issue-52086.rs:14:10
+  --> $DIR/issue-52086.rs:12:10
    |
 LL |     drop(y.field);
    |          ^^^^^^^ cannot move out of an `Arc`
index 795f4f426ffffedc82c3fac7b762471f32a710fc..0d7ee0376924dc618028d5db3d1b02375ce180cd 100644 (file)
@@ -1,6 +1,3 @@
-//
-
-#![allow(warnings)]
 #![feature(nll)]
 
 trait Bazinga {}
index 8638fe2576980f34d9329a341faffff043b9aa3b..590963ded78bcfeb5eaca7206a0153c7c4314844 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/issue-52113.rs:37:5
+  --> $DIR/issue-52113.rs:34:5
    |
 LL | fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b {
    |                --  -- lifetime `'b` defined here
index 7ab3593c89f7efd7d1d8a808b4802b7f6b644368..d9ea3ae42c49e8004ef780bbc9bbc26af80d36d9 100644 (file)
@@ -1,6 +1,3 @@
-#![feature(nll)]
-#![allow(warnings)]
-
 struct Test;
 
 impl Test {
index 7d82f5e710fb17e41644c43f52bbb34eea3ef8b4..743179f05c1afb7c0c4f9cb1ec4d66309620c143 100644 (file)
@@ -1,17 +1,17 @@
 error[E0515]: cannot return reference to local variable `x`
-  --> $DIR/issue-52534-1.rs:9:9
+  --> $DIR/issue-52534-1.rs:6:9
    |
 LL |         &x
    |         ^^ returns a reference to data owned by the current function
 
 error[E0515]: cannot return reference to local variable `x`
-  --> $DIR/issue-52534-1.rs:16:5
+  --> $DIR/issue-52534-1.rs:13:5
    |
 LL |     &x
    |     ^^ returns a reference to data owned by the current function
 
 error[E0515]: cannot return value referencing local variable `x`
-  --> $DIR/issue-52534-1.rs:22:5
+  --> $DIR/issue-52534-1.rs:19:5
    |
 LL |     &&x
    |     ^--
@@ -20,7 +20,7 @@ LL |     &&x
    |     returns a value referencing data owned by the current function
 
 error[E0515]: cannot return reference to temporary value
-  --> $DIR/issue-52534-1.rs:22:5
+  --> $DIR/issue-52534-1.rs:19:5
    |
 LL |     &&x
    |     ^--
@@ -29,25 +29,25 @@ LL |     &&x
    |     returns a reference to data owned by the current function
 
 error[E0515]: cannot return reference to local variable `x`
-  --> $DIR/issue-52534-1.rs:29:5
+  --> $DIR/issue-52534-1.rs:26:5
    |
 LL |     &x
    |     ^^ returns a reference to data owned by the current function
 
 error[E0515]: cannot return reference to local variable `x`
-  --> $DIR/issue-52534-1.rs:35:5
+  --> $DIR/issue-52534-1.rs:32:5
    |
 LL |     &x
    |     ^^ returns a reference to data owned by the current function
 
 error[E0515]: cannot return reference to local variable `x`
-  --> $DIR/issue-52534-1.rs:41:5
+  --> $DIR/issue-52534-1.rs:38:5
    |
 LL |     &x
    |     ^^ returns a reference to data owned by the current function
 
 error[E0515]: cannot return reference to local variable `x`
-  --> $DIR/issue-52534-1.rs:47:5
+  --> $DIR/issue-52534-1.rs:44:5
    |
 LL |     &x
    |     ^^ returns a reference to data owned by the current function
index 6e84869dd6d3b00a9d2cb6678aed0222116fdd62..e416264ed09fd889f2a937d4353fc97c5c0fa094 100644 (file)
@@ -1,6 +1,3 @@
-#![feature(nll)]
-#![allow(warnings)]
-
 fn foo(x: &u32) -> &u32 {
     let y;
 
index f98deaea7183e8e95db10881a5c5ab88899bec94..dd8a87f7e29aa8e152d72efbacc4d327c4553eae 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/issue-52534-2.rs:9:9
+  --> $DIR/issue-52534-2.rs:6:9
    |
 LL |         y = &x
    |         ^^^^^^ borrowed value does not live long enough
index 1394560df19ba295fbdfb6f15fb1c9cd6d5ad579..559d4c8591b34ece8a48031f9e98db5a202939de 100644 (file)
@@ -1,6 +1,3 @@
-#![feature(nll)]
-#![allow(warnings)]
-
 fn foo(_: impl FnOnce(&u32) -> &u32) {
 }
 
index 9ac79eda1614ccedff73396e849ad5f2aa05fea7..b2b727fd438935f0c80be656aa1d9149b54b23ae 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/issue-52534.rs:12:14
+  --> $DIR/issue-52534.rs:9:14
    |
 LL |     foo(|a| &x)
    |          -   ^ `x` would have to be valid for `'0`...
@@ -13,7 +13,7 @@ LL | }
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#dangling-references>
 
 error[E0597]: `y` does not live long enough
-  --> $DIR/issue-52534.rs:18:26
+  --> $DIR/issue-52534.rs:15:26
    |
 LL |     baz(|first, second| &y)
    |          -----           ^ `y` would have to be valid for `'0`...
index 3e57d26745a95550b73d87b74dfb8f67cd51db00..24a4267f653f47b86ea4b69777251bb6f4f15353 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn expect_fn<F>(f: F) where F : Fn() {
     f();
 }
index 0162c6bcbd1ecc9b17158d6f39c0826fb44a0d56..8958bdf4c2a8d7779e3a819c6678e8348a98e948 100644 (file)
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/issue-52663-span-decl-captured-variable.rs:10:26
+  --> $DIR/issue-52663-span-decl-captured-variable.rs:8:26
    |
 LL |        let x = (vec![22], vec![44]);
    |            - captured outer variable
index 121c3ef4e610981e2d9a9ac8653419b4d0e7a9b0..e8e571aadc3680de679abe85fe1dc0319fd81427 100644 (file)
@@ -1,5 +1,4 @@
 #![feature(box_syntax)]
-#![feature(nll)]
 
 trait Foo { fn get(&self); }
 
index b9437d88ff6742bcda7475662e1b575a35a02939..9262117f397553efdae9e8d3539dcc52fd5fecff 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `tmp0` does not live long enough
-  --> $DIR/issue-52663-trait-object.rs:13:20
+  --> $DIR/issue-52663-trait-object.rs:12:20
    |
 LL |         let tmp1 = &tmp0;
    |                    ^^^^^ borrowed value does not live long enough
index 6027e988141280c46c64692ceabf713e82926c1c..e33528ac59e68293b8110f65dd93795be2357eee 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 struct A {
     b: B,
 }
index f51768c3859e4f3244ed795bdb74e56f9153d309..db53e444b9e4a60dca5232390e5fad4fc2c9f309 100644 (file)
@@ -1,5 +1,5 @@
 error[E0382]: borrow of moved value: `a.b`
-  --> $DIR/issue-52669.rs:15:5
+  --> $DIR/issue-52669.rs:13:5
    |
 LL | fn bar(mut a: A) -> B {
    |        ----- move occurs because `a` has type `A`, which does not implement the `Copy` trait
diff --git a/src/test/ui/nll/issue-52742.nll.stderr b/src/test/ui/nll/issue-52742.nll.stderr
new file mode 100644 (file)
index 0000000..e8b7b33
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-52742.rs:14:9
+   |
+LL |     fn take_bar(&mut self, b: Bar<'_>) {
+   |                 ---------         -- let's call this `'1`
+   |                 |
+   |                 has type `&mut Foo<'_, '2>`
+LL |         self.y = b.z
+   |         ^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
index 150e67fe094818eecfe00c02a1115de7aeafe340..db9ddfff285b3c23776dcceba9fb5a5652ee4b45 100644 (file)
@@ -1,4 +1,3 @@
-#![feature(nll)]
 #![feature(in_band_lifetimes)]
 
 struct Foo<'a, 'b> {
@@ -13,7 +12,7 @@ struct Bar<'b> {
 impl Foo<'_, '_> {
     fn take_bar(&mut self, b: Bar<'_>) {
         self.y = b.z
-        //~^ ERROR lifetime may not live long enough
+        //~^ ERROR
     }
 }
 
index 6b25296c4bda1588d0e30793ad9d672a903629d8..b982915800294ab0ddf41009cbce354d0aac4ad8 100644 (file)
@@ -1,12 +1,22 @@
-error: lifetime may not live long enough
-  --> $DIR/issue-52742.rs:15:9
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/issue-52742.rs:14:18
    |
-LL |     fn take_bar(&mut self, b: Bar<'_>) {
-   |                 ---------         -- let's call this `'1`
-   |                 |
-   |                 has type `&mut Foo<'_, '2>`
 LL |         self.y = b.z
-   |         ^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+   |                  ^^^
+   |
+note: ...the reference is valid for the lifetime '_ as defined on the impl at 12:10...
+  --> $DIR/issue-52742.rs:12:10
+   |
+LL | impl Foo<'_, '_> {
+   |          ^^
+note: ...but the borrowed content is only valid for the anonymous lifetime #2 defined on the method body at 13:5
+  --> $DIR/issue-52742.rs:13:5
+   |
+LL | /     fn take_bar(&mut self, b: Bar<'_>) {
+LL | |         self.y = b.z
+LL | |
+LL | |     }
+   | |_____^
 
 error: aborting due to previous error
 
index 97e05c8810d09bee86902c71c73c7d134bedc9d7..7a47a77f6bb4ccb24dce60261dd8aa0674d01038 100644 (file)
@@ -1,7 +1,5 @@
 // compile-pass
 
-#![feature(nll)]
-
 use std::ops::Deref;
 
 pub struct TypeFieldIterator<'a, T: 'a> {
index d0baffa2702c3ccd71dddb1f33036e4c5429a431..cea458dcb65b92460b2ece1f38f46d9728a87600 100644 (file)
@@ -8,10 +8,6 @@
 //
 // compile-pass
 
-#![feature(nll)]
-#![feature(rustc_attrs)]
-#![allow(dead_code)]
-
 use std::cell::{RefCell, Ref};
 
 trait AnyVec<'a> {
index 9b3eb7f05ded4467965b36602cc0df1d71a4efd9..c7b6ac592483799312a704220611925a55414554 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // run-pass
 
 struct Slice(&'static [&'static [u8]]);
index b900acfa1599ef7d078ef8ef8f91724c92ec7790..521d4d33d8633f8a5a68ebbb9cc7e2578ab17d72 100644 (file)
@@ -1,7 +1,5 @@
 // compile-pass
 
-#![feature(nll)]
-#![allow(unreachable_code)]
 #![deny(unused_mut)]
 
 pub fn foo() {
diff --git a/src/test/ui/nll/issue-55394.nll.stderr b/src/test/ui/nll/issue-55394.nll.stderr
new file mode 100644 (file)
index 0000000..d072304
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-55394.rs:9:9
+   |
+LL |     fn new(bar: &mut Bar) -> Self {
+   |                 -            ---- return type is Foo<'2>
+   |                 |
+   |                 let's call the lifetime of this reference `'1`
+LL |         Foo { bar }
+   |         ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
index deb1034525edb6622bb754018c849764ef4db19d..f813d1c915cf62fe97d6dbb68175844f4cbf1117 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 struct Bar;
 
 struct Foo<'s> {
@@ -8,7 +6,7 @@ struct Foo<'s> {
 
 impl Foo<'_> {
     fn new(bar: &mut Bar) -> Self {
-        Foo { bar } //~ERROR lifetime may not live long enough
+        Foo { bar } //~ERROR
     }
 }
 
index e9a70fd6b161741f99365171ad913388c307c4d9..ffb94ed7dd7c0eab3ee8a3bbe82708c546aacdaa 100644 (file)
@@ -1,12 +1,29 @@
-error: lifetime may not live long enough
-  --> $DIR/issue-55394.rs:11:9
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` due to conflicting requirements
+  --> $DIR/issue-55394.rs:9:9
    |
-LL |     fn new(bar: &mut Bar) -> Self {
-   |                 -            ---- return type is Foo<'2>
-   |                 |
-   |                 let's call the lifetime of this reference `'1`
 LL |         Foo { bar }
-   |         ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
+   |         ^^^
+   |
+note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 8:5...
+  --> $DIR/issue-55394.rs:8:5
+   |
+LL | /     fn new(bar: &mut Bar) -> Self {
+LL | |         Foo { bar }
+LL | |     }
+   | |_____^
+note: ...so that reference does not outlive borrowed content
+  --> $DIR/issue-55394.rs:9:15
+   |
+LL |         Foo { bar }
+   |               ^^^
+note: but, the lifetime must be valid for the lifetime '_ as defined on the impl at 7:10...
+  --> $DIR/issue-55394.rs:7:10
+   |
+LL | impl Foo<'_> {
+   |          ^^
+   = note: ...so that the expression is assignable:
+           expected Foo<'_>
+              found Foo<'_>
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/issue-55401.nll.stderr b/src/test/ui/nll/issue-55401.nll.stderr
new file mode 100644 (file)
index 0000000..4f797f2
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-55401.rs:3:5
+   |
+LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
+   |                                               -- lifetime `'a` defined here
+LL |     let (ref y, _z): (&'a u32, u32) = (&22, 44);
+LL |     *y
+   |     ^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
index 2fa234491087d679d10cfe68653575753d3ea00d..fc45824e903c8134a237003e02596c1c77777fb4 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
     let (ref y, _z): (&'a u32, u32) = (&22, 44);
     *y //~ ERROR
index 622bc5a3f34113dad5bcdab15e39633fa61e1fb7..50debc6386f6add1b7b497d9e2a8ce931e112e42 100644 (file)
@@ -1,11 +1,15 @@
-error: lifetime may not live long enough
-  --> $DIR/issue-55401.rs:5:5
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/issue-55401.rs:3:5
    |
-LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
-   |                                               -- lifetime `'a` defined here
-LL |     let (ref y, _z): (&'a u32, u32) = (&22, 44);
 LL |     *y
-   |     ^^ returning this value requires that `'a` must outlive `'static`
+   |     ^^
+   |
+   = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 1:47
+  --> $DIR/issue-55401.rs:1:47
+   |
+LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
+   |                                               ^^
 
 error: aborting due to previous error
 
index 24c61a4926f0c13fc6b53f727953542e3aeed959..8fb8351cee26032d532ed773f18db9caaa616f2b 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 use std::any::Any;
 
 #[derive(Debug, Clone)]
index db01212597f5bfe0b7e4849c2110c8f0b8dbdd00..20add62b91ddf19268958d33985f06cb506673c1 100644 (file)
@@ -1,5 +1,5 @@
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/issue-57265-return-type-wf-check.rs:22:23
+  --> $DIR/issue-57265-return-type-wf-check.rs:20:23
    |
 LL |     let (_, z) = foo(&"hello".to_string());
    |                  -----^^^^^^^^^^^^^^^^^^^-- temporary value is freed at the end of this statement
index 356c477f1ba36f0ef97994fddc91203b83762447..e02d6a0cb5a3957bed3a62507555cc11f08c8588 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // compile-pass
 
 trait Foo<'a> {
index 4fe6a96f5dcc811e70bbffc94fccee51c75ab385..776a0d359cda6f163a6b308eef7ccc63d3894800 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // compile-pass
 
 trait Foo {
index 4f21cca97cc093160a60f8fe5fd5a6e8c3aaec57..c410f0b0bfb4da6fd4d8b73d1ec5298cf5666c8a 100644 (file)
@@ -1,7 +1,5 @@
 // Test for ICE from issue 57989
 
-#![feature(nll)]
-
 fn f(x: &i32) {
     let g = &x;
     *x = 0;     //~ ERROR cannot assign to `*x` which is behind a `&` reference
index 7367dc095a31abcde8727f4eae1d671f8d3b6dc0..00a9bab486855a62c61372d58ed2d1b6fa69bbd7 100644 (file)
@@ -1,5 +1,5 @@
 error[E0594]: cannot assign to `*x` which is behind a `&` reference
-  --> $DIR/issue-57989.rs:7:5
+  --> $DIR/issue-57989.rs:5:5
    |
 LL | fn f(x: &i32) {
    |         ---- help: consider changing this to be a mutable reference: `&mut i32`
@@ -8,7 +8,7 @@ LL |     *x = 0;
    |     ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
 
 error[E0506]: cannot assign to `*x` because it is borrowed
-  --> $DIR/issue-57989.rs:7:5
+  --> $DIR/issue-57989.rs:5:5
    |
 LL |     let g = &x;
    |             -- borrow of `*x` occurs here
index d4338905ed2df6ee2fdc6c07d858a06d96bebecf..0992e3a85ae94964023d9e2db4037b77640ee64b 100644 (file)
@@ -1,4 +1,3 @@
-#![allow(warnings)]
 #![feature(nll)]
 
 fn main() {
index 9048983318b361a97f5c76f5b1587b388828a419..297681ff4038af97a0a1c2c92f6358ca84f2b5ea 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/issue-58053.rs:7:33
+  --> $DIR/issue-58053.rs:6:33
    |
 LL |     let f = |x: &i32| -> &i32 { x };
    |                 -        ----   ^ returning this value requires that `'1` must outlive `'2`
@@ -8,7 +8,7 @@ LL |     let f = |x: &i32| -> &i32 { x };
    |                 let's call the lifetime of this reference `'1`
 
 error: lifetime may not live long enough
-  --> $DIR/issue-58053.rs:11:25
+  --> $DIR/issue-58053.rs:10:25
    |
 LL |     let g = |x: &i32| { x };
    |                 -   -   ^ returning this value requires that `'1` must outlive `'2`
index 9267cac5dd3d75c559ee6d3c8beb45ce15259452..3277a9db8ec466c2a0b84f81faf5ea11a51d3c10 100644 (file)
@@ -1,4 +1,3 @@
-#![allow(dead_code)]
 #![feature(nll)]
 
 struct A<'a>(&'a ());
index 0c69b70a97c77565692331939d0a14a64cb5d796..aba07542d026e826b2d8589e14cc306cad81b1a8 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/issue-58299.rs:17:9
+  --> $DIR/issue-58299.rs:16:9
    |
 LL | fn foo<'a>(x: i32) {
    |        -- lifetime `'a` defined here
@@ -8,7 +8,7 @@ LL |         A::<'a>::X..=A::<'static>::X => (),
    |         ^^^^^^^^^^ requires that `'a` must outlive `'static`
 
 error: lifetime may not live long enough
-  --> $DIR/issue-58299.rs:25:27
+  --> $DIR/issue-58299.rs:24:27
    |
 LL | fn bar<'a>(x: i32) {
    |        -- lifetime `'a` defined here
index 5b609820a237feb320ed498639cb7d100afa777f..1de32ddf531c82ecb1198738b526655fb972b564 100644 (file)
@@ -1,6 +1,3 @@
-#![allow(warnings)]
-#![feature(nll)]
-
 struct Wrap<'p> { p: &'p mut i32 }
 
 impl<'p> Drop for Wrap<'p> {
index e7755bdb89ccf869d986e5bf994d91049670cece..80e297807465d6bcde327a5c75f777a1fb56166c 100644 (file)
@@ -1,5 +1,5 @@
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/maybe-initialized-drop-implicit-fragment-drop.rs:20:5
+  --> $DIR/maybe-initialized-drop-implicit-fragment-drop.rs:17:5
    |
 LL |     let wrap = Wrap { p: &mut x };
    |                          ------ borrow of `x` occurs here
index a34163737096c292d937d67a32eba496aade1f17..e0fcd6250322dc4b63011c2e7ff85dd1ff62c53a 100644 (file)
@@ -1,6 +1,3 @@
-#![allow(unused)]
-#![feature(nll)]
-
 struct A(String);
 struct C(D);
 
index bb30da034af56c8a677543a75f32952462af132b..a4af11e3d40f7368aa4c01135833fd9a73bd7ef5 100644 (file)
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/move-errors.rs:9:13
+  --> $DIR/move-errors.rs:6:13
    |
 LL |     let b = *a;
    |             ^^
@@ -8,7 +8,7 @@ LL |     let b = *a;
    |             help: consider removing the `*`: `a`
 
 error[E0508]: cannot move out of type `[A; 1]`, a non-copy array
-  --> $DIR/move-errors.rs:15:13
+  --> $DIR/move-errors.rs:12:13
    |
 LL |     let b = a[0];
    |             ^^^^
@@ -17,7 +17,7 @@ LL |     let b = a[0];
    |             help: consider borrowing here: `&a[0]`
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/move-errors.rs:22:13
+  --> $DIR/move-errors.rs:19:13
    |
 LL |     let s = **r;
    |             ^^^
@@ -26,7 +26,7 @@ LL |     let s = **r;
    |             help: consider removing the `*`: `*r`
 
 error[E0507]: cannot move out of an `Rc`
-  --> $DIR/move-errors.rs:30:13
+  --> $DIR/move-errors.rs:27:13
    |
 LL |     let s = *r;
    |             ^^
@@ -35,7 +35,7 @@ LL |     let s = *r;
    |             help: consider removing the `*`: `r`
 
 error[E0508]: cannot move out of type `[A; 1]`, a non-copy array
-  --> $DIR/move-errors.rs:35:13
+  --> $DIR/move-errors.rs:32:13
    |
 LL |     let a = [A("".to_string())][0];
    |             ^^^^^^^^^^^^^^^^^^^^^^
@@ -44,7 +44,7 @@ LL |     let a = [A("".to_string())][0];
    |             help: consider borrowing here: `&[A("".to_string())][0]`
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/move-errors.rs:41:16
+  --> $DIR/move-errors.rs:38:16
    |
 LL |     let A(s) = *a;
    |           -    ^^
@@ -54,13 +54,13 @@ LL |     let A(s) = *a;
    |           data moved here
    |
 note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
-  --> $DIR/move-errors.rs:41:11
+  --> $DIR/move-errors.rs:38:11
    |
 LL |     let A(s) = *a;
    |           ^
 
 error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
-  --> $DIR/move-errors.rs:47:19
+  --> $DIR/move-errors.rs:44:19
    |
 LL |     let C(D(s)) = c;
    |             -     ^ cannot move out of here
@@ -68,19 +68,19 @@ LL |     let C(D(s)) = c;
    |             data moved here
    |
 note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
-  --> $DIR/move-errors.rs:47:13
+  --> $DIR/move-errors.rs:44:13
    |
 LL |     let C(D(s)) = c;
    |             ^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/move-errors.rs:54:9
+  --> $DIR/move-errors.rs:51:9
    |
 LL |     b = *a;
    |         ^^ cannot move out of borrowed content
 
 error[E0508]: cannot move out of type `[B; 1]`, a non-copy array
-  --> $DIR/move-errors.rs:77:11
+  --> $DIR/move-errors.rs:74:11
    |
 LL |     match x[0] {
    |           ^^^^
@@ -94,7 +94,7 @@ LL |         B::V(s) => (),
    |              - ...and here
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/move-errors.rs:79:14
+  --> $DIR/move-errors.rs:76:14
    |
 LL |         B::U(d) => (),
    |              ^
@@ -102,7 +102,7 @@ LL |         B::V(s) => (),
    |              ^
 
 error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
-  --> $DIR/move-errors.rs:86:11
+  --> $DIR/move-errors.rs:83:11
    |
 LL |     match x {
    |           ^ cannot move out of here
@@ -111,13 +111,13 @@ LL |         B::U(D(s)) => (),
    |                - data moved here
    |
 note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
-  --> $DIR/move-errors.rs:89:16
+  --> $DIR/move-errors.rs:86:16
    |
 LL |         B::U(D(s)) => (),
    |                ^
 
 error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
-  --> $DIR/move-errors.rs:95:11
+  --> $DIR/move-errors.rs:92:11
    |
 LL |     match x {
    |           ^ cannot move out of here
@@ -126,13 +126,13 @@ LL |         (D(s), &t) => (),
    |            - data moved here
    |
 note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
-  --> $DIR/move-errors.rs:98:12
+  --> $DIR/move-errors.rs:95:12
    |
 LL |         (D(s), &t) => (),
    |            ^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/move-errors.rs:95:11
+  --> $DIR/move-errors.rs:92:11
    |
 LL |     match x {
    |           ^ cannot move out of borrowed content
@@ -141,13 +141,13 @@ LL |         (D(s), &t) => (),
    |                 - data moved here
    |
 note: move occurs because `t` has type `std::string::String`, which does not implement the `Copy` trait
-  --> $DIR/move-errors.rs:98:17
+  --> $DIR/move-errors.rs:95:17
    |
 LL |         (D(s), &t) => (),
    |                 ^
 
 error[E0509]: cannot move out of type `F`, which implements the `Drop` trait
-  --> $DIR/move-errors.rs:105:11
+  --> $DIR/move-errors.rs:102:11
    |
 LL |     match x {
    |           ^ cannot move out of here
@@ -158,13 +158,13 @@ LL |         F(s, mut t) => (),
    |           data moved here
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/move-errors.rs:107:11
+  --> $DIR/move-errors.rs:104:11
    |
 LL |         F(s, mut t) => (),
    |           ^  ^^^^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/move-errors.rs:113:11
+  --> $DIR/move-errors.rs:110:11
    |
 LL |     match *x {
    |           ^^
@@ -176,7 +176,7 @@ LL |         Ok(s) | Err(s) => (),
    |            - data moved here
    |
 note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
-  --> $DIR/move-errors.rs:115:12
+  --> $DIR/move-errors.rs:112:12
    |
 LL |         Ok(s) | Err(s) => (),
    |            ^
index 72a36ef22dff749b31f344c58ae8c6fe1a20111d..e7caf89e78391d2b50eec6e068edd5afbe67764e 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn main() {
     let x = (vec![1, 2, 3], );
     drop(x.0);
index bdbc25e9ee3d4fbafaeef523dcdbb2606af85d35..7030d5b3305f1181990d13e7b20844d6deabcf1d 100644 (file)
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `x`
-  --> $DIR/move-subpaths-moves-root.rs:6:10
+  --> $DIR/move-subpaths-moves-root.rs:4:10
    |
 LL |     drop(x.0);
    |          --- value moved here
index d6610e158236c3afcfd85db176695a09573c12d3..b6cfcd98732b458d9b77c85c7ec4570b2fd93ee2 100644 (file)
@@ -1,7 +1,6 @@
 // Check that we error when a bound from the impl is not satisfied when
 // normalizing an associated type.
 
-#![feature(nll)]
 trait Visitor<'d> {
     type Value;
 }
index 8ee00168661bd76cb94ff68f891371d70214e865..951e73e7fd76555659eb5261b618e7493a626f2a 100644 (file)
@@ -1,16 +1,16 @@
 error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'d` due to conflicting requirements
-  --> $DIR/normalization-bounds-error.rs:13:1
+  --> $DIR/normalization-bounds-error.rs:12:1
    |
 LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-note: first, the lifetime cannot outlive the lifetime 'd as defined on the function body at 13:14...
-  --> $DIR/normalization-bounds-error.rs:13:14
+note: first, the lifetime cannot outlive the lifetime 'd as defined on the function body at 12:14...
+  --> $DIR/normalization-bounds-error.rs:12:14
    |
 LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
    |              ^^
-note: ...but the lifetime must also be valid for the lifetime 'a as defined on the function body at 13:18...
-  --> $DIR/normalization-bounds-error.rs:13:18
+note: ...but the lifetime must also be valid for the lifetime 'a as defined on the function body at 12:18...
+  --> $DIR/normalization-bounds-error.rs:12:18
    |
 LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
    |                  ^^
index ebc19d7cc83506a0f55c7434deba53b59c74260b..5d2825ef2d670cd65ad1a137a9d19e9996e94a65 100644 (file)
@@ -2,7 +2,6 @@
 
 //run-pass
 
-#![feature(nll)]
 trait Visitor<'d> {
     type Value;
 }
index 061d0d69d099ecb1f49ea071cf41d62096c2f538..6d5bdfa4da2f06bc1afd55e9b2f261e19bf6d9a4 100644 (file)
@@ -3,8 +3,6 @@
 
 // run-pass
 
-#![feature(nll)]
-
 pub fn main() {
     let mut x: Vec<&[i32; 0]> = Vec::new();
     for i in 0..10 {
index 59b21cf9ac2a9c9cab61ebf11351e0077e3932e8..5f95ae13c58af0f07c4465a7cb0e4f85db279bf0 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 fn shorten_lifetime<'a, 'b, 'min>(a: &'a i32, b: &'b i32) -> &'min i32
 where
     'a: 'min,
index de185cc0d294786d04346f6862c8f3aa095e3f33..df347f4e7f0fec3642272b4b763da71a8da138f2 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `l` does not live long enough
-  --> $DIR/promoted-bounds.rs:21:17
+  --> $DIR/promoted-bounds.rs:19:17
    |
 LL |     let ptr = {
    |         --- borrow later stored here
index 7b3bbad4c1e0c5e8113e72f9afdf3436228851a5..cc9f17fd4e6bc0ae60fb6eff90f6136997cc3422 100644 (file)
@@ -1,7 +1,5 @@
 // Check that we handle multiple closures in the same promoted constant.
 
-#![feature(nll)]
-
 fn foo() -> &'static i32 {
     let z = 0;
     let p = &(|y| y, |y| y);
index b04d1a9ccba7fc7889fbeb895f2de39d65904c29..000bdf85804d8eb970f0e62d67d864b46ff42fbc 100644 (file)
@@ -1,5 +1,5 @@
 error[E0515]: cannot return value referencing local variable `z`
-  --> $DIR/promoted-closure-pair.rs:9:5
+  --> $DIR/promoted-closure-pair.rs:7:5
    |
 LL |     p.1(&z)
    |     ^^^^--^
diff --git a/src/test/ui/nll/region-ends-after-if-condition.nll.stderr b/src/test/ui/nll/region-ends-after-if-condition.nll.stderr
new file mode 100644 (file)
index 0000000..3229309
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable
+  --> $DIR/region-ends-after-if-condition.rs:26:9
+   |
+LL |     let value = &my_struct.field;
+   |                 ---------------- immutable borrow occurs here
+LL |     if value.is_empty() {
+LL |         my_struct.field.push_str("Hello, world!");
+   |         ^^^^^^^^^^^^^^^ mutable borrow occurs here
+...
+LL |     drop(value);
+   |          ----- immutable borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
index 9b8ac167466f7eb5d360e0f5b6a381469c438c18..72987629848c88b873e004acebf6fc25e1bb8d48 100644 (file)
@@ -6,10 +6,6 @@
 //
 // compile-pass
 
-#![allow(warnings)]
-#![feature(dyn_trait)]
-#![feature(nll)]
-
 trait Foo {
     fn foo(&self) { }
 }
index 2f227c872598ffb47f261105226c9e3f09252ed4..77129f4468f047a3f89be10302a52bfa42c838e1 100644 (file)
@@ -2,9 +2,6 @@
 // function returning always its first argument can be upcast to one
 // that returns either first or second argument.
 
-#![feature(nll)]
-#![allow(warnings)]
-
 use std::cell::Cell;
 
 type DoubleCell<A> = Cell<(A, A)>;
index 7c078d226dc0cdfe1ff868cfc2609f2ba8b96873..d032ce6f2132ce21f97cbc1e8bce1a05a4a9a06e 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `b` does not live long enough
-  --> $DIR/var-appears-twice.rs:23:38
+  --> $DIR/var-appears-twice.rs:20:38
    |
 LL |     let x: DoubleCell<_> = make_cell(&b);
    |            -------------             ^^ borrowed value does not live long enough
index b535ab1f5e13952a390d1e4cc5c874be2c917cfc..dca61d39dfe813e2e22f3a9a56e50eac5aa32cc8 100644 (file)
@@ -1,8 +1,5 @@
 // Regression test for issue #46557
 
-#![feature(nll)]
-#![allow(dead_code)]
-
 fn gimme_static_mut() -> &'static mut u32 {
     let ref mut x = 1234543;
     x //~ ERROR cannot return value referencing temporary value [E0515]
index cc201136ff212d61db9969a03ba14878220c4ed1..720440a0ae5f8a27d3edd98915e57ec62b725bef 100644 (file)
@@ -1,5 +1,5 @@
 error[E0515]: cannot return value referencing temporary value
-  --> $DIR/return-ref-mut-issue-46557.rs:8:5
+  --> $DIR/return-ref-mut-issue-46557.rs:5:5
    |
 LL |     let ref mut x = 1234543;
    |                     ------- temporary value created here
index 586f076c8cabfac2e490b39adab551eac494aabd..dc67c1a68aaf639d4528b8d51fb85a60ed689b41 100644 (file)
@@ -2,9 +2,6 @@
 //
 // compile-pass
 
-#![feature(nll)]
-#![allow(unused_variables)]
-
 use std::collections::BTreeMap;
 
 trait ValueTree {
index de8b05aeed75cd172d18e6e775e18d8c52a2fe37..1b80be2eaff99169c1e96e81baa0cf38a0b036d4 100644 (file)
@@ -2,9 +2,6 @@
 //
 // compile-pass
 
-#![feature(nll)]
-#![allow(unused_variables)]
-
 use std::collections::BTreeMap;
 use std::ops::Range;
 use std::cmp::Ord;
diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.nll.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.nll.stderr
new file mode 100644 (file)
index 0000000..3a84cbf
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
+  --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5
+   |
+LL |     bar::<T::Output>()
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
index 9c2cbfd4a4530ead2f45a365afa8127891e8a9d6..dce88b88c7530bbbddd498e3847d6fbdd2be0f11 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // Test that we are able to establish that `<T as
 // MyTrait<'a>>::Output` outlives `'b` here. We need to prove however
 // that `<T as MyTrait<'a>>::Output` outlives `'a`, so we also have to
index 1aed0a545b478203315ab22ead6311fa25d43bb2..1a5a3719fd86d36f0b7fd3874e9a95d4a53da1d2 100644 (file)
@@ -1,10 +1,15 @@
-error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
-  --> $DIR/projection-where-clause-env-wrong-bound.rs:17:5
+error[E0309]: the associated type `<T as MyTrait<'a>>::Output` may not live long enough
+  --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5
    |
 LL |     bar::<T::Output>()
    |     ^^^^^^^^^^^^^^^^
    |
-   = help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`...
+   = help: consider adding an explicit lifetime bound `<T as MyTrait<'a>>::Output: 'a`...
+note: ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds
+  --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5
+   |
+LL |     bar::<T::Output>()
+   |     ^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr
new file mode 100644 (file)
index 0000000..58bfb60
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
+  --> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5
+   |
+LL |     bar::<<T as MyTrait<'a>>::Output>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
index c6935badf54b289dd8f66764568f260b9a17b505..731476661112148053971caa944d21a80e19f012 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // Test that when we have a `<T as MyTrait<'a>>::Output: 'a`
 // relationship in the environment we take advantage of it.  In this
 // case, that means we **don't** have to prove that `T: 'a`.
diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs
deleted file mode 100644 (file)
index ec55943..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// Test that we assume that universal types like `T` outlive the
-// function body. Same as ty-param-fn-body, but uses `feature(nll)`,
-// which affects error reporting.
-
-#![feature(nll)]
-
-#![allow(warnings)]
-
-use std::cell::Cell;
-
-// No errors here, because `'a` is local to the body.
-fn region_within_body<T>(t: T) {
-    let some_int = 22;
-    let cell = Cell::new(&some_int);
-    outlives(cell, t)
-}
-
-// Error here, because T: 'a is not satisfied.
-fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) {
-    outlives(cell, t)
-    //~^ ERROR the parameter type `T` may not live long enough
-}
-
-fn outlives<'a, T>(x: Cell<&'a usize>, y: T)
-where
-    T: 'a,
-{
-}
-
-fn main() {}
diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr
deleted file mode 100644 (file)
index b3c02f7..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/ty-param-fn-body-nll-feature.rs:20:5
-   |
-LL |     outlives(cell, t)
-   |     ^^^^^^^^^^^^^^^^^
-   |
-   = help: consider adding an explicit lifetime bound `T: 'a`...
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/nll/type-alias-free-regions.nll.stderr b/src/test/ui/nll/type-alias-free-regions.nll.stderr
new file mode 100644 (file)
index 0000000..235bf41
--- /dev/null
@@ -0,0 +1,22 @@
+error: lifetime may not live long enough
+  --> $DIR/type-alias-free-regions.rs:17:9
+   |
+LL | impl<'a> FromBox<'a> for C<'a> {
+   |      -- lifetime `'a` defined here
+LL |     fn from_box(b: Box<B>) -> Self {
+   |                 - has type `std::boxed::Box<std::boxed::Box<&'1 isize>>`
+LL |         C { f: b }
+   |         ^^^^^^^^^^ returning this value requires that `'1` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/type-alias-free-regions.rs:27:9
+   |
+LL | impl<'a> FromTuple<'a> for C<'a> {
+   |      -- lifetime `'a` defined here
+LL |     fn from_tuple(b: (B,)) -> Self {
+   |                   - has type `(std::boxed::Box<&'1 isize>,)`
+LL |         C { f: Box::new(b.0) }
+   |         ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
index ebe6b9d20739aad9d751a667c6e2f0c35a25aa6d..fd5566f35d5141f5f49a39688f40bf03bc3e5ada 100644 (file)
@@ -1,8 +1,6 @@
 // Test that we don't assume that type aliases have the same type parameters
 // as the type they alias and then panic when we see this.
 
-#![feature(nll)]
-
 type A<'a> = &'a isize;
 type B<'a> = Box<A<'a>>;
 
index 4facc2d0da0e6b0e2825ceb28ccc850ee8cb8ef9..00d58d34362e644c78a445592e7a1e2f9fb8ffdc 100644 (file)
@@ -1,22 +1,52 @@
-error: lifetime may not live long enough
-  --> $DIR/type-alias-free-regions.rs:19:9
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+  --> $DIR/type-alias-free-regions.rs:17:9
    |
-LL | impl<'a> FromBox<'a> for C<'a> {
-   |      -- lifetime `'a` defined here
-LL |     fn from_box(b: Box<B>) -> Self {
-   |                 - has type `std::boxed::Box<std::boxed::Box<&'1 isize>>`
 LL |         C { f: b }
-   |         ^^^^^^^^^^ returning this value requires that `'1` must outlive `'a`
+   |         ^
+   |
+note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 16:5...
+  --> $DIR/type-alias-free-regions.rs:16:5
+   |
+LL | /     fn from_box(b: Box<B>) -> Self {
+LL | |         C { f: b }
+LL | |     }
+   | |_____^
+   = note: ...so that the expression is assignable:
+           expected std::boxed::Box<std::boxed::Box<&isize>>
+              found std::boxed::Box<std::boxed::Box<&isize>>
+note: but, the lifetime must be valid for the lifetime 'a as defined on the impl at 15:6...
+  --> $DIR/type-alias-free-regions.rs:15:6
+   |
+LL | impl<'a> FromBox<'a> for C<'a> {
+   |      ^^
+   = note: ...so that the expression is assignable:
+           expected C<'a>
+              found C<'_>
 
-error: lifetime may not live long enough
-  --> $DIR/type-alias-free-regions.rs:29:9
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+  --> $DIR/type-alias-free-regions.rs:27:16
    |
-LL | impl<'a> FromTuple<'a> for C<'a> {
-   |      -- lifetime `'a` defined here
-LL |     fn from_tuple(b: (B,)) -> Self {
-   |                   - has type `(std::boxed::Box<&'1 isize>,)`
 LL |         C { f: Box::new(b.0) }
-   |         ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'a`
+   |                ^^^^^^^^^^^^^
+   |
+note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 26:5...
+  --> $DIR/type-alias-free-regions.rs:26:5
+   |
+LL | /     fn from_tuple(b: (B,)) -> Self {
+LL | |         C { f: Box::new(b.0) }
+LL | |     }
+   | |_____^
+   = note: ...so that the expression is assignable:
+           expected std::boxed::Box<&isize>
+              found std::boxed::Box<&isize>
+note: but, the lifetime must be valid for the lifetime 'a as defined on the impl at 25:6...
+  --> $DIR/type-alias-free-regions.rs:25:6
+   |
+LL | impl<'a> FromTuple<'a> for C<'a> {
+   |      ^^
+   = note: ...so that the expression is assignable:
+           expected C<'a>
+              found C<'_>
 
 error: aborting due to 2 previous errors
 
index 06dbc473557398068c3e1877db7e7420ac6170e4..da0d9229c1262bb9edfda28e23ee317df70e8df6 100644 (file)
@@ -1,4 +1,3 @@
-#![feature(nll)]
 #![deny(unused_mut)]
 
 fn main() {
index ef31dd7b29a40ed5069dd835ecea82df109bdfea..261d678db67587bc37514f856d1117a56ec067c2 100644 (file)
@@ -1,5 +1,5 @@
 error: variable does not need to be mutable
-  --> $DIR/unused-mut-issue-50343.rs:5:33
+  --> $DIR/unused-mut-issue-50343.rs:4:33
    |
 LL |     vec![(42, 22)].iter().map(|(mut x, _y)| ()).count();
    |                                 ----^
@@ -7,7 +7,7 @@ LL |     vec![(42, 22)].iter().map(|(mut x, _y)| ()).count();
    |                                 help: remove this `mut`
    |
 note: lint level defined here
-  --> $DIR/unused-mut-issue-50343.rs:2:9
+  --> $DIR/unused-mut-issue-50343.rs:1:9
    |
 LL | #![deny(unused_mut)]
    |         ^^^^^^^^^^
index 842ebae261819c3574a095b1b3ad2e35ee0c1c2d..0d9828342d8cbefc16fc42cef29e4b8570ad4b1d 100644 (file)
@@ -1,8 +1,6 @@
 // Unit test for the "user substitutions" that are annotated on each
 // node.
 
-#![feature(nll)]
-
 enum SomeEnum<T> {
     SomeVariant { t: T }
 }
index 38f068746a6784370cc536316de6ea32eeab88e1..e38b77fdcea012dd5b719a33c1222c933ca402f3 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-brace-enums.rs:27:48
+  --> $DIR/adt-brace-enums.rs:25:48
    |
 LL |     SomeEnum::SomeVariant::<&'static u32> { t: &c };
    |                                                ^^
@@ -10,7 +10,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-brace-enums.rs:32:43
+  --> $DIR/adt-brace-enums.rs:30:43
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
@@ -24,7 +24,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-brace-enums.rs:42:47
+  --> $DIR/adt-brace-enums.rs:40:47
    |
 LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
    |                                              -- lifetime `'a` defined here
index d7ebbe8eb5fc0b001ba350a2dbd5292e69146126..bdbfd87d584d9c15dc578b510363ec8bebde1e49 100644 (file)
@@ -1,8 +1,6 @@
 // Unit test for the "user substitutions" that are annotated on each
 // node.
 
-#![feature(nll)]
-
 struct SomeStruct<T> { t: T }
 
 fn no_annot() {
index 25a9de480b2caf05fb5ecdc866a4f39a76cb59d3..3c3003477c2d6e688fb47d0a0c8e9e9eab664f0e 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-brace-structs.rs:25:37
+  --> $DIR/adt-brace-structs.rs:23:37
    |
 LL |     SomeStruct::<&'static u32> { t: &c };
    |                                     ^^
@@ -10,7 +10,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-brace-structs.rs:30:32
+  --> $DIR/adt-brace-structs.rs:28:32
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
@@ -24,7 +24,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-brace-structs.rs:40:36
+  --> $DIR/adt-brace-structs.rs:38:36
    |
 LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
    |                                              -- lifetime `'a` defined here
index 7a8f55a800b9268b54ed68e4d8e9a66857e544e1..53853668d1978bd14370906400ae26d3a819cb85 100644 (file)
@@ -1,7 +1,6 @@
 // Unit test for the "user substitutions" that are annotated on each
 // node.
 
-#![feature(nll)]
 #![allow(warnings)]
 
 use std::cell::Cell;
index 1afbac7c4b2efafcd95df4af67ee9281d4db5a9d..bb703412228800d6be0d47cf2bac4026f47728d0 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-nullary-enums.rs:34:41
+  --> $DIR/adt-nullary-enums.rs:33:41
    |
 LL |         SomeEnum::SomeVariant(Cell::new(&c)),
    |                               ----------^^-
@@ -11,7 +11,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-nullary-enums.rs:42:41
+  --> $DIR/adt-nullary-enums.rs:41:41
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
@@ -26,7 +26,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-nullary-enums.rs:55:45
+  --> $DIR/adt-nullary-enums.rs:54:45
    |
 LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
    |                                              -- lifetime `'a` defined here
index 085596ecc53ee0389d2c8d92126b6533ce7d86b5..efe8dfda1910a28f6f9fbdf1567241a24e8c57be 100644 (file)
@@ -1,7 +1,6 @@
 // Unit test for the "user substitutions" that are annotated on each
 // node.
 
-#![feature(nll)]
 #![allow(warnings)]
 
 enum SomeEnum<T> {
index cd625653ace2004fdd257859c1c31470434942a6..810912bf886187a3b9fb2b6ec7670ed9a5449fb1 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-tuple-enums.rs:29:43
+  --> $DIR/adt-tuple-enums.rs:28:43
    |
 LL |     SomeEnum::SomeVariant::<&'static u32>(&c);
    |                                           ^^
@@ -10,7 +10,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-tuple-enums.rs:34:38
+  --> $DIR/adt-tuple-enums.rs:33:38
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
@@ -24,7 +24,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-tuple-enums.rs:44:42
+  --> $DIR/adt-tuple-enums.rs:43:42
    |
 LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
    |                                              -- lifetime `'a` defined here
index ebbe3cd2c8988685582726cba6fdac353103deb9..37284e1fda82b307b76700e91b02f5ccb6c5f221 100644 (file)
@@ -1,8 +1,6 @@
 // Unit test for the "user substitutions" that are annotated on each
 // node.
 
-#![feature(nll)]
-
 struct SomeStruct<T>(T);
 
 fn no_annot() {
index 2bb58bb2590b3eec5e98edd15c04d48a7e8acce8..4d2140eca1b02a87c239ba64ed0d92607fb3fe91 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-tuple-struct.rs:25:32
+  --> $DIR/adt-tuple-struct.rs:23:32
    |
 LL |     SomeStruct::<&'static u32>(&c);
    |                                ^^
@@ -10,7 +10,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-tuple-struct.rs:30:27
+  --> $DIR/adt-tuple-struct.rs:28:27
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
@@ -24,7 +24,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/adt-tuple-struct.rs:40:31
+  --> $DIR/adt-tuple-struct.rs:38:31
    |
 LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
    |                                              -- lifetime `'a` defined here
index 4756c771f6eaaa036b4bc418fd5af0cc32d3825e..bb6129dacda8d1e2368c426d6bf9421e09831966 100644 (file)
@@ -1,5 +1,4 @@
 #![allow(warnings)]
-#![feature(nll)]
 
 fn main() {
     let x = 22_u32;
index 0228b56d761f32518d7130585415289d675b190e..4599d04e7e2300c3eb27ab2121cbc7c17ddf32da 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/cast_static_lifetime.rs:6:19
+  --> $DIR/cast_static_lifetime.rs:5:19
    |
 LL |     let y: &u32 = (&x) as &'static u32;
    |                   ^^^^----------------
diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr
new file mode 100644 (file)
index 0000000..c393015
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/constant-in-expr-inherent-1.rs:8:5
+   |
+LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
+   |        -- lifetime `'a` defined here
+LL |     <Foo<'a>>::C
+   |     ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
index 9f0c60967efb28d090a611a95400f3508d96758c..e3a8a5f58dfda6193981ce0cc20d0b41ca1b8b9c 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 struct Foo<'a> { x: &'a u32 }
 
 impl<'a> Foo<'a> {
index 9a28fbd11339fe3c9e8b07965a08e7c862ff89bb..77e1339dc161d7ed43667e6ff2f4e4fdc8f7728e 100644 (file)
@@ -1,10 +1,23 @@
-error: lifetime may not live long enough
-  --> $DIR/constant-in-expr-inherent-1.rs:10:5
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+  --> $DIR/constant-in-expr-inherent-1.rs:8:5
+   |
+LL |     <Foo<'a>>::C
+   |     ^^^^^^^^^^^^
+   |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 7:8...
+  --> $DIR/constant-in-expr-inherent-1.rs:7:8
    |
 LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
-   |        -- lifetime `'a` defined here
+   |        ^^
+   = note: ...so that the types are compatible:
+           expected Foo<'_>
+              found Foo<'a>
+   = note: but, the lifetime must be valid for the static lifetime...
+note: ...so that reference does not outlive borrowed content
+  --> $DIR/constant-in-expr-inherent-1.rs:8:5
+   |
 LL |     <Foo<'a>>::C
-   |     ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+   |     ^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 123be6b3e4098dc7911844576054e45b48db3f1f..90696d4b17d8dd3f66673df4061fdd7ed84327d2 100644 (file)
@@ -1,8 +1,6 @@
 // Test that we still check constants are well-formed, even when we there's no
 // type annotation to check.
 
-#![feature(nll)]
-
 const FUN: fn(&'static ()) = |_| {};
 struct A;
 impl A {
index 07e2e1e85cb787b7b9a294c210dff7ed71206eef..12065a85aa4a0a512872fb8943ecdb3bf92ff4f8 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/constant-in-expr-inherent-2.rs:25:9
+  --> $DIR/constant-in-expr-inherent-2.rs:23:9
    |
 LL |     FUN(&x);
    |     ----^^-
@@ -11,7 +11,7 @@ LL | }
    | - `x` dropped here while still borrowed
 
 error[E0597]: `x` does not live long enough
-  --> $DIR/constant-in-expr-inherent-2.rs:26:23
+  --> $DIR/constant-in-expr-inherent-2.rs:24:23
    |
 LL |     A::ASSOCIATED_FUN(&x);
    |     ------------------^^-
@@ -23,7 +23,7 @@ LL | }
    | - `x` dropped here while still borrowed
 
 error[E0597]: `x` does not live long enough
-  --> $DIR/constant-in-expr-inherent-2.rs:27:28
+  --> $DIR/constant-in-expr-inherent-2.rs:25:28
    |
 LL |     B::ALSO_ASSOCIATED_FUN(&x);
    |     -----------------------^^-
@@ -35,7 +35,7 @@ LL | }
    | - `x` dropped here while still borrowed
 
 error[E0597]: `x` does not live long enough
-  --> $DIR/constant-in-expr-inherent-2.rs:28:31
+  --> $DIR/constant-in-expr-inherent-2.rs:26:31
    |
 LL |     <_>::TRAIT_ASSOCIATED_FUN(&x);
    |     --------------------------^^-
diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr
new file mode 100644 (file)
index 0000000..541a2cf
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/constant-in-expr-normalize.rs:18:5
+   |
+LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
+   |        -- lifetime `'a` defined here
+LL |     <() as Foo<'a>>::C
+   |     ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
index 4292fc710e98bb58c49bd7eb2a234614c6a56dee..b7095430d8bd2849fca33b546c4839e620fc4e01 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 trait Mirror {
     type Me;
 }
index 5e66a30d7c332ec4bb72bb9483856c601a523d35..f49d68458bea5d10b522c69110b3cb5100795b90 100644 (file)
@@ -1,10 +1,15 @@
-error: lifetime may not live long enough
-  --> $DIR/constant-in-expr-normalize.rs:20:5
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/constant-in-expr-normalize.rs:18:5
    |
-LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
-   |        -- lifetime `'a` defined here
 LL |     <() as Foo<'a>>::C
-   |     ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+   |     ^^^^^^^^^^^^^^^^^^
+   |
+   = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 17:8
+  --> $DIR/constant-in-expr-normalize.rs:17:8
+   |
+LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
+   |        ^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr
new file mode 100644 (file)
index 0000000..ea0fcb6
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/constant-in-expr-trait-item-1.rs:10:5
+   |
+LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
+   |        -- lifetime `'a` defined here
+LL |     <() as Foo<'a>>::C
+   |     ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
index daa0d7bc24140b1cbf6d5906b07e950fe8616d14..e0400b2cc0267fb1d393bce8689490d683289d16 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 trait Foo<'a> {
     const C: &'a u32;
 }
index c96838f259a818aa88a792f9f03c3a42a83a4ccc..451bcf41e42a9b2dc42daa125c8ada007b7a8254 100644 (file)
@@ -1,10 +1,15 @@
-error: lifetime may not live long enough
-  --> $DIR/constant-in-expr-trait-item-1.rs:12:5
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/constant-in-expr-trait-item-1.rs:10:5
    |
-LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
-   |        -- lifetime `'a` defined here
 LL |     <() as Foo<'a>>::C
-   |     ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+   |     ^^^^^^^^^^^^^^^^^^
+   |
+   = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 9:8
+  --> $DIR/constant-in-expr-trait-item-1.rs:9:8
+   |
+LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
+   |        ^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr
new file mode 100644 (file)
index 0000000..ff549f1
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/constant-in-expr-trait-item-2.rs:10:5
+   |
+LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
+   |        -- lifetime `'a` defined here
+LL |     <T as Foo<'a>>::C
+   |     ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
index cd66e7a49cb83d1bc9350b593e1e4ee6047d88e6..73c4e577b05c087a16b4e7df73e3f5c6f22b185a 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 trait Foo<'a> {
     const C: &'a u32;
 }
index fcc3c40e43f74f95a71518b2d913fff98f363440..d129e55e1e6f63c8c5d49fbeb61f7c917501233a 100644 (file)
@@ -1,10 +1,15 @@
-error: lifetime may not live long enough
-  --> $DIR/constant-in-expr-trait-item-2.rs:12:5
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/constant-in-expr-trait-item-2.rs:10:5
    |
-LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
-   |        -- lifetime `'a` defined here
 LL |     <T as Foo<'a>>::C
-   |     ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 9:8
+  --> $DIR/constant-in-expr-trait-item-2.rs:9:8
+   |
+LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
+   |        ^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr
new file mode 100644 (file)
index 0000000..7f160d8
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/constant-in-expr-trait-item-3.rs:10:5
+   |
+LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
+   |        -- lifetime `'a` defined here
+LL |     T::C
+   |     ^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
index f83ae2438e6d5dd1fffa6a9eeadd96c0afb575e9..567e31ef936321b7d7d0b10a84730e11cfedbb86 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 trait Foo<'a> {
     const C: &'a u32;
 }
index c91370c810c8e42a7452e40afc1522e13c7b34d0..77655fe091b6275fedbd0721f22cff7b94929a31 100644 (file)
@@ -1,10 +1,23 @@
-error: lifetime may not live long enough
-  --> $DIR/constant-in-expr-trait-item-3.rs:12:5
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+  --> $DIR/constant-in-expr-trait-item-3.rs:10:5
+   |
+LL |     T::C
+   |     ^^^^
+   |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:8...
+  --> $DIR/constant-in-expr-trait-item-3.rs:9:8
    |
 LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
-   |        -- lifetime `'a` defined here
+   |        ^^
+   = note: ...so that the types are compatible:
+           expected Foo<'_>
+              found Foo<'a>
+   = note: but, the lifetime must be valid for the static lifetime...
+note: ...so that reference does not outlive borrowed content
+  --> $DIR/constant-in-expr-trait-item-3.rs:10:5
+   |
 LL |     T::C
-   |     ^^^^ returning this value requires that `'a` must outlive `'static`
+   |     ^^^^
 
 error: aborting due to previous error
 
index 1e5e9340bef51bf0e555c923ab248425f49135a2..38db6d1c4c56fdf9d89b40f372499d783cc9f13c 100644 (file)
@@ -1,8 +1,6 @@
 // Unit test for the "user substitutions" that are annotated on each
 // node.
 
-#![feature(nll)]
-
 fn some_fn<T>(arg: T) { }
 
 fn no_annot() {
index dadce24159e83c377c2360554aeebea712051f7c..e0640da39e2b62fb3211d3c89e7fdab35b910ab9 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/fns.rs:25:29
+  --> $DIR/fns.rs:23:29
    |
 LL |     some_fn::<&'static u32>(&c);
    |     ------------------------^^-
@@ -10,7 +10,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/fns.rs:30:24
+  --> $DIR/fns.rs:28:24
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
@@ -24,7 +24,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/fns.rs:40:28
+  --> $DIR/fns.rs:38:28
    |
 LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
    |                                              -- lifetime `'a` defined here
index 0a8a6793dc782fcd119599b33edefd0f4b104e78..6b9d30f5ab4259eadc86b5327cdeef3aafd3dcf6 100644 (file)
@@ -1,5 +1,4 @@
 // compile-pass
-#![feature(nll)]
 
 // This test is reduced from a scenario pnkfelix encountered while
 // bootstrapping the compiler.
index 7daa5a59b997746e63246a42d52923c38917c828..4d18e96cc1543f8157d0dc0d570cace448f5e3e1 100644 (file)
@@ -5,8 +5,6 @@
 //
 // run-pass
 
-#![feature(nll)]
-
 pub struct Foo<T>(T);
 
 impl<T> Foo<T> {
index d7686b9dc9411479d00e658d6a7c1ddf85fb55c2..29969c7b4c6c84696aea31026be2f68a6bb6e023 100644 (file)
@@ -7,8 +7,6 @@
 //
 // run-pass
 
-#![feature(nll)]
-
 pub trait Hasher {
     type Out: Eq;
 }
index 59d1513c4c38e3caf8ca2ceeca394e4c59125a54..beafc597ac113ba4e1507f9b4eadb455078959e1 100644 (file)
@@ -1,8 +1,6 @@
 // Unit test for the "user substitutions" that are annotated on each
 // node.
 
-#![feature(nll)]
-
 trait Bazoom<T> {
     fn method<U>(&self, arg: T, arg2: U) { }
 }
index 7e5314614f3465683279e679d79c05ccf3aded0f..10447e45a6d422de9a6ad372f19bf5083a0a1f77 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/method-call.rs:38:34
+  --> $DIR/method-call.rs:36:34
    |
 LL |     a.method::<&'static u32>(b,  &c);
    |     -----------------------------^^-
@@ -10,7 +10,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/method-call.rs:45:29
+  --> $DIR/method-call.rs:43:29
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
@@ -24,7 +24,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/method-call.rs:59:33
+  --> $DIR/method-call.rs:57:33
    |
 LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
    |                                              -- lifetime `'a` defined here
index 7968a9f6c4fd501d2219011c92645ae81ccafd40..950771f35e49c350fe0043da8819f24490d78149 100644 (file)
@@ -1,8 +1,6 @@
 // Unit test for the "user substitutions" that are annotated on each
 // node.
 
-#![feature(nll)]
-
 trait Bazoom<T>: Sized {
     fn method<U>(self, arg: T, arg2: U) { }
 }
index 12b02ba33f72550a9e42e1eb075136be4877a738..962ddfd2bd151f372c7af5b88dd2dca42808b9cc 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `a` does not live long enough
-  --> $DIR/method-ufcs-1.rs:32:7
+  --> $DIR/method-ufcs-1.rs:30:7
    |
 LL |     x(&a, b, c);
    |     --^^-------
@@ -10,7 +10,7 @@ LL | }
    | - `a` dropped here while still borrowed
 
 error[E0597]: `a` does not live long enough
-  --> $DIR/method-ufcs-1.rs:39:36
+  --> $DIR/method-ufcs-1.rs:37:36
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
@@ -24,7 +24,7 @@ LL | }
    | - `a` dropped here while still borrowed
 
 error[E0597]: `a` does not live long enough
-  --> $DIR/method-ufcs-1.rs:53:41
+  --> $DIR/method-ufcs-1.rs:51:41
    |
 LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
    |                                              -- lifetime `'a` defined here
index a1d0e7b4c920846c33490556a4c9743bd79ceca6..7dc0f0c12a43e93e09f87d5a7827c68252209413 100644 (file)
@@ -1,8 +1,6 @@
 // Unit test for the "user substitutions" that are annotated on each
 // node.
 
-#![feature(nll)]
-
 trait Bazoom<T>: Sized {
     fn method<U>(self, arg: T, arg2: U) { }
 }
index a55ed1aa272ad26046f796bd254bdc9d428dbb61..63d59905e1c3892f90fb174794c658e6a6e0ba13 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `a` does not live long enough
-  --> $DIR/method-ufcs-2.rs:32:7
+  --> $DIR/method-ufcs-2.rs:30:7
    |
 LL |     x(&a, b, c);
    |     --^^-------
@@ -10,7 +10,7 @@ LL | }
    | - `a` dropped here while still borrowed
 
 error[E0597]: `b` does not live long enough
-  --> $DIR/method-ufcs-2.rs:39:39
+  --> $DIR/method-ufcs-2.rs:37:39
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
@@ -24,7 +24,7 @@ LL | }
    | - `b` dropped here while still borrowed
 
 error[E0597]: `b` does not live long enough
-  --> $DIR/method-ufcs-2.rs:53:44
+  --> $DIR/method-ufcs-2.rs:51:44
    |
 LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
    |                                              -- lifetime `'a` defined here
index ea480c03c35032dccc59b33065303ca43b3543d9..59d2009d14bdfd3e2917c933d29bfe4d9a94a27a 100644 (file)
@@ -1,8 +1,6 @@
 // Unit test for the "user substitutions" that are annotated on each
 // node.
 
-#![feature(nll)]
-
 trait Bazoom<T> {
     fn method<U>(&self, arg: T, arg2: U) { }
 }
index 140bda2df4147ebf91422462dd46f35fca9a5974..e7851833e93b23a7f77a130197e6dd19f2dfb33d 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/method-ufcs-3.rs:38:53
+  --> $DIR/method-ufcs-3.rs:36:53
    |
 LL |     <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c);
    |     ------------------------------------------------^^-
@@ -10,7 +10,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/method-ufcs-3.rs:45:48
+  --> $DIR/method-ufcs-3.rs:43:48
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
@@ -24,7 +24,7 @@ LL | }
    | - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/method-ufcs-3.rs:59:52
+  --> $DIR/method-ufcs-3.rs:57:52
    |
 LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
    |                                              -- lifetime `'a` defined here
index a77d6af5323c2c5b6d0cdaea77e7e50a694ef9a9..cfbc0bcf6b0fc0375b29ce32adf613dad52c3832 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // Check that substitutions given on the self type (here, `A`) can be
 // used in combination with annotations given for method arguments.
 
index 4dc534b2e77acb5b5e8285d09f85ef8c499f7e0a..06f20d9b2355957ec460832005a4aad5947b9770 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `v` does not live long enough
-  --> $DIR/method-ufcs-inherent-2.rs:16:37
+  --> $DIR/method-ufcs-inherent-2.rs:14:37
    |
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
@@ -14,7 +14,7 @@ LL | }
    | - `v` dropped here while still borrowed
 
 error[E0597]: `v` does not live long enough
-  --> $DIR/method-ufcs-inherent-2.rs:16:41
+  --> $DIR/method-ufcs-inherent-2.rs:14:41
    |
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
index 3f88c3df48e006640a373f0694c44304819294a5..85e7597390d5cb8849686e148345e7fe955a897f 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 // Check that inherent methods invoked with `<T>::new` style
 // carry their annotations through to NLL in connection with
 // method type parameters.
index a41cf50465e876dbfeedb290cc69a5dd111d592b..0f83e99cdfb92f186eecdecf5c6c085531f0b1ca 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `v` does not live long enough
-  --> $DIR/method-ufcs-inherent-4.rs:17:37
+  --> $DIR/method-ufcs-inherent-4.rs:15:37
    |
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
@@ -14,7 +14,7 @@ LL | }
    | - `v` dropped here while still borrowed
 
 error[E0597]: `v` does not live long enough
-  --> $DIR/method-ufcs-inherent-4.rs:17:41
+  --> $DIR/method-ufcs-inherent-4.rs:15:41
    |
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
index e0af2e67e1836f4f9a874fa3d1aa306b1cc3bea8..870e3d8110cd5e34b487a02157a0da808d240da1 100644 (file)
@@ -1,8 +1,6 @@
 // Test that we enforce a `&'static` requirement that is only visible
 // after normalization.
 
-#![feature(nll)]
-
 trait Foo { type Out; }
 impl Foo for () { type Out = &'static u32; }
 
index fe93c3edba87a0d23af926bf2b862f38d2c97e38..4c7893789a53516cf57d10500cff3db0bd89cf7c 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `a` does not live long enough
-  --> $DIR/normalization.rs:11:31
+  --> $DIR/normalization.rs:9:31
    |
 LL |     let b: <() as Foo>::Out = &a;
    |            ----------------   ^^ borrowed value does not live long enough
index d97cc88dd9af4e194fbd659ec0bfd451fa3f69db..a06229a02032a48afba91d61d2394ffc7c2da362 100644 (file)
@@ -4,8 +4,6 @@
 //
 // run-pass
 
-#![feature(nll)]
-
 trait Mirror {
     type Me;
 }
index 526134b6e4b3c2ae22e26744a8a501e0cefa3e09..59cd69c0ca55d7c3d2e1280ed7d6a40f4d957403 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 enum Foo<'a> {
     Bar { field: &'a u32 }
 }
index b483f219c9007d0adf1045de9a44e1d0575e9e4d..a97e7a9fd46fc3a3b1647c5ac17e29f78ba51609 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `y` does not live long enough
-  --> $DIR/pattern_substs_on_brace_enum_variant.rs:9:33
+  --> $DIR/pattern_substs_on_brace_enum_variant.rs:7:33
    |
 LL |     let foo = Foo::Bar { field: &y };
    |                                 ^^ borrowed value does not live long enough
@@ -10,7 +10,7 @@ LL | }
    | - `y` dropped here while still borrowed
 
 error[E0597]: `y` does not live long enough
-  --> $DIR/pattern_substs_on_brace_enum_variant.rs:16:33
+  --> $DIR/pattern_substs_on_brace_enum_variant.rs:14:33
    |
 LL |     let foo = Foo::Bar { field: &y };
    |                                 ^^ borrowed value does not live long enough
index 1c92858eb3a08cd9d8c1c5c58f4a60129de7b5ae..1586c4ea30c62b2a56c78b92de4302058c2260b5 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 struct Foo<'a> { field: &'a u32 }
 
 fn in_let() {
index 9c888b0bffe5312e3ec19aacb851af3d1a8bfca9..408d7c2a5e2a5c62250df15c5bfb384f48246274 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `y` does not live long enough
-  --> $DIR/pattern_substs_on_brace_struct.rs:7:28
+  --> $DIR/pattern_substs_on_brace_struct.rs:5:28
    |
 LL |     let foo = Foo { field: &y };
    |                            ^^ borrowed value does not live long enough
@@ -10,7 +10,7 @@ LL | }
    | - `y` dropped here while still borrowed
 
 error[E0597]: `y` does not live long enough
-  --> $DIR/pattern_substs_on_brace_struct.rs:14:28
+  --> $DIR/pattern_substs_on_brace_struct.rs:12:28
    |
 LL |     let foo = Foo { field: &y };
    |                            ^^ borrowed value does not live long enough
index d6c364f8e3f0c83afc4b14f08ceb155aac72e591..6fa59fdd8d8996e9595f67aaeac022cd8fd79238 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 enum Foo<'a> {
     Bar(&'a u32)
 }
index 698cff51126f9caa226977e42decf31351be31a3..920c906f63a5824a3e08bdf049149f8af153135b 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `y` does not live long enough
-  --> $DIR/pattern_substs_on_tuple_enum_variant.rs:9:24
+  --> $DIR/pattern_substs_on_tuple_enum_variant.rs:7:24
    |
 LL |     let foo = Foo::Bar(&y);
    |                        ^^ borrowed value does not live long enough
@@ -10,7 +10,7 @@ LL | }
    | - `y` dropped here while still borrowed
 
 error[E0597]: `y` does not live long enough
-  --> $DIR/pattern_substs_on_tuple_enum_variant.rs:16:24
+  --> $DIR/pattern_substs_on_tuple_enum_variant.rs:14:24
    |
 LL |     let foo = Foo::Bar(&y);
    |                        ^^ borrowed value does not live long enough
index 626ca908797876dfb9a1bd067f45f4b28df4aafe..7486aab0e0883628e60630700503519e39953a50 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 struct Foo<'a>(&'a u32);
 
 fn in_let() {
index b5f2cb8e321ab50e3d8314b398226d779d6c83d4..3f01638d84757f6aaee8764ab4c8e56f27d2d7e6 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `y` does not live long enough
-  --> $DIR/pattern_substs_on_tuple_struct.rs:7:19
+  --> $DIR/pattern_substs_on_tuple_struct.rs:5:19
    |
 LL |     let foo = Foo(&y);
    |                   ^^ borrowed value does not live long enough
@@ -10,7 +10,7 @@ LL | }
    | - `y` dropped here while still borrowed
 
 error[E0597]: `y` does not live long enough
-  --> $DIR/pattern_substs_on_tuple_struct.rs:14:19
+  --> $DIR/pattern_substs_on_tuple_struct.rs:12:19
    |
 LL |     let foo = Foo(&y);
    |                   ^^ borrowed value does not live long enough
index fa2d2fb81183dc32ae7f3e322e2e8a70bd4c175e..b92f8bfd23b234ce2cb7e0dc5c506e46ed7b6c00 100644 (file)
@@ -1,7 +1,5 @@
 // Test that type annotations are checked in promoted constants correctly.
 
-#![feature(nll)]
-
 fn foo<'a>() {
     let x = 0;
     let f = &drop::<&'a i32>;
index d8b01f22145db946de9c390d647158f9caf8e5e9..cb99a6a369d0b25a12b4a4656b128c832335ea36 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/promoted-annotation.rs:8:7
+  --> $DIR/promoted-annotation.rs:6:7
    |
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
index 362fe51c3ea377bf4f443d524de6c8be31cb6af9..101b5cfabb3d06419e37559c583179c4b15f5790 100644 (file)
@@ -1,5 +1,4 @@
 #![allow(warnings)]
-#![feature(nll)]
 #![feature(type_ascription)]
 
 fn main() {
index 93dbf7cb1b310144d1f89b37534af3092c98f138..133bbef52311dc1135ea0faf821e4619383161f3 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/type_ascription_static_lifetime.rs:7:19
+  --> $DIR/type_ascription_static_lifetime.rs:6:19
    |
 LL |     let y: &u32 = &x: &'static u32;
    |                   ^^--------------
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr
new file mode 100644 (file)
index 0000000..19cdd66
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/object-lifetime-default-elision.rs:71:5
+   |
+LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait {
+   |          -- -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+...
+LL |     ss
+   |     ^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr
new file mode 100644 (file)
index 0000000..9e68647
--- /dev/null
@@ -0,0 +1,28 @@
+error[E0621]: explicit lifetime required in the type of `ss`
+  --> $DIR/object-lifetime-default-from-box-error.rs:18:5
+   |
+LL | fn load(ss: &mut SomeStruct) -> Box<SomeTrait> {
+   |             --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>`
+...
+LL |     ss.r
+   |     ^^^^ lifetime `'static` required
+
+error[E0507]: cannot move out of borrowed content
+  --> $DIR/object-lifetime-default-from-box-error.rs:18:5
+   |
+LL |     ss.r
+   |     ^^^^ cannot move out of borrowed content
+
+error[E0621]: explicit lifetime required in the type of `ss`
+  --> $DIR/object-lifetime-default-from-box-error.rs:31:5
+   |
+LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<SomeTrait+'b>) {
+   |                   --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>`
+...
+LL |     ss.r = b;
+   |     ^^^^ lifetime `'b` required
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0507, E0621.
+For more information about an error, try `rustc --explain E0507`.
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr
new file mode 100644 (file)
index 0000000..6d183dd
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/object-lifetime-default-from-rptr-box-error.rs:15:5
+   |
+LL | fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) {
+   |      -- lifetime `'a` defined here
+LL |     ss.t = t;
+   |     ^^^^^^^^ assignment requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr
new file mode 100644 (file)
index 0000000..fe3b21f
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:21:5
+   |
+LL | fn c<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) {
+   |      -- lifetime `'a` defined here
+LL |     ss.t = t;
+   |     ^^^^^^^^ assignment requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr
new file mode 100644 (file)
index 0000000..448fe9e
--- /dev/null
@@ -0,0 +1,21 @@
+error: lifetime may not live long enough
+  --> $DIR/object-lifetime-default-mybox.rs:27:5
+   |
+LL | fn load1<'a,'b>(a: &'a MyBox<SomeTrait>,
+   |          -- -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+...
+LL |     a
+   |     ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/object-lifetime-default-mybox.rs:31:5
+   |
+LL | fn load2<'a>(ss: &MyBox<SomeTrait+'a>) -> MyBox<SomeTrait+'a> {
+   |              -- `ss` is a reference that is only valid in the function body
+LL |     load0(ss)
+   |     ^^^^^^^^^ `ss` escapes the function body here
+
+error: aborting due to 2 previous errors
+
index 7e1174a273438320880e1fd9ab3be70d37d9d05b..c2deeb7dfd48b0729fb52229baa3b2b170410978 100644 (file)
@@ -2,6 +2,7 @@
 // ignore-musl - no dylibs here
 // ignore-cloudabi
 // ignore-emscripten
+// ignore-sgx no dynamic lib support
 // error-pattern:`panic_unwind` is not compiled with this crate's panic strategy
 
 // This is a test where the local crate, compiled with `panic=abort`, links to
diff --git a/src/test/ui/pattern/pattern-bindings-after-at.nll.stderr b/src/test/ui/pattern/pattern-bindings-after-at.nll.stderr
new file mode 100644 (file)
index 0000000..35ee787
--- /dev/null
@@ -0,0 +1,22 @@
+error[E0303]: pattern bindings are not allowed after an `@`
+  --> $DIR/pattern-bindings-after-at.rs:8:31
+   |
+LL |         ref mut z @ &mut Some(ref a) => {
+   |                               ^^^^^ not allowed after `@`
+
+error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
+  --> $DIR/pattern-bindings-after-at.rs:8:31
+   |
+LL |         ref mut z @ &mut Some(ref a) => {
+   |         ----------------------^^^^^-
+   |         |                     |
+   |         |                     immutable borrow occurs here
+   |         mutable borrow occurs here
+...
+LL |             **z = None;
+   |             ---------- mutable borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0303, E0502.
+For more information about an error, try `rustc --explain E0303`.
index bed1e32a60158110c5182368ac219abdaf61c402..0127261b2b7d0a6111f68b71c1af2690c5c7819b 100644 (file)
@@ -57,6 +57,15 @@ pub enum Enum4<A, B, C, D> {
     Four(D)
 }
 
+pub union Union1<A: Copy> {
+    a: A,
+}
+
+pub union Union2<A: Copy, B: Copy> {
+    a: A,
+    b: B,
+}
+
 #[start]
 fn start(_: isize, _: *const *const u8) -> isize {
     let _x: MyOption<NonZeroU32> = Default::default();
@@ -69,5 +78,13 @@ fn start(_: isize, _: *const *const u8) -> isize {
     let _e: Enum4<(), char, (), ()> = Enum4::One(());
     let _f: Enum4<(), (), bool, ()> = Enum4::One(());
     let _g: Enum4<(), (), (), MyOption<u8>> = Enum4::One(());
+
+    // Unions do not currently participate in niche filling.
+    let _h: MyOption<Union2<NonZeroU32, u32>> = Default::default();
+
+    // ...even when theoretically possible.
+    let _i: MyOption<Union1<NonZeroU32>> = Default::default();
+    let _j: MyOption<Union2<NonZeroU32, NonZeroU32>> = Default::default();
+
     0
 }
index 9cdb2ae4f57e0aeb99097f211545210d8c75f1c2..301edc0d086b11fee1b251fd47b5ab7ebba36190 100644 (file)
@@ -14,6 +14,21 @@ print-type-size         field `.post`: 2 bytes
 print-type-size         field `.pre`: 1 bytes
 print-type-size     variant `None`: 0 bytes
 print-type-size     end padding: 1 bytes
+print-type-size type: `MyOption<Union1<std::num::NonZeroU32>>`: 8 bytes, alignment: 4 bytes
+print-type-size     discriminant: 4 bytes
+print-type-size     variant `Some`: 4 bytes
+print-type-size         field `.0`: 4 bytes
+print-type-size     variant `None`: 0 bytes
+print-type-size type: `MyOption<Union2<std::num::NonZeroU32, std::num::NonZeroU32>>`: 8 bytes, alignment: 4 bytes
+print-type-size     discriminant: 4 bytes
+print-type-size     variant `Some`: 4 bytes
+print-type-size         field `.0`: 4 bytes
+print-type-size     variant `None`: 0 bytes
+print-type-size type: `MyOption<Union2<std::num::NonZeroU32, u32>>`: 8 bytes, alignment: 4 bytes
+print-type-size     discriminant: 4 bytes
+print-type-size     variant `Some`: 4 bytes
+print-type-size         field `.0`: 4 bytes
+print-type-size     variant `None`: 0 bytes
 print-type-size type: `NestedNonZero`: 8 bytes, alignment: 4 bytes
 print-type-size     field `.val`: 4 bytes
 print-type-size     field `.post`: 2 bytes
@@ -36,6 +51,17 @@ print-type-size type: `MyOption<std::num::NonZeroU32>`: 4 bytes, alignment: 4 by
 print-type-size     variant `Some`: 4 bytes
 print-type-size         field `.0`: 4 bytes
 print-type-size     variant `None`: 0 bytes
+print-type-size type: `Union1<std::num::NonZeroU32>`: 4 bytes, alignment: 4 bytes
+print-type-size     variant `Union1`: 4 bytes
+print-type-size         field `.a`: 4 bytes
+print-type-size type: `Union2<std::num::NonZeroU32, std::num::NonZeroU32>`: 4 bytes, alignment: 4 bytes
+print-type-size     variant `Union2`: 4 bytes
+print-type-size         field `.a`: 4 bytes
+print-type-size         field `.b`: 4 bytes, offset: 0 bytes, alignment: 4 bytes
+print-type-size type: `Union2<std::num::NonZeroU32, u32>`: 4 bytes, alignment: 4 bytes
+print-type-size     variant `Union2`: 4 bytes
+print-type-size         field `.a`: 4 bytes
+print-type-size         field `.b`: 4 bytes, offset: 0 bytes, alignment: 4 bytes
 print-type-size type: `std::num::NonZeroU32`: 4 bytes, alignment: 4 bytes
 print-type-size     field `.0`: 4 bytes
 print-type-size type: `Enum4<(), (), (), MyOption<u8>>`: 2 bytes, alignment: 1 bytes
diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.nll.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.nll.stderr
new file mode 100644 (file)
index 0000000..eee331d
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0005]: refutable pattern in local binding: `Err(_)` not covered
+  --> $DIR/recursive-types-are-not-uninhabited.rs:6:9
+   |
+LL |     let Ok(x) = res;
+   |         ^^^^^ pattern `Err(_)` not covered
+
+error[E0381]: use of possibly uninitialized variable: `x`
+  --> $DIR/recursive-types-are-not-uninhabited.rs:8:5
+   |
+LL |     x
+   |     ^ use of possibly uninitialized `x`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0005, E0381.
+For more information about an error, try `rustc --explain E0005`.
diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr
new file mode 100644 (file)
index 0000000..76129b4
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/region-invariant-static-error-reporting.rs:15:9
+   |
+LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
+   |              - `x` is a reference that is only valid in the function body
+LL |     let bad = if x.is_some() {
+LL |         x.unwrap()
+   |         ^^^^^^^^^^ `x` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr
new file mode 100644 (file)
index 0000000..24c9a31
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43
+   |
+LL |     let _: fn(&mut &isize, &mut &isize) = a;
+   |                                           ^ expected concrete lifetime, found bound lifetime parameter
+   |
+   = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
+              found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr
new file mode 100644 (file)
index 0000000..6d031e9
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56
+   |
+LL |     let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
+   |                                                        ^ expected concrete lifetime, found bound lifetime parameter
+   |
+   = note: expected type `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)`
+              found type `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize) {a::<'_, '_, '_>}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/region-object-lifetime-2.nll.stderr b/src/test/ui/regions/region-object-lifetime-2.nll.stderr
new file mode 100644 (file)
index 0000000..56e8c40
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/region-object-lifetime-2.rs:10:5
+   |
+LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () {
+   |                                          -- -- lifetime `'b` defined here
+   |                                          |
+   |                                          lifetime `'a` defined here
+LL |     x.borrowed()
+   |     ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/region-object-lifetime-4.nll.stderr b/src/test/ui/regions/region-object-lifetime-4.nll.stderr
new file mode 100644 (file)
index 0000000..aa91c37
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/region-object-lifetime-4.rs:12:5
+   |
+LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () {
+   |                                         -- -- lifetime `'b` defined here
+   |                                         |
+   |                                         lifetime `'a` defined here
+LL |     x.borrowed()
+   |     ^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr
new file mode 100644 (file)
index 0000000..a54f8f5
--- /dev/null
@@ -0,0 +1,38 @@
+error[E0621]: explicit lifetime required in the type of `v`
+  --> $DIR/region-object-lifetime-in-coercion.rs:8:12
+   |
+LL | fn a(v: &[u8]) -> Box<Foo + 'static> {
+   |         ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+LL |     let x: Box<Foo + 'static> = Box::new(v);
+   |            ^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+  --> $DIR/region-object-lifetime-in-coercion.rs:14:5
+   |
+LL | fn b(v: &[u8]) -> Box<Foo + 'static> {
+   |         ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+  --> $DIR/region-object-lifetime-in-coercion.rs:21:5
+   |
+LL | fn c(v: &[u8]) -> Box<Foo> {
+   |         ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+...
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^ lifetime `'static` required
+
+error: lifetime may not live long enough
+  --> $DIR/region-object-lifetime-in-coercion.rs:26:5
+   |
+LL | fn d<'a,'b>(v: &'a [u8]) -> Box<Foo+'b> {
+   |      -- -- lifetime `'b` defined here
+   |      |
+   |      lifetime `'a` defined here
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/regions/regions-addr-of-self.nll.stderr b/src/test/ui/regions/regions-addr-of-self.nll.stderr
new file mode 100644 (file)
index 0000000..3d7aac7
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-addr-of-self.rs:7:16
+   |
+LL |     pub fn chase_cat(&mut self) {
+   |                      - let's call the lifetime of this reference `'1`
+LL |         let p: &'static mut usize = &mut self.cats_chased;
+   |                ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr
new file mode 100644 (file)
index 0000000..345e617
--- /dev/null
@@ -0,0 +1,35 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-addr-of-upvar-self.rs:10:20
+   |
+LL |         let _f = || {
+   |                  -- lifetime `'1` represents this closure's body
+LL |             let p: &'static mut usize = &mut self.food;
+   |                    ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`
+   |
+   = note: closure implements `FnMut`, so references to captured variables can't escape the closure
+
+error: lifetime may not live long enough
+  --> $DIR/regions-addr-of-upvar-self.rs:10:20
+   |
+LL |     pub fn chase_cat(&mut self) {
+   |                      - let's call the lifetime of this reference `'1`
+LL |         let _f = || {
+LL |             let p: &'static mut usize = &mut self.food;
+   |                    ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`
+
+error[E0597]: `self` does not live long enough
+  --> $DIR/regions-addr-of-upvar-self.rs:10:46
+   |
+LL |         let _f = || {
+   |                  -- value captured here
+LL |             let p: &'static mut usize = &mut self.food;
+   |                    ------------------        ^^^^ borrowed value does not live long enough
+   |                    |
+   |                    type annotation requires that `self` is borrowed for `'static`
+...
+LL |     }
+   |      - `self` dropped here while still borrowed
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..867eafe
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:43:12
+   |
+LL | fn with_assoc<'a,'b>() {
+   |               -- -- lifetime `'b` defined here
+   |               |
+   |               lifetime `'a` defined here
+...
+LL |     let _: &'a WithAssoc<TheType<'b>> = loop { };
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr
new file mode 100644 (file)
index 0000000..86bd100
--- /dev/null
@@ -0,0 +1,50 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:22:5
+   |
+LL | fn param_not_ok<'a>(x: &'a isize) {
+   |                 -- lifetime `'a` defined here
+LL |     assert_send::<&'a isize>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5
+   |
+LL | fn param_not_ok1<'a>(_: &'a isize) {
+   |                  -- lifetime `'a` defined here
+LL |     assert_send::<&'a str>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5
+   |
+LL | fn param_not_ok2<'a>(_: &'a isize) {
+   |                  -- lifetime `'a` defined here
+LL |     assert_send::<&'a [isize]>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5
+   |
+LL | fn box_with_region_not_ok<'a>() {
+   |                           -- lifetime `'a` defined here
+LL |     assert_send::<Box<&'a isize>>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5
+   |
+LL | fn unsafe_ok2<'a>(_: &'a isize) {
+   |               -- lifetime `'a` defined here
+LL |     assert_send::<*const &'a isize>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5
+   |
+LL | fn unsafe_ok3<'a>(_: &'a isize) {
+   |               -- lifetime `'a` defined here
+LL |     assert_send::<*mut &'a isize>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr
new file mode 100644 (file)
index 0000000..a8ab92d
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:20:5
+   |
+LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) {
+   |                       --  -- lifetime `'y` defined here
+   |                       |
+   |                       lifetime `'x` defined here
+LL |     // Here the value provided for 'y is 'y, and hence 'y:'x does not hold.
+LL |     a.bigger_region(b)
+   |     ^^^^^^^^^^^^^^^^^^ argument requires that `'y` must outlive `'x`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr
new file mode 100644 (file)
index 0000000..52ad2d9
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:20:5
+   |
+LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) {
+   |                             -           - `b` is a reference that is only valid in the function body
+   |                             |
+   |                             `a` is declared here, outside of the function body
+LL |     // Here the value provided for 'y is 'b, and hence 'b:'a does not hold.
+LL |     f.method(b);
+   |     ^^^^^^^^^^^ `b` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr
new file mode 100644 (file)
index 0000000..b6d7b8a
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-method-type-parameters.rs:12:9
+   |
+LL | fn caller<'a>(x: &isize) {
+   |           -- lifetime `'a` defined here
+LL |     Foo.some_method::<&'a isize>();
+   |         ^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-bounds.nll.stderr b/src/test/ui/regions/regions-bounds.nll.stderr
new file mode 100644 (file)
index 0000000..3345946
--- /dev/null
@@ -0,0 +1,22 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-bounds.rs:9:12
+   |
+LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> {
+   |          -- -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+LL |     return e;
+   |            ^ returning this value requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounds.rs:13:12
+   |
+LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> {
+   |          -- -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+LL |     return e;
+   |            ^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr
new file mode 100644 (file)
index 0000000..92c4956
--- /dev/null
@@ -0,0 +1,36 @@
+error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
+  --> $DIR/regions-close-associated-type-into-object.rs:15:5
+   |
+LL |     Box::new(item)
+   |     ^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
+
+error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
+  --> $DIR/regions-close-associated-type-into-object.rs:22:5
+   |
+LL |     Box::new(item)
+   |     ^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
+
+error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
+  --> $DIR/regions-close-associated-type-into-object.rs:28:5
+   |
+LL |     Box::new(item)
+   |     ^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
+
+error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
+  --> $DIR/regions-close-associated-type-into-object.rs:35:5
+   |
+LL |     Box::new(item)
+   |     ^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr
new file mode 100644 (file)
index 0000000..42df9b1
--- /dev/null
@@ -0,0 +1,20 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-close-object-into-object-2.rs:10:5
+   |
+LL | fn g<'a, T: 'static>(v: Box<A<T>+'a>) -> Box<X+'static> {
+   |      -- lifetime `'a` defined here
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error[E0515]: cannot return value referencing local data `*v`
+  --> $DIR/regions-close-object-into-object-2.rs:10:5
+   |
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^---^^^^^^^^^^^
+   |     |     |
+   |     |     `*v` is borrowed here
+   |     returns a value referencing data owned by the current function
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr
new file mode 100644 (file)
index 0000000..8af94fa
--- /dev/null
@@ -0,0 +1,37 @@
+error[E0310]: the parameter type `U` may not live long enough
+  --> $DIR/regions-close-object-into-object-4.rs:10:5
+   |
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `U: 'static`...
+
+error: lifetime may not live long enough
+  --> $DIR/regions-close-object-into-object-4.rs:10:5
+   |
+LL | fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> {
+   |      -- lifetime `'a` defined here
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error[E0515]: cannot return value referencing local data `*v`
+  --> $DIR/regions-close-object-into-object-4.rs:10:5
+   |
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^---^^^^^^^^^^^
+   |     |     |
+   |     |     `*v` is borrowed here
+   |     returns a value referencing data owned by the current function
+
+error[E0310]: the parameter type `U` may not live long enough
+  --> $DIR/regions-close-object-into-object-4.rs:10:9
+   |
+LL |     box B(&*v) as Box<X>
+   |         ^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `U: 'static`...
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0310, E0515.
+For more information about an error, try `rustc --explain E0310`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr
new file mode 100644 (file)
index 0000000..08ba1b1
--- /dev/null
@@ -0,0 +1,29 @@
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-object-into-object-5.rs:17:5
+   |
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error[E0515]: cannot return value referencing local data `*v`
+  --> $DIR/regions-close-object-into-object-5.rs:17:5
+   |
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^---^^^^^^^^^^^
+   |     |     |
+   |     |     `*v` is borrowed here
+   |     returns a value referencing data owned by the current function
+
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-object-into-object-5.rs:17:9
+   |
+LL |     box B(&*v) as Box<X>
+   |         ^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0310, E0515.
+For more information about an error, try `rustc --explain E0310`.
diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr
new file mode 100644 (file)
index 0000000..30fdb82
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0310]: the parameter type `A` may not live long enough
+  --> $DIR/regions-close-over-type-parameter-1.rs:10:5
+   |
+LL |     box v as Box<SomeTrait+'static>
+   |     ^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `A: 'static`...
+
+error[E0309]: the parameter type `A` may not live long enough
+  --> $DIR/regions-close-over-type-parameter-1.rs:20:5
+   |
+LL |     box v as Box<SomeTrait+'b>
+   |     ^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `A: 'b`...
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr
new file mode 100644 (file)
index 0000000..001ed7f
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5
+   |
+LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<SomeTrait+'c> {
+   |                    --    -- lifetime `'c` defined here
+   |                    |
+   |                    lifetime `'a` defined here
+LL |     // A outlives 'a AND 'b...but not 'c.
+LL |     box v as Box<SomeTrait+'a>
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'c`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-close-param-into-object.nll.stderr b/src/test/ui/regions/regions-close-param-into-object.nll.stderr
new file mode 100644 (file)
index 0000000..7bd7824
--- /dev/null
@@ -0,0 +1,36 @@
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-param-into-object.rs:6:5
+   |
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-param-into-object.rs:12:5
+   |
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error[E0309]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-param-into-object.rs:18:5
+   |
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'a`...
+
+error[E0309]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-param-into-object.rs:24:5
+   |
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'a`...
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-creating-enums3.nll.stderr b/src/test/ui/regions/regions-creating-enums3.nll.stderr
new file mode 100644 (file)
index 0000000..e35a878
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-creating-enums3.rs:7:5
+   |
+LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> {
+   |                -- -- lifetime `'b` defined here
+   |                |
+   |                lifetime `'a` defined here
+LL |     Ast::Add(x, y)
+   |     ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-creating-enums4.nll.stderr b/src/test/ui/regions/regions-creating-enums4.nll.stderr
new file mode 100644 (file)
index 0000000..4eac457
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-creating-enums4.rs:7:5
+   |
+LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> {
+   |                -- -- lifetime `'b` defined here
+   |                |
+   |                lifetime `'a` defined here
+LL |     Ast::Add(x, y)
+   |     ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr
new file mode 100644 (file)
index 0000000..1540a7b
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-early-bound-error-method.rs:20:9
+   |
+LL | impl<'a> Box<'a> {
+   |      -- lifetime `'a` defined here
+LL |     fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize {
+   |           -- lifetime `'b` defined here
+LL |         g2.get()
+   |         ^^^^^^^^ returning this value requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-early-bound-error.nll.stderr b/src/test/ui/regions/regions-early-bound-error.nll.stderr
new file mode 100644 (file)
index 0000000..7836291
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-early-bound-error.rs:19:5
+   |
+LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize {
+   |        -- -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+LL |     g1.get()
+   |     ^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-escape-method.nll.stderr b/src/test/ui/regions/regions-escape-method.nll.stderr
new file mode 100644 (file)
index 0000000..9f42512
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-escape-method.rs:15:13
+   |
+LL |     s.f(|p| p)
+   |          -- ^ returning this value requires that `'1` must outlive `'2`
+   |          ||
+   |          |return type of closure is &'2 i32
+   |          has type `&'1 i32`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr b/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr
new file mode 100644 (file)
index 0000000..cae6c33
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-escape-via-trait-or-not.rs:18:14
+   |
+LL |     with(|o| o)
+   |           -- ^ returning this value requires that `'1` must outlive `'2`
+   |           ||
+   |           |return type of closure is &'2 isize
+   |           has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr
new file mode 100644 (file)
index 0000000..9ae484e
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-callee.rs:13:5
+   |
+LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize {
+   |              --  -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+LL |     // However, it is not safe to assume that 'b <= 'a
+LL |     &*y
+   |     ^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-callee.rs:18:12
+   |
+LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize {
+   |              --  -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+LL |     // Do not infer an ordering from the return value.
+LL |     let z: &'b usize = &*x;
+   |            ^^^^^^^^^ type annotation requires that `'a` must outlive `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..16eda28
--- /dev/null
@@ -0,0 +1,33 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-caller.rs:11:12
+   |
+LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
+   |          --  -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+LL |     let z: Option<&'b &'a usize> = None;
+   |            ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-caller.rs:17:12
+   |
+LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
+   |          --  -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+LL |     let y: Paramd<'a> = Paramd { x: a };
+LL |     let z: Option<&'b Paramd<'a>> = None;
+   |            ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-caller.rs:22:12
+   |
+LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
+   |          --  -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+LL |     let z: Option<&'a &'b usize> = None;
+   |            ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr
new file mode 100644 (file)
index 0000000..480a81d
--- /dev/null
@@ -0,0 +1,15 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-incorrect.rs:15:9
+   |
+LL |   impl<'b, T> Node<'b, T> {
+   |        -- lifetime `'b` defined here
+LL |       fn get<'a>(&'a self) -> &'b T {
+   |              -- lifetime `'a` defined here
+LL | /         match self.next {
+LL | |             Some(ref next) => next.get(),
+LL | |             None => &self.val
+LL | |         }
+   | |_________^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr
new file mode 100644 (file)
index 0000000..0f0f86d
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0309]: the parameter type `T` may not live long enough
+  --> $DIR/regions-implied-bounds-projection-gap-1.rs:16:5
+   |
+LL |     wf::<&'x T>();
+   |     ^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'x`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr
new file mode 100644 (file)
index 0000000..0651e30
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0309]: the parameter type `Self` may not live long enough
+  --> $DIR/regions-infer-bound-from-trait-self.rs:46:9
+   |
+LL |         check_bound(x, self)
+   |         ^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `Self: 'a`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr
new file mode 100644 (file)
index 0000000..1f7b34f
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0309]: the parameter type `A` may not live long enough
+  --> $DIR/regions-infer-bound-from-trait.rs:33:5
+   |
+LL |     check_bound(x, a)
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `A: 'a`...
+
+error[E0309]: the parameter type `A` may not live long enough
+  --> $DIR/regions-infer-bound-from-trait.rs:37:5
+   |
+LL |     check_bound(x, a)
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `A: 'a`...
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-infer-call-3.nll.stderr b/src/test/ui/regions/regions-infer-call-3.nll.stderr
new file mode 100644 (file)
index 0000000..ca51555
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-call-3.rs:8:24
+   |
+LL |     let z = with(|y| { select(x, y) });
+   |                   --   ^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
+   |                   ||
+   |                   |return type of closure is &'2 isize
+   |                   has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr
new file mode 100644 (file)
index 0000000..cefeecf
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-contravariance-due-to-decl.rs:25:12
+   |
+LL | fn use_<'short,'long>(c: Contravariant<'short>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Contravariant<'long> = c;
+   |            ^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr
new file mode 100644 (file)
index 0000000..1bddecb
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-covariance-due-to-decl.rs:22:12
+   |
+LL | fn use_<'short,'long>(c: Covariant<'long>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Covariant<'short> = c;
+   |            ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr
new file mode 100644 (file)
index 0000000..0c1e398
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-invariance-due-to-decl.rs:12:5
+   |
+LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
+   |                       -- lifetime `'r` defined here
+LL |     b_isize
+   |     ^^^^^^^ returning this value requires that `'r` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr
new file mode 100644 (file)
index 0000000..0edeb27
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:10:5
+   |
+LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
+   |                       -- lifetime `'r` defined here
+LL |     b_isize
+   |     ^^^^^^^ returning this value requires that `'r` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr
new file mode 100644 (file)
index 0000000..724dd7e
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5
+   |
+LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
+   |                       -- lifetime `'r` defined here
+LL |     b_isize
+   |     ^^^^^^^ returning this value requires that `'r` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-not-param.nll.stderr b/src/test/ui/regions/regions-infer-not-param.nll.stderr
new file mode 100644 (file)
index 0000000..2064b06
--- /dev/null
@@ -0,0 +1,26 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-not-param.rs:15:54
+   |
+LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p }
+   |                -- -- lifetime `'b` defined here      ^ returning this value requires that `'a` must outlive `'b`
+   |                |
+   |                lifetime `'a` defined here
+
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-not-param.rs:19:63
+   |
+LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p }
+   |                   -- -- lifetime `'b` defined here            ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+   |                   |
+   |                   lifetime `'a` defined here
+
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-not-param.rs:19:63
+   |
+LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p }
+   |                   -- -- lifetime `'b` defined here            ^ returning this value requires that `'a` must outlive `'b`
+   |                   |
+   |                   lifetime `'a` defined here
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr
new file mode 100644 (file)
index 0000000..a86e6cc
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-paramd-indirect.rs:22:9
+   |
+LL | impl<'a> SetF<'a> for C<'a> {
+   |      -- lifetime `'a` defined here
+...
+LL |     fn set_f_bad(&mut self, b: Box<B>) {
+   |                             - has type `std::boxed::Box<std::boxed::Box<&'1 isize>>`
+LL |         self.f = b;
+   |         ^^^^^^ assignment requires that `'1` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr
new file mode 100644 (file)
index 0000000..e1f14fc
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/regions-lifetime-bounds-on-fns.rs:20:43
+   |
+LL |     let _: fn(&mut &isize, &mut &isize) = a;
+   |                                           ^ expected concrete lifetime, found bound lifetime parameter
+   |
+   = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
+              found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr
new file mode 100644 (file)
index 0000000..c11c09b
--- /dev/null
@@ -0,0 +1,51 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/regions-nested-fns.rs:10:9
+   |
+LL |     let mut ay = &y;
+   |         ------ `ay` is declared here, outside of the closure body
+LL | 
+LL |     ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
+   |                                                       - `z` is a reference that is only valid in the closure body
+...
+LL |         ay = z;
+   |         ^^^^^^ `z` escapes the closure body here
+
+error[E0597]: `y` does not live long enough
+  --> $DIR/regions-nested-fns.rs:5:18
+   |
+LL |     let mut ay = &y;
+   |                  ^^ borrowed value does not live long enough
+...
+LL |         if false { return ay; }
+   |                           -- returning this value requires that `y` is borrowed for `'static`
+...
+LL | }
+   | - `y` dropped here while still borrowed
+
+error[E0597]: `y` does not live long enough
+  --> $DIR/regions-nested-fns.rs:9:15
+   |
+LL |     ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
+   |                                                      --- value captured here
+LL |         ay = x;
+LL |         ay = &y;
+   |               ^ borrowed value does not live long enough
+...
+LL |         if false { return ay; }
+   |                           -- returning this value requires that `y` is borrowed for `'static`
+...
+LL | }
+   | - `y` dropped here while still borrowed
+
+error: lifetime may not live long enough
+  --> $DIR/regions-nested-fns.rs:14:27
+   |
+LL | fn nested<'x>(x: &'x isize) {
+   |           -- lifetime `'x` defined here
+...
+LL |         if false { return x; }
+   |                           ^ returning this value requires that `'x` must outlive `'static`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..5028663
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container-hrtb.rs:35:12
+   |
+LL | fn with_assoc<'a,'b>() {
+   |               -- -- lifetime `'b` defined here
+   |               |
+   |               lifetime `'a` defined here
+...
+LL |     let _: &'a WithHrAssoc<TheType<'b>> = loop { };
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container-hrtb.rs:57:12
+   |
+LL | fn with_assoc_sub<'a,'b>() {
+   |                   -- -- lifetime `'b` defined here
+   |                   |
+   |                   lifetime `'a` defined here
+...
+LL |     let _: &'a WithHrAssocSub<TheType<'b>> = loop { };
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..880fe17
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container-wc.rs:37:12
+   |
+LL | fn with_assoc<'a,'b>() {
+   |               -- -- lifetime `'b` defined here
+   |               |
+   |               lifetime `'a` defined here
+...
+LL |     let _: &'a WithAssoc<TheType<'b>> = loop { };
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-outlives-projection-container.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container.nll.stderr
new file mode 100644 (file)
index 0000000..ef87d02
--- /dev/null
@@ -0,0 +1,46 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container.rs:40:13
+   |
+LL | fn with_assoc<'a,'b>() {
+   |               -- -- lifetime `'b` defined here
+   |               |
+   |               lifetime `'a` defined here
+...
+LL |     let _x: &'a WithAssoc<TheType<'b>> = loop { };
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container.rs:58:13
+   |
+LL | fn without_assoc<'a,'b>() {
+   |                  -- -- lifetime `'b` defined here
+   |                  |
+   |                  lifetime `'a` defined here
+...
+LL |     let _x: &'a WithoutAssoc<TheType<'b>> = loop { };
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container.rs:67:5
+   |
+LL | fn call_with_assoc<'a,'b>() {
+   |                    -- -- lifetime `'b` defined here
+   |                    |
+   |                    lifetime `'a` defined here
+...
+LL |     call::<&'a WithAssoc<TheType<'b>>>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container.rs:74:5
+   |
+LL | fn call_without_assoc<'a,'b>() {
+   |                       -- -- lifetime `'b` defined here
+   |                       |
+   |                       lifetime `'a` defined here
+...
+LL |     call::<&'a WithoutAssoc<TheType<'b>>>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr
new file mode 100644 (file)
index 0000000..c8582f8
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:4:5
+   |
+LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize {
+   |                      --  -- lifetime `'b` defined here
+   |                      |
+   |                      lifetime `'a` defined here
+LL |     &mut ***p
+   |     ^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr
new file mode 100644 (file)
index 0000000..5946e7b
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:6:5
+   |
+LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize {
+   |                      --  -- lifetime `'b` defined here
+   |                      |
+   |                      lifetime `'a` defined here
+LL |     &mut **p
+   |     ^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr b/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr
new file mode 100644 (file)
index 0000000..0784e89
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-ret-borrowed-1.rs:10:14
+   |
+LL |     with(|o| o)
+   |           -- ^ returning this value requires that `'1` must outlive `'2`
+   |           ||
+   |           |return type of closure is &'2 isize
+   |           has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-ret-borrowed.nll.stderr b/src/test/ui/regions/regions-ret-borrowed.nll.stderr
new file mode 100644 (file)
index 0000000..d9be5ef
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-ret-borrowed.rs:13:14
+   |
+LL |     with(|o| o)
+   |           -- ^ returning this value requires that `'1` must outlive `'2`
+   |           ||
+   |           |return type of closure is &'2 isize
+   |           has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr
new file mode 100644 (file)
index 0000000..4c275b1
--- /dev/null
@@ -0,0 +1,13 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24
+   |
+LL |         let mut f = || &mut x;
+   |                      - ^^^^^^ returns a reference to a captured variable which escapes the closure body
+   |                      |
+   |                      inferred to be a `FnMut` closure
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-static-bound.ll.nll.stderr b/src/test/ui/regions/regions-static-bound.ll.nll.stderr
new file mode 100644 (file)
index 0000000..d6cec03
--- /dev/null
@@ -0,0 +1,28 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-static-bound.rs:9:5
+   |
+LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
+   |                        -- lifetime `'a` defined here
+LL |     t //[ll]~ ERROR E0312
+   |     ^ returning this value requires that `'a` must outlive `'static`
+
+error[E0621]: explicit lifetime required in the type of `u`
+  --> $DIR/regions-static-bound.rs:14:5
+   |
+LL | fn error(u: &(), v: &()) {
+   |             --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
+LL |     static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
+   |     ^^^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+  --> $DIR/regions-static-bound.rs:16:5
+   |
+LL | fn error(u: &(), v: &()) {
+   |                     --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
+...
+LL |     static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
+   |     ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/regions/regions-static-bound.migrate.nll.stderr b/src/test/ui/regions/regions-static-bound.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..b5f3e6c
--- /dev/null
@@ -0,0 +1,28 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-static-bound.rs:9:5
+   |
+LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
+   |                        -- lifetime `'a` defined here
+LL |     t
+   |     ^ returning this value requires that `'a` must outlive `'static`
+
+error[E0621]: explicit lifetime required in the type of `u`
+  --> $DIR/regions-static-bound.rs:14:5
+   |
+LL | fn error(u: &(), v: &()) {
+   |             --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
+LL |     static_id(&u);
+   |     ^^^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+  --> $DIR/regions-static-bound.rs:16:5
+   |
+LL | fn error(u: &(), v: &()) {
+   |                     --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
+...
+LL |     static_id_indirect(&v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr
new file mode 100644 (file)
index 0000000..eccf1b5
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-trait-object-subtyping.rs:15:5
+   |
+LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
+   |         -- -- lifetime `'b` defined here
+   |         |
+   |         lifetime `'a` defined here
+LL |     // Without knowing 'a:'b, we can't coerce
+LL |     x
+   |     ^ returning this value requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-trait-object-subtyping.rs:22:5
+   |
+LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> {
+   |         --    -- lifetime `'b` defined here
+   |         |
+   |         lifetime `'a` defined here
+LL |     // We can't coerce because it is packed in `Wrapper`
+LL |     x
+   |     ^ returning this value requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr
new file mode 100644 (file)
index 0000000..f5b96f3
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:25:12
+   |
+LL | fn use_<'short,'long>(c: S<'long, 'short>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: S<'long, 'long> = c;
+   |            ^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr
new file mode 100644 (file)
index 0000000..372510a
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-variance-contravariant-use-covariant.rs:23:12
+   |
+LL | fn use_<'short,'long>(c: Contravariant<'short>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Contravariant<'long> = c;
+   |            ^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr
new file mode 100644 (file)
index 0000000..e87e914
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-variance-covariant-use-contravariant.rs:23:12
+   |
+LL | fn use_<'short,'long>(c: Covariant<'long>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Covariant<'short> = c;
+   |            ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr
new file mode 100644 (file)
index 0000000..adee33b
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-variance-invariant-use-contravariant.rs:20:12
+   |
+LL | fn use_<'short,'long>(c: Invariant<'long>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Invariant<'short> = c;
+   |            ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr
new file mode 100644 (file)
index 0000000..15853e6
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-variance-invariant-use-covariant.rs:17:12
+   |
+LL | fn use_<'b>(c: Invariant<'b>) {
+   |         -- lifetime `'b` defined here
+...
+LL |     let _: Invariant<'static> = c;
+   |            ^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'static`
+
+error: aborting due to previous error
+
index 2f3c094ff3954b8d53e529e48569e0249528c18b..7b499af632ecee2645fe079cde2cbfe6e9b342c6 100644 (file)
@@ -4,7 +4,6 @@
 
 // compile-pass
 
-#![feature(nll)]
 #![feature(bind_by_move_pattern_guards)]
 
 use std::sync::mpsc::channel;
index 9a9d11ce1b13ed37d893361ee6ffb9eb9ad74db4..aca6aa5f0f8676dd6369f9b37a367361aadeb684 100644 (file)
@@ -1,4 +1,3 @@
-#![feature(nll)]
 #![feature(bind_by_move_pattern_guards)]
 
 // compile-pass
diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr
new file mode 100644 (file)
index 0000000..c74b82d
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-issue-49631.rs:20:9
+   |
+LL |     while let Some(Ok(string)) = foo.get() {
+   |                                  --- immutable borrow occurs here
+LL |         foo.mutate();
+   |         ^^^ mutable borrow occurs here
+LL |
+LL |         println!("foo={:?}", *string);
+   |                              ------- immutable borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
index e2a7ac349ecd5ce6f3515ce9404cc6683ea2ccb3..e885263aa80840863fe5b44eb1a8381e171ec707 100644 (file)
@@ -1,6 +1,7 @@
 // run-pass
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
+// ignore-sgx no processes
 
 // Tests ensuring that `dbg!(expr)` has the expected run-time behavior.
 // as well as some compile time properties we expect.
@@ -69,44 +70,44 @@ fn f<'a>(x: &'a u8) -> &'a u8 { x }
 
 fn validate_stderr(stderr: Vec<String>) {
     assert_eq!(stderr, &[
-        ":21] Unit = Unit",
+        ":22] Unit = Unit",
 
-        ":22] a = Unit",
+        ":23] a = Unit",
 
-        ":28] Point{x: 42, y: 24,} = Point {",
+        ":29] Point{x: 42, y: 24,} = Point {",
         "    x: 42,",
         "    y: 24,",
         "}",
 
-        ":29] b = Point {",
+        ":30] b = Point {",
         "    x: 42,",
         "    y: 24,",
         "}",
 
-        ":37]",
+        ":38]",
 
-        ":41] &a = NoCopy(",
+        ":42] &a = NoCopy(",
         "    1337,",
         ")",
 
-        ":41] dbg!(& a) = NoCopy(",
+        ":42] dbg!(& a) = NoCopy(",
         "    1337,",
         ")",
-        ":46] f(&42) = 42",
+        ":47] f(&42) = 42",
 
         "before",
-        ":51] { foo += 1; eprintln!(\"before\"); 7331 } = 7331",
+        ":52] { foo += 1; eprintln!(\"before\"); 7331 } = 7331",
 
-        ":59] (\"Yeah\",) = (",
+        ":60] (\"Yeah\",) = (",
         "    \"Yeah\",",
         ")",
 
-        ":62] 1 = 1",
-        ":62] 2 = 2",
+        ":63] 1 = 1",
+        ":63] 2 = 2",
 
-        ":66] 1u8 = 1",
-        ":66] 2u32 = 2",
-        ":66] \"Yeah\" = \"Yeah\"",
+        ":67] 1u8 = 1",
+        ":67] 2u32 = 2",
+        ":67] \"Yeah\" = \"Yeah\"",
     ]);
 }
 
index ddd9abbd50ed8abed5a4853db71aeb8c2c9e5199..e51ce5d1d5b83e48bfc48e65be4538175ec9178b 100644 (file)
 
 //~^ ERROR unused extern crate
 
-use edition_lint_paths as bar;
-//~^ ERROR `extern crate` is not idiomatic in the new edition
+// Shouldn't suggest changing to `use`, as `bar`
+// would no longer be added to the prelude which could cause
+// compilation errors for imports that use `bar` in other
+// modules. See #57672.
+extern crate edition_lint_paths as bar;
 
 fn main() {
     // This is not considered to *use* the `extern crate` in Rust 2018:
index 47674bc19fc044614791f543f522f0d3005ae953..debbf085d618293d1ed901a4e535cf6f21414fbc 100644 (file)
 extern crate edition_lint_paths;
 //~^ ERROR unused extern crate
 
+// Shouldn't suggest changing to `use`, as `bar`
+// would no longer be added to the prelude which could cause
+// compilation errors for imports that use `bar` in other
+// modules. See #57672.
 extern crate edition_lint_paths as bar;
-//~^ ERROR `extern crate` is not idiomatic in the new edition
 
 fn main() {
     // This is not considered to *use* the `extern crate` in Rust 2018:
index f3f9193948667173bc6d68a756c239cf7333f928..13980c70a82aa219082d4271dd59b17112c8f498 100644 (file)
@@ -11,11 +11,5 @@ LL | #![deny(rust_2018_idioms)]
    |         ^^^^^^^^^^^^^^^^
    = note: #[deny(unused_extern_crates)] implied by #[deny(rust_2018_idioms)]
 
-error: `extern crate` is not idiomatic in the new edition
-  --> $DIR/extern-crate-idiomatic-in-2018.rs:15:1
-   |
-LL | extern crate edition_lint_paths as bar;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index 17449caf84fb41ea835e42a5c56b9378ca93d0f9..14575d18c236aa3275b669bdaae93c6bd1f1c887 100644 (file)
@@ -7,7 +7,11 @@
 #![warn(rust_2018_idioms)]
 
 
-use core as another_name;
+// Shouldn't suggest changing to `use`, as `another_name`
+// would no longer be added to the prelude which could cause
+// compilation errors for imports that use `another_name` in other
+// modules. See #57672.
+extern crate core as another_name;
 use remove_extern_crate;
 #[macro_use]
 extern crate remove_extern_crate as something_else;
index fb2217df0005d4e8c7e250a54cea76473d8ea222..0ee85f34e40d99c98bbdb9bbc1649af77bcec8b5 100644 (file)
@@ -7,6 +7,10 @@
 #![warn(rust_2018_idioms)]
 
 extern crate core;
+// Shouldn't suggest changing to `use`, as `another_name`
+// would no longer be added to the prelude which could cause
+// compilation errors for imports that use `another_name` in other
+// modules. See #57672.
 extern crate core as another_name;
 use remove_extern_crate;
 #[macro_use]
index 549693201b70346a426bb61cb7a10723abcf3716..5de0dfe961338701d99e17fa1cfac2b5d848cf08 100644 (file)
@@ -12,13 +12,7 @@ LL | #![warn(rust_2018_idioms)]
    = note: #[warn(unused_extern_crates)] implied by #[warn(rust_2018_idioms)]
 
 warning: `extern crate` is not idiomatic in the new edition
-  --> $DIR/remove-extern-crate.rs:10:1
-   |
-LL | extern crate core as another_name;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
-
-warning: `extern crate` is not idiomatic in the new edition
-  --> $DIR/remove-extern-crate.rs:28:5
+  --> $DIR/remove-extern-crate.rs:32:5
    |
 LL |     extern crate core;
    |     ^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.rs b/src/test/ui/self/arbitrary-self-types-not-object-safe.rs
new file mode 100644 (file)
index 0000000..2c1fd93
--- /dev/null
@@ -0,0 +1,41 @@
+#![feature(arbitrary_self_types)]
+
+use std::rc::Rc;
+
+trait Foo {
+    fn foo(self: &Rc<Self>) -> usize;
+}
+
+trait Bar {
+    fn foo(self: &Rc<Self>) -> usize where Self: Sized;
+    fn bar(self: Rc<Self>) -> usize;
+}
+
+impl Foo for usize {
+    fn foo(self: &Rc<Self>) -> usize {
+        **self
+    }
+}
+
+impl Bar for usize {
+    fn foo(self: &Rc<Self>) -> usize {
+        **self
+    }
+
+    fn bar(self: Rc<Self>) -> usize {
+        *self
+    }
+}
+
+fn make_foo() {
+    let x = Rc::new(5usize) as Rc<Foo>;
+    //~^ ERROR E0038
+    //~| ERROR E0038
+}
+
+fn make_bar() {
+    let x = Rc::new(5usize) as Rc<Bar>;
+    x.bar();
+}
+
+fn main() {}
diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr b/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr
new file mode 100644 (file)
index 0000000..dacab12
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0038]: the trait `Foo` cannot be made into an object
+  --> $DIR/arbitrary-self-types-not-object-safe.rs:31:32
+   |
+LL |     let x = Rc::new(5usize) as Rc<Foo>;
+   |                                ^^^^^^^ the trait `Foo` cannot be made into an object
+   |
+   = note: method `foo`'s receiver cannot be dispatched on
+
+error[E0038]: the trait `Foo` cannot be made into an object
+  --> $DIR/arbitrary-self-types-not-object-safe.rs:31:13
+   |
+LL |     let x = Rc::new(5usize) as Rc<Foo>;
+   |             ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
+   |
+   = note: method `foo`'s receiver cannot be dispatched on
+   = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::rc::Rc<dyn Foo>>` for `std::rc::Rc<usize>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/src/test/ui/self/arbitrary_self_types_pointers_and_wrappers.rs b/src/test/ui/self/arbitrary_self_types_pointers_and_wrappers.rs
new file mode 100644 (file)
index 0000000..65fec3b
--- /dev/null
@@ -0,0 +1,68 @@
+// run-pass
+#![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)]
+#![feature(rustc_attrs)]
+
+use std::{
+    ops::{Deref, CoerceUnsized, DispatchFromDyn},
+    marker::Unsize,
+};
+
+struct Ptr<T: ?Sized>(Box<T>);
+
+impl<T: ?Sized> Deref for Ptr<T> {
+    type Target = T;
+
+    fn deref(&self) -> &T {
+        &*self.0
+    }
+}
+
+impl<T: Unsize<U> + ?Sized, U: ?Sized> CoerceUnsized<Ptr<U>> for Ptr<T> {}
+impl<T: Unsize<U> + ?Sized, U: ?Sized> DispatchFromDyn<Ptr<U>> for Ptr<T> {}
+
+struct Wrapper<T: ?Sized>(T);
+
+impl<T: ?Sized> Deref for Wrapper<T> {
+    type Target = T;
+
+    fn deref(&self) -> &T {
+        &self.0
+    }
+}
+
+impl<T: CoerceUnsized<U>, U> CoerceUnsized<Wrapper<U>> for Wrapper<T> {}
+impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<Wrapper<U>> for Wrapper<T> {}
+
+
+trait Trait {
+    // This method isn't object-safe yet. Unsized by-value `self` is object-safe (but not callable
+    // without unsized_locals), but wrappers arond `Self` currently are not.
+    // FIXME (mikeyhew) uncomment this when unsized rvalues object-safety is implemented
+    // fn wrapper(self: Wrapper<Self>) -> i32;
+    fn ptr_wrapper(self: Ptr<Wrapper<Self>>) -> i32;
+    fn wrapper_ptr(self: Wrapper<Ptr<Self>>) -> i32;
+    fn wrapper_ptr_wrapper(self: Wrapper<Ptr<Wrapper<Self>>>) -> i32;
+}
+
+impl Trait for i32 {
+    fn ptr_wrapper(self: Ptr<Wrapper<Self>>) -> i32 {
+        **self
+    }
+    fn wrapper_ptr(self: Wrapper<Ptr<Self>>) -> i32 {
+        **self
+    }
+    fn wrapper_ptr_wrapper(self: Wrapper<Ptr<Wrapper<Self>>>) -> i32 {
+        ***self
+    }
+}
+
+fn main() {
+    let pw = Ptr(Box::new(Wrapper(5))) as Ptr<Wrapper<dyn Trait>>;
+    assert_eq!(pw.ptr_wrapper(), 5);
+
+    let wp = Wrapper(Ptr(Box::new(6))) as Wrapper<Ptr<dyn Trait>>;
+    assert_eq!(wp.wrapper_ptr(), 6);
+
+    let wpw = Wrapper(Ptr(Box::new(Wrapper(7)))) as Wrapper<Ptr<Wrapper<dyn Trait>>>;
+    assert_eq!(wpw.wrapper_ptr_wrapper(), 7);
+}
diff --git a/src/test/ui/self/arbitrary_self_types_raw_pointer_struct.rs b/src/test/ui/self/arbitrary_self_types_raw_pointer_struct.rs
new file mode 100644 (file)
index 0000000..0eab761
--- /dev/null
@@ -0,0 +1,28 @@
+// run-pass
+#![feature(arbitrary_self_types)]
+
+use std::rc::Rc;
+
+struct Foo(String);
+
+impl Foo {
+    unsafe fn foo(self: *const Self) -> *const str {
+        (*self).0.as_ref()
+    }
+
+    fn complicated_1(self: *const Rc<Self>) -> &'static str {
+        "Foo::complicated_1"
+    }
+
+    unsafe fn complicated_2(self: Rc<*const Self>) -> *const str {
+        (**self).0.as_ref()
+    }
+}
+
+fn main() {
+    let foo = Foo("abc123".into());
+    assert_eq!("abc123", unsafe { &*(&foo as *const Foo).foo() });
+    assert_eq!("Foo::complicated_1", std::ptr::null::<Rc<Foo>>().complicated_1());
+    let rc = Rc::new(&foo as *const Foo);
+    assert_eq!("abc123", unsafe { &*rc.complicated_2()});
+}
diff --git a/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs b/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs
new file mode 100644 (file)
index 0000000..acbe896
--- /dev/null
@@ -0,0 +1,61 @@
+// run-pass
+#![feature(arbitrary_self_types)]
+
+use std::ptr;
+
+trait Foo {
+    fn foo(self: *const Self) -> &'static str;
+
+    unsafe fn bar(self: *const Self) -> i64;
+
+    unsafe fn complicated(self: *const *const Self) -> i64 where Self: Sized {
+        (*self).bar()
+    }
+}
+
+impl Foo for i32 {
+    fn foo(self: *const Self) -> &'static str {
+        "I'm an i32!"
+    }
+
+    unsafe fn bar(self: *const Self) -> i64 {
+        *self as i64
+    }
+}
+
+impl Foo for u32 {
+    fn foo(self: *const Self) -> &'static str {
+        "I'm a u32!"
+    }
+
+    unsafe fn bar(self: *const Self) -> i64 {
+        *self as i64
+    }
+}
+
+fn main() {
+    let null_i32 = ptr::null::<i32>() as *const Foo;
+    let null_u32 = ptr::null::<u32>() as *const Foo;
+
+    assert_eq!("I'm an i32!", null_i32.foo());
+    assert_eq!("I'm a u32!", null_u32.foo());
+
+    let valid_i32 = 5i32;
+    let valid_i32_thin = &valid_i32 as *const i32;
+    assert_eq!("I'm an i32!", valid_i32_thin.foo());
+    assert_eq!(5, unsafe { valid_i32_thin.bar() });
+    assert_eq!(5, unsafe { (&valid_i32_thin as *const *const i32).complicated() });
+    let valid_i32_fat = valid_i32_thin as *const Foo;
+    assert_eq!("I'm an i32!", valid_i32_fat.foo());
+    assert_eq!(5, unsafe { valid_i32_fat.bar() });
+
+    let valid_u32 = 18u32;
+    let valid_u32_thin = &valid_u32 as *const u32;
+    assert_eq!("I'm a u32!", valid_u32_thin.foo());
+    assert_eq!(18, unsafe { valid_u32_thin.bar() });
+    assert_eq!(18, unsafe { (&valid_u32_thin as *const *const u32).complicated() });
+    let valid_u32_fat = valid_u32_thin as *const Foo;
+    assert_eq!("I'm a u32!", valid_u32_fat.foo());
+    assert_eq!(18, unsafe { valid_u32_fat.bar() });
+
+}
diff --git a/src/test/ui/self/arbitrary_self_types_silly.rs b/src/test/ui/self/arbitrary_self_types_silly.rs
new file mode 100644 (file)
index 0000000..fb5f901
--- /dev/null
@@ -0,0 +1,21 @@
+// run-pass
+#![feature(arbitrary_self_types)]
+
+struct Foo;
+struct Bar;
+
+impl std::ops::Deref for Bar {
+    type Target = Foo;
+
+    fn deref(&self) -> &Foo {
+        &Foo
+    }
+}
+
+impl Foo {
+    fn bar(self: Bar) -> i32 { 3 }
+}
+
+fn main() {
+    assert_eq!(3, Bar.bar());
+}
diff --git a/src/test/ui/self/arbitrary_self_types_stdlib_pointers.rs b/src/test/ui/self/arbitrary_self_types_stdlib_pointers.rs
new file mode 100644 (file)
index 0000000..29563fb
--- /dev/null
@@ -0,0 +1,54 @@
+// run-pass
+#![feature(arbitrary_self_types)]
+#![feature(rustc_attrs)]
+
+use std::{
+    rc::Rc,
+    sync::Arc,
+    pin::Pin,
+};
+
+trait Trait {
+    fn by_rc(self: Rc<Self>) -> i64;
+    fn by_arc(self: Arc<Self>) -> i64;
+    fn by_pin_mut(self: Pin<&mut Self>) -> i64;
+    fn by_pin_box(self: Pin<Box<Self>>) -> i64;
+    fn by_pin_pin_pin_ref(self: Pin<Pin<Pin<&Self>>>) -> i64;
+}
+
+impl Trait for i64 {
+    fn by_rc(self: Rc<Self>) -> i64 {
+        *self
+    }
+    fn by_arc(self: Arc<Self>) -> i64 {
+        *self
+    }
+    fn by_pin_mut(self: Pin<&mut Self>) -> i64 {
+        *self
+    }
+    fn by_pin_box(self: Pin<Box<Self>>) -> i64 {
+        *self
+    }
+    fn by_pin_pin_pin_ref(self: Pin<Pin<Pin<&Self>>>) -> i64 {
+        *self
+    }
+}
+
+fn main() {
+    let rc = Rc::new(1i64) as Rc<dyn Trait>;
+    assert_eq!(1, rc.by_rc());
+
+    let arc = Arc::new(2i64) as Arc<dyn Trait>;
+    assert_eq!(2, arc.by_arc());
+
+    let mut value = 3i64;
+    let pin_mut = Pin::new(&mut value) as Pin<&mut dyn Trait>;
+    assert_eq!(3, pin_mut.by_pin_mut());
+
+    let pin_box = Into::<Pin<Box<i64>>>::into(Box::new(4i64)) as Pin<Box<dyn Trait>>;
+    assert_eq!(4, pin_box.by_pin_box());
+
+    let value = 5i64;
+    let pin_pin_pin_ref = Pin::new(Pin::new(Pin::new(&value))) as Pin<Pin<Pin<&dyn Trait>>>;
+    assert_eq!(5, pin_pin_pin_ref.by_pin_pin_pin_ref());
+}
diff --git a/src/test/ui/self/arbitrary_self_types_struct.rs b/src/test/ui/self/arbitrary_self_types_struct.rs
new file mode 100644 (file)
index 0000000..cf62cd3
--- /dev/null
@@ -0,0 +1,25 @@
+// run-pass
+#![feature(arbitrary_self_types)]
+
+use std::rc::Rc;
+
+struct Foo {
+    x: i32,
+    y: i32,
+}
+
+impl Foo {
+    fn x(self: &Rc<Self>) -> i32 {
+        self.x
+    }
+
+    fn y(self: Rc<Self>) -> i32 {
+        self.y
+    }
+}
+
+fn main() {
+    let foo = Rc::new(Foo {x: 3, y: 4});
+    assert_eq!(3, foo.x());
+    assert_eq!(4, foo.y());
+}
diff --git a/src/test/ui/self/arbitrary_self_types_trait.rs b/src/test/ui/self/arbitrary_self_types_trait.rs
new file mode 100644 (file)
index 0000000..fb06344
--- /dev/null
@@ -0,0 +1,20 @@
+// run-pass
+#![feature(arbitrary_self_types)]
+
+use std::rc::Rc;
+
+trait Trait {
+    fn trait_method<'a>(self: &'a Box<Rc<Self>>) -> &'a [i32];
+}
+
+impl Trait for Vec<i32> {
+    fn trait_method<'a>(self: &'a Box<Rc<Self>>) -> &'a [i32] {
+        &***self
+    }
+}
+
+fn main() {
+    let v = vec![1,2,3];
+
+    assert_eq!(&[1,2,3], Box::new(Rc::new(v)).trait_method());
+}
diff --git a/src/test/ui/self/arbitrary_self_types_unsized_struct.rs b/src/test/ui/self/arbitrary_self_types_unsized_struct.rs
new file mode 100644 (file)
index 0000000..b78223f
--- /dev/null
@@ -0,0 +1,17 @@
+// run-pass
+#![feature(arbitrary_self_types)]
+
+use std::rc::Rc;
+
+struct Foo<T: ?Sized>(T);
+
+impl Foo<[u8]> {
+    fn len(self: Rc<Self>) -> usize {
+        self.0.len()
+    }
+}
+
+fn main() {
+    let rc = Rc::new(Foo([1u8,2,3])) as Rc<Foo<[u8]>>;
+    assert_eq!(3, rc.len());
+}
diff --git a/src/test/ui/self/auxiliary/explicit_self_xcrate.rs b/src/test/ui/self/auxiliary/explicit_self_xcrate.rs
new file mode 100644 (file)
index 0000000..25cdfa9
--- /dev/null
@@ -0,0 +1,15 @@
+pub trait Foo {
+    #[inline(always)]
+    fn f(&self);
+}
+
+pub struct Bar {
+    pub x: String
+}
+
+impl Foo for Bar {
+    #[inline(always)]
+    fn f(&self) {
+        println!("{}", (*self).x);
+    }
+}
diff --git a/src/test/ui/self/builtin-superkinds-self-type.rs b/src/test/ui/self/builtin-superkinds-self-type.rs
new file mode 100644 (file)
index 0000000..c56542b
--- /dev/null
@@ -0,0 +1,20 @@
+// run-pass
+// Tests the ability for the Self type in default methods to use
+// capabilities granted by builtin kinds as supertraits.
+
+
+use std::sync::mpsc::{Sender, channel};
+
+trait Foo : Send + Sized + 'static {
+    fn foo(self, tx: Sender<Self>) {
+        tx.send(self).unwrap();
+    }
+}
+
+impl <T: Send + 'static> Foo for T { }
+
+pub fn main() {
+    let (tx, rx) = channel();
+    1193182.foo(tx);
+    assert_eq!(rx.recv().unwrap(), 1193182);
+}
diff --git a/src/test/ui/self/by-value-self-in-mut-slot.rs b/src/test/ui/self/by-value-self-in-mut-slot.rs
new file mode 100644 (file)
index 0000000..267afd1
--- /dev/null
@@ -0,0 +1,22 @@
+// run-pass
+
+struct X {
+    a: isize
+}
+
+trait Changer {
+    fn change(self) -> Self;
+}
+
+impl Changer for X {
+    fn change(mut self) -> X {
+        self.a = 55;
+        self
+    }
+}
+
+pub fn main() {
+    let x = X { a: 32 };
+    let new_x = x.change();
+    assert_eq!(new_x.a, 55);
+}
diff --git a/src/test/ui/self/explicit-self-closures.rs b/src/test/ui/self/explicit-self-closures.rs
new file mode 100644 (file)
index 0000000..1217823
--- /dev/null
@@ -0,0 +1,17 @@
+// compile-pass
+#![allow(dead_code)]
+// Test to make sure that explicit self params work inside closures
+
+// pretty-expanded FIXME #23616
+
+struct Box {
+    x: usize
+}
+
+impl Box {
+    pub fn set_many(&mut self, xs: &[usize]) {
+        for x in xs { self.x = *x; }
+    }
+}
+
+pub fn main() {}
diff --git a/src/test/ui/self/explicit-self-generic.rs b/src/test/ui/self/explicit-self-generic.rs
new file mode 100644 (file)
index 0000000..03f72a5
--- /dev/null
@@ -0,0 +1,29 @@
+// run-pass
+#![allow(dead_code)]
+#![feature(box_syntax)]
+
+#[derive(Copy, Clone)]
+struct LM { resize_at: usize, size: usize }
+
+enum HashMap<K,V> {
+    HashMap_(LM, Vec<(K,V)>)
+}
+
+fn linear_map<K,V>() -> HashMap<K,V> {
+    HashMap::HashMap_(LM{
+        resize_at: 32,
+        size: 0}, Vec::new())
+}
+
+impl<K,V> HashMap<K,V> {
+    pub fn len(&mut self) -> usize {
+        match *self {
+            HashMap::HashMap_(ref l, _) => l.size
+        }
+    }
+}
+
+pub fn main() {
+    let mut m: Box<_> = box linear_map::<(),()>();
+    assert_eq!(m.len(), 0);
+}
diff --git a/src/test/ui/self/explicit-self-objects-uniq.rs b/src/test/ui/self/explicit-self-objects-uniq.rs
new file mode 100644 (file)
index 0000000..f95686c
--- /dev/null
@@ -0,0 +1,22 @@
+// run-pass
+#![feature(box_syntax)]
+
+trait Foo {
+    fn f(self: Box<Self>);
+}
+
+struct S {
+    x: isize
+}
+
+impl Foo for S {
+    fn f(self: Box<S>) {
+        assert_eq!(self.x, 3);
+    }
+}
+
+pub fn main() {
+    let x = box S { x: 3 };
+    let y = x as Box<Foo>;
+    y.f();
+}
diff --git a/src/test/ui/self/explicit-self.rs b/src/test/ui/self/explicit-self.rs
new file mode 100644 (file)
index 0000000..6d19d33
--- /dev/null
@@ -0,0 +1,73 @@
+// run-pass
+#![allow(dead_code)]
+#![allow(non_camel_case_types)]
+#![allow(non_upper_case_globals)]
+
+#![feature(box_syntax)]
+
+static tau: f64 = 2.0*3.14159265358979323;
+
+struct Point {x: f64, y: f64}
+struct Size {w: f64, h: f64}
+enum shape {
+    circle(Point, f64),
+    rectangle(Point, Size)
+}
+
+
+fn compute_area(shape: &shape) -> f64 {
+    match *shape {
+        shape::circle(_, radius) => 0.5 * tau * radius * radius,
+        shape::rectangle(_, ref size) => size.w * size.h
+    }
+}
+
+impl shape {
+    // self is in the implicit self region
+    pub fn select<'r, T>(&self, threshold: f64, a: &'r T, b: &'r T)
+                         -> &'r T {
+        if compute_area(self) > threshold {a} else {b}
+    }
+}
+
+fn select_based_on_unit_circle<'r, T>(
+    threshold: f64, a: &'r T, b: &'r T) -> &'r T {
+
+    let shape = &shape::circle(Point{x: 0.0, y: 0.0}, 1.0);
+    shape.select(threshold, a, b)
+}
+
+#[derive(Clone)]
+struct thing {
+    x: A
+}
+
+#[derive(Clone)]
+struct A {
+    a: isize
+}
+
+fn thing(x: A) -> thing {
+    thing {
+        x: x
+    }
+}
+
+impl thing {
+    pub fn bar(self: Box<thing>) -> isize { self.x.a }
+    pub fn quux(&self) -> isize { self.x.a }
+    pub fn baz<'a>(&'a self) -> &'a A { &self.x }
+    pub fn spam(self) -> isize { self.x.a }
+}
+
+trait Nus { fn f(&self); }
+impl Nus for thing { fn f(&self) {} }
+
+pub fn main() {
+    let y: Box<_> = box thing(A {a: 10});
+    assert_eq!(y.clone().bar(), 10);
+    assert_eq!(y.quux(), 10);
+
+    let z = thing(A {a: 11});
+    assert_eq!(z.spam(), 11);
+}
diff --git a/src/test/ui/self/explicit_self_xcrate_exe.rs b/src/test/ui/self/explicit_self_xcrate_exe.rs
new file mode 100644 (file)
index 0000000..c3796f7
--- /dev/null
@@ -0,0 +1,12 @@
+// run-pass
+// aux-build:explicit_self_xcrate.rs
+
+// pretty-expanded FIXME #23616
+
+extern crate explicit_self_xcrate;
+use explicit_self_xcrate::{Foo, Bar};
+
+pub fn main() {
+    let x = Bar { x: "hello".to_string() };
+    x.f();
+}
diff --git a/src/test/ui/self/move-self.rs b/src/test/ui/self/move-self.rs
new file mode 100644 (file)
index 0000000..6603278
--- /dev/null
@@ -0,0 +1,19 @@
+// run-pass
+struct S {
+    x: String
+}
+
+impl S {
+    pub fn foo(self) {
+        self.bar();
+    }
+
+    pub fn bar(self) {
+        println!("{}", self.x);
+    }
+}
+
+pub fn main() {
+    let x = S { x: "Hello!".to_string() };
+    x.foo();
+}
diff --git a/src/test/ui/self/object-safety-sized-self-by-value-self.rs b/src/test/ui/self/object-safety-sized-self-by-value-self.rs
new file mode 100644 (file)
index 0000000..ae05126
--- /dev/null
@@ -0,0 +1,39 @@
+// run-pass
+#![allow(unused_mut)]
+// Check that a trait is still object-safe (and usable) if it has
+// methods with by-value self so long as they require `Self : Sized`.
+
+
+trait Counter {
+    fn tick(&mut self) -> u32;
+    fn get(self) -> u32 where Self : Sized;
+}
+
+struct CCounter {
+    c: u32
+}
+
+impl Counter for CCounter {
+    fn tick(&mut self) -> u32 { self.c += 1; self.c }
+    fn get(self) -> u32 where Self : Sized { self.c }
+}
+
+fn tick1<C:Counter>(mut c: C) -> u32 {
+    tick2(&mut c);
+    c.get()
+}
+
+fn tick2(c: &mut Counter) {
+    tick3(c);
+}
+
+fn tick3<C:?Sized+Counter>(c: &mut C) {
+    c.tick();
+    c.tick();
+}
+
+fn main() {
+    let mut c = CCounter { c: 0 };
+    let value = tick1(c);
+    assert_eq!(value, 2);
+}
diff --git a/src/test/ui/self/object-safety-sized-self-generic-method.rs b/src/test/ui/self/object-safety-sized-self-generic-method.rs
new file mode 100644 (file)
index 0000000..0b3f663
--- /dev/null
@@ -0,0 +1,39 @@
+// run-pass
+#![allow(unused_variables)]
+// Check that a trait is still object-safe (and usable) if it has
+// generic methods so long as they require `Self : Sized`.
+
+
+trait Counter {
+    fn tick(&mut self) -> u32;
+    fn with<F:FnOnce(u32)>(&self, f: F) where Self : Sized;
+}
+
+struct CCounter {
+    c: u32
+}
+
+impl Counter for CCounter {
+    fn tick(&mut self) -> u32 { self.c += 1; self.c }
+    fn with<F:FnOnce(u32)>(&self, f: F) { f(self.c); }
+}
+
+fn tick1<C:Counter>(c: &mut C) {
+    tick2(c);
+    c.with(|i| ());
+}
+
+fn tick2(c: &mut Counter) {
+    tick3(c);
+}
+
+fn tick3<C:?Sized+Counter>(c: &mut C) {
+    c.tick();
+    c.tick();
+}
+
+fn main() {
+    let mut c = CCounter { c: 0 };
+    tick1(&mut c);
+    assert_eq!(c.tick(), 3);
+}
diff --git a/src/test/ui/self/object-safety-sized-self-return-Self.rs b/src/test/ui/self/object-safety-sized-self-return-Self.rs
new file mode 100644 (file)
index 0000000..e88dba0
--- /dev/null
@@ -0,0 +1,39 @@
+// run-pass
+// Check that a trait is still object-safe (and usable) if it has
+// methods that return `Self` so long as they require `Self : Sized`.
+
+
+trait Counter {
+    fn new() -> Self where Self : Sized;
+    fn tick(&mut self) -> u32;
+}
+
+struct CCounter {
+    c: u32
+}
+
+impl Counter for CCounter {
+    fn new() -> CCounter { CCounter { c: 0 } }
+    fn tick(&mut self) -> u32 { self.c += 1; self.c }
+}
+
+fn preticked<C:Counter>() -> C {
+    let mut c: C = Counter::new();
+    tick(&mut c);
+    c
+}
+
+fn tick(c: &mut Counter) {
+    tick_generic(c);
+}
+
+fn tick_generic<C:?Sized+Counter>(c: &mut C) {
+    c.tick();
+    c.tick();
+}
+
+fn main() {
+    let mut c = preticked::<CCounter>();
+    tick(&mut c);
+    assert_eq!(c.tick(), 5);
+}
diff --git a/src/test/ui/self/self-impl-2.rs b/src/test/ui/self/self-impl-2.rs
new file mode 100644 (file)
index 0000000..23d513e
--- /dev/null
@@ -0,0 +1,70 @@
+// run-pass
+#![allow(dead_code)]
+#![allow(unused_variables)]
+// Test that we can use `Self` types in impls in the expected way.
+
+// pretty-expanded FIXME #23616
+
+#![feature(box_syntax)]
+
+struct Foo;
+
+// Test uses on inherent impl.
+impl Foo {
+    fn foo(_x: Self, _y: &Self, _z: Box<Self>) -> Self {
+        Foo
+    }
+
+    fn baz() {
+        // Test that Self cannot be shadowed.
+        type Foo = i32;
+        // There is no empty method on i32.
+        Self::empty();
+
+        let _: Self = Foo;
+    }
+
+    fn empty() {}
+}
+
+// Test uses when implementing a trait and with a type parameter.
+pub struct Baz<X> {
+    pub f: X,
+}
+
+trait SuperBar {
+    type SuperQux;
+}
+
+trait Bar<X>: SuperBar {
+    type Qux;
+
+    fn bar(x: Self, y: &Self, z: Box<Self>, _: Self::SuperQux) -> Self;
+    fn dummy(&self, x: X) { }
+}
+
+impl SuperBar for Box<Baz<isize>> {
+    type SuperQux = bool;
+}
+
+impl Bar<isize> for Box<Baz<isize>> {
+    type Qux = i32;
+
+    fn bar(_x: Self, _y: &Self, _z: Box<Self>, _: Self::SuperQux) -> Self {
+        let _: Self::Qux = 42;
+        let _: <Self as Bar<isize>>::Qux = 42;
+
+        let _: Self::SuperQux = true;
+        let _: <Self as SuperBar>::SuperQux = true;
+
+        box Baz { f: 42 }
+    }
+}
+
+fn main() {
+    let _: Foo = Foo::foo(Foo, &Foo, box Foo);
+    let _: Box<Baz<isize>> = Bar::bar(box Baz { f: 42 },
+                                      &box Baz { f: 42 },
+                                      box box Baz { f: 42 },
+                                      true);
+}
diff --git a/src/test/ui/self/self-in-mut-slot-default-method.rs b/src/test/ui/self/self-in-mut-slot-default-method.rs
new file mode 100644 (file)
index 0000000..82c5f58
--- /dev/null
@@ -0,0 +1,36 @@
+// run-pass
+#![feature(box_syntax)]
+
+struct X {
+    a: isize
+}
+
+trait Changer : Sized {
+    fn change(mut self) -> Self {
+        self.set_to(55);
+        self
+    }
+
+    fn change_again(mut self: Box<Self>) -> Box<Self> {
+        self.set_to(45);
+        self
+    }
+
+    fn set_to(&mut self, a: isize);
+}
+
+impl Changer for X {
+    fn set_to(&mut self, a: isize) {
+        self.a = a;
+    }
+}
+
+pub fn main() {
+    let x = X { a: 32 };
+    let new_x = x.change();
+    assert_eq!(new_x.a, 55);
+
+    let x: Box<_> = box new_x;
+    let new_x = x.change_again();
+    assert_eq!(new_x.a, 45);
+}
diff --git a/src/test/ui/self/self-in-mut-slot-immediate-value.rs b/src/test/ui/self/self-in-mut-slot-immediate-value.rs
new file mode 100644 (file)
index 0000000..6086530
--- /dev/null
@@ -0,0 +1,23 @@
+// run-pass
+// Assert that `mut self` on an immediate value doesn't
+// allow mutating the original - issue #10615.
+
+
+#[derive(Copy, Clone)]
+struct Value {
+    n: isize
+}
+
+impl Value {
+    fn squared(mut self) -> Value {
+        self.n *= self.n;
+        self
+    }
+}
+
+pub fn main() {
+    let x = Value { n: 3 };
+    let y = x.squared();
+    assert_eq!(x.n, 3);
+    assert_eq!(y.n, 9);
+}
diff --git a/src/test/ui/self/self-in-typedefs.rs b/src/test/ui/self/self-in-typedefs.rs
new file mode 100644 (file)
index 0000000..e4fe732
--- /dev/null
@@ -0,0 +1,32 @@
+// compile-pass
+
+#![feature(untagged_unions)]
+
+#![allow(dead_code)]
+#![allow(unions_with_drop_fields)]
+
+enum A<'a, T: 'a>
+where
+    Self: Send, T: PartialEq<Self>
+{
+    Foo(&'a Self),
+    Bar(T),
+}
+
+struct B<'a, T: 'a>
+where
+    Self: Send, T: PartialEq<Self>
+{
+    foo: &'a Self,
+    bar: T,
+}
+
+union C<'a, T: 'a>
+where
+    Self: Send, T: PartialEq<Self>
+{
+    foo: &'a Self,
+    bar: T,
+}
+
+fn main() {}
diff --git a/src/test/ui/self/self-re-assign.rs b/src/test/ui/self/self-re-assign.rs
new file mode 100644 (file)
index 0000000..a7b089e
--- /dev/null
@@ -0,0 +1,17 @@
+// run-pass
+// Ensure assigning an owned or managed variable to itself works. In particular,
+// that we do not glue_drop before we glue_take (#3290).
+
+#![feature(box_syntax)]
+
+use std::rc::Rc;
+
+pub fn main() {
+   let mut x: Box<_> = box 3;
+   x = x;
+   assert_eq!(*x, 3);
+
+   let mut x = Rc::new(3);
+   x = x;
+   assert_eq!(*x, 3);
+}
diff --git a/src/test/ui/self/self-shadowing-import.rs b/src/test/ui/self/self-shadowing-import.rs
new file mode 100644 (file)
index 0000000..1d60c6c
--- /dev/null
@@ -0,0 +1,16 @@
+// run-pass
+
+mod a {
+    pub mod b {
+        pub mod a {
+            pub fn foo() -> isize { return 1; }
+        }
+    }
+}
+
+mod c {
+    use a::b::a;
+    pub fn bar() { assert_eq!(a::foo(), 1); }
+}
+
+pub fn main() { c::bar(); }
diff --git a/src/test/ui/self/self-type-param.rs b/src/test/ui/self/self-type-param.rs
new file mode 100644 (file)
index 0000000..57e01ca
--- /dev/null
@@ -0,0 +1,19 @@
+// compile-pass
+#![allow(dead_code)]
+// pretty-expanded FIXME #23616
+
+trait MyTrait {
+    fn f(&self) -> Self;
+}
+
+struct S {
+    x: isize
+}
+
+impl MyTrait for S {
+    fn f(&self) -> S {
+        S { x: 3 }
+    }
+}
+
+pub fn main() {}
diff --git a/src/test/ui/self/string-self-append.rs b/src/test/ui/self/string-self-append.rs
new file mode 100644 (file)
index 0000000..e63dc00
--- /dev/null
@@ -0,0 +1,14 @@
+// run-pass
+pub fn main() {
+    // Make sure we properly handle repeated self-appends.
+    let mut a: String = "A".to_string();
+    let mut i = 20;
+    let mut expected_len = 1;
+    while i > 0 {
+        println!("{}", a.len());
+        assert_eq!(a.len(), expected_len);
+        a = format!("{}{}", a, a);
+        i -= 1;
+        expected_len *= 2;
+    }
+}
diff --git a/src/test/ui/self/ufcs-explicit-self.rs b/src/test/ui/self/ufcs-explicit-self.rs
new file mode 100644 (file)
index 0000000..4e24055
--- /dev/null
@@ -0,0 +1,49 @@
+// run-pass
+#![feature(box_syntax)]
+
+#[derive(Copy, Clone)]
+struct Foo {
+    f: isize,
+}
+
+impl Foo {
+    fn foo(self: Foo, x: isize) -> isize {
+        self.f + x
+    }
+    fn bar(self: &Foo, x: isize) -> isize {
+        self.f + x
+    }
+    fn baz(self: Box<Foo>, x: isize) -> isize {
+        self.f + x
+    }
+}
+
+#[derive(Copy, Clone)]
+struct Bar<T> {
+    f: T,
+}
+
+impl<T> Bar<T> {
+    fn foo(self: Bar<T>, x: isize) -> isize {
+        x
+    }
+    fn bar<'a>(self: &'a Bar<T>, x: isize) -> isize {
+        x
+    }
+    fn baz(self: Bar<T>, x: isize) -> isize {
+        x
+    }
+}
+
+fn main() {
+    let foo: Box<_> = box Foo {
+        f: 1,
+    };
+    println!("{} {} {}", foo.foo(2), foo.bar(2), foo.baz(2));
+    let bar: Box<_> = box Bar {
+        f: 1,
+    };
+    println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2));
+    let bar: Box<Bar<isize>> = bar;
+    println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2));
+}
diff --git a/src/test/ui/self/uniq-self-in-mut-slot.rs b/src/test/ui/self/uniq-self-in-mut-slot.rs
new file mode 100644 (file)
index 0000000..695f06e
--- /dev/null
@@ -0,0 +1,23 @@
+// run-pass
+#![feature(box_syntax)]
+
+struct X {
+    a: isize
+}
+
+trait Changer {
+    fn change(self: Box<Self>) -> Box<Self>;
+}
+
+impl Changer for X {
+    fn change(mut self: Box<X>) -> Box<X> {
+        self.a = 55;
+        self
+    }
+}
+
+pub fn main() {
+    let x: Box<_> = box X { a: 32 };
+    let new_x = x.change();
+    assert_eq!(new_x.a, 55);
+}
diff --git a/src/test/ui/self/where-for-self.rs b/src/test/ui/self/where-for-self.rs
new file mode 100644 (file)
index 0000000..76c592d
--- /dev/null
@@ -0,0 +1,51 @@
+// run-pass
+// Test that we can quantify lifetimes outside a constraint (i.e., including
+// the self type) in a where clause.
+
+
+static mut COUNT: u32 = 1;
+
+trait Bar<'a> {
+    fn bar(&self);
+}
+
+trait Baz<'a>
+{
+    fn baz(&self);
+}
+
+impl<'a, 'b> Bar<'b> for &'a u32 {
+    fn bar(&self) {
+        unsafe { COUNT *= 2; }
+    }
+}
+
+impl<'a, 'b> Baz<'b> for &'a u32 {
+    fn baz(&self) {
+        unsafe { COUNT *= 3; }
+    }
+}
+
+// Test we can use the syntax for HRL including the self type.
+fn foo1<T>(x: &T)
+    where for<'a, 'b> &'a T: Bar<'b>
+{
+    x.bar()
+}
+
+// Test we can quantify multiple bounds (i.e., the precedence is sensible).
+fn foo2<T>(x: &T)
+    where for<'a, 'b> &'a T: Bar<'b> + Baz<'b>
+{
+    x.baz();
+    x.bar()
+}
+
+fn main() {
+    let x = 42;
+    foo1(&x);
+    foo2(&x);
+    unsafe {
+        assert_eq!(COUNT, 12);
+    }
+}
index 6dbc8d39976ad431af8c04b661558a4298e82a13..a3b1d1d81799fce76716f160f2cd95b64ebcfc80 100644 (file)
@@ -16,3 +16,23 @@ enum World {
     Hello,
     Goodbye,
 }
+
+fn foo() {
+    let a = String::new();
+    let b = String::new();
+    let c = "";
+    let d = "";
+    let e = &a;
+    let _ = &a + &b; //~ ERROR binary operation
+    let _ = &a + b; //~ ERROR binary operation
+    let _ = a + &b; // ok
+    let _ = a + b; //~ ERROR mismatched types
+    let _ = e + b; //~ ERROR binary operation
+    let _ = e + &b; //~ ERROR binary operation
+    let _ = e + d; //~ ERROR binary operation
+    let _ = e + &d; //~ ERROR binary operation
+    let _ = &c + &d; //~ ERROR binary operation
+    let _ = &c + d; //~ ERROR binary operation
+    let _ = c + &d; //~ ERROR binary operation
+    let _ = c + d; //~ ERROR binary operation
+}
index a5b91f090d2c01a62d08fccad35f1a5c89a08935..d8fbf841b6157cd5613248a65fbd22d545e8eb49 100644 (file)
@@ -4,7 +4,7 @@ error[E0369]: binary operation `+` cannot be applied to type `&str`
 LL |     let x = "Hello " + "World!";
    |             -------- ^ -------- &str
    |             |        |
-   |             |        `+` can't be used to concatenate two `&str` strings
+   |             |        `+` cannot be used to concatenate two `&str` strings
    |             &str
 help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
    |
@@ -25,16 +25,152 @@ error[E0369]: binary operation `+` cannot be applied to type `&str`
   --> $DIR/issue-39018.rs:11:22
    |
 LL |     let x = "Hello " + "World!".to_owned();
-   |             ---------^--------------------
-   |             |          |
-   |             |          std::string::String
+   |             -------- ^ ------------------- std::string::String
+   |             |        |
+   |             |        `+` cannot be used to concatenate a `&str` with a `String`
    |             &str
-   |             `+` can't be used to concatenate a `&str` with a `String`
 help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
    |
 LL |     let x = "Hello ".to_owned() + &"World!".to_owned();
    |             ^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 3 previous errors
+error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
+  --> $DIR/issue-39018.rs:26:16
+   |
+LL |     let _ = &a + &b;
+   |             -- ^ -- &std::string::String
+   |             |  |
+   |             |  `+` cannot be used to concatenate two `&str` strings
+   |             &std::string::String
+help: String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
+   |
+LL |     let _ = a + &b;
+   |             ^
+
+error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
+  --> $DIR/issue-39018.rs:27:16
+   |
+LL |     let _ = &a + b;
+   |             -- ^ - std::string::String
+   |             |  |
+   |             |  `+` cannot be used to concatenate a `&str` with a `String`
+   |             &std::string::String
+help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
+   |
+LL |     let _ = a + &b;
+   |             ^   ^^
+
+error[E0308]: mismatched types
+  --> $DIR/issue-39018.rs:29:17
+   |
+LL |     let _ = a + b;
+   |                 ^
+   |                 |
+   |                 expected &str, found struct `std::string::String`
+   |                 help: consider borrowing here: `&b`
+   |
+   = note: expected type `&str`
+              found type `std::string::String`
+
+error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
+  --> $DIR/issue-39018.rs:30:15
+   |
+LL |     let _ = e + b;
+   |             - ^ - std::string::String
+   |             | |
+   |             | `+` cannot be used to concatenate a `&str` with a `String`
+   |             &std::string::String
+help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
+   |
+LL |     let _ = e.to_owned() + &b;
+   |             ^^^^^^^^^^^^   ^^
+
+error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
+  --> $DIR/issue-39018.rs:31:15
+   |
+LL |     let _ = e + &b;
+   |             - ^ -- &std::string::String
+   |             | |
+   |             | `+` cannot be used to concatenate two `&str` strings
+   |             &std::string::String
+help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
+   |
+LL |     let _ = e.to_owned() + &b;
+   |             ^^^^^^^^^^^^
+
+error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
+  --> $DIR/issue-39018.rs:32:15
+   |
+LL |     let _ = e + d;
+   |             - ^ - &str
+   |             | |
+   |             | `+` cannot be used to concatenate two `&str` strings
+   |             &std::string::String
+help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
+   |
+LL |     let _ = e.to_owned() + d;
+   |             ^^^^^^^^^^^^
+
+error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
+  --> $DIR/issue-39018.rs:33:15
+   |
+LL |     let _ = e + &d;
+   |             - ^ -- &&str
+   |             | |
+   |             | `+` cannot be used to concatenate two `&str` strings
+   |             &std::string::String
+help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
+   |
+LL |     let _ = e.to_owned() + &d;
+   |             ^^^^^^^^^^^^
+
+error[E0369]: binary operation `+` cannot be applied to type `&&str`
+  --> $DIR/issue-39018.rs:34:16
+   |
+LL |     let _ = &c + &d;
+   |             -- ^ -- &&str
+   |             |
+   |             &&str
+   |
+   = note: an implementation of `std::ops::Add` might be missing for `&&str`
+
+error[E0369]: binary operation `+` cannot be applied to type `&&str`
+  --> $DIR/issue-39018.rs:35:16
+   |
+LL |     let _ = &c + d;
+   |             -- ^ - &str
+   |             |
+   |             &&str
+   |
+   = note: an implementation of `std::ops::Add` might be missing for `&&str`
+
+error[E0369]: binary operation `+` cannot be applied to type `&str`
+  --> $DIR/issue-39018.rs:36:15
+   |
+LL |     let _ = c + &d;
+   |             - ^ -- &&str
+   |             | |
+   |             | `+` cannot be used to concatenate two `&str` strings
+   |             &str
+help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
+   |
+LL |     let _ = c.to_owned() + &d;
+   |             ^^^^^^^^^^^^
+
+error[E0369]: binary operation `+` cannot be applied to type `&str`
+  --> $DIR/issue-39018.rs:37:15
+   |
+LL |     let _ = c + d;
+   |             - ^ - &str
+   |             | |
+   |             | `+` cannot be used to concatenate two `&str` strings
+   |             &str
+help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
+   |
+LL |     let _ = c.to_owned() + d;
+   |             ^^^^^^^^^^^^
+
+error: aborting due to 14 previous errors
 
-For more information about this error, try `rustc --explain E0369`.
+Some errors have detailed explanations: E0308, E0369.
+For more information about an error, try `rustc --explain E0308`.
index 61ebcfdefc31601c5776e8a30372ed8d645d891a..3e53cdc4d98ca36c8d9ad606d833cf772704847b 100644 (file)
@@ -3,10 +3,13 @@ error[E0369]: binary operation `+` cannot be applied to type `&std::string::Stri
    |
 LL |     let c = a + b;
    |             - ^ - &str
-   |             |
+   |             | |
+   |             | `+` cannot be used to concatenate two `&str` strings
    |             &std::string::String
+help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
    |
-   = note: an implementation of `std::ops::Add` might be missing for `&std::string::String`
+LL |     let c = a.to_owned() + b;
+   |             ^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 4faede353059a8d3ab780e87894fb589567e491f..1c1230346a56cf2ce476b3afba2d37ca51eb06b1 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 #[derive(Clone)]
 enum Either {
     One(X),
index b1aaab6a75441f7c0aac8703ac04759812d56e8e..f8e043fbfdfd4052df84589e20b53c909528e40c 100644 (file)
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:41:27
+  --> $DIR/duplicate-suggestions.rs:39:27
    |
 LL |     let &(X(_t), X(_u)) = &(x.clone(), x.clone());
    |         ---------------   ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -9,13 +9,13 @@ LL |     let &(X(_t), X(_u)) = &(x.clone(), x.clone());
    |         help: consider removing the `&`: `(X(_t), X(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:41:13
+  --> $DIR/duplicate-suggestions.rs:39:13
    |
 LL |     let &(X(_t), X(_u)) = &(x.clone(), x.clone());
    |             ^^     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:45:50
+  --> $DIR/duplicate-suggestions.rs:43:50
    |
 LL |     if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
    |            -----------------------------------   ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -25,13 +25,13 @@ LL |     if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) {
    |            help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:45:26
+  --> $DIR/duplicate-suggestions.rs:43:26
    |
 LL |     if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
    |                          ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:49:53
+  --> $DIR/duplicate-suggestions.rs:47:53
    |
 LL |     while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
    |               -----------------------------------   ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -41,13 +41,13 @@ LL |     while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone())
    |               help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:49:29
+  --> $DIR/duplicate-suggestions.rs:47:29
    |
 LL |     while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
    |                             ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:53:11
+  --> $DIR/duplicate-suggestions.rs:51:11
    |
 LL |     match &(e.clone(), e.clone()) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -61,7 +61,7 @@ LL |         &(Either::Two(_t), Either::One(_u)) => (),
    |                       -- ...and here   -- ...and here
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:55:23
+  --> $DIR/duplicate-suggestions.rs:53:23
    |
 LL |         &(Either::One(_t), Either::Two(_u)) => (),
    |                       ^^               ^^
@@ -78,7 +78,7 @@ LL |         (Either::Two(_t), Either::One(_u)) => (),
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:63:11
+  --> $DIR/duplicate-suggestions.rs:61:11
    |
 LL |     match &(e.clone(), e.clone()) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -91,13 +91,13 @@ LL |         &(Either::One(_t), Either::Two(_u))
    |         help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:65:23
+  --> $DIR/duplicate-suggestions.rs:63:23
    |
 LL |         &(Either::One(_t), Either::Two(_u))
    |                       ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:72:11
+  --> $DIR/duplicate-suggestions.rs:70:11
    |
 LL |     match &(e.clone(), e.clone()) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -110,13 +110,13 @@ LL |         &(Either::One(_t), Either::Two(_u)) => (),
    |         help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:74:23
+  --> $DIR/duplicate-suggestions.rs:72:23
    |
 LL |         &(Either::One(_t), Either::Two(_u)) => (),
    |                       ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:80:11
+  --> $DIR/duplicate-suggestions.rs:78:11
    |
 LL |     match &(e.clone(), e.clone()) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -129,13 +129,13 @@ LL |         &(Either::One(_t), Either::Two(_u)) => (),
    |         help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:82:23
+  --> $DIR/duplicate-suggestions.rs:80:23
    |
 LL |         &(Either::One(_t), Either::Two(_u)) => (),
    |                       ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:93:31
+  --> $DIR/duplicate-suggestions.rs:91:31
    |
 LL |     let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
    |         -------------------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -145,13 +145,13 @@ LL |     let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
    |         help: consider removing the `&mut`: `(X(_t), X(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:93:17
+  --> $DIR/duplicate-suggestions.rs:91:17
    |
 LL |     let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
    |                 ^^     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:97:54
+  --> $DIR/duplicate-suggestions.rs:95:54
    |
 LL |     if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
    |            ---------------------------------------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -161,13 +161,13 @@ LL |     if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.c
    |            help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:97:30
+  --> $DIR/duplicate-suggestions.rs:95:30
    |
 LL |     if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
    |                              ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:101:57
+  --> $DIR/duplicate-suggestions.rs:99:57
    |
 LL |     while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
    |               ---------------------------------------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -177,13 +177,13 @@ LL |     while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), e
    |               help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:101:33
+  --> $DIR/duplicate-suggestions.rs:99:33
    |
 LL |     while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
    |                                 ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:105:11
+  --> $DIR/duplicate-suggestions.rs:103:11
    |
 LL |     match &mut (em.clone(), em.clone()) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -197,7 +197,7 @@ LL |         &mut (Either::Two(_t), Either::One(_u)) => (),
    |                           -- ...and here   -- ...and here
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:107:27
+  --> $DIR/duplicate-suggestions.rs:105:27
    |
 LL |         &mut (Either::One(_t), Either::Two(_u)) => (),
    |                           ^^               ^^
@@ -214,7 +214,7 @@ LL |         (Either::Two(_t), Either::One(_u)) => (),
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:115:11
+  --> $DIR/duplicate-suggestions.rs:113:11
    |
 LL |     match &mut (em.clone(), em.clone()) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -227,13 +227,13 @@ LL |         &mut (Either::One(_t), Either::Two(_u))
    |         help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:117:27
+  --> $DIR/duplicate-suggestions.rs:115:27
    |
 LL |         &mut (Either::One(_t), Either::Two(_u))
    |                           ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:124:11
+  --> $DIR/duplicate-suggestions.rs:122:11
    |
 LL |     match &mut (em.clone(), em.clone()) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -246,13 +246,13 @@ LL |         &mut (Either::One(_t), Either::Two(_u)) => (),
    |         help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:126:27
+  --> $DIR/duplicate-suggestions.rs:124:27
    |
 LL |         &mut (Either::One(_t), Either::Two(_u)) => (),
    |                           ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:132:11
+  --> $DIR/duplicate-suggestions.rs:130:11
    |
 LL |     match &mut (em.clone(), em.clone()) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -265,13 +265,13 @@ LL |         &mut (Either::One(_t), Either::Two(_u)) => (),
    |         help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:134:27
+  --> $DIR/duplicate-suggestions.rs:132:27
    |
 LL |         &mut (Either::One(_t), Either::Two(_u)) => (),
    |                           ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:140:11
+  --> $DIR/duplicate-suggestions.rs:138:11
    |
 LL |     match &mut (em.clone(), em.clone()) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -284,13 +284,13 @@ LL |         &mut (Either::One(_t), Either::Two(_u)) => (),
    |         help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:142:27
+  --> $DIR/duplicate-suggestions.rs:140:27
    |
 LL |         &mut (Either::One(_t), Either::Two(_u)) => (),
    |                           ^^               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:88:11
+  --> $DIR/duplicate-suggestions.rs:86:11
    |
 LL |     fn f5(&(X(_t), X(_u)): &(X, X)) { }
    |           ^^^^--^^^^^--^^
@@ -301,13 +301,13 @@ LL |     fn f5(&(X(_t), X(_u)): &(X, X)) { }
    |           help: consider removing the `&`: `(X(_t), X(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:88:15
+  --> $DIR/duplicate-suggestions.rs:86:15
    |
 LL |     fn f5(&(X(_t), X(_u)): &(X, X)) { }
    |               ^^     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/duplicate-suggestions.rs:148:11
+  --> $DIR/duplicate-suggestions.rs:146:11
    |
 LL |     fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
    |           ^^^^^^^^--^^^^^--^^
@@ -318,7 +318,7 @@ LL |     fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
    |           help: consider removing the `&mut`: `(X(_t), X(_u))`
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/duplicate-suggestions.rs:148:19
+  --> $DIR/duplicate-suggestions.rs:146:19
    |
 LL |     fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
    |                   ^^     ^^
index 90a9fe4e7d06ce1646cdbe0e3fcae8e67f26c944..6e3879a4155b9be456afdd0ee9520cc538acabfa 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 #[derive(Clone)]
 enum Either {
     One(X),
index f1d515e932c600773c8c50c2bee1249f9a968c71..74f3a63be57de2886d2c28b829c06b56532d185c 100644 (file)
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/move-into-closure.rs:30:21
+  --> $DIR/move-into-closure.rs:28:21
    |
 LL |     let x = X(Y);
    |         - captured outer variable
@@ -12,13 +12,13 @@ LL |         let X(_t) = x;
    |               data moved here
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:30:15
+  --> $DIR/move-into-closure.rs:28:15
    |
 LL |         let X(_t) = x;
    |               ^^
 
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/move-into-closure.rs:34:34
+  --> $DIR/move-into-closure.rs:32:34
    |
 LL |     let e = Either::One(X(Y));
    |         - captured outer variable
@@ -31,13 +31,13 @@ LL |         if let Either::One(_t) = e { }
    |                            data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:34:28
+  --> $DIR/move-into-closure.rs:32:28
    |
 LL |         if let Either::One(_t) = e { }
    |                            ^^
 
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/move-into-closure.rs:38:37
+  --> $DIR/move-into-closure.rs:36:37
    |
 LL |     let e = Either::One(X(Y));
    |         - captured outer variable
@@ -50,13 +50,13 @@ LL |         while let Either::One(_t) = e { }
    |                               data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:38:31
+  --> $DIR/move-into-closure.rs:36:31
    |
 LL |         while let Either::One(_t) = e { }
    |                               ^^
 
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/move-into-closure.rs:42:15
+  --> $DIR/move-into-closure.rs:40:15
    |
 LL |     let e = Either::One(X(Y));
    |         - captured outer variable
@@ -71,13 +71,13 @@ LL |             Either::One(_t)
    |                         -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:46:25
+  --> $DIR/move-into-closure.rs:44:25
    |
 LL |             Either::One(_t)
    |                         ^^
 
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/move-into-closure.rs:49:15
+  --> $DIR/move-into-closure.rs:47:15
    |
 LL |     let e = Either::One(X(Y));
    |         - captured outer variable
@@ -92,13 +92,13 @@ LL |             Either::One(_t) => (),
    |                         -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:53:25
+  --> $DIR/move-into-closure.rs:51:25
    |
 LL |             Either::One(_t) => (),
    |                         ^^
 
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/move-into-closure.rs:58:25
+  --> $DIR/move-into-closure.rs:56:25
    |
 LL |     let x = X(Y);
    |         - captured outer variable
@@ -111,13 +111,13 @@ LL |         let X(mut _t) = x;
    |               data moved here
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:58:15
+  --> $DIR/move-into-closure.rs:56:15
    |
 LL |         let X(mut _t) = x;
    |               ^^^^^^
 
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/move-into-closure.rs:62:38
+  --> $DIR/move-into-closure.rs:60:38
    |
 LL |     let mut em = Either::One(X(Y));
    |         ------ captured outer variable
@@ -130,13 +130,13 @@ LL |         if let Either::One(mut _t) = em { }
    |                            data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:62:28
+  --> $DIR/move-into-closure.rs:60:28
    |
 LL |         if let Either::One(mut _t) = em { }
    |                            ^^^^^^
 
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/move-into-closure.rs:66:41
+  --> $DIR/move-into-closure.rs:64:41
    |
 LL |     let mut em = Either::One(X(Y));
    |         ------ captured outer variable
@@ -149,13 +149,13 @@ LL |         while let Either::One(mut _t) = em { }
    |                               data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:66:31
+  --> $DIR/move-into-closure.rs:64:31
    |
 LL |         while let Either::One(mut _t) = em { }
    |                               ^^^^^^
 
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/move-into-closure.rs:70:15
+  --> $DIR/move-into-closure.rs:68:15
    |
 LL |     let mut em = Either::One(X(Y));
    |         ------ captured outer variable
@@ -170,13 +170,13 @@ LL |             Either::One(mut _t)
    |                         ------ data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:74:25
+  --> $DIR/move-into-closure.rs:72:25
    |
 LL |             Either::One(mut _t)
    |                         ^^^^^^
 
 error[E0507]: cannot move out of captured variable in an `Fn` closure
-  --> $DIR/move-into-closure.rs:77:15
+  --> $DIR/move-into-closure.rs:75:15
    |
 LL |     let mut em = Either::One(X(Y));
    |         ------ captured outer variable
@@ -191,13 +191,13 @@ LL |             Either::One(mut _t) => (),
    |                         ------ data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:81:25
+  --> $DIR/move-into-closure.rs:79:25
    |
 LL |             Either::One(mut _t) => (),
    |                         ^^^^^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:97:21
+  --> $DIR/move-into-closure.rs:95:21
    |
 LL |     let x = X(Y);
    |         - captured outer variable
@@ -210,13 +210,13 @@ LL |         let X(_t) = x;
    |               data moved here
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:97:15
+  --> $DIR/move-into-closure.rs:95:15
    |
 LL |         let X(_t) = x;
    |               ^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:101:34
+  --> $DIR/move-into-closure.rs:99:34
    |
 LL |     let e = Either::One(X(Y));
    |         - captured outer variable
@@ -229,13 +229,13 @@ LL |         if let Either::One(_t) = e { }
    |                            data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:101:28
+  --> $DIR/move-into-closure.rs:99:28
    |
 LL |         if let Either::One(_t) = e { }
    |                            ^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:105:37
+  --> $DIR/move-into-closure.rs:103:37
    |
 LL |     let e = Either::One(X(Y));
    |         - captured outer variable
@@ -248,13 +248,13 @@ LL |         while let Either::One(_t) = e { }
    |                               data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:105:31
+  --> $DIR/move-into-closure.rs:103:31
    |
 LL |         while let Either::One(_t) = e { }
    |                               ^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:109:15
+  --> $DIR/move-into-closure.rs:107:15
    |
 LL |     let e = Either::One(X(Y));
    |         - captured outer variable
@@ -269,13 +269,13 @@ LL |             Either::One(_t)
    |                         -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:113:25
+  --> $DIR/move-into-closure.rs:111:25
    |
 LL |             Either::One(_t)
    |                         ^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:116:15
+  --> $DIR/move-into-closure.rs:114:15
    |
 LL |     let e = Either::One(X(Y));
    |         - captured outer variable
@@ -290,13 +290,13 @@ LL |             Either::One(_t) => (),
    |                         -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:120:25
+  --> $DIR/move-into-closure.rs:118:25
    |
 LL |             Either::One(_t) => (),
    |                         ^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:125:25
+  --> $DIR/move-into-closure.rs:123:25
    |
 LL |     let x = X(Y);
    |         - captured outer variable
@@ -309,13 +309,13 @@ LL |         let X(mut _t) = x;
    |               data moved here
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:125:15
+  --> $DIR/move-into-closure.rs:123:15
    |
 LL |         let X(mut _t) = x;
    |               ^^^^^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:129:38
+  --> $DIR/move-into-closure.rs:127:38
    |
 LL |     let mut em = Either::One(X(Y));
    |         ------ captured outer variable
@@ -328,13 +328,13 @@ LL |         if let Either::One(mut _t) = em { }
    |                            data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:129:28
+  --> $DIR/move-into-closure.rs:127:28
    |
 LL |         if let Either::One(mut _t) = em { }
    |                            ^^^^^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:133:41
+  --> $DIR/move-into-closure.rs:131:41
    |
 LL |     let mut em = Either::One(X(Y));
    |         ------ captured outer variable
@@ -347,13 +347,13 @@ LL |         while let Either::One(mut _t) = em { }
    |                               data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:133:31
+  --> $DIR/move-into-closure.rs:131:31
    |
 LL |         while let Either::One(mut _t) = em { }
    |                               ^^^^^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:137:15
+  --> $DIR/move-into-closure.rs:135:15
    |
 LL |     let mut em = Either::One(X(Y));
    |         ------ captured outer variable
@@ -368,13 +368,13 @@ LL |             Either::One(mut _t)
    |                         ------ data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:141:25
+  --> $DIR/move-into-closure.rs:139:25
    |
 LL |             Either::One(mut _t)
    |                         ^^^^^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:144:15
+  --> $DIR/move-into-closure.rs:142:15
    |
 LL |     let mut em = Either::One(X(Y));
    |         ------ captured outer variable
@@ -389,13 +389,13 @@ LL |             Either::One(mut _t) => (),
    |                         ------ data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:148:25
+  --> $DIR/move-into-closure.rs:146:25
    |
 LL |             Either::One(mut _t) => (),
    |                         ^^^^^^
 
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
-  --> $DIR/move-into-closure.rs:152:15
+  --> $DIR/move-into-closure.rs:150:15
    |
 LL |     let mut em = Either::One(X(Y));
    |         ------ captured outer variable
@@ -410,7 +410,7 @@ LL |             Either::One(mut _t) => (),
    |                         ------ data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/move-into-closure.rs:156:25
+  --> $DIR/move-into-closure.rs:154:25
    |
 LL |             Either::One(mut _t) => (),
    |                         ^^^^^^
index 58aab85ac2673625abc3d10b1307b41867f434d1..31ab1a6639acc7e95294754638864141bae0621b 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 #[derive(Clone)]
 enum Either {
     One(X),
index 6a8b17ca870474c033cd3a1b6d528b5f64730d8d..7f2ba4da714d8db31b8568c2074ee03ce3810dee 100644 (file)
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:40:17
+  --> $DIR/simple.rs:38:17
    |
 LL |     let X(_t) = *s;
    |           --    ^^
@@ -9,13 +9,13 @@ LL |     let X(_t) = *s;
    |           data moved here
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:40:11
+  --> $DIR/simple.rs:38:11
    |
 LL |     let X(_t) = *s;
    |           ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:44:30
+  --> $DIR/simple.rs:42:30
    |
 LL |     if let Either::One(_t) = *r { }
    |                        --    ^^
@@ -25,13 +25,13 @@ LL |     if let Either::One(_t) = *r { }
    |                        data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:44:24
+  --> $DIR/simple.rs:42:24
    |
 LL |     if let Either::One(_t) = *r { }
    |                        ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:48:33
+  --> $DIR/simple.rs:46:33
    |
 LL |     while let Either::One(_t) = *r { }
    |                           --    ^^
@@ -41,13 +41,13 @@ LL |     while let Either::One(_t) = *r { }
    |                           data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:48:27
+  --> $DIR/simple.rs:46:27
    |
 LL |     while let Either::One(_t) = *r { }
    |                           ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:52:11
+  --> $DIR/simple.rs:50:11
    |
 LL |     match *r {
    |           ^^
@@ -59,13 +59,13 @@ LL |         Either::One(_t)
    |                     -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:56:21
+  --> $DIR/simple.rs:54:21
    |
 LL |         Either::One(_t)
    |                     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:59:11
+  --> $DIR/simple.rs:57:11
    |
 LL |     match *r {
    |           ^^
@@ -77,13 +77,13 @@ LL |         Either::One(_t) => (),
    |                     -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:63:21
+  --> $DIR/simple.rs:61:21
    |
 LL |         Either::One(_t) => (),
    |                     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:68:17
+  --> $DIR/simple.rs:66:17
    |
 LL |     let X(_t) = *sm;
    |           --    ^^^
@@ -93,13 +93,13 @@ LL |     let X(_t) = *sm;
    |           data moved here
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:68:11
+  --> $DIR/simple.rs:66:11
    |
 LL |     let X(_t) = *sm;
    |           ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:72:30
+  --> $DIR/simple.rs:70:30
    |
 LL |     if let Either::One(_t) = *rm { }
    |                        --    ^^^
@@ -109,13 +109,13 @@ LL |     if let Either::One(_t) = *rm { }
    |                        data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:72:24
+  --> $DIR/simple.rs:70:24
    |
 LL |     if let Either::One(_t) = *rm { }
    |                        ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:76:33
+  --> $DIR/simple.rs:74:33
    |
 LL |     while let Either::One(_t) = *rm { }
    |                           --    ^^^
@@ -125,13 +125,13 @@ LL |     while let Either::One(_t) = *rm { }
    |                           data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:76:27
+  --> $DIR/simple.rs:74:27
    |
 LL |     while let Either::One(_t) = *rm { }
    |                           ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:80:11
+  --> $DIR/simple.rs:78:11
    |
 LL |     match *rm {
    |           ^^^
@@ -143,13 +143,13 @@ LL |         Either::One(_t)
    |                     -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:84:21
+  --> $DIR/simple.rs:82:21
    |
 LL |         Either::One(_t)
    |                     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:87:11
+  --> $DIR/simple.rs:85:11
    |
 LL |     match *rm {
    |           ^^^
@@ -161,13 +161,13 @@ LL |         Either::One(_t) => (),
    |                     -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:91:21
+  --> $DIR/simple.rs:89:21
    |
 LL |         Either::One(_t) => (),
    |                     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:95:11
+  --> $DIR/simple.rs:93:11
    |
 LL |     match *rm {
    |           ^^^
@@ -179,13 +179,13 @@ LL |         Either::One(_t) => (),
    |                     -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:99:21
+  --> $DIR/simple.rs:97:21
    |
 LL |         Either::One(_t) => (),
    |                     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:104:17
+  --> $DIR/simple.rs:102:17
    |
 LL |     let X(_t) = vs[0];
    |           --    ^^^^^
@@ -195,13 +195,13 @@ LL |     let X(_t) = vs[0];
    |           data moved here
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:104:11
+  --> $DIR/simple.rs:102:11
    |
 LL |     let X(_t) = vs[0];
    |           ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:108:30
+  --> $DIR/simple.rs:106:30
    |
 LL |     if let Either::One(_t) = vr[0] { }
    |                        --    ^^^^^
@@ -211,13 +211,13 @@ LL |     if let Either::One(_t) = vr[0] { }
    |                        data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:108:24
+  --> $DIR/simple.rs:106:24
    |
 LL |     if let Either::One(_t) = vr[0] { }
    |                        ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:112:33
+  --> $DIR/simple.rs:110:33
    |
 LL |     while let Either::One(_t) = vr[0] { }
    |                           --    ^^^^^
@@ -227,13 +227,13 @@ LL |     while let Either::One(_t) = vr[0] { }
    |                           data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:112:27
+  --> $DIR/simple.rs:110:27
    |
 LL |     while let Either::One(_t) = vr[0] { }
    |                           ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:116:11
+  --> $DIR/simple.rs:114:11
    |
 LL |     match vr[0] {
    |           ^^^^^
@@ -245,13 +245,13 @@ LL |         Either::One(_t)
    |                     -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:120:21
+  --> $DIR/simple.rs:118:21
    |
 LL |         Either::One(_t)
    |                     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:123:11
+  --> $DIR/simple.rs:121:11
    |
 LL |     match vr[0] {
    |           ^^^^^
@@ -263,13 +263,13 @@ LL |         Either::One(_t) => (),
    |                     -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:127:21
+  --> $DIR/simple.rs:125:21
    |
 LL |         Either::One(_t) => (),
    |                     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:132:17
+  --> $DIR/simple.rs:130:17
    |
 LL |     let X(_t) = vsm[0];
    |           --    ^^^^^^
@@ -279,13 +279,13 @@ LL |     let X(_t) = vsm[0];
    |           data moved here
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:132:11
+  --> $DIR/simple.rs:130:11
    |
 LL |     let X(_t) = vsm[0];
    |           ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:136:30
+  --> $DIR/simple.rs:134:30
    |
 LL |     if let Either::One(_t) = vrm[0] { }
    |                        --    ^^^^^^
@@ -295,13 +295,13 @@ LL |     if let Either::One(_t) = vrm[0] { }
    |                        data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:136:24
+  --> $DIR/simple.rs:134:24
    |
 LL |     if let Either::One(_t) = vrm[0] { }
    |                        ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:140:33
+  --> $DIR/simple.rs:138:33
    |
 LL |     while let Either::One(_t) = vrm[0] { }
    |                           --    ^^^^^^
@@ -311,13 +311,13 @@ LL |     while let Either::One(_t) = vrm[0] { }
    |                           data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:140:27
+  --> $DIR/simple.rs:138:27
    |
 LL |     while let Either::One(_t) = vrm[0] { }
    |                           ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:144:11
+  --> $DIR/simple.rs:142:11
    |
 LL |     match vrm[0] {
    |           ^^^^^^
@@ -329,13 +329,13 @@ LL |         Either::One(_t)
    |                     -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:148:21
+  --> $DIR/simple.rs:146:21
    |
 LL |         Either::One(_t)
    |                     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:151:11
+  --> $DIR/simple.rs:149:11
    |
 LL |     match vrm[0] {
    |           ^^^^^^
@@ -347,13 +347,13 @@ LL |         Either::One(_t) => (),
    |                     -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:155:21
+  --> $DIR/simple.rs:153:21
    |
 LL |         Either::One(_t) => (),
    |                     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:159:11
+  --> $DIR/simple.rs:157:11
    |
 LL |     match vrm[0] {
    |           ^^^^^^
@@ -365,13 +365,13 @@ LL |         Either::One(_t) => (),
    |                     -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:163:21
+  --> $DIR/simple.rs:161:21
    |
 LL |         Either::One(_t) => (),
    |                     ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:170:18
+  --> $DIR/simple.rs:168:18
    |
 LL |     let &X(_t) = s;
    |         ------   ^ cannot move out of borrowed content
@@ -380,13 +380,13 @@ LL |     let &X(_t) = s;
    |         help: consider removing the `&`: `X(_t)`
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:170:12
+  --> $DIR/simple.rs:168:12
    |
 LL |     let &X(_t) = s;
    |            ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:174:31
+  --> $DIR/simple.rs:172:31
    |
 LL |     if let &Either::One(_t) = r { }
    |            ----------------   ^ cannot move out of borrowed content
@@ -395,13 +395,13 @@ LL |     if let &Either::One(_t) = r { }
    |            help: consider removing the `&`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:174:25
+  --> $DIR/simple.rs:172:25
    |
 LL |     if let &Either::One(_t) = r { }
    |                         ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:178:34
+  --> $DIR/simple.rs:176:34
    |
 LL |     while let &Either::One(_t) = r { }
    |               ----------------   ^ cannot move out of borrowed content
@@ -410,13 +410,13 @@ LL |     while let &Either::One(_t) = r { }
    |               help: consider removing the `&`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:178:28
+  --> $DIR/simple.rs:176:28
    |
 LL |     while let &Either::One(_t) = r { }
    |                            ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:182:11
+  --> $DIR/simple.rs:180:11
    |
 LL |     match r {
    |           ^ cannot move out of borrowed content
@@ -428,13 +428,13 @@ LL |         &Either::One(_t)
    |         help: consider removing the `&`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:184:22
+  --> $DIR/simple.rs:182:22
    |
 LL |         &Either::One(_t)
    |                      ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:190:11
+  --> $DIR/simple.rs:188:11
    |
 LL |     match r {
    |           ^ cannot move out of borrowed content
@@ -446,13 +446,13 @@ LL |         &Either::One(_t) => (),
    |         help: consider removing the `&`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:192:22
+  --> $DIR/simple.rs:190:22
    |
 LL |         &Either::One(_t) => (),
    |                      ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:197:11
+  --> $DIR/simple.rs:195:11
    |
 LL |     match r {
    |           ^ cannot move out of borrowed content
@@ -464,13 +464,13 @@ LL |         &Either::One(_t) => (),
    |         help: consider removing the `&`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:199:22
+  --> $DIR/simple.rs:197:22
    |
 LL |         &Either::One(_t) => (),
    |                      ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:209:22
+  --> $DIR/simple.rs:207:22
    |
 LL |     let &mut X(_t) = sm;
    |         ----------   ^^ cannot move out of borrowed content
@@ -479,13 +479,13 @@ LL |     let &mut X(_t) = sm;
    |         help: consider removing the `&mut`: `X(_t)`
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:209:16
+  --> $DIR/simple.rs:207:16
    |
 LL |     let &mut X(_t) = sm;
    |                ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:213:35
+  --> $DIR/simple.rs:211:35
    |
 LL |     if let &mut Either::One(_t) = rm { }
    |            --------------------   ^^ cannot move out of borrowed content
@@ -494,13 +494,13 @@ LL |     if let &mut Either::One(_t) = rm { }
    |            help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:213:29
+  --> $DIR/simple.rs:211:29
    |
 LL |     if let &mut Either::One(_t) = rm { }
    |                             ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:217:38
+  --> $DIR/simple.rs:215:38
    |
 LL |     while let &mut Either::One(_t) = rm { }
    |               --------------------   ^^ cannot move out of borrowed content
@@ -509,13 +509,13 @@ LL |     while let &mut Either::One(_t) = rm { }
    |               help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:217:32
+  --> $DIR/simple.rs:215:32
    |
 LL |     while let &mut Either::One(_t) = rm { }
    |                                ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:221:11
+  --> $DIR/simple.rs:219:11
    |
 LL |     match rm {
    |           ^^ cannot move out of borrowed content
@@ -527,7 +527,7 @@ LL |         &mut Either::Two(_t) => (),
    |                          -- ...and here
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/simple.rs:223:26
+  --> $DIR/simple.rs:221:26
    |
 LL |         &mut Either::One(_t) => (),
    |                          ^^
@@ -544,7 +544,7 @@ LL |         Either::Two(_t) => (),
    |         ^^^^^^^^^^^^^^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:230:11
+  --> $DIR/simple.rs:228:11
    |
 LL |     match rm {
    |           ^^ cannot move out of borrowed content
@@ -556,13 +556,13 @@ LL |         &mut Either::One(_t) => (),
    |         help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:232:26
+  --> $DIR/simple.rs:230:26
    |
 LL |         &mut Either::One(_t) => (),
    |                          ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:237:11
+  --> $DIR/simple.rs:235:11
    |
 LL |     match rm {
    |           ^^ cannot move out of borrowed content
@@ -574,13 +574,13 @@ LL |         &mut Either::One(_t) => (),
    |         help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:239:26
+  --> $DIR/simple.rs:237:26
    |
 LL |         &mut Either::One(_t) => (),
    |                          ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:244:11
+  --> $DIR/simple.rs:242:11
    |
 LL |     match rm {
    |           ^^ cannot move out of borrowed content
@@ -592,13 +592,13 @@ LL |         &mut Either::One(_t) => (),
    |         help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:246:26
+  --> $DIR/simple.rs:244:26
    |
 LL |         &mut Either::One(_t) => (),
    |                          ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:260:21
+  --> $DIR/simple.rs:258:21
    |
 LL |     let (&X(_t),) = (&x.clone(),);
    |             --      ^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -606,13 +606,13 @@ LL |     let (&X(_t),) = (&x.clone(),);
    |             data moved here
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:260:13
+  --> $DIR/simple.rs:258:13
    |
 LL |     let (&X(_t),) = (&x.clone(),);
    |             ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:262:34
+  --> $DIR/simple.rs:260:34
    |
 LL |     if let (&Either::One(_t),) = (&e.clone(),) { }
    |                          --      ^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -620,13 +620,13 @@ LL |     if let (&Either::One(_t),) = (&e.clone(),) { }
    |                          data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:262:26
+  --> $DIR/simple.rs:260:26
    |
 LL |     if let (&Either::One(_t),) = (&e.clone(),) { }
    |                          ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:264:37
+  --> $DIR/simple.rs:262:37
    |
 LL |     while let (&Either::One(_t),) = (&e.clone(),) { }
    |                             --      ^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -634,13 +634,13 @@ LL |     while let (&Either::One(_t),) = (&e.clone(),) { }
    |                             data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:264:29
+  --> $DIR/simple.rs:262:29
    |
 LL |     while let (&Either::One(_t),) = (&e.clone(),) { }
    |                             ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:266:11
+  --> $DIR/simple.rs:264:11
    |
 LL |     match (&e.clone(),) {
    |           ^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -649,13 +649,13 @@ LL |         (&Either::One(_t),)
    |                       -- data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:268:23
+  --> $DIR/simple.rs:266:23
    |
 LL |         (&Either::One(_t),)
    |                       ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:274:25
+  --> $DIR/simple.rs:272:25
    |
 LL |     let (&mut X(_t),) = (&mut xm.clone(),);
    |                 --      ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -663,13 +663,13 @@ LL |     let (&mut X(_t),) = (&mut xm.clone(),);
    |                 data moved here
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:274:17
+  --> $DIR/simple.rs:272:17
    |
 LL |     let (&mut X(_t),) = (&mut xm.clone(),);
    |                 ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:276:38
+  --> $DIR/simple.rs:274:38
    |
 LL |     if let (&mut Either::One(_t),) = (&mut em.clone(),) { }
    |                              --      ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -677,13 +677,13 @@ LL |     if let (&mut Either::One(_t),) = (&mut em.clone(),) { }
    |                              data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:276:30
+  --> $DIR/simple.rs:274:30
    |
 LL |     if let (&mut Either::One(_t),) = (&mut em.clone(),) { }
    |                              ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:278:41
+  --> $DIR/simple.rs:276:41
    |
 LL |     while let (&mut Either::One(_t),) = (&mut em.clone(),) { }
    |                                 --      ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -691,13 +691,13 @@ LL |     while let (&mut Either::One(_t),) = (&mut em.clone(),) { }
    |                                 data moved here
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:278:33
+  --> $DIR/simple.rs:276:33
    |
 LL |     while let (&mut Either::One(_t),) = (&mut em.clone(),) { }
    |                                 ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:280:11
+  --> $DIR/simple.rs:278:11
    |
 LL |     match (&mut em.clone(),) {
    |           ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -708,7 +708,7 @@ LL |         (&mut Either::Two(_t),) => (),
    |                           -- ...and here
    |
 note: move occurs because these variables have types that don't implement the `Copy` trait
-  --> $DIR/simple.rs:282:27
+  --> $DIR/simple.rs:280:27
    |
 LL |         (&mut Either::One(_t),) => (),
    |                           ^^
@@ -716,7 +716,7 @@ LL |         (&mut Either::Two(_t),) => (),
    |                           ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:290:18
+  --> $DIR/simple.rs:288:18
    |
 LL |     let &X(_t) = &x;
    |         ------   ^^ cannot move out of borrowed content
@@ -725,13 +725,13 @@ LL |     let &X(_t) = &x;
    |         help: consider removing the `&`: `X(_t)`
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:290:12
+  --> $DIR/simple.rs:288:12
    |
 LL |     let &X(_t) = &x;
    |            ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:294:31
+  --> $DIR/simple.rs:292:31
    |
 LL |     if let &Either::One(_t) = &e { }
    |            ----------------   ^^ cannot move out of borrowed content
@@ -740,13 +740,13 @@ LL |     if let &Either::One(_t) = &e { }
    |            help: consider removing the `&`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:294:25
+  --> $DIR/simple.rs:292:25
    |
 LL |     if let &Either::One(_t) = &e { }
    |                         ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:298:34
+  --> $DIR/simple.rs:296:34
    |
 LL |     while let &Either::One(_t) = &e { }
    |               ----------------   ^^ cannot move out of borrowed content
@@ -755,13 +755,13 @@ LL |     while let &Either::One(_t) = &e { }
    |               help: consider removing the `&`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:298:28
+  --> $DIR/simple.rs:296:28
    |
 LL |     while let &Either::One(_t) = &e { }
    |                            ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:302:11
+  --> $DIR/simple.rs:300:11
    |
 LL |     match &e {
    |           ^^ cannot move out of borrowed content
@@ -773,13 +773,13 @@ LL |         &Either::One(_t)
    |         help: consider removing the `&`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:304:22
+  --> $DIR/simple.rs:302:22
    |
 LL |         &Either::One(_t)
    |                      ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:310:11
+  --> $DIR/simple.rs:308:11
    |
 LL |     match &e {
    |           ^^ cannot move out of borrowed content
@@ -791,13 +791,13 @@ LL |         &Either::One(_t) => (),
    |         help: consider removing the `&`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:312:22
+  --> $DIR/simple.rs:310:22
    |
 LL |         &Either::One(_t) => (),
    |                      ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:317:11
+  --> $DIR/simple.rs:315:11
    |
 LL |     match &e {
    |           ^^ cannot move out of borrowed content
@@ -809,13 +809,13 @@ LL |         &Either::One(_t) => (),
    |         help: consider removing the `&`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:319:22
+  --> $DIR/simple.rs:317:22
    |
 LL |         &Either::One(_t) => (),
    |                      ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:325:22
+  --> $DIR/simple.rs:323:22
    |
 LL |     let &mut X(_t) = &mut xm;
    |         ----------   ^^^^^^^ cannot move out of borrowed content
@@ -824,13 +824,13 @@ LL |     let &mut X(_t) = &mut xm;
    |         help: consider removing the `&mut`: `X(_t)`
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:325:16
+  --> $DIR/simple.rs:323:16
    |
 LL |     let &mut X(_t) = &mut xm;
    |                ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:329:35
+  --> $DIR/simple.rs:327:35
    |
 LL |     if let &mut Either::One(_t) = &mut em { }
    |            --------------------   ^^^^^^^ cannot move out of borrowed content
@@ -839,13 +839,13 @@ LL |     if let &mut Either::One(_t) = &mut em { }
    |            help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:329:29
+  --> $DIR/simple.rs:327:29
    |
 LL |     if let &mut Either::One(_t) = &mut em { }
    |                             ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:333:38
+  --> $DIR/simple.rs:331:38
    |
 LL |     while let &mut Either::One(_t) = &mut em { }
    |               --------------------   ^^^^^^^ cannot move out of borrowed content
@@ -854,13 +854,13 @@ LL |     while let &mut Either::One(_t) = &mut em { }
    |               help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:333:32
+  --> $DIR/simple.rs:331:32
    |
 LL |     while let &mut Either::One(_t) = &mut em { }
    |                                ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:337:11
+  --> $DIR/simple.rs:335:11
    |
 LL |     match &mut em {
    |           ^^^^^^^ cannot move out of borrowed content
@@ -872,13 +872,13 @@ LL |         &mut Either::One(_t)
    |         help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:339:26
+  --> $DIR/simple.rs:337:26
    |
 LL |         &mut Either::One(_t)
    |                          ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:345:11
+  --> $DIR/simple.rs:343:11
    |
 LL |     match &mut em {
    |           ^^^^^^^ cannot move out of borrowed content
@@ -890,13 +890,13 @@ LL |         &mut Either::One(_t) => (),
    |         help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:347:26
+  --> $DIR/simple.rs:345:26
    |
 LL |         &mut Either::One(_t) => (),
    |                          ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:352:11
+  --> $DIR/simple.rs:350:11
    |
 LL |     match &mut em {
    |           ^^^^^^^ cannot move out of borrowed content
@@ -908,13 +908,13 @@ LL |         &mut Either::One(_t) => (),
    |         help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:354:26
+  --> $DIR/simple.rs:352:26
    |
 LL |         &mut Either::One(_t) => (),
    |                          ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:359:11
+  --> $DIR/simple.rs:357:11
    |
 LL |     match &mut em {
    |           ^^^^^^^ cannot move out of borrowed content
@@ -926,13 +926,13 @@ LL |         &mut Either::One(_t) => (),
    |         help: consider removing the `&mut`: `Either::One(_t)`
    |
 note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:361:26
+  --> $DIR/simple.rs:359:26
    |
 LL |         &mut Either::One(_t) => (),
    |                          ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:204:11
+  --> $DIR/simple.rs:202:11
    |
 LL |     fn f1(&X(_t): &X) { }
    |           ^^^--^
@@ -942,13 +942,13 @@ LL |     fn f1(&X(_t): &X) { }
    |           help: consider removing the `&`: `X(_t)`
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:204:14
+  --> $DIR/simple.rs:202:14
    |
 LL |     fn f1(&X(_t): &X) { }
    |              ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:251:11
+  --> $DIR/simple.rs:249:11
    |
 LL |     fn f2(&mut X(_t): &mut X) { }
    |           ^^^^^^^--^
@@ -958,13 +958,13 @@ LL |     fn f2(&mut X(_t): &mut X) { }
    |           help: consider removing the `&mut`: `X(_t)`
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:251:18
+  --> $DIR/simple.rs:249:18
    |
 LL |     fn f2(&mut X(_t): &mut X) { }
    |                  ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:271:11
+  --> $DIR/simple.rs:269:11
    |
 LL |     fn f3((&X(_t),): (&X,)) { }
    |           ^^^^--^^^
@@ -973,13 +973,13 @@ LL |     fn f3((&X(_t),): (&X,)) { }
    |           cannot move out of borrowed content
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:271:15
+  --> $DIR/simple.rs:269:15
    |
 LL |     fn f3((&X(_t),): (&X,)) { }
    |               ^^
 
 error[E0507]: cannot move out of borrowed content
-  --> $DIR/simple.rs:285:11
+  --> $DIR/simple.rs:283:11
    |
 LL |     fn f4((&mut X(_t),): (&mut X,)) { }
    |           ^^^^^^^^--^^^
@@ -988,7 +988,7 @@ LL |     fn f4((&mut X(_t),): (&mut X,)) { }
    |           cannot move out of borrowed content
    |
 note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
-  --> $DIR/simple.rs:285:19
+  --> $DIR/simple.rs:283:19
    |
 LL |     fn f4((&mut X(_t),): (&mut X,)) { }
    |                   ^^
diff --git a/src/test/ui/suggestions/issue-57672.rs b/src/test/ui/suggestions/issue-57672.rs
new file mode 100644 (file)
index 0000000..1773f72
--- /dev/null
@@ -0,0 +1,14 @@
+// aux-build:foo.rs
+// compile-flags:--extern foo
+// compile-pass
+// edition:2018
+
+#![deny(unused_extern_crates)]
+
+extern crate foo as foo_renamed;
+
+pub mod m {
+    pub use foo_renamed::Foo;
+}
+
+fn main() {}
diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr b/src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr
new file mode 100644 (file)
index 0000000..f4eb981
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0310]: the parameter type `impl Debug` may not live long enough
+  --> $DIR/suggest-impl-trait-lifetime.rs:7:5
+   |
+LL |     bar(d);
+   |     ^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `impl Debug: 'static`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
index b4a6fa39f9052ba22d3eddd4cc649a51153db528..d04113ffccc3a9b63c5b9177a9374f36e7161ca2 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(nll)]
-
 struct X(usize);
 
 impl X {
index 3dd9fbc6f1480012a486f22b4d95bc5ae5184d2c..24143678757187454e6ec86e0e2039d72ee15673 100644 (file)
@@ -1,5 +1,5 @@
 error[E0594]: cannot assign to `self.0` which is behind a `&` reference
-  --> $DIR/suggest-ref-mut.rs:9:9
+  --> $DIR/suggest-ref-mut.rs:7:9
    |
 LL |     fn zap(&self) {
    |            ----- help: consider changing this to be a mutable reference: `&mut self`
@@ -8,7 +8,7 @@ LL |         self.0 = 32;
    |         ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
 
 error[E0594]: cannot assign to `*foo` which is behind a `&` reference
-  --> $DIR/suggest-ref-mut.rs:18:5
+  --> $DIR/suggest-ref-mut.rs:16:5
    |
 LL |     let ref foo = 16;
    |         ------- help: consider changing this to be a mutable reference: `ref mut foo`
@@ -17,7 +17,7 @@ LL |     *foo = 32;
    |     ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written
 
 error[E0594]: cannot assign to `*bar` which is behind a `&` reference
-  --> $DIR/suggest-ref-mut.rs:23:9
+  --> $DIR/suggest-ref-mut.rs:21:9
    |
 LL |     if let Some(ref bar) = Some(16) {
    |                 ------- help: consider changing this to be a mutable reference: `ref mut bar`
@@ -26,7 +26,7 @@ LL |         *bar = 32;
    |         ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written
 
 error[E0594]: cannot assign to `*quo` which is behind a `&` reference
-  --> $DIR/suggest-ref-mut.rs:27:22
+  --> $DIR/suggest-ref-mut.rs:25:22
    |
 LL |         ref quo => { *quo = 32; },
    |         -------      ^^^^^^^^^ `quo` is a `&` reference, so the data it refers to cannot be written
diff --git a/src/test/ui/thread-local-in-ctfe.nll.stderr b/src/test/ui/thread-local-in-ctfe.nll.stderr
new file mode 100644 (file)
index 0000000..18d01b1
--- /dev/null
@@ -0,0 +1,49 @@
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:6:17
+   |
+LL | static B: u32 = A;
+   |                 ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:9:18
+   |
+LL | static C: &u32 = &A;
+   |                  ^^
+
+error[E0712]: thread-local variable borrowed past end of function
+  --> $DIR/thread-local-in-ctfe.rs:9:18
+   |
+LL | static C: &u32 = &A;
+   |                  ^^- end of enclosing function is here
+   |                  |
+   |                  thread-local variables cannot be borrowed beyond the end of the function
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:15:16
+   |
+LL | const D: u32 = A;
+   |                ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:18:17
+   |
+LL | const E: &u32 = &A;
+   |                 ^^
+
+error[E0712]: thread-local variable borrowed past end of function
+  --> $DIR/thread-local-in-ctfe.rs:18:17
+   |
+LL | const E: &u32 = &A;
+   |                 ^^- end of enclosing function is here
+   |                 |
+   |                 thread-local variables cannot be borrowed beyond the end of the function
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:25:5
+   |
+LL |     A
+   |     ^
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0712`.
index 7c7366df1dc3ed6b59eac7c13fbf3b20c8ee6f18..e1c2c6b675e9bb1d1dd2d7a2ae56d7f1b73f9801 100644 (file)
@@ -4,6 +4,7 @@ error[E0277]: `?` couldn't convert the error to `i32`
 LL |         Err("")?;
    |                ^ the trait `std::convert::From<&str>` is not implemented for `i32`
    |
+   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following implementations were found:
              <i32 as std::convert::From<bool>>
              <i32 as std::convert::From<i16>>
index 4465fbe14b75cd39f2f9b3265dd245f4738b9f8a..db5046f8c151af029bc24d9f3b3a59b5b8c39c55 100644 (file)
@@ -4,6 +4,7 @@ error[E0277]: `?` couldn't convert the error to `()`
 LL |     x?;
    |      ^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()`
    |
+   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = note: required by `std::convert::From::from`
 
 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr
new file mode 100644 (file)
index 0000000..ead42c1
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:9
+   |
+LL |     doit(0, &|x, y| {
+   |               -  - has type `&'1 i32`
+   |               |
+   |               has type `&std::cell::Cell<&'2 i32>`
+LL |         x.set(y);
+   |         ^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr
new file mode 100644 (file)
index 0000000..8ed48bd
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/dyn-trait-underscore.rs:8:5
+   |
+LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
+   |                - let's call the lifetime of this reference `'1`
+LL |     //                      ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
+LL |     Box::new(items.iter())
+   |     ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr
new file mode 100644 (file)
index 0000000..e1d57b8
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/underscore-lifetime-elison-mismatch.rs:1:42
+   |
+LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
+   |                    -           -         ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+   |                    |           |
+   |                    |           let's call the lifetime of this reference `'1`
+   |                    let's call the lifetime of this reference `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr
new file mode 100644 (file)
index 0000000..344437f
--- /dev/null
@@ -0,0 +1,106 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:4:5
+   |
+LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
+   |                     ---- lifetime `'new` defined here
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:7:5
+   |
+LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
+   |                     ---- lifetime `'new` defined here
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:10:5
+   |
+LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
+   |                        ---- lifetime `'new` defined here
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:13:5
+   |
+LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
+   |                        ---- lifetime `'new` defined here
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:18:5
+   |
+LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
+   |                    ---- lifetime `'new` defined here
+LL |                          -> OccupiedEntry<'a, &'new (), ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:22:5
+   |
+LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
+   |                    ---- lifetime `'new` defined here
+LL |                          -> OccupiedEntry<'a, (), &'new ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:26:5
+   |
+LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
+   |                       ---- lifetime `'new` defined here
+LL |                             -> OccupiedEntry<'a, &'static (), ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:30:5
+   |
+LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
+   |                       ---- lifetime `'new` defined here
+LL |                             -> OccupiedEntry<'a, (), &'static ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:35:5
+   |
+LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
+   |                    ---- lifetime `'new` defined here
+LL |                          -> VacantEntry<'a, &'new (), ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:39:5
+   |
+LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
+   |                    ---- lifetime `'new` defined here
+LL |                          -> VacantEntry<'a, (), &'new ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:43:5
+   |
+LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
+   |                       ---- lifetime `'new` defined here
+LL |                             -> VacantEntry<'a, &'static (), ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:47:5
+   |
+LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
+   |                       ---- lifetime `'new` defined here
+LL |                             -> VacantEntry<'a, (), &'static ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: aborting due to 12 previous errors
+
diff --git a/src/test/ui/variance/variance-cell-is-invariant.nll.stderr b/src/test/ui/variance/variance-cell-is-invariant.nll.stderr
new file mode 100644 (file)
index 0000000..a3ae532
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-cell-is-invariant.rs:14:12
+   |
+LL | fn use_<'short,'long>(c: Foo<'short>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Foo<'long> = c;
+   |            ^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr
new file mode 100644 (file)
index 0000000..8b5ecbe
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-arg-object.rs:14:5
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-arg-object.rs:22:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..dbd75cb
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-arg-trait-match.rs:13:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'min i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-arg-trait-match.rs:21:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'max i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..9212cf2
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-self-trait-match.rs:13:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'min G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-self-trait-match.rs:22:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'max G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr
new file mode 100644 (file)
index 0000000..acf9f2e
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-arg-object.rs:15:5
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-arg-object.rs:22:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..3358912
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-arg-trait-match.rs:14:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'min i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-arg-trait-match.rs:20:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'max i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..6b2413d
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-self-trait-match.rs:14:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'min G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-self-trait-match.rs:20:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'max G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr
new file mode 100644 (file)
index 0000000..3c1ee7f
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-arg-object.rs:11:5
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-arg-object.rs:18:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..2ab44c5
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-arg-trait-match.rs:10:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'min i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-arg-trait-match.rs:16:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'max i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..7b7c42f
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-self-trait-match.rs:10:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'min G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-self-trait-match.rs:16:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'max G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-trait-matching.nll.stderr b/src/test/ui/variance/variance-trait-matching.nll.stderr
new file mode 100644 (file)
index 0000000..3308cc6
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0621]: explicit lifetime required in the type of `get`
+  --> $DIR/variance-trait-matching.rs:24:5
+   |
+LL | fn get<'a, G>(get: &G) -> i32
+   |                    -- help: add explicit lifetime `'a` to the type of `get`: `&'a G`
+...
+LL |     pick(get, &22)
+   |     ^^^^^^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr
new file mode 100644 (file)
index 0000000..8468448
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-use-contravariant-struct-1.rs:12:5
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+   |        ---- ---- lifetime `'max` defined here
+   |        |
+   |        lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr
new file mode 100644 (file)
index 0000000..19a22f0
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-use-covariant-struct-1.rs:10:5
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
+   |        ---- ---- lifetime `'max` defined here
+   |        |
+   |        lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr
new file mode 100644 (file)
index 0000000..61f80fe
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-use-invariant-struct-1.rs:12:5
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+   |        ---- ---- lifetime `'max` defined here
+   |        |
+   |        lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-use-invariant-struct-1.rs:19:5
+   |
+LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
+   |        ---- ---- lifetime `'max` defined here
+   |        |
+   |        lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/wf/wf-static-method.nll.stderr b/src/test/ui/wf/wf-static-method.nll.stderr
new file mode 100644 (file)
index 0000000..338de6d
--- /dev/null
@@ -0,0 +1,65 @@
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:17:9
+   |
+LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
+   |      --  -- lifetime `'b` defined here
+   |      |
+   |      lifetime `'a` defined here
+...
+LL |         u
+   |         ^ returning this value requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:26:18
+   |
+LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> {
+   |      --  -- lifetime `'b` defined here
+   |      |
+   |      lifetime `'a` defined here
+...
+LL |         let me = Self::make_me();
+   |                  ^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:33:9
+   |
+LL | impl<'a, 'b> Evil<'a, 'b> {
+   |      --  -- lifetime `'b` defined here
+   |      |
+   |      lifetime `'a` defined here
+LL |     fn inherent_evil(u: &'b u32) -> &'a u32 {
+LL |         u
+   |         ^ returning this value requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:41:5
+   |
+LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |         --  -- lifetime `'b` defined here
+   |         |
+   |         lifetime `'a` defined here
+LL |     <()>::static_evil(b)
+   |     ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:45:5
+   |
+LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |                  --  -- lifetime `'b` defined here
+   |                  |
+   |                  lifetime `'a` defined here
+LL |     <IndirectEvil>::static_evil(b)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:50:5
+   |
+LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |                  --  -- lifetime `'b` defined here
+   |                  |
+   |                  lifetime `'a` defined here
+LL |     <Evil>::inherent_evil(b) // bug? shouldn't this be an error
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a`
+
+error: aborting due to 6 previous errors
+
index 759b6161a328db1d4863139e90875308ecd25a75..c4fcfb725b4be00c72eb9cf30c7d8b095577c280 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 759b6161a328db1d4863139e90875308ecd25a75
+Subproject commit c4fcfb725b4be00c72eb9cf30c7d8b095577c280
index ad3269c4b510b94b7c0082f4bb341bee6ed1eca4..60a609acaed3bf2b3ec6ab995bccf0f03bc26060 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ad3269c4b510b94b7c0082f4bb341bee6ed1eca4
+Subproject commit 60a609acaed3bf2b3ec6ab995bccf0f03bc26060
index 336d7e32024b7748a5f596a491956cd95f5cafab..e759ad1f35dde426d8efd05251d1728c76e5e93c 100644 (file)
@@ -7,7 +7,6 @@ edition = "2018"
 [dependencies]
 diff = "0.1.10"
 env_logger = { version = "0.5", default-features = false }
-filetime = "0.2"
 getopts = "0.2"
 log = "0.4"
 regex = "1.0"
index e253934e566a725b253850f071a1acc01b200b5a..442e58bfd74e1408c1ff9b9e31c5ed018ff507de 100644 (file)
@@ -9,7 +9,6 @@
 use crate::common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS};
 use crate::common::{Config, TestPaths};
 use crate::common::{DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Mode, Pretty};
-use filetime::FileTime;
 use getopts::Options;
 use std::env;
 use std::ffi::OsString;
@@ -17,6 +16,7 @@
 use std::io::{self, ErrorKind};
 use std::path::{Path, PathBuf};
 use std::process::Command;
+use std::time::SystemTime;
 use test::ColorConfig;
 use crate::util::logv;
 use walkdir::WalkDir;
@@ -752,31 +752,36 @@ fn up_to_date(
 
 #[derive(Debug, PartialEq, PartialOrd, Ord, Eq)]
 struct Stamp {
-    time: FileTime,
+    time: SystemTime,
     file: PathBuf,
 }
 
 impl Stamp {
     fn from_path(p: &Path) -> Self {
+        let time = fs::metadata(p)
+            .and_then(|metadata| metadata.modified())
+            .unwrap_or(SystemTime::UNIX_EPOCH);
+
         Stamp {
-            time: mtime(&p),
+            time,
             file: p.into(),
         }
     }
 
-    fn from_dir(path: &Path) -> impl Iterator<Item=Stamp> {
+    fn from_dir(path: &Path) -> impl Iterator<Item = Stamp> {
         WalkDir::new(path)
             .into_iter()
             .map(|entry| entry.unwrap())
             .filter(|entry| entry.file_type().is_file())
-            .map(|entry| Stamp::from_path(entry.path()))
-    }
-}
+            .map(|entry| {
+                let time = (|| -> io::Result<_> { entry.metadata()?.modified() })();
 
-fn mtime(path: &Path) -> FileTime {
-    fs::metadata(path)
-        .map(|f| FileTime::from_last_modification_time(&f))
-        .unwrap_or_else(|_| FileTime::zero())
+                Stamp {
+                    time: time.unwrap_or(SystemTime::UNIX_EPOCH),
+                    file: entry.path().into(),
+                }
+            })
+    }
 }
 
 fn make_test_name(
index b335fe3ae185a270d17057dcc7adfb2781c9d215..2082de7cbce3454e83759ba5659ef7d01ada246b 100644 (file)
@@ -9,7 +9,6 @@
 use crate::common::{Incremental, MirOpt, RunMake, Ui, JsDocTest, Assembly};
 use diff;
 use crate::errors::{self, Error, ErrorKind};
-use filetime::FileTime;
 use crate::header::TestProps;
 use crate::json;
 use regex::{Captures, Regex};
@@ -1912,8 +1911,7 @@ fn make_compile_args(&self, input_file: &Path, output_file: TargetLocation) -> C
 
         match self.config.compare_mode {
             Some(CompareMode::Nll) => {
-                // FIXME(#56993) use -Zborrowck=mir
-                rustc.args(&["-Zborrowck=migrate"]);
+                rustc.args(&["-Zborrowck=mir"]);
             }
             Some(CompareMode::Polonius) => {
                 rustc.args(&["-Zpolonius", "-Zborrowck=mir"]);
@@ -3029,7 +3027,7 @@ fn check_mir_dump(&self) {
     }
 
     fn check_mir_test_timestamp(&self, test_name: &str, output_file: &Path) {
-        let t = |file| FileTime::from_last_modification_time(&fs::metadata(file).unwrap());
+        let t = |file| fs::metadata(file).unwrap().modified().unwrap();
         let source_file = &self.testpaths.file;
         let output_time = t(output_file);
         let source_time = t(source_file);
index 04986b59ea0f1afeee4df464bf31e649bbab707d..3e7c7ab6379d8433d983a66232a85b01d9eed841 100644 (file)
@@ -15,6 +15,7 @@
 use std::path::PathBuf;
 use std::cell::RefCell;
 
+use syntax::edition::DEFAULT_EDITION;
 use syntax::diagnostics::metadata::{get_metadata_dir, ErrorMetadataMap, ErrorMetadata};
 
 use rustdoc::html::markdown::{Markdown, IdMap, ErrorCodes, PLAYGROUND};
@@ -97,7 +98,8 @@ fn error_code_block(&self, output: &mut dyn Write, info: &ErrorMetadata,
             Some(ref desc) => {
                 let mut id_map = self.0.borrow_mut();
                 write!(output, "{}",
-                    Markdown(desc, &[], RefCell::new(&mut id_map), ErrorCodes::Yes))?
+                    Markdown(desc, &[], RefCell::new(&mut id_map),
+                             ErrorCodes::Yes, DEFAULT_EDITION))?
             },
             None => write!(output, "<p>No description.</p>\n")?,
         }
@@ -264,7 +266,7 @@ fn main() {
         *slot.borrow_mut() = Some((None, String::from("https://play.rust-lang.org/")));
     });
     let (format, dst) = parse_args();
-    let result = syntax::with_globals(move || {
+    let result = syntax::with_default_globals(move || {
         main_with_result(format, &dst)
     });
     if let Err(e) = result {
index bc0c76d861a178911f3f506196a7404eda1e690d..0c85dbf3df0f545133dca24eccfc9f0f6107c7f8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit bc0c76d861a178911f3f506196a7404eda1e690d
+Subproject commit 0c85dbf3df0f545133dca24eccfc9f0f6107c7f8
index 5b8e99bb61958ca8abcb7c5eda70521726be1065..9692ca8fd82a8f96a4113dc4b88c1fb1d79c1c60 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 5b8e99bb61958ca8abcb7c5eda70521726be1065
+Subproject commit 9692ca8fd82a8f96a4113dc4b88c1fb1d79c1c60
index 5bf1553b22711914fbf67ec5968b6140ffb5aa81..d2b1a7bac60aed0e5cb2326c497370dcb88d4797 100644 (file)
@@ -2,7 +2,7 @@
 authors = ["The Rust Project Developers"]
 name = "rustbook"
 version = "0.1.0"
-license = "MIT/Apache-2.0"
+license = "MIT OR Apache-2.0"
 edition = "2018"
 
 [dependencies]
index 98578914963db01a83d9eff939118a443f478b4b..05df1fddc7f1c9125b109b8bae41a3e675082174 100644 (file)
@@ -2,7 +2,7 @@
 name = "rustc-std-workspace-alloc"
 version = "1.0.0"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
-license = 'MIT/Apache-2.0'
+license = 'MIT OR Apache-2.0'
 description = """
 Hack for the compiler's own build system
 """
index d527ce12bc3a15335f491c7a7a23f42ae7b3d94a..38ca56a557be6c2935c62da934f57bf8f3552d62 100644 (file)
@@ -2,7 +2,7 @@
 name = "rustc-std-workspace-core"
 version = "1.0.0"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
-license = 'MIT/Apache-2.0'
+license = 'MIT OR Apache-2.0'
 description = """
 Hack for the compiler's own build system
 """
index d51841cd65075cc6b5361bc8bc45c8a16269b16f..290c4481c005e552871a44230bd4a898b66effc7 100644 (file)
@@ -2,7 +2,7 @@
 name = "rustc-workspace-hack"
 version = "1.0.0"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
-license = 'MIT/Apache-2.0'
+license = 'MIT OR Apache-2.0'
 description = """
 Hack for the compiler's own build system
 """
index 3209de09aeb68ae670c2399a35c6b165c50496dd..e43e4e6c7cb5ae691bae64ea69a47e5df0a7cb05 100644 (file)
@@ -3,7 +3,7 @@ authors = ["est31 <MTest31@outlook.com>",
            "The Rust Project Developers"]
 name = "unstable-book-gen"
 version = "0.1.0"
-license = "MIT/Apache-2.0"
+license = "MIT OR Apache-2.0"
 edition = "2018"
 
 [dependencies]
index 6f60481600c2ebe79d4d5c0903dc78b4883ec77b..0e703a3ab349d2951a0cc0b914e4499092d0b464 100644 (file)
@@ -4,3 +4,5 @@ allow-unauthenticated = [
     # I-* without I-nominated
     "I-compilemem", "I-compiletime", "I-crash", "I-hang", "I-ICE", "I-slow",
 ]
+
+[assign]