]> git.lizzy.rs Git - rust.git/commitdiff
Change compare mode to use -Zborrowck=mir
authorMatthew Jasper <mjjasper1@gmail.com>
Sun, 27 Jan 2019 11:03:21 +0000 (11:03 +0000)
committerMatthew Jasper <mjjasper1@gmail.com>
Sun, 12 May 2019 17:46:43 +0000 (18:46 +0100)
199 files changed:
src/test/incremental/hashes/closure_expressions.rs
src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr [new file with mode: 0644]
src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-describe-lvalue.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/issue-7573.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr [new file with mode: 0644]
src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.nll.stderr [new file with mode: 0644]
src/test/ui/c-variadic/variadic-ffi-4.nll.stderr [new file with mode: 0644]
src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr [new file with mode: 0644]
src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr [new file with mode: 0644]
src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr [new file with mode: 0644]
src/test/ui/consts/const_let_refutable.nll.stderr [new file with mode: 0644]
src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr [new file with mode: 0644]
src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr [new file with mode: 0644]
src/test/ui/continue-after-missing-main.nll.stderr [new file with mode: 0644]
src/test/ui/empty/empty-never-array.nll.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0502.nll.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr [new file with mode: 0644]
src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr [new file with mode: 0644]
src/test/ui/generator/auto-trait-regions.nll.stderr [new file with mode: 0644]
src/test/ui/hashmap-iter-value-lifetime.nll.stderr [new file with mode: 0644]
src/test/ui/hashmap-lifetimes.nll.stderr [new file with mode: 0644]
src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr [new file with mode: 0644]
src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr [new file with mode: 0644]
src/test/ui/hrtb/hrtb-cache-issue-54302.nll.stderr [new file with mode: 0644]
src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr [new file with mode: 0644]
src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr [new file with mode: 0644]
src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr [new file with mode: 0644]
src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr [new file with mode: 0644]
src/test/ui/impl-trait/type_parameters_captured.nll.stderr [new file with mode: 0644]
src/test/ui/in-band-lifetimes/mismatched.nll.stderr [new file with mode: 0644]
src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-10291.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-13058.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-15034.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-15381.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-16683.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-17728.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-17758.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-26217.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-28848.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-1.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-1.migrate.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-1.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-1.rs
src/test/ui/issues/issue-40510-1.stderr [deleted file]
src/test/ui/issues/issue-40510-3.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-3.migrate.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-3.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-40510-3.rs
src/test/ui/issues/issue-40510-3.stderr [deleted file]
src/test/ui/issues/issue-49824.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-52213.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-52533-1.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-52533.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-54302-cases.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-54302.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-55731.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-55796.nll.stderr [new file with mode: 0644]
src/test/ui/issues/issue-57843.nll.stderr [new file with mode: 0644]
src/test/ui/kindck/kindck-impl-type-params.nll.stderr [new file with mode: 0644]
src/test/ui/kindck/kindck-send-object1.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr [new file with mode: 0644]
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr [new file with mode: 0644]
src/test/ui/lub-if.nll.stderr [new file with mode: 0644]
src/test/ui/lub-match.nll.stderr [new file with mode: 0644]
src/test/ui/match/match-ref-mut-invariance.nll.stderr [new file with mode: 0644]
src/test/ui/match/match-ref-mut-let-invariance.nll.stderr [new file with mode: 0644]
src/test/ui/nll/get_default.nll.stderr [new file with mode: 0644]
src/test/ui/nll/region-ends-after-if-condition.nll.stderr [new file with mode: 0644]
src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr [new file with mode: 0644]
src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr [new file with mode: 0644]
src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr [new file with mode: 0644]
src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr [new file with mode: 0644]
src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr [new file with mode: 0644]
src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr [new file with mode: 0644]
src/test/ui/pattern/pattern-bindings-after-at.nll.stderr [new file with mode: 0644]
src/test/ui/recursion/recursive-types-are-not-uninhabited.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-object-lifetime-2.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-object-lifetime-4.nll.stderr [new file with mode: 0644]
src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-addr-of-self.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-bounds.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-object-into-object-2.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-object-into-object-4.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-object-into-object-5.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-close-param-into-object.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-creating-enums3.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-creating-enums4.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-early-bound-error-method.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-early-bound-error.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-escape-method.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-call-3.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-not-param.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-nested-fns.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-outlives-projection-container.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-ret-borrowed-1.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-ret-borrowed.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-static-bound.ll.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-static-bound.migrate.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-trait-object-subtyping.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr [new file with mode: 0644]
src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr [new file with mode: 0644]
src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr [new file with mode: 0644]
src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr [new file with mode: 0644]
src/test/ui/thread-local-in-ctfe.nll.stderr [new file with mode: 0644]
src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr [new file with mode: 0644]
src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr [new file with mode: 0644]
src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-btree-invariant-types.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-cell-is-invariant.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-contravariant-arg-object.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-covariant-arg-object.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-invariant-arg-object.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-trait-matching.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr [new file with mode: 0644]
src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr [new file with mode: 0644]
src/test/ui/wf/wf-static-method.nll.stderr [new file with mode: 0644]
src/tools/compiletest/src/runtest.rs

index 5bfd540eca63ec7c9c5ebec63f3b525bc7599133..5165f9821fd88302c72db33115fe08fb4123f96b 100644 (file)
@@ -49,14 +49,14 @@ pub fn add_parameter() {
 // Change parameter pattern ----------------------------------------------------
 #[cfg(cfail1)]
 pub fn change_parameter_pattern() {
-    let _ = |x: &u32| x;
+    let _ = |x: (u32,)| x;
 }
 
 #[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2", except="HirBody, mir_built, typeck_tables_of")]
 #[rustc_clean(cfg="cfail3")]
 pub fn change_parameter_pattern() {
-    let _ = |&x: &u32| x;
+    let _ = |(x,): (u32,)| x;
 }
 
 
diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr
new file mode 100644 (file)
index 0000000..ca99304
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:29
+   |
+LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
+   |        --  -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+...
+LL |     let z: I::A = if cond { x } else { y };
+   |                             ^ assignment requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40
+   |
+LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
+   |        --  -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+...
+LL |     let z: I::A = if cond { x } else { y };
+   |                                        ^ assignment requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr b/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr
new file mode 100644 (file)
index 0000000..d8506b9
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/associated-types-subtyping-1.rs:24:12
+   |
+LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
+   |            -- -- lifetime `'b` defined here
+   |            |
+   |            lifetime `'a` defined here
+...
+LL |     let a: <T as Trait<'a>>::Type = make_any();
+   |            ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/associated-types-subtyping-1.rs:35:13
+   |
+LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
+   |            -- -- lifetime `'b` defined here
+   |            |
+   |            lifetime `'a` defined here
+...
+LL |     let _c: <T as Trait<'a>>::Type = b;
+   |             ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr
new file mode 100644 (file)
index 0000000..779e6da
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-contravariant.rs:45:4
+   |
+LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
+   |              -- -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+...
+LL |    (a, b)
+   |    ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-contravariant.rs:45:4
+   |
+LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
+   |              -- -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+...
+LL |    (a, b)
+   |    ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr
new file mode 100644 (file)
index 0000000..f532c96
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-contravariant.rs:38:4
+   |
+LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
+   |        -- lifetime `'a` defined here
+LL |    bar(foo, x)
+   |    ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr
new file mode 100644 (file)
index 0000000..c45082f
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-invariant.rs:55:4
+   |
+LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+   |              -- -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+...
+LL |    (a, b)
+   |    ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-invariant.rs:55:4
+   |
+LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+   |              -- -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+...
+LL |    (a, b)
+   |    ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr
new file mode 100644 (file)
index 0000000..2c11e7f
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-invariant.rs:38:12
+   |
+LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+   |        -- -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+LL |    let f = foo; // <-- No consistent type can be inferred for `f` here.
+LL |    let a = bar(f, x);
+   |            ^^^^^^^^^ argument requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-invariant.rs:39:12
+   |
+LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+   |        -- -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+...
+LL |    let b = bar(f, y);
+   |            ^^^^^^^^^ argument requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr
new file mode 100644 (file)
index 0000000..8be0ad6
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/project-fn-ret-invariant.rs:48:4
+   |
+LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
+   |        -- lifetime `'a` defined here
+...
+LL |    bar(foo, x)
+   |    ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr
new file mode 100644 (file)
index 0000000..f66994b
--- /dev/null
@@ -0,0 +1,40 @@
+error[E0503]: cannot use `y` because it was mutably borrowed
+  --> $DIR/borrowck-anon-fields-variant.rs:17:7
+   |
+LL |       Foo::Y(ref mut a, _) => a,
+   |              --------- borrow of `y.0` occurs here
+...
+LL |       Foo::Y(_, ref mut b) => b,
+   |       ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
+...
+LL |     *a += 1;
+   |     ------- borrow later used here
+
+error[E0503]: cannot use `y` because it was mutably borrowed
+  --> $DIR/borrowck-anon-fields-variant.rs:37:7
+   |
+LL |       Foo::Y(ref mut a, _) => a,
+   |              --------- borrow of `y.0` occurs here
+...
+LL |       Foo::Y(ref mut b, _) => b,
+   |       ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
+...
+LL |     *a += 1;
+   |     ------- borrow later used here
+
+error[E0499]: cannot borrow `y.0` as mutable more than once at a time
+  --> $DIR/borrowck-anon-fields-variant.rs:37:14
+   |
+LL |       Foo::Y(ref mut a, _) => a,
+   |              --------- first mutable borrow occurs here
+...
+LL |       Foo::Y(ref mut b, _) => b,
+   |              ^^^^^^^^^ second mutable borrow occurs here
+...
+LL |     *a += 1;
+   |     ------- first borrow later used here
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0499, E0503.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.nll.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.nll.stderr
new file mode 100644 (file)
index 0000000..f1e1ae1
--- /dev/null
@@ -0,0 +1,366 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+  --> $DIR/borrowck-describe-lvalue.rs:262:13
+   |
+LL |             let y = &mut x;
+   |                     ------ first mutable borrow occurs here
+LL |             &mut x;
+   |             ^^^^^^ second mutable borrow occurs here
+LL |             *y = 1;
+   |             ------ first borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+  --> $DIR/borrowck-describe-lvalue.rs:272:20
+   |
+LL |                    let y = &mut x;
+   |                            ------ first mutable borrow occurs here
+LL |                    &mut x;
+   |                    ^^^^^^ second mutable borrow occurs here
+LL |                    *y = 1;
+   |                    ------ first borrow later used here
+
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/borrowck-describe-lvalue.rs:270:16
+   |
+LL |              || {
+   |               - inferred to be a `FnMut` closure
+LL | /                || {
+LL | |                    let y = &mut x;
+LL | |                    &mut x;
+LL | |                    *y = 1;
+LL | |                    drop(y);
+LL | |                 }
+   | |_________________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:41:9
+   |
+LL |         let x = f.x();
+   |                 - borrow of `f` occurs here
+LL |         f.x;
+   |         ^^^ use of borrowed `f`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:48:9
+   |
+LL |         let x = g.x();
+   |                 - borrow of `g` occurs here
+LL |         g.0;
+   |         ^^^ use of borrowed `g`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:55:9
+   |
+LL |         let x = &mut h.0;
+   |                 -------- borrow of `h.0` occurs here
+LL |         h.0;
+   |         ^^^ use of borrowed `h.0`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:63:20
+   |
+LL |         let x = e.x();
+   |                 - borrow of `e` occurs here
+LL |         match e {
+LL |             Baz::X(value) => value
+   |                    ^^^^^ use of borrowed `e`
+LL |         };
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:71:9
+   |
+LL |         let x = &mut u.a;
+   |                 -------- borrow of `u.a` occurs here
+LL |         u.a;
+   |         ^^^ use of borrowed `u.a`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:78:9
+   |
+LL |         let x = f.x();
+   |                 - borrow of `*f` occurs here
+LL |         f.x;
+   |         ^^^ use of borrowed `*f`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:85:9
+   |
+LL |         let x = g.x();
+   |                 - borrow of `*g` occurs here
+LL |         g.0;
+   |         ^^^ use of borrowed `*g`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:92:9
+   |
+LL |         let x = &mut h.0;
+   |                 -------- borrow of `h.0` occurs here
+LL |         h.0;
+   |         ^^^ use of borrowed `h.0`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:100:20
+   |
+LL |         let x = e.x();
+   |                 - borrow of `*e` occurs here
+LL |         match *e {
+LL |             Baz::X(value) => value
+   |                    ^^^^^ use of borrowed `*e`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:109:9
+   |
+LL |         let x = &mut u.a;
+   |                 -------- borrow of `u.a` occurs here
+LL |         u.a;
+   |         ^^^ use of borrowed `u.a`
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:117:15
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+LL |         match v {
+LL |             &[x, _, .., _, _] => println!("{}", x),
+   |               ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:122:18
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[_, x, .., _, _] => println!("{}", x),
+   |                  ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:127:25
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[_, _, .., x, _] => println!("{}", x),
+   |                         ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:132:28
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[_, _, .., _, x] => println!("{}", x),
+   |                            ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:143:15
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+LL |         match v {
+LL |             &[x..] => println!("{:?}", x),
+   |               ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:148:18
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[_, x..] => println!("{:?}", x),
+   |                  ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:153:15
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[x.., _] => println!("{:?}", x),
+   |               ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:158:18
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+...
+LL |             &[_, x.., _] => println!("{:?}", x),
+   |                  ^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `e` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:171:13
+   |
+LL |         let x = &mut e;
+   |                 ------ borrow of `e` occurs here
+LL |         match e {
+LL |             E::A(ref ax) =>
+   |             ^^^^^^^^^^^^ use of borrowed `e`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:171:18
+   |
+LL |         let x = &mut e;
+   |                 ------ mutable borrow occurs here
+LL |         match e {
+LL |             E::A(ref ax) =>
+   |                  ^^^^^^ immutable borrow occurs here
+...
+LL |         drop(x);
+   |              - mutable borrow later used here
+
+error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:175:23
+   |
+LL |         let x = &mut e;
+   |                 ------ mutable borrow occurs here
+...
+LL |             E::B { x: ref bx } =>
+   |                       ^^^^^^ immutable borrow occurs here
+...
+LL |         drop(x);
+   |              - mutable borrow later used here
+
+error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:188:22
+   |
+LL |         let x = &mut s;
+   |                 ------ mutable borrow occurs here
+LL |         match s {
+LL |             S  { y: (ref y0, _), .. } =>
+   |                      ^^^^^^ immutable borrow occurs here
+...
+LL |         drop(x);
+   |              - mutable borrow later used here
+
+error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:194:28
+   |
+LL |         let x = &mut s;
+   |                 ------ mutable borrow occurs here
+...
+LL |             S  { x: F { y: ref x0, .. }, .. } =>
+   |                            ^^^^^^ immutable borrow occurs here
+...
+LL |         drop(x);
+   |              - mutable borrow later used here
+
+error[E0503]: cannot use `*v` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:240:9
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+LL |         v[0].y;
+   |         ^^^^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0503]: cannot use `v[_].y` because it was mutably borrowed
+  --> $DIR/borrowck-describe-lvalue.rs:240:9
+   |
+LL |         let x = &mut v;
+   |                 ------ borrow of `v` occurs here
+LL |         v[0].y;
+   |         ^^^^^^ use of borrowed `v`
+...
+LL |         drop(x);
+   |              - borrow later used here
+
+error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:251:24
+   |
+LL |         let x = &mut v;
+   |                 ------ mutable borrow occurs here
+LL |         match v {
+LL |             &[_, F {x: ref xf, ..}] => println!("{}", xf),
+   |                        ^^^^^^ immutable borrow occurs here
+...
+LL |         drop(x);
+   |              - mutable borrow later used here
+
+error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:210:29
+   |
+LL |             let x = &mut block;
+   |                     ---------- mutable borrow occurs here
+LL |             let p: &'a u8 = &*block.current;
+   |                             ^^^^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL |             drop(x);
+   |                  - mutable borrow later used here
+
+error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-describe-lvalue.rs:227:33
+   |
+LL |             let x = &mut block;
+   |                     ---------- mutable borrow occurs here
+LL |             let p : *const u8 = &*(*block).current;
+   |                                 ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL |             drop(x);
+   |                  - mutable borrow later used here
+
+error[E0382]: use of moved value: `x`
+  --> $DIR/borrowck-describe-lvalue.rs:282:22
+   |
+LL |                 drop(x);
+   |                      - value moved here
+LL |                 drop(x);
+   |                      ^ value used here after move
+   |
+   = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 32 previous errors
+
+Some errors have detailed explanations: E0382, E0499, E0502, E0503.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr
new file mode 100644 (file)
index 0000000..3468f29
--- /dev/null
@@ -0,0 +1,27 @@
+error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-for-loop-head-linkage.rs:7:9
+   |
+LL |     for &x in &vector {
+   |               -------
+   |               |
+   |               immutable borrow occurs here
+   |               immutable borrow later used here
+LL |         let cap = vector.capacity();
+LL |         vector.extend(repeat(0));
+   |         ^^^^^^ mutable borrow occurs here
+
+error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-for-loop-head-linkage.rs:8:9
+   |
+LL |     for &x in &vector {
+   |               -------
+   |               |
+   |               immutable borrow occurs here
+   |               immutable borrow later used here
+...
+LL |         vector[1] = 5;
+   |         ^^^^^^ mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr b/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr
new file mode 100644 (file)
index 0000000..7e4a632
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0302]: cannot assign in a pattern guard
+  --> $DIR/borrowck-mutate-in-guard.rs:10:25
+   |
+LL |         Enum::A(_) if { x = Enum::B(false); false } => 1,
+   |                         ^^^^^^^^^^^^^^^^^^ assignment in pattern guard
+
+error[E0301]: cannot mutably borrow in a pattern guard
+  --> $DIR/borrowck-mutate-in-guard.rs:15:38
+   |
+LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
+   |                                      ^ borrowed mutably in pattern guard
+   |
+   = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
+
+error[E0302]: cannot assign in a pattern guard
+  --> $DIR/borrowck-mutate-in-guard.rs:15:41
+   |
+LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
+   |                                         ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
+
+error[E0510]: cannot assign `x` in match guard
+  --> $DIR/borrowck-mutate-in-guard.rs:10:25
+   |
+LL |     match x {
+   |           - value is immutable in match guard
+LL |         Enum::A(_) if { x = Enum::B(false); false } => 1,
+   |                         ^^^^^^^^^^^^^^^^^^ cannot assign
+
+error[E0510]: cannot mutably borrow `x` in match guard
+  --> $DIR/borrowck-mutate-in-guard.rs:15:33
+   |
+LL |     match x {
+   |           - value is immutable in match guard
+...
+LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
+   |                                 ^^^^^^ cannot mutably borrow
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0301, E0302, E0510.
+For more information about an error, try `rustc --explain E0301`.
diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr
new file mode 100644 (file)
index 0000000..49c3f86
--- /dev/null
@@ -0,0 +1,23 @@
+error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-object-lifetime.rs:20:13
+   |
+LL |     let y = x.borrowed();
+   |             - immutable borrow occurs here
+LL |     let z = x.mut_borrowed();
+   |             ^ mutable borrow occurs here
+LL |     y.use_ref();
+   |     - immutable borrow later used here
+
+error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-object-lifetime.rs:26:13
+   |
+LL |     let y = x.borrowed();
+   |             - immutable borrow occurs here
+LL |     let z = &mut x;
+   |             ^^^^^^ mutable borrow occurs here
+LL |     y.use_ref();
+   |     - immutable borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr
new file mode 100644 (file)
index 0000000..e6d0f88
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:9:5
+   |
+LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> {
+   |                      -- -- lifetime `'b` defined here
+   |                      |
+   |                      lifetime `'a` defined here
+LL |     S { pointer: &mut *p.pointer }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/issue-7573.nll.stderr b/src/test/ui/borrowck/issue-7573.nll.stderr
new file mode 100644 (file)
index 0000000..0da715b
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/issue-7573.rs:21:9
+   |
+LL |     let mut lines_to_use: Vec<&CrateId> = Vec::new();
+   |         ---------------- `lines_to_use` is declared here, outside of the closure body
+LL |
+LL |     let push_id = |installed_id: &CrateId| {
+   |                    ------------ `installed_id` is a reference that is only valid in the closure body
+...
+LL |         lines_to_use.push(installed_id);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `installed_id` escapes the closure body here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr
new file mode 100644 (file)
index 0000000..4797a9d
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/regions-escape-bound-fn-2.rs:8:18
+   |
+LL |     let mut x = None;
+   |         ----- `x` is declared here, outside of the closure body
+LL |     with_int(|y| x = Some(y));
+   |               -  ^^^^^^^^^^^ `y` escapes the closure body here
+   |               |
+   |               `y` is a reference that is only valid in the closure body
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr
new file mode 100644 (file)
index 0000000..2b3a981
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/regions-escape-bound-fn.rs:8:18
+   |
+LL |     let mut x: Option<&isize> = None;
+   |         ----- `x` is declared here, outside of the closure body
+LL |     with_int(|y| x = Some(y));
+   |               -  ^^^^^^^^^^^ `y` escapes the closure body here
+   |               |
+   |               `y` is a reference that is only valid in the closure body
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr b/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr
new file mode 100644 (file)
index 0000000..8ceefd2
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/regions-escape-unboxed-closure.rs:6:23
+   |
+LL |     let mut x: Option<&isize> = None;
+   |         ----- `x` is declared here, outside of the closure body
+LL |     with_int(&mut |y| x = Some(y));
+   |                    -  ^^^^^^^^^^^ `y` escapes the closure body here
+   |                    |
+   |                    `y` is a reference that is only valid in the closure body
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.nll.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.nll.stderr
new file mode 100644 (file)
index 0000000..d2ea5ab
--- /dev/null
@@ -0,0 +1,36 @@
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+  --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:13:9
+   |
+LL |         let shared = &v;
+   |                      -- immutable borrow occurs here
+LL | 
+LL |         v.push(shared.len());
+   |         ^      ------ immutable borrow later used here
+   |         |
+   |         mutable borrow occurs here
+
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+  --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:24:9
+   |
+LL |         let shared = &v;
+   |                      -- immutable borrow occurs here
+LL | 
+LL |         v.push(shared.len());
+   |         ^      ------ immutable borrow later used here
+   |         |
+   |         mutable borrow occurs here
+
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+  --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:37:9
+   |
+LL |         let shared = &v;
+   |                      -- immutable borrow occurs here
+LL | 
+LL |         v.push(shared.len());
+   |         ^      ------ immutable borrow later used here
+   |         |
+   |         mutable borrow occurs here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/c-variadic/variadic-ffi-4.nll.stderr b/src/test/ui/c-variadic/variadic-ffi-4.nll.stderr
new file mode 100644 (file)
index 0000000..a1afbb0
--- /dev/null
@@ -0,0 +1,81 @@
+error[E0621]: explicit lifetime required in the type of `ap`
+  --> $DIR/variadic-ffi-4.rs:8:5
+   |
+LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> {
+   |                                                       --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>`
+LL |     ap
+   |     ^^ lifetime `'a` required
+
+error[E0621]: explicit lifetime required in the type of `ap`
+  --> $DIR/variadic-ffi-4.rs:12:5
+   |
+LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> {
+   |                                                   --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>`
+LL |     ap
+   |     ^^ lifetime `'static` required
+
+error: lifetime may not live long enough
+  --> $DIR/variadic-ffi-4.rs:16:33
+   |
+LL |     let _ = ap.with_copy(|ap| { ap });
+   |                           ---   ^^ returning this value requires that `'1` must outlive `'2`
+   |                           | |
+   |                           | return type of closure is core::ffi::VaList<'2>
+   |                           has type `core::ffi::VaList<'1>`
+
+error: lifetime may not live long enough
+  --> $DIR/variadic-ffi-4.rs:20:5
+   |
+LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
+   |                                               -------               ------- has type `core::ffi::VaList<'1>`
+   |                                               |
+   |                                               has type `&mut core::ffi::VaList<'2>`
+LL |     *ap0 = ap1;
+   |     ^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: lifetime may not live long enough
+  --> $DIR/variadic-ffi-4.rs:24:5
+   |
+LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
+   |                                               ---               ------- has type `core::ffi::VaList<'2>`
+   |                                               |
+   |                                               has type `&mut core::ffi::VaList<'1>`
+LL |     ap0 = &mut ap1;
+   |     ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: lifetime may not live long enough
+  --> $DIR/variadic-ffi-4.rs:24:5
+   |
+LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
+   |                                               ---               ------- has type `core::ffi::VaList<'1>`
+   |                                               |
+   |                                               has type `&mut core::ffi::VaList<'2>`
+LL |     ap0 = &mut ap1;
+   |     ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error[E0384]: cannot assign to immutable argument `ap0`
+  --> $DIR/variadic-ffi-4.rs:24:5
+   |
+LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
+   |                                               --- help: make this binding mutable: `mut ap0`
+LL |     ap0 = &mut ap1;
+   |     ^^^^^^^^^^^^^^ cannot assign to immutable argument
+
+error[E0597]: `ap1` does not live long enough
+  --> $DIR/variadic-ffi-4.rs:24:11
+   |
+LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
+   |                                                    - let's call the lifetime of this reference `'1`
+LL |     ap0 = &mut ap1;
+   |     ------^^^^^^^^
+   |     |     |
+   |     |     borrowed value does not live long enough
+   |     assignment requires that `ap1` is borrowed for `'1`
+...
+LL | }
+   |  - `ap1` dropped here while still borrowed
+
+error: aborting due to 8 previous errors
+
+Some errors have detailed explanations: E0384, E0597, E0621.
+For more information about an error, try `rustc --explain E0384`.
diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr
new file mode 100644 (file)
index 0000000..7e4ac4e
--- /dev/null
@@ -0,0 +1,53 @@
+error[E0631]: type mismatch in closure arguments
+  --> $DIR/expect-fn-supply-fn.rs:30:5
+   |
+LL |     with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _`
+   |     |
+   |     expected signature of `fn(fn(&'a u32), &i32) -> _`
+   |
+note: required by `with_closure_expecting_fn_with_free_region`
+  --> $DIR/expect-fn-supply-fn.rs:1:1
+   |
+LL | / fn with_closure_expecting_fn_with_free_region<F>(_: F)
+LL | |     where F: for<'a> FnOnce(fn(&'a u32), &i32)
+LL | | {
+LL | | }
+   | |_^
+
+error[E0631]: type mismatch in closure arguments
+  --> $DIR/expect-fn-supply-fn.rs:37:5
+   |
+LL |     with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _`
+   |     |
+   |     expected signature of `fn(for<'r> fn(&'r u32), &i32) -> _`
+   |
+note: required by `with_closure_expecting_fn_with_bound_region`
+  --> $DIR/expect-fn-supply-fn.rs:6:1
+   |
+LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
+LL | |     where F: FnOnce(fn(&u32), &i32)
+LL | | {
+LL | | }
+   | |_^
+
+error[E0631]: type mismatch in closure arguments
+  --> $DIR/expect-fn-supply-fn.rs:46:5
+   |
+LL |     with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _`
+   |     |
+   |     expected signature of `fn(for<'r> fn(&'r u32), &i32) -> _`
+   |
+note: required by `with_closure_expecting_fn_with_bound_region`
+  --> $DIR/expect-fn-supply-fn.rs:6:1
+   |
+LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
+LL | |     where F: FnOnce(fn(&u32), &i32)
+LL | | {
+LL | | }
+   | |_^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr
new file mode 100644 (file)
index 0000000..1d12e2f
--- /dev/null
@@ -0,0 +1,37 @@
+error[E0621]: explicit lifetime required in the type of `x`
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
+   |
+LL |   fn foo(x: &()) {
+   |             --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
+LL | /     bar(|| {
+LL | |
+LL | |         let _ = x;
+LL | |     })
+   | |______^ lifetime `'static` required
+
+error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:9
+   |
+LL |     bar(|| {
+   |         ^^ may outlive borrowed value `x`
+LL |
+LL |         let _ = x;
+   |                 - `x` is borrowed here
+   |
+note: function requires argument type to outlive `'static`
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
+   |
+LL | /     bar(|| {
+LL | |
+LL | |         let _ = x;
+LL | |     })
+   | |______^
+help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
+   |
+LL |     bar(move || {
+   |         ^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0373, E0621.
+For more information about an error, try `rustc --explain E0373`.
diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr
new file mode 100644 (file)
index 0000000..bbf7530
--- /dev/null
@@ -0,0 +1,42 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/expect-region-supply-region.rs:18:9
+   |
+LL |     let mut f: Option<&u32> = None;
+   |         ----- `f` is declared here, outside of the closure body
+LL |     closure_expecting_bound(|x| {
+   |                              - `x` is a reference that is only valid in the closure body
+LL |         f = Some(x);
+   |         ^^^^^^^^^^^ `x` escapes the closure body here
+
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/expect-region-supply-region.rs:28:9
+   |
+LL |     let mut f: Option<&u32> = None;
+   |         ----- `f` is declared here, outside of the closure body
+LL |     closure_expecting_bound(|x: &u32| {
+   |                              - `x` is a reference that is only valid in the closure body
+LL |         f = Some(x);
+   |         ^^^^^^^^^^^ `x` escapes the closure body here
+
+error: lifetime may not live long enough
+  --> $DIR/expect-region-supply-region.rs:37:30
+   |
+LL | fn expect_bound_supply_named<'x>() {
+   |                              -- lifetime `'x` defined here
+...
+LL |     closure_expecting_bound(|x: &'x u32| {
+   |                              ^  - let's call the lifetime of this reference `'1`
+   |                              |
+   |                              requires that `'1` must outlive `'x`
+
+error: lifetime may not live long enough
+  --> $DIR/expect-region-supply-region.rs:37:30
+   |
+LL | fn expect_bound_supply_named<'x>() {
+   |                              -- lifetime `'x` defined here
+...
+LL |     closure_expecting_bound(|x: &'x u32| {
+   |                              ^ requires that `'x` must outlive `'static`
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/consts/const_let_refutable.nll.stderr b/src/test/ui/consts/const_let_refutable.nll.stderr
new file mode 100644 (file)
index 0000000..30ab1f4
--- /dev/null
@@ -0,0 +1,31 @@
+error[E0005]: refutable pattern in function argument: `&[]` not covered
+  --> $DIR/const_let_refutable.rs:3:16
+   |
+LL | const fn slice([a, b]: &[i32]) -> i32 {
+   |                ^^^^^^ pattern `&[]` not covered
+
+error[E0723]: can only call other `const fn` within a `const fn`, but `const std::ops::Add::add` is not stable as `const fn`
+  --> $DIR/const_let_refutable.rs:4:5
+   |
+LL |     a + b
+   |     ^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0381]: use of possibly uninitialized variable: `a`
+  --> $DIR/const_let_refutable.rs:4:5
+   |
+LL |     a + b
+   |     ^ use of possibly uninitialized `a`
+
+error[E0381]: use of possibly uninitialized variable: `b`
+  --> $DIR/const_let_refutable.rs:4:9
+   |
+LL |     a + b
+   |         ^ use of possibly uninitialized `b`
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0005, E0381, E0723.
+For more information about an error, try `rustc --explain E0005`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr
new file mode 100644 (file)
index 0000000..8d96238
--- /dev/null
@@ -0,0 +1,328 @@
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:37:25
+   |
+LL |     const fn into_inner(self) -> T { self.0 }
+   |                         ^^^^ constant functions cannot evaluate destructors
+
+error[E0723]: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:39:36
+   |
+LL |     const fn get_mut(&mut self) -> &mut T { &mut self.0 }
+   |                                    ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:44:28
+   |
+LL |     const fn into_inner_lt(self) -> T { self.0 }
+   |                            ^^^^ constant functions cannot evaluate destructors
+
+error[E0723]: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:46:42
+   |
+LL |     const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
+   |                                          ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0493]: destructors cannot be evaluated at compile-time
+  --> $DIR/min_const_fn.rs:51:27
+   |
+LL |     const fn into_inner_s(self) -> T { self.0 }
+   |                           ^^^^ constant functions cannot evaluate destructors
+
+error[E0723]: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:53:38
+   |
+LL |     const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
+   |                                      ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:58:39
+   |
+LL |     const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
+   |                                       ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:76:16
+   |
+LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
+   |                ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:78:18
+   |
+LL | const fn foo11_2<T: Send>(t: T) -> T { t }
+   |                  ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:80:33
+   |
+LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
+   |                                 ^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:82:35
+   |
+LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
+   |                                   ^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: only int and `bool` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:84:35
+   |
+LL | const fn foo19_3(f: f32) -> f32 { -f }
+   |                                   ^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
+  --> $DIR/min_const_fn.rs:86:43
+   |
+LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
+   |                                           ^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: cannot access `static` items in const fn
+  --> $DIR/min_const_fn.rs:90:27
+   |
+LL | const fn foo25() -> u32 { BAR }
+   |                           ^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: cannot access `static` items in const fn
+  --> $DIR/min_const_fn.rs:91:36
+   |
+LL | const fn foo26() -> &'static u32 { &BAR }
+   |                                    ^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:92:42
+   |
+LL | const fn foo30(x: *const u32) -> usize { x as usize }
+   |                                          ^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:94:63
+   |
+LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }
+   |                                                               ^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:96:42
+   |
+LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
+   |                                          ^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: casting pointers to ints is unstable in const fn
+  --> $DIR/min_const_fn.rs:98:63
+   |
+LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
+   |                                                               ^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:100:38
+   |
+LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:102:29
+   |
+LL | const fn foo30_5(b: bool) { while b { } }
+   |                             ^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:104:44
+   |
+LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
+   |                                            ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/min_const_fn.rs:106:44
+   |
+LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
+   |                                            ^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: mutable references in const fn are unstable
+  --> $DIR/min_const_fn.rs:108:14
+   |
+LL | const fn inc(x: &mut i32) { *x += 1 }
+   |              ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:113:6
+   |
+LL | impl<T: std::fmt::Debug> Foo<T> {
+   |      ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:118:6
+   |
+LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
+   |      ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:123:6
+   |
+LL | impl<T: Sync + Sized> Foo<T> {
+   |      ^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `impl Trait` in const fn is unstable
+  --> $DIR/min_const_fn.rs:129:24
+   |
+LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
+   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:131:34
+   |
+LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
+   |                                  ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:133:22
+   |
+LL | const fn no_apit(_x: impl std::fmt::Debug) {}
+   |                      ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: `impl Trait` in const fn is unstable
+  --> $DIR/min_const_fn.rs:134:23
+   |
+LL | const fn no_rpit() -> impl std::fmt::Debug {}
+   |                       ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:135:23
+   |
+LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
+   |                       ^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:136:32
+   |
+LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0515]: cannot return reference to temporary value
+  --> $DIR/min_const_fn.rs:136:63
+   |
+LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
+   |                                                               ^--
+   |                                                               ||
+   |                                                               |temporary value created here
+   |                                                               returns a reference to data owned by the current function
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn.rs:144:41
+   |
+LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
+   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: function pointers in const fn are unstable
+  --> $DIR/min_const_fn.rs:147:21
+   |
+LL | const fn no_fn_ptrs(_x: fn()) {}
+   |                     ^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: function pointers in const fn are unstable
+  --> $DIR/min_const_fn.rs:149:27
+   |
+LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
+   |                           ^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error: aborting due to 37 previous errors
+
+Some errors have detailed explanations: E0515, E0723.
+For more information about an error, try `rustc --explain E0515`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr
new file mode 100644 (file)
index 0000000..9ffb549
--- /dev/null
@@ -0,0 +1,31 @@
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn_dyn.rs:9:5
+   |
+LL |     x.0.field;
+   |     ^^^^^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
+  --> $DIR/min_const_fn_dyn.rs:12:66
+   |
+LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
+   |                                                                  ^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+error[E0716]: temporary value dropped while borrowed
+  --> $DIR/min_const_fn_dyn.rs:12:67
+   |
+LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
+   |                                                                  -^    - temporary value is freed at the end of this statement
+   |                                                                  ||
+   |                                                                  |creates a temporary which is freed while still in use
+   |                                                                  cast requires that borrow lasts for `'static`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0716, E0723.
+For more information about an error, try `rustc --explain E0716`.
diff --git a/src/test/ui/continue-after-missing-main.nll.stderr b/src/test/ui/continue-after-missing-main.nll.stderr
new file mode 100644 (file)
index 0000000..aceabf3
--- /dev/null
@@ -0,0 +1,7 @@
+error[E0601]: `main` function not found in crate `continue_after_missing_main`
+   |
+   = note: consider adding a `main` function to `$DIR/continue-after-missing-main.rs`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/ui/empty/empty-never-array.nll.stderr b/src/test/ui/empty/empty-never-array.nll.stderr
new file mode 100644 (file)
index 0000000..01ee1c3
--- /dev/null
@@ -0,0 +1,23 @@
+error[E0005]: refutable pattern in local binding: `T(_, _)` not covered
+  --> $DIR/empty-never-array.rs:10:9
+   |
+LL | / enum Helper<T, U> {
+LL | |     T(T, [!; 0]),
+LL | |     #[allow(dead_code)]
+LL | |     U(U),
+LL | | }
+   | |_- `Helper<T, U>` defined here
+...
+LL |       let Helper::U(u) = Helper::T(t, []);
+   |           ^^^^^^^^^^^^ pattern `T(_, _)` not covered
+
+error[E0381]: use of possibly uninitialized variable: `u`
+  --> $DIR/empty-never-array.rs:12:5
+   |
+LL |     u
+   |     ^ use of possibly uninitialized `u`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0005, E0381.
+For more information about an error, try `rustc --explain E0005`.
diff --git a/src/test/ui/error-codes/E0502.nll.stderr b/src/test/ui/error-codes/E0502.nll.stderr
new file mode 100644 (file)
index 0000000..e5671ee
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immutable
+  --> $DIR/E0502.rs:4:9
+   |
+LL |     let ref y = a;
+   |         ----- immutable borrow occurs here
+LL |     bar(a);
+   |         ^ mutable borrow occurs here
+LL |     y.use_ref();
+   |     - immutable borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
new file mode 100644 (file)
index 0000000..5140d1a
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/E0621-does-not-trigger-for-closures.rs:15:45
+   |
+LL |     invoke(&x, |a, b| if a > b { a } else { b });
+   |                    --                       ^ returning this value requires that `'1` must outlive `'2`
+   |                    ||
+   |                    |return type of closure is &'2 i32
+   |                    has type `&'1 i32`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr
new file mode 100644 (file)
index 0000000..f316644
--- /dev/null
@@ -0,0 +1,18 @@
+error: at least one trait must be specified
+  --> $DIR/generic_type_does_not_live_long_enough.rs:9:35
+   |
+LL | existential type WrongGeneric<T>: 'static;
+   |                                   ^^^^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/generic_type_does_not_live_long_enough.rs:6:18
+   |
+LL |     let z: i32 = x;
+   |                  ^ expected i32, found opaque type
+   |
+   = note: expected type `i32`
+              found type `WrongGeneric::<&{integer}>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/generator/auto-trait-regions.nll.stderr b/src/test/ui/generator/auto-trait-regions.nll.stderr
new file mode 100644 (file)
index 0000000..4c157a0
--- /dev/null
@@ -0,0 +1,41 @@
+error[E0716]: temporary value dropped while borrowed
+  --> $DIR/auto-trait-regions.rs:44:24
+   |
+LL |         let a = A(&mut true, &mut true, No);
+   |                        ^^^^                - temporary value is freed at the end of this statement
+   |                        |
+   |                        creates a temporary which is freed while still in use
+LL |         yield;
+LL |         assert_foo(a);
+   |                    - borrow later used here
+   |
+   = note: consider using a `let` binding to create a longer lived value
+
+error[E0716]: temporary value dropped while borrowed
+  --> $DIR/auto-trait-regions.rs:44:35
+   |
+LL |         let a = A(&mut true, &mut true, No);
+   |                                   ^^^^     - temporary value is freed at the end of this statement
+   |                                   |
+   |                                   creates a temporary which is freed while still in use
+LL |         yield;
+LL |         assert_foo(a);
+   |                    - borrow later used here
+   |
+   = note: consider using a `let` binding to create a longer lived value
+
+error: higher-ranked subtype error
+  --> $DIR/auto-trait-regions.rs:30:5
+   |
+LL |     assert_foo(gen);
+   |     ^^^^^^^^^^^^^^^
+
+error: higher-ranked subtype error
+  --> $DIR/auto-trait-regions.rs:48:5
+   |
+LL |     assert_foo(gen);
+   |     ^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr
new file mode 100644 (file)
index 0000000..312a91a
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
+  --> $DIR/hashmap-iter-value-lifetime.rs:7:5
+   |
+LL |     let (_, thing) = my_stuff.iter().next().unwrap();
+   |                      -------- immutable borrow occurs here
+LL | 
+LL |     my_stuff.clear();
+   |     ^^^^^^^^ mutable borrow occurs here
+LL | 
+LL |     println!("{}", *thing);
+   |                    ------ immutable borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/hashmap-lifetimes.nll.stderr b/src/test/ui/hashmap-lifetimes.nll.stderr
new file mode 100644 (file)
index 0000000..aa8e890
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
+  --> $DIR/hashmap-lifetimes.rs:6:5
+   |
+LL |     let mut it = my_stuff.iter();
+   |                  -------- immutable borrow occurs here
+LL |     my_stuff.insert(1, 43);
+   |     ^^^^^^^^ mutable borrow occurs here
+LL |     it;
+   |     -- immutable borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
new file mode 100644 (file)
index 0000000..070fe12
--- /dev/null
@@ -0,0 +1,30 @@
+error: lifetime may not live long enough
+  --> $DIR/hr-subtype.rs:33:13
+   |
+LL |           fn subtype<'x,'y:'x,'z:'y>() {
+   |                      -- -- lifetime `'y` defined here
+   |                      |
+   |                      lifetime `'x` defined here
+LL |               gimme::<$t2>(None::<$t1>);
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | |                                     fn(Inv<'y>)) }
+   | |__________________________________________________- in this macro invocation
+
+error: lifetime may not live long enough
+  --> $DIR/hr-subtype.rs:39:13
+   |
+LL |           fn supertype<'x,'y:'x,'z:'y>() {
+   |                        -- -- lifetime `'y` defined here
+   |                        |
+   |                        lifetime `'x` defined here
+LL |               gimme::<$t1>(None::<$t2>);
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | |                                     fn(Inv<'y>)) }
+   | |__________________________________________________- in this macro invocation
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
new file mode 100644 (file)
index 0000000..e140eaa
--- /dev/null
@@ -0,0 +1,16 @@
+error: lifetime may not live long enough
+  --> $DIR/hr-subtype.rs:39:13
+   |
+LL |           fn supertype<'x,'y:'x,'z:'y>() {
+   |                        -- -- lifetime `'y` defined here
+   |                        |
+   |                        lifetime `'x` defined here
+LL |               gimme::<$t1>(None::<$t2>);
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
+...
+LL | / check! { free_x_vs_free_y: (fn(&'x u32),
+LL | |                             fn(&'y u32)) }
+   | |__________________________________________- in this macro invocation
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.nll.stderr b/src/test/ui/hrtb/hrtb-cache-issue-54302.nll.stderr
new file mode 100644 (file)
index 0000000..4de35d7
--- /dev/null
@@ -0,0 +1,8 @@
+error: higher-ranked subtype error
+  --> $DIR/hrtb-cache-issue-54302.rs:19:5
+   |
+LL |     assert_deserialize_owned::<&'static str>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr
new file mode 100644 (file)
index 0000000..0522fc4
--- /dev/null
@@ -0,0 +1,77 @@
+warning: function cannot return without recursing
+  --> $DIR/hrtb-perfect-forwarding.rs:22:1
+   |
+LL | / fn no_hrtb<'b,T>(mut t: T)
+LL | |     where T : Bar<&'b isize>
+LL | | {
+LL | |     // OK -- `T : Bar<&'b isize>`, and thus the impl above ensures that
+LL | |     // `&mut T : Bar<&'b isize>`.
+LL | |     no_hrtb(&mut t);
+   | |     --------------- recursive call site
+LL | | }
+   | |_^ cannot return without recursing
+   |
+   = note: #[warn(unconditional_recursion)] on by default
+   = help: a `loop` may express intention better if this is on purpose
+
+warning: function cannot return without recursing
+  --> $DIR/hrtb-perfect-forwarding.rs:30:1
+   |
+LL | / fn bar_hrtb<T>(mut t: T)
+LL | |     where T : for<'b> Bar<&'b isize>
+LL | | {
+LL | |     // OK -- `T : for<'b> Bar<&'b isize>`, and thus the impl above
+...  |
+LL | |     bar_hrtb(&mut t);
+   | |     ---------------- recursive call site
+LL | | }
+   | |_^ cannot return without recursing
+   |
+   = help: a `loop` may express intention better if this is on purpose
+
+warning: function cannot return without recursing
+  --> $DIR/hrtb-perfect-forwarding.rs:39:1
+   |
+LL | / fn foo_hrtb_bar_not<'b,T>(mut t: T)
+LL | |     where T : for<'a> Foo<&'a isize> + Bar<&'b isize>
+LL | | {
+LL | |     // Not OK -- The forwarding impl for `Foo` requires that `Bar` also
+...  |
+LL | |     foo_hrtb_bar_not(&mut t);
+   | |     ------------------------ recursive call site
+LL | | }
+   | |_^ cannot return without recursing
+   |
+   = help: a `loop` may express intention better if this is on purpose
+
+error: higher-ranked subtype error
+  --> $DIR/hrtb-perfect-forwarding.rs:46:5
+   |
+LL |     foo_hrtb_bar_not(&mut t);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: lifetime may not live long enough
+  --> $DIR/hrtb-perfect-forwarding.rs:46:5
+   |
+LL | fn foo_hrtb_bar_not<'b,T>(mut t: T)
+   |                     -- lifetime `'b` defined here
+...
+LL |     foo_hrtb_bar_not(&mut t);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static`
+
+warning: function cannot return without recursing
+  --> $DIR/hrtb-perfect-forwarding.rs:49:1
+   |
+LL | / fn foo_hrtb_bar_hrtb<T>(mut t: T)
+LL | |     where T : for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>
+LL | | {
+LL | |     // OK -- now we have `T : for<'b> Bar&'b isize>`.
+LL | |     foo_hrtb_bar_hrtb(&mut t);
+   | |     ------------------------- recursive call site
+LL | | }
+   | |_^ cannot return without recursing
+   |
+   = help: a `loop` may express intention better if this is on purpose
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr
new file mode 100644 (file)
index 0000000..da30997
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/dyn-trait.rs:20:5
+   |
+LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
+   |                              - `x` is a reference that is only valid in the function body
+LL |     static_val(x);
+   |     ^^^^^^^^^^^^^ `x` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr
new file mode 100644 (file)
index 0000000..4b7c04f
--- /dev/null
@@ -0,0 +1,51 @@
+error: lifetime may not live long enough
+  --> $DIR/must_outlive_least_region_or_bound.rs:3:23
+   |
+LL | fn elided(x: &i32) -> impl Copy { x }
+   |              -        ^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
+   |              |
+   |              let's call the lifetime of this reference `'1`
+help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint
+   |
+LL | fn elided(x: &i32) -> impl Copy + '_ { x }
+   |                       ^^^^^^^^^^^^^^
+
+error: lifetime may not live long enough
+  --> $DIR/must_outlive_least_region_or_bound.rs:6:32
+   |
+LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
+   |             --                 ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
+   |             |
+   |             lifetime `'a` defined here
+help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
+   |
+LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
+   |                                ^^^^^^^^^^^^^^
+
+error: lifetime may not live long enough
+  --> $DIR/must_outlive_least_region_or_bound.rs:12:69
+   |
+LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
+   |               -- lifetime `'a` defined here                         ^ returning this value requires that `'a` must outlive `'static`
+   |
+   = help: consider replacing `'a` with `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/must_outlive_least_region_or_bound.rs:17:61
+   |
+LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
+   |                          --  -- lifetime `'b` defined here  ^^^^^^^^^^^^^^^^ opaque type requires that `'b` must outlive `'a`
+   |                          |
+   |                          lifetime `'a` defined here
+
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/must_outlive_least_region_or_bound.rs:22:51
+   |
+LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
+   |                                                   ^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr
new file mode 100644 (file)
index 0000000..0bf120c
--- /dev/null
@@ -0,0 +1,26 @@
+error: lifetime may not live long enough
+  --> $DIR/static-return-lifetime-infered.rs:6:35
+   |
+LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
+   |                         -         ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
+   |                         |
+   |                         let's call the lifetime of this reference `'1`
+help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint
+   |
+LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: lifetime may not live long enough
+  --> $DIR/static-return-lifetime-infered.rs:10:37
+   |
+LL |     fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
+   |                    --               ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
+   |                    |
+   |                    lifetime `'a` defined here
+help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
+   |
+LL |     fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/impl-trait/type_parameters_captured.nll.stderr b/src/test/ui/impl-trait/type_parameters_captured.nll.stderr
new file mode 100644 (file)
index 0000000..039cb62
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/type_parameters_captured.rs:7:20
+   |
+LL | fn foo<T>(x: T) -> impl Any + 'static {
+   |                    ^^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr
new file mode 100644 (file)
index 0000000..f5aee2d
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0621]: explicit lifetime required in the type of `y`
+  --> $DIR/mismatched.rs:4:42
+   |
+LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y }
+   |                       ----               ^ lifetime `'a` required
+   |                       |
+   |                       help: add explicit lifetime `'a` to the type of `y`: `&'a u32`
+
+error: lifetime may not live long enough
+  --> $DIR/mismatched.rs:6:46
+   |
+LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y }
+   |             --          --                   ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+   |             |           |
+   |             |           lifetime `'b` defined here
+   |             lifetime `'a` defined here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr
new file mode 100644 (file)
index 0000000..cd65bab
--- /dev/null
@@ -0,0 +1,24 @@
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements
+  --> $DIR/mismatched_trait_impl.rs:9:5
+   |
+LL |     fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 9:5...
+  --> $DIR/mismatched_trait_impl.rs:9:5
+   |
+LL | /     fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+LL | |         x
+LL | |     }
+   | |_____^
+note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 9:32...
+  --> $DIR/mismatched_trait_impl.rs:9:32
+   |
+LL |     fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+   |                                ^^
+   = note: ...so that the method type is compatible with trait:
+           expected fn(&i32, &'a u32, &u32) -> &'a u32
+              found fn(&i32, &u32, &u32) -> &u32
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-10291.nll.stderr b/src/test/ui/issues/issue-10291.nll.stderr
new file mode 100644 (file)
index 0000000..45f29fd
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-10291.rs:3:9
+   |
+LL | fn test<'x>(x: &'x isize) {
+   |         -- lifetime `'x` defined here
+LL |     drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
+LL |         x
+   |         ^ returning this value requires that `'x` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-13058.nll.stderr b/src/test/ui/issues/issue-13058.nll.stderr
new file mode 100644 (file)
index 0000000..8368978
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0621]: explicit lifetime required in the type of `cont`
+  --> $DIR/issue-13058.rs:14:21
+   |
+LL | fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
+   |                                                                     -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T`
+LL | {
+LL |     let cont_iter = cont.iter();
+   |                     ^^^^^^^^^^^ lifetime `'r` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/issues/issue-15034.nll.stderr b/src/test/ui/issues/issue-15034.nll.stderr
new file mode 100644 (file)
index 0000000..f142e26
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0621]: explicit lifetime required in the type of `lexer`
+  --> $DIR/issue-15034.rs:17:9
+   |
+LL |     pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
+   |                       ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>`
+LL |         Parser { lexer: lexer }
+   |         ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/issues/issue-15381.nll.stderr b/src/test/ui/issues/issue-15381.nll.stderr
new file mode 100644 (file)
index 0000000..a849584
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0005]: refutable pattern in `for` loop binding: `&[]` not covered
+  --> $DIR/issue-15381.rs:4:9
+   |
+LL |     for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
+   |         ^^^^^^^^ pattern `&[]` not covered
+
+error[E0381]: borrow of possibly uninitialized variable: `y`
+  --> $DIR/issue-15381.rs:6:26
+   |
+LL |         println!("y={}", y);
+   |                          ^ use of possibly uninitialized `y`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0005, E0381.
+For more information about an error, try `rustc --explain E0005`.
diff --git a/src/test/ui/issues/issue-16683.nll.stderr b/src/test/ui/issues/issue-16683.nll.stderr
new file mode 100644 (file)
index 0000000..ea6b69d
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/issue-16683.rs:4:9
+   |
+LL |     fn b(&self) {
+   |          ----- `self` is a reference that is only valid in the function body
+LL |         self.a();
+   |         ^^^^^^^^ `self` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-17728.nll.stderr b/src/test/ui/issues/issue-17728.nll.stderr
new file mode 100644 (file)
index 0000000..7436ebd
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0308]: match arms have incompatible types
+  --> $DIR/issue-17728.rs:109:14
+   |
+LL | /     match to_parse {
+LL | |         "w" | "west" => RoomDirection::West,
+LL | |         "e" | "east" => RoomDirection::East,
+LL | |         "n" | "north" => RoomDirection::North,
+...  |
+LL | |         "down" => RoomDirection::Down,
+   | |                   ------------------- this and all prior arms are found to be of type `RoomDirection`
+LL | |         _ => None
+   | |              ^^^^ expected enum `RoomDirection`, found enum `std::option::Option`
+LL | |     }
+   | |_____- `match` arms have incompatible types
+   |
+   = note: expected type `RoomDirection`
+              found type `std::option::Option<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/issues/issue-17758.nll.stderr b/src/test/ui/issues/issue-17758.nll.stderr
new file mode 100644 (file)
index 0000000..b9dc9da
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/issue-17758.rs:7:9
+   |
+LL |     fn bar(&self) {
+   |            ----- `self` is a reference that is only valid in the function body
+LL |         self.foo();
+   |         ^^^^^^^^^^ `self` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-26217.nll.stderr b/src/test/ui/issues/issue-26217.nll.stderr
new file mode 100644 (file)
index 0000000..c7601ca
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-26217.rs:4:5
+   |
+LL | fn bar<'a>() {
+   |        -- lifetime `'a` defined here
+LL |     foo::<&'a i32>();
+   |     ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-28848.nll.stderr b/src/test/ui/issues/issue-28848.nll.stderr
new file mode 100644 (file)
index 0000000..5cf9856
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-28848.rs:10:5
+   |
+LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
+   |            --  -- lifetime `'b` defined here
+   |            |
+   |            lifetime `'a` defined here
+LL |     Foo::<'a, 'b>::xmute(u)
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-40510-1.migrate.nll.stderr b/src/test/ui/issues/issue-40510-1.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..776a724
--- /dev/null
@@ -0,0 +1,13 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-1.rs:11:9
+   |
+LL |     || {
+   |      - inferred to be a `FnMut` closure
+LL |         &mut x
+   |         ^^^^^^ returns a reference to a captured variable which escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-40510-1.migrate.stderr b/src/test/ui/issues/issue-40510-1.migrate.stderr
new file mode 100644 (file)
index 0000000..17d1c48
--- /dev/null
@@ -0,0 +1,21 @@
+warning: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-1.rs:11:9
+   |
+LL |     || {
+   |      - inferred to be a `FnMut` closure
+LL |         &mut x
+   |         ^^^^^^ returns a reference to a captured variable which escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+error: compilation successful
+  --> $DIR/issue-40510-1.rs:20:1
+   |
+LL | fn main() {}
+   | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-40510-1.nll.stderr b/src/test/ui/issues/issue-40510-1.nll.stderr
new file mode 100644 (file)
index 0000000..776a724
--- /dev/null
@@ -0,0 +1,13 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-1.rs:11:9
+   |
+LL |     || {
+   |      - inferred to be a `FnMut` closure
+LL |         &mut x
+   |         ^^^^^^ returns a reference to a captured variable which escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
index dd8a6bc5ab2bd73f0a2bdce2e0844dca22e09ab4..6ecbeefd88115801d2b6a5f9a5204ac886f5df7f 100644 (file)
@@ -1,13 +1,21 @@
-// compile-pass
+#![feature(rustc_attrs)]
 #![allow(unused)]
 
+// revisions: migrate nll
+#![cfg_attr(nll, feature(nll))]
+
 fn f() {
     let mut x: Box<()> = Box::new(());
 
     || {
         &mut x
     };
+    //[migrate]~^^ WARNING captured variable cannot escape `FnMut` closure body
+    //[migrate]~| WARNING this error has been downgraded to a warning
+    //[migrate]~| WARNING this warning will become a hard error in the future
+    //[nll]~^^^^^ ERROR captured variable cannot escape `FnMut` closure body
 }
 
-
+#[rustc_error]
 fn main() {}
+//[migrate]~^ ERROR
diff --git a/src/test/ui/issues/issue-40510-1.stderr b/src/test/ui/issues/issue-40510-1.stderr
deleted file mode 100644 (file)
index 44234cb..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-warning: captured variable cannot escape `FnMut` closure body
-  --> $DIR/issue-40510-1.rs:8:9
-   |
-LL |     || {
-   |      - inferred to be a `FnMut` closure
-LL |         &mut x
-   |         ^^^^^^ returns a reference to a captured variable which escapes the closure body
-   |
-   = note: `FnMut` closures only have access to their captured variables while they are executing...
-   = note: ...therefore, they cannot allow references to captured variables to escape
-   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
-   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
diff --git a/src/test/ui/issues/issue-40510-3.migrate.nll.stderr b/src/test/ui/issues/issue-40510-3.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..a49475a
--- /dev/null
@@ -0,0 +1,15 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-3.rs:11:9
+   |
+LL |       || {
+   |        - inferred to be a `FnMut` closure
+LL | /         || {
+LL | |             x.push(())
+LL | |         }
+   | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-40510-3.migrate.stderr b/src/test/ui/issues/issue-40510-3.migrate.stderr
new file mode 100644 (file)
index 0000000..692aa10
--- /dev/null
@@ -0,0 +1,23 @@
+warning: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-3.rs:11:9
+   |
+LL |       || {
+   |        - inferred to be a `FnMut` closure
+LL | /         || {
+LL | |             x.push(())
+LL | |         }
+   | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+error: compilation successful
+  --> $DIR/issue-40510-3.rs:22:1
+   |
+LL | fn main() {}
+   | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-40510-3.nll.stderr b/src/test/ui/issues/issue-40510-3.nll.stderr
new file mode 100644 (file)
index 0000000..a49475a
--- /dev/null
@@ -0,0 +1,15 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-40510-3.rs:11:9
+   |
+LL |       || {
+   |        - inferred to be a `FnMut` closure
+LL | /         || {
+LL | |             x.push(())
+LL | |         }
+   | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
index bc95c461d1e1eea30652bcdd07c35884a9a2e445..205d982363128d11d70c5d705580e2a3066284e5 100644 (file)
@@ -1,6 +1,9 @@
-// compile-pass
+#![feature(rustc_attrs)]
 #![allow(unused)]
 
+// revisions: migrate nll
+#![cfg_attr(nll, feature(nll))]
+
 fn f() {
     let mut x: Vec<()> = Vec::new();
 
@@ -8,8 +11,13 @@ fn f() {
         || {
             x.push(())
         }
+        //[migrate]~^^^ WARNING captured variable cannot escape `FnMut` closure body
+        //[migrate]~| WARNING this error has been downgraded to a warning
+        //[migrate]~| WARNING this warning will become a hard error in the future
+        //[nll]~^^^^^^ ERROR captured variable cannot escape `FnMut` closure body
     };
 }
 
-
+#[rustc_error]
 fn main() {}
+//[migrate]~^ ERROR
diff --git a/src/test/ui/issues/issue-40510-3.stderr b/src/test/ui/issues/issue-40510-3.stderr
deleted file mode 100644 (file)
index 1297e14..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-warning: captured variable cannot escape `FnMut` closure body
-  --> $DIR/issue-40510-3.rs:8:9
-   |
-LL |       || {
-   |        - inferred to be a `FnMut` closure
-LL | /         || {
-LL | |             x.push(())
-LL | |         }
-   | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
-   |
-   = note: `FnMut` closures only have access to their captured variables while they are executing...
-   = note: ...therefore, they cannot allow references to captured variables to escape
-   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
-   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr
new file mode 100644 (file)
index 0000000..9c6f8d4
--- /dev/null
@@ -0,0 +1,18 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/issue-49824.rs:10:9
+   |
+LL |       || {
+   |        - inferred to be a `FnMut` closure
+LL | /         || {
+LL | |
+LL | |
+LL | |
+LL | |             let _y = &mut x;
+LL | |         }
+   | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-52213.nll.stderr b/src/test/ui/issues/issue-52213.nll.stderr
new file mode 100644 (file)
index 0000000..eba875d
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-52213.rs:3:20
+   |
+LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
+   |                       --  -- lifetime `'b` defined here
+   |                       |
+   |                       lifetime `'a` defined here
+LL |     match (&t,) {
+LL |         ((u,),) => u,
+   |                    ^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-52533-1.nll.stderr b/src/test/ui/issues/issue-52533-1.nll.stderr
new file mode 100644 (file)
index 0000000..20f19b2
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-52533-1.rs:9:18
+   |
+LL |     gimme(|x, y| y)
+   |            -  -  ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+   |            |  |
+   |            |  has type `&Foo<'_, '1, u32>`
+   |            has type `&Foo<'_, '2, u32>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-52533.nll.stderr b/src/test/ui/issues/issue-52533.nll.stderr
new file mode 100644 (file)
index 0000000..c764736
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-52533.rs:5:16
+   |
+LL |     foo(|a, b| b)
+   |          -  -  ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+   |          |  |
+   |          |  has type `&'1 u32`
+   |          has type `&'2 u32`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-54302-cases.nll.stderr b/src/test/ui/issues/issue-54302-cases.nll.stderr
new file mode 100644 (file)
index 0000000..7463a3f
--- /dev/null
@@ -0,0 +1,26 @@
+error: higher-ranked subtype error
+  --> $DIR/issue-54302-cases.rs:63:5
+   |
+LL |     <u32 as RefFoo<u32>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: higher-ranked subtype error
+  --> $DIR/issue-54302-cases.rs:69:5
+   |
+LL |     <i32 as RefFoo<i32>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: higher-ranked subtype error
+  --> $DIR/issue-54302-cases.rs:75:5
+   |
+LL |     <u64 as RefFoo<u64>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: higher-ranked subtype error
+  --> $DIR/issue-54302-cases.rs:81:5
+   |
+LL |     <i64 as RefFoo<i64>>::ref_foo(a)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/issues/issue-54302.nll.stderr b/src/test/ui/issues/issue-54302.nll.stderr
new file mode 100644 (file)
index 0000000..e68de03
--- /dev/null
@@ -0,0 +1,8 @@
+error: higher-ranked subtype error
+  --> $DIR/issue-54302.rs:13:5
+   |
+LL |     assert_deserialize_owned::<&'static str>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-55731.nll.stderr b/src/test/ui/issues/issue-55731.nll.stderr
new file mode 100644 (file)
index 0000000..dd38bb6
--- /dev/null
@@ -0,0 +1,11 @@
+error: higher-ranked subtype error
+  --> $DIR/issue-55731.rs:48:5
+   |
+LL | /     multi(Map {
+LL | |         i: Cloned(PhantomData),
+LL | |         f: X,
+LL | |     });
+   | |______^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-55796.nll.stderr b/src/test/ui/issues/issue-55796.nll.stderr
new file mode 100644 (file)
index 0000000..5809a56
--- /dev/null
@@ -0,0 +1,20 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-55796.rs:16:9
+   |
+LL | pub trait Graph<'a> {
+   |                 -- lifetime `'a` defined here
+...
+LL |         Box::new(self.out_edges(u).map(|e| e.target()))
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/issue-55796.rs:21:9
+   |
+LL | pub trait Graph<'a> {
+   |                 -- lifetime `'a` defined here
+...
+LL |         Box::new(self.in_edges(u).map(|e| e.target()))
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/issues/issue-57843.nll.stderr b/src/test/ui/issues/issue-57843.nll.stderr
new file mode 100644 (file)
index 0000000..7031078
--- /dev/null
@@ -0,0 +1,8 @@
+error: higher-ranked subtype error
+  --> $DIR/issue-57843.rs:23:9
+   |
+LL |     Foo(Box::new(|_| ()));
+   |         ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr
new file mode 100644 (file)
index 0000000..c1f662f
--- /dev/null
@@ -0,0 +1,63 @@
+error[E0277]: `T` cannot be sent between threads safely
+  --> $DIR/kindck-impl-type-params.rs:18:13
+   |
+LL |     let a = &t as &Gettable<T>;
+   |             ^^ `T` cannot be sent between threads safely
+   |
+   = help: the trait `std::marker::Send` is not implemented for `T`
+   = help: consider adding a `where T: std::marker::Send` bound
+   = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+   = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+  --> $DIR/kindck-impl-type-params.rs:18:13
+   |
+LL |     let a = &t as &Gettable<T>;
+   |             ^^ the trait `std::marker::Copy` is not implemented for `T`
+   |
+   = help: consider adding a `where T: std::marker::Copy` bound
+   = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+   = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: `T` cannot be sent between threads safely
+  --> $DIR/kindck-impl-type-params.rs:25:27
+   |
+LL |     let a: &Gettable<T> = &t;
+   |                           ^^ `T` cannot be sent between threads safely
+   |
+   = help: the trait `std::marker::Send` is not implemented for `T`
+   = help: consider adding a `where T: std::marker::Send` bound
+   = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+   = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+  --> $DIR/kindck-impl-type-params.rs:25:27
+   |
+LL |     let a: &Gettable<T> = &t;
+   |                           ^^ the trait `std::marker::Copy` is not implemented for `T`
+   |
+   = help: consider adding a `where T: std::marker::Copy` bound
+   = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+   = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
+  --> $DIR/kindck-impl-type-params.rs:38:13
+   |
+LL |     let a = t as Box<Gettable<String>>;
+   |             ^ the trait `std::marker::Copy` is not implemented for `std::string::String`
+   |
+   = note: required because of the requirements on the impl of `Gettable<std::string::String>` for `S<std::string::String>`
+   = note: required for the cast to the object type `dyn Gettable<std::string::String>`
+
+error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied
+  --> $DIR/kindck-impl-type-params.rs:46:33
+   |
+LL |     let a: Box<Gettable<Foo>> = t;
+   |                                 ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo`
+   |
+   = note: required because of the requirements on the impl of `Gettable<foo3::Foo>` for `S<foo3::Foo>`
+   = note: required for the cast to the object type `dyn Gettable<foo3::Foo>`
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/kindck/kindck-send-object1.nll.stderr b/src/test/ui/kindck/kindck-send-object1.nll.stderr
new file mode 100644 (file)
index 0000000..1df7412
--- /dev/null
@@ -0,0 +1,32 @@
+error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely
+  --> $DIR/kindck-send-object1.rs:10:5
+   |
+LL |     assert_send::<&'a Dummy>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely
+   |
+   = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)`
+   = note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)`
+note: required by `assert_send`
+  --> $DIR/kindck-send-object1.rs:5:1
+   |
+LL | fn assert_send<T:Send+'static>() { }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely
+  --> $DIR/kindck-send-object1.rs:29:5
+   |
+LL |     assert_send::<Box<Dummy+'a>>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely
+   |
+   = help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)`
+   = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>`
+   = note: required because it appears within the type `std::boxed::Box<(dyn Dummy + 'a)>`
+note: required by `assert_send`
+  --> $DIR/kindck-send-object1.rs:5:1
+   |
+LL | fn assert_send<T:Send+'static>() { }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr
new file mode 100644 (file)
index 0000000..8b24563
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/lifetime-bound-will-change-warning.rs:34:5
+   |
+LL | fn test2<'a>(x: &'a Box<Fn()+'a>) {
+   |              - `x` is a reference that is only valid in the function body
+LL |     // but ref_obj will not, so warn.
+LL |     ref_obj(x)
+   |     ^^^^^^^^^^ `x` escapes the function body here
+
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/lifetime-bound-will-change-warning.rs:39:5
+   |
+LL | fn test2cc<'a>(x: &'a Box<Fn()+'a>) {
+   |                - `x` is a reference that is only valid in the function body
+LL |     // same as test2, but cross crate
+LL |     lib::ref_obj(x)
+   |     ^^^^^^^^^^^^^^^ `x` escapes the function body here
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr
new file mode 100644 (file)
index 0000000..fc9093b
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:11:20
+   |
+LL |     fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
+   |            --     - let's call the lifetime of this reference `'1`
+   |            |
+   |            lifetime `'a` defined here
+LL | 
+LL |         if x > y { x } else { y }
+   |                    ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr
new file mode 100644 (file)
index 0000000..3384c24
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:8:5
+   |
+LL |   fn foo<'a>(&self, x: &'a i32) -> &i32 {
+   |          --  - let's call the lifetime of this reference `'1`
+   |          |
+   |          lifetime `'a` defined here
+LL | 
+LL |     x
+   |     ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr
new file mode 100644 (file)
index 0000000..5ef2907
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:8:30
+   |
+LL |     fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
+   |            --  - let's call the lifetime of this reference `'1`
+   |            |
+   |            lifetime `'a` defined here
+LL | 
+LL |         if true { x } else { self }
+   |                              ^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr
new file mode 100644 (file)
index 0000000..90d4754
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0621]: explicit lifetime required in the type of `x`
+  --> $DIR/ex2a-push-one-existing-name-2.rs:6:5
+   |
+LL | fn foo<'a>(x: Ref<i32>, y: &mut Vec<Ref<'a, i32>>) {
+   |               -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>`
+LL |     y.push(x);
+   |     ^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr
new file mode 100644 (file)
index 0000000..a03e16b
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0621]: explicit lifetime required in the type of `y`
+  --> $DIR/ex2a-push-one-existing-name-early-bound.rs:8:5
+   |
+LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T)
+   |                                          -- help: add explicit lifetime `'a` to the type of `y`: `&'a T`
+...
+LL |     x.push(y);
+   |     ^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr
new file mode 100644 (file)
index 0000000..487b34e
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0621]: explicit lifetime required in the type of `y`
+  --> $DIR/ex2a-push-one-existing-name.rs:6:5
+   |
+LL | fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) {
+   |                                          -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>`
+LL |     x.push(y);
+   |     ^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr
new file mode 100644 (file)
index 0000000..735f7a0
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex2b-push-no-existing-names.rs:6:5
+   |
+LL | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
+   |        -                      - has type `Ref<'1, i32>`
+   |        |
+   |        has type `&mut std::vec::Vec<Ref<'2, i32>>`
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr
new file mode 100644 (file)
index 0000000..fbefa1f
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex2c-push-inference-variable.rs:7:5
+   |
+LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
+   |            --  -- lifetime `'c` defined here
+   |            |
+   |            lifetime `'b` defined here
+LL |     let z = Ref { data: y.data };
+LL |     x.push(z);
+   |     ^^^^^^^^^ argument requires that `'c` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr
new file mode 100644 (file)
index 0000000..d889eb4
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex2d-push-inference-variable-2.rs:8:5
+   |
+LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
+   |            --  -- lifetime `'c` defined here
+   |            |
+   |            lifetime `'b` defined here
+...
+LL |     a.push(b);
+   |     ^^^^^^^^^ argument requires that `'c` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr
new file mode 100644 (file)
index 0000000..39eb407
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex2e-push-inference-variable-3.rs:8:5
+   |
+LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
+   |            --  -- lifetime `'c` defined here
+   |            |
+   |            lifetime `'b` defined here
+...
+LL |     Vec::push(a, b);
+   |     ^^^^^^^^^^^^^^^ argument requires that `'c` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr
new file mode 100644 (file)
index 0000000..a94f9a7
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-2.rs:2:5
+   |
+LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) {
+   |                                   -             - let's call the lifetime of this reference `'1`
+   |                                   |
+   |                                   let's call the lifetime of this reference `'2`
+LL |     *v = x;
+   |     ^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr
new file mode 100644 (file)
index 0000000..779e2eb
--- /dev/null
@@ -0,0 +1,22 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-3.rs:2:5
+   |
+LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
+   |                     -                   - let's call the lifetime of this reference `'1`
+   |                     |
+   |                     let's call the lifetime of this reference `'2`
+LL |     z.push((x,y));
+   |     ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-3.rs:2:5
+   |
+LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
+   |                         -                    - let's call the lifetime of this reference `'1`
+   |                         |
+   |                         let's call the lifetime of this reference `'2`
+LL |     z.push((x,y));
+   |     ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr
new file mode 100644 (file)
index 0000000..4c0ffe5
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:5
+   |
+LL | fn foo(mut x: Ref, y: Ref) {
+   |        -----       - has type `Ref<'_, '1>`
+   |        |
+   |        has type `Ref<'_, '2>`
+LL |     x.b = y.b;
+   |     ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr
new file mode 100644 (file)
index 0000000..97c6653
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:7:5
+   |
+LL | fn foo(mut x: Ref) {
+   |        -----
+   |        |
+   |        has type `Ref<'_, '1>`
+   |        has type `Ref<'2, '_>`
+LL |     x.a = x.b;
+   |     ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr
new file mode 100644 (file)
index 0000000..a39bb16
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:9:5
+   |
+LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>)
+   |        --  -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+...
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr
new file mode 100644 (file)
index 0000000..48ce530
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:6:5
+   |
+LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) {
+   |        --  -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr
new file mode 100644 (file)
index 0000000..f9c33c2
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-both-are-structs.rs:6:5
+   |
+LL | fn foo(mut x: Vec<Ref>, y: Ref) {
+   |        -----            - has type `Ref<'1>`
+   |        |
+   |        has type `std::vec::Vec<Ref<'2>>`
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr
new file mode 100644 (file)
index 0000000..0996068
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-latebound-regions.rs:2:5
+   |
+LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
+   |        -- -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr
new file mode 100644 (file)
index 0000000..5751c31
--- /dev/null
@@ -0,0 +1,21 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5
+   |
+LL | fn foo(mut x: Ref, y: &u32) {
+   |        -----          - let's call the lifetime of this reference `'2`
+   |        |
+   |        has type `Ref<'_, '1>`
+LL |     y = x.b;
+   |     ^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error[E0384]: cannot assign to immutable argument `y`
+  --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5
+   |
+LL | fn foo(mut x: Ref, y: &u32) {
+   |                    - help: make this binding mutable: `mut y`
+LL |     y = x.b;
+   |     ^^^^^^^ cannot assign to immutable argument
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr
new file mode 100644 (file)
index 0000000..79e7e8e
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:4:5
+   |
+LL | fn foo(mut y: Ref, x: &u32) {
+   |        -----          - let's call the lifetime of this reference `'1`
+   |        |
+   |        has type `Ref<'_, '2>`
+LL |     y.b = x;
+   |     ^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr
new file mode 100644 (file)
index 0000000..53615fd
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:4:5
+   |
+LL | fn foo(mut y: Ref, x: &u32) {
+   |        -----          - let's call the lifetime of this reference `'1`
+   |        |
+   |        has type `Ref<'_, '2>`
+LL |     y.b = x;
+   |     ^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr
new file mode 100644 (file)
index 0000000..6ff4411
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-one-is-struct.rs:7:5
+   |
+LL | fn foo(mut x: Ref, y: &u32) {
+   |        -----          - let's call the lifetime of this reference `'1`
+   |        |
+   |        has type `Ref<'_, '2>`
+LL |     x.b = y;
+   |     ^^^^^^^ assignment requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr
new file mode 100644 (file)
index 0000000..1c258ad
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:7:5
+   |
+LL |   fn foo<'a>(&self, x: &i32) -> &i32 {
+   |              -         - let's call the lifetime of this reference `'1`
+   |              |
+   |              let's call the lifetime of this reference `'2`
+LL |     x
+   |     ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr
new file mode 100644 (file)
index 0000000..ffe39fd
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-self-is-anon.rs:7:19
+   |
+LL |     fn foo<'a>(&self, x: &Foo) -> &Foo {
+   |                -         - let's call the lifetime of this reference `'1`
+   |                |
+   |                let's call the lifetime of this reference `'2`
+LL |         if true { x } else { self }
+   |                   ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr
new file mode 100644 (file)
index 0000000..33be98c
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
+  --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
+   |
+LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
+   |                        - help: consider changing this to be mutable: `mut y`
+LL |   y.push(z);
+   |   ^ cannot borrow as mutable
+
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
+   |
+LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
+   |                               -        - let's call the lifetime of this reference `'1`
+   |                               |
+   |                               let's call the lifetime of this reference `'2`
+LL |   y.push(z);
+   |   ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr
new file mode 100644 (file)
index 0000000..f350267
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-using-impl-items.rs:6:9
+   |
+LL |     fn foo(x: &mut Vec<&u8>, y: &u8) {
+   |                        -        - let's call the lifetime of this reference `'1`
+   |                        |
+   |                        let's call the lifetime of this reference `'2`
+LL |         x.push(y);
+   |         ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr
new file mode 100644 (file)
index 0000000..c4e7ff9
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
+  --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
+   |
+LL | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
+   |                              - help: consider changing this to be mutable: `mut y`
+LL |   y.push(z);
+   |   ^ cannot borrow as mutable
+
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
+   |
+LL | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
+   |                                     -        - let's call the lifetime of this reference `'1`
+   |                                     |
+   |                                     let's call the lifetime of this reference `'2`
+LL |   y.push(z);
+   |   ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr
new file mode 100644 (file)
index 0000000..6989acf
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/ex3-both-anon-regions.rs:2:5
+   |
+LL | fn foo(x: &mut Vec<&u8>, y: &u8) {
+   |                    -        - let's call the lifetime of this reference `'1`
+   |                    |
+   |                    let's call the lifetime of this reference `'2`
+LL |     x.push(y);
+   |     ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lub-if.nll.stderr b/src/test/ui/lub-if.nll.stderr
new file mode 100644 (file)
index 0000000..832688f
--- /dev/null
@@ -0,0 +1,20 @@
+error: lifetime may not live long enough
+  --> $DIR/lub-if.rs:28:9
+   |
+LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 -- lifetime `'a` defined here
+...
+LL |         s
+   |         ^ returning this value requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/lub-if.rs:35:9
+   |
+LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 -- lifetime `'a` defined here
+...
+LL |         s
+   |         ^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/lub-match.nll.stderr b/src/test/ui/lub-match.nll.stderr
new file mode 100644 (file)
index 0000000..3a344a7
--- /dev/null
@@ -0,0 +1,20 @@
+error: lifetime may not live long enough
+  --> $DIR/lub-match.rs:30:13
+   |
+LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 -- lifetime `'a` defined here
+...
+LL |             s
+   |             ^ returning this value requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/lub-match.rs:39:13
+   |
+LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 -- lifetime `'a` defined here
+...
+LL |             s
+   |             ^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/match/match-ref-mut-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-invariance.nll.stderr
new file mode 100644 (file)
index 0000000..505b8db
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/match-ref-mut-invariance.rs:10:9
+   |
+LL | impl<'b> S<'b> {
+   |      -- lifetime `'b` defined here
+LL |     fn bar<'a>(&'a mut self) -> &'a mut &'a i32 {
+   |            -- lifetime `'a` defined here
+LL |         match self.0 { ref mut x => x }
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr
new file mode 100644 (file)
index 0000000..ab5f43d
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/match-ref-mut-let-invariance.rs:11:9
+   |
+LL | impl<'b> S<'b> {
+   |      -- lifetime `'b` defined here
+LL |     fn bar<'a>(&'a mut self) -> &'a mut &'a i32 {
+   |            -- lifetime `'a` defined here
+LL |         let ref mut x = self.0;
+LL |         x
+   |         ^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/nll/get_default.nll.stderr b/src/test/ui/nll/get_default.nll.stderr
new file mode 100644 (file)
index 0000000..2791230
--- /dev/null
@@ -0,0 +1,48 @@
+error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
+  --> $DIR/get_default.rs:21:17
+   |
+LL | fn ok(map: &mut Map) -> &String {
+   |            - let's call the lifetime of this reference `'1`
+LL |     loop {
+LL |         match map.get() {
+   |               --- immutable borrow occurs here
+LL |             Some(v) => {
+LL |                 return v;
+   |                        - returning this value requires that `*map` is borrowed for `'1`
+...
+LL |                 map.set(String::new()); // Ideally, this would not error.
+   |                 ^^^ mutable borrow occurs here
+
+error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
+  --> $DIR/get_default.rs:32:17
+   |
+LL | fn err(map: &mut Map) -> &String {
+   |             - let's call the lifetime of this reference `'1`
+LL |     loop {
+LL |         match map.get() {
+   |               --- immutable borrow occurs here
+LL |             Some(v) => {
+LL |                 map.set(String::new()); // Both AST and MIR error here
+   |                 ^^^ mutable borrow occurs here
+LL |
+LL |                 return v;
+   |                        - returning this value requires that `*map` is borrowed for `'1`
+
+error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
+  --> $DIR/get_default.rs:37:17
+   |
+LL | fn err(map: &mut Map) -> &String {
+   |             - let's call the lifetime of this reference `'1`
+LL |     loop {
+LL |         match map.get() {
+   |               --- immutable borrow occurs here
+...
+LL |                 return v;
+   |                        - returning this value requires that `*map` is borrowed for `'1`
+...
+LL |                 map.set(String::new()); // Ideally, just AST would error here
+   |                 ^^^ mutable borrow occurs here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/nll/region-ends-after-if-condition.nll.stderr b/src/test/ui/nll/region-ends-after-if-condition.nll.stderr
new file mode 100644 (file)
index 0000000..3229309
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable
+  --> $DIR/region-ends-after-if-condition.rs:26:9
+   |
+LL |     let value = &my_struct.field;
+   |                 ---------------- immutable borrow occurs here
+LL |     if value.is_empty() {
+LL |         my_struct.field.push_str("Hello, world!");
+   |         ^^^^^^^^^^^^^^^ mutable borrow occurs here
+...
+LL |     drop(value);
+   |          ----- immutable borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr
new file mode 100644 (file)
index 0000000..58bfb60
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
+  --> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5
+   |
+LL |     bar::<<T as MyTrait<'a>>::Output>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr
new file mode 100644 (file)
index 0000000..19cdd66
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/object-lifetime-default-elision.rs:71:5
+   |
+LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait {
+   |          -- -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+...
+LL |     ss
+   |     ^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr
new file mode 100644 (file)
index 0000000..9e68647
--- /dev/null
@@ -0,0 +1,28 @@
+error[E0621]: explicit lifetime required in the type of `ss`
+  --> $DIR/object-lifetime-default-from-box-error.rs:18:5
+   |
+LL | fn load(ss: &mut SomeStruct) -> Box<SomeTrait> {
+   |             --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>`
+...
+LL |     ss.r
+   |     ^^^^ lifetime `'static` required
+
+error[E0507]: cannot move out of borrowed content
+  --> $DIR/object-lifetime-default-from-box-error.rs:18:5
+   |
+LL |     ss.r
+   |     ^^^^ cannot move out of borrowed content
+
+error[E0621]: explicit lifetime required in the type of `ss`
+  --> $DIR/object-lifetime-default-from-box-error.rs:31:5
+   |
+LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<SomeTrait+'b>) {
+   |                   --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>`
+...
+LL |     ss.r = b;
+   |     ^^^^ lifetime `'b` required
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0507, E0621.
+For more information about an error, try `rustc --explain E0507`.
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr
new file mode 100644 (file)
index 0000000..6d183dd
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/object-lifetime-default-from-rptr-box-error.rs:15:5
+   |
+LL | fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) {
+   |      -- lifetime `'a` defined here
+LL |     ss.t = t;
+   |     ^^^^^^^^ assignment requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr
new file mode 100644 (file)
index 0000000..fe3b21f
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:21:5
+   |
+LL | fn c<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) {
+   |      -- lifetime `'a` defined here
+LL |     ss.t = t;
+   |     ^^^^^^^^ assignment requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr
new file mode 100644 (file)
index 0000000..448fe9e
--- /dev/null
@@ -0,0 +1,21 @@
+error: lifetime may not live long enough
+  --> $DIR/object-lifetime-default-mybox.rs:27:5
+   |
+LL | fn load1<'a,'b>(a: &'a MyBox<SomeTrait>,
+   |          -- -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+...
+LL |     a
+   |     ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/object-lifetime-default-mybox.rs:31:5
+   |
+LL | fn load2<'a>(ss: &MyBox<SomeTrait+'a>) -> MyBox<SomeTrait+'a> {
+   |              -- `ss` is a reference that is only valid in the function body
+LL |     load0(ss)
+   |     ^^^^^^^^^ `ss` escapes the function body here
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/pattern/pattern-bindings-after-at.nll.stderr b/src/test/ui/pattern/pattern-bindings-after-at.nll.stderr
new file mode 100644 (file)
index 0000000..35ee787
--- /dev/null
@@ -0,0 +1,22 @@
+error[E0303]: pattern bindings are not allowed after an `@`
+  --> $DIR/pattern-bindings-after-at.rs:8:31
+   |
+LL |         ref mut z @ &mut Some(ref a) => {
+   |                               ^^^^^ not allowed after `@`
+
+error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
+  --> $DIR/pattern-bindings-after-at.rs:8:31
+   |
+LL |         ref mut z @ &mut Some(ref a) => {
+   |         ----------------------^^^^^-
+   |         |                     |
+   |         |                     immutable borrow occurs here
+   |         mutable borrow occurs here
+...
+LL |             **z = None;
+   |             ---------- mutable borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0303, E0502.
+For more information about an error, try `rustc --explain E0303`.
diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.nll.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.nll.stderr
new file mode 100644 (file)
index 0000000..eee331d
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0005]: refutable pattern in local binding: `Err(_)` not covered
+  --> $DIR/recursive-types-are-not-uninhabited.rs:6:9
+   |
+LL |     let Ok(x) = res;
+   |         ^^^^^ pattern `Err(_)` not covered
+
+error[E0381]: use of possibly uninitialized variable: `x`
+  --> $DIR/recursive-types-are-not-uninhabited.rs:8:5
+   |
+LL |     x
+   |     ^ use of possibly uninitialized `x`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0005, E0381.
+For more information about an error, try `rustc --explain E0005`.
diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr
new file mode 100644 (file)
index 0000000..76129b4
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/region-invariant-static-error-reporting.rs:15:9
+   |
+LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
+   |              - `x` is a reference that is only valid in the function body
+LL |     let bad = if x.is_some() {
+LL |         x.unwrap()
+   |         ^^^^^^^^^^ `x` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr
new file mode 100644 (file)
index 0000000..24c9a31
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43
+   |
+LL |     let _: fn(&mut &isize, &mut &isize) = a;
+   |                                           ^ expected concrete lifetime, found bound lifetime parameter
+   |
+   = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
+              found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr
new file mode 100644 (file)
index 0000000..6d031e9
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56
+   |
+LL |     let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
+   |                                                        ^ expected concrete lifetime, found bound lifetime parameter
+   |
+   = note: expected type `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)`
+              found type `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize) {a::<'_, '_, '_>}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/region-object-lifetime-2.nll.stderr b/src/test/ui/regions/region-object-lifetime-2.nll.stderr
new file mode 100644 (file)
index 0000000..56e8c40
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/region-object-lifetime-2.rs:10:5
+   |
+LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () {
+   |                                          -- -- lifetime `'b` defined here
+   |                                          |
+   |                                          lifetime `'a` defined here
+LL |     x.borrowed()
+   |     ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/region-object-lifetime-4.nll.stderr b/src/test/ui/regions/region-object-lifetime-4.nll.stderr
new file mode 100644 (file)
index 0000000..aa91c37
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/region-object-lifetime-4.rs:12:5
+   |
+LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () {
+   |                                         -- -- lifetime `'b` defined here
+   |                                         |
+   |                                         lifetime `'a` defined here
+LL |     x.borrowed()
+   |     ^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr
new file mode 100644 (file)
index 0000000..a54f8f5
--- /dev/null
@@ -0,0 +1,38 @@
+error[E0621]: explicit lifetime required in the type of `v`
+  --> $DIR/region-object-lifetime-in-coercion.rs:8:12
+   |
+LL | fn a(v: &[u8]) -> Box<Foo + 'static> {
+   |         ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+LL |     let x: Box<Foo + 'static> = Box::new(v);
+   |            ^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+  --> $DIR/region-object-lifetime-in-coercion.rs:14:5
+   |
+LL | fn b(v: &[u8]) -> Box<Foo + 'static> {
+   |         ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+  --> $DIR/region-object-lifetime-in-coercion.rs:21:5
+   |
+LL | fn c(v: &[u8]) -> Box<Foo> {
+   |         ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+...
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^ lifetime `'static` required
+
+error: lifetime may not live long enough
+  --> $DIR/region-object-lifetime-in-coercion.rs:26:5
+   |
+LL | fn d<'a,'b>(v: &'a [u8]) -> Box<Foo+'b> {
+   |      -- -- lifetime `'b` defined here
+   |      |
+   |      lifetime `'a` defined here
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/regions/regions-addr-of-self.nll.stderr b/src/test/ui/regions/regions-addr-of-self.nll.stderr
new file mode 100644 (file)
index 0000000..3d7aac7
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-addr-of-self.rs:7:16
+   |
+LL |     pub fn chase_cat(&mut self) {
+   |                      - let's call the lifetime of this reference `'1`
+LL |         let p: &'static mut usize = &mut self.cats_chased;
+   |                ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr
new file mode 100644 (file)
index 0000000..345e617
--- /dev/null
@@ -0,0 +1,35 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-addr-of-upvar-self.rs:10:20
+   |
+LL |         let _f = || {
+   |                  -- lifetime `'1` represents this closure's body
+LL |             let p: &'static mut usize = &mut self.food;
+   |                    ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`
+   |
+   = note: closure implements `FnMut`, so references to captured variables can't escape the closure
+
+error: lifetime may not live long enough
+  --> $DIR/regions-addr-of-upvar-self.rs:10:20
+   |
+LL |     pub fn chase_cat(&mut self) {
+   |                      - let's call the lifetime of this reference `'1`
+LL |         let _f = || {
+LL |             let p: &'static mut usize = &mut self.food;
+   |                    ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`
+
+error[E0597]: `self` does not live long enough
+  --> $DIR/regions-addr-of-upvar-self.rs:10:46
+   |
+LL |         let _f = || {
+   |                  -- value captured here
+LL |             let p: &'static mut usize = &mut self.food;
+   |                    ------------------        ^^^^ borrowed value does not live long enough
+   |                    |
+   |                    type annotation requires that `self` is borrowed for `'static`
+...
+LL |     }
+   |      - `self` dropped here while still borrowed
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..867eafe
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:43:12
+   |
+LL | fn with_assoc<'a,'b>() {
+   |               -- -- lifetime `'b` defined here
+   |               |
+   |               lifetime `'a` defined here
+...
+LL |     let _: &'a WithAssoc<TheType<'b>> = loop { };
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr
new file mode 100644 (file)
index 0000000..86bd100
--- /dev/null
@@ -0,0 +1,50 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:22:5
+   |
+LL | fn param_not_ok<'a>(x: &'a isize) {
+   |                 -- lifetime `'a` defined here
+LL |     assert_send::<&'a isize>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5
+   |
+LL | fn param_not_ok1<'a>(_: &'a isize) {
+   |                  -- lifetime `'a` defined here
+LL |     assert_send::<&'a str>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5
+   |
+LL | fn param_not_ok2<'a>(_: &'a isize) {
+   |                  -- lifetime `'a` defined here
+LL |     assert_send::<&'a [isize]>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5
+   |
+LL | fn box_with_region_not_ok<'a>() {
+   |                           -- lifetime `'a` defined here
+LL |     assert_send::<Box<&'a isize>>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5
+   |
+LL | fn unsafe_ok2<'a>(_: &'a isize) {
+   |               -- lifetime `'a` defined here
+LL |     assert_send::<*const &'a isize>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5
+   |
+LL | fn unsafe_ok3<'a>(_: &'a isize) {
+   |               -- lifetime `'a` defined here
+LL |     assert_send::<*mut &'a isize>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr
new file mode 100644 (file)
index 0000000..a8ab92d
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:20:5
+   |
+LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) {
+   |                       --  -- lifetime `'y` defined here
+   |                       |
+   |                       lifetime `'x` defined here
+LL |     // Here the value provided for 'y is 'y, and hence 'y:'x does not hold.
+LL |     a.bigger_region(b)
+   |     ^^^^^^^^^^^^^^^^^^ argument requires that `'y` must outlive `'x`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr
new file mode 100644 (file)
index 0000000..52ad2d9
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:20:5
+   |
+LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) {
+   |                             -           - `b` is a reference that is only valid in the function body
+   |                             |
+   |                             `a` is declared here, outside of the function body
+LL |     // Here the value provided for 'y is 'b, and hence 'b:'a does not hold.
+LL |     f.method(b);
+   |     ^^^^^^^^^^^ `b` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr
new file mode 100644 (file)
index 0000000..b6d7b8a
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-bounded-method-type-parameters.rs:12:9
+   |
+LL | fn caller<'a>(x: &isize) {
+   |           -- lifetime `'a` defined here
+LL |     Foo.some_method::<&'a isize>();
+   |         ^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-bounds.nll.stderr b/src/test/ui/regions/regions-bounds.nll.stderr
new file mode 100644 (file)
index 0000000..3345946
--- /dev/null
@@ -0,0 +1,22 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-bounds.rs:9:12
+   |
+LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> {
+   |          -- -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+LL |     return e;
+   |            ^ returning this value requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-bounds.rs:13:12
+   |
+LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> {
+   |          -- -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+LL |     return e;
+   |            ^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr
new file mode 100644 (file)
index 0000000..92c4956
--- /dev/null
@@ -0,0 +1,36 @@
+error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
+  --> $DIR/regions-close-associated-type-into-object.rs:15:5
+   |
+LL |     Box::new(item)
+   |     ^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
+
+error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
+  --> $DIR/regions-close-associated-type-into-object.rs:22:5
+   |
+LL |     Box::new(item)
+   |     ^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
+
+error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
+  --> $DIR/regions-close-associated-type-into-object.rs:28:5
+   |
+LL |     Box::new(item)
+   |     ^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
+
+error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
+  --> $DIR/regions-close-associated-type-into-object.rs:35:5
+   |
+LL |     Box::new(item)
+   |     ^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr
new file mode 100644 (file)
index 0000000..42df9b1
--- /dev/null
@@ -0,0 +1,20 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-close-object-into-object-2.rs:10:5
+   |
+LL | fn g<'a, T: 'static>(v: Box<A<T>+'a>) -> Box<X+'static> {
+   |      -- lifetime `'a` defined here
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error[E0515]: cannot return value referencing local data `*v`
+  --> $DIR/regions-close-object-into-object-2.rs:10:5
+   |
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^---^^^^^^^^^^^
+   |     |     |
+   |     |     `*v` is borrowed here
+   |     returns a value referencing data owned by the current function
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr
new file mode 100644 (file)
index 0000000..8af94fa
--- /dev/null
@@ -0,0 +1,37 @@
+error[E0310]: the parameter type `U` may not live long enough
+  --> $DIR/regions-close-object-into-object-4.rs:10:5
+   |
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `U: 'static`...
+
+error: lifetime may not live long enough
+  --> $DIR/regions-close-object-into-object-4.rs:10:5
+   |
+LL | fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> {
+   |      -- lifetime `'a` defined here
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error[E0515]: cannot return value referencing local data `*v`
+  --> $DIR/regions-close-object-into-object-4.rs:10:5
+   |
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^---^^^^^^^^^^^
+   |     |     |
+   |     |     `*v` is borrowed here
+   |     returns a value referencing data owned by the current function
+
+error[E0310]: the parameter type `U` may not live long enough
+  --> $DIR/regions-close-object-into-object-4.rs:10:9
+   |
+LL |     box B(&*v) as Box<X>
+   |         ^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `U: 'static`...
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0310, E0515.
+For more information about an error, try `rustc --explain E0310`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr
new file mode 100644 (file)
index 0000000..08ba1b1
--- /dev/null
@@ -0,0 +1,29 @@
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-object-into-object-5.rs:17:5
+   |
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error[E0515]: cannot return value referencing local data `*v`
+  --> $DIR/regions-close-object-into-object-5.rs:17:5
+   |
+LL |     box B(&*v) as Box<X>
+   |     ^^^^^^---^^^^^^^^^^^
+   |     |     |
+   |     |     `*v` is borrowed here
+   |     returns a value referencing data owned by the current function
+
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-object-into-object-5.rs:17:9
+   |
+LL |     box B(&*v) as Box<X>
+   |         ^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0310, E0515.
+For more information about an error, try `rustc --explain E0310`.
diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr
new file mode 100644 (file)
index 0000000..30fdb82
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0310]: the parameter type `A` may not live long enough
+  --> $DIR/regions-close-over-type-parameter-1.rs:10:5
+   |
+LL |     box v as Box<SomeTrait+'static>
+   |     ^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `A: 'static`...
+
+error[E0309]: the parameter type `A` may not live long enough
+  --> $DIR/regions-close-over-type-parameter-1.rs:20:5
+   |
+LL |     box v as Box<SomeTrait+'b>
+   |     ^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `A: 'b`...
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr
new file mode 100644 (file)
index 0000000..001ed7f
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5
+   |
+LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<SomeTrait+'c> {
+   |                    --    -- lifetime `'c` defined here
+   |                    |
+   |                    lifetime `'a` defined here
+LL |     // A outlives 'a AND 'b...but not 'c.
+LL |     box v as Box<SomeTrait+'a>
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'c`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-close-param-into-object.nll.stderr b/src/test/ui/regions/regions-close-param-into-object.nll.stderr
new file mode 100644 (file)
index 0000000..7bd7824
--- /dev/null
@@ -0,0 +1,36 @@
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-param-into-object.rs:6:5
+   |
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-param-into-object.rs:12:5
+   |
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error[E0309]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-param-into-object.rs:18:5
+   |
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'a`...
+
+error[E0309]: the parameter type `T` may not live long enough
+  --> $DIR/regions-close-param-into-object.rs:24:5
+   |
+LL |     Box::new(v)
+   |     ^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'a`...
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-creating-enums3.nll.stderr b/src/test/ui/regions/regions-creating-enums3.nll.stderr
new file mode 100644 (file)
index 0000000..e35a878
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-creating-enums3.rs:7:5
+   |
+LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> {
+   |                -- -- lifetime `'b` defined here
+   |                |
+   |                lifetime `'a` defined here
+LL |     Ast::Add(x, y)
+   |     ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-creating-enums4.nll.stderr b/src/test/ui/regions/regions-creating-enums4.nll.stderr
new file mode 100644 (file)
index 0000000..4eac457
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-creating-enums4.rs:7:5
+   |
+LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> {
+   |                -- -- lifetime `'b` defined here
+   |                |
+   |                lifetime `'a` defined here
+LL |     Ast::Add(x, y)
+   |     ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr
new file mode 100644 (file)
index 0000000..1540a7b
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-early-bound-error-method.rs:20:9
+   |
+LL | impl<'a> Box<'a> {
+   |      -- lifetime `'a` defined here
+LL |     fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize {
+   |           -- lifetime `'b` defined here
+LL |         g2.get()
+   |         ^^^^^^^^ returning this value requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-early-bound-error.nll.stderr b/src/test/ui/regions/regions-early-bound-error.nll.stderr
new file mode 100644 (file)
index 0000000..7836291
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-early-bound-error.rs:19:5
+   |
+LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize {
+   |        -- -- lifetime `'b` defined here
+   |        |
+   |        lifetime `'a` defined here
+LL |     g1.get()
+   |     ^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-escape-method.nll.stderr b/src/test/ui/regions/regions-escape-method.nll.stderr
new file mode 100644 (file)
index 0000000..9f42512
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-escape-method.rs:15:13
+   |
+LL |     s.f(|p| p)
+   |          -- ^ returning this value requires that `'1` must outlive `'2`
+   |          ||
+   |          |return type of closure is &'2 i32
+   |          has type `&'1 i32`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr b/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr
new file mode 100644 (file)
index 0000000..cae6c33
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-escape-via-trait-or-not.rs:18:14
+   |
+LL |     with(|o| o)
+   |           -- ^ returning this value requires that `'1` must outlive `'2`
+   |           ||
+   |           |return type of closure is &'2 isize
+   |           has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr
new file mode 100644 (file)
index 0000000..9ae484e
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-callee.rs:13:5
+   |
+LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize {
+   |              --  -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+LL |     // However, it is not safe to assume that 'b <= 'a
+LL |     &*y
+   |     ^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-callee.rs:18:12
+   |
+LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize {
+   |              --  -- lifetime `'b` defined here
+   |              |
+   |              lifetime `'a` defined here
+LL |     // Do not infer an ordering from the return value.
+LL |     let z: &'b usize = &*x;
+   |            ^^^^^^^^^ type annotation requires that `'a` must outlive `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..16eda28
--- /dev/null
@@ -0,0 +1,33 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-caller.rs:11:12
+   |
+LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
+   |          --  -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+LL |     let z: Option<&'b &'a usize> = None;
+   |            ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-caller.rs:17:12
+   |
+LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
+   |          --  -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+LL |     let y: Paramd<'a> = Paramd { x: a };
+LL |     let z: Option<&'b Paramd<'a>> = None;
+   |            ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-caller.rs:22:12
+   |
+LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
+   |          --  -- lifetime `'b` defined here
+   |          |
+   |          lifetime `'a` defined here
+LL |     let z: Option<&'a &'b usize> = None;
+   |            ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr
new file mode 100644 (file)
index 0000000..480a81d
--- /dev/null
@@ -0,0 +1,15 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-free-region-ordering-incorrect.rs:15:9
+   |
+LL |   impl<'b, T> Node<'b, T> {
+   |        -- lifetime `'b` defined here
+LL |       fn get<'a>(&'a self) -> &'b T {
+   |              -- lifetime `'a` defined here
+LL | /         match self.next {
+LL | |             Some(ref next) => next.get(),
+LL | |             None => &self.val
+LL | |         }
+   | |_________^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr
new file mode 100644 (file)
index 0000000..0f0f86d
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0309]: the parameter type `T` may not live long enough
+  --> $DIR/regions-implied-bounds-projection-gap-1.rs:16:5
+   |
+LL |     wf::<&'x T>();
+   |     ^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `T: 'x`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr
new file mode 100644 (file)
index 0000000..0651e30
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0309]: the parameter type `Self` may not live long enough
+  --> $DIR/regions-infer-bound-from-trait-self.rs:46:9
+   |
+LL |         check_bound(x, self)
+   |         ^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `Self: 'a`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr
new file mode 100644 (file)
index 0000000..1f7b34f
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0309]: the parameter type `A` may not live long enough
+  --> $DIR/regions-infer-bound-from-trait.rs:33:5
+   |
+LL |     check_bound(x, a)
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `A: 'a`...
+
+error[E0309]: the parameter type `A` may not live long enough
+  --> $DIR/regions-infer-bound-from-trait.rs:37:5
+   |
+LL |     check_bound(x, a)
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `A: 'a`...
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-infer-call-3.nll.stderr b/src/test/ui/regions/regions-infer-call-3.nll.stderr
new file mode 100644 (file)
index 0000000..ca51555
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-call-3.rs:8:24
+   |
+LL |     let z = with(|y| { select(x, y) });
+   |                   --   ^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
+   |                   ||
+   |                   |return type of closure is &'2 isize
+   |                   has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr
new file mode 100644 (file)
index 0000000..cefeecf
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-contravariance-due-to-decl.rs:25:12
+   |
+LL | fn use_<'short,'long>(c: Contravariant<'short>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Contravariant<'long> = c;
+   |            ^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr
new file mode 100644 (file)
index 0000000..1bddecb
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-covariance-due-to-decl.rs:22:12
+   |
+LL | fn use_<'short,'long>(c: Covariant<'long>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Covariant<'short> = c;
+   |            ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr
new file mode 100644 (file)
index 0000000..0c1e398
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-invariance-due-to-decl.rs:12:5
+   |
+LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
+   |                       -- lifetime `'r` defined here
+LL |     b_isize
+   |     ^^^^^^^ returning this value requires that `'r` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr
new file mode 100644 (file)
index 0000000..0edeb27
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:10:5
+   |
+LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
+   |                       -- lifetime `'r` defined here
+LL |     b_isize
+   |     ^^^^^^^ returning this value requires that `'r` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr
new file mode 100644 (file)
index 0000000..724dd7e
--- /dev/null
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5
+   |
+LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
+   |                       -- lifetime `'r` defined here
+LL |     b_isize
+   |     ^^^^^^^ returning this value requires that `'r` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-infer-not-param.nll.stderr b/src/test/ui/regions/regions-infer-not-param.nll.stderr
new file mode 100644 (file)
index 0000000..2064b06
--- /dev/null
@@ -0,0 +1,26 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-not-param.rs:15:54
+   |
+LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p }
+   |                -- -- lifetime `'b` defined here      ^ returning this value requires that `'a` must outlive `'b`
+   |                |
+   |                lifetime `'a` defined here
+
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-not-param.rs:19:63
+   |
+LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p }
+   |                   -- -- lifetime `'b` defined here            ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+   |                   |
+   |                   lifetime `'a` defined here
+
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-not-param.rs:19:63
+   |
+LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p }
+   |                   -- -- lifetime `'b` defined here            ^ returning this value requires that `'a` must outlive `'b`
+   |                   |
+   |                   lifetime `'a` defined here
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr
new file mode 100644 (file)
index 0000000..a86e6cc
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-infer-paramd-indirect.rs:22:9
+   |
+LL | impl<'a> SetF<'a> for C<'a> {
+   |      -- lifetime `'a` defined here
+...
+LL |     fn set_f_bad(&mut self, b: Box<B>) {
+   |                             - has type `std::boxed::Box<std::boxed::Box<&'1 isize>>`
+LL |         self.f = b;
+   |         ^^^^^^ assignment requires that `'1` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr
new file mode 100644 (file)
index 0000000..e1f14fc
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/regions-lifetime-bounds-on-fns.rs:20:43
+   |
+LL |     let _: fn(&mut &isize, &mut &isize) = a;
+   |                                           ^ expected concrete lifetime, found bound lifetime parameter
+   |
+   = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
+              found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr
new file mode 100644 (file)
index 0000000..c11c09b
--- /dev/null
@@ -0,0 +1,51 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/regions-nested-fns.rs:10:9
+   |
+LL |     let mut ay = &y;
+   |         ------ `ay` is declared here, outside of the closure body
+LL | 
+LL |     ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
+   |                                                       - `z` is a reference that is only valid in the closure body
+...
+LL |         ay = z;
+   |         ^^^^^^ `z` escapes the closure body here
+
+error[E0597]: `y` does not live long enough
+  --> $DIR/regions-nested-fns.rs:5:18
+   |
+LL |     let mut ay = &y;
+   |                  ^^ borrowed value does not live long enough
+...
+LL |         if false { return ay; }
+   |                           -- returning this value requires that `y` is borrowed for `'static`
+...
+LL | }
+   | - `y` dropped here while still borrowed
+
+error[E0597]: `y` does not live long enough
+  --> $DIR/regions-nested-fns.rs:9:15
+   |
+LL |     ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
+   |                                                      --- value captured here
+LL |         ay = x;
+LL |         ay = &y;
+   |               ^ borrowed value does not live long enough
+...
+LL |         if false { return ay; }
+   |                           -- returning this value requires that `y` is borrowed for `'static`
+...
+LL | }
+   | - `y` dropped here while still borrowed
+
+error: lifetime may not live long enough
+  --> $DIR/regions-nested-fns.rs:14:27
+   |
+LL | fn nested<'x>(x: &'x isize) {
+   |           -- lifetime `'x` defined here
+...
+LL |         if false { return x; }
+   |                           ^ returning this value requires that `'x` must outlive `'static`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..5028663
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container-hrtb.rs:35:12
+   |
+LL | fn with_assoc<'a,'b>() {
+   |               -- -- lifetime `'b` defined here
+   |               |
+   |               lifetime `'a` defined here
+...
+LL |     let _: &'a WithHrAssoc<TheType<'b>> = loop { };
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container-hrtb.rs:57:12
+   |
+LL | fn with_assoc_sub<'a,'b>() {
+   |                   -- -- lifetime `'b` defined here
+   |                   |
+   |                   lifetime `'a` defined here
+...
+LL |     let _: &'a WithHrAssocSub<TheType<'b>> = loop { };
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..880fe17
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container-wc.rs:37:12
+   |
+LL | fn with_assoc<'a,'b>() {
+   |               -- -- lifetime `'b` defined here
+   |               |
+   |               lifetime `'a` defined here
+...
+LL |     let _: &'a WithAssoc<TheType<'b>> = loop { };
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-outlives-projection-container.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container.nll.stderr
new file mode 100644 (file)
index 0000000..ef87d02
--- /dev/null
@@ -0,0 +1,46 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container.rs:40:13
+   |
+LL | fn with_assoc<'a,'b>() {
+   |               -- -- lifetime `'b` defined here
+   |               |
+   |               lifetime `'a` defined here
+...
+LL |     let _x: &'a WithAssoc<TheType<'b>> = loop { };
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container.rs:58:13
+   |
+LL | fn without_assoc<'a,'b>() {
+   |                  -- -- lifetime `'b` defined here
+   |                  |
+   |                  lifetime `'a` defined here
+...
+LL |     let _x: &'a WithoutAssoc<TheType<'b>> = loop { };
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container.rs:67:5
+   |
+LL | fn call_with_assoc<'a,'b>() {
+   |                    -- -- lifetime `'b` defined here
+   |                    |
+   |                    lifetime `'a` defined here
+...
+LL |     call::<&'a WithAssoc<TheType<'b>>>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-outlives-projection-container.rs:74:5
+   |
+LL | fn call_without_assoc<'a,'b>() {
+   |                       -- -- lifetime `'b` defined here
+   |                       |
+   |                       lifetime `'a` defined here
+...
+LL |     call::<&'a WithoutAssoc<TheType<'b>>>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr
new file mode 100644 (file)
index 0000000..c8582f8
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:4:5
+   |
+LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize {
+   |                      --  -- lifetime `'b` defined here
+   |                      |
+   |                      lifetime `'a` defined here
+LL |     &mut ***p
+   |     ^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr
new file mode 100644 (file)
index 0000000..5946e7b
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:6:5
+   |
+LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize {
+   |                      --  -- lifetime `'b` defined here
+   |                      |
+   |                      lifetime `'a` defined here
+LL |     &mut **p
+   |     ^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr b/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr
new file mode 100644 (file)
index 0000000..0784e89
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-ret-borrowed-1.rs:10:14
+   |
+LL |     with(|o| o)
+   |           -- ^ returning this value requires that `'1` must outlive `'2`
+   |           ||
+   |           |return type of closure is &'2 isize
+   |           has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-ret-borrowed.nll.stderr b/src/test/ui/regions/regions-ret-borrowed.nll.stderr
new file mode 100644 (file)
index 0000000..d9be5ef
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-ret-borrowed.rs:13:14
+   |
+LL |     with(|o| o)
+   |           -- ^ returning this value requires that `'1` must outlive `'2`
+   |           ||
+   |           |return type of closure is &'2 isize
+   |           has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr
new file mode 100644 (file)
index 0000000..4c275b1
--- /dev/null
@@ -0,0 +1,13 @@
+error: captured variable cannot escape `FnMut` closure body
+  --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24
+   |
+LL |         let mut f = || &mut x;
+   |                      - ^^^^^^ returns a reference to a captured variable which escapes the closure body
+   |                      |
+   |                      inferred to be a `FnMut` closure
+   |
+   = note: `FnMut` closures only have access to their captured variables while they are executing...
+   = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-static-bound.ll.nll.stderr b/src/test/ui/regions/regions-static-bound.ll.nll.stderr
new file mode 100644 (file)
index 0000000..d6cec03
--- /dev/null
@@ -0,0 +1,28 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-static-bound.rs:9:5
+   |
+LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
+   |                        -- lifetime `'a` defined here
+LL |     t //[ll]~ ERROR E0312
+   |     ^ returning this value requires that `'a` must outlive `'static`
+
+error[E0621]: explicit lifetime required in the type of `u`
+  --> $DIR/regions-static-bound.rs:14:5
+   |
+LL | fn error(u: &(), v: &()) {
+   |             --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
+LL |     static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
+   |     ^^^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+  --> $DIR/regions-static-bound.rs:16:5
+   |
+LL | fn error(u: &(), v: &()) {
+   |                     --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
+...
+LL |     static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
+   |     ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/regions/regions-static-bound.migrate.nll.stderr b/src/test/ui/regions/regions-static-bound.migrate.nll.stderr
new file mode 100644 (file)
index 0000000..b5f3e6c
--- /dev/null
@@ -0,0 +1,28 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-static-bound.rs:9:5
+   |
+LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
+   |                        -- lifetime `'a` defined here
+LL |     t
+   |     ^ returning this value requires that `'a` must outlive `'static`
+
+error[E0621]: explicit lifetime required in the type of `u`
+  --> $DIR/regions-static-bound.rs:14:5
+   |
+LL | fn error(u: &(), v: &()) {
+   |             --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
+LL |     static_id(&u);
+   |     ^^^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+  --> $DIR/regions-static-bound.rs:16:5
+   |
+LL | fn error(u: &(), v: &()) {
+   |                     --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
+...
+LL |     static_id_indirect(&v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr
new file mode 100644 (file)
index 0000000..eccf1b5
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-trait-object-subtyping.rs:15:5
+   |
+LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
+   |         -- -- lifetime `'b` defined here
+   |         |
+   |         lifetime `'a` defined here
+LL |     // Without knowing 'a:'b, we can't coerce
+LL |     x
+   |     ^ returning this value requires that `'a` must outlive `'b`
+
+error: lifetime may not live long enough
+  --> $DIR/regions-trait-object-subtyping.rs:22:5
+   |
+LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> {
+   |         --    -- lifetime `'b` defined here
+   |         |
+   |         lifetime `'a` defined here
+LL |     // We can't coerce because it is packed in `Wrapper`
+LL |     x
+   |     ^ returning this value requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr
new file mode 100644 (file)
index 0000000..f5b96f3
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:25:12
+   |
+LL | fn use_<'short,'long>(c: S<'long, 'short>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: S<'long, 'long> = c;
+   |            ^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr
new file mode 100644 (file)
index 0000000..372510a
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-variance-contravariant-use-covariant.rs:23:12
+   |
+LL | fn use_<'short,'long>(c: Contravariant<'short>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Contravariant<'long> = c;
+   |            ^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr
new file mode 100644 (file)
index 0000000..e87e914
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-variance-covariant-use-contravariant.rs:23:12
+   |
+LL | fn use_<'short,'long>(c: Covariant<'long>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Covariant<'short> = c;
+   |            ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr
new file mode 100644 (file)
index 0000000..adee33b
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-variance-invariant-use-contravariant.rs:20:12
+   |
+LL | fn use_<'short,'long>(c: Invariant<'long>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Invariant<'short> = c;
+   |            ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr
new file mode 100644 (file)
index 0000000..15853e6
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/regions-variance-invariant-use-covariant.rs:17:12
+   |
+LL | fn use_<'b>(c: Invariant<'b>) {
+   |         -- lifetime `'b` defined here
+...
+LL |     let _: Invariant<'static> = c;
+   |            ^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr
new file mode 100644 (file)
index 0000000..c74b82d
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-issue-49631.rs:20:9
+   |
+LL |     while let Some(Ok(string)) = foo.get() {
+   |                                  --- immutable borrow occurs here
+LL |         foo.mutate();
+   |         ^^^ mutable borrow occurs here
+LL |
+LL |         println!("foo={:?}", *string);
+   |                              ------- immutable borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr b/src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr
new file mode 100644 (file)
index 0000000..f4eb981
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0310]: the parameter type `impl Debug` may not live long enough
+  --> $DIR/suggest-impl-trait-lifetime.rs:7:5
+   |
+LL |     bar(d);
+   |     ^^^^^^
+   |
+   = help: consider adding an explicit lifetime bound `impl Debug: 'static`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/src/test/ui/thread-local-in-ctfe.nll.stderr b/src/test/ui/thread-local-in-ctfe.nll.stderr
new file mode 100644 (file)
index 0000000..18d01b1
--- /dev/null
@@ -0,0 +1,49 @@
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:6:17
+   |
+LL | static B: u32 = A;
+   |                 ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:9:18
+   |
+LL | static C: &u32 = &A;
+   |                  ^^
+
+error[E0712]: thread-local variable borrowed past end of function
+  --> $DIR/thread-local-in-ctfe.rs:9:18
+   |
+LL | static C: &u32 = &A;
+   |                  ^^- end of enclosing function is here
+   |                  |
+   |                  thread-local variables cannot be borrowed beyond the end of the function
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:15:16
+   |
+LL | const D: u32 = A;
+   |                ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:18:17
+   |
+LL | const E: &u32 = &A;
+   |                 ^^
+
+error[E0712]: thread-local variable borrowed past end of function
+  --> $DIR/thread-local-in-ctfe.rs:18:17
+   |
+LL | const E: &u32 = &A;
+   |                 ^^- end of enclosing function is here
+   |                 |
+   |                 thread-local variables cannot be borrowed beyond the end of the function
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:25:5
+   |
+LL |     A
+   |     ^
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr
new file mode 100644 (file)
index 0000000..ead42c1
--- /dev/null
@@ -0,0 +1,12 @@
+error: lifetime may not live long enough
+  --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:9
+   |
+LL |     doit(0, &|x, y| {
+   |               -  - has type `&'1 i32`
+   |               |
+   |               has type `&std::cell::Cell<&'2 i32>`
+LL |         x.set(y);
+   |         ^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr
new file mode 100644 (file)
index 0000000..8ed48bd
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/dyn-trait-underscore.rs:8:5
+   |
+LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
+   |                - let's call the lifetime of this reference `'1`
+LL |     //                      ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
+LL |     Box::new(items.iter())
+   |     ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr
new file mode 100644 (file)
index 0000000..e1d57b8
--- /dev/null
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/underscore-lifetime-elison-mismatch.rs:1:42
+   |
+LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
+   |                    -           -         ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+   |                    |           |
+   |                    |           let's call the lifetime of this reference `'1`
+   |                    let's call the lifetime of this reference `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr
new file mode 100644 (file)
index 0000000..344437f
--- /dev/null
@@ -0,0 +1,106 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:4:5
+   |
+LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
+   |                     ---- lifetime `'new` defined here
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:7:5
+   |
+LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
+   |                     ---- lifetime `'new` defined here
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:10:5
+   |
+LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
+   |                        ---- lifetime `'new` defined here
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:13:5
+   |
+LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
+   |                        ---- lifetime `'new` defined here
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:18:5
+   |
+LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
+   |                    ---- lifetime `'new` defined here
+LL |                          -> OccupiedEntry<'a, &'new (), ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:22:5
+   |
+LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
+   |                    ---- lifetime `'new` defined here
+LL |                          -> OccupiedEntry<'a, (), &'new ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:26:5
+   |
+LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
+   |                       ---- lifetime `'new` defined here
+LL |                             -> OccupiedEntry<'a, &'static (), ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:30:5
+   |
+LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
+   |                       ---- lifetime `'new` defined here
+LL |                             -> OccupiedEntry<'a, (), &'static ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:35:5
+   |
+LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
+   |                    ---- lifetime `'new` defined here
+LL |                          -> VacantEntry<'a, &'new (), ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:39:5
+   |
+LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
+   |                    ---- lifetime `'new` defined here
+LL |                          -> VacantEntry<'a, (), &'new ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:43:5
+   |
+LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
+   |                       ---- lifetime `'new` defined here
+LL |                             -> VacantEntry<'a, &'static (), ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-btree-invariant-types.rs:47:5
+   |
+LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
+   |                       ---- lifetime `'new` defined here
+LL |                             -> VacantEntry<'a, (), &'static ()> {
+LL |     v
+   |     ^ returning this value requires that `'new` must outlive `'static`
+
+error: aborting due to 12 previous errors
+
diff --git a/src/test/ui/variance/variance-cell-is-invariant.nll.stderr b/src/test/ui/variance/variance-cell-is-invariant.nll.stderr
new file mode 100644 (file)
index 0000000..a3ae532
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-cell-is-invariant.rs:14:12
+   |
+LL | fn use_<'short,'long>(c: Foo<'short>,
+   |         ------ ----- lifetime `'long` defined here
+   |         |
+   |         lifetime `'short` defined here
+...
+LL |     let _: Foo<'long> = c;
+   |            ^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr
new file mode 100644 (file)
index 0000000..8b5ecbe
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-arg-object.rs:14:5
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-arg-object.rs:22:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..dbd75cb
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-arg-trait-match.rs:13:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'min i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-arg-trait-match.rs:21:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'max i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..9212cf2
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-self-trait-match.rs:13:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'min G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-contravariant-self-trait-match.rs:22:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'max G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr
new file mode 100644 (file)
index 0000000..acf9f2e
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-arg-object.rs:15:5
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-arg-object.rs:22:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..3358912
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-arg-trait-match.rs:14:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'min i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-arg-trait-match.rs:20:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'max i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..6b2413d
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-self-trait-match.rs:14:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'min G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-covariant-self-trait-match.rs:20:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'max G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr
new file mode 100644 (file)
index 0000000..3c1ee7f
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-arg-object.rs:11:5
+   |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-arg-object.rs:18:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..2ab44c5
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-arg-trait-match.rs:10:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'min i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-arg-trait-match.rs:16:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<G,&'max i32>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr
new file mode 100644 (file)
index 0000000..7b7c42f
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-self-trait-match.rs:10:5
+   |
+LL | fn get_min_from_max<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'min G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-invariant-self-trait-match.rs:16:5
+   |
+LL | fn get_max_from_min<'min, 'max, G>()
+   |                     ----  ---- lifetime `'max` defined here
+   |                     |
+   |                     lifetime `'min` defined here
+...
+LL |     impls_get::<&'max G>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/variance/variance-trait-matching.nll.stderr b/src/test/ui/variance/variance-trait-matching.nll.stderr
new file mode 100644 (file)
index 0000000..3308cc6
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0621]: explicit lifetime required in the type of `get`
+  --> $DIR/variance-trait-matching.rs:24:5
+   |
+LL | fn get<'a, G>(get: &G) -> i32
+   |                    -- help: add explicit lifetime `'a` to the type of `get`: `&'a G`
+...
+LL |     pick(get, &22)
+   |     ^^^^^^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr
new file mode 100644 (file)
index 0000000..8468448
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-use-contravariant-struct-1.rs:12:5
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+   |        ---- ---- lifetime `'max` defined here
+   |        |
+   |        lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr
new file mode 100644 (file)
index 0000000..19a22f0
--- /dev/null
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-use-covariant-struct-1.rs:10:5
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
+   |        ---- ---- lifetime `'max` defined here
+   |        |
+   |        lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr
new file mode 100644 (file)
index 0000000..61f80fe
--- /dev/null
@@ -0,0 +1,24 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-use-invariant-struct-1.rs:12:5
+   |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+   |        ---- ---- lifetime `'max` defined here
+   |        |
+   |        lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: lifetime may not live long enough
+  --> $DIR/variance-use-invariant-struct-1.rs:19:5
+   |
+LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
+   |        ---- ---- lifetime `'max` defined here
+   |        |
+   |        lifetime `'min` defined here
+...
+LL |     v
+   |     ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/wf/wf-static-method.nll.stderr b/src/test/ui/wf/wf-static-method.nll.stderr
new file mode 100644 (file)
index 0000000..338de6d
--- /dev/null
@@ -0,0 +1,65 @@
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:17:9
+   |
+LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
+   |      --  -- lifetime `'b` defined here
+   |      |
+   |      lifetime `'a` defined here
+...
+LL |         u
+   |         ^ returning this value requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:26:18
+   |
+LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> {
+   |      --  -- lifetime `'b` defined here
+   |      |
+   |      lifetime `'a` defined here
+...
+LL |         let me = Self::make_me();
+   |                  ^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:33:9
+   |
+LL | impl<'a, 'b> Evil<'a, 'b> {
+   |      --  -- lifetime `'b` defined here
+   |      |
+   |      lifetime `'a` defined here
+LL |     fn inherent_evil(u: &'b u32) -> &'a u32 {
+LL |         u
+   |         ^ returning this value requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:41:5
+   |
+LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |         --  -- lifetime `'b` defined here
+   |         |
+   |         lifetime `'a` defined here
+LL |     <()>::static_evil(b)
+   |     ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:45:5
+   |
+LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |                  --  -- lifetime `'b` defined here
+   |                  |
+   |                  lifetime `'a` defined here
+LL |     <IndirectEvil>::static_evil(b)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a`
+
+error: lifetime may not live long enough
+  --> $DIR/wf-static-method.rs:50:5
+   |
+LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+   |                  --  -- lifetime `'b` defined here
+   |                  |
+   |                  lifetime `'a` defined here
+LL |     <Evil>::inherent_evil(b) // bug? shouldn't this be an error
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a`
+
+error: aborting due to 6 previous errors
+
index 10b8133326bba2f798aa6c4506bb0687dbe5e804..2579f1f51bd2dbccfc04d3a4e96cb19831be204b 100644 (file)
@@ -1912,8 +1912,7 @@ fn make_compile_args(&self, input_file: &Path, output_file: TargetLocation) -> C
 
         match self.config.compare_mode {
             Some(CompareMode::Nll) => {
-                // FIXME(#56993) use -Zborrowck=mir
-                rustc.args(&["-Zborrowck=migrate"]);
+                rustc.args(&["-Zborrowck=mir"]);
             }
             Some(CompareMode::Polonius) => {
                 rustc.args(&["-Zpolonius", "-Zborrowck=mir"]);