From d8db5299fae13a5ef321fd8f7be7364d735fecbb Mon Sep 17 00:00:00 2001 From: David Wood Date: Wed, 17 Oct 2018 00:47:28 +0200 Subject: [PATCH 1/3] Don't buffer lints. When lints are emitted from the AST borrow checker, they do not signal an error as it is not known at that time whether, due to attributes, that lint will error or warn. This means that when lints are buffered in the MIR they will always be downgraded, as the AST borrowck will not have been marked as having errored, even if a lint was upgraded to an error after being emitted from the AST borrowck. The simple solution to this is to not buffer any lints from the MIR borrowck. --- src/librustc_mir/borrow_check/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 9cbaf35acd3..fe80447e4a8 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -321,20 +321,20 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( continue; } - let mut err = tcx.struct_span_lint_node( + let mut_span = tcx.sess.source_map().span_until_non_whitespace(span); + tcx.struct_span_lint_node( UNUSED_MUT, vsi[local_decl.source_info.scope].lint_root, span, "variable does not need to be mutable", - ); - let mut_span = tcx.sess.source_map().span_until_non_whitespace(span); - err.span_suggestion_short_with_applicability( + ) + .span_suggestion_short_with_applicability( mut_span, "remove this `mut`", String::new(), - Applicability::MachineApplicable); - - err.buffer(&mut mbcx.errors_buffer); + Applicability::MachineApplicable, + ) + .emit(); } } From 8b34881e972906545d030318006478c1986fa0aa Mon Sep 17 00:00:00 2001 From: David Wood Date: Wed, 17 Oct 2018 00:51:05 +0200 Subject: [PATCH 2/3] Change NLL compare mode to borrowck=migrate. This commit changes the NLL compare mode to pass `-Z borrowck=migrate` rather than `-Z borrowck=nll` to better test what will be deployed. It does not include the test output updates, as separation of these commits makes reviewing simpler. --- src/tools/compiletest/src/runtest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 4cb6f6b83bd..c69956030c0 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1810,7 +1810,7 @@ impl<'test> TestCx<'test> { match self.config.compare_mode { Some(CompareMode::Nll) => { - rustc.args(&["-Zborrowck=mir", "-Ztwo-phase-borrows"]); + rustc.args(&["-Zborrowck=migrate", "-Ztwo-phase-borrows"]); } Some(CompareMode::Polonius) => { rustc.args(&["-Zpolonius", "-Zborrowck=mir", "-Ztwo-phase-borrows"]); From 539404b77d1e443793c653ae03b207c62b3b1ae0 Mon Sep 17 00:00:00 2001 From: David Wood Date: Wed, 17 Oct 2018 00:57:32 +0200 Subject: [PATCH 3/3] Update output for borrowck=migrate compare mode. This commit updates the test output for the updated NLL compare mode that uses `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The previous commit changes `compiletest` and this commit only updates `.nll.stderr` files. --- .../ui/access-mode-in-closures.nll.stderr | 14 ++- ...es-project-from-hrtb-in-fn-body.nll.stderr | 24 ---- .../associated-types-subtyping-1.nll.stderr | 24 ---- ...fn-ret-contravariant.krisskross.nll.stderr | 24 ---- ...-fn-ret-contravariant.transmute.nll.stderr | 20 ---- ...ect-fn-ret-invariant.krisskross.nll.stderr | 24 ---- ...project-fn-ret-invariant.oneuse.nll.stderr | 24 ---- ...ject-fn-ret-invariant.transmute.nll.stderr | 22 ---- .../ui/binop/binop-move-semantics.nll.stderr | 14 ++- .../borrowck-closures-unique.nll.stderr | 8 +- .../borrowck-describe-lvalue.ast.nll.stderr | 19 +++- .../borrowck-fn-in-const-a.ast.nll.stderr | 20 ++++ ...or-loop-correct-cmt-for-pattern.nll.stderr | 32 +++++- .../ui/borrowck/borrowck-in-static.nll.stderr | 17 ++- .../borrowck/borrowck-issue-2657-2.nll.stderr | 13 ++- .../borrowck-move-error-with-note.nll.stderr | 50 ++++++++- .../borrowck-move-from-unsafe-ptr.nll.stderr | 13 ++- ...orrowck-move-in-irrefut-pat.ast.nll.stderr | 29 ++++- ...ut-of-overloaded-auto-deref.ast.nll.stderr | 11 +- ...ck-move-out-of-overloaded-deref.nll.stderr | 11 +- ...wck-move-out-of-static-item.ast.nll.stderr | 18 +++ .../borrowck-move-out-of-vec-tail.nll.stderr | 29 ++++- ...-overloaded-index-move-from-vec.nll.stderr | 11 +- ...orrow-from-shorter-lived-andmut.nll.stderr | 12 -- src/test/ui/borrowck/issue-51415.nll.stderr | 11 +- src/test/ui/borrowck/issue-7573.nll.stderr | 14 --- ...tic-initializer-issue-38520.ast.nll.stderr | 33 ++++++ .../ui/borrowck/mutability-errors.nll.stderr | 26 ++++- .../regions-escape-bound-fn-2.nll.stderr | 12 -- .../regions-escape-bound-fn.nll.stderr | 12 -- .../regions-escape-unboxed-closure.nll.stderr | 12 -- ...upvar-from-non-once-ref-closure.nll.stderr | 21 +++- .../ui/by-move-pattern-binding.nll.stderr | 11 +- ...check-static-values-constraints.nll.stderr | 11 +- .../expect-fn-supply-fn.nll.stderr | 54 --------- ...ds-static-cant-capture-borrowed.nll.stderr | 29 ----- .../expect-region-supply-region.nll.stderr | 34 ------ .../min_const_fn/min_const_fn.nll.stderr | 7 +- .../min_const_fn/min_const_fn_dyn.nll.stderr | 7 +- src/test/ui/dst/dst-index.nll.stderr | 20 +++- src/test/ui/dst/dst-rvalue.nll.stderr | 22 +++- src/test/ui/error-codes/E0507.nll.stderr | 18 +++ ...1-does-not-trigger-for-closures.nll.stderr | 11 -- ..._type_does_not_live_long_enough.nll.stderr | 12 -- ...ubtype.free_inv_x_vs_free_inv_y.nll.stderr | 30 ----- .../hr-subtype.free_x_vs_free_y.nll.stderr | 16 --- .../dyn-trait.nll.stderr | 10 -- ...t_outlive_least_region_or_bound.nll.stderr | 49 -------- .../static-return-lifetime-infered.nll.stderr | 26 ----- .../type_parameters_captured.nll.stderr | 11 -- .../in-band-lifetimes/mismatched.nll.stderr | 20 ---- src/test/ui/issues/issue-10291.nll.stderr | 11 -- src/test/ui/issues/issue-12567.nll.stderr | 41 ++++++- src/test/ui/issues/issue-13058.nll.stderr | 12 -- src/test/ui/issues/issue-15034.nll.stderr | 11 -- src/test/ui/issues/issue-16683.nll.stderr | 10 -- .../issues/issue-17718-static-move.nll.stderr | 11 +- src/test/ui/issues/issue-17728.nll.stderr | 19 ---- src/test/ui/issues/issue-17758.nll.stderr | 10 -- src/test/ui/issues/issue-20801.nll.stderr | 20 +++- src/test/ui/issues/issue-2590.nll.stderr | 13 ++- src/test/ui/issues/issue-26217.nll.stderr | 9 -- src/test/ui/issues/issue-30355.nll.stderr | 13 ++- src/test/ui/issues/issue-40288-2.nll.stderr | 21 ---- .../issue-40402-1.nll.stderr | 11 +- .../issue-40402-2.nll.stderr | 20 +++- src/test/ui/issues/issue-40510-1.nll.stderr | 11 +- src/test/ui/issues/issue-40510-3.nll.stderr | 11 +- src/test/ui/issues/issue-4335.nll.stderr | 11 +- src/test/ui/issues/issue-49824.nll.stderr | 17 ++- src/test/ui/issues/issue-52213.nll.stderr | 13 --- src/test/ui/issues/issue-52533-1.nll.stderr | 11 -- src/test/ui/issues/issue-52533.nll.stderr | 11 -- .../kindck/kindck-impl-type-params.nll.stderr | 63 ----------- .../ui/kindck/kindck-send-object1.nll.stderr | 32 ------ ...etime-bound-will-change-warning.nll.stderr | 20 ---- ...xisting-name-if-else-using-impl.nll.stderr | 13 --- ...isting-name-return-type-is-anon.nll.stderr | 13 --- ...-one-existing-name-self-is-anon.nll.stderr | 13 --- .../ex2a-push-one-existing-name-2.nll.stderr | 11 -- ...h-one-existing-name-early-bound.nll.stderr | 12 -- .../ex2a-push-one-existing-name.nll.stderr | 11 -- .../ex2b-push-no-existing-names.nll.stderr | 12 -- .../ex2c-push-inference-variable.nll.stderr | 13 --- .../ex2d-push-inference-variable-2.nll.stderr | 13 --- .../ex2e-push-inference-variable-3.nll.stderr | 13 --- .../ex3-both-anon-regions-2.nll.stderr | 12 -- .../ex3-both-anon-regions-3.nll.stderr | 22 ---- ...anon-regions-both-are-structs-2.nll.stderr | 12 -- ...anon-regions-both-are-structs-3.nll.stderr | 13 --- ...-are-structs-earlybound-regions.nll.stderr | 13 --- ...h-are-structs-latebound-regions.nll.stderr | 12 -- ...h-anon-regions-both-are-structs.nll.stderr | 12 -- ...-anon-regions-latebound-regions.nll.stderr | 12 -- ...th-anon-regions-one-is-struct-2.nll.stderr | 21 ---- ...th-anon-regions-one-is-struct-3.nll.stderr | 12 -- ...th-anon-regions-one-is-struct-4.nll.stderr | 12 -- ...both-anon-regions-one-is-struct.nll.stderr | 12 -- ...non-regions-return-type-is-anon.nll.stderr | 12 -- ...-both-anon-regions-self-is-anon.nll.stderr | 12 -- ...oth-anon-regions-using-fn-items.nll.stderr | 21 ---- ...h-anon-regions-using-impl-items.nll.stderr | 12 -- ...non-regions-using-trait-objects.nll.stderr | 21 ---- .../ex3-both-anon-regions.nll.stderr | 12 -- src/test/ui/lub-if.nll.stderr | 20 ---- src/test/ui/lub-match.nll.stderr | 20 ---- .../match/match-ref-mut-invariance.nll.stderr | 12 -- .../match-ref-mut-let-invariance.nll.stderr | 13 --- .../moves-based-on-type-block-bad.nll.stderr | 14 ++- ...e-out-of-closure-env-issue-1965.nll.stderr | 17 ++- .../ui/nll/cannot-move-block-spans.nll.stderr | 72 +++++++++++- .../match-guards-always-borrow.ast.nll.stderr | 30 ++++- ...where-clause-env-wrong-lifetime.nll.stderr | 11 -- ...object-lifetime-default-elision.nll.stderr | 13 --- ...lifetime-default-from-box-error.nll.stderr | 28 ----- ...ime-default-from-rptr-box-error.nll.stderr | 10 -- ...-default-from-rptr-struct-error.nll.stderr | 10 -- .../object-lifetime-default-mybox.nll.stderr | 21 ---- ...nvariant-static-error-reporting.nll.stderr | 11 -- ...time-bounds-on-fns-where-clause.nll.stderr | 12 -- ...time-bounds-on-fns-where-clause.nll.stderr | 12 -- .../region-object-lifetime-2.nll.stderr | 12 -- .../region-object-lifetime-4.nll.stderr | 12 -- ...ion-object-lifetime-in-coercion.nll.stderr | 38 ------- .../regions/regions-addr-of-self.nll.stderr | 10 -- .../regions-addr-of-upvar-self.nll.stderr | 47 -------- ...n-supertrait-outlives-container.nll.stderr | 13 --- ...unded-by-trait-requiring-static.nll.stderr | 50 --------- ...hod-type-parameters-cross-crate.nll.stderr | 13 --- ...hod-type-parameters-trait-bound.nll.stderr | 13 --- ...-bounded-method-type-parameters.nll.stderr | 19 ---- src/test/ui/regions/regions-bounds.nll.stderr | 22 ---- ...ose-associated-type-into-object.nll.stderr | 36 ------ ...ions-close-object-into-object-2.nll.stderr | 21 ---- ...ions-close-object-into-object-4.nll.stderr | 38 ------- ...ions-close-object-into-object-5.nll.stderr | 31 ----- ...ons-close-over-type-parameter-1.nll.stderr | 20 ---- ...se-over-type-parameter-multiple.nll.stderr | 11 -- ...regions-close-param-into-object.nll.stderr | 36 ------ .../regions-creating-enums3.nll.stderr | 12 -- .../regions-creating-enums4.nll.stderr | 12 -- ...egions-early-bound-error-method.nll.stderr | 12 -- .../regions-early-bound-error.nll.stderr | 12 -- .../regions/regions-escape-method.nll.stderr | 11 -- ...regions-escape-via-trait-or-not.nll.stderr | 11 -- ...ons-free-region-ordering-callee.nll.stderr | 24 ---- ...ons-free-region-ordering-caller.nll.stderr | 33 ------ ...-free-region-ordering-incorrect.nll.stderr | 15 --- ...implied-bounds-projection-gap-1.nll.stderr | 11 -- ...ons-infer-bound-from-trait-self.nll.stderr | 11 -- .../regions-infer-bound-from-trait.nll.stderr | 19 ---- .../regions/regions-infer-call-3.nll.stderr | 11 -- ...nfer-contravariance-due-to-decl.nll.stderr | 13 --- ...ns-infer-covariance-due-to-decl.nll.stderr | 13 --- ...ns-infer-invariance-due-to-decl.nll.stderr | 10 -- ...-invariance-due-to-mutability-3.nll.stderr | 10 -- ...-invariance-due-to-mutability-4.nll.stderr | 10 -- .../regions-infer-not-param.nll.stderr | 26 ----- .../regions-infer-paramd-indirect.nll.stderr | 13 --- .../regions-lifetime-bounds-on-fns.nll.stderr | 12 -- .../ui/regions/regions-nested-fns.nll.stderr | 49 -------- ...lives-projection-container-hrtb.nll.stderr | 9 -- ...utlives-projection-container-wc.nll.stderr | 13 --- ...s-outlives-projection-container.nll.stderr | 46 -------- ...ow-from-shorter-mut-ref-mut-ref.nll.stderr | 12 -- ...s-reborrow-from-shorter-mut-ref.nll.stderr | 12 -- .../regions/regions-ret-borrowed-1.nll.stderr | 11 -- .../regions/regions-ret-borrowed.nll.stderr | 11 -- ...return-ref-to-upvar-issue-17403.nll.stderr | 13 --- .../regions-static-bound.ll.nll.stderr | 49 -------- .../regions-trait-object-subtyping.nll.stderr | 24 ---- ...se-covariant-in-second-position.nll.stderr | 13 --- ...nce-contravariant-use-covariant.nll.stderr | 13 --- ...nce-covariant-use-contravariant.nll.stderr | 13 --- ...nce-invariant-use-contravariant.nll.stderr | 13 --- ...ariance-invariant-use-covariant.nll.stderr | 11 -- .../static/static-items-cant-move.nll.stderr | 18 +++ src/test/ui/std-uncopyable-atomics.nll.stderr | 38 ++++++- src/test/ui/thread-local-in-ctfe.nll.stderr | 14 ++- .../trivial-bounds-leak-copy.nll.stderr | 20 ++++ .../unboxed-closure-illegal-move.nll.stderr | 32 +++++- ...boxed-closure-immutable-capture.nll.stderr | 26 ++++- ...ument-types-two-region-pointers.nll.stderr | 12 -- ...nfer-fnmut-calling-fnmut-no-mut.nll.stderr | 8 +- .../unboxed-closures-mutate-upvar.nll.stderr | 8 +- .../dyn-trait-underscore.nll.stderr | 11 -- ...rscore-lifetime-elison-mismatch.nll.stderr | 11 -- src/test/ui/unop-move-semantics.nll.stderr | 14 ++- .../variance-btree-invariant-types.nll.stderr | 106 ------------------ .../variance-cell-is-invariant.nll.stderr | 13 --- ...riance-contravariant-arg-object.nll.stderr | 24 ---- ...e-contravariant-arg-trait-match.nll.stderr | 24 ---- ...-contravariant-self-trait-match.nll.stderr | 24 ---- .../variance-covariant-arg-object.nll.stderr | 24 ---- ...iance-covariant-arg-trait-match.nll.stderr | 24 ---- ...ance-covariant-self-trait-match.nll.stderr | 24 ---- .../variance-invariant-arg-object.nll.stderr | 24 ---- ...iance-invariant-arg-trait-match.nll.stderr | 24 ---- ...ance-invariant-self-trait-match.nll.stderr | 24 ---- .../variance-trait-matching.nll.stderr | 12 -- ...ance-use-contravariant-struct-1.nll.stderr | 13 --- ...variance-use-covariant-struct-1.nll.stderr | 13 --- ...variance-use-invariant-struct-1.nll.stderr | 24 ---- src/test/ui/wf/wf-static-method.nll.stderr | 55 --------- 204 files changed, 920 insertions(+), 2958 deletions(-) delete mode 100644 src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr delete mode 100644 src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr delete mode 100644 src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr delete mode 100644 src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr delete mode 100644 src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr delete mode 100644 src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr delete mode 100644 src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr create mode 100644 src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr create mode 100644 src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr delete mode 100644 src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr delete mode 100644 src/test/ui/borrowck/issue-7573.nll.stderr create mode 100644 src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr delete mode 100644 src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr delete mode 100644 src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr delete mode 100644 src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr delete mode 100644 src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr delete mode 100644 src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr delete mode 100644 src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr create mode 100644 src/test/ui/error-codes/E0507.nll.stderr delete mode 100644 src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr delete mode 100644 src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr delete mode 100644 src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr delete mode 100644 src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr delete mode 100644 src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr delete mode 100644 src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr delete mode 100644 src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr delete mode 100644 src/test/ui/impl-trait/type_parameters_captured.nll.stderr delete mode 100644 src/test/ui/in-band-lifetimes/mismatched.nll.stderr delete mode 100644 src/test/ui/issues/issue-10291.nll.stderr delete mode 100644 src/test/ui/issues/issue-13058.nll.stderr delete mode 100644 src/test/ui/issues/issue-15034.nll.stderr delete mode 100644 src/test/ui/issues/issue-16683.nll.stderr delete mode 100644 src/test/ui/issues/issue-17728.nll.stderr delete mode 100644 src/test/ui/issues/issue-17758.nll.stderr delete mode 100644 src/test/ui/issues/issue-26217.nll.stderr delete mode 100644 src/test/ui/issues/issue-40288-2.nll.stderr delete mode 100644 src/test/ui/issues/issue-52213.nll.stderr delete mode 100644 src/test/ui/issues/issue-52533-1.nll.stderr delete mode 100644 src/test/ui/issues/issue-52533.nll.stderr delete mode 100644 src/test/ui/kindck/kindck-impl-type-params.nll.stderr delete mode 100644 src/test/ui/kindck/kindck-send-object1.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr delete mode 100644 src/test/ui/lub-if.nll.stderr delete mode 100644 src/test/ui/lub-match.nll.stderr delete mode 100644 src/test/ui/match/match-ref-mut-invariance.nll.stderr delete mode 100644 src/test/ui/match/match-ref-mut-let-invariance.nll.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr delete mode 100644 src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr delete mode 100644 src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr delete mode 100644 src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr delete mode 100644 src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr delete mode 100644 src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr delete mode 100644 src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr delete mode 100644 src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr delete mode 100644 src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr delete mode 100644 src/test/ui/regions/region-object-lifetime-2.nll.stderr delete mode 100644 src/test/ui/regions/region-object-lifetime-4.nll.stderr delete mode 100644 src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr delete mode 100644 src/test/ui/regions/regions-addr-of-self.nll.stderr delete mode 100644 src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr delete mode 100644 src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr delete mode 100644 src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr delete mode 100644 src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr delete mode 100644 src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr delete mode 100644 src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr delete mode 100644 src/test/ui/regions/regions-bounds.nll.stderr delete mode 100644 src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr delete mode 100644 src/test/ui/regions/regions-close-object-into-object-2.nll.stderr delete mode 100644 src/test/ui/regions/regions-close-object-into-object-4.nll.stderr delete mode 100644 src/test/ui/regions/regions-close-object-into-object-5.nll.stderr delete mode 100644 src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr delete mode 100644 src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr delete mode 100644 src/test/ui/regions/regions-close-param-into-object.nll.stderr delete mode 100644 src/test/ui/regions/regions-creating-enums3.nll.stderr delete mode 100644 src/test/ui/regions/regions-creating-enums4.nll.stderr delete mode 100644 src/test/ui/regions/regions-early-bound-error-method.nll.stderr delete mode 100644 src/test/ui/regions/regions-early-bound-error.nll.stderr delete mode 100644 src/test/ui/regions/regions-escape-method.nll.stderr delete mode 100644 src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr delete mode 100644 src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr delete mode 100644 src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr delete mode 100644 src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr delete mode 100644 src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr delete mode 100644 src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr delete mode 100644 src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr delete mode 100644 src/test/ui/regions/regions-infer-call-3.nll.stderr delete mode 100644 src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr delete mode 100644 src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr delete mode 100644 src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr delete mode 100644 src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr delete mode 100644 src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr delete mode 100644 src/test/ui/regions/regions-infer-not-param.nll.stderr delete mode 100644 src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr delete mode 100644 src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr delete mode 100644 src/test/ui/regions/regions-nested-fns.nll.stderr delete mode 100644 src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr delete mode 100644 src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr delete mode 100644 src/test/ui/regions/regions-outlives-projection-container.nll.stderr delete mode 100644 src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr delete mode 100644 src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr delete mode 100644 src/test/ui/regions/regions-ret-borrowed-1.nll.stderr delete mode 100644 src/test/ui/regions/regions-ret-borrowed.nll.stderr delete mode 100644 src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr delete mode 100644 src/test/ui/regions/regions-static-bound.ll.nll.stderr delete mode 100644 src/test/ui/regions/regions-trait-object-subtyping.nll.stderr delete mode 100644 src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr delete mode 100644 src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr delete mode 100644 src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr delete mode 100644 src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr delete mode 100644 src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr create mode 100644 src/test/ui/static/static-items-cant-move.nll.stderr create mode 100644 src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr delete mode 100644 src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr delete mode 100644 src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr delete mode 100644 src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr delete mode 100644 src/test/ui/variance/variance-btree-invariant-types.nll.stderr delete mode 100644 src/test/ui/variance/variance-cell-is-invariant.nll.stderr delete mode 100644 src/test/ui/variance/variance-contravariant-arg-object.nll.stderr delete mode 100644 src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr delete mode 100644 src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr delete mode 100644 src/test/ui/variance/variance-covariant-arg-object.nll.stderr delete mode 100644 src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr delete mode 100644 src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr delete mode 100644 src/test/ui/variance/variance-invariant-arg-object.nll.stderr delete mode 100644 src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr delete mode 100644 src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr delete mode 100644 src/test/ui/variance/variance-trait-matching.nll.stderr delete mode 100644 src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr delete mode 100644 src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr delete mode 100644 src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr delete mode 100644 src/test/ui/wf/wf-static-method.nll.stderr diff --git a/src/test/ui/access-mode-in-closures.nll.stderr b/src/test/ui/access-mode-in-closures.nll.stderr index b9de60f43f7..3366f0639ca 100644 --- a/src/test/ui/access-mode-in-closures.nll.stderr +++ b/src/test/ui/access-mode-in-closures.nll.stderr @@ -13,6 +13,18 @@ note: move occurs because `v` has type `std::vec::Vec`, which does not im LL | match *s { sty(v) => v } //~ ERROR cannot move out | ^ -error: aborting due to previous error +error[E0507]: cannot move out of `s.0` which is behind a `&` reference + --> $DIR/access-mode-in-closures.rs:19:24 + | +LL | let _foo = unpack(|s| { + | - help: consider changing this to be a mutable reference: `&mut sty` +LL | // Test that `s` is moved here. +LL | match *s { sty(v) => v } //~ ERROR cannot move out + | ^ + | | + | cannot move out of `s.0` which is behind a `&` reference + | `s` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. 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 deleted file mode 100644 index 674d85d9591..00000000000 --- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:32: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: unsatisfied lifetime constraints - --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:32: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 deleted file mode 100644 index 1156c773b8c..00000000000 --- a/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/associated-types-subtyping-1.rs:36:13 - | -LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T) - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | let _c: >::Type = a; //~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - -error: unsatisfied lifetime constraints - --> $DIR/associated-types-subtyping-1.rs:44:12 - | -LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T) - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | let b: >::Type = make_any(); - | ^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 044a3f70b4a..00000000000 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/project-fn-ret-contravariant.rs:55: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) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623] - | ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` - -error: unsatisfied lifetime constraints - --> $DIR/project-fn-ret-contravariant.rs:55: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) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623] - | ^^^^^^ 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 deleted file mode 100644 index 10f70b525e0..00000000000 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/project-fn-ret-contravariant.rs:48:4 - | -LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | bar(foo, x) //[transmute]~ ERROR E0495 - | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/project-fn-ret-contravariant.rs:48:4 - | -LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | bar(foo, x) //[transmute]~ ERROR E0495 - | ^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` - -error: aborting due to 2 previous errors - 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 deleted file mode 100644 index 1cb68785694..00000000000 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/project-fn-ret-invariant.rs:65: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) //[krisskross]~ ERROR E0623 - | ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` - -error: unsatisfied lifetime constraints - --> $DIR/project-fn-ret-invariant.rs:65: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) //[krisskross]~ ERROR E0623 - | ^^^^^^ 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 deleted file mode 100644 index a9c2bb37639..00000000000 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/project-fn-ret-invariant.rs:48: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: unsatisfied lifetime constraints - --> $DIR/project-fn-ret-invariant.rs:49: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); //[oneuse]~ ERROR 49:19: 49:20: lifetime mismatch [E0623] - | ^^^^^^^^^ 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 deleted file mode 100644 index 2329adb5dea..00000000000 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/project-fn-ret-invariant.rs:58:4 - | -LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> { - | -- lifetime `'a` defined here -... -LL | bar(foo, x) //[transmute]~ ERROR E0495 - | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/project-fn-ret-invariant.rs:58:4 - | -LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | bar(foo, x) //[transmute]~ ERROR E0495 - | ^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/binop/binop-move-semantics.nll.stderr b/src/test/ui/binop/binop-move-semantics.nll.stderr index 545a60f6770..94676f0e5ad 100644 --- a/src/test/ui/binop/binop-move-semantics.nll.stderr +++ b/src/test/ui/binop/binop-move-semantics.nll.stderr @@ -32,6 +32,18 @@ error[E0507]: cannot move out of borrowed content LL | *n; //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content +error[E0507]: cannot move out of `*n` which is behind a `&` reference + --> $DIR/binop-move-semantics.rs:42:5 + | +LL | let n = &y; + | -- help: consider changing this to be a mutable reference: `&mut y` +... +LL | *n; //~ ERROR: cannot move out of borrowed content + | ^^ + | | + | cannot move out of `*n` which is behind a `&` reference + | `n` is a `&` reference, so the data it refers to cannot be moved + error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable --> $DIR/binop-move-semantics.rs:64:5 | @@ -62,7 +74,7 @@ LL | | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also b | | immutable borrow later used here | mutable borrow occurs here -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors Some errors occurred: E0382, E0502, E0507. For more information about an error, try `rustc --explain E0382`. diff --git a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr index 231ae53fe82..771ef88a662 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr @@ -40,15 +40,19 @@ LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` LL | c1; | -- first borrow later used here -error[E0594]: cannot assign to `x`, as it is not declared as mutable +warning[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/borrowck-closures-unique.rs:57:38 | LL | fn e(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument | ^^^^^ cannot assign + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors Some errors occurred: E0500, E0524, E0594. For more information about an error, try `rustc --explain E0500`. diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr index 5721c52ba21..88ae73b6368 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr @@ -20,7 +20,7 @@ LL | //[mir]~^ ERROR cannot borrow `x` as mutable more than o LL | *y = 1; | ------ first borrow later used here -error: captured variable cannot escape `FnMut` closure body +warning: captured variable cannot escape `FnMut` closure body --> $DIR/borrowck-describe-lvalue.rs:305:16 | LL | || { @@ -36,6 +36,9 @@ LL | | } | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. error[E0503]: cannot use `f.x` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:53:9 @@ -339,7 +342,7 @@ LL | &[_, F {x: ref xf, ..}] => println!("{}", xf), LL | drop(x); | - mutable borrow later used here -error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable +warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable --> $DIR/borrowck-describe-lvalue.rs:245:29 | LL | let x = &mut block; @@ -349,8 +352,12 @@ LL | let p: &'a u8 = &*block.current; ... LL | drop(x); | - mutable borrow later used here + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. -error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable +warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable --> $DIR/borrowck-describe-lvalue.rs:260:33 | LL | let x = &mut block; @@ -360,6 +367,10 @@ LL | let p : *const u8 = &*(*block).current; ... LL | drop(x); | - mutable borrow later used here + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. error[E0382]: use of moved value: `x` --> $DIR/borrowck-describe-lvalue.rs:318:22 @@ -371,7 +382,7 @@ LL | drop(x); //[ast]~ ERROR use of moved value: `x` | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait -error: aborting due to 32 previous errors +error: aborting due to 29 previous errors Some errors occurred: E0382, E0499, E0502, E0503. For more information about an error, try `rustc --explain E0382`. diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr new file mode 100644 index 00000000000..b171a48ac50 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr @@ -0,0 +1,20 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/borrowck-fn-in-const-a.rs:19:16 + | +LL | return *x //[ast]~ ERROR cannot move out of borrowed content [E0507] + | ^^ cannot move out of borrowed content + +error[E0507]: cannot move out of `*x` which is behind a `&` reference + --> $DIR/borrowck-fn-in-const-a.rs:19:16 + | +LL | fn broken(x: &String) -> String { + | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` +LL | return *x //[ast]~ ERROR cannot move out of borrowed content [E0507] + | ^^ + | | + | cannot move out of `*x` which is behind a `&` reference + | `x` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr index 25eb69ad937..0ab3d3ea5cd 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr @@ -1,3 +1,13 @@ +error[E0507]: cannot move out of `*__next` which is behind a `&` reference + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10 + | +LL | for &a in x.iter() { //~ ERROR cannot move out + | -^ + | || + | |cannot move out of `*__next` which is behind a `&` reference + | |`__next` is a `&` reference, so the data it refers to cannot be moved + | help: consider changing this to be a mutable reference: `&mut a` + error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15 | @@ -13,6 +23,16 @@ note: move occurs because `a` has type `&mut i32`, which does not implement the LL | for &a in x.iter() { //~ ERROR cannot move out | ^ +error[E0507]: cannot move out of `*__next` which is behind a `&` reference + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:10 + | +LL | for &a in &f.a { //~ ERROR cannot move out + | -^ + | || + | |cannot move out of `*__next` which is behind a `&` reference + | |`__next` is a `&` reference, so the data it refers to cannot be moved + | help: consider changing this to be a mutable reference: `&mut a` + error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:15 | @@ -28,6 +48,16 @@ note: move occurs because `a` has type `std::boxed::Box`, which does not LL | for &a in &f.a { //~ ERROR cannot move out | ^ +error[E0507]: cannot move out of `*__next` which is behind a `&` reference + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:10 + | +LL | for &a in x.iter() { //~ ERROR cannot move out + | -^ + | || + | |cannot move out of `*__next` which is behind a `&` reference + | |`__next` is a `&` reference, so the data it refers to cannot be moved + | help: consider changing this to be a mutable reference: `&mut a` + error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:15 | @@ -43,6 +73,6 @@ note: move occurs because `a` has type `std::boxed::Box`, which does not im LL | for &a in x.iter() { //~ ERROR cannot move out | ^ -error: aborting due to 3 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-in-static.nll.stderr b/src/test/ui/borrowck/borrowck-in-static.nll.stderr index 45fa1764f70..ba42dc24363 100644 --- a/src/test/ui/borrowck/borrowck-in-static.nll.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.nll.stderr @@ -6,6 +6,21 @@ LL | let x = Box::new(0); LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable | ^ cannot move out of captured variable in an `Fn` closure -error: aborting due to previous error +error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure + --> $DIR/borrowck-in-static.rs:15:17 + | +LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable + | ^ + | | + | cannot move out of `x`, as it is a captured variable in a `Fn` closure + | cannot move + | +help: consider changing this to accept closures that implement `FnMut` + --> $DIR/borrowck-in-static.rs:15:14 + | +LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable + | ^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr index cdbfab8bd05..0445a75d61a 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr @@ -7,6 +7,17 @@ LL | let _b = *y; //~ ERROR cannot move out | cannot move out of borrowed content | help: consider removing the `*`: `y` -error: aborting due to previous error +error[E0507]: cannot move out of `*y` which is behind a `&` reference + --> $DIR/borrowck-issue-2657-2.rs:17:18 + | +LL | Some(ref y) => { + | ----- help: consider changing this to be a mutable reference: `ref mut y` +LL | let _b = *y; //~ ERROR cannot move out + | ^^ + | | + | cannot move out of `*y` which is behind a `&` reference + | `y` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr index 2df520a936c..99f69515a47 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr @@ -24,6 +24,42 @@ LL | num2) => (), LL | Foo::Foo2(num) => (), | ^^^ +error[E0507]: cannot move out of `f.0` which is behind a `&` reference + --> $DIR/borrowck-move-error-with-note.rs:23:19 + | +LL | let f = &Foo::Foo1(box 1, box 2); + | ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)` +... +LL | Foo::Foo1(num1, + | ^^^^ + | | + | cannot move out of `f.0` which is behind a `&` reference + | `f` is a `&` reference, so the data it refers to cannot be moved + +error[E0507]: cannot move out of `f.1` which is behind a `&` reference + --> $DIR/borrowck-move-error-with-note.rs:24:19 + | +LL | let f = &Foo::Foo1(box 1, box 2); + | ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)` +... +LL | num2) => (), + | ^^^^ + | | + | cannot move out of `f.1` which is behind a `&` reference + | `f` is a `&` reference, so the data it refers to cannot be moved + +error[E0507]: cannot move out of `f.0` which is behind a `&` reference + --> $DIR/borrowck-move-error-with-note.rs:25:19 + | +LL | let f = &Foo::Foo1(box 1, box 2); + | ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)` +... +LL | Foo::Foo2(num) => (), + | ^^^ + | | + | cannot move out of `f.0` which is behind a `&` reference + | `f` is a `&` reference, so the data it refers to cannot be moved + error[E0509]: cannot move out of type `S`, which implements the `Drop` trait --> $DIR/borrowck-move-error-with-note.rs:39:11 | @@ -61,7 +97,19 @@ note: move occurs because `n` has type `std::boxed::Box`, which does not LL | n => { | ^ -error: aborting due to 3 previous errors +error[E0507]: cannot move out of `a.a` which is behind a `&` reference + --> $DIR/borrowck-move-error-with-note.rs:59:9 + | +LL | let a = &A { a: box 1 }; + | --------------- help: consider changing this to be a mutable reference: `&mut A { a: box 1 }` +... +LL | n => { + | ^ + | | + | cannot move out of `a.a` which is behind a `&` reference + | `a` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 7 previous errors Some errors occurred: E0507, E0509. For more information about an error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr index c3a2180b9f0..83c5b82957d 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr @@ -7,6 +7,17 @@ LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer | cannot move out of dereference of raw pointer | help: consider removing the `*`: `x` -error: aborting due to previous error +error[E0507]: cannot move out of `*x` which is behind a `*const` pointer + --> $DIR/borrowck-move-from-unsafe-ptr.rs:13:13 + | +LL | unsafe fn foo(x: *const Box) -> Box { + | ----------------- help: consider changing this to be a mutable pointer: `*mut std::boxed::Box` +LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer + | ^^ + | | + | cannot move out of `*x` which is behind a `*const` pointer + | `x` is a `*const` pointer, so the data it refers to cannot be moved + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr index 49c2ec0dcf4..f22aca99949 100644 --- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr @@ -14,6 +14,15 @@ note: move occurs because `_x` has type `std::string::String`, which does not im LL | fn arg_item(&_x: &String) {} | ^^ +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/borrowck-move-in-irrefut-pat.rs:16:14 + | +LL | fn arg_item(&_x: &String) {} + | ^^ + | | + | cannot move out of data in a `&` reference + | cannot move + error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-in-irrefut-pat.rs:21:11 | @@ -30,6 +39,24 @@ note: move occurs because `_x` has type `std::string::String`, which does not im LL | with(|&_x| ()) | ^^ +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/borrowck-move-in-irrefut-pat.rs:21:12 + | +LL | with(|&_x| ()) + | ^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/borrowck-move-in-irrefut-pat.rs:27:10 + | +LL | let &_x = &"hi".to_string(); + | ^^ + | | + | cannot move out of data in a `&` reference + | cannot move + error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-in-irrefut-pat.rs:27:15 | @@ -45,6 +72,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im LL | let &_x = &"hi".to_string(); | ^^ -error: aborting due to 3 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr index d58beabb303..ba74cd2514e 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr @@ -4,6 +4,15 @@ error[E0507]: cannot move out of an `Rc` LL | let _x = Rc::new(vec![1, 2]).into_iter(); | ^^^^^^^^^^^^^^^^^^^ cannot move out of an `Rc` -error: aborting due to previous error +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:17:14 + | +LL | let _x = Rc::new(vec![1, 2]).into_iter(); + | ^^^^^^^^^^^^^^^^^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr index c9c8cf104ce..205044bb368 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr @@ -7,6 +7,15 @@ LL | let _x = *Rc::new("hi".to_string()); | cannot move out of an `Rc` | help: consider removing the `*`: `Rc::new("hi".to_string())` -error: aborting due to previous error +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/borrowck-move-out-of-overloaded-deref.rs:14:14 + | +LL | let _x = *Rc::new("hi".to_string()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr new file mode 100644 index 00000000000..675458d8c2b --- /dev/null +++ b/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr @@ -0,0 +1,18 @@ +error[E0507]: cannot move out of static item + --> $DIR/borrowck-move-out-of-static-item.rs:28:10 + | +LL | test(BAR); //[ast]~ ERROR cannot move out of static item [E0507] + | ^^^ cannot move out of static item + +error[E0507]: cannot move out of immutable static item `BAR` + --> $DIR/borrowck-move-out-of-static-item.rs:28:10 + | +LL | test(BAR); //[ast]~ ERROR cannot move out of static item [E0507] + | ^^^ + | | + | cannot move out of immutable static item `BAR` + | cannot move + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr index f3430ba4e06..dea42c53992 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr @@ -26,6 +26,31 @@ LL | //~| to prevent move LL | Foo { string: b }] => { | -error: aborting due to previous error +error[E0507]: cannot move out of `tail[..].string` which is behind a `&` reference + --> $DIR/borrowck-move-out-of-vec-tail.rs:30:33 + | +LL | [_, ref tail..] => { + | -------- help: consider changing this to be a mutable reference: `ref mut tail` +LL | match tail { +LL | &[Foo { string: a }, + | ^ + | | + | cannot move out of `tail[..].string` which is behind a `&` reference + | `tail` is a `&` reference, so the data it refers to cannot be moved -For more information about this error, try `rustc --explain E0508`. +error[E0507]: cannot move out of `tail[..].string` which is behind a `&` reference + --> $DIR/borrowck-move-out-of-vec-tail.rs:34:33 + | +LL | [_, ref tail..] => { + | -------- help: consider changing this to be a mutable reference: `ref mut tail` +... +LL | Foo { string: b }] => { + | ^ + | | + | cannot move out of `tail[..].string` which is behind a `&` reference + | `tail` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 3 previous errors + +Some errors occurred: E0507, E0508. +For more information about an error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr index 92e10c258c2..05fd6d71520 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr @@ -7,6 +7,15 @@ LL | let bad = v[0]; | cannot move out of borrowed content | help: consider borrowing here: `&v[0]` -error: aborting due to previous error +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/borrowck-overloaded-index-move-from-vec.rs:30:15 + | +LL | let bad = v[0]; + | ^^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. 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 deleted file mode 100644 index e3211f83850..00000000000 --- a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:19: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 - diff --git a/src/test/ui/borrowck/issue-51415.nll.stderr b/src/test/ui/borrowck/issue-51415.nll.stderr index d4340938eeb..ee7e3e71962 100644 --- a/src/test/ui/borrowck/issue-51415.nll.stderr +++ b/src/test/ui/borrowck/issue-51415.nll.stderr @@ -13,6 +13,15 @@ note: move occurs because `s` has type `std::string::String`, which does not imp LL | let opt = a.iter().enumerate().find(|(_, &s)| { | ^ -error: aborting due to previous error +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/issue-51415.rs:16:47 + | +LL | let opt = a.iter().enumerate().find(|(_, &s)| { + | ^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/issue-7573.nll.stderr b/src/test/ui/borrowck/issue-7573.nll.stderr deleted file mode 100644 index 372df61d78c..00000000000 --- a/src/test/ui/borrowck/issue-7573.nll.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: borrowed data escapes outside of closure - --> $DIR/issue-7573.rs:32:9 - | -LL | let mut lines_to_use: Vec<&CrateId> = Vec::new(); - | ---------------- `lines_to_use` is declared here, outside of the closure body -LL | //~^ NOTE cannot infer an appropriate lifetime -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/move-in-static-initializer-issue-38520.ast.nll.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr new file mode 100644 index 00000000000..d25fc759775 --- /dev/null +++ b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr @@ -0,0 +1,33 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/move-in-static-initializer-issue-38520.rs:25:23 + | +LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507 + | ^^^ cannot move out of borrowed content + +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/move-in-static-initializer-issue-38520.rs:25:23 + | +LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507 + | ^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error[E0507]: cannot move out of borrowed content + --> $DIR/move-in-static-initializer-issue-38520.rs:27:22 + | +LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507 + | ^^^ cannot move out of borrowed content + +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/move-in-static-initializer-issue-38520.rs:27:22 + | +LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507 + | ^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/mutability-errors.nll.stderr b/src/test/ui/borrowck/mutability-errors.nll.stderr index 14c41bb81b2..bb45fe2da81 100644 --- a/src/test/ui/borrowck/mutability-errors.nll.stderr +++ b/src/test/ui/borrowck/mutability-errors.nll.stderr @@ -277,7 +277,7 @@ LL | &mut x; //~ ERROR LL | &mut x.0; //~ ERROR | ^^^^^^^^ cannot borrow as mutable -error[E0594]: cannot assign to `x`, as it is not declared as mutable +warning[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/mutability-errors.rs:70:9 | LL | fn imm_capture(x: (i32,)) { @@ -285,8 +285,12 @@ LL | fn imm_capture(x: (i32,)) { LL | || { //~ ERROR LL | x = (1,); | ^^^^^^^^ cannot assign + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. -error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable +warning[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable --> $DIR/mutability-errors.rs:71:9 | LL | fn imm_capture(x: (i32,)) { @@ -294,8 +298,12 @@ LL | fn imm_capture(x: (i32,)) { ... LL | x.0 = 1; | ^^^^^^^ cannot assign + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. -error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable +warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/mutability-errors.rs:72:9 | LL | fn imm_capture(x: (i32,)) { @@ -303,8 +311,12 @@ LL | fn imm_capture(x: (i32,)) { ... LL | &mut x; | ^^^^^^ cannot borrow as mutable + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. -error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable +warning[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable --> $DIR/mutability-errors.rs:73:9 | LL | fn imm_capture(x: (i32,)) { @@ -312,6 +324,10 @@ LL | fn imm_capture(x: (i32,)) { ... LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. error[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/mutability-errors.rs:76:9 @@ -373,7 +389,7 @@ error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item LL | &mut X.0; //~ ERROR | ^^^^^^^^ cannot borrow as mutable -error: aborting due to 38 previous errors +error: aborting due to 34 previous errors Some errors occurred: E0594, E0596. For more information about an error, try `rustc --explain E0594`. 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 deleted file mode 100644 index 787fc4d8729..00000000000 --- a/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: borrowed data escapes outside of closure - --> $DIR/regions-escape-bound-fn-2.rs:18: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 deleted file mode 100644 index 91f1f00ce30..00000000000 --- a/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: borrowed data escapes outside of closure - --> $DIR/regions-escape-bound-fn.rs:18: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 deleted file mode 100644 index 44e7018fdd7..00000000000 --- a/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: borrowed data escapes outside of closure - --> $DIR/regions-escape-unboxed-closure.rs:16: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 - diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr index 0eb5fc8c324..0844ac32b8b 100644 --- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr +++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr @@ -7,6 +7,25 @@ LL | call(|| { LL | y.into_iter(); | ^ cannot move out of captured variable in an `Fn` closure -error: aborting due to previous error +error[E0507]: cannot move out of `y`, as it is a captured variable in a `Fn` closure + --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9 + | +LL | y.into_iter(); + | ^ + | | + | cannot move out of `y`, as it is a captured variable in a `Fn` closure + | cannot move + | +help: consider changing this to accept closures that implement `FnMut` + --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:20:10 + | +LL | call(|| { + | __________^ +LL | | y.into_iter(); +LL | | //~^ ERROR cannot move out of captured outer variable in an `Fn` closure +LL | | }); + | |_____^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/by-move-pattern-binding.nll.stderr b/src/test/ui/by-move-pattern-binding.nll.stderr index 491b5b5bd74..40987958115 100644 --- a/src/test/ui/by-move-pattern-binding.nll.stderr +++ b/src/test/ui/by-move-pattern-binding.nll.stderr @@ -16,6 +16,15 @@ note: move occurs because `identifier` has type `std::string::String`, which doe LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move | ^^^^^^^^^^ -error: aborting due to previous error +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/by-move-pattern-binding.rs:26:17 + | +LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move + | ^^^^^^^^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/check-static-values-constraints.nll.stderr b/src/test/ui/check-static-values-constraints.nll.stderr index 5522e22fb1f..576322ff5c1 100644 --- a/src/test/ui/check-static-values-constraints.nll.stderr +++ b/src/test/ui/check-static-values-constraints.nll.stderr @@ -58,13 +58,22 @@ LL | let y = { static x: Box = box 3; x }; | cannot move out of static item | help: consider borrowing here: `&x` +error[E0507]: cannot move out of immutable static item `x` + --> $DIR/check-static-values-constraints.rs:120:45 + | +LL | let y = { static x: Box = box 3; x }; + | ^ + | | + | cannot move out of immutable static item `x` + | cannot move + error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:120:38 | LL | let y = { static x: Box = box 3; x }; | ^^^^^ allocation not allowed in statics -error: aborting due to 10 previous errors +error: aborting due to 11 previous errors Some errors occurred: E0010, E0015, E0493, E0507. For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr deleted file mode 100644 index ae3e3a262b5..00000000000 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr +++ /dev/null @@ -1,54 +0,0 @@ -error[E0631]: type mismatch in closure arguments - --> $DIR/expect-fn-supply-fn.rs:40: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 `for<'a, 'r> fn(fn(&'a u32), &'r i32) -> _` - | -note: required by `with_closure_expecting_fn_with_free_region` - --> $DIR/expect-fn-supply-fn.rs:11:1 - | -LL | / fn with_closure_expecting_fn_with_free_region(_: 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:47:5 - | -LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _` - | | - | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _` - | -note: required by `with_closure_expecting_fn_with_bound_region` - --> $DIR/expect-fn-supply-fn.rs:16:1 - | -LL | / fn with_closure_expecting_fn_with_bound_region(_: F) -LL | | where F: FnOnce(fn(&u32), &i32) -LL | | { -LL | | } - | |_^ - -error[E0631]: type mismatch in closure arguments - --> $DIR/expect-fn-supply-fn.rs:56:5 - | -LL | with_closure_expecting_fn_with_bound_region(|_x: Foo<'_>, y| {}); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _` - | | - | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _` - | -note: required by `with_closure_expecting_fn_with_bound_region` - --> $DIR/expect-fn-supply-fn.rs:16:1 - | -LL | / fn with_closure_expecting_fn_with_bound_region(_: F) -LL | | where F: FnOnce(fn(&u32), &i32) -LL | | { -LL | | } - | |_^ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0631`. 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 deleted file mode 100644 index 4bc5034f93e..00000000000 --- a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:15:5 - | -LL | fn foo(x: &()) { - | --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()` -LL | / bar(|| { -LL | | //~^ ERROR explicit lifetime required in the type of `x` [E0621] -LL | | let _ = x; -LL | | }) - | |______^ lifetime `'static` required - -error[E0597]: `x` does not live long enough - --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:17:17 - | -LL | bar(|| { - | -- value captured here -LL | //~^ ERROR explicit lifetime required in the type of `x` [E0621] -LL | let _ = x; - | ^ borrowed value does not live long enough -LL | }) -LL | } - | - `x` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... - -error: aborting due to 2 previous errors - -Some errors occurred: E0597, E0621. -For more information about an error, try `rustc --explain E0597`. 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 deleted file mode 100644 index 7f842c40ece..00000000000 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error: 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| { - | - `x` is a reference that is only valid in the closure body -LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure - | ^^^^^^^^^^^ `x` escapes the closure body here - -error: borrowed data escapes outside of closure - --> $DIR/expect-region-supply-region.rs:38: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); //~ ERROR borrowed data cannot be stored outside of its closure - | ^^^^^^^^^^^ `x` escapes the closure body here - -error: borrowed data escapes outside of closure - --> $DIR/expect-region-supply-region.rs:52:9 - | -LL | let mut f: Option<&u32> = None; - | ----- `f` is declared here, outside of the closure body -... -LL | closure_expecting_bound(|x: &'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: aborting due to 3 previous errors - 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 index a03c5168367..38937904f47 100644 --- 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 @@ -190,7 +190,7 @@ error: trait bounds other than `Sized` on const fn parameters are unstable LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0716]: temporary value dropped while borrowed +warning[E0716]: temporary value dropped while borrowed --> $DIR/min_const_fn.rs:142:64 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } @@ -199,6 +199,9 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | creates a temporary which is freed while still in use | = note: borrowed value must be valid for the static lifetime... + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. error: trait bounds other than `Sized` on const fn parameters are unstable --> $DIR/min_const_fn.rs:147:41 @@ -218,7 +221,7 @@ error: function pointers in const fn are unstable LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } | ^^^^ -error: aborting due to 36 previous errors +error: aborting due to 35 previous errors Some errors occurred: E0493, E0716. For more information about an error, try `rustc --explain E0493`. 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 index 5d071a0fe24..a1d40cbfd46 100644 --- 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 @@ -10,7 +10,7 @@ error: trait bounds other than `Sized` on const fn parameters are unstable LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } | ^^ -error[E0716]: temporary value dropped while borrowed +warning[E0716]: temporary value dropped while borrowed --> $DIR/min_const_fn_dyn.rs:22:67 | LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } @@ -19,7 +19,10 @@ LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } | creates a temporary which is freed while still in use | = note: borrowed value must be valid for the static lifetime... + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/dst/dst-index.nll.stderr b/src/test/ui/dst/dst-index.nll.stderr index 0aa85d3ed7a..d14760b707d 100644 --- a/src/test/ui/dst/dst-index.nll.stderr +++ b/src/test/ui/dst/dst-index.nll.stderr @@ -16,13 +16,31 @@ error[E0507]: cannot move out of borrowed content LL | S[0]; | ^^^^ cannot move out of borrowed content +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/dst-index.rs:41:5 + | +LL | S[0]; + | ^^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + error[E0507]: cannot move out of borrowed content --> $DIR/dst-index.rs:44:5 | LL | T[0]; | ^^^^ cannot move out of borrowed content -error: aborting due to 4 previous errors +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/dst-index.rs:44:5 + | +LL | T[0]; + | ^^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 6 previous errors Some errors occurred: E0161, E0507. For more information about an error, try `rustc --explain E0161`. diff --git a/src/test/ui/dst/dst-rvalue.nll.stderr b/src/test/ui/dst/dst-rvalue.nll.stderr index b120da773a2..537ece48e01 100644 --- a/src/test/ui/dst/dst-rvalue.nll.stderr +++ b/src/test/ui/dst/dst-rvalue.nll.stderr @@ -16,13 +16,33 @@ error[E0507]: cannot move out of borrowed content LL | let _x: Box = box *"hello world"; | ^^^^^^^^^^^^^^ cannot move out of borrowed content +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/dst-rvalue.rs:16:28 + | +LL | let _x: Box = box *"hello world"; + | ^^^^^^^^^^^^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + error[E0508]: cannot move out of type `[isize]`, a non-copy slice --> $DIR/dst-rvalue.rs:21:32 | LL | let _x: Box<[isize]> = box *array; | ^^^^^^ cannot move out of here -error: aborting due to 4 previous errors +error[E0507]: cannot move out of `*array` which is behind a `&` reference + --> $DIR/dst-rvalue.rs:21:32 + | +LL | let array: &[isize] = &[1, 2, 3]; + | ---------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3]` +LL | let _x: Box<[isize]> = box *array; + | ^^^^^^ + | | + | cannot move out of `*array` which is behind a `&` reference + | `array` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 6 previous errors Some errors occurred: E0161, E0507, E0508. For more information about an error, try `rustc --explain E0161`. diff --git a/src/test/ui/error-codes/E0507.nll.stderr b/src/test/ui/error-codes/E0507.nll.stderr new file mode 100644 index 00000000000..43795e5224d --- /dev/null +++ b/src/test/ui/error-codes/E0507.nll.stderr @@ -0,0 +1,18 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/E0507.rs:22:5 + | +LL | x.borrow().nothing_is_true(); //~ ERROR E0507 + | ^^^^^^^^^^ cannot move out of borrowed content + +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/E0507.rs:22:5 + | +LL | x.borrow().nothing_is_true(); //~ ERROR E0507 + | ^^^^^^^^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0507`. 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 deleted file mode 100644 index 65008380f9e..00000000000 --- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/E0621-does-not-trigger-for-closures.rs:25:45 - | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 - | -- ^ 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 deleted file mode 100644 index 471eda45daf..00000000000 --- a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/generic_type_does_not_live_long_enough.rs:16:18 - | -LL | let z: i32 = x; //~ ERROR mismatched types - | ^ expected i32, found opaque type - | - = note: expected type `i32` - found type `WrongGeneric::<&{integer}>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. 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 deleted file mode 100644 index cadb552697e..00000000000 --- a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/hr-subtype.rs:43: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: unsatisfied lifetime constraints - --> $DIR/hr-subtype.rs:49: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 deleted file mode 100644 index c1bcd146b34..00000000000 --- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/hr-subtype.rs:49: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/impl-header-lifetime-elision/dyn-trait.nll.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr deleted file mode 100644 index 45ee808950e..00000000000 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: borrowed data escapes outside of function - --> $DIR/dyn-trait.rs:32:5 - | -LL | fn with_dyn_debug_static<'a>(x: Box) { - | - `x` is a reference that is only valid in the function body -LL | static_val(x); //~ ERROR cannot infer - | ^^^^^^^^^^^^^ `x` escapes the function body here - -error: aborting due to previous error - 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 deleted file mode 100644 index 485d3566244..00000000000 --- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/must_outlive_least_region_or_bound.rs:13:35 - | -LL | fn elided(x: &i32) -> impl Copy { x } - | ---- ^ lifetime `'static` required - | | - | help: add explicit lifetime `'static` to the type of `x`: `&'static i32` - -error: unsatisfied lifetime constraints - --> $DIR/must_outlive_least_region_or_bound.rs:16:44 - | -LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } - | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static` -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: unsatisfied lifetime constraints - --> $DIR/must_outlive_least_region_or_bound.rs:22: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: unsatisfied lifetime constraints - --> $DIR/must_outlive_least_region_or_bound.rs:29:5 - | -LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | //~^ ERROR lifetime mismatch -LL | move |_| println!("{}", y) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` - -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/must_outlive_least_region_or_bound.rs:32:51 - | -LL | fn ty_param_wont_outlive_static(x: T) -> impl Debug + 'static { - | ^^^^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `T: 'static`... - -error: aborting due to 5 previous errors - -Some errors occurred: E0310, E0621. -For more information about an error, try `rustc --explain E0310`. 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 deleted file mode 100644 index 7e9aa90c6c5..00000000000 --- a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/static-return-lifetime-infered.rs:17:9 - | -LL | fn iter_values_anon(&self) -> impl Iterator { - | - let's call the lifetime of this reference `'1` -LL | self.x.iter().map(|a| a.0) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` -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 + '_ { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: unsatisfied lifetime constraints - --> $DIR/static-return-lifetime-infered.rs:21:9 - | -LL | fn iter_values<'a>(&'a self) -> impl Iterator { - | -- lifetime `'a` defined here -LL | self.x.iter().map(|a| a.0) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` -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 + '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 deleted file mode 100644 index 18258ef1f9d..00000000000 --- a/src/test/ui/impl-trait/type_parameters_captured.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/type_parameters_captured.rs:17:20 - | -LL | fn foo(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`. diff --git a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr deleted file mode 100644 index c8b2f849b32..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/mismatched.rs:14:42 - | -LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required - | ---- ^ lifetime `'a` required - | | - | help: add explicit lifetime `'a` to the type of `y`: `&'a u32` - -error: unsatisfied lifetime constraints - --> $DIR/mismatched.rs:16:46 - | -LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch - | -- -- ^ 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/issues/issue-10291.nll.stderr b/src/test/ui/issues/issue-10291.nll.stderr deleted file mode 100644 index a21336654f3..00000000000 --- a/src/test/ui/issues/issue-10291.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/issue-10291.rs:13:9 - | -LL | fn test<'x>(x: &'x isize) { - | -- lifetime `'x` defined here -LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { -LL | x //~ ERROR E0312 - | ^ returning this value requires that `'x` must outlive `'static` - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-12567.nll.stderr b/src/test/ui/issues/issue-12567.nll.stderr index 72d21d47d86..bb844c4a69f 100644 --- a/src/test/ui/issues/issue-12567.nll.stderr +++ b/src/test/ui/issues/issue-12567.nll.stderr @@ -40,6 +40,43 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) LL | (&[hd1, ..], &[hd2, ..]) | ^^^ -error: aborting due to 2 previous errors +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/issue-12567.rs:16:17 + | +LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) + | ^^ + | | + | cannot move out of data in a `&` reference + | cannot move -For more information about this error, try `rustc --explain E0508`. +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/issue-12567.rs:16:31 + | +LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) + | ^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/issue-12567.rs:20:12 + | +LL | (&[hd1, ..], &[hd2, ..]) + | ^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/issue-12567.rs:20:24 + | +LL | (&[hd1, ..], &[hd2, ..]) + | ^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 6 previous errors + +Some errors occurred: E0507, E0508. +For more information about an error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-13058.nll.stderr b/src/test/ui/issues/issue-13058.nll.stderr deleted file mode 100644 index 0d641ec8e89..00000000000 --- a/src/test/ui/issues/issue-13058.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `cont` - --> $DIR/issue-13058.rs:24:21 - | -LL | fn check<'r, I: Iterator, 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 deleted file mode 100644 index aa5ceabfb11..00000000000 --- a/src/test/ui/issues/issue-15034.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `lexer` - --> $DIR/issue-15034.rs:27: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-16683.nll.stderr b/src/test/ui/issues/issue-16683.nll.stderr deleted file mode 100644 index 29d9948f61a..00000000000 --- a/src/test/ui/issues/issue-16683.nll.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: borrowed data escapes outside of function - --> $DIR/issue-16683.rs:14:9 - | -LL | fn b(&self) { - | ----- `self` is a reference that is only valid in the function body -LL | self.a(); //~ ERROR cannot infer - | ^^^^^^^^ `self` escapes the function body here - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-17718-static-move.nll.stderr b/src/test/ui/issues/issue-17718-static-move.nll.stderr index f8da3c3d598..66fba7749f4 100644 --- a/src/test/ui/issues/issue-17718-static-move.nll.stderr +++ b/src/test/ui/issues/issue-17718-static-move.nll.stderr @@ -7,6 +7,15 @@ LL | let _a = FOO; //~ ERROR: cannot move out of static item | cannot move out of static item | help: consider borrowing here: `&FOO` -error: aborting due to previous error +error[E0507]: cannot move out of immutable static item `FOO` + --> $DIR/issue-17718-static-move.rs:16:14 + | +LL | let _a = FOO; //~ ERROR: cannot move out of static item + | ^^^ + | | + | cannot move out of immutable static item `FOO` + | cannot move + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-17728.nll.stderr b/src/test/ui/issues/issue-17728.nll.stderr deleted file mode 100644 index 2cb6f831d85..00000000000 --- a/src/test/ui/issues/issue-17728.nll.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0308]: match arms have incompatible types - --> $DIR/issue-17728.rs:110:5 - | -LL | / match to_parse { //~ ERROR match arms have incompatible types -LL | | "w" | "west" => RoomDirection::West, -LL | | "e" | "east" => RoomDirection::East, -LL | | "n" | "north" => RoomDirection::North, -... | -LL | | _ => None - | | ---- match arm with an incompatible type -LL | | } - | |_____^ expected enum `RoomDirection`, found enum `std::option::Option` - | - = 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 deleted file mode 100644 index 87e01ace64a..00000000000 --- a/src/test/ui/issues/issue-17758.nll.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: borrowed data escapes outside of function - --> $DIR/issue-17758.rs:17: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 - diff --git a/src/test/ui/issues/issue-20801.nll.stderr b/src/test/ui/issues/issue-20801.nll.stderr index 362778b26c8..60e3056b8c4 100644 --- a/src/test/ui/issues/issue-20801.nll.stderr +++ b/src/test/ui/issues/issue-20801.nll.stderr @@ -16,6 +16,15 @@ LL | let b = unsafe { *imm_ref() }; | cannot move out of borrowed content | help: consider removing the `*`: `imm_ref()` +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/issue-20801.rs:39:22 + | +LL | let b = unsafe { *imm_ref() }; + | ^^^^^^^^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + error[E0507]: cannot move out of dereference of raw pointer --> $DIR/issue-20801.rs:42:22 | @@ -34,6 +43,15 @@ LL | let d = unsafe { *const_ptr() }; | cannot move out of dereference of raw pointer | help: consider removing the `*`: `const_ptr()` -error: aborting due to 4 previous errors +error[E0507]: cannot move out of data in a `*const` pointer + --> $DIR/issue-20801.rs:45:22 + | +LL | let d = unsafe { *const_ptr() }; + | ^^^^^^^^^^^^ + | | + | cannot move out of data in a `*const` pointer + | cannot move + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-2590.nll.stderr b/src/test/ui/issues/issue-2590.nll.stderr index fa2df26498a..ae726d26d07 100644 --- a/src/test/ui/issues/issue-2590.nll.stderr +++ b/src/test/ui/issues/issue-2590.nll.stderr @@ -4,6 +4,17 @@ error[E0507]: cannot move out of borrowed content LL | self.tokens //~ ERROR cannot move out of borrowed content | ^^^^^^^^^^^ cannot move out of borrowed content -error: aborting due to previous error +error[E0507]: cannot move out of `self.tokens` which is behind a `&` reference + --> $DIR/issue-2590.rs:22:9 + | +LL | fn parse(&self) -> Vec { + | ----- help: consider changing this to be a mutable reference: `&mut self` +LL | self.tokens //~ ERROR cannot move out of borrowed content + | ^^^^^^^^^^^ + | | + | cannot move out of `self.tokens` which is behind a `&` reference + | `self` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-26217.nll.stderr b/src/test/ui/issues/issue-26217.nll.stderr deleted file mode 100644 index f28b0654099..00000000000 --- a/src/test/ui/issues/issue-26217.nll.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0131]: `main` function is not allowed to have generic parameters - --> $DIR/issue-26217.rs:13:8 - | -LL | fn main<'a>() { - | ^^^^ `main` cannot have generic parameters - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0131`. diff --git a/src/test/ui/issues/issue-30355.nll.stderr b/src/test/ui/issues/issue-30355.nll.stderr index fdf8157dcf8..78cf3661bb7 100644 --- a/src/test/ui/issues/issue-30355.nll.stderr +++ b/src/test/ui/issues/issue-30355.nll.stderr @@ -16,7 +16,16 @@ error[E0508]: cannot move out of type `[u8]`, a non-copy slice LL | &X(*Y) | ^^ cannot move out of here -error: aborting due to 3 previous errors +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/issue-30355.rs:15:8 + | +LL | &X(*Y) + | ^^ + | | + | cannot move out of data in a `&` reference + | cannot move -Some errors occurred: E0161, E0508. +error: aborting due to 4 previous errors + +Some errors occurred: E0161, E0507, E0508. For more information about an error, try `rustc --explain E0161`. diff --git a/src/test/ui/issues/issue-40288-2.nll.stderr b/src/test/ui/issues/issue-40288-2.nll.stderr deleted file mode 100644 index e15e4e86dbc..00000000000 --- a/src/test/ui/issues/issue-40288-2.nll.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/issue-40288-2.rs:17:9 - | -LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { - | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` -... -LL | slice[0] = y; - | ^^^^^^^^^^^^ lifetime `'a` required - -error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/issue-40288-2.rs:32:9 - | -LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { - | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` -... -LL | dst.head = y; - | ^^^^^^^^^^^^ lifetime `'a` required - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr index 9020d3778c3..22fcffb9527 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr @@ -7,6 +7,15 @@ LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content | cannot move out of borrowed content | help: consider borrowing here: `&f.v[0]` -error: aborting due to previous error +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/issue-40402-1.rs:19:13 + | +LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content + | ^^^^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr index a80e9a5fe09..cdb547ad100 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr @@ -1,3 +1,21 @@ +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/issue-40402-2.rs:15:10 + | +LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content + | ^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/issue-40402-2.rs:15:13 + | +LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content + | ^ + | | + | cannot move out of data in a `&` reference + | cannot move + error[E0507]: cannot move out of borrowed content --> $DIR/issue-40402-2.rs:15:18 | @@ -15,6 +33,6 @@ note: move occurs because these variables have types that don't implement the `C LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content | ^ ^ -error: aborting due to previous error +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-40510-1.nll.stderr b/src/test/ui/issues/issue-40510-1.nll.stderr index 1aeb1a89ead..ee8fdc16a06 100644 --- a/src/test/ui/issues/issue-40510-1.nll.stderr +++ b/src/test/ui/issues/issue-40510-1.nll.stderr @@ -1,4 +1,4 @@ -error: captured variable cannot escape `FnMut` closure body +warning: captured variable cannot escape `FnMut` closure body --> $DIR/issue-40510-1.rs:18:9 | LL | || { @@ -8,6 +8,15 @@ LL | &mut x | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. + +error: compilation successful + --> $DIR/issue-40510-1.rs:23:1 + | +LL | fn main() {} //~ ERROR compilation successful + | ^^^^^^^^^^^^ 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 index c334e592fbc..37a00746a88 100644 --- a/src/test/ui/issues/issue-40510-3.nll.stderr +++ b/src/test/ui/issues/issue-40510-3.nll.stderr @@ -1,4 +1,4 @@ -error: captured variable cannot escape `FnMut` closure body +warning: captured variable cannot escape `FnMut` closure body --> $DIR/issue-40510-3.rs:18:9 | LL | || { @@ -10,6 +10,15 @@ LL | | } | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. + +error: compilation successful + --> $DIR/issue-40510-3.rs:25:1 + | +LL | fn main() {} //~ ERROR compilation successful + | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4335.nll.stderr b/src/test/ui/issues/issue-4335.nll.stderr index a9345e86f72..fb123de2139 100644 --- a/src/test/ui/issues/issue-4335.nll.stderr +++ b/src/test/ui/issues/issue-4335.nll.stderr @@ -6,6 +6,15 @@ LL | fn f<'r, T>(v: &'r T) -> Box T + 'r> { LL | id(Box::new(|| *v)) | ^^ cannot move out of captured variable in an `FnMut` closure +error[E0507]: cannot move out of `*v` which is behind a `&` reference + --> $DIR/issue-4335.rs:16:20 + | +LL | id(Box::new(|| *v)) + | ^^ + | | + | cannot move out of `*v` which is behind a `&` reference + | cannot move + error[E0597]: `v` does not live long enough --> $DIR/issue-4335.rs:16:21 | @@ -23,7 +32,7 @@ note: borrowed value must be valid for the lifetime 'r as defined on the functio LL | fn f<'r, T>(v: &'r T) -> Box T + 'r> { | ^^ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors Some errors occurred: E0507, E0597. For more information about an error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr index 2e0463fdd1d..555558c99d9 100644 --- a/src/test/ui/issues/issue-49824.nll.stderr +++ b/src/test/ui/issues/issue-49824.nll.stderr @@ -1,4 +1,4 @@ -error: captured variable cannot escape `FnMut` closure body +warning: captured variable cannot escape `FnMut` closure body --> $DIR/issue-49824.rs:22:9 | LL | || { @@ -10,6 +10,21 @@ LL | | } | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. + +error: compilation successful + --> $DIR/issue-49824.rs:18:1 + | +LL | / fn main() { +LL | | //~^ compilation successful +LL | | let mut x = 0; +LL | | || { +... | +LL | | }; +LL | | } + | |_^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-52213.nll.stderr b/src/test/ui/issues/issue-52213.nll.stderr deleted file mode 100644 index dab3fd866ba..00000000000 --- a/src/test/ui/issues/issue-52213.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/issue-52213.rs:13:20 - | -LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime -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 deleted file mode 100644 index cc5f4df79f8..00000000000 --- a/src/test/ui/issues/issue-52533-1.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/issue-52533-1.rs:19: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 deleted file mode 100644 index 37ab2a3b84d..00000000000 --- a/src/test/ui/issues/issue-52533.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/issue-52533.rs:15: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 - diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr deleted file mode 100644 index d484632f4c3..00000000000 --- a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error[E0277]: `T` cannot be sent between threads safely - --> $DIR/kindck-impl-type-params.rs:28:13 - | -LL | let a = &t as &Gettable; - | ^^ `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` for `S` - = note: required for the cast to the object type `dyn Gettable` - -error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:28:13 - | -LL | let a = &t as &Gettable; - | ^^ 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` for `S` - = note: required for the cast to the object type `dyn Gettable` - -error[E0277]: `T` cannot be sent between threads safely - --> $DIR/kindck-impl-type-params.rs:35:27 - | -LL | let a: &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` for `S` - = note: required for the cast to the object type `dyn Gettable` - -error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:35:27 - | -LL | let a: &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` for `S` - = note: required for the cast to the object type `dyn Gettable` - -error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:48:13 - | -LL | let a = t as Box>; - | ^ the trait `std::marker::Copy` is not implemented for `std::string::String` - | - = note: required because of the requirements on the impl of `Gettable` for `S` - = note: required for the cast to the object type `dyn Gettable` - -error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:56:33 - | -LL | let a: Box> = t; - | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` - | - = note: required because of the requirements on the impl of `Gettable` for `S` - = note: required for the cast to the object type `dyn Gettable` - -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 deleted file mode 100644 index a45ba157bf9..00000000000 --- a/src/test/ui/kindck/kindck-send-object1.nll.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely - --> $DIR/kindck-send-object1.rs:20: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:15:1 - | -LL | fn assert_send() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely - --> $DIR/kindck-send-object1.rs:39:5 - | -LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(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:15:1 - | -LL | fn assert_send() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -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 deleted file mode 100644 index bc15df264cc..00000000000 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: borrowed data escapes outside of function - --> $DIR/lifetime-bound-will-change-warning.rs:44:5 - | -LL | fn test2<'a>(x: &'a Box) { - | - `x` is a reference that is only valid in the function body -LL | // but ref_obj will not, so warn. -LL | ref_obj(x) //~ ERROR mismatched types - | ^^^^^^^^^^ `x` escapes the function body here - -error: borrowed data escapes outside of function - --> $DIR/lifetime-bound-will-change-warning.rs:49:5 - | -LL | fn test2cc<'a>(x: &'a Box) { - | - `x` is a reference that is only valid in the function body -LL | // same as test2, but cross crate -LL | lib::ref_obj(x) //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^ `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 deleted file mode 100644 index 4e3193ccbfd..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21: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 } //~ ERROR lifetime mismatch - | ^ 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 deleted file mode 100644 index 3413203fa7f..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18: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 //~ ERROR lifetime mismatch - | ^ 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 deleted file mode 100644 index 239419967f6..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18: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 } //~ ERROR lifetime mismatch - | ^^^^ 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 deleted file mode 100644 index 709d9f84db3..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/ex2a-push-one-existing-name-2.rs:16:5 - | -LL | fn foo<'a>(x: Ref, y: &mut Vec>) { - | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` -LL | y.push(x); //~ ERROR explicit lifetime - | ^^^^^^^^^ 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 deleted file mode 100644 index 1e608fe16e4..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex2a-push-one-existing-name-early-bound.rs:17: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); //~ ERROR explicit lifetime required - | ^^^^^^^^^ 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 deleted file mode 100644 index 14194352093..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex2a-push-one-existing-name.rs:16:5 - | -LL | fn foo<'a>(x: &mut Vec>, y: Ref) { - | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` -LL | x.push(y); //~ ERROR explicit lifetime - | ^^^^^^^^^ 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 deleted file mode 100644 index fc5f02fbc72..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex2b-push-no-existing-names.rs:16:5 - | -LL | fn foo(x: &mut Vec>, y: Ref) { - | - - has type `Ref<'1, i32>` - | | - | has type `&mut std::vec::Vec>` -LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index a5053244dc1..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex2c-push-inference-variable.rs:17:5 - | -LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - | -- -- lifetime `'c` defined here - | | - | lifetime `'b` defined here -LL | let z = Ref { data: y.data }; -LL | x.push(z); //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index 361fb708d40..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex2d-push-inference-variable-2.rs:18:5 - | -LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, 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 deleted file mode 100644 index 5d0f07054df..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex2e-push-inference-variable-3.rs:18:5 - | -LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, 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 deleted file mode 100644 index e4aafd7b66e..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-2.rs:12: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; //~ ERROR lifetime mismatch - | ^^^^^^ 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 deleted file mode 100644 index e1872dcf777..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-3.rs:12: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)); //~ ERROR lifetime mismatch - | ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` - -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-3.rs:12: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)); //~ ERROR lifetime mismatch - | ^^^^^^^^^^^^^ 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 deleted file mode 100644 index 934cdcd2ef2..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:16:5 - | -LL | fn foo(mut x: Ref, y: Ref) { - | ----- - has type `Ref<'_, '1>` - | | - | has type `Ref<'_, '2>` -LL | x.b = y.b; //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index cbfd9d47809..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:5 - | -LL | fn foo(mut x: Ref) { - | ----- - | | - | has type `Ref<'_, '1>` - | has type `Ref<'2, '_>` -LL | x.a = x.b; //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index 7f814b730ff..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:18:5 - | -LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index f38dceb331b..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:15:5 - | -LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index 39a7154c8e9..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:5 - | -LL | fn foo(mut x: Vec, y: Ref) { - | ----- - has type `Ref<'1>` - | | - | has type `std::vec::Vec>` -LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index d59480cefcc..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-latebound-regions.rs:12: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); //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index fc1fab7aab5..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14: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; //~ ERROR lifetime mismatch - | ^^^^^^^ 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:14:5 - | -LL | fn foo(mut x: Ref, y: &u32) { - | - help: make this binding mutable: `mut y` -LL | y = x.b; //~ ERROR lifetime mismatch - | ^^^^^^^ 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 deleted file mode 100644 index 8100fa89c2d..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14: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; //~ ERROR lifetime mismatch - | ^^^^^^^ 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 deleted file mode 100644 index 1c4a8b66589..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14: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; //~ ERROR lifetime mismatch - | ^^^^^^^ 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 deleted file mode 100644 index 2a4c5a685f1..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-one-is-struct.rs:17: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; //~ ERROR lifetime mismatch - | ^^^^^^^ 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 deleted file mode 100644 index 898f997779d..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17: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 //~ ERROR lifetime mismatch - | ^ 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 deleted file mode 100644 index bdb9b306cda..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-self-is-anon.rs:17: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 } //~ ERROR lifetime mismatch - | ^ 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 deleted file mode 100644 index 2e4df170d6c..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable - --> $DIR/ex3-both-anon-regions-using-fn-items.rs:11: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); //~ ERROR lifetime mismatch - | ^ cannot borrow as mutable - -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-using-fn-items.rs:11: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); //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index 8d743608438..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-using-impl-items.rs:15: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); //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index a2dc0e4bda3..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable - --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:11:3 - | -LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | - help: consider changing this to be mutable: `mut y` -LL | y.push(z); //~ ERROR lifetime mismatch - | ^ cannot borrow as mutable - -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:11:3 - | -LL | fn foo(x:Box , 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); //~ ERROR lifetime mismatch - | ^^^^^^^^^ 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 deleted file mode 100644 index 0d674162eea..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions.rs:12: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); //~ ERROR lifetime mismatch - | ^^^^^^^^^ argument requires that `'1` must outlive `'2` - -error: aborting due to previous error - diff --git a/src/test/ui/lub-if.nll.stderr b/src/test/ui/lub-if.nll.stderr deleted file mode 100644 index 2405e30a8cd..00000000000 --- a/src/test/ui/lub-if.nll.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/lub-if.rs:38:9 - | -LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { - | -- lifetime `'a` defined here -... -LL | s //~ ERROR E0312 - | ^ returning this value requires that `'a` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/lub-if.rs:45:9 - | -LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { - | -- lifetime `'a` defined here -... -LL | s //~ ERROR E0312 - | ^ 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 deleted file mode 100644 index 5a39dd14e4c..00000000000 --- a/src/test/ui/lub-match.nll.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/lub-match.rs:40:13 - | -LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { - | -- lifetime `'a` defined here -... -LL | s //~ ERROR E0312 - | ^ returning this value requires that `'a` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/lub-match.rs:49:13 - | -LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { - | -- lifetime `'a` defined here -... -LL | s //~ ERROR E0312 - | ^ 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 deleted file mode 100644 index d5167bbaeab..00000000000 --- a/src/test/ui/match/match-ref-mut-invariance.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/match-ref-mut-invariance.rs:20: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 } //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 54915865d88..00000000000 --- a/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/match-ref-mut-let-invariance.rs:21: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 //~ ERROR mismatched types - | ^ returning this value requires that `'a` must outlive `'b` - -error: aborting due to previous error - diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr index 1f22ab14818..1ded703fd5a 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr @@ -16,6 +16,18 @@ note: move occurs because `x` has type `std::boxed::Box`, which does not LL | box E::Bar(x) => println!("{}", x.to_string()), | ^ -error: aborting due to previous error +error[E0507]: cannot move out of `hellothere.x.0` which is behind a `&` reference + --> $DIR/moves-based-on-type-block-bad.rs:37:28 + | +LL | f(&s, |hellothere| { + | ---------- help: consider changing this to be a mutable reference: `&mut S` +... +LL | box E::Bar(x) => println!("{}", x.to_string()), + | ^ + | | + | cannot move out of `hellothere.x.0` which is behind a `&` reference + | `hellothere` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr index 13a6fc15ce3..a34a9efab6b 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr @@ -6,6 +6,21 @@ LL | let i = box 3; LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out | ^ cannot move out of captured variable in an `Fn` closure -error: aborting due to previous error +error[E0507]: cannot move out of `i`, as it is a captured variable in a `Fn` closure + --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:28 + | +LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out + | ^ + | | + | cannot move out of `i`, as it is a captured variable in a `Fn` closure + | cannot move + | +help: consider changing this to accept closures that implement `FnMut` + --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:20 + | +LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/nll/cannot-move-block-spans.nll.stderr b/src/test/ui/nll/cannot-move-block-spans.nll.stderr index 6a4c8f2e8d8..2d54ae0b81e 100644 --- a/src/test/ui/nll/cannot-move-block-spans.nll.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.nll.stderr @@ -7,6 +7,17 @@ LL | let x = { *r }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` +error[E0507]: cannot move out of `*r` which is behind a `&` reference + --> $DIR/cannot-move-block-spans.rs:15:15 + | +LL | pub fn deref(r: &String) { + | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` +LL | let x = { *r }; //~ ERROR + | ^^ + | | + | cannot move out of `*r` which is behind a `&` reference + | `r` is a `&` reference, so the data it refers to cannot be moved + error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:16:22 | @@ -16,6 +27,18 @@ LL | let y = unsafe { *r }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` +error[E0507]: cannot move out of `*r` which is behind a `&` reference + --> $DIR/cannot-move-block-spans.rs:16:22 + | +LL | pub fn deref(r: &String) { + | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` +LL | let x = { *r }; //~ ERROR +LL | let y = unsafe { *r }; //~ ERROR + | ^^ + | | + | cannot move out of `*r` which is behind a `&` reference + | `r` is a `&` reference, so the data it refers to cannot be moved + error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:17:26 | @@ -25,6 +48,18 @@ LL | let z = loop { break *r; }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` +error[E0507]: cannot move out of `*r` which is behind a `&` reference + --> $DIR/cannot-move-block-spans.rs:17:26 + | +LL | pub fn deref(r: &String) { + | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` +... +LL | let z = loop { break *r; }; //~ ERROR + | ^^ + | | + | cannot move out of `*r` which is behind a `&` reference + | `r` is a `&` reference, so the data it refers to cannot be moved + error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:21:15 | @@ -61,6 +96,17 @@ LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` +error[E0507]: cannot move out of `*r` which is behind a `&` reference + --> $DIR/cannot-move-block-spans.rs:27:38 + | +LL | pub fn additional_statement_cases(r: &String) { + | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` +LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR + | ^^ + | | + | cannot move out of `*r` which is behind a `&` reference + | `r` is a `&` reference, so the data it refers to cannot be moved + error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:28:45 | @@ -70,6 +116,18 @@ LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` +error[E0507]: cannot move out of `*r` which is behind a `&` reference + --> $DIR/cannot-move-block-spans.rs:28:45 + | +LL | pub fn additional_statement_cases(r: &String) { + | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` +LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR + | ^^ + | | + | cannot move out of `*r` which is behind a `&` reference + | `r` is a `&` reference, so the data it refers to cannot be moved + error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:29:49 | @@ -79,7 +137,19 @@ LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` -error: aborting due to 9 previous errors +error[E0507]: cannot move out of `*r` which is behind a `&` reference + --> $DIR/cannot-move-block-spans.rs:29:49 + | +LL | pub fn additional_statement_cases(r: &String) { + | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` +... +LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR + | ^^ + | | + | cannot move out of `*r` which is behind a `&` reference + | `r` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 15 previous errors Some errors occurred: E0507, E0508. For more information about an error, try `rustc --explain E0507`. diff --git a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr index 54b1fcbd5bb..4fe01d472f5 100644 --- a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr +++ b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr @@ -1,8 +1,36 @@ -error[E0507]: cannot move out of borrowed content +warning[E0507]: cannot move out of borrowed content --> $DIR/match-guards-always-borrow.rs:23:13 | LL | (|| { let bar = foo; bar.take() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. + +warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard + --> $DIR/match-guards-always-borrow.rs:23:13 + | +LL | (|| { let bar = foo; bar.take() })(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | cannot move out of `foo`, as it is immutable for the pattern guard + | cannot move + | + = note: variables bound in patterns are immutable until the end of the pattern guard + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. + +error: compilation successful + --> $DIR/match-guards-always-borrow.rs:57:1 + | +LL | / fn main() { //[ast]~ ERROR compilation successful +LL | | should_reject_destructive_mutate_in_guard(); +LL | | allow_mutate_in_arm_body(); +LL | | allow_move_into_arm_body(); +LL | | } + | |_^ 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 deleted file mode 100644 index 1e953ecff69..00000000000 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0309]: the associated type `>::Output` may not live long enough - --> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5 - | -LL | bar::<>::Output>() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `>::Output: 'a`... - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0309`. 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 deleted file mode 100644 index e132ec67b96..00000000000 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/object-lifetime-default-elision.rs:81: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 deleted file mode 100644 index e0c29192828..00000000000 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `ss` - --> $DIR/object-lifetime-default-from-box-error.rs:28:5 - | -LL | fn load(ss: &mut SomeStruct) -> Box { - | --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>` -... -LL | ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621] - | ^^^^ lifetime `'static` required - -error[E0507]: cannot move out of borrowed content - --> $DIR/object-lifetime-default-from-box-error.rs:28:5 - | -LL | ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621] - | ^^^^ cannot move out of borrowed content - -error[E0621]: explicit lifetime required in the type of `ss` - --> $DIR/object-lifetime-default-from-box-error.rs:41:5 - | -LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { - | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>` -... -LL | ss.r = b; //~ ERROR 41:12: 41:13: explicit lifetime required in the type of `ss` [E0621] - | ^^^^ lifetime `'b` required - -error: aborting due to 3 previous errors - -Some errors occurred: 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 deleted file mode 100644 index a6bfcf1d369..00000000000 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/object-lifetime-default-from-rptr-box-error.rs:25:5 - | -LL | fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { - | -- lifetime `'a` defined here -LL | ss.t = t; //~ ERROR mismatched types - | ^^^^^^^^ 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 deleted file mode 100644 index 396ff1302b1..00000000000 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:31:5 - | -LL | fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { - | -- lifetime `'a` defined here -LL | ss.t = t; //~ ERROR mismatched types - | ^^^^^^^^ 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 deleted file mode 100644 index 41988b31e97..00000000000 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/object-lifetime-default-mybox.rs:37:5 - | -LL | fn load1<'a,'b>(a: &'a MyBox, - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | a //~ ERROR lifetime mismatch - | ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` - -error: borrowed data escapes outside of function - --> $DIR/object-lifetime-default-mybox.rs:41:5 - | -LL | fn load2<'a>(ss: &MyBox) -> MyBox { - | -- `ss` is a reference that is only valid in the function body -LL | load0(ss) //~ ERROR mismatched types - | ^^^^^^^^^ `ss` escapes the function body here - -error: aborting due to 2 previous errors - 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 deleted file mode 100644 index c9714de1f09..00000000000 --- a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: borrowed data escapes outside of function - --> $DIR/region-invariant-static-error-reporting.rs:25:9 - | -LL | fn unify<'a>(x: Option>, 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 deleted file mode 100644 index 01bc022acb1..00000000000 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:30:43 - | -LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index 44f8f9e46f3..00000000000 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:32:56 - | -LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index 4e1b8b7e1a0..00000000000 --- a/src/test/ui/regions/region-object-lifetime-2.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/region-object-lifetime-2.rs:20:5 - | -LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | x.borrowed() //~ ERROR cannot infer - | ^^^^^^^^^^^^ 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 deleted file mode 100644 index 5f1f70dfe19..00000000000 --- a/src/test/ui/regions/region-object-lifetime-4.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/region-object-lifetime-4.rs:22: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() //~ ERROR cannot infer - | ^^^^^^^^^^^^ argument requires that `'a` must outlive `'b` - -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 deleted file mode 100644 index 8fd195639fe..00000000000 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `v` - --> $DIR/region-object-lifetime-in-coercion.rs:18:12 - | -LL | fn a(v: &[u8]) -> Box { - | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` -LL | let x: Box = Box::new(v); - | ^^^^^^^^^^^^^^^^^^ lifetime `'static` required - -error[E0621]: explicit lifetime required in the type of `v` - --> $DIR/region-object-lifetime-in-coercion.rs:24:5 - | -LL | fn b(v: &[u8]) -> Box { - | ----- 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:31:5 - | -LL | fn c(v: &[u8]) -> Box { - | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` -... -LL | Box::new(v) - | ^^^^^^^^^^^ lifetime `'static` required - -error: unsatisfied lifetime constraints - --> $DIR/region-object-lifetime-in-coercion.rs:36:5 - | -LL | fn d<'a,'b>(v: &'a [u8]) -> Box { - | -- -- 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 deleted file mode 100644 index 1454c856f97..00000000000 --- a/src/test/ui/regions/regions-addr-of-self.nll.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-addr-of-self.rs:17: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; //~ ERROR cannot infer - | ^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 0e48192eaff..00000000000 --- a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr +++ /dev/null @@ -1,47 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-addr-of-upvar-self.rs:20:20 - | -LL | let _f = || { - | -- lifetime `'1` represents this closure's body -LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer - | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static` - | - = note: closure implements `FnMut`, so references to captured variables can't escape the closure - -error: unsatisfied lifetime constraints - --> $DIR/regions-addr-of-upvar-self.rs:20:20 - | -LL | pub fn chase_cat(&mut self) { - | --------- lifetime `'2` appears in the type of `self` -LL | let _f = || { - | -- lifetime `'1` represents this closure's body -LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer - | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'2` - | - = note: closure implements `FnMut`, so references to captured variables can't escape the closure - -error: unsatisfied lifetime constraints - --> $DIR/regions-addr-of-upvar-self.rs:20: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; //~ ERROR cannot infer - | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static` - -error[E0597]: `self` does not live long enough - --> $DIR/regions-addr-of-upvar-self.rs:20:46 - | -LL | let _f = || { - | -- value captured here -LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer - | ^^^^ borrowed value does not live long enough -... -LL | } - | - `self` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... - -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-assoc-type-in-supertrait-outlives-container.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr deleted file mode 100644 index f711541fbd5..00000000000 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:52:13 - | -LL | fn with_assoc<'a,'b>() { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | let _x: &'a WithAssoc> = 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 deleted file mode 100644 index 654b2b91583..00000000000 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr +++ /dev/null @@ -1,50 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-bounded-by-trait-requiring-static.rs:32:5 - | -LL | fn param_not_ok<'a>(x: &'a isize) { - | -- lifetime `'a` defined here -LL | assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/regions-bounded-by-trait-requiring-static.rs:36:5 - | -LL | fn param_not_ok1<'a>(_: &'a isize) { - | -- lifetime `'a` defined here -LL | assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime - | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/regions-bounded-by-trait-requiring-static.rs:40:5 - | -LL | fn param_not_ok2<'a>(_: &'a isize) { - | -- lifetime `'a` defined here -LL | assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/regions-bounded-by-trait-requiring-static.rs:54:5 - | -LL | fn box_with_region_not_ok<'a>() { - | -- lifetime `'a` defined here -LL | assert_send::>(); //~ ERROR does not fulfill the required lifetime - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/regions-bounded-by-trait-requiring-static.rs:65:5 - | -LL | fn unsafe_ok2<'a>(_: &'a isize) { - | -- lifetime `'a` defined here -LL | assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/regions-bounded-by-trait-requiring-static.rs:69:5 - | -LL | fn unsafe_ok3<'a>(_: &'a isize) { - | -- lifetime `'a` defined here -LL | assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index a292bacc674..00000000000 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:30: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) //~ ERROR 30:7: 30:20: lifetime mismatch [E0623] - | ^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 99c31783acd..00000000000 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: borrowed data escapes outside of function - --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:30: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); //~ ERROR 30:7: 30:13: lifetime mismatch [E0623] - | ^^^^^^^^^^^ `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 deleted file mode 100644 index 91e0f7f73ee..00000000000 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/regions-bounded-method-type-parameters.rs:22:5 - | -LL | fn caller<'a>(x: &isize) { - | ------ help: add explicit lifetime `'a` to the type of `x`: `&'a isize` -LL | Foo.some_method::<&'a isize>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required - -error: unsatisfied lifetime constraints - --> $DIR/regions-bounded-method-type-parameters.rs:22:5 - | -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 2 previous errors - -For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/regions/regions-bounds.nll.stderr b/src/test/ui/regions/regions-bounds.nll.stderr deleted file mode 100644 index e50e806da12..00000000000 --- a/src/test/ui/regions/regions-bounds.nll.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-bounds.rs:19:12 - | -LL | fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | return e; //~ ERROR mismatched types - | ^ returning this value requires that `'a` must outlive `'b` - -error: unsatisfied lifetime constraints - --> $DIR/regions-bounds.rs:23:12 - | -LL | fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | return e; //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index 90d38a49c4a..00000000000 --- a/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr +++ /dev/null @@ -1,36 +0,0 @@ -error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:25:5 - | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough - | ^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `::Item: 'static`... - -error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:32:5 - | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough - | ^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `::Item: 'static`... - -error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:38:5 - | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough - | ^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `::Item: 'a`... - -error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:45:5 - | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough - | ^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `::Item: 'a`... - -error: aborting due to 4 previous errors - -Some errors occurred: 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 deleted file mode 100644 index c073e3728e7..00000000000 --- a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-close-object-into-object-2.rs:20:5 - | -LL | fn g<'a, T: 'static>(v: Box+'a>) -> Box { - | -- lifetime `'a` defined here -LL | box B(&*v) as Box //~ ERROR cannot infer - | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -error[E0597]: `*v` does not live long enough - --> $DIR/regions-close-object-into-object-2.rs:20:11 - | -LL | box B(&*v) as Box //~ ERROR cannot infer - | ^^^ borrowed value does not live long enough -LL | } - | - `*v` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. 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 deleted file mode 100644 index 4b47b951d77..00000000000 --- a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:20:5 - | -LL | box B(&*v) as Box //~ ERROR cannot infer - | ^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `U: 'static`... - -error: unsatisfied lifetime constraints - --> $DIR/regions-close-object-into-object-4.rs:20:5 - | -LL | fn i<'a, T, U>(v: Box+'a>) -> Box { - | -- lifetime `'a` defined here -LL | box B(&*v) as Box //~ ERROR cannot infer - | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:20:9 - | -LL | box B(&*v) as Box //~ ERROR cannot infer - | ^^^^^^ - | - = help: consider adding an explicit lifetime bound `U: 'static`... - -error[E0597]: `*v` does not live long enough - --> $DIR/regions-close-object-into-object-4.rs:20:11 - | -LL | box B(&*v) as Box //~ ERROR cannot infer - | ^^^ borrowed value does not live long enough -LL | } - | - `*v` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... - -error: aborting due to 4 previous errors - -Some errors occurred: E0310, E0597. -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 deleted file mode 100644 index 8ef80fd775b..00000000000 --- a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:27:5 - | -LL | box B(&*v) as Box - | ^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `T: 'static`... - -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:27:9 - | -LL | box B(&*v) as Box - | ^^^^^^ - | - = help: consider adding an explicit lifetime bound `T: 'static`... - -error[E0597]: `*v` does not live long enough - --> $DIR/regions-close-object-into-object-5.rs:27:11 - | -LL | box B(&*v) as Box - | ^^^ borrowed value does not live long enough -... -LL | } - | - `*v` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... - -error: aborting due to 3 previous errors - -Some errors occurred: E0310, E0597. -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 deleted file mode 100644 index 6b8406cdb6e..00000000000 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0310]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:20:5 - | -LL | box v as Box - | ^^^^^ - | - = 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:30:5 - | -LL | box v as Box - | ^^^^^ - | - = help: consider adding an explicit lifetime bound `A: 'b`... - -error: aborting due to 2 previous errors - -Some errors occurred: 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 deleted file mode 100644 index 017e9126888..00000000000 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-multiple.rs:30:5 - | -LL | box v as Box //~ ERROR cannot infer an appropriate lifetime - | ^^^^^ - | - = help: consider adding an explicit lifetime bound `A: 'c`... - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0309`. 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 deleted file mode 100644 index c1c7e1b71c9..00000000000 --- a/src/test/ui/regions/regions-close-param-into-object.nll.stderr +++ /dev/null @@ -1,36 +0,0 @@ -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:16:5 - | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough - | ^^^^^^^^^^^ - | - = 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:22:5 - | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough - | ^^^^^^^^^^^ - | - = 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:28:5 - | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough - | ^^^^^^^^^^^ - | - = 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:34:5 - | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough - | ^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `T: 'a`... - -error: aborting due to 4 previous errors - -Some errors occurred: 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 deleted file mode 100644 index aeb4fc67f55..00000000000 --- a/src/test/ui/regions/regions-creating-enums3.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-creating-enums3.rs:17: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) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623] - | ^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 9c68c9bca49..00000000000 --- a/src/test/ui/regions/regions-creating-enums4.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-creating-enums4.rs:17: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) //~ ERROR cannot infer - | ^^^^^^^^^^^^^^ 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 deleted file mode 100644 index e6c60b301a0..00000000000 --- a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-early-bound-error-method.rs:30: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 deleted file mode 100644 index 3c95e977fb3..00000000000 --- a/src/test/ui/regions/regions-early-bound-error.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-early-bound-error.rs:29: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 deleted file mode 100644 index ffcd1b6bd7b..00000000000 --- a/src/test/ui/regions/regions-escape-method.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-escape-method.rs:25:13 - | -LL | s.f(|p| p) //~ ERROR cannot infer - | -- ^ 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 deleted file mode 100644 index 36a79d52fd0..00000000000 --- a/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-escape-via-trait-or-not.rs:28:14 - | -LL | with(|o| o) //~ ERROR cannot infer - | -- ^ 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 deleted file mode 100644 index d0606295713..00000000000 --- a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-free-region-ordering-callee.rs:23: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 //~ ERROR 23:5: 23:8: lifetime mismatch [E0623] - | ^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` - -error: unsatisfied lifetime constraints - --> $DIR/regions-free-region-ordering-callee.rs:28:24 - | -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; - | ^^^ assignment 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.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr deleted file mode 100644 index 8d4f3d1e87f..00000000000 --- a/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-free-region-ordering-caller.rs:18: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;//~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` - -error: unsatisfied lifetime constraints - --> $DIR/regions-free-region-ordering-caller.rs:23: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;//~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` - -error: unsatisfied lifetime constraints - --> $DIR/regions-free-region-ordering-caller.rs:27: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;//~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 10259ccf270..00000000000 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-free-region-ordering-incorrect.rs:25:5 - | -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 //~ ERROR cannot infer -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 deleted file mode 100644 index 2eb4ccf1c35..00000000000 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-implied-bounds-projection-gap-1.rs:26: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 deleted file mode 100644 index 9fc58273c94..00000000000 --- a/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/regions-infer-bound-from-trait-self.rs:56: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 deleted file mode 100644 index ace8f14c734..00000000000 --- a/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:43:5 - | -LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough - | ^^^^^^^^^^^^^^^^^ - | - = 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:47:5 - | -LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough - | ^^^^^^^^^^^^^^^^^ - | - = 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 deleted file mode 100644 index 30b892d3710..00000000000 --- a/src/test/ui/regions/regions-infer-call-3.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-infer-call-3.rs:18: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 deleted file mode 100644 index aba285d427b..00000000000 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-infer-contravariance-due-to-decl.rs:35:12 - | -LL | fn use_<'short,'long>(c: Contravariant<'short>, - | ------ ----- lifetime `'long` defined here - | | - | lifetime `'short` defined here -... -LL | let _: Contravariant<'long> = c; //~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 8bc6d565cf1..00000000000 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-infer-covariance-due-to-decl.rs:32:12 - | -LL | fn use_<'short,'long>(c: Covariant<'long>, - | ------ ----- lifetime `'long` defined here - | | - | lifetime `'short` defined here -... -LL | let _: Covariant<'short> = c; //~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 23a719e5503..00000000000 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-infer-invariance-due-to-decl.rs:22:5 - | -LL | fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { - | -- lifetime `'r` defined here -LL | b_isize //~ ERROR mismatched types - | ^^^^^^^ 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 deleted file mode 100644 index ff0a6adec04..00000000000 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:21:5 - | -LL | fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { - | -- lifetime `'r` defined here -LL | b_isize //~ ERROR mismatched types - | ^^^^^^^ 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 deleted file mode 100644 index c296397954a..00000000000 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:21:5 - | -LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { - | -- lifetime `'r` defined here -LL | b_isize //~ ERROR mismatched types - | ^^^^^^^ 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 deleted file mode 100644 index faeaa5eda02..00000000000 --- a/src/test/ui/regions/regions-infer-not-param.nll.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-infer-not-param.rs:25:54 - | -LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types - | -- -- lifetime `'b` defined here ^ returning this value requires that `'a` must outlive `'b` - | | - | lifetime `'a` defined here - -error: unsatisfied lifetime constraints - --> $DIR/regions-infer-not-param.rs:29:63 - | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types - | -- -- 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: unsatisfied lifetime constraints - --> $DIR/regions-infer-not-param.rs:29:63 - | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types - | -- -- 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 deleted file mode 100644 index 7558c5caa0e..00000000000 --- a/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-infer-paramd-indirect.rs:33:9 - | -LL | impl<'a> set_f<'a> for c<'a> { - | -- lifetime `'a` defined here -... -LL | fn set_f_bad(&mut self, b: Box) { - | - has type `std::boxed::Box>` -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 deleted file mode 100644 index d1d98a26a41..00000000000 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/regions-lifetime-bounds-on-fns.rs:30:43 - | -LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index cbc1e6b787d..00000000000 --- a/src/test/ui/regions/regions-nested-fns.nll.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error: borrowed data escapes outside of closure - --> $DIR/regions-nested-fns.rs:20:9 - | -LL | let mut ay = &y; //~ ERROR E0495 - | ------ `ay` is declared here, outside of the closure body -LL | -LL | ignore:: 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:15:18 - | -LL | let mut ay = &y; //~ ERROR E0495 - | ^^ borrowed value does not live long enough -... -LL | } - | - `y` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... - -error[E0597]: `y` does not live long enough - --> $DIR/regions-nested-fns.rs:19:15 - | -LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { - | --- value captured here -LL | ay = x; -LL | ay = &y; - | ^ borrowed value does not live long enough -... -LL | } - | - `y` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... - -error: unsatisfied lifetime constraints - --> $DIR/regions-nested-fns.rs:24:27 - | -LL | fn nested<'x>(x: &'x isize) { - | -- lifetime `'x` defined here -... -LL | if false { return x; } //~ ERROR E0312 - | ^ 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.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr deleted file mode 100644 index 6db1f6f4e78..00000000000 --- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error: compilation successful - --> $DIR/regions-outlives-projection-container-hrtb.rs:68:1 - | -LL | / fn main() { -LL | | } - | |_^ - -error: aborting due to previous error - diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr deleted file mode 100644 index 836f8c28a73..00000000000 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-outlives-projection-container-wc.rs:46:13 - | -LL | fn with_assoc<'a,'b>() { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | let _x: &'a WithAssoc> = 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 deleted file mode 100644 index 126f50577c8..00000000000 --- a/src/test/ui/regions/regions-outlives-projection-container.nll.stderr +++ /dev/null @@ -1,46 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-outlives-projection-container.rs:50:13 - | -LL | fn with_assoc<'a,'b>() { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | let _x: &'a WithAssoc> = loop { }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - -error: unsatisfied lifetime constraints - --> $DIR/regions-outlives-projection-container.rs:68:13 - | -LL | fn without_assoc<'a,'b>() { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | let _x: &'a WithoutAssoc> = loop { }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - -error: unsatisfied lifetime constraints - --> $DIR/regions-outlives-projection-container.rs:77:5 - | -LL | fn call_with_assoc<'a,'b>() { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | call::<&'a WithAssoc>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a` - -error: unsatisfied lifetime constraints - --> $DIR/regions-outlives-projection-container.rs:84:5 - | -LL | fn call_without_assoc<'a,'b>() { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | call::<&'a WithoutAssoc>>(); //~ ERROR reference has a longer lifetime - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 48cd2d5a60b..00000000000 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:14: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 //~ ERROR 14:5: 14:14: lifetime mismatch [E0623] - | ^^^^^^^^^ 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 deleted file mode 100644 index 02c7ce33aab..00000000000 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:16: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 //~ ERROR 16:5: 16:13: lifetime mismatch [E0623] - | ^^^^^^^^ 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 deleted file mode 100644 index 5df6bca72fa..00000000000 --- a/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-ret-borrowed-1.rs:20: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 deleted file mode 100644 index b36191ada61..00000000000 --- a/src/test/ui/regions/regions-ret-borrowed.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-ret-borrowed.rs:23: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 deleted file mode 100644 index 300a5639822..00000000000 --- a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: captured variable cannot escape `FnMut` closure body - --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:17:24 - | -LL | let mut f = || &mut x; //~ ERROR cannot infer - | - ^^^^^^ 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 deleted file mode 100644 index dc3a32cec6a..00000000000 --- a/src/test/ui/regions/regions-static-bound.ll.nll.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-static-bound.rs:19: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:24: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:27: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: unsatisfied lifetime constraints - --> $DIR/regions-static-bound.rs:24:5 - | -LL | fn error(u: &(), v: &()) { - | - - let's call the lifetime of this reference `'2` - | | - | let's call the lifetime of this reference `'1` -LL | static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621] - | ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` - -error: unsatisfied lifetime constraints - --> $DIR/regions-static-bound.rs:27:5 - | -LL | fn error(u: &(), v: &()) { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` -... -LL | static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621] - | ^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` - -error: aborting due to 5 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 deleted file mode 100644 index 0a9bcee1ce2..00000000000 --- a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-trait-object-subtyping.rs:25: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 //~ ERROR lifetime bound not satisfied - | ^ cast requires that `'a` must outlive `'b` - -error: unsatisfied lifetime constraints - --> $DIR/regions-trait-object-subtyping.rs:32: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 //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index 668b75f5733..00000000000 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:35:12 - | -LL | fn use_<'short,'long>(c: S<'long, 'short>, - | ------ ----- lifetime `'long` defined here - | | - | lifetime `'short` defined here -... -LL | let _: S<'long, 'long> = c; //~ ERROR E0623 - | ^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 5d787e6dab6..00000000000 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-variance-contravariant-use-covariant.rs:33:12 - | -LL | fn use_<'short,'long>(c: Contravariant<'short>, - | ------ ----- lifetime `'long` defined here - | | - | lifetime `'short` defined here -... -LL | let _: Contravariant<'long> = c; //~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 3fb29009668..00000000000 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-variance-covariant-use-contravariant.rs:33:12 - | -LL | fn use_<'short,'long>(c: Covariant<'long>, - | ------ ----- lifetime `'long` defined here - | | - | lifetime `'short` defined here -... -LL | let _: Covariant<'short> = c; //~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index fb59ec1ca10..00000000000 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-variance-invariant-use-contravariant.rs:30:12 - | -LL | fn use_<'short,'long>(c: Invariant<'long>, - | ------ ----- lifetime `'long` defined here - | | - | lifetime `'short` defined here -... -LL | let _: Invariant<'short> = c; //~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index daf6a79136a..00000000000 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-variance-invariant-use-covariant.rs:27:12 - | -LL | fn use_<'b>(c: Invariant<'b>) { - | -- lifetime `'b` defined here -... -LL | let _: Invariant<'static> = c; //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'static` - -error: aborting due to previous error - diff --git a/src/test/ui/static/static-items-cant-move.nll.stderr b/src/test/ui/static/static-items-cant-move.nll.stderr new file mode 100644 index 00000000000..35a400b1508 --- /dev/null +++ b/src/test/ui/static/static-items-cant-move.nll.stderr @@ -0,0 +1,18 @@ +error[E0507]: cannot move out of static item + --> $DIR/static-items-cant-move.rs:28:10 + | +LL | test(BAR); //~ ERROR cannot move out of static item + | ^^^ cannot move out of static item + +error[E0507]: cannot move out of immutable static item `BAR` + --> $DIR/static-items-cant-move.rs:28:10 + | +LL | test(BAR); //~ ERROR cannot move out of static item + | ^^^ + | | + | cannot move out of immutable static item `BAR` + | cannot move + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/std-uncopyable-atomics.nll.stderr b/src/test/ui/std-uncopyable-atomics.nll.stderr index e6b612fed85..d2576a4baf3 100644 --- a/src/test/ui/std-uncopyable-atomics.nll.stderr +++ b/src/test/ui/std-uncopyable-atomics.nll.stderr @@ -7,6 +7,15 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | cannot move out of borrowed content | help: consider removing the `*`: `&x` +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/std-uncopyable-atomics.rs:19:13 + | +LL | let x = *&x; //~ ERROR: cannot move out of borrowed content + | ^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:21:13 | @@ -16,6 +25,15 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | cannot move out of borrowed content | help: consider removing the `*`: `&x` +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/std-uncopyable-atomics.rs:21:13 + | +LL | let x = *&x; //~ ERROR: cannot move out of borrowed content + | ^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:23:13 | @@ -25,6 +43,15 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | cannot move out of borrowed content | help: consider removing the `*`: `&x` +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/std-uncopyable-atomics.rs:23:13 + | +LL | let x = *&x; //~ ERROR: cannot move out of borrowed content + | ^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:25:13 | @@ -34,6 +61,15 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | cannot move out of borrowed content | help: consider removing the `*`: `&x` -error: aborting due to 4 previous errors +error[E0507]: cannot move out of data in a `&` reference + --> $DIR/std-uncopyable-atomics.rs:25:13 + | +LL | let x = *&x; //~ ERROR: cannot move out of borrowed content + | ^^^ + | | + | cannot move out of data in a `&` reference + | cannot move + +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/thread-local-in-ctfe.nll.stderr b/src/test/ui/thread-local-in-ctfe.nll.stderr index c9c0ac2b2d9..05f8f343380 100644 --- a/src/test/ui/thread-local-in-ctfe.nll.stderr +++ b/src/test/ui/thread-local-in-ctfe.nll.stderr @@ -10,13 +10,17 @@ error[E0625]: thread-local statics cannot be accessed at compile-time LL | static C: &u32 = &A; | ^^ -error[E0712]: thread-local variable borrowed past end of function +warning[E0712]: thread-local variable borrowed past end of function --> $DIR/thread-local-in-ctfe.rs:19:18 | LL | static C: &u32 = &A; | ^^- end of enclosing function is here | | | thread-local variables cannot be borrowed beyond the end of the function + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. error[E0625]: thread-local statics cannot be accessed at compile-time --> $DIR/thread-local-in-ctfe.rs:22:16 @@ -30,13 +34,17 @@ error[E0625]: thread-local statics cannot be accessed at compile-time LL | const E: &u32 = &A; | ^^ -error[E0712]: thread-local variable borrowed past end of function +warning[E0712]: thread-local variable borrowed past end of function --> $DIR/thread-local-in-ctfe.rs:25:17 | LL | const E: &u32 = &A; | ^^- end of enclosing function is here | | | thread-local variables cannot be borrowed beyond the end of the function + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. error[E0625]: thread-local statics cannot be accessed at compile-time --> $DIR/thread-local-in-ctfe.rs:29:5 @@ -44,7 +52,7 @@ error[E0625]: thread-local statics cannot be accessed at compile-time LL | A | ^ -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors Some errors occurred: E0625, E0712. For more information about an error, try `rustc --explain E0625`. diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr new file mode 100644 index 00000000000..9f56bf05384 --- /dev/null +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr @@ -0,0 +1,20 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/trivial-bounds-leak-copy.rs:19:5 + | +LL | *t //~ ERROR + | ^^ cannot move out of borrowed content + +error[E0507]: cannot move out of `*t` which is behind a `&` reference + --> $DIR/trivial-bounds-leak-copy.rs:19:5 + | +LL | fn move_out_string(t: &String) -> String { + | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` +LL | *t //~ ERROR + | ^^ + | | + | cannot move out of `*t` which is behind a `&` reference + | `t` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr index 4baa54e34c7..625084efec2 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr @@ -6,6 +6,21 @@ LL | let x = Box::new(0); LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move | ^ cannot move out of captured variable in an `Fn` closure +error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure + --> $DIR/unboxed-closure-illegal-move.rs:25:31 + | +LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move + | ^ + | | + | cannot move out of `x`, as it is a captured variable in a `Fn` closure + | cannot move + | +help: consider changing this to accept closures that implement `FnMut` + --> $DIR/unboxed-closure-illegal-move.rs:25:23 + | +LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move + | ^^^^^^^^^^ + error[E0507]: cannot move out of captured variable in an `FnMut` closure --> $DIR/unboxed-closure-illegal-move.rs:29:35 | @@ -22,6 +37,21 @@ LL | let x = Box::new(0); LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move | ^ cannot move out of captured variable in an `Fn` closure +error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure + --> $DIR/unboxed-closure-illegal-move.rs:38:36 + | +LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move + | ^ + | | + | cannot move out of `x`, as it is a captured variable in a `Fn` closure + | cannot move + | +help: consider changing this to accept closures that implement `FnMut` + --> $DIR/unboxed-closure-illegal-move.rs:38:23 + | +LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move + | ^^^^^^^^^^^^^^^ + error[E0507]: cannot move out of captured variable in an `FnMut` closure --> $DIR/unboxed-closure-illegal-move.rs:42:40 | @@ -30,6 +60,6 @@ LL | let x = Box::new(0); LL | let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move | ^ cannot move out of captured variable in an `FnMut` closure -error: aborting due to 4 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr index 084d7ff3bcd..ee91ea3b66f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr @@ -33,7 +33,7 @@ LL | let x = 0; LL | move || set(&mut x); //~ ERROR cannot borrow | ^^^^^^ cannot borrow as mutable -error[E0594]: cannot assign to `x`, as it is not declared as mutable +warning[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/unboxed-closure-immutable-capture.rs:23:8 | LL | let x = 0; @@ -41,8 +41,12 @@ LL | let x = 0; ... LL | || x = 1; //~ ERROR cannot assign | ^^^^^ cannot assign + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. -error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable +warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/unboxed-closure-immutable-capture.rs:25:12 | LL | let x = 0; @@ -50,8 +54,12 @@ LL | let x = 0; ... LL | || set(&mut x); //~ ERROR cannot assign | ^^^^^^ cannot borrow as mutable + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. -error[E0594]: cannot assign to `x`, as it is not declared as mutable +warning[E0594]: cannot assign to `x`, as it is not declared as mutable --> $DIR/unboxed-closure-immutable-capture.rs:26:8 | LL | let x = 0; @@ -59,8 +67,12 @@ LL | let x = 0; ... LL | || x = 1; //~ ERROR cannot assign | ^^^^^ cannot assign + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. -error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable +warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/unboxed-closure-immutable-capture.rs:28:12 | LL | let x = 0; @@ -68,8 +80,12 @@ LL | let x = 0; ... LL | || set(&mut x); //~ ERROR cannot assign | ^^^^^^ cannot borrow as mutable + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. -error: aborting due to 8 previous errors +error: aborting due to 4 previous errors Some errors occurred: E0594, E0596. For more information about an error, try `rustc --explain E0594`. 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 deleted file mode 100644 index a3501290cd6..00000000000 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:27:9 - | -LL | doit(0, &|x, y| { - | - - has type `&'1 i32` - | | - | has type `&std::cell::Cell<&'2 i32>` -LL | x.set(y); //~ ERROR E0312 - | ^^^^^^^^ argument requires that `'1` must outlive `'2` - -error: aborting due to previous error - diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr index 718c3a19938..fa0aba96e18 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr @@ -1,4 +1,4 @@ -error[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable +warning[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:27:9 | LL | let tick1 = || { @@ -6,6 +6,10 @@ LL | let tick1 = || { ... LL | tick1(); | ^^^^^ cannot borrow as mutable + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:30:5 @@ -16,6 +20,6 @@ LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local var LL | tick2(); //~ ERROR cannot borrow | ^^^^^ cannot borrow as mutable -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr index f765f207303..9858b8db211 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr @@ -1,4 +1,4 @@ -error[E0594]: cannot assign to `n`, as it is not declared as mutable +warning[E0594]: cannot assign to `n`, as it is not declared as mutable --> $DIR/unboxed-closures-mutate-upvar.rs:25:9 | LL | let n = 0; @@ -6,6 +6,10 @@ LL | let n = 0; LL | let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign LL | n += 1; | ^^^^^^ cannot assign + | + = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. + It represents potential unsoundness in your code. + This warning will become a hard error in the future. error[E0594]: cannot assign to `n`, as it is not declared as mutable --> $DIR/unboxed-closures-mutate-upvar.rs:42:9 @@ -40,6 +44,6 @@ LL | | n += 1; //~ ERROR cannot assign LL | | }); | |_____^ -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr deleted file mode 100644 index 7adb195b7d0..00000000000 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/dyn-trait-underscore.rs:18:5 - | -LL | fn a(items: &[T]) -> Box> { - | - let's call the lifetime of this reference `'1` -LL | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static` -LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime - | ^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index eedbfbf5f61..00000000000 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/underscore-lifetime-elison-mismatch.rs:11:42 - | -LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch - | - - ^^^^^^^^^ 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/unop-move-semantics.nll.stderr b/src/test/ui/unop-move-semantics.nll.stderr index 111940aab2c..8112ddbe2f1 100644 --- a/src/test/ui/unop-move-semantics.nll.stderr +++ b/src/test/ui/unop-move-semantics.nll.stderr @@ -21,7 +21,19 @@ error[E0507]: cannot move out of borrowed content LL | !*n; //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content -error: aborting due to 3 previous errors +error[E0507]: cannot move out of `*n` which is behind a `&` reference + --> $DIR/unop-move-semantics.rs:36:6 + | +LL | let n = &y; + | -- help: consider changing this to be a mutable reference: `&mut y` +... +LL | !*n; //~ ERROR: cannot move out of borrowed content + | ^^ + | | + | cannot move out of `*n` which is behind a `&` reference + | `n` is a `&` reference, so the data it refers to cannot be moved + +error: aborting due to 4 previous errors Some errors occurred: E0382, E0507. For more information about an error, try `rustc --explain E0382`. diff --git a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr deleted file mode 100644 index f09dcdf25da..00000000000 --- a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr +++ /dev/null @@ -1,106 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:16:5 - | -LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { - | ---- lifetime `'new` defined here -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:19:5 - | -LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> { - | ---- lifetime `'new` defined here -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:22:5 - | -LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> { - | ---- lifetime `'new` defined here -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:25:5 - | -LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> { - | ---- lifetime `'new` defined here -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:30:5 - | -LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) - | ---- lifetime `'new` defined here -LL | -> OccupiedEntry<'a, &'new (), ()> { -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:34:5 - | -LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) - | ---- lifetime `'new` defined here -LL | -> OccupiedEntry<'a, (), &'new ()> { -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:38:5 - | -LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) - | ---- lifetime `'new` defined here -LL | -> OccupiedEntry<'a, &'static (), ()> { -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:42:5 - | -LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) - | ---- lifetime `'new` defined here -LL | -> OccupiedEntry<'a, (), &'static ()> { -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:47:5 - | -LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) - | ---- lifetime `'new` defined here -LL | -> VacantEntry<'a, &'new (), ()> { -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:51:5 - | -LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) - | ---- lifetime `'new` defined here -LL | -> VacantEntry<'a, (), &'new ()> { -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:55:5 - | -LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) - | ---- lifetime `'new` defined here -LL | -> VacantEntry<'a, &'static (), ()> { -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'new` must outlive `'static` - -error: unsatisfied lifetime constraints - --> $DIR/variance-btree-invariant-types.rs:59:5 - | -LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) - | ---- lifetime `'new` defined here -LL | -> VacantEntry<'a, (), &'static ()> { -LL | v //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index eb01c2bbb05..00000000000 --- a/src/test/ui/variance/variance-cell-is-invariant.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-cell-is-invariant.rs:24:12 - | -LL | fn use_<'short,'long>(c: Foo<'short>, - | ------ ----- lifetime `'long` defined here - | | - | lifetime `'short` defined here -... -LL | let _: Foo<'long> = c; //~ ERROR E0623 - | ^^^^^^^^^^ 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 deleted file mode 100644 index a30720dc6ba..00000000000 --- a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-contravariant-arg-object.rs:24:5 - | -LL | fn get_min_from_max<'min, 'max>(v: Box>) - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'min` must outlive `'max` - -error: unsatisfied lifetime constraints - --> $DIR/variance-contravariant-arg-object.rs:32:5 - | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | v //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index 69981699da8..00000000000 --- a/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-contravariant-arg-trait-match.rs:23:5 - | -LL | fn get_min_from_max<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::() //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` - -error: unsatisfied lifetime constraints - --> $DIR/variance-contravariant-arg-trait-match.rs:31:5 - | -LL | fn get_max_from_min<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::() //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index a8566814c64..00000000000 --- a/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-contravariant-self-trait-match.rs:23:5 - | -LL | fn get_min_from_max<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::<&'min G>(); //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` - -error: unsatisfied lifetime constraints - --> $DIR/variance-contravariant-self-trait-match.rs:32:5 - | -LL | fn get_max_from_min<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::<&'max G>(); //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 26699a537e8..00000000000 --- a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-covariant-arg-object.rs:25:5 - | -LL | fn get_min_from_max<'min, 'max>(v: Box>) - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'min` must outlive `'max` - -error: unsatisfied lifetime constraints - --> $DIR/variance-covariant-arg-object.rs:32:5 - | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | v //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index bb3f5f5711c..00000000000 --- a/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-covariant-arg-trait-match.rs:24:5 - | -LL | fn get_min_from_max<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::() //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` - -error: unsatisfied lifetime constraints - --> $DIR/variance-covariant-arg-trait-match.rs:30:5 - | -LL | fn get_max_from_min<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::() //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 3bbf9c0d3f5..00000000000 --- a/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-covariant-self-trait-match.rs:24:5 - | -LL | fn get_min_from_max<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::<&'min G>(); //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` - -error: unsatisfied lifetime constraints - --> $DIR/variance-covariant-self-trait-match.rs:30:5 - | -LL | fn get_max_from_min<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::<&'max G>(); //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 20ab6485986..00000000000 --- a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-invariant-arg-object.rs:21:5 - | -LL | fn get_min_from_max<'min, 'max>(v: Box>) - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'min` must outlive `'max` - -error: unsatisfied lifetime constraints - --> $DIR/variance-invariant-arg-object.rs:28:5 - | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | v //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index be9f5a632dd..00000000000 --- a/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-invariant-arg-trait-match.rs:20:5 - | -LL | fn get_min_from_max<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::() //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` - -error: unsatisfied lifetime constraints - --> $DIR/variance-invariant-arg-trait-match.rs:26:5 - | -LL | fn get_max_from_min<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::() //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index f5827856a1b..00000000000 --- a/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-invariant-self-trait-match.rs:20:5 - | -LL | fn get_min_from_max<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::<&'min G>(); //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` - -error: unsatisfied lifetime constraints - --> $DIR/variance-invariant-self-trait-match.rs:26:5 - | -LL | fn get_max_from_min<'min, 'max, G>() - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | impls_get::<&'max G>(); //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 14b42585d6e..00000000000 --- a/src/test/ui/variance/variance-trait-matching.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `get` - --> $DIR/variance-trait-matching.rs:34: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) //~ ERROR 34:5: 34:9: explicit lifetime required in the type of `get` [E0621] - | ^^^^^^^^^^^^^^ 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 deleted file mode 100644 index 37604af5063..00000000000 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-use-contravariant-struct-1.rs:22:5 - | -LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | v //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index c7fd60301c8..00000000000 --- a/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-use-covariant-struct-1.rs:20:5 - | -LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>) - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | v //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index 1638d5ec4fb..00000000000 --- a/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/variance-use-invariant-struct-1.rs:22:5 - | -LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | v //~ ERROR mismatched types - | ^ returning this value requires that `'min` must outlive `'max` - -error: unsatisfied lifetime constraints - --> $DIR/variance-use-invariant-struct-1.rs:29:5 - | -LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>) - | ---- ---- lifetime `'max` defined here - | | - | lifetime `'min` defined here -... -LL | v //~ ERROR mismatched types - | ^ 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 deleted file mode 100644 index bfcb16c654f..00000000000 --- a/src/test/ui/wf/wf-static-method.nll.stderr +++ /dev/null @@ -1,55 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/wf-static-method.rs:27:9 - | -LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | u //~ ERROR E0312 - | ^ returning this value requires that `'b` must outlive `'a` - -error: unsatisfied lifetime constraints - --> $DIR/wf-static-method.rs:36: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(); //~ ERROR lifetime bound not satisfied - | ^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a` - -error: unsatisfied lifetime constraints - --> $DIR/wf-static-method.rs:43: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 //~ ERROR E0312 - | ^ returning this value requires that `'b` must outlive `'a` - -error: unsatisfied lifetime constraints - --> $DIR/wf-static-method.rs:51:5 - | -LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime - | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` - -error: unsatisfied lifetime constraints - --> $DIR/wf-static-method.rs:55:5 - | -LL | fn indirect_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: aborting due to 5 previous errors -