]> git.lizzy.rs Git - rust.git/commitdiff
Tweak E0597
authorEsteban Küber <esteban@kuber.com.ar>
Sun, 15 Jan 2023 03:06:44 +0000 (03:06 +0000)
committerEsteban Küber <esteban@kuber.com.ar>
Sun, 15 Jan 2023 19:46:20 +0000 (19:46 +0000)
CC #99430

208 files changed:
compiler/rustc_borrowck/src/borrowck_errors.rs
compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
compiler/rustc_borrowck/src/diagnostics/move_errors.rs
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
tests/ui/asm/type-check-4.stderr
tests/ui/associated-types/associated-types-outlives.stderr
tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr
tests/ui/async-await/issue-75785-confusing-named-region.stderr
tests/ui/async-await/multiple-lifetimes/ret-ref.stderr
tests/ui/augmented-assignments.rs
tests/ui/augmented-assignments.stderr
tests/ui/binop/binop-move-semantics.stderr
tests/ui/borrowck/borrowck-anon-fields-variant.stderr
tests/ui/borrowck/borrowck-assign-comp.stderr
tests/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr
tests/ui/borrowck/borrowck-closures-mut-and-imm.stderr
tests/ui/borrowck/borrowck-describe-lvalue.stderr
tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr
tests/ui/borrowck/borrowck-issue-14498.stderr
tests/ui/borrowck/borrowck-lend-flow-match.stderr
tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
tests/ui/borrowck/borrowck-loan-blocks-move.stderr
tests/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr
tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
tests/ui/borrowck/borrowck-match-already-borrowed.stderr
tests/ui/borrowck/borrowck-move-by-capture.stderr
tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
tests/ui/borrowck/borrowck-move-subcomponent.stderr
tests/ui/borrowck/borrowck-multiple-captures.stderr
tests/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr
tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
tests/ui/borrowck/borrowck-overloaded-index-move-index.stderr
tests/ui/borrowck/borrowck-pat-reassign-binding.stderr
tests/ui/borrowck/borrowck-union-borrow-nested.stderr
tests/ui/borrowck/borrowck-union-borrow.stderr
tests/ui/borrowck/borrowck-use-mut-borrow.stderr
tests/ui/borrowck/borrowck-vec-pattern-move-tail.stderr
tests/ui/borrowck/borrowck-vec-pattern-nesting.rs
tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr
tests/ui/borrowck/issue-25793.stderr
tests/ui/borrowck/issue-52713-bug.stderr
tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr
tests/ui/borrowck/issue-81365-1.stderr
tests/ui/borrowck/issue-81365-10.stderr
tests/ui/borrowck/issue-81365-11.stderr
tests/ui/borrowck/issue-81365-2.stderr
tests/ui/borrowck/issue-81365-3.stderr
tests/ui/borrowck/issue-81365-4.stderr
tests/ui/borrowck/issue-81365-5.stderr
tests/ui/borrowck/issue-81365-6.stderr
tests/ui/borrowck/issue-81365-7.stderr
tests/ui/borrowck/issue-81365-8.stderr
tests/ui/borrowck/issue-81365-9.stderr
tests/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr
tests/ui/borrowck/two-phase-surprise-no-conflict.stderr
tests/ui/btreemap/btreemap_dropck.stderr
tests/ui/c-variadic/variadic-ffi-4.stderr
tests/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr
tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr
tests/ui/closures/2229_closure_analysis/diagnostics/union.rs
tests/ui/closures/2229_closure_analysis/diagnostics/union.stderr
tests/ui/coercion/coerce-overloaded-autoderef-fail.stderr
tests/ui/consts/promote_const_let.stderr
tests/ui/dropck/dropck-eyepatch-extern-crate.stderr
tests/ui/dropck/dropck-eyepatch-reorder.stderr
tests/ui/dropck/dropck-eyepatch.stderr
tests/ui/dropck/dropck-union.stderr
tests/ui/dropck/dropck_trait_cycle_checked.stderr
tests/ui/dst/dst-bad-coerce3.stderr
tests/ui/error-codes/E0503.stderr
tests/ui/error-codes/E0504.stderr
tests/ui/error-codes/E0505.stderr
tests/ui/error-codes/E0506.stderr
tests/ui/error-codes/E0597.stderr
tests/ui/fn/implied-bounds-unnorm-associated-type-4.stderr
tests/ui/fn/implied-bounds-unnorm-associated-type.stderr
tests/ui/generic-associated-types/issue-74684-1.stderr
tests/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr
tests/ui/impl-trait/feature-self-return-type.stderr
tests/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.stderr
tests/ui/inline-const/const-expr-lifetime-err.stderr
tests/ui/issues/issue-40288.stderr
tests/ui/issues/issue-45697-1.stderr
tests/ui/issues/issue-45697.stderr
tests/ui/issues/issue-46471-1.stderr
tests/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr
tests/ui/mut/mut-pattern-internal-mutability.stderr
tests/ui/nll/borrowed-local-error.stderr
tests/ui/nll/borrowed-match-issue-45045.stderr
tests/ui/nll/capture-ref-in-struct.stderr
tests/ui/nll/closure-access-spans.stderr
tests/ui/nll/closure-borrow-spans.stderr
tests/ui/nll/closure-requirements/escape-argument.stderr
tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
tests/ui/nll/closure-use-spans.stderr
tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy-proj.stderr
tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr
tests/ui/nll/dont-print-desugared.stderr
tests/ui/nll/drop-no-may-dangle.stderr
tests/ui/nll/guarantor-issue-46974.stderr
tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr
tests/ui/nll/issue-27282-mutation-in-guard.stderr
tests/ui/nll/issue-27868.stderr
tests/ui/nll/issue-46036.stderr
tests/ui/nll/issue-48803.stderr
tests/ui/nll/issue-52534-2.stderr
tests/ui/nll/issue-52663-trait-object.stderr
tests/ui/nll/issue-54382-use-span-of-tail-of-block.stderr
tests/ui/nll/issue-54556-stephaneyfx.stderr
tests/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr
tests/ui/nll/issue-54556-used-vs-unused-tails.stderr
tests/ui/nll/issue-54556-wrap-it-up.stderr
tests/ui/nll/issue-55511.stderr
tests/ui/nll/issue-57989.stderr
tests/ui/nll/issue-68550.stderr
tests/ui/nll/issue-69114-static-mut-ty.stderr
tests/ui/nll/issue-69114-static-ty.stderr
tests/ui/nll/loan_ends_mid_block_pair.stderr
tests/ui/nll/local-outlives-static-via-hrtb.stderr
tests/ui/nll/match-cfg-fake-edges2.stderr
tests/ui/nll/match-guards-always-borrow.stderr
tests/ui/nll/match-guards-partially-borrow.stderr
tests/ui/nll/match-on-borrowed.stderr
tests/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr
tests/ui/nll/maybe-initialized-drop-with-fragment.stderr
tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr
tests/ui/nll/maybe-initialized-drop.stderr
tests/ui/nll/polonius/polonius-smoke-test.stderr
tests/ui/nll/promoted-bounds.stderr
tests/ui/nll/reference-carried-through-struct-field.stderr
tests/ui/nll/relate_tys/var-appears-twice.stderr
tests/ui/nll/user-annotations/adt-brace-enums.stderr
tests/ui/nll/user-annotations/adt-brace-structs.stderr
tests/ui/nll/user-annotations/adt-nullary-enums.stderr
tests/ui/nll/user-annotations/adt-tuple-enums.stderr
tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr
tests/ui/nll/user-annotations/adt-tuple-struct.stderr
tests/ui/nll/user-annotations/cast_static_lifetime.stderr
tests/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr
tests/ui/nll/user-annotations/fns.stderr
tests/ui/nll/user-annotations/method-call.stderr
tests/ui/nll/user-annotations/method-ufcs-1.stderr
tests/ui/nll/user-annotations/method-ufcs-2.stderr
tests/ui/nll/user-annotations/method-ufcs-3.stderr
tests/ui/nll/user-annotations/method-ufcs-inherent-1.stderr
tests/ui/nll/user-annotations/method-ufcs-inherent-2.stderr
tests/ui/nll/user-annotations/method-ufcs-inherent-3.stderr
tests/ui/nll/user-annotations/method-ufcs-inherent-4.stderr
tests/ui/nll/user-annotations/normalization.stderr
tests/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr
tests/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr
tests/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr
tests/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr
tests/ui/nll/user-annotations/patterns.stderr
tests/ui/nll/user-annotations/promoted-annotation.stderr
tests/ui/nll/user-annotations/type_ascription_static_lifetime.stderr
tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr
tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr
tests/ui/regions/regions-addr-of-arg.stderr
tests/ui/regions/regions-free-region-ordering-caller1.stderr
tests/ui/regions/regions-infer-proc-static-upvar.stderr
tests/ui/regions/regions-nested-fns.stderr
tests/ui/regions/regions-pattern-typing-issue-19552.stderr
tests/ui/regions/regions-pattern-typing-issue-19997.stderr
tests/ui/rfc-2008-non-exhaustive/borrowck-non-exhaustive.stderr
tests/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.stderr
tests/ui/self/issue-61882-2.stderr
tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr
tests/ui/span/dropck_arr_cycle_checked.stderr
tests/ui/span/dropck_direct_cycle_with_drop.stderr
tests/ui/span/dropck_misc_variants.stderr
tests/ui/span/dropck_vec_cycle_checked.stderr
tests/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr
tests/ui/span/issue-24805-dropck-trait-has-items.stderr
tests/ui/span/issue-24895-copy-clone-dropck.stderr
tests/ui/span/issue-25199.stderr
tests/ui/span/issue-26656.stderr
tests/ui/span/issue-29106.stderr
tests/ui/span/issue-36537.stderr
tests/ui/span/issue-40157.stderr
tests/ui/span/issue28498-reject-lifetime-param.stderr
tests/ui/span/issue28498-reject-passed-to-fn.stderr
tests/ui/span/issue28498-reject-trait-bound.stderr
tests/ui/span/mut-ptr-cant-outlive-ref.stderr
tests/ui/span/range-2.stderr
tests/ui/span/regionck-unboxed-closure-lifetimes.stderr
tests/ui/span/regions-close-over-type-parameter-2.stderr
tests/ui/span/regions-escape-loop-via-variable.stderr
tests/ui/span/regions-escape-loop-via-vec.stderr
tests/ui/span/send-is-not-static-ensures-scoping.stderr
tests/ui/span/send-is-not-static-std-sync-2.stderr
tests/ui/span/send-is-not-static-std-sync.stderr
tests/ui/span/vec-must-not-hide-type-from-dropck.stderr
tests/ui/span/vec_refs_data_with_early_death.stderr
tests/ui/span/wf-method-late-bound-regions.stderr
tests/ui/static/static-lifetime-bound.stderr
tests/ui/suggestions/borrow-for-loop-head.stderr
tests/ui/suggestions/option-content-move2.stderr
tests/ui/traits/associated_type_bound/check-trait-object-bounds-3.stderr
tests/ui/traits/coercion-generic-regions.stderr
tests/ui/traits/vtable/issue-97381.stderr
tests/ui/try-block/try-block-bad-lifetime.stderr
tests/ui/try-block/try-block-maybe-bad-lifetime.stderr
tests/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr
tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr
tests/ui/unop-move-semantics.stderr
tests/ui/variance/variance-issue-20533.stderr

index a4943d112042dc212d419f0247933a88cecb158a..2bbb9618dbf09f27f74a09662e66c6fffd6dd031 100644 (file)
@@ -37,7 +37,7 @@ pub(crate) fn cannot_use_when_mutably_borrowed(
             desc,
         );
 
-        err.span_label(borrow_span, format!("borrow of {} occurs here", borrow_desc));
+        err.span_label(borrow_span, format!("{} is borrowed here", borrow_desc));
         err.span_label(span, format!("use of borrowed {}", borrow_desc));
         err
     }
@@ -250,8 +250,8 @@ pub(crate) fn cannot_assign_to_borrowed(
             desc,
         );
 
-        err.span_label(borrow_span, format!("borrow of {} occurs here", desc));
-        err.span_label(span, format!("assignment to borrowed {} occurs here", desc));
+        err.span_label(borrow_span, format!("{} is borrowed here", desc));
+        err.span_label(span, format!("{} is assigned to here but it was already borrowed", desc));
         err
     }
 
index 968c1f49b95c00ccec072fc253421936dc258f90..0ab8aabd63bd0f6a73915340bd2a035a03416607 100644 (file)
@@ -1742,7 +1742,7 @@ fn report_local_value_does_not_live_long_enough(
                 &self.local_names,
                 &mut err,
                 "",
-                None,
+                Some(borrow_span),
                 None,
             );
         }
index 2095747097b7660870ecdff8b32fc8820525652b..e4f45c53aefe5f53271a81ec3b8e901301065691 100644 (file)
@@ -1,6 +1,8 @@
 //! Print diagnostics to explain why values are borrowed.
 
 use rustc_errors::{Applicability, Diagnostic};
+use rustc_hir as hir;
+use rustc_hir::intravisit::Visitor;
 use rustc_index::vec::IndexVec;
 use rustc_infer::infer::NllRegionVariableOrigin;
 use rustc_middle::mir::{
@@ -11,6 +13,7 @@
 use rustc_middle::ty::{self, RegionVid, TyCtxt};
 use rustc_span::symbol::{kw, Symbol};
 use rustc_span::{sym, DesugaringKind, Span};
+use rustc_trait_selection::traits::error_reporting::FindExprBySpan;
 
 use crate::region_infer::{BlameConstraint, ExtraConstraintInfo};
 use crate::{
@@ -63,6 +66,31 @@ pub(crate) fn add_explanation_to_diagnostic(
         borrow_span: Option<Span>,
         multiple_borrow_span: Option<(Span, Span)>,
     ) {
+        if let Some(span) = borrow_span {
+            let def_id = body.source.def_id();
+            if let Some(node) = tcx.hir().get_if_local(def_id)
+                && let Some(body_id) = node.body_id()
+            {
+                let body = tcx.hir().body(body_id);
+                let mut expr_finder = FindExprBySpan::new(span);
+                expr_finder.visit_expr(body.value);
+                if let Some(mut expr) = expr_finder.result {
+                    while let hir::ExprKind::AddrOf(_, _, inner) = &expr.kind {
+                        expr = inner;
+                    }
+                    if let hir::ExprKind::Path(hir::QPath::Resolved(None, p)) = expr.kind
+                        && let [hir::PathSegment { ident, args: None, .. }] = p.segments
+                        && let hir::def::Res::Local(hir_id) = p.res
+                        && let Some(hir::Node::Pat(pat)) = tcx.hir().find(hir_id)
+                    {
+                        err.span_label(
+                            pat.span,
+                            &format!("binding `{ident}` declared here"),
+                        );
+                    }
+                }
+            }
+        }
         match *self {
             BorrowExplanation::UsedLater(later_use_kind, var_or_use_span, path_span) => {
                 let message = match later_use_kind {
index 6db3c858ae7149b9a138dbd77c7813c3eeea298e..ea58ad5ae3e34539a7ee5bf53f2ec95ffa7a8a3e 100644 (file)
@@ -448,7 +448,7 @@ fn add_move_hints(&self, error: GroupedMoveError<'tcx>, err: &mut Diagnostic, sp
                 };
                 self.note_type_does_not_implement_copy(err, &place_desc, place_ty, Some(span), "");
 
-                use_spans.args_span_label(err, format!("move out of {place_desc} occurs here"));
+                use_spans.args_span_label(err, format!("{place_desc} is moved here"));
             }
         }
     }
index edd187b8dec3b1469a14125c01ad4845f6e0bade..c3d097b5d7559b8a3df49ea3ee23efee5e24bc90 100644 (file)
@@ -2827,7 +2827,7 @@ pub struct FindExprBySpan<'hir> {
 }
 
 impl<'hir> FindExprBySpan<'hir> {
-    fn new(span: Span) -> Self {
+    pub fn new(span: Span) -> Self {
         Self { span, result: None, ty_result: None }
     }
 }
index c97cd171b1e38610578588cb1c5363d142741cae..b5ecb3e1b56fb28147755ab50302952063669a0e 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `a` because it is borrowed
   --> $DIR/type-check-4.rs:14:9
    |
 LL |         let p = &a;
-   |                 -- borrow of `a` occurs here
+   |                 -- `a` is borrowed here
 LL |         asm!("{}", out(reg) a);
-   |         ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `a` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^ `a` is assigned to here but it was already borrowed
 LL |
 LL |         println!("{}", p);
    |                        - borrow later used here
@@ -13,7 +13,7 @@ error[E0503]: cannot use `a` because it was mutably borrowed
   --> $DIR/type-check-4.rs:22:28
    |
 LL |         let p = &mut a;
-   |                 ------ borrow of `a` occurs here
+   |                 ------ `a` is borrowed here
 LL |         asm!("{}", in(reg) a);
    |                            ^ use of borrowed `a`
 LL |
index 840e33b4b8a8e900cedd6b87f1794cfd10434097..2fe3f2d4a02505149a1dbb347b9314c00500b908 100644 (file)
@@ -1,6 +1,9 @@
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/associated-types-outlives.rs:22:14
    |
+LL |                     F: for<'a> FnOnce(<T as Foo<'a>>::Bar)>(x: T, f: F) {
+   |                                                             - binding `x` declared here
+...
 LL |         's: loop { y = denormalise(&x); break }
    |                                    -- borrow of `x` occurs here
 LL |         drop(x);
index b96cab9f0f51affffcac89671167a6490b5cc134..628ba1a4818936642e68726a80c6af74cab267b4 100644 (file)
@@ -4,9 +4,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
 LL | pub async fn async_fn(x: &mut i32) -> &i32 {
    |                          - let's call the lifetime of this reference `'1`
 LL |     let y = &*x;
-   |             --- borrow of `*x` occurs here
+   |             --- `*x` is borrowed here
 LL |     *x += 1;
-   |     ^^^^^^^ assignment to borrowed `*x` occurs here
+   |     ^^^^^^^ `*x` is assigned to here but it was already borrowed
 LL |     y
    |     - returning this value requires that `*x` is borrowed for `'1`
 
@@ -14,9 +14,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
   --> $DIR/issue-74072-lifetime-name-annotations.rs:16:9
    |
 LL |         let y = &*x;
-   |                 --- borrow of `*x` occurs here
+   |                 --- `*x` is borrowed here
 LL |         *x += 1;
-   |         ^^^^^^^ assignment to borrowed `*x` occurs here
+   |         ^^^^^^^ `*x` is assigned to here but it was already borrowed
 LL |         y
    |         - returning this value requires that `*x` is borrowed for `'1`
 LL |     })()
@@ -28,9 +28,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
 LL |     (async move || -> &i32 {
    |                       - let's call the lifetime of this reference `'1`
 LL |         let y = &*x;
-   |                 --- borrow of `*x` occurs here
+   |                 --- `*x` is borrowed here
 LL |         *x += 1;
-   |         ^^^^^^^ assignment to borrowed `*x` occurs here
+   |         ^^^^^^^ `*x` is assigned to here but it was already borrowed
 LL |         y
    |         - returning this value requires that `*x` is borrowed for `'1`
 
@@ -38,9 +38,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
   --> $DIR/issue-74072-lifetime-name-annotations.rs:32:9
    |
 LL |         let y = &*x;
-   |                 --- borrow of `*x` occurs here
+   |                 --- `*x` is borrowed here
 LL |         *x += 1;
-   |         ^^^^^^^ assignment to borrowed `*x` occurs here
+   |         ^^^^^^^ `*x` is assigned to here but it was already borrowed
 LL |         y
    |         - returning this value requires that `*x` is borrowed for `'1`
 LL |     }
index 3b731d9c60a6ae20b51e776fc86dc88cd4468fc0..b69033a0eda0b836a84c154b599565cbb1b07ddf 100644 (file)
@@ -4,9 +4,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
 LL | pub async fn async_fn(x: &mut i32) -> (&i32, &i32) {
    |                          - let's call the lifetime of this reference `'1`
 LL |     let y = &*x;
-   |             --- borrow of `*x` occurs here
+   |             --- `*x` is borrowed here
 LL |     *x += 1;
-   |     ^^^^^^^ assignment to borrowed `*x` occurs here
+   |     ^^^^^^^ `*x` is assigned to here but it was already borrowed
 LL |     (&32, y)
    |     -------- returning this value requires that `*x` is borrowed for `'1`
 
index d86e84033b8cd688191c48f0926dc1ea2256da36..a599ac1d92f831386d1bdb146f952d0e6388523d 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `a` because it is borrowed
   --> $DIR/ret-ref.rs:16:5
    |
 LL |     let future = multiple_named_lifetimes(&a, &b);
-   |                                           -- borrow of `a` occurs here
+   |                                           -- `a` is borrowed here
 LL |     a += 1;
-   |     ^^^^^^ assignment to borrowed `a` occurs here
+   |     ^^^^^^ `a` is assigned to here but it was already borrowed
 LL |     b += 1;
 LL |     let p = future.await;
    |             ------ borrow later used here
@@ -13,10 +13,10 @@ error[E0506]: cannot assign to `b` because it is borrowed
   --> $DIR/ret-ref.rs:17:5
    |
 LL |     let future = multiple_named_lifetimes(&a, &b);
-   |                                               -- borrow of `b` occurs here
+   |                                               -- `b` is borrowed here
 LL |     a += 1;
 LL |     b += 1;
-   |     ^^^^^^ assignment to borrowed `b` occurs here
+   |     ^^^^^^ `b` is assigned to here but it was already borrowed
 LL |     let p = future.await;
    |             ------ borrow later used here
 
@@ -24,10 +24,10 @@ error[E0506]: cannot assign to `a` because it is borrowed
   --> $DIR/ret-ref.rs:28:5
    |
 LL |     let future = multiple_named_lifetimes(&a, &b);
-   |                                           -- borrow of `a` occurs here
+   |                                           -- `a` is borrowed here
 LL |     let p = future.await;
 LL |     a += 1;
-   |     ^^^^^^ assignment to borrowed `a` occurs here
+   |     ^^^^^^ `a` is assigned to here but it was already borrowed
 LL |     b += 1;
 LL |     drop(p);
    |          - borrow later used here
index 20c7fb3a98395bddc9bf07788364b7630dd9d867..bd2435a78bf222152d8a6653e574e2a69ce5e1db 100644 (file)
@@ -9,7 +9,7 @@ fn add_assign(&mut self, _: Int) {
 }
 
 fn main() {
-    let mut x = Int(1);
+    let mut x = Int(1); //~ NOTE binding `x` declared here
     x
     //~^ NOTE borrow of `x` occurs here
     +=
index 2910c910d55241bf4c660f667df359b0ac38289f..d1096aea2794e3db0f8f9359ec674e388561ae8d 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/augmented-assignments.rs:16:5
    |
+LL |     let mut x = Int(1);
+   |         ----- binding `x` declared here
 LL |     x
    |     - borrow of `x` occurs here
 ...
index dae267da05d1758bd31791fff00a437cc3066a8a..8645169b98ac9d2a227e33dcb092468243afc54b 100644 (file)
@@ -41,6 +41,8 @@ LL | fn move_then_borrow<T: Add<Output=()> + Clone + Copy>(x: T) {
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/binop-move-semantics.rs:21:5
    |
+LL | fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) {
+   |                                     - binding `x` declared here
 LL |     let m = &x;
    |             -- borrow of `x` occurs here
 ...
@@ -53,6 +55,9 @@ LL |     use_mut(n); use_imm(m);
 error[E0505]: cannot move out of `y` because it is borrowed
   --> $DIR/binop-move-semantics.rs:23:5
    |
+LL | fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) {
+   |                                           ----- binding `y` declared here
+LL |     let m = &x;
 LL |     let n = &mut y;
    |             ------ borrow of `y` occurs here
 ...
index 98f6f00a7d48bbdb6a725d0af80d535854020fea..c1d668f74efb94354e7b63c90bf9d503747d6331 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `y` because it was mutably borrowed
   --> $DIR/borrowck-anon-fields-variant.rs:16:19
    |
 LL |       Foo::Y(ref mut a, _) => a,
-   |              --------- borrow of `y.0` occurs here
+   |              --------- `y.0` is borrowed here
 ...
 LL |     let b = match y {
    |                   ^ use of borrowed `y.0`
@@ -14,7 +14,7 @@ error[E0503]: cannot use `y` because it was mutably borrowed
   --> $DIR/borrowck-anon-fields-variant.rs:34:19
    |
 LL |       Foo::Y(ref mut a, _) => a,
-   |              --------- borrow of `y.0` occurs here
+   |              --------- `y.0` is borrowed here
 ...
 LL |     let b = match y {
    |                   ^ use of borrowed `y.0`
index 2b7cef7b3253b55fb5febe33969f66ca0b1119f5..d35f2331a76f4ed06b2c3593a4f1bce997962e32 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `p.x` because it is borrowed
   --> $DIR/borrowck-assign-comp.rs:10:5
    |
 LL |     let q = &p;
-   |             -- borrow of `p.x` occurs here
+   |             -- `p.x` is borrowed here
 ...
 LL |     p.x = 5;
-   |     ^^^^^^^ assignment to borrowed `p.x` occurs here
+   |     ^^^^^^^ `p.x` is assigned to here but it was already borrowed
 LL |     q.x;
    |     --- borrow later used here
 
@@ -13,9 +13,9 @@ error[E0506]: cannot assign to `p` because it is borrowed
   --> $DIR/borrowck-assign-comp.rs:20:5
    |
 LL |     let q = &p.y;
-   |             ---- borrow of `p` occurs here
+   |             ---- `p` is borrowed here
 LL |     p = Point {x: 5, y: 7};
-   |     ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
+   |     ^^^^^^^^^^^^^^^^^^^^^^ `p` is assigned to here but it was already borrowed
 LL |     p.x; // silence warning
 LL |     *q; // stretch loan
    |     -- borrow later used here
@@ -24,9 +24,9 @@ error[E0506]: cannot assign to `p.y` because it is borrowed
   --> $DIR/borrowck-assign-comp.rs:31:5
    |
 LL |     let q = &p.y;
-   |             ---- borrow of `p.y` occurs here
+   |             ---- `p.y` is borrowed here
 LL |     p.y = 5;
-   |     ^^^^^^^ assignment to borrowed `p.y` occurs here
+   |     ^^^^^^^ `p.y` is assigned to here but it was already borrowed
 LL |     *q;
    |     -- borrow later used here
 
index 0b21d113f74ee7c72e3e298c402a61c5193b8f50..8c0a8efcc1828548bfc810f2e36b5fe0a32be634 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
   --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9
    |
 LL |         let z = copy_borrowed_ptr(&mut y);
-   |                                   ------ borrow of `y` occurs here
+   |                                   ------ `y` is borrowed here
 LL |         *y.pointer += 1;
    |         ^^^^^^^^^^^^^^^ use of borrowed `y`
 ...
@@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed
   --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9
    |
 LL |         let z = copy_borrowed_ptr(&mut y);
-   |                                   ------ borrow of `*y.pointer` occurs here
+   |                                   ------ `*y.pointer` is borrowed here
 LL |         *y.pointer += 1;
-   |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
+   |         ^^^^^^^^^^^^^^^ `*y.pointer` is assigned to here but it was already borrowed
 ...
 LL |         *z.pointer += 1;
    |         --------------- borrow later used here
index fadcd11a592aa7444c98852e6d9ce31b28f1a35a..8a7870e0c44af17949deeaf46bbfd92bc66f59c8 100644 (file)
@@ -49,9 +49,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
 LL |     let c2 = || x * 5;
    |              -- - borrow occurs due to use in closure
    |              |
-   |              borrow of `x` occurs here
+   |              `x` is borrowed here
 LL |     x = 5;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL |
 LL |     drop(c2);
    |          -- borrow later used here
@@ -62,9 +62,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
 LL |     let c1 = || get(&x);
    |              --      - borrow occurs due to use in closure
    |              |
-   |              borrow of `x` occurs here
+   |              `x` is borrowed here
 LL |     x = 5;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL |
 LL |     drop(c1);
    |          -- borrow later used here
@@ -75,9 +75,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
 LL |     let c1 = || get(&*x);
    |              --      -- borrow occurs due to use in closure
    |              |
-   |              borrow of `*x` occurs here
+   |              `*x` is borrowed here
 LL |     *x = 5;
-   |     ^^^^^^ assignment to borrowed `*x` occurs here
+   |     ^^^^^^ `*x` is assigned to here but it was already borrowed
 LL |
 LL |     drop(c1);
    |          -- borrow later used here
@@ -88,9 +88,9 @@ error[E0506]: cannot assign to `*x.f` because it is borrowed
 LL |     let c1 = || get(&*x.f);
    |              --      ---- borrow occurs due to use in closure
    |              |
-   |              borrow of `*x.f` occurs here
+   |              `*x.f` is borrowed here
 LL |     *x.f = 5;
-   |     ^^^^^^^^ assignment to borrowed `*x.f` occurs here
+   |     ^^^^^^^^ `*x.f` is assigned to here but it was already borrowed
 LL |
 LL |     drop(c1);
    |          -- borrow later used here
index 2c1b9c10d4660dc0cd71e3931f2224d2dd9592a5..cb29c9fdac3c66bd356a81d0d5076f35c520dab3 100644 (file)
@@ -45,7 +45,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:37:9
    |
 LL |         let x = f.x();
-   |                 ----- borrow of `f` occurs here
+   |                 ----- `f` is borrowed here
 LL |         f.x;
    |         ^^^ use of borrowed `f`
 LL |         drop(x);
@@ -55,7 +55,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:44:9
    |
 LL |         let x = g.x();
-   |                 ----- borrow of `g` occurs here
+   |                 ----- `g` is borrowed here
 LL |         g.0;
    |         ^^^ use of borrowed `g`
 LL |         drop(x);
@@ -65,7 +65,7 @@ error[E0503]: cannot use `h.0` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:51:9
    |
 LL |         let x = &mut h.0;
-   |                 -------- borrow of `h.0` occurs here
+   |                 -------- `h.0` is borrowed here
 LL |         h.0;
    |         ^^^ use of borrowed `h.0`
 LL |         drop(x);
@@ -75,7 +75,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:59:20
    |
 LL |         let x = e.x();
-   |                 ----- borrow of `e` occurs here
+   |                 ----- `e` is borrowed here
 LL |         match e {
 LL |             Baz::X(value) => value
    |                    ^^^^^ use of borrowed `e`
@@ -87,7 +87,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:67:9
    |
 LL |         let x = &mut u.a;
-   |                 -------- borrow of `u.a` occurs here
+   |                 -------- `u.a` is borrowed here
 LL |         u.a;
    |         ^^^ use of borrowed `u.a`
 LL |         drop(x);
@@ -97,7 +97,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:74:9
    |
 LL |         let x = f.x();
-   |                 ----- borrow of `*f` occurs here
+   |                 ----- `*f` is borrowed here
 LL |         f.x;
    |         ^^^ use of borrowed `*f`
 LL |         drop(x);
@@ -107,7 +107,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:81:9
    |
 LL |         let x = g.x();
-   |                 ----- borrow of `*g` occurs here
+   |                 ----- `*g` is borrowed here
 LL |         g.0;
    |         ^^^ use of borrowed `*g`
 LL |         drop(x);
@@ -117,7 +117,7 @@ error[E0503]: cannot use `h.0` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:88:9
    |
 LL |         let x = &mut h.0;
-   |                 -------- borrow of `h.0` occurs here
+   |                 -------- `h.0` is borrowed here
 LL |         h.0;
    |         ^^^ use of borrowed `h.0`
 LL |         drop(x);
@@ -127,7 +127,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:96:20
    |
 LL |         let x = e.x();
-   |                 ----- borrow of `*e` occurs here
+   |                 ----- `*e` is borrowed here
 LL |         match *e {
 LL |             Baz::X(value) => value
    |                    ^^^^^ use of borrowed `*e`
@@ -139,7 +139,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:105:9
    |
 LL |         let x = &mut u.a;
-   |                 -------- borrow of `u.a` occurs here
+   |                 -------- `u.a` is borrowed here
 LL |         u.a;
    |         ^^^ use of borrowed `u.a`
 LL |         drop(x);
@@ -149,7 +149,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:113:15
    |
 LL |         let x = &mut v;
-   |                 ------ borrow of `v` occurs here
+   |                 ------ `v` is borrowed here
 LL |         match v {
 LL |             &[x, _, .., _, _] => println!("{}", x),
    |               ^ use of borrowed `v`
@@ -161,7 +161,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:118:18
    |
 LL |         let x = &mut v;
-   |                 ------ borrow of `v` occurs here
+   |                 ------ `v` is borrowed here
 ...
 LL |             &[_, x, .., _, _] => println!("{}", x),
    |                  ^ use of borrowed `v`
@@ -173,7 +173,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:123:25
    |
 LL |         let x = &mut v;
-   |                 ------ borrow of `v` occurs here
+   |                 ------ `v` is borrowed here
 ...
 LL |             &[_, _, .., x, _] => println!("{}", x),
    |                         ^ use of borrowed `v`
@@ -185,7 +185,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:128:28
    |
 LL |         let x = &mut v;
-   |                 ------ borrow of `v` occurs here
+   |                 ------ `v` is borrowed here
 ...
 LL |             &[_, _, .., _, x] => println!("{}", x),
    |                            ^ use of borrowed `v`
@@ -197,7 +197,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:139:15
    |
 LL |         let x = &mut v;
-   |                 ------ borrow of `v` occurs here
+   |                 ------ `v` is borrowed here
 LL |         match v {
 LL |             &[x @ ..] => println!("{:?}", x),
    |               ^ use of borrowed `v`
@@ -209,7 +209,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:144:18
    |
 LL |         let x = &mut v;
-   |                 ------ borrow of `v` occurs here
+   |                 ------ `v` is borrowed here
 ...
 LL |             &[_, x @ ..] => println!("{:?}", x),
    |                  ^ use of borrowed `v`
@@ -221,7 +221,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:149:15
    |
 LL |         let x = &mut v;
-   |                 ------ borrow of `v` occurs here
+   |                 ------ `v` is borrowed here
 ...
 LL |             &[x @ .., _] => println!("{:?}", x),
    |               ^ use of borrowed `v`
@@ -233,7 +233,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:154:18
    |
 LL |         let x = &mut v;
-   |                 ------ borrow of `v` occurs here
+   |                 ------ `v` is borrowed here
 ...
 LL |             &[_, x @ .., _] => println!("{:?}", x),
    |                  ^ use of borrowed `v`
@@ -245,7 +245,7 @@ error[E0503]: cannot use `e` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:166:15
    |
 LL |         let x = &mut e;
-   |                 ------ borrow of `e` occurs here
+   |                 ------ `e` is borrowed here
 LL |         match e {
    |               ^ use of borrowed `e`
 ...
@@ -304,7 +304,7 @@ error[E0503]: cannot use `*v` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:232:9
    |
 LL |         let x = &mut v;
-   |                 ------ borrow of `v` occurs here
+   |                 ------ `v` is borrowed here
 LL |         v[0].y;
    |         ^^^^ use of borrowed `v`
 ...
@@ -315,7 +315,7 @@ error[E0503]: cannot use `v[_].y` because it was mutably borrowed
   --> $DIR/borrowck-describe-lvalue.rs:232:9
    |
 LL |         let x = &mut v;
-   |                 ------ borrow of `v` occurs here
+   |                 ------ `v` is borrowed here
 LL |         v[0].y;
    |         ^^^^^^ use of borrowed `v`
 ...
index a66db05ccc5fcfe7c6ba59917551cf972f7a1b23..1a20ec85fc00f07add55ee4ed182a74ddb9c3b54 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `_a` because it is borrowed
   --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:6:9
    |
 LL |     let b = &mut _a;
-   |             ------- borrow of `_a` occurs here
+   |             ------- `_a` is borrowed here
 ...
 LL |         _a = 4;
-   |         ^^^^^^ assignment to borrowed `_a` occurs here
+   |         ^^^^^^ `_a` is assigned to here but it was already borrowed
 ...
 LL |     drop(b);
    |          - borrow later used here
index 42a55b7a854ba407b8670ea37dde36b86c61302f..374c5ee3ed27b7a28b733c107dfe69db74920d10 100644 (file)
@@ -13,10 +13,10 @@ error[E0506]: cannot assign to `**y` because it is borrowed
   --> $DIR/borrowck-issue-14498.rs:25:5
    |
 LL |     let p = &y;
-   |             -- borrow of `**y` occurs here
+   |             -- `**y` is borrowed here
 LL |     let q = &***p;
 LL |     **y = 2;
-   |     ^^^^^^^ assignment to borrowed `**y` occurs here
+   |     ^^^^^^^ `**y` is assigned to here but it was already borrowed
 LL |     drop(p);
    |          - borrow later used here
 
@@ -24,10 +24,10 @@ error[E0506]: cannot assign to `**y` because it is borrowed
   --> $DIR/borrowck-issue-14498.rs:35:5
    |
 LL |     let p = &y;
-   |             -- borrow of `**y` occurs here
+   |             -- `**y` is borrowed here
 LL |     let q = &***p;
 LL |     **y = 2;
-   |     ^^^^^^^ assignment to borrowed `**y` occurs here
+   |     ^^^^^^^ `**y` is assigned to here but it was already borrowed
 LL |     drop(p);
    |          - borrow later used here
 
@@ -35,10 +35,10 @@ error[E0506]: cannot assign to `**y` because it is borrowed
   --> $DIR/borrowck-issue-14498.rs:45:5
    |
 LL |     let p = &y;
-   |             -- borrow of `**y` occurs here
+   |             -- `**y` is borrowed here
 LL |     let q = &***p;
 LL |     **y = 2;
-   |     ^^^^^^^ assignment to borrowed `**y` occurs here
+   |     ^^^^^^^ `**y` is assigned to here but it was already borrowed
 LL |     drop(p);
    |          - borrow later used here
 
@@ -46,10 +46,10 @@ error[E0506]: cannot assign to `**y` because it is borrowed
   --> $DIR/borrowck-issue-14498.rs:55:5
    |
 LL |     let p = &y;
-   |             -- borrow of `**y` occurs here
+   |             -- `**y` is borrowed here
 LL |     let q = &***p;
 LL |     **y = 2;
-   |     ^^^^^^^ assignment to borrowed `**y` occurs here
+   |     ^^^^^^^ `**y` is assigned to here but it was already borrowed
 LL |     drop(p);
    |          - borrow later used here
 
@@ -57,10 +57,10 @@ error[E0506]: cannot assign to `**y.a` because it is borrowed
   --> $DIR/borrowck-issue-14498.rs:65:5
    |
 LL |     let p = &y.a;
-   |             ---- borrow of `**y.a` occurs here
+   |             ---- `**y.a` is borrowed here
 LL |     let q = &***p;
 LL |     **y.a = 2;
-   |     ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+   |     ^^^^^^^^^ `**y.a` is assigned to here but it was already borrowed
 LL |     drop(p);
    |          - borrow later used here
 
@@ -68,10 +68,10 @@ error[E0506]: cannot assign to `**y.a` because it is borrowed
   --> $DIR/borrowck-issue-14498.rs:75:5
    |
 LL |     let p = &y.a;
-   |             ---- borrow of `**y.a` occurs here
+   |             ---- `**y.a` is borrowed here
 LL |     let q = &***p;
 LL |     **y.a = 2;
-   |     ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+   |     ^^^^^^^^^ `**y.a` is assigned to here but it was already borrowed
 LL |     drop(p);
    |          - borrow later used here
 
@@ -79,10 +79,10 @@ error[E0506]: cannot assign to `**y.a` because it is borrowed
   --> $DIR/borrowck-issue-14498.rs:85:5
    |
 LL |     let p = &y.a;
-   |             ---- borrow of `**y.a` occurs here
+   |             ---- `**y.a` is borrowed here
 LL |     let q = &***p;
 LL |     **y.a = 2;
-   |     ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+   |     ^^^^^^^^^ `**y.a` is assigned to here but it was already borrowed
 LL |     drop(p);
    |          - borrow later used here
 
@@ -90,10 +90,10 @@ error[E0506]: cannot assign to `**y.a` because it is borrowed
   --> $DIR/borrowck-issue-14498.rs:95:5
    |
 LL |     let p = &y.a;
-   |             ---- borrow of `**y.a` occurs here
+   |             ---- `**y.a` is borrowed here
 LL |     let q = &***p;
 LL |     **y.a = 2;
-   |     ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+   |     ^^^^^^^^^ `**y.a` is assigned to here but it was already borrowed
 LL |     drop(p);
    |          - borrow later used here
 
index 66f1cd9bd5664a68f97ffdae50283138feacaf31..6cdce7bee88975ccf15b12a800e1cd819fce16e7 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/borrowck-lend-flow-match.rs:12:13
    |
 LL |         Some(ref r) => {
-   |              ----- borrow of `x` occurs here
+   |              ----- `x` is borrowed here
 LL |             x = Some(1);
-   |             ^^^^^^^^^^^ assignment to borrowed `x` occurs here
+   |             ^^^^^^^^^^^ `x` is assigned to here but it was already borrowed
 LL |             drop(r);
    |                  - borrow later used here
 
index 3548da35b613926a4acf0ef7ebf0585127f2810b..6eabfff9054c4afab0e17080133c0cfb509a6f21 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `v` because it is borrowed
   --> $DIR/borrowck-loan-blocks-move-cc.rs:14:19
    |
+LL |     let v: Box<_> = Box::new(3);
+   |         - binding `v` declared here
 LL |     let w = &v;
    |             -- borrow of `v` occurs here
 LL |     thread::spawn(move|| {
@@ -15,6 +17,8 @@ LL |     w.use_ref();
 error[E0505]: cannot move out of `v` because it is borrowed
   --> $DIR/borrowck-loan-blocks-move-cc.rs:24:19
    |
+LL |     let v: Box<_> = Box::new(3);
+   |         - binding `v` declared here
 LL |     let w = &v;
    |             -- borrow of `v` occurs here
 LL |     thread::spawn(move|| {
index b5c6b101f765caffdb6000162d4ea6cf76b05a2c..38e06fa018786b829b17be72b093d1b8747bb400 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `v` because it is borrowed
   --> $DIR/borrowck-loan-blocks-move.rs:11:10
    |
+LL |     let v = Box::new(3);
+   |         - binding `v` declared here
 LL |     let w = &v;
    |             -- borrow of `v` occurs here
 LL |     take(v);
index 6994c837dfcbe62eb98ae6b9fc4da1db692ae624..311369a260d76e86ba0939dd8e4e8893ead0590c 100644 (file)
@@ -2,12 +2,12 @@ error[E0506]: cannot assign to `*s` because it is borrowed
   --> $DIR/borrowck-loan-of-static-data-issue-27616.rs:16:5
    |
 LL |     let alias: &'static mut String = s;
-   |                -------------------   - borrow of `*s` occurs here
+   |                -------------------   - `*s` is borrowed here
    |                |
    |                type annotation requires that `*s` is borrowed for `'static`
 ...
 LL |     *s = String::new();
-   |     ^^ assignment to borrowed `*s` occurs here
+   |     ^^ `*s` is assigned to here but it was already borrowed
 
 error: aborting due to previous error
 
index 24cc4933ef1b055efa4cf821bb90816c98ce1e46..f1640d3b7776f56fdff5759249439f30858c0628 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `p` because it was mutably borrowed
   --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:38:5
    |
 LL |     let q = &mut p;
-   |             ------ borrow of `p` occurs here
+   |             ------ `p` is borrowed here
 LL |
 LL |     p + 3;
    |     ^ use of borrowed `p`
index 39047be9de670e667bcd9517168ee5ad6140d64e..e5c0ec960a4a705b2b6d8994b769b655ea6f26ac 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `foo` because it was mutably borrowed
   --> $DIR/borrowck-match-already-borrowed.rs:9:19
    |
 LL |     let p = &mut foo;
-   |             -------- borrow of `foo` occurs here
+   |             -------- `foo` is borrowed here
 LL |     let _ = match foo {
    |                   ^^^ use of borrowed `foo`
 ...
@@ -13,7 +13,7 @@ error[E0503]: cannot use `foo.0` because it was mutably borrowed
   --> $DIR/borrowck-match-already-borrowed.rs:12:16
    |
 LL |     let p = &mut foo;
-   |             -------- borrow of `foo` occurs here
+   |             -------- `foo` is borrowed here
 ...
 LL |         Foo::A(x) => x
    |                ^ use of borrowed `foo`
@@ -25,7 +25,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/borrowck-match-already-borrowed.rs:22:9
    |
 LL |     let r = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 LL |     let _ = match x {
 LL |         x => x + 1,
    |         ^ use of borrowed `x`
@@ -37,7 +37,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/borrowck-match-already-borrowed.rs:23:9
    |
 LL |     let r = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 ...
 LL |         y => y + 2,
    |         ^ use of borrowed `x`
index 8ddc48b2a99cdf0711a8f7812e1f1c4f9c2ee49f..6eaa1fa3169321fdfeefcb49a50e2be5b1d010ee 100644 (file)
@@ -10,7 +10,7 @@ LL |         let _h = to_fn_once(move || -> isize { *bar });
    |                             |                  |
    |                             |                  variable moved due to use in closure
    |                             |                  move occurs because `bar` has type `Box<isize>`, which does not implement the `Copy` trait
-   |                             move out of `bar` occurs here
+   |                             `bar` is moved here
 
 error: aborting due to previous error
 
index f833abcc02acf83a4335359c739c0658ec4eda33..bd94f1a4299b808dc519713aca3357fe7b917199 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `*a` because it is borrowed
   --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:12:13
    |
+LL |     let a: Box<Box<_>> = Box::new(Box::new(2));
+   |         - binding `a` declared here
 LL |     let b = &a;
    |             -- borrow of `a` occurs here
 LL |
index 8c9083fcf135642d2ad1da46bb79bc55fd67ff53..341146bd18fd9496c7c0ca389c829d756ba432cd 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `a.x` because it is borrowed
   --> $DIR/borrowck-move-subcomponent.rs:15:14
    |
+LL |   let a : S = S { x : Box::new(1) };
+   |       - binding `a` declared here
 LL |   let pb = &a;
    |            -- borrow of `a` occurs here
 LL |   let S { x: ax } = a;
index f94cbc30db421d77c381e2f123be1c4b464b9bc5..70abe7b346e1a75aaab94c1cdc960aff27b15787 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `x1` because it is borrowed
   --> $DIR/borrowck-multiple-captures.rs:12:19
    |
+LL |     let x1: Box<_> = Box::new(1);
+   |         -- binding `x1` declared here
 LL |     let p1 = &x1;
    |              --- borrow of `x1` occurs here
 ...
@@ -16,6 +18,8 @@ LL |     borrow(&*p1);
 error[E0505]: cannot move out of `x2` because it is borrowed
   --> $DIR/borrowck-multiple-captures.rs:12:19
    |
+LL |     let x2: Box<_> = Box::new(2);
+   |         -- binding `x2` declared here
 LL |     let p2 = &x2;
    |              --- borrow of `x2` occurs here
 LL |     thread::spawn(move|| {
@@ -77,6 +81,8 @@ LL |         drop(x);
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/borrowck-multiple-captures.rs:38:19
    |
+LL |     let x: Box<_> = Box::new(1);
+   |         - binding `x` declared here
 LL |     let p = &x;
    |             -- borrow of `x` occurs here
 LL |     thread::spawn(move|| {
index 5d52e49191831a143109967ba8010c5ae5103d89..7f42becd21c2a48195af9fc96865de4e77cd1ff9 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `v` because it is borrowed
   --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:31:5
    |
 LL |     let i = &v[0].f;
-   |              - borrow of `v` occurs here
+   |              - `v` is borrowed here
 LL |     v = MyVec { x: MyPtr { x: Foo { f: 23 } } };
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `v` occurs here
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `v` is assigned to here but it was already borrowed
 LL |
 LL |     read(*i);
    |          -- borrow later used here
index 087f2ac799eebc3eff5668846b48e09d53af8b74..fb7af50bcb5650c7ab7c4659cc401c26ab590333 100644 (file)
@@ -42,9 +42,9 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed
   --> $DIR/borrowck-overloaded-index-autoderef.rs:71:5
    |
 LL |     let p = &f.foo[&s];
-   |              ----- borrow of `f.foo` occurs here
+   |              ----- `f.foo` is borrowed here
 LL |     f.foo = g;
-   |     ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
+   |     ^^^^^^^^^ `f.foo` is assigned to here but it was already borrowed
 LL |     p.use_ref();
    |     ----------- borrow later used here
 
@@ -52,9 +52,9 @@ error[E0506]: cannot assign to `*f` because it is borrowed
   --> $DIR/borrowck-overloaded-index-autoderef.rs:77:5
    |
 LL |     let p = &f.foo[&s];
-   |              ----- borrow of `*f` occurs here
+   |              ----- `*f` is borrowed here
 LL |     *f = g;
-   |     ^^^^^^ assignment to borrowed `*f` occurs here
+   |     ^^^^^^ `*f` is assigned to here but it was already borrowed
 LL |     p.use_ref();
    |     ----------- borrow later used here
 
@@ -62,9 +62,9 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed
   --> $DIR/borrowck-overloaded-index-autoderef.rs:83:5
    |
 LL |     let p = &mut f.foo[&s];
-   |                  ----- borrow of `f.foo` occurs here
+   |                  ----- `f.foo` is borrowed here
 LL |     f.foo = g;
-   |     ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
+   |     ^^^^^^^^^ `f.foo` is assigned to here but it was already borrowed
 LL |     p.use_mut();
    |     ----------- borrow later used here
 
@@ -72,9 +72,9 @@ error[E0506]: cannot assign to `*f` because it is borrowed
   --> $DIR/borrowck-overloaded-index-autoderef.rs:89:5
    |
 LL |     let p = &mut f.foo[&s];
-   |                  ----- borrow of `*f` occurs here
+   |                  ----- `*f` is borrowed here
 LL |     *f = g;
-   |     ^^^^^^ assignment to borrowed `*f` occurs here
+   |     ^^^^^^ `*f` is assigned to here but it was already borrowed
 LL |     p.use_mut();
    |     ----------- borrow later used here
 
index fb0e274c2919ab2958b9110b31ed8337cf3d617d..7f8cc74a7157a695bfa7b45fe47776384e97b5ec 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `s` because it is borrowed
   --> $DIR/borrowck-overloaded-index-move-index.rs:50:22
    |
+LL |     let mut s = "hello".to_string();
+   |         ----- binding `s` declared here
 LL |     let rs = &mut s;
    |              ------ borrow of `s` occurs here
 LL |
@@ -13,6 +15,8 @@ LL |     use_mut(rs);
 error[E0505]: cannot move out of `s` because it is borrowed
   --> $DIR/borrowck-overloaded-index-move-index.rs:53:7
    |
+LL |     let mut s = "hello".to_string();
+   |         ----- binding `s` declared here
 LL |     let rs = &mut s;
    |              ------ borrow of `s` occurs here
 ...
index 9e65ccf5a1913ea9b8bfedb6efec7198c6b491e2..b86a8693881a96aca5e8b5db0f40c0a68b3c60e5 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/borrowck-pat-reassign-binding.rs:10:11
    |
 LL |       Some(ref i) => {
-   |            ----- borrow of `x` occurs here
+   |            ----- `x` is borrowed here
 LL |           // But on this branch, `i` is an outstanding borrow
 LL |           x = Some(*i+1);
-   |           ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+   |           ^^^^^^^^^^^^^^ `x` is assigned to here but it was already borrowed
 LL |           drop(i);
    |                - borrow later used here
 
index 4bd7d54cffedacef1094d6e49cac88aeb5763c9b..a87a14e7cabd8fca08a63458e855f4772c952dd4 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `u.c` because it was mutably borrowed
   --> $DIR/borrowck-union-borrow-nested.rs:24:21
    |
 LL |             let ra = &mut u.s.a;
-   |                      ---------- borrow of `u.s.a` occurs here
+   |                      ---------- `u.s.a` is borrowed here
 LL |             let b = u.c;
    |                     ^^^ use of borrowed `u.s.a`
 LL |             ra.use_mut();
index 090c7b6b51a31cf27390e59e9cbdf0ee4a6555d6..11a28f6744b701da2a32a8f80ed862c882133859 100644 (file)
@@ -12,9 +12,9 @@ error[E0506]: cannot assign to `u.a` because it is borrowed
   --> $DIR/borrowck-union-borrow.rs:28:13
    |
 LL |             let ra = &u.a;
-   |                      ---- borrow of `u.a` occurs here
+   |                      ---- `u.a` is borrowed here
 LL |             u.a = 1;
-   |             ^^^^^^^ assignment to borrowed `u.a` occurs here
+   |             ^^^^^^^ `u.a` is assigned to here but it was already borrowed
 LL |             drop(ra);
    |                  -- borrow later used here
 
@@ -34,9 +34,9 @@ error[E0506]: cannot assign to `u.b` because it is borrowed
   --> $DIR/borrowck-union-borrow.rs:49:13
    |
 LL |             let ra = &u.a;
-   |                      ---- borrow of `u.b` occurs here
+   |                      ---- `u.b` is borrowed here
 LL |             u.b = 1;
-   |             ^^^^^^^ assignment to borrowed `u.b` occurs here
+   |             ^^^^^^^ `u.b` is assigned to here but it was already borrowed
 LL |             drop(ra);
    |                  -- borrow later used here
 
@@ -54,7 +54,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed
   --> $DIR/borrowck-union-borrow.rs:60:21
    |
 LL |             let ra = &mut u.a;
-   |                      -------- borrow of `u.a` occurs here
+   |                      -------- `u.a` is borrowed here
 LL |             let a = u.a;
    |                     ^^^ use of borrowed `u.a`
 LL |             drop(ra);
@@ -74,9 +74,9 @@ error[E0506]: cannot assign to `u.a` because it is borrowed
   --> $DIR/borrowck-union-borrow.rs:70:13
    |
 LL |             let rma = &mut u.a;
-   |                       -------- borrow of `u.a` occurs here
+   |                       -------- `u.a` is borrowed here
 LL |             u.a = 1;
-   |             ^^^^^^^ assignment to borrowed `u.a` occurs here
+   |             ^^^^^^^ `u.a` is assigned to here but it was already borrowed
 LL |             drop(rma);
    |                  --- borrow later used here
 
@@ -96,7 +96,7 @@ error[E0503]: cannot use `u.b` because it was mutably borrowed
   --> $DIR/borrowck-union-borrow.rs:81:21
    |
 LL |             let ra = &mut u.a;
-   |                      -------- borrow of `u.a` occurs here
+   |                      -------- `u.a` is borrowed here
 LL |             let b = u.b;
    |                     ^^^ use of borrowed `u.a`
 LL |
@@ -119,9 +119,9 @@ error[E0506]: cannot assign to `u.b` because it is borrowed
   --> $DIR/borrowck-union-borrow.rs:92:13
    |
 LL |             let rma = &mut u.a;
-   |                       -------- borrow of `u.b` occurs here
+   |                       -------- `u.b` is borrowed here
 LL |             u.b = 1;
-   |             ^^^^^^^ assignment to borrowed `u.b` occurs here
+   |             ^^^^^^^ `u.b` is assigned to here but it was already borrowed
 LL |             drop(rma);
    |                  --- borrow later used here
 
index 91d69c51e8180d6f931b44478974ee286397657e..4d300ae3c527b3c8610f6098c29298c7d624f444 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/borrowck-use-mut-borrow.rs:11:10
    |
 LL |     let p = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 LL |     drop(x);
    |          ^ use of borrowed `x`
 LL |     *p = 2;
@@ -12,7 +12,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/borrowck-use-mut-borrow.rs:18:10
    |
 LL |     let p = &mut x.a;
-   |             -------- borrow of `x.a` occurs here
+   |             -------- `x.a` is borrowed here
 LL |     drop(x);
    |          ^ use of borrowed `x.a`
 LL |     *p = 3;
@@ -22,7 +22,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed
   --> $DIR/borrowck-use-mut-borrow.rs:25:10
    |
 LL |     let p = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 LL |     drop(x.a);
    |          ^^^ use of borrowed `x`
 LL |     p.a = 3;
@@ -32,7 +32,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed
   --> $DIR/borrowck-use-mut-borrow.rs:32:10
    |
 LL |     let p = &mut x.a;
-   |             -------- borrow of `x.a` occurs here
+   |             -------- `x.a` is borrowed here
 LL |     drop(x.a);
    |          ^^^ use of borrowed `x.a`
 LL |     *p = 3;
@@ -42,7 +42,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed
   --> $DIR/borrowck-use-mut-borrow.rs:39:13
    |
 LL |     let p = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 LL |     let y = A { b: 3, .. x };
    |             ^^^^^^^^^^^^^^^^ use of borrowed `x`
 LL |     drop(y);
@@ -53,7 +53,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed
   --> $DIR/borrowck-use-mut-borrow.rs:47:13
    |
 LL |     let p = &mut x.a;
-   |             -------- borrow of `x.a` occurs here
+   |             -------- `x.a` is borrowed here
 LL |     let y = A { b: 3, .. x };
    |             ^^^^^^^^^^^^^^^^ use of borrowed `x.a`
 LL |     drop(y);
@@ -64,7 +64,7 @@ error[E0503]: cannot use `*x` because it was mutably borrowed
   --> $DIR/borrowck-use-mut-borrow.rs:55:10
    |
 LL |     let p = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 LL |     drop(*x);
    |          ^^ use of borrowed `x`
 LL |     **p = 2;
@@ -74,7 +74,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed
   --> $DIR/borrowck-use-mut-borrow.rs:62:10
    |
 LL |     let p = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 LL |     drop(*x.b);
    |          ^^^^ use of borrowed `x`
 LL |     p.a = 3;
@@ -84,7 +84,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed
   --> $DIR/borrowck-use-mut-borrow.rs:69:10
    |
 LL |     let p = &mut x.b;
-   |             -------- borrow of `x.b` occurs here
+   |             -------- `x.b` is borrowed here
 LL |     drop(*x.b);
    |          ^^^^ use of borrowed `x.b`
 LL |     **p = 3;
index 0ac7df944d78114ad1de4c57ea5eaac14fa2a8d7..494d8c351a152930852687740887b1342dd79cd8 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `a[_]` because it is borrowed
   --> $DIR/borrowck-vec-pattern-move-tail.rs:8:5
    |
 LL |         [1, 2, ref tail @ ..] => tail,
-   |                -------- borrow of `a[_]` occurs here
+   |                -------- `a[_]` is borrowed here
 ...
 LL |     a[2] = 0;
-   |     ^^^^^^^^ assignment to borrowed `a[_]` occurs here
+   |     ^^^^^^^^ `a[_]` is assigned to here but it was already borrowed
 LL |     println!("t[0]: {}", t[0]);
    |                          ---- borrow later used here
 
index 0e9284a2cadd26cf48564328da88ebe070829077..1bda7a4971375491003540a23cfc68c4a02887f5 100644 (file)
@@ -5,9 +5,9 @@ fn a() {
     let mut vec = [Box::new(1), Box::new(2), Box::new(3)];
     match vec {
         [box ref _a, _, _] => {
-        //~^ NOTE borrow of `vec[_]` occurs here
+        //~^ NOTE `vec[_]` is borrowed here
             vec[0] = Box::new(4); //~ ERROR cannot assign
-            //~^ NOTE assignment to borrowed `vec[_]` occurs here
+            //~^ NOTE `vec[_]` is assigned to here
             _a.use_ref();
             //~^ NOTE borrow later used here
         }
@@ -19,9 +19,9 @@ fn b() {
     let vec: &mut [Box<isize>] = &mut vec;
     match vec {
         &mut [ref _b @ ..] => {
-        //~^ borrow of `vec[_]` occurs here
+        //~^ `vec[_]` is borrowed here
             vec[0] = Box::new(4); //~ ERROR cannot assign
-            //~^ NOTE assignment to borrowed `vec[_]` occurs here
+            //~^ NOTE `vec[_]` is assigned to here
             _b.use_ref();
             //~^ NOTE borrow later used here
         }
index 0dc5e64e4ff3022ee92075d07b49bd3c2134729e..70b9e4f4433b34e8ae6926e2fd507c658bf92c15 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed
   --> $DIR/borrowck-vec-pattern-nesting.rs:9:13
    |
 LL |         [box ref _a, _, _] => {
-   |              ------ borrow of `vec[_]` occurs here
+   |              ------ `vec[_]` is borrowed here
 LL |
 LL |             vec[0] = Box::new(4);
-   |             ^^^^^^ assignment to borrowed `vec[_]` occurs here
+   |             ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
 LL |
 LL |             _a.use_ref();
    |             ------------ borrow later used here
@@ -14,10 +14,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed
   --> $DIR/borrowck-vec-pattern-nesting.rs:23:13
    |
 LL |         &mut [ref _b @ ..] => {
-   |               ------ borrow of `vec[_]` occurs here
+   |               ------ `vec[_]` is borrowed here
 LL |
 LL |             vec[0] = Box::new(4);
-   |             ^^^^^^ assignment to borrowed `vec[_]` occurs here
+   |             ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
 LL |
 LL |             _b.use_ref();
    |             ------------ borrow later used here
index da3412f112d7a9e4f064966d13fca062920bf222..27dab53e48fd5c93fad79b6af16e57d474b2b7a2 100644 (file)
@@ -5,7 +5,7 @@ LL |         $this.width.unwrap()
    |         ^^^^^^^^^^^ use of borrowed `*self`
 ...
 LL |         let r = &mut *self;
-   |                 ---------- borrow of `*self` occurs here
+   |                 ---------- `*self` is borrowed here
 LL |         r.get_size(width!(self))
    |           -------- ------------ in this macro invocation
    |           |
index 4abb6fb2c71868674dbf2266cd1c3afae61c9c71..3f7715645e60c28f56c0a17f1003daef69310409 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/issue-52713-bug.rs:12:5
    |
 LL |     let y = &x;
-   |             -- borrow of `x` occurs here
+   |             -- `x` is borrowed here
 ...
 LL |     x += 1;
-   |     ^^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^^ `x` is assigned to here but it was already borrowed
 LL |     println!("{}", y);
    |                    - borrow later used here
 
index 57803247ba8d05fa0ee37e700456d830d7558b81..0870b4237690e2b8040ee74cbc132292023c4079 100644 (file)
@@ -4,10 +4,10 @@ error[E0506]: cannot assign to `greeting` because it is borrowed
 LL |     let res = (|| (|| &greeting)())();
    |                --      -------- borrow occurs due to use in closure
    |                |
-   |                borrow of `greeting` occurs here
+   |                `greeting` is borrowed here
 LL |
 LL |     greeting = "DEALLOCATED".to_string();
-   |     ^^^^^^^^ assignment to borrowed `greeting` occurs here
+   |     ^^^^^^^^ `greeting` is assigned to here but it was already borrowed
 ...
 LL |     println!("thread result: {:?}", res);
    |                                     --- borrow later used here
index d79394834dcad615cab6f1d3dfc8a0c0f63b8392..0d803b0427ace43bfbf752f704fa7bc85f5bdc59 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
   --> $DIR/issue-81365-1.rs:21:9
    |
 LL |         let first = &self.target_field;
-   |                      ---- borrow of `self.container_field` occurs here
+   |                      ---- `self.container_field` is borrowed here
 LL |         self.container_field = true;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
 LL |         first;
    |         ----- borrow later used here
    |
index 27123ef2be1ef91355c9f789a0aad0fd75cc8f08..d0986e9f922e656ca3d21f32db01b9be30af287d 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
   --> $DIR/issue-81365-10.rs:21:9
    |
 LL |         let first = &self.deref().target_field;
-   |                      ------------ borrow of `self.container_field` occurs here
+   |                      ------------ `self.container_field` is borrowed here
 LL |         self.container_field = true;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
 LL |         first;
    |         ----- borrow later used here
 
index 0770c136632db1f9603c2d6ef0e68ab8c6331a5e..5f7e86f11dcd1daeb15ba92f150e9458b27bcbe6 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
   --> $DIR/issue-81365-11.rs:27:9
    |
 LL |         let first = &mut self.target_field;
-   |                          ---- borrow of `self.container_field` occurs here
+   |                          ---- `self.container_field` is borrowed here
 LL |         self.container_field = true;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
 LL |         first;
    |         ----- borrow later used here
 
index 764eaaa7cc7b4cb253846e71101af7b2e13c60f8..d9aeaf15f2002679a8867f852e2035387f84b600 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container.container_field` because it is bo
   --> $DIR/issue-81365-2.rs:25:9
    |
 LL |         let first = &self.container.target_field;
-   |                      -------------- borrow of `self.container.container_field` occurs here
+   |                      -------------- `self.container.container_field` is borrowed here
 LL |         self.container.container_field = true;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container.container_field` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container.container_field` is assigned to here but it was already borrowed
 LL |         first;
    |         ----- borrow later used here
    |
index 9447174fd21ea2e7dbb1568f38ea9f1f688e110a..0c0d1994baff2a3359b782aeb8f24eb79098d536 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container.container_field` because it is bo
   --> $DIR/issue-81365-3.rs:32:9
    |
 LL |         let first = &self.target_field;
-   |                      ---- borrow of `self.container.container_field` occurs here
+   |                      ---- `self.container.container_field` is borrowed here
 LL |         self.container.container_field = true;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container.container_field` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container.container_field` is assigned to here but it was already borrowed
 LL |         first;
    |         ----- borrow later used here
    |
index 0ab3fa92706b059b525a522237778c9f741ce922..98093daa94520ca577eff8b80250fe28d4cb8307 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.outer_field` because it is borrowed
   --> $DIR/issue-81365-4.rs:33:9
    |
 LL |         let first = &self.target_field;
-   |                      ---- borrow of `self.outer_field` occurs here
+   |                      ---- `self.outer_field` is borrowed here
 LL |         self.outer_field = true;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.outer_field` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^^ `self.outer_field` is assigned to here but it was already borrowed
 LL |         first;
    |         ----- borrow later used here
    |
index 20ff229ffe7dd3ed1c6e9aedd1980c0eefe8dd26..c00e48288ba075985af16bcef0309e9117362770 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
   --> $DIR/issue-81365-5.rs:28:9
    |
 LL |         let first = self.get();
-   |                     ---------- borrow of `self.container_field` occurs here
+   |                     ---------- `self.container_field` is borrowed here
 LL |         self.container_field = true;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
 LL |         first;
    |         ----- borrow later used here
    |
index 575aed73b4663107b2a0232e864cd429e741c0a9..e61dc95ecc8fad2526d5145e04336c0170a9a33c 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
   --> $DIR/issue-81365-6.rs:18:9
    |
 LL |         let first = &self[0];
-   |                      ---- borrow of `self.container_field` occurs here
+   |                      ---- `self.container_field` is borrowed here
 LL |         self.container_field = true;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
 LL |         first;
    |         ----- borrow later used here
    |
index 52d2d9e75a9515c317fa7cc8d7bb550d090427ea..0565127e3875be859af07a4c8697ce88fdb76062 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `c.container_field` because it is borrowed
   --> $DIR/issue-81365-7.rs:20:5
    |
 LL |     let first = &c.target_field;
-   |                  - borrow of `c.container_field` occurs here
+   |                  - `c.container_field` is borrowed here
 LL |     c.container_field = true;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `c.container_field` occurs here
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ `c.container_field` is assigned to here but it was already borrowed
 LL |     first;
    |     ----- borrow later used here
    |
index fd83e10a295dc10f47913308cacdc8c58c94c28d..0ca732ff2ae434b6709cf120c39cdbc23a4f838b 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
   --> $DIR/issue-81365-8.rs:21:9
    |
 LL |         let first = &(*self).target_field;
-   |                      ------- borrow of `self.container_field` occurs here
+   |                      ------- `self.container_field` is borrowed here
 LL |         self.container_field = true;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
 LL |         first;
    |         ----- borrow later used here
    |
index c7d48214fd4a81bb9abeaf08aa9b8f6b983a8074..4d305268a0b33d5841baecb7e28ebe8f67a35149 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
   --> $DIR/issue-81365-9.rs:21:9
    |
 LL |         let first = &Deref::deref(self).target_field;
-   |                                   ---- borrow of `self.container_field` occurs here
+   |                                   ---- `self.container_field` is borrowed here
 LL |         self.container_field = true;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
 LL |         first;
    |         ----- borrow later used here
 
index a57ceb847394563448a27e5c98711b60c6814ef9..1356c80493cdb8b441d368913d1b7c3fe6b790a9 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `i` because it was mutably borrowed
   --> $DIR/two-phase-allow-access-during-reservation.rs:26:19
    |
 LL |     /*1*/ let p = &mut i; // (reservation of `i` starts here)
-   |                   ------ borrow of `i` occurs here
+   |                   ------ `i` is borrowed here
 LL |
 LL |     /*2*/ let j = i;      // OK: `i` is only reserved here
    |                   ^ use of borrowed `i`
@@ -14,7 +14,7 @@ error[E0503]: cannot use `i` because it was mutably borrowed
   --> $DIR/two-phase-allow-access-during-reservation.rs:31:19
    |
 LL |     /*1*/ let p = &mut i; // (reservation of `i` starts here)
-   |                   ------ borrow of `i` occurs here
+   |                   ------ `i` is borrowed here
 ...
 LL |     /*4*/ let k = i;
    |                   ^ use of borrowed `i`
index 5a240d90011e4ea64d9232947dd260f1a647ad6b..e75094d4f1309eba7f17640e89c340de14195a6f 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `self.cx` because it was mutably borrowed
   --> $DIR/two-phase-surprise-no-conflict.rs:21:23
    |
 LL |         let _mut_borrow = &mut *self;
-   |                           ---------- borrow of `*self` occurs here
+   |                           ---------- `*self` is borrowed here
 LL |         let _access = self.cx;
    |                       ^^^^^^^ use of borrowed `*self`
 LL |
index e953e7ae82bb8443f17b230b9d465d2d5315a633..d405e465aaeea2e27f87ed94748748a127b5646d 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `s` because it is borrowed
   --> $DIR/btreemap_dropck.rs:15:10
    |
+LL |     let s = String::from("Hello World!");
+   |         - binding `s` declared here
 LL |     let _map = BTreeMap::from_iter([((), PrintOnDrop(&s))]);
    |                                                      -- borrow of `s` occurs here
 LL |     drop(s);
index 6f8e53298ace2ccf88385f2b5b7f181ab6ac5da7..c9d90d73dea318d661ddee493307401b6d07de8a 100644 (file)
@@ -107,7 +107,9 @@ error[E0597]: `ap1` does not live long enough
   --> $DIR/variadic-ffi-4.rs:28:11
    |
 LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
-   |                                                        - let's call the lifetime of this reference `'3`
+   |                                                        -                ------- binding `ap1` declared here
+   |                                                        |
+   |                                                        let's call the lifetime of this reference `'3`
 LL |     ap0 = &mut ap1;
    |     ------^^^^^^^^
    |     |     |
index 4f41060dc9842c8a304a2ea1bf2d81cec1b61fdb..9e5200ef34b54204a4b5fa37748cea128a01850a 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `arr` because it was mutably borrowed
   --> $DIR/arrays.rs:14:5
    |
 LL |     let mut c = || {
-   |                 -- borrow of `arr` occurs here
+   |                 -- `arr` is borrowed here
 LL |         arr[0] += 10;
    |         --- borrow occurs due to use of `arr` in closure
 ...
@@ -16,7 +16,7 @@ error[E0503]: cannot use `arr[_]` because it was mutably borrowed
   --> $DIR/arrays.rs:14:5
    |
 LL |     let mut c = || {
-   |                 -- borrow of `arr` occurs here
+   |                 -- `arr` is borrowed here
 LL |         arr[0] += 10;
    |         --- borrow occurs due to use of `arr` in closure
 ...
@@ -30,12 +30,12 @@ error[E0506]: cannot assign to `arr[_]` because it is borrowed
   --> $DIR/arrays.rs:29:5
    |
 LL |     let c = || {
-   |             -- borrow of `arr[_]` occurs here
+   |             -- `arr[_]` is borrowed here
 LL |         println!("{:#?}", &arr[3..4]);
    |                            --- borrow occurs due to use in closure
 ...
 LL |     arr[1] += 10;
-   |     ^^^^^^^^^^^^ assignment to borrowed `arr[_]` occurs here
+   |     ^^^^^^^^^^^^ `arr[_]` is assigned to here but it was already borrowed
 LL |
 LL |     c();
    |     - borrow later used here
@@ -44,12 +44,12 @@ error[E0506]: cannot assign to `arr[_]` because it is borrowed
   --> $DIR/arrays.rs:43:5
    |
 LL |     let c = || {
-   |             -- borrow of `arr[_]` occurs here
+   |             -- `arr[_]` is borrowed here
 LL |         println!("{}", arr[3]);
    |                        --- borrow occurs due to use in closure
 ...
 LL |     arr[1] += 10;
-   |     ^^^^^^^^^^^^ assignment to borrowed `arr[_]` occurs here
+   |     ^^^^^^^^^^^^ `arr[_]` is assigned to here but it was already borrowed
 LL |
 LL |     c();
    |     - borrow later used here
@@ -58,7 +58,7 @@ error[E0503]: cannot use `arr` because it was mutably borrowed
   --> $DIR/arrays.rs:57:20
    |
 LL |     let mut c = || {
-   |                 -- borrow of `arr` occurs here
+   |                 -- `arr` is borrowed here
 LL |         arr[1] += 10;
    |         --- borrow occurs due to use of `arr` in closure
 ...
index f8b178752351acbb2bc54d2cdd4953e04c2c40fc..2e3259e64059615f8eedb4a9c988f0fbcdfa6922 100644 (file)
@@ -2,12 +2,12 @@ error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed
   --> $DIR/box.rs:21:5
    |
 LL |     let mut c = || {
-   |                 -- borrow of `e.0.0.m.x` occurs here
+   |                 -- `e.0.0.m.x` is borrowed here
 LL |         e.0.0.m.x = format!("not-x");
    |         --------- borrow occurs due to use in closure
 ...
 LL |     e.0.0.m.x = format!("not-x");
-   |     ^^^^^^^^^ assignment to borrowed `e.0.0.m.x` occurs here
+   |     ^^^^^^^^^ `e.0.0.m.x` is assigned to here but it was already borrowed
 LL |
 LL |     c();
    |     - borrow later used here
@@ -32,12 +32,12 @@ error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed
   --> $DIR/box.rs:55:5
    |
 LL |     let c = || {
-   |             -- borrow of `e.0.0.m.x` occurs here
+   |             -- `e.0.0.m.x` is borrowed here
 LL |         println!("{}", e.0.0.m.x);
    |                        --------- borrow occurs due to use in closure
 ...
 LL |     e.0.0.m.x = format!("not-x");
-   |     ^^^^^^^^^ assignment to borrowed `e.0.0.m.x` occurs here
+   |     ^^^^^^^^^ `e.0.0.m.x` is assigned to here but it was already borrowed
 LL |
 LL |     c();
    |     - borrow later used here
index 46b54846e32ebdc1960692c7ca0204bec7ac94f6..695337ea82cf9fadc2f22ae1fe2c99069c124646 100644 (file)
@@ -11,7 +11,7 @@ union A {
 fn main() {
     let mut a = A { y: 1 };
     let mut c = || {
-    //~^ borrow of `a.y` occurs here
+    //~^ `a.y` is borrowed here
         let _ = unsafe { &a.y };
         let _ = &mut a;
         //~^ borrow occurs due to use in closure
@@ -19,7 +19,7 @@ fn main() {
     };
     a.y = 1;
     //~^ cannot assign to `a.y` because it is borrowed [E0506]
-    //~| assignment to borrowed `a.y` occurs here
+    //~| `a.y` is assigned to here
     c();
     //~^ borrow later used here
 }
index 7c34e2336c867487444c10479c9d8b43e81cfad8..17834e6123628a1f47df5152ebd8a7bc71b1831b 100644 (file)
@@ -2,13 +2,13 @@ error[E0506]: cannot assign to `a.y` because it is borrowed
   --> $DIR/union.rs:20:5
    |
 LL |     let mut c = || {
-   |                 -- borrow of `a.y` occurs here
+   |                 -- `a.y` is borrowed here
 ...
 LL |         let _ = &mut a;
    |                      - borrow occurs due to use in closure
 ...
 LL |     a.y = 1;
-   |     ^^^^^^^ assignment to borrowed `a.y` occurs here
+   |     ^^^^^^^ `a.y` is assigned to here but it was already borrowed
 ...
 LL |     c();
    |     - borrow later used here
index d067c3b3a18056c1f3e5bb5c79b02da297ae17c5..d412b8b08b79a8a865d784560db0945c1b1c9d0f 100644 (file)
@@ -13,10 +13,10 @@ error[E0506]: cannot assign to `**x` because it is borrowed
   --> $DIR/coerce-overloaded-autoderef-fail.rs:17:5
    |
 LL |     let y = borrow(x);
-   |                    - borrow of `**x` occurs here
+   |                    - `**x` is borrowed here
 LL |     let z = borrow(x);
 LL |     **x += 1;
-   |     ^^^^^^^^ assignment to borrowed `**x` occurs here
+   |     ^^^^^^^^ `**x` is assigned to here but it was already borrowed
 LL |
 LL |     drop((y, z));
    |           - borrow later used here
index 975a235a6495b6f3a587bd2306e3086c5f7fb901..6e0349a4773cdd8ee77cd9d390ce0cfa8d731f83 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `y` does not live long enough
 LL |     let x: &'static u32 = {
    |            ------------ type annotation requires that `y` is borrowed for `'static`
 LL |         let y = 42;
+   |             - binding `y` declared here
 LL |         &y
    |         ^^ borrowed value does not live long enough
 LL |     };
index 5d53405579d9d0b057ef7575113eab948bc02367..23d57634e8fd2e19e55b63c40b3f43736056f342 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `c_shortest` does not live long enough
   --> $DIR/dropck-eyepatch-extern-crate.rs:46:23
    |
+LL |         let (mut dt, mut dr, c_shortest): (Dt<_>, Dr<_>, Cell<_>);
+   |                              ---------- binding `c_shortest` declared here
+...
 LL |         dt = Dt("dt", &c_shortest);
    |                       ^^^^^^^^^^^ borrowed value does not live long enough
 ...
@@ -15,6 +18,9 @@ LL |     }
 error[E0597]: `c_shortest` does not live long enough
   --> $DIR/dropck-eyepatch-extern-crate.rs:68:32
    |
+LL |         let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>);
+   |                              ---------- binding `c_shortest` declared here
+...
 LL |         pt = Pt("pt", &c_long, &c_shortest);
    |                                ^^^^^^^^^^^ borrowed value does not live long enough
 ...
index 5055cdd8b2bf92d0792f0e5559207e8650cd22f1..a5d5136b5c578bd530e51577c48bc4b95087461b 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `c_shortest` does not live long enough
   --> $DIR/dropck-eyepatch-reorder.rs:64:23
    |
+LL |         let (mut dt, mut dr, c_shortest): (Dt<_>, Dr<_>, Cell<_>);
+   |                              ---------- binding `c_shortest` declared here
+...
 LL |         dt = Dt("dt", &c_shortest);
    |                       ^^^^^^^^^^^ borrowed value does not live long enough
 ...
@@ -15,6 +18,9 @@ LL |     }
 error[E0597]: `c_shortest` does not live long enough
   --> $DIR/dropck-eyepatch-reorder.rs:86:32
    |
+LL |         let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>);
+   |                              ---------- binding `c_shortest` declared here
+...
 LL |         pt = Pt("pt", &c_long, &c_shortest);
    |                                ^^^^^^^^^^^ borrowed value does not live long enough
 ...
index 21295e6c6019e4f6fb966fa76bf5f25e09c9cfbc..dc3f8c05e7396445176b4efc58f7739aeb0c3f20 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `c_shortest` does not live long enough
   --> $DIR/dropck-eyepatch.rs:88:23
    |
+LL |         let (mut dt, mut dr, c_shortest): (Dt<_>, Dr<_>, Cell<_>);
+   |                              ---------- binding `c_shortest` declared here
+...
 LL |         dt = Dt("dt", &c_shortest);
    |                       ^^^^^^^^^^^ borrowed value does not live long enough
 ...
@@ -15,6 +18,9 @@ LL |     }
 error[E0597]: `c_shortest` does not live long enough
   --> $DIR/dropck-eyepatch.rs:110:32
    |
+LL |         let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>);
+   |                              ---------- binding `c_shortest` declared here
+...
 LL |         pt = Pt("pt", &c_long, &c_shortest);
    |                                ^^^^^^^^^^^ borrowed value does not live long enough
 ...
index 854e29385a81bcc04785808f7410b4110d4d3d97..7d48e9fdcee3192c0a8266585cbe726cd8ab9cbb 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `v` does not live long enough
   --> $DIR/dropck-union.rs:37:18
    |
+LL |     let v : Wrap<C> = Wrap::new(C(Cell::new(None)));
+   |         - binding `v` declared here
 LL |     v.0.set(Some(&v));
    |                  ^^ borrowed value does not live long enough
 LL | }
index dc3fbed593b796d07925ca5089eb0b89bf3a1eb5..4d4f7b9df11799e4ede4246fd7602c93c98bfb6e 100644 (file)
@@ -2,7 +2,7 @@ error[E0597]: `o2` does not live long enough
   --> $DIR/dropck_trait_cycle_checked.rs:111:13
    |
 LL |     let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
-   |                                                                     -------- cast requires that `o2` is borrowed for `'static`
+   |              -- binding `o2` declared here                          -------- cast requires that `o2` is borrowed for `'static`
 LL |     o1.set0(&o2);
    |             ^^^ borrowed value does not live long enough
 ...
@@ -13,7 +13,7 @@ error[E0597]: `o3` does not live long enough
   --> $DIR/dropck_trait_cycle_checked.rs:112:13
    |
 LL |     let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
-   |                                                                     -------- cast requires that `o3` is borrowed for `'static`
+   |                  -- binding `o3` declared here                      -------- cast requires that `o3` is borrowed for `'static`
 LL |     o1.set0(&o2);
 LL |     o1.set1(&o3);
    |             ^^^ borrowed value does not live long enough
@@ -25,7 +25,7 @@ error[E0597]: `o2` does not live long enough
   --> $DIR/dropck_trait_cycle_checked.rs:113:13
    |
 LL |     let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
-   |                                                                               -------- cast requires that `o2` is borrowed for `'static`
+   |              -- binding `o2` declared here                                    -------- cast requires that `o2` is borrowed for `'static`
 ...
 LL |     o2.set0(&o2);
    |             ^^^ borrowed value does not live long enough
@@ -37,7 +37,7 @@ error[E0597]: `o3` does not live long enough
   --> $DIR/dropck_trait_cycle_checked.rs:114:13
    |
 LL |     let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
-   |                                                                               -------- cast requires that `o3` is borrowed for `'static`
+   |                  -- binding `o3` declared here                                -------- cast requires that `o3` is borrowed for `'static`
 ...
 LL |     o2.set1(&o3);
    |             ^^^ borrowed value does not live long enough
@@ -49,7 +49,7 @@ error[E0597]: `o1` does not live long enough
   --> $DIR/dropck_trait_cycle_checked.rs:115:13
    |
 LL |     let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
-   |                                                                                         -------- cast requires that `o1` is borrowed for `'static`
+   |          -- binding `o1` declared here                                                  -------- cast requires that `o1` is borrowed for `'static`
 ...
 LL |     o3.set0(&o1);
    |             ^^^ borrowed value does not live long enough
@@ -61,7 +61,7 @@ error[E0597]: `o2` does not live long enough
   --> $DIR/dropck_trait_cycle_checked.rs:116:13
    |
 LL |     let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
-   |                                                                                         -------- cast requires that `o2` is borrowed for `'static`
+   |              -- binding `o2` declared here                                              -------- cast requires that `o2` is borrowed for `'static`
 ...
 LL |     o3.set1(&o2);
    |             ^^^ borrowed value does not live long enough
index 957e98bbeee96c7e6e38569fa3ad5577a735be4e..1254250bcbd85cb91a8e43b53a5f47dcccc46c50 100644 (file)
@@ -3,7 +3,9 @@ error[E0597]: `f1` does not live long enough
    |
 LL | fn baz<'a>() {
    |        -- lifetime `'a` defined here
-...
+LL |     // With a vec of ints.
+LL |     let f1 = Fat { ptr: [1, 2, 3] };
+   |         -- binding `f1` declared here
 LL |     let f2: &Fat<[isize; 3]> = &f1;
    |                                ^^^ borrowed value does not live long enough
 LL |     let f3: &'a Fat<[isize]> = f2;
@@ -18,6 +20,8 @@ error[E0597]: `f1` does not live long enough
 LL | fn baz<'a>() {
    |        -- lifetime `'a` defined here
 ...
+LL |     let f1 = Fat { ptr: Foo };
+   |         -- binding `f1` declared here
 LL |     let f2: &Fat<Foo> = &f1;
    |                         ^^^ borrowed value does not live long enough
 LL |     let f3: &'a Fat<dyn Bar> = f2;
@@ -32,6 +36,8 @@ error[E0597]: `f1` does not live long enough
 LL | fn baz<'a>() {
    |        -- lifetime `'a` defined here
 ...
+LL |     let f1 = ([1, 2, 3],);
+   |         -- binding `f1` declared here
 LL |     let f2: &([isize; 3],) = &f1;
    |                              ^^^ borrowed value does not live long enough
 LL |     let f3: &'a ([isize],) = f2;
@@ -46,6 +52,8 @@ error[E0597]: `f1` does not live long enough
 LL | fn baz<'a>() {
    |        -- lifetime `'a` defined here
 ...
+LL |     let f1 = (Foo,);
+   |         -- binding `f1` declared here
 LL |     let f2: &(Foo,) = &f1;
    |                       ^^^ borrowed value does not live long enough
 LL |     let f3: &'a (dyn Bar,) = f2;
index fafe363eb47a6c05ecfa81883c917171d6eac6a6..2f02e3b1a613818270858b301bd3e55b7f720c85 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `value` because it was mutably borrowed
   --> $DIR/E0503.rs:4:16
    |
 LL |     let _borrow = &mut value;
-   |                   ---------- borrow of `value` occurs here
+   |                   ---------- `value` is borrowed here
 LL |     let _sum = value + 1;
    |                ^^^^^ use of borrowed `value`
 LL |     _borrow.use_mut();
index e677e8916154240fb531b4e282c1871393e908de..20e16a5381061af846c2e6b9e8838a83e57f043e 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `fancy_num` because it is borrowed
   --> $DIR/E0504.rs:9:13
    |
+LL |     let fancy_num = FancyNum { num: 5 };
+   |         --------- binding `fancy_num` declared here
 LL |     let fancy_ref = &fancy_num;
    |                     ---------- borrow of `fancy_num` occurs here
 LL |
index bd3f37f54e0a88486417d2a7b786fcc1f2e42d7c..2ecb4a75c4382627f26865584ebfbd8af731fee7 100644 (file)
@@ -1,6 +1,9 @@
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/E0505.rs:9:13
    |
+LL |     let x = Value{};
+   |         - binding `x` declared here
+LL |     {
 LL |         let _ref_to_val: &Value = &x;
    |                                   -- borrow of `x` occurs here
 LL |         eat(x);
index d70406b750afcf6cb04f1e3f7945b9e6ef9e68c0..17ad7c611f824eef6a68d59e56ba40eebbd68317 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `fancy_num` because it is borrowed
   --> $DIR/E0506.rs:8:5
    |
 LL |     let fancy_ref = &fancy_num;
-   |                     ---------- borrow of `fancy_num` occurs here
+   |                     ---------- `fancy_num` is borrowed here
 LL |     fancy_num = FancyNum { num: 6 };
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `fancy_num` is assigned to here but it was already borrowed
 LL |
 LL |     println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
    |                                                 ------------- borrow later used here
index b4a1180ad546c8903171c5e9c21434dbbb0d9ff0..82e3481b65a593ba17f019d7f546c46ba58bebd0 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `y` does not live long enough
   --> $DIR/E0597.rs:8:16
    |
+LL |     let y = 0;
+   |         - binding `y` declared here
 LL |     x.x = Some(&y);
    |                ^^ borrowed value does not live long enough
 LL |
index fcbaa91d19f82d1a1833c8eaa96705792003c50b..4df639232a332436b0d122f23980c199a8b5e5b4 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/implied-bounds-unnorm-associated-type-4.rs:21:10
    |
+LL |     let x = String::from("Hello World!");
+   |         - binding `x` declared here
 LL |     let y = f(&x, ());
    |               -- borrow of `x` occurs here
 LL |     drop(x);
index e35f46e4439a90b1c9e94ac8396b8a2077b9851b..d417f28839368978f54d413405094cac3147a068 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/implied-bounds-unnorm-associated-type.rs:20:10
    |
+LL |     let x = String::from("Hello World!");
+   |         - binding `x` declared here
 LL |     let y = f(&x, ());
    |               -- borrow of `x` occurs here
 LL |     drop(x);
index cacc973077ce72f9c918db182135d505b0a77aac..b93ee37987f272b96888c48506c2c8d2cc534a26 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `a` does not live long enough
 LL | fn bug<'a, T: ?Sized + Fun<F<'a> = [u8]>>(_ : Box<T>) -> &'static T::F<'a> {
    |        -- lifetime `'a` defined here
 LL |     let a = [0; 1];
+   |         - binding `a` declared here
 LL |     let _x = T::identity(&a);
    |              ------------^^-
    |              |           |
index 4886a3c8bad62925aec0d2e0500d52c5ba7a3c30..25af011e3fc410049cc0a39322f06044556a0431 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/hrtb-identity-fn-borrows.rs:14:5
    |
 LL |     let y = f.call(&x);
-   |                    -- borrow of `x` occurs here
+   |                    -- `x` is borrowed here
 LL |     x = 5;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 ...
 LL |     drop(y);
    |          - borrow later used here
index 601e53b7694596631c84c67ada9e54e958519058..b9b8d00ce308b7463efac35c5c51a5725380f309 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `bar` does not live long enough
 LL |         let x = {
    |             - borrow later stored here
 LL |             let bar = 22;
+   |                 --- binding `bar` declared here
 LL |             Foo::new(&bar).into()
    |                      ^^^^ borrowed value does not live long enough
 LL |
@@ -16,6 +17,7 @@ error[E0597]: `y` does not live long enough
 LL |         let x = {
    |             - borrow later stored here
 LL |             let y = ();
+   |                 - binding `y` declared here
 LL |             foo(&y)
    |                 ^^ borrowed value does not live long enough
 LL |
@@ -28,6 +30,7 @@ error[E0597]: `y` does not live long enough
 LL |         let x = {
    |             - borrow later stored here
 LL |             let y = ();
+   |                 - binding `y` declared here
 LL |             foo(&y)
    |                 ^^ borrowed value does not live long enough
 LL |
index d0249e74f39e966939434ac403c5ea4417e2740e..307899297bc01664fa71c38d2f01b42e30130013 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/assoc-ty-wf-used-to-get-assoc-ty.rs:24:31
    |
+LL |     let x: u8 = 3;
+   |         - binding `x` declared here
 LL |     let _: &'static u8 = test(&x, &&3);
    |                          -----^^------
    |                          |    |
index a23f7c9a796c53b1a74726d14c1efccdcadb12f0..443fcf89c4e11d1aa8c5f6c0ee2a02e4b41bcac3 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `y` does not live long enough
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
 LL |     let y = ();
+   |         - binding `y` declared here
 LL |     equate(InvariantRef::new(&y), const { InvariantRef::<'a>::NEW });
    |            ------------------^^-
    |            |                 |
index fb4ecab362db1f61ffb9a7880f7a57a85a114583..db5d064379a76a40a52bd5420adf1bf9bd0e1191 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `*refr` because it is borrowed
   --> $DIR/issue-40288.rs:16:5
    |
 LL |     save_ref(&*refr, &mut out);
-   |              ------ borrow of `*refr` occurs here
+   |              ------ `*refr` is borrowed here
 ...
 LL |     *refr = 3;
-   |     ^^^^^^^^^ assignment to borrowed `*refr` occurs here
+   |     ^^^^^^^^^ `*refr` is assigned to here but it was already borrowed
 ...
 LL |     println!("{:?}", out[0]);
    |                      ------ borrow later used here
index 30c69f19658c84e0240bdc95a22938fd7a16133b..474313398e2bc35092cb0b5d4f5f5c5fbb395d27 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
   --> $DIR/issue-45697-1.rs:20:9
    |
 LL |         let z = copy_borrowed_ptr(&mut y);
-   |                                   ------ borrow of `y` occurs here
+   |                                   ------ `y` is borrowed here
 LL |         *y.pointer += 1;
    |         ^^^^^^^^^^^^^^^ use of borrowed `y`
 ...
@@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed
   --> $DIR/issue-45697-1.rs:20:9
    |
 LL |         let z = copy_borrowed_ptr(&mut y);
-   |                                   ------ borrow of `*y.pointer` occurs here
+   |                                   ------ `*y.pointer` is borrowed here
 LL |         *y.pointer += 1;
-   |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
+   |         ^^^^^^^^^^^^^^^ `*y.pointer` is assigned to here but it was already borrowed
 ...
 LL |         *z.pointer += 1;
    |         --------------- borrow later used here
index 26749d36f0b7b69495db9ca915c2068788f1c65f..7986fd5c9df2e0b85bf8ea00d2091ec5303ba173 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
   --> $DIR/issue-45697.rs:20:9
    |
 LL |         let z = copy_borrowed_ptr(&mut y);
-   |                                   ------ borrow of `y` occurs here
+   |                                   ------ `y` is borrowed here
 LL |         *y.pointer += 1;
    |         ^^^^^^^^^^^^^^^ use of borrowed `y`
 ...
@@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed
   --> $DIR/issue-45697.rs:20:9
    |
 LL |         let z = copy_borrowed_ptr(&mut y);
-   |                                   ------ borrow of `*y.pointer` occurs here
+   |                                   ------ `*y.pointer` is borrowed here
 LL |         *y.pointer += 1;
-   |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
+   |         ^^^^^^^^^^^^^^^ `*y.pointer` is assigned to here but it was already borrowed
 ...
 LL |         *z.pointer += 1;
    |         --------------- borrow later used here
index b09f31729a5fdcc366e694af63094c94b9bac1c5..2ae6e709d5ad5c5235584fdfd4bb086bfb098834 100644 (file)
@@ -1,11 +1,10 @@
 error[E0597]: `z` does not live long enough
   --> $DIR/issue-46471-1.rs:4:9
    |
+LL |         let mut z = 0;
+   |             ----- binding `z` declared here
 LL |         &mut z
-   |         ^^^^^^
-   |         |
-   |         borrowed value does not live long enough
-   |         borrow later used here
+   |         ^^^^^^ borrowed value does not live long enough
 LL |     };
    |     - `z` dropped here while still borrowed
 
index 99e1e7217b45ce2318f07df0f0c37689a9858450..3602de8dd9577079f2bb7b6f5e2e9c2dfd9ad769 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `foo` does not live long enough
   --> $DIR/issue-90600-expected-return-static-indirect.rs:7:32
    |
+LL | fn inner(mut foo: &[u8]) {
+   |          ------- binding `foo` declared here
 LL |     let refcell = RefCell::new(&mut foo);
    |                                ^^^^^^^^ borrowed value does not live long enough
 LL |
index 6583546aa5c1fe70bbecdb12f294372a20dcdd7c..5f2074edb12407bf0ab8b4b128cf48846a4f75f2 100644 (file)
@@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*foo` because it is borrowed
   --> $DIR/mut-pattern-internal-mutability.rs:13:5
    |
 LL |     let &mut ref x = foo;
-   |              ----- borrow of `*foo` occurs here
+   |              ----- `*foo` is borrowed here
 LL |     *foo += 1;
-   |     ^^^^^^^^^ assignment to borrowed `*foo` occurs here
+   |     ^^^^^^^^^ `*foo` is assigned to here but it was already borrowed
 LL |     drop(x);
    |          - borrow later used here
 
index d629caa435319c355347a94dabec6360edff860e..1cca4077d825ac1bbc163ad71ac88944cb041f37 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough
 LL |     let x = gimme({
    |             ----- borrow later used by call
 LL |         let v = (22,);
+   |             - binding `v` declared here
 LL |         &v
    |         ^^ borrowed value does not live long enough
 LL |
index 9d4682667dddddbfcf9032509fab39eed1badccf..33e3eb797969e36f92e62f9615ebe111e503ea61 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `e` because it was mutably borrowed
   --> $DIR/borrowed-match-issue-45045.rs:12:11
    |
 LL |     let f = &mut e;
-   |             ------ borrow of `e` occurs here
+   |             ------ `e` is borrowed here
 LL |     let g = f;
 LL |     match e {
    |           ^ use of borrowed `e`
index cdfe7f6db82a929eb29c4c6f1f7e608aaa4b7004..84b7ecf2f7da82c3e3e8cc10d058b17c981742a2 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `y` does not live long enough
   --> $DIR/capture-ref-in-struct.rs:18:16
    |
+LL |         let y = 22;
+   |             - binding `y` declared here
+...
 LL |             y: &y,
    |                ^^ borrowed value does not live long enough
 ...
index 0a09353b8ec0a52f941f11331dd54b180b04e1e7..035dd5a561096cbaef671a20e200204ca6a0b1b0 100644 (file)
@@ -38,7 +38,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/closure-access-spans.rs:23:13
    |
 LL |     let r = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 LL |     move || x;
    |             ^ use of borrowed `x`
 LL |     r.use_ref();
@@ -47,6 +47,8 @@ LL |     r.use_ref();
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/closure-access-spans.rs:29:5
    |
+LL | fn closure_move_capture_conflict(mut x: String) {
+   |                                  ----- binding `x` declared here
 LL |     let r = &x;
    |             -- borrow of `x` occurs here
 LL |     || x;
index bada4e1b84b52cdf25e9222f62022d9bdadd15b9..cf0df5834cc0dd39e30115455d5395c38ccf8df0 100644 (file)
@@ -40,9 +40,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
 LL |     let f = || x;
    |             -- - borrow occurs due to use in closure
    |             |
-   |             borrow of `x` occurs here
+   |             `x` is borrowed here
 LL |     x = 1;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL |     f.use_ref();
    |     ----------- borrow later used here
 
@@ -52,7 +52,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
 LL |     let f = || x = 0;
    |             -- - borrow occurs due to use of `x` in closure
    |             |
-   |             borrow of `x` occurs here
+   |             `x` is borrowed here
 LL |     let y = x;
    |             ^ use of borrowed `x`
 LL |     f.use_ref();
@@ -100,9 +100,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
 LL |     let f = || x = 0;
    |             -- - borrow occurs due to use in closure
    |             |
-   |             borrow of `x` occurs here
+   |             `x` is borrowed here
 LL |     x = 1;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL |     f.use_ref();
    |     ----------- borrow later used here
 
@@ -160,9 +160,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
 LL |     let f = || *x = 0;
    |             -- -- borrow occurs due to use in closure
    |             |
-   |             borrow of `*x` occurs here
+   |             `*x` is borrowed here
 LL |     *x = 1;
-   |     ^^^^^^ assignment to borrowed `*x` occurs here
+   |     ^^^^^^ `*x` is assigned to here but it was already borrowed
 LL |     f.use_ref();
    |     ----------- borrow later used here
 
index f67c312b946883a486655688f21717605e098567..5a8462d4dc56e4e1279c9092a9831d5fafbd839f 100644 (file)
@@ -21,6 +21,9 @@ LL | fn test() {
 error[E0597]: `y` does not live long enough
   --> $DIR/escape-argument.rs:27:25
    |
+LL |         let y = 22;
+   |             - binding `y` declared here
+LL |         let mut closure = expect_sig(|p, y| *p = y);
 LL |         closure(&mut p, &y);
    |                         ^^ borrowed value does not live long enough
 LL |
index 7991abeb7a800d72a6e04c0e4ef402911420492c..721cd45ded98e2866c4e6a838ca67e80448f8c16 100644 (file)
@@ -53,6 +53,8 @@ LL | fn case2() {
 error[E0597]: `a` does not live long enough
   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26
    |
+LL |       let a = 0;
+   |           - binding `a` declared here
 LL |       let cell = Cell::new(&a);
    |                            ^^ borrowed value does not live long enough
 ...
index ad928f1bbc984373031b9be3ebaec01b64d027d3..0e27e5f5f7c162adf7d46e8cbabf54af423edcdc 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/closure-use-spans.rs:5:5
    |
 LL |     let y = &x;
-   |             -- borrow of `x` occurs here
+   |             -- `x` is borrowed here
 LL |     x = 0;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL |     || *y;
    |        -- borrow later captured here by closure
 
@@ -12,9 +12,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/closure-use-spans.rs:11:5
    |
 LL |     let y = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 LL |     x = 0;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL |     || *y = 1;
    |        -- borrow later captured here by closure
 
@@ -22,9 +22,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/closure-use-spans.rs:17:5
    |
 LL |     let y = &x;
-   |             -- borrow of `x` occurs here
+   |             -- `x` is borrowed here
 LL |     x = 0;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL |     move || *y;
    |             -- borrow later captured here by closure
 
index 65be3b37e0e3bed31239ba5bc20258d2b006527a..862c925b468fd3a5e12da81bb73881dda35a6407 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `s` does not live long enough
   --> $DIR/do-not-ignore-lifetime-bounds-in-copy-proj.rs:9:18
    |
+LL |     let s = 2;
+   |         - binding `s` declared here
 LL |     let a = (Foo(&s),);
    |                  ^^ borrowed value does not live long enough
 LL |     drop(a.0);
index b811ba4fd0cd2a4c12456083ecd99e1b03efd004..ebaf6d1244d7d6c12cc02e3917e86e19196b8123 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `s` does not live long enough
   --> $DIR/do-not-ignore-lifetime-bounds-in-copy.rs:8:17
    |
+LL |     let s = 2;
+   |         - binding `s` declared here
 LL |     let a = Foo(&s);
    |                 ^^ borrowed value does not live long enough
 LL |     drop(a);
index fad6121cbca52f4da0e2c0031dea932e322e78ea..289b246e663e1a705bf7a2f0fd8278f29fa2bb52 100644 (file)
@@ -10,6 +10,7 @@ error[E0597]: `y` does not live long enough
 LL |     for ref mut d in v {
    |                      - a temporary with access to the borrow is created here ...
 LL |         let y = ();
+   |             - binding `y` declared here
 LL |         *d = D(&y);
    |                ^^ borrowed value does not live long enough
 LL |     }
index cb280880950043fa07ee9427c7a4ffddfeb5461f..0ddb7adbb38223dffa6cdbbaa1df5b95024aeabd 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `v[_]` because it is borrowed
   --> $DIR/drop-no-may-dangle.rs:18:9
    |
 LL |     let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
-   |                                                                 ----- borrow of `v[_]` occurs here
+   |                                                                 ----- `v[_]` is borrowed here
 ...
 LL |         v[0] += 1;
-   |         ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
+   |         ^^^^^^^^^ `v[_]` is assigned to here but it was already borrowed
 ...
 LL | }
    | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
@@ -14,10 +14,10 @@ error[E0506]: cannot assign to `v[_]` because it is borrowed
   --> $DIR/drop-no-may-dangle.rs:21:5
    |
 LL |     let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
-   |                                                                 ----- borrow of `v[_]` occurs here
+   |                                                                 ----- `v[_]` is borrowed here
 ...
 LL |     v[0] += 1;
-   |     ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
+   |     ^^^^^^^^^ `v[_]` is assigned to here but it was already borrowed
 LL | }
    | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
 
index 8854dd8d68c9daa460beb8f50b83da3be37f30c1..7edc3dcc5cde3e03653955c7a71d2f4942785630 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `*s` because it is borrowed
   --> $DIR/guarantor-issue-46974.rs:7:5
    |
 LL |     let t = &mut *s; // this borrow should last for the entire function
-   |             ------- borrow of `*s` occurs here
+   |             ------- `*s` is borrowed here
 LL |     let x = &t.0;
 LL |     *s = (2,);
-   |     ^^^^^^^^^ assignment to borrowed `*s` occurs here
+   |     ^^^^^^^^^ `*s` is assigned to here but it was already borrowed
 LL |     *x
    |     -- borrow later used here
 
index 45119018d4e60570243a455dc0129f584db68403..4a512560c87519160e3c4572e9b573bc3bcc062a 100644 (file)
@@ -4,7 +4,7 @@ error[E0507]: cannot move out of `foo` in pattern guard
 LL |             if { (|| { let bar = foo; bar.take() })(); false } => {},
    |                   ^^             --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait
    |                   |
-   |                   move out of `foo` occurs here
+   |                   `foo` is moved here
    |
    = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
 
@@ -14,7 +14,7 @@ error[E0507]: cannot move out of `foo` in pattern guard
 LL |             if let Some(()) = { (|| { let bar = foo; bar.take() })(); None } => {},
    |                                  ^^             --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait
    |                                  |
-   |                                  move out of `foo` occurs here
+   |                                  `foo` is moved here
    |
    = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
 
index 1ba696593afffe4adafbac72bb0e1055fa4b4d71..0b5d723172c76601c0948a0c5977412610d1ec2f 100644 (file)
@@ -4,7 +4,7 @@ error[E0507]: cannot move out of `foo` in pattern guard
 LL |                 (|| { let bar = foo; bar.take() })();
    |                  ^^             --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait
    |                  |
-   |                  move out of `foo` occurs here
+   |                  `foo` is moved here
    |
    = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
 
@@ -14,7 +14,7 @@ error[E0507]: cannot move out of `foo` in pattern guard
 LL |                 (|| { let bar = foo; bar.take() })();
    |                  ^^             --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait
    |                  |
-   |                  move out of `foo` occurs here
+   |                  `foo` is moved here
    |
    = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
 
index e0b3b5494d0a574b53f2d1fa035277500359dcc2..204eda3d2679631ccb93b6505769f2c727b5ba73 100644 (file)
@@ -4,10 +4,10 @@ error[E0506]: cannot assign to `vecvec` because it is borrowed
 LL |       vecvec[0] += {
    |       ------
    |       |
-   |  _____borrow of `vecvec` occurs here
+   |  _____`vecvec` is borrowed here
    | |
 LL | |         vecvec = vec![];
-   | |         ^^^^^^ assignment to borrowed `vecvec` occurs here
+   | |         ^^^^^^ `vecvec` is assigned to here but it was already borrowed
 LL | |
 LL | |         0
 LL | |     };
index e6e95ee613647a1cff34d4d4479a73ab32e75162..f337e23455070ba8ec0962364e6b424e473c9728 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `a` does not live long enough
   --> $DIR/issue-46036.rs:8:24
    |
+LL |     let a = 3;
+   |         - binding `a` declared here
 LL |     let foo = Foo { x: &a };
    |                        ^^
    |                        |
index 2f94039c0c3a934af7970fa24cc473ce8f4e8c8f..e24606e0b53e866b0f4488d6e3aa65778e793d70 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/issue-48803.rs:10:5
    |
 LL |     let y = &x;
-   |             -- borrow of `x` occurs here
+   |             -- `x` is borrowed here
 ...
 LL |     x = "modified";
-   |     ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^^^^^^^^^^ `x` is assigned to here but it was already borrowed
 LL |
 LL |     println!("{}", w); // prints "modified"
    |                    - borrow later used here
index ac385e056b9f81712c7e58248950222e04f9d72a..35d39bb6e908d7110db644eec628c44d10c10c07 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/issue-52534-2.rs:6:13
    |
+LL |         let x = 32;
+   |             - binding `x` declared here
 LL |         y = &x
    |             ^^ borrowed value does not live long enough
 LL |
index 5cedea6e66520a5e022ce895232324b31bb79272..338f64841321f70dc5fd23285805a02f0f5877c5 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `tmp0` does not live long enough
   --> $DIR/issue-52663-trait-object.rs:12:20
    |
+LL |         let tmp0 = 3;
+   |             ---- binding `tmp0` declared here
 LL |         let tmp1 = &tmp0;
    |                    ^^^^^ borrowed value does not live long enough
 LL |         Box::new(tmp1) as Box<dyn Foo + '_>
index d8f43cbc92a1e7874581d6af9fa21704c9cec2be..4a32c777a86f1492b471aaaf736df2501cd9a381 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `_thing1` does not live long enough
   --> $DIR/issue-54382-use-span-of-tail-of-block.rs:7:29
    |
+LL |         let mut _thing1 = D(Box::new("thing1"));
+   |             ----------- binding `_thing1` declared here
+...
 LL |             D("other").next(&_thing1)
    |             ----------------^^^^^^^^-
    |             |               |
index 036a7a0abfdcc7eecd3b2d9b17ac628460ca1f8a..f9e82cb003fc2be9e34722586dc22df8dfbe851c 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `stmt` does not live long enough
   --> $DIR/issue-54556-stephaneyfx.rs:27:21
    |
+LL |     let stmt = Statement;
+   |         ---- binding `stmt` declared here
 LL |     let rows = Rows(&stmt);
    |                     ^^^^^ borrowed value does not live long enough
 LL |     rows.map(|row| row).next()
index 92f5ffdf388ed22e724e4e53ab1df8efb8ee84ed..4eae9fdcde0d29c1ebff0a4937a714e3865bddca 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `_thing1` does not live long enough
   --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11
    |
+LL |         let mut _thing1 = D(Box::new("thing1"));
+   |             ----------- binding `_thing1` declared here
+LL |         // D("other").next(&_thing1).end()
 LL |         D(&_thing1).end()
    |         --^^^^^^^^-
    |         | |
index 25226e2967353b45a8f804d12e60e758c341ee7e..a2a7a8486545cb0b0ab8f36764f49d870af666a5 100644 (file)
@@ -2,11 +2,12 @@ error[E0597]: `_t1` does not live long enough
   --> $DIR/issue-54556-used-vs-unused-tails.rs:10:55
    |
 LL |     {              let mut _t1 = D(Box::new("t1")); D(&_t1).end()    } ; // suggest `;`
-   |                                                     --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
-   |                                                     | |              |
-   |                                                     | |              `_t1` dropped here while still borrowed
-   |                                                     | borrowed value does not live long enough
-   |                                                     a temporary with access to the borrow is created here ...
+   |                        -------                      --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+   |                        |                            | |              |
+   |                        |                            | |              `_t1` dropped here while still borrowed
+   |                        |                            | borrowed value does not live long enough
+   |                        |                            a temporary with access to the borrow is created here ...
+   |                        binding `_t1` declared here
    |
 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
    |
@@ -17,11 +18,12 @@ error[E0597]: `_t1` does not live long enough
   --> $DIR/issue-54556-used-vs-unused-tails.rs:13:55
    |
 LL |     {            { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }  } ; // suggest `;`
-   |                                                     --^^^^-       -    - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
-   |                                                     | |           |
-   |                                                     | |           `_t1` dropped here while still borrowed
-   |                                                     | borrowed value does not live long enough
-   |                                                     a temporary with access to the borrow is created here ...
+   |                        -------                      --^^^^-       -    - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+   |                        |                            | |           |
+   |                        |                            | |           `_t1` dropped here while still borrowed
+   |                        |                            | borrowed value does not live long enough
+   |                        |                            a temporary with access to the borrow is created here ...
+   |                        binding `_t1` declared here
    |
 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
    |
@@ -32,11 +34,12 @@ error[E0597]: `_t1` does not live long enough
   --> $DIR/issue-54556-used-vs-unused-tails.rs:16:55
    |
 LL |     {            { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; }   // suggest `;`
-   |                                                     --^^^^-       -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
-   |                                                     | |           |
-   |                                                     | |           `_t1` dropped here while still borrowed
-   |                                                     | borrowed value does not live long enough
-   |                                                     a temporary with access to the borrow is created here ...
+   |                        -------                      --^^^^-       -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+   |                        |                            | |           |
+   |                        |                            | |           `_t1` dropped here while still borrowed
+   |                        |                            | borrowed value does not live long enough
+   |                        |                            a temporary with access to the borrow is created here ...
+   |                        binding `_t1` declared here
    |
 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
    |
@@ -47,11 +50,12 @@ error[E0597]: `_t1` does not live long enough
   --> $DIR/issue-54556-used-vs-unused-tails.rs:19:55
    |
 LL |     let _ =      { let mut _t1 = D(Box::new("t1")); D(&_t1).end()    } ; // suggest `;`
-   |                                                     --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
-   |                                                     | |              |
-   |                                                     | |              `_t1` dropped here while still borrowed
-   |                                                     | borrowed value does not live long enough
-   |                                                     a temporary with access to the borrow is created here ...
+   |                        -------                      --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+   |                        |                            | |              |
+   |                        |                            | |              `_t1` dropped here while still borrowed
+   |                        |                            | borrowed value does not live long enough
+   |                        |                            a temporary with access to the borrow is created here ...
+   |                        binding `_t1` declared here
    |
 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
    |
@@ -62,11 +66,12 @@ error[E0597]: `_t1` does not live long enough
   --> $DIR/issue-54556-used-vs-unused-tails.rs:22:55
    |
 LL |     let _u =     { let mut _t1 = D(Box::new("t1")); D(&_t1).unit()   } ; // suggest `;`
-   |                                                     --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
-   |                                                     | |              |
-   |                                                     | |              `_t1` dropped here while still borrowed
-   |                                                     | borrowed value does not live long enough
-   |                                                     a temporary with access to the borrow is created here ...
+   |                        -------                      --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+   |                        |                            | |              |
+   |                        |                            | |              `_t1` dropped here while still borrowed
+   |                        |                            | borrowed value does not live long enough
+   |                        |                            a temporary with access to the borrow is created here ...
+   |                        binding `_t1` declared here
    |
 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
    |
@@ -77,11 +82,12 @@ error[E0597]: `_t1` does not live long enough
   --> $DIR/issue-54556-used-vs-unused-tails.rs:25:55
    |
 LL |     let _x =     { let mut _t1 = D(Box::new("t1")); D(&_t1).end()    } ; // `let x = ...; x`
-   |                                                     --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
-   |                                                     | |              |
-   |                                                     | |              `_t1` dropped here while still borrowed
-   |                                                     | borrowed value does not live long enough
-   |                                                     a temporary with access to the borrow is created here ...
+   |                        -------                      --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+   |                        |                            | |              |
+   |                        |                            | |              `_t1` dropped here while still borrowed
+   |                        |                            | borrowed value does not live long enough
+   |                        |                            a temporary with access to the borrow is created here ...
+   |                        binding `_t1` declared here
    |
    = note: the temporary is part of an expression at the end of a block;
            consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
@@ -94,11 +100,12 @@ error[E0597]: `_t1` does not live long enough
   --> $DIR/issue-54556-used-vs-unused-tails.rs:30:55
    |
 LL |     _y =         { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x`
-   |                                                     --^^^^-       - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
-   |                                                     | |           |
-   |                                                     | |           `_t1` dropped here while still borrowed
-   |                                                     | borrowed value does not live long enough
-   |                                                     a temporary with access to the borrow is created here ...
+   |                        -------                      --^^^^-       - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+   |                        |                            | |           |
+   |                        |                            | |           `_t1` dropped here while still borrowed
+   |                        |                            | borrowed value does not live long enough
+   |                        |                            a temporary with access to the borrow is created here ...
+   |                        binding `_t1` declared here
    |
    = note: the temporary is part of an expression at the end of a block;
            consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
@@ -111,12 +118,13 @@ error[E0597]: `_t1` does not live long enough
   --> $DIR/issue-54556-used-vs-unused-tails.rs:37:55
    |
 LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit()   }  // suggest `;`
-   |                                                     --^^^^-          -
-   |                                                     | |              |
-   |                                                     | |              `_t1` dropped here while still borrowed
-   |                                                     | |              ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
-   |                                                     | borrowed value does not live long enough
-   |                                                     a temporary with access to the borrow is created here ...
+   |                        -------                      --^^^^-          -
+   |                        |                            | |              |
+   |                        |                            | |              `_t1` dropped here while still borrowed
+   |                        |                            | |              ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+   |                        |                            | borrowed value does not live long enough
+   |                        |                            a temporary with access to the borrow is created here ...
+   |                        binding `_t1` declared here
    |
 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
    |
@@ -127,12 +135,13 @@ error[E0597]: `_t1` does not live long enough
   --> $DIR/issue-54556-used-vs-unused-tails.rs:40:55
    |
 LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end()   }   // `let x = ...; x`
-   |                                                     --^^^^-         -
-   |                                                     | |             |
-   |                                                     | |             `_t1` dropped here while still borrowed
-   |                                                     | |             ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
-   |                                                     | borrowed value does not live long enough
-   |                                                     a temporary with access to the borrow is created here ...
+   |                        -------                      --^^^^-         -
+   |                        |                            | |             |
+   |                        |                            | |             `_t1` dropped here while still borrowed
+   |                        |                            | |             ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+   |                        |                            | borrowed value does not live long enough
+   |                        |                            a temporary with access to the borrow is created here ...
+   |                        binding `_t1` declared here
    |
    = note: the temporary is part of an expression at the end of a block;
            consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
index 9f27fac15a7f67161922cf5b42101c3807bb7adf..adc419ae51562534b10ed164be2a58c833b4bd08 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/issue-54556-wrap-it-up.rs:27:5
    |
 LL |     let wrap = Wrap { p: &mut x };
-   |                          ------ borrow of `x` occurs here
+   |                          ------ `x` is borrowed here
 ...
 LL |     x = 1;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL | }
    | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>`
 
index bf3e58e8cdb19b1c5cfea5247b1bba8e6cc4af73..ecb9ef0aef96e3773b54b54faf9fe553f402223b 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `a` does not live long enough
   --> $DIR/issue-55511.rs:13:28
    |
+LL |     let a = 22;
+   |         - binding `a` declared here
 LL |     let b = Some(Cell::new(&a));
    |                            ^^ borrowed value does not live long enough
 ...
index 31f40d8252ed6a40745dc26e2606729a84cf5a8b..d5effd6f346d16bc543768676128a57ae3e33bb7 100644 (file)
@@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
   --> $DIR/issue-57989.rs:5:5
    |
 LL |     let g = &x;
-   |             -- borrow of `*x` occurs here
+   |             -- `*x` is borrowed here
 LL |     *x = 0;
-   |     ^^^^^^ assignment to borrowed `*x` occurs here
+   |     ^^^^^^ `*x` is assigned to here but it was already borrowed
 LL |
 LL |     g;
    |     - borrow later used here
index e234ebb04e16a5ea874c7482a3cf11da6bc03dd5..851e3628748f22af1610de992fc5dd0b5523c718 100644 (file)
@@ -2,7 +2,9 @@ error[E0597]: `x` does not live long enough
   --> $DIR/issue-68550.rs:12:20
    |
 LL | fn run<'a, A>(x: A)
-   |        -- lifetime `'a` defined here
+   |        --     - binding `x` declared here
+   |        |
+   |        lifetime `'a` defined here
 ...
 LL |     let _: &'a A = &x;
    |            -----   ^^ borrowed value does not live long enough
index 5e55cb502caa9c235d696fa1760a7d94223ec94a..1b41230d7ba39976eedf542397a86725c95db886 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `n` does not live long enough
   --> $DIR/issue-69114-static-mut-ty.rs:19:15
    |
+LL |     let n = 42;
+   |         - binding `n` declared here
+LL |     unsafe {
 LL |         BAR = &n;
    |         ------^^
    |         |     |
@@ -13,6 +16,9 @@ LL | }
 error[E0597]: `n` does not live long enough
   --> $DIR/issue-69114-static-mut-ty.rs:27:22
    |
+LL |     let n = 42;
+   |         - binding `n` declared here
+LL |     unsafe {
 LL |         BAR_ELIDED = &n;
    |         -------------^^
    |         |            |
index 0815e74b5537d9a2bafa634329286a9aa5f7cde0..9215e850f7d8fa063cf11c5f9faf170d169cd374 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `n` does not live long enough
   --> $DIR/issue-69114-static-ty.rs:7:9
    |
+LL |     let n = 42;
+   |         - binding `n` declared here
 LL |     FOO(&n);
    |     ----^^-
    |     |   |
index eb8442b31d7c73b323076b65fee62c112f77bfa5..58e378ab02118d7455c6b62f0e811d782c0dd136 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `data.0` because it is borrowed
   --> $DIR/loan_ends_mid_block_pair.rs:12:5
    |
 LL |     let c = &mut data.0;
-   |             ----------- borrow of `data.0` occurs here
+   |             ----------- `data.0` is borrowed here
 LL |     capitalize(c);
 LL |     data.0 = 'e';
-   |     ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
+   |     ^^^^^^^^^^^^ `data.0` is assigned to here but it was already borrowed
 ...
 LL |     capitalize(c);
    |                - borrow later used here
index f5c10f3ddea0ea0686342e06ab87b16a6b4d63fb..a6b3328b5a294475ca720c90e10c330af78902d9 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `local` does not live long enough
   --> $DIR/local-outlives-static-via-hrtb.rs:24:28
    |
+LL |     let local = 0;
+   |         ----- binding `local` declared here
 LL |     assert_static_via_hrtb(&local);
    |     -----------------------^^^^^^-
    |     |                      |
@@ -19,6 +21,9 @@ LL | fn assert_static_via_hrtb<G>(_: G) where for<'a> G: Outlives<'a> {}
 error[E0597]: `local` does not live long enough
   --> $DIR/local-outlives-static-via-hrtb.rs:25:45
    |
+LL |     let local = 0;
+   |         ----- binding `local` declared here
+LL |     assert_static_via_hrtb(&local);
 LL |     assert_static_via_hrtb_with_assoc_type(&&local);
    |     ----------------------------------------^^^^^^-
    |     |                                       |
index c6d15a936d81939e13a770ae03fde1a622a9dbe1..36f2cd0b85d1c62e355dfc5b84d5a844eaa57409 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `y.1` because it was mutably borrowed
   --> $DIR/match-cfg-fake-edges2.rs:8:5
    |
 LL |     let r = &mut y.1;
-   |             -------- borrow of `y.1` occurs here
+   |             -------- `y.1` is borrowed here
 ...
 LL |     match y {
    |     ^^^^^^^ use of borrowed `y.1`
index fa01d3a6fd1e0092a95e40c270c4f7b681626f97..afd853c403ee38d83f40315da6a4915a4d075ef4 100644 (file)
@@ -4,7 +4,7 @@ error[E0507]: cannot move out of `foo` in pattern guard
 LL |             (|| { let bar = foo; bar.take() })();
    |              ^^             --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait
    |              |
-   |              move out of `foo` occurs here
+   |              `foo` is moved here
    |
    = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
 
@@ -14,7 +14,7 @@ error[E0507]: cannot move out of `foo` in pattern guard
 LL |             (|| { let bar = foo; bar.take() })();
    |              ^^             --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait
    |              |
-   |              move out of `foo` occurs here
+   |              `foo` is moved here
    |
    = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
 
index 60b8dee71a8632e2866abc43561c1b0dd36bd25c..7bdcbcb9c6ef6a43f3876732ac7d7871f778f019 100644 (file)
@@ -74,9 +74,9 @@ error[E0506]: cannot assign to `t` because it is borrowed
   --> $DIR/match-guards-partially-borrow.rs:225:13
    |
 LL |         s if {
-   |         - borrow of `t` occurs here
+   |         - `t` is borrowed here
 LL |             t = !t;
-   |             ^^^^^^ assignment to borrowed `t` occurs here
+   |             ^^^^^^ `t` is assigned to here but it was already borrowed
 LL |             false
 LL |         } => (), // What value should `s` have in the arm?
    |         - borrow later used here
@@ -85,9 +85,9 @@ error[E0506]: cannot assign to `t` because it is borrowed
   --> $DIR/match-guards-partially-borrow.rs:235:13
    |
 LL |         s if let Some(()) = {
-   |         - borrow of `t` occurs here
+   |         - `t` is borrowed here
 LL |             t = !t;
-   |             ^^^^^^ assignment to borrowed `t` occurs here
+   |             ^^^^^^ `t` is assigned to here but it was already borrowed
 LL |             None
 LL |         } => (), // What value should `s` have in the arm?
    |         - borrow later used here
index 32666529f3f957949c5d0e0a427153ee5ac743b9..9273484565a198f72121c73a7022d8dc20781690 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `e` because it was mutably borrowed
   --> $DIR/match-on-borrowed.rs:47:11
    |
 LL |         E::V(ref mut x, _) => x,
-   |              --------- borrow of `e.0` occurs here
+   |              --------- `e.0` is borrowed here
 ...
 LL |     match e { // Don't know that E uses a tag for its discriminant
    |           ^ use of borrowed `e.0`
@@ -14,7 +14,7 @@ error[E0503]: cannot use `*f` because it was mutably borrowed
   --> $DIR/match-on-borrowed.rs:61:11
    |
 LL |         E::V(ref mut x, _) => x,
-   |              --------- borrow of `f.0` occurs here
+   |              --------- `f.0` is borrowed here
 ...
 LL |     match f { // Don't know that E uses a tag for its discriminant
    |           ^ use of borrowed `f.0`
@@ -26,7 +26,7 @@ error[E0503]: cannot use `t` because it was mutably borrowed
   --> $DIR/match-on-borrowed.rs:81:5
    |
 LL |     let x = &mut t;
-   |             ------ borrow of `t` occurs here
+   |             ------ `t` is borrowed here
 LL |     match t {
    |     ^^^^^^^ use of borrowed `t`
 ...
index 80e297807465d6bcde327a5c75f777a1fb56166c..55646b9dca9863a46914eea9483ccdff8735c2d1 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/maybe-initialized-drop-implicit-fragment-drop.rs:17:5
    |
 LL |     let wrap = Wrap { p: &mut x };
-   |                          ------ borrow of `x` occurs here
+   |                          ------ `x` is borrowed here
 ...
 LL |     x = 1;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL |     // FIXME ^ Should not error in the future with implicit dtors, only manually implemented ones
 LL | }
    | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>`
index 14074472eaf88b98d67b3cf01592d6327e12af1f..c89f94a7894f004c46d2d29dacf6778822d6923d 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/maybe-initialized-drop-with-fragment.rs:19:5
    |
 LL |     let wrap = Wrap { p: &mut x };
-   |                          ------ borrow of `x` occurs here
+   |                          ------ `x` is borrowed here
 ...
 LL |     x = 1;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL | }
    | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>`
 
index 91c0afc1dbaa1a22bb2d31ae3938fb0e3291893e..90db13bc5784949f41a745019d94f9e9da4aa155 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/maybe-initialized-drop-with-uninitialized-fragments.rs:20:5
    |
 LL |     let wrap = Wrap { p: &mut x };
-   |                          ------ borrow of `x` occurs here
+   |                          ------ `x` is borrowed here
 ...
 LL |     x = 1;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL |     // FIXME ^ This currently errors and it should not.
 LL | }
    | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>`
index 9825ba4611b7d7b7d26b44ff222bca4827006a4c..15a53a09af8c2ef956babaa9983c9f6d7ffc201c 100644 (file)
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
   --> $DIR/maybe-initialized-drop.rs:14:5
    |
 LL |     let wrap = Wrap { p: &mut x };
-   |                          ------ borrow of `x` occurs here
+   |                          ------ `x` is borrowed here
 LL |     x = 1;
-   |     ^^^^^ assignment to borrowed `x` occurs here
+   |     ^^^^^ `x` is assigned to here but it was already borrowed
 LL | }
    | - borrow might be used here, when `wrap` is dropped and runs the `Drop` code for type `Wrap`
 
index fa1a6a9c95786f9457fa8bbfc723d7bc002085b2..789d202f73a7bf7d8ff4925243af969658953c0c 100644 (file)
@@ -8,7 +8,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/polonius-smoke-test.rs:12:13
    |
 LL |     let y = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 LL |     let z = x;
    |             ^ use of borrowed `x`
 LL |     let w = y;
index df347f4e7f0fec3642272b4b763da71a8da138f2..d111256b8454ff957d1e3aabaa8c798318ef1283 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `l` does not live long enough
 LL |     let ptr = {
    |         --- borrow later stored here
 LL |         let l = 3;
+   |             - binding `l` declared here
 LL |         let b = &l;
    |                 ^^ borrowed value does not live long enough
 ...
index 56d878e43033b0f0cfb4f6175848747d457933f5..5672b9cd7e9cc5e96d68e049bafad66c0165953e 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/reference-carried-through-struct-field.rs:6:5
    |
 LL |     let wrapper = Wrap { w: &mut x };
-   |                             ------ borrow of `x` occurs here
+   |                             ------ `x` is borrowed here
 LL |     x += 1;
    |     ^^^^^^ use of borrowed `x`
 LL |     *wrapper.w += 1;
index d032ce6f2132ce21f97cbc1e8bce1a05a4a9a06e..ff6ea598ff46f49f86bdc014b2433ebeb13527ea 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `b` does not live long enough
   --> $DIR/var-appears-twice.rs:20:38
    |
+LL |     let b = 44;
+   |         - binding `b` declared here
+...
 LL |     let x: DoubleCell<_> = make_cell(&b);
    |            -------------             ^^ borrowed value does not live long enough
    |            |
index 253e382511045c4163c152317501755de690b2bd..9e94fd5a7826e3bdc753135a1f2889d056486a9c 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/adt-brace-enums.rs:25:48
    |
+LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     SomeEnum::SomeVariant::<&'static u32> { t: &c };
    |                                                ^^
    |                                                |
@@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
 LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     SomeEnum::SomeVariant::<&'a u32> { t: &c };
    |                                           ^^
    |                                           |
index 8b9d1705df6ad816de949a8b3436d1c93e4bc8a3..cbb7f6a55a989ca60590a6d66fe33783964862d0 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/adt-brace-structs.rs:23:37
    |
+LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     SomeStruct::<&'static u32> { t: &c };
    |                                     ^^
    |                                     |
@@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
 LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     SomeStruct::<&'a u32> { t: &c };
    |                                ^^
    |                                |
index 3326fa521fc9cea4efc8e4d26b039fb90f1c7663..bca85a90d190890db4bd72bb7409a065ed3533f9 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/adt-nullary-enums.rs:33:41
    |
+LL |       let c = 66;
+   |           - binding `c` declared here
 LL | /     combine(
 LL | |         SomeEnum::SomeVariant(Cell::new(&c)),
    | |                                         ^^ borrowed value does not live long enough
@@ -15,7 +17,9 @@ error[E0597]: `c` does not live long enough
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
-...
+LL |     let c = 66;
+   |         - binding `c` declared here
+LL |     combine(
 LL |         SomeEnum::SomeVariant(Cell::new(&c)),
    |                               ----------^^-
    |                               |         |
index 2fa7042631d21dd924429e47978eebc11b9c1196..d2d85ec2b9b0f1fc124926f0b2122d2be1ebec3f 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/adt-tuple-enums.rs:28:43
    |
+LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     SomeEnum::SomeVariant::<&'static u32>(&c);
    |                                           ^^
    |                                           |
@@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
 LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     SomeEnum::SomeVariant::<&'a u32>(&c);
    |                                      ^^
    |                                      |
index 9664fb9f548317ea13151a99abb06665b64ab03b..b7bc2a10b7040f434427ca2f6aa2fdffaa9495ee 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/adt-tuple-struct-calls.rs:27:7
    |
+LL |     let c = 66;
+   |         - binding `c` declared here
+LL |     let f = SomeStruct::<&'static u32>;
 LL |     f(&c);
    |     --^^-
    |     | |
@@ -14,7 +17,9 @@ error[E0597]: `c` does not live long enough
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
-...
+LL |     let c = 66;
+   |         - binding `c` declared here
+LL |     let f = SomeStruct::<&'a u32>;
 LL |     f(&c);
    |     --^^-
    |     | |
index 76b5252258c7bc3260014944e20b50387cb4291f..97d39da265fe3f810c1812498ebe09ce671c0633 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/adt-tuple-struct.rs:23:32
    |
+LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     SomeStruct::<&'static u32>(&c);
    |                                ^^
    |                                |
@@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
 LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     SomeStruct::<&'a u32>(&c);
    |                           ^^
    |                           |
index 4599d04e7e2300c3eb27ab2121cbc7c17ddf32da..3b9363c41f20fb3741f7b5b12fc913648daacc90 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/cast_static_lifetime.rs:5:19
    |
+LL |     let x = 22_u32;
+   |         - binding `x` declared here
 LL |     let y: &u32 = (&x) as &'static u32;
    |                   ^^^^----------------
    |                   |
index 12065a85aa4a0a512872fb8943ecdb3bf92ff4f8..f164255ef305fdb7b1fcc2fadbccdfa7adaa7209 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/constant-in-expr-inherent-2.rs:23:9
    |
+LL |     let x = ();
+   |         - binding `x` declared here
 LL |     FUN(&x);
    |     ----^^-
    |     |   |
@@ -13,6 +15,9 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/constant-in-expr-inherent-2.rs:24:23
    |
+LL |     let x = ();
+   |         - binding `x` declared here
+LL |     FUN(&x);
 LL |     A::ASSOCIATED_FUN(&x);
    |     ------------------^^-
    |     |                 |
@@ -25,6 +30,9 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/constant-in-expr-inherent-2.rs:25:28
    |
+LL |     let x = ();
+   |         - binding `x` declared here
+...
 LL |     B::ALSO_ASSOCIATED_FUN(&x);
    |     -----------------------^^-
    |     |                      |
@@ -37,6 +45,9 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/constant-in-expr-inherent-2.rs:26:31
    |
+LL |     let x = ();
+   |         - binding `x` declared here
+...
 LL |     <_>::TRAIT_ASSOCIATED_FUN(&x);
    |     --------------------------^^-
    |     |                         |
index e0640da39e2b62fb3211d3c89e7fdab35b910ab9..8b53e138d9bd0c05e36da6c21e813958641b7f07 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/fns.rs:23:29
    |
+LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     some_fn::<&'static u32>(&c);
    |     ------------------------^^-
    |     |                       |
@@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
 LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     some_fn::<&'a u32>(&c);
    |     -------------------^^-
    |     |                  |
index 10447e45a6d422de9a6ad372f19bf5083a0a1f77..3803cbf776b675e8ef338b8807ee30ce9e6137d3 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/method-call.rs:36:34
    |
+LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     a.method::<&'static u32>(b,  &c);
    |     -----------------------------^^-
    |     |                            |
@@ -15,6 +17,8 @@ error[E0597]: `c` does not live long enough
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
 ...
+LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     a.method::<&'a u32>(b,  &c);
    |     ------------------------^^-
    |     |                       |
index 962ddfd2bd151f372c7af5b88dd2dca42808b9cc..c7c08c948abdb20b658857002346ab2a198ca338 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `a` does not live long enough
   --> $DIR/method-ufcs-1.rs:30:7
    |
+LL |     let a = 22;
+   |         - binding `a` declared here
+...
 LL |     x(&a, b, c);
    |     --^^-------
    |     | |
@@ -14,6 +17,8 @@ error[E0597]: `a` does not live long enough
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
+LL |     let a = 22;
+   |         - binding `a` declared here
 ...
 LL |     <&'a u32 as Bazoom<_>>::method(&a, b, c);
    |     -------------------------------^^-------
index 63d59905e1c3892f90fb174794c658e6a6e0ba13..b7861a3bd069ff863cd62293f367aa6b7296042d 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `a` does not live long enough
   --> $DIR/method-ufcs-2.rs:30:7
    |
+LL |     let a = 22;
+   |         - binding `a` declared here
+...
 LL |     x(&a, b, c);
    |     --^^-------
    |     | |
@@ -14,7 +17,10 @@ error[E0597]: `b` does not live long enough
    |
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
-...
+LL |     let a = 22;
+LL |     let b = 44;
+   |         - binding `b` declared here
+LL |     let c = 66;
 LL |     <_ as Bazoom<&'a u32>>::method(a, &b, c);
    |     ----------------------------------^^----
    |     |                                 |
index e7851833e93b23a7f77a130197e6dd19f2dfb33d..8cb995a03ce2ff00054e7c0a369ce4370bf6915e 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/method-ufcs-3.rs:36:53
    |
+LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c);
    |     ------------------------------------------------^^-
    |     |                                               |
@@ -15,6 +17,8 @@ error[E0597]: `c` does not live long enough
 LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
    |                                   -- lifetime `'a` defined here
 ...
+LL |     let c = 66;
+   |         - binding `c` declared here
 LL |     <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c);
    |     -------------------------------------------^^-
    |     |                                          |
index 94861babd6f320f74b17dee88649a87742560c51..fb26b8d09e179bd8fa732edd24d1fd110627b781 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
 LL |     let v = 22;
+   |         - binding `v` declared here
 LL |     let x = A::<'a>::new(&v, 22);
    |             -------------^^-----
    |             |            |
index 06f20d9b2355957ec460832005a4aad5947b9770..03b97447e1aa00bcf19da6e2c2c3dd8645607417 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
 LL |     let v = 22;
+   |         - binding `v` declared here
 LL |     let x = A::<'a>::new::<&'a u32>(&v, &v);
    |             ------------------------^^-----
    |             |                       |
@@ -19,6 +20,7 @@ error[E0597]: `v` does not live long enough
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
 LL |     let v = 22;
+   |         - binding `v` declared here
 LL |     let x = A::<'a>::new::<&'a u32>(&v, &v);
    |             ----------------------------^^-
    |             |                           |
index 4ad61dc81c493911905be8845d6a792e3cec3840..69dd1d1aaae28694f8989172fc7f27766b9528cd 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
 LL |     let v = 22;
+   |         - binding `v` declared here
 LL |     let x = <A<'a>>::new(&v, 22);
    |             -------------^^-----
    |             |            |
index 0f83e99cdfb92f186eecdecf5c6c085531f0b1ca..66d82bb49dc68cabba031451f44510105eaee1f3 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
 LL |     let v = 22;
+   |         - binding `v` declared here
 LL |     let x = <A<'a>>::new::<&'a u32>(&v, &v);
    |             ------------------------^^-----
    |             |                       |
@@ -19,6 +20,7 @@ error[E0597]: `v` does not live long enough
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
 LL |     let v = 22;
+   |         - binding `v` declared here
 LL |     let x = <A<'a>>::new::<&'a u32>(&v, &v);
    |             ----------------------------^^-
    |             |                           |
index 975cb4b66d91d0ef91004d6524d5f21786f43878..acc3a1800f4fd8d385faa62b705c6944b8443e2a 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `a` does not live long enough
   --> $DIR/normalization.rs:10:31
    |
+LL |     let a = 22;
+   |         - binding `a` declared here
 LL |     let _: <() as Foo>::Out = &a;
    |            ----------------   ^^ borrowed value does not live long enough
    |            |
@@ -12,6 +14,8 @@ LL | }
 error[E0597]: `a` does not live long enough
   --> $DIR/normalization.rs:13:40
    |
+LL |     let a = 22;
+   |         - binding `a` declared here
 LL |     let _: <&'static () as Foo>::Out = &a;
    |            -------------------------   ^^ borrowed value does not live long enough
    |            |
index a97e7a9fd46fc3a3b1647c5ac17e29f78ba51609..3e7969e117934bad31b598fdf10aba4897e05472 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `y` does not live long enough
   --> $DIR/pattern_substs_on_brace_enum_variant.rs:7:33
    |
+LL |     let y = 22;
+   |         - binding `y` declared here
 LL |     let foo = Foo::Bar { field: &y };
    |                                 ^^ borrowed value does not live long enough
 LL |
@@ -12,6 +14,8 @@ LL | }
 error[E0597]: `y` does not live long enough
   --> $DIR/pattern_substs_on_brace_enum_variant.rs:14:33
    |
+LL |     let y = 22;
+   |         - binding `y` declared here
 LL |     let foo = Foo::Bar { field: &y };
    |                                 ^^ borrowed value does not live long enough
 ...
index 408d7c2a5e2a5c62250df15c5bfb384f48246274..89a1e9545e8af520b3f23213ca3ee88642ba79f6 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `y` does not live long enough
   --> $DIR/pattern_substs_on_brace_struct.rs:5:28
    |
+LL |     let y = 22;
+   |         - binding `y` declared here
 LL |     let foo = Foo { field: &y };
    |                            ^^ borrowed value does not live long enough
 LL |
@@ -12,6 +14,8 @@ LL | }
 error[E0597]: `y` does not live long enough
   --> $DIR/pattern_substs_on_brace_struct.rs:12:28
    |
+LL |     let y = 22;
+   |         - binding `y` declared here
 LL |     let foo = Foo { field: &y };
    |                            ^^ borrowed value does not live long enough
 ...
index 920c906f63a5824a3e08bdf049149f8af153135b..8efeecc77098a93ae9b0d03fd6fd96fa4353a2d1 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `y` does not live long enough
   --> $DIR/pattern_substs_on_tuple_enum_variant.rs:7:24
    |
+LL |     let y = 22;
+   |         - binding `y` declared here
 LL |     let foo = Foo::Bar(&y);
    |                        ^^ borrowed value does not live long enough
 LL |
@@ -12,6 +14,8 @@ LL | }
 error[E0597]: `y` does not live long enough
   --> $DIR/pattern_substs_on_tuple_enum_variant.rs:14:24
    |
+LL |     let y = 22;
+   |         - binding `y` declared here
 LL |     let foo = Foo::Bar(&y);
    |                        ^^ borrowed value does not live long enough
 ...
index 3f01638d84757f6aaee8764ab4c8e56f27d2d7e6..d7f1dac88a618b82b268d97716ceed4101576431 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `y` does not live long enough
   --> $DIR/pattern_substs_on_tuple_struct.rs:5:19
    |
+LL |     let y = 22;
+   |         - binding `y` declared here
 LL |     let foo = Foo(&y);
    |                   ^^ borrowed value does not live long enough
 LL |
@@ -12,6 +14,8 @@ LL | }
 error[E0597]: `y` does not live long enough
   --> $DIR/pattern_substs_on_tuple_struct.rs:12:19
    |
+LL |     let y = 22;
+   |         - binding `y` declared here
 LL |     let foo = Foo(&y);
    |                   ^^ borrowed value does not live long enough
 ...
index de6f8f80fe25248bcac3e425fcd37b9e639fa7fb..8bb714f1d0cdce635e586e53223558eabd522b0b 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:6:9
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let y: &'static u32;
    |            ------------ type annotation requires that `x` is borrowed for `'static`
 LL |     y = &x;
@@ -11,6 +13,8 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:14:9
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let (y, z): (&'static u32, &'static u32);
    |                 ---------------------------- type annotation requires that `x` is borrowed for `'static`
 LL |     y = &x;
@@ -21,6 +25,8 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:20:13
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let y = &x;
    |             ^^ borrowed value does not live long enough
 LL |     let ref z: &'static u32 = y;
@@ -32,6 +38,8 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:39:9
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let Single { value: y }: Single<&'static u32>;
    |                              -------------------- type annotation requires that `x` is borrowed for `'static`
 LL |     y = &x;
@@ -42,6 +50,8 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:51:10
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let Single2 { value: mut _y }: Single2<StaticU32>;
    |                                    ------------------ type annotation requires that `x` is borrowed for `'static`
 LL |     _y = &x;
@@ -52,6 +62,8 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:56:27
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let y: &'static u32 = &x;
    |            ------------   ^^ borrowed value does not live long enough
    |            |
@@ -62,6 +74,8 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:61:27
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let _: &'static u32 = &x;
    |            ------------   ^^ borrowed value does not live long enough
    |            |
@@ -100,6 +114,8 @@ LL |     let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:75:40
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let (_, _): (&'static u32, u32) = (&x, 44);
    |                 -------------------    ^^ borrowed value does not live long enough
    |                 |
@@ -110,6 +126,8 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:80:40
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let (y, _): (&'static u32, u32) = (&x, 44);
    |                 -------------------    ^^ borrowed value does not live long enough
    |                 |
@@ -120,6 +138,8 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:85:69
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let Single { value: y }: Single<&'static u32> = Single { value: &x };
    |                              --------------------                   ^^ borrowed value does not live long enough
    |                              |
@@ -130,6 +150,8 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:90:69
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let Single { value: _ }: Single<&'static u32> = Single { value: &x };
    |                              --------------------                   ^^ borrowed value does not live long enough
    |                              |
@@ -140,6 +162,8 @@ LL | }
 error[E0597]: `x` does not live long enough
   --> $DIR/patterns.rs:98:17
    |
+LL |     let x = 22;
+   |         - binding `x` declared here
 LL |     let Double { value1: _, value2: _ }: Double<&'static u32> = Double {
    |                                          -------------------- type annotation requires that `x` is borrowed for `'static`
 LL |         value1: &x,
index cb99a6a369d0b25a12b4a4656b128c832335ea36..132a00ba41581da4175c9f0c5565bd690ba7a3c0 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `x` does not live long enough
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
 LL |     let x = 0;
+   |         - binding `x` declared here
 LL |     let f = &drop::<&'a i32>;
    |             ---------------- assignment requires that `x` is borrowed for `'a`
 LL |     f(&x);
index ccbf3c1d927c6b02e29571a8645a45b8458df656..766877f8835c414bb59c60c9cee536b8b285b12a 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/type_ascription_static_lifetime.rs:6:33
    |
+LL |     let x = 22_u32;
+   |         - binding `x` declared here
 LL |     let y: &u32 = type_ascribe!(&x, &'static u32);
    |                   --------------^^---------------
    |                   |             |
index 1b93267b397714cf694a084d0b7a3da0100c90dd..c7c7c074f7cd0f07ae76257f0066b53bfcdddd24 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `arr[..]` because it is borrowed
   --> $DIR/borrowck-move-ref-pattern.rs:8:24
    |
+LL |     let mut arr = [U, U, U, U, U];
+   |         ------- binding `arr` declared here
 LL |     let hold_all = &arr;
    |                    ---- borrow of `arr` occurs here
 LL |     let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
index 6ea238f302f3faf42db9c3df15340f7679e345c3..d76a83b02580904019ca09f8650f12311d251ed9 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/do-not-suggest-adding-bound-to-opaque-type.rs:9:7
    |
+LL |     let x = ();
+   |         - binding `x` declared here
 LL |     S(&x)
    |     --^^-
    |     | |
index e77289287e5366f09cae79d1b25f011e89abbffb..99060a9c7f59ffe125f44fb11e322e0997b041a6 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `a` does not live long enough
   --> $DIR/regions-addr-of-arg.rs:5:30
    |
+LL | fn foo(a: isize) {
+   |        - binding `a` declared here
 LL |     let _p: &'static isize = &a;
    |             --------------   ^^ borrowed value does not live long enough
    |             |
index 8ef7e22536bf94a4847261ad3fe6bf476fbf88de..c83cfc1c987b6e28d0403f408cef06f744120d95 100644 (file)
@@ -18,6 +18,8 @@ error[E0597]: `y` does not live long enough
 LL | fn call1<'a>(x: &'a usize) {
    |          -- lifetime `'a` defined here
 ...
+LL |     let y: usize = 3;
+   |         - binding `y` declared here
 LL |     let z: &'a & usize = &(&y);
    |            -----------    ^^^^ borrowed value does not live long enough
    |            |
index 803d0d7449108722618bb392aca6ffa7c4d08508..c8a33bbc52236e0c58d9f78c4fba760ea5d80ad1 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/regions-infer-proc-static-upvar.rs:10:13
    |
+LL |       let x = 3;
+   |           - binding `x` declared here
 LL |       let y = &x;
    |               ^^ borrowed value does not live long enough
 LL | /     foo(move|| {
index bb2740310f6a1ba8371bb1aea975334f241a4d56..ee43f9fa5724d3d2278d889dcec7fb7890a6da3f 100644 (file)
@@ -13,6 +13,8 @@ LL |         ay = z;
 error[E0597]: `y` does not live long enough
   --> $DIR/regions-nested-fns.rs:5:18
    |
+LL |     let y = 3;
+   |         - binding `y` declared here
 LL |     let mut ay = &y;
    |                  ^^ borrowed value does not live long enough
 ...
index f77d94a24b88fee2a3fc4d09f0994116b8af8d9b..18aec29ad0b74291ddfda7c480caed2725b3f592 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `line` does not live long enough
   --> $DIR/regions-pattern-typing-issue-19552.rs:5:14
    |
+LL |     let line = String::new();
+   |         ---- binding `line` declared here
 LL |     match [&*line] {
    |              ^^^^ borrowed value does not live long enough
 LL |         [ word ] => { assert_static(word); }
index ae60e3c0d5d671a0b973f839e7c6e1863cb1630a..0abe77a86977f4d65304e675652d290bee10de6b 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `a1` because it is borrowed
   --> $DIR/regions-pattern-typing-issue-19997.rs:7:13
    |
 LL |     match (&a1,) {
-   |            --- borrow of `a1` occurs here
+   |            --- `a1` is borrowed here
 LL |         (&ref b0,) => {
 LL |             a1 = &f;
-   |             ^^^^^^^ assignment to borrowed `a1` occurs here
+   |             ^^^^^^^ `a1` is assigned to here but it was already borrowed
 LL |             drop(b0);
    |                  -- borrow later used here
 
index de730ce1030f24bbab5699e3a644dc2acce470a5..ad84ebe3a504c0e99ccdc6b2963f90cca0abe78c 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/borrowck-non-exhaustive.rs:12:11
    |
 LL |     let y = &mut x;
-   |             ------ borrow of `x` occurs here
+   |             ------ `x` is borrowed here
 LL |     match x {
    |           ^ use of borrowed `x`
 ...
index 5f93ad6e0279e969d569f7ae4ce6c7ac8815f98b..1c26eb8803d7f68088feac2dfa304537ebaa3a35 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `s` does not live long enough
   --> $DIR/lifetime-update.rs:20:17
    |
+LL |     let s = String::from("hello");
+   |         - binding `s` declared here
+...
 LL |         lt_str: &s,
    |                 ^^ borrowed value does not live long enough
 ...
index 0b8e134c9662e8f8ef7c1a7c2db749ed0e3cc45d..6faa4477d8c5d3476aa432a512984d448c6104bc 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/issue-61882-2.rs:6:14
    |
+LL |         let x = 0;
+   |             - binding `x` declared here
 LL |         Self(&x);
    |              ^^
    |              |
index 48b42bc78253f59842a5fe00a4416b3bea2e24b4..9711dad80785b6cbeec10aa0bb6a3cf69ced645f 100644 (file)
@@ -47,6 +47,9 @@ LL |         foo(f);
 error[E0505]: cannot move out of `f` because it is borrowed
   --> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16
    |
+LL |     let mut f = move |g: Box<dyn FnMut(isize)>, b: isize| {
+   |         ----- binding `f` declared here
+...
 LL |     f(Box::new(|a| {
    |     -          ^^^ move out of `f` occurs here
    |     |
index 068c779ae52673be950d27f84d13255bea70f6b5..23ebc8d598c672d1d05b13227e5e7587e3a24c27 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `b2` does not live long enough
   --> $DIR/dropck_arr_cycle_checked.rs:93:24
    |
+LL |     let (b1, b2, b3);
+   |              -- binding `b2` declared here
+...
 LL |     b1.a[0].v.set(Some(&b2));
    |                        ^^^ borrowed value does not live long enough
 ...
@@ -15,6 +18,9 @@ LL | }
 error[E0597]: `b3` does not live long enough
   --> $DIR/dropck_arr_cycle_checked.rs:95:24
    |
+LL |     let (b1, b2, b3);
+   |                  -- binding `b3` declared here
+...
 LL |     b1.a[1].v.set(Some(&b3));
    |                        ^^^ borrowed value does not live long enough
 ...
@@ -29,6 +35,9 @@ LL | }
 error[E0597]: `b1` does not live long enough
   --> $DIR/dropck_arr_cycle_checked.rs:99:24
    |
+LL |     let (b1, b2, b3);
+   |          -- binding `b1` declared here
+...
 LL |     b3.a[0].v.set(Some(&b1));
    |                        ^^^ borrowed value does not live long enough
 ...
index 07ae138ac71eae3c91807e2acc1c56a719389299..1e75e3b2fa12180792a912a7df9ae755234cd161 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `d2` does not live long enough
   --> $DIR/dropck_direct_cycle_with_drop.rs:36:19
    |
+LL |     let (d1, d2) = (D::new(format!("d1")), D::new(format!("d2")));
+   |              -- binding `d2` declared here
 LL |     d1.p.set(Some(&d2));
    |                   ^^^ borrowed value does not live long enough
 ...
@@ -15,6 +17,9 @@ LL | }
 error[E0597]: `d1` does not live long enough
   --> $DIR/dropck_direct_cycle_with_drop.rs:38:19
    |
+LL |     let (d1, d2) = (D::new(format!("d1")), D::new(format!("d2")));
+   |          -- binding `d1` declared here
+...
 LL |     d2.p.set(Some(&d1));
    |                   ^^^ borrowed value does not live long enough
 LL |
index 76e90574cef440de02cc5ec826ec24c7072637f8..24a2c9089f5b1f1a9265fe8a27b189097c9ecfeb 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `bomb` does not live long enough
   --> $DIR/dropck_misc_variants.rs:23:36
    |
+LL |     let (_w, bomb);
+   |              ---- binding `bomb` declared here
+LL |     bomb = vec![""];
 LL |     _w = Wrap::<&[&str]>(NoisyDrop(&bomb));
    |                                    ^^^^^ borrowed value does not live long enough
 LL | }
@@ -14,6 +17,9 @@ LL | }
 error[E0597]: `v` does not live long enough
   --> $DIR/dropck_misc_variants.rs:31:27
    |
+LL |     let (_w,v);
+   |             - binding `v` declared here
+...
 LL |         let u = NoisyDrop(&v);
    |                           ^^ borrowed value does not live long enough
 ...
index 7ff991c0c3737d38de82cc72f9bc516e5a15d984..5817439c0d8555aff362c515e90b9613f4acc167 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `c2` does not live long enough
   --> $DIR/dropck_vec_cycle_checked.rs:98:24
    |
+LL |     let (mut c1, mut c2, mut c3);
+   |                  ------ binding `c2` declared here
+...
 LL |     c1.v[0].v.set(Some(&c2));
    |                        ^^^ borrowed value does not live long enough
 ...
@@ -15,6 +18,9 @@ LL | }
 error[E0597]: `c3` does not live long enough
   --> $DIR/dropck_vec_cycle_checked.rs:100:24
    |
+LL |     let (mut c1, mut c2, mut c3);
+   |                          ------ binding `c3` declared here
+...
 LL |     c1.v[1].v.set(Some(&c3));
    |                        ^^^ borrowed value does not live long enough
 ...
@@ -29,6 +35,9 @@ LL | }
 error[E0597]: `c1` does not live long enough
   --> $DIR/dropck_vec_cycle_checked.rs:104:24
    |
+LL |     let (mut c1, mut c2, mut c3);
+   |          ------ binding `c1` declared here
+...
 LL |     c3.v[0].v.set(Some(&c1));
    |                        ^^^ borrowed value does not live long enough
 ...
index 809e60a8c8aac99c664c47b5f7ad0dddad87bf0c..c3b6d7580b4e020598e555b9fbe2f8de8d1da023 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `d1` does not live long enough
   --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:28:18
    |
+LL |     let (_d, d1);
+   |              -- binding `d1` declared here
+...
 LL |     _d = D_Child(&d1);
    |                  ^^^ borrowed value does not live long enough
 ...
index 2e217066915d3cacad84e350ae8eff5bc198ff26..e52c57d9ab1f824ac0337cd8d614078776e0dc38 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `d1` does not live long enough
   --> $DIR/issue-24805-dropck-trait-has-items.rs:37:26
    |
+LL |     let (_d, d1);
+   |              -- binding `d1` declared here
+LL |     d1 = D_HasSelfMethod(1);
 LL |     _d = D_HasSelfMethod(&d1);
    |                          ^^^ borrowed value does not live long enough
 LL | }
@@ -14,6 +17,9 @@ LL | }
 error[E0597]: `d1` does not live long enough
   --> $DIR/issue-24805-dropck-trait-has-items.rs:43:33
    |
+LL |     let (_d, d1);
+   |              -- binding `d1` declared here
+LL |     d1 = D_HasMethodWithSelfArg(1);
 LL |     _d = D_HasMethodWithSelfArg(&d1);
    |                                 ^^^ borrowed value does not live long enough
 LL | }
@@ -27,6 +33,9 @@ LL | }
 error[E0597]: `d1` does not live long enough
   --> $DIR/issue-24805-dropck-trait-has-items.rs:49:20
    |
+LL |     let (_d, d1);
+   |              -- binding `d1` declared here
+LL |     d1 = D_HasType(1);
 LL |     _d = D_HasType(&d1);
    |                    ^^^ borrowed value does not live long enough
 LL | }
index 18a3dc9e6defa3855ab01aa200b45accadfd7184..83db4d509d49988b33fe3fe59d20dc7b9de4b231 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `d1` does not live long enough
   --> $DIR/issue-24895-copy-clone-dropck.rs:27:14
    |
+LL |     let (d2, d1);
+   |              -- binding `d1` declared here
+LL |     d1 = D(34, "d1");
 LL |     d2 = D(S(&d1, "inner"), "d2");
    |              ^^^ borrowed value does not live long enough
 LL | }
index d70a4afc1bf340e6c5fa88cfc8387e302895582b..1e0276f0c3694b6376e97817a4c4ceb9dfb57e1b 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `container` does not live long enough
   --> $DIR/issue-25199.rs:70:27
    |
+LL |     let container = Container::new();
+   |         --------- binding `container` declared here
 LL |     let test = Test{test: &container};
    |                           ^^^^^^^^^^ borrowed value does not live long enough
 ...
index 1e939c484fb7b35291775a78020242aded9791b6..fea6e001238b59294353970fc4bcc88da054e0f2 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `ticking` does not live long enough
   --> $DIR/issue-26656.rs:40:35
    |
+LL |     let (mut zook, ticking);
+   |                    ------- binding `ticking` declared here
+...
 LL |     zook.button = B::BigRedButton(&ticking);
    |                                   ^^^^^^^^ borrowed value does not live long enough
 LL | }
index 71fbd60ee733b27e0d4a2fedc54293d5f72e10aa..28ee7acd90e8c5b3ca80c5044c15f784aabfe55b 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/issue-29106.rs:16:26
    |
+LL |         let (y, x);
+   |                 - binding `x` declared here
+LL |         x = "alive".to_string();
 LL |         y = Arc::new(Foo(&x));
    |                          ^^ borrowed value does not live long enough
 LL |     }
@@ -14,6 +17,9 @@ LL |     }
 error[E0597]: `x` does not live long enough
   --> $DIR/issue-29106.rs:23:25
    |
+LL |         let (y, x);
+   |                 - binding `x` declared here
+LL |         x = "alive".to_string();
 LL |         y = Rc::new(Foo(&x));
    |                         ^^ borrowed value does not live long enough
 LL |     }
index 79a0ebaeb8db6c8b6ab999999737bd3194d2280e..6c330c1a094758b9de3345dbd87c6a294f1dca9b 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `a` does not live long enough
   --> $DIR/issue-36537.rs:5:13
    |
+LL |         let a = 42;
+   |             - binding `a` declared here
 LL |         p = &a;
    |             ^^ borrowed value does not live long enough
 ...
index 57f80214a4f83ad2c9988fda6677fdf434aaea07..e9b84de5059892d20ff3ddd498d6090271c9e998 100644 (file)
@@ -2,11 +2,9 @@ error[E0597]: `foo` does not live long enough
   --> $DIR/issue-40157.rs:2:53
    |
 LL |     {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });}
-   |                             ------------------------^^^^^^^^^^--
-   |                             |                       |          |
-   |                             |                       |          `foo` dropped here while still borrowed
-   |                             |                       borrowed value does not live long enough
-   |                             borrow later used here
+   |                                                     ^^^^^^^^^^ - `foo` dropped here while still borrowed
+   |                                                     |
+   |                                                     borrowed value does not live long enough
 
 error: aborting due to previous error
 
index 3119ddd03cc26654a20e1d31d9ce559e26aeb7f3..94c450c7b1ececc99ca46eff2b6086bb4ae0d143 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `first_dropped` does not live long enough
   --> $DIR/issue28498-reject-lifetime-param.rs:32:19
    |
+LL |     let (foo1, first_dropped);
+   |                ------------- binding `first_dropped` declared here
+...
 LL |     foo1 = Foo(1, &first_dropped);
    |                   ^^^^^^^^^^^^^^ borrowed value does not live long enough
 ...
index 60e8a648cd5979d37f780f315fd13fb6b199cb90..e133f75d57bb7628e3c7d01090bc497849002105 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `first_dropped` does not live long enough
   --> $DIR/issue28498-reject-passed-to-fn.rs:34:19
    |
+LL |     let (foo1, first_dropped);
+   |                ------------- binding `first_dropped` declared here
+...
 LL |     foo1 = Foo(1, &first_dropped, Box::new(callback));
    |                   ^^^^^^^^^^^^^^ borrowed value does not live long enough
 ...
index 22e4a8205b617723a856dd8f7e904ce7c962c368..9ab3cdd1343a1700dbf007fc2d1cf3fde58c5c4d 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `first_dropped` does not live long enough
   --> $DIR/issue28498-reject-trait-bound.rs:34:19
    |
+LL |     let (foo1, first_dropped);
+   |                ------------- binding `first_dropped` declared here
+...
 LL |     foo1 = Foo(1, &first_dropped);
    |                   ^^^^^^^^^^^^^^ borrowed value does not live long enough
 ...
index 4d976a7bbfa47bb52b59dd675606d3a49273a86b..be56f9489c770391aa139eab90b13fb72f522fe6 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `b` does not live long enough
   --> $DIR/mut-ptr-cant-outlive-ref.rs:8:15
    |
+LL |         let b = m.borrow();
+   |             - binding `b` declared here
 LL |         p = &*b;
    |               ^ borrowed value does not live long enough
 LL |     }
index 8ca8156b0830cbaaa8fe83c0dd97b4ed582f9dd7..d7084b00ba4027a78516321624e1d71bc2248b59 100644 (file)
@@ -3,7 +3,9 @@ error[E0597]: `a` does not live long enough
    |
 LL |     let r = {
    |         - borrow later stored here
-...
+LL |         let a = 42;
+   |             - binding `a` declared here
+LL |         let b = 42;
 LL |         &a..&b
    |         ^^ borrowed value does not live long enough
 LL |     };
@@ -14,7 +16,9 @@ error[E0597]: `b` does not live long enough
    |
 LL |     let r = {
    |         - borrow later stored here
-...
+LL |         let a = 42;
+LL |         let b = 42;
+   |             - binding `b` declared here
 LL |         &a..&b
    |             ^^ borrowed value does not live long enough
 LL |     };
index 0b985de609c26debdb98dbdcca279a3a685f655f..fb3fad6ae9050f4873d8293533ad35cbc18ed6be 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/regionck-unboxed-closure-lifetimes.rs:8:21
    |
+LL |         let c = 1;
+   |             - binding `c` declared here
 LL |         let c_ref = &c;
    |                     ^^ borrowed value does not live long enough
 ...
index 2e584d9a884f174f5f743cb2828c3c06a4e3a8fd..fed40a4fdd2a5984674f2d8ac889bf26cf439fe6 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `tmp0` does not live long enough
   --> $DIR/regions-close-over-type-parameter-2.rs:23:20
    |
+LL |         let tmp0 = 3;
+   |             ---- binding `tmp0` declared here
 LL |         let tmp1 = &tmp0;
    |                    ^^^^^ borrowed value does not live long enough
 LL |         repeater3(tmp1)
index 42df668529749df6d739a23fd8c37827cc5fde92..e5c7d8b26ab00e31fc8c39b88d583e8c4a0b2b68 100644 (file)
@@ -2,7 +2,9 @@ error[E0597]: `x` does not live long enough
   --> $DIR/regions-escape-loop-via-variable.rs:11:13
    |
 LL |         let x = 1 + *p;
-   |                     -- borrow later used here
+   |             -       -- borrow later used here
+   |             |
+   |             binding `x` declared here
 LL |         p = &x;
    |             ^^ borrowed value does not live long enough
 LL |     }
index 2b649307739f5c89b08ced82852cc6a4b03ce652..532ac3606c544e9fada531cd4277efb517207a92 100644 (file)
@@ -2,7 +2,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/regions-escape-loop-via-vec.rs:5:11
    |
 LL |     let mut _y = vec![&mut x];
-   |                       ------ borrow of `x` occurs here
+   |                       ------ `x` is borrowed here
 LL |     while x < 10 {
    |           ^ use of borrowed `x`
 LL |         let mut z = x;
@@ -13,7 +13,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/regions-escape-loop-via-vec.rs:6:21
    |
 LL |     let mut _y = vec![&mut x];
-   |                       ------ borrow of `x` occurs here
+   |                       ------ `x` is borrowed here
 LL |     while x < 10 {
 LL |         let mut z = x;
    |                     ^ use of borrowed `x`
@@ -23,11 +23,10 @@ LL |         _y.push(&mut z);
 error[E0597]: `z` does not live long enough
   --> $DIR/regions-escape-loop-via-vec.rs:7:17
    |
+LL |         let mut z = x;
+   |             ----- binding `z` declared here
 LL |         _y.push(&mut z);
-   |         --------^^^^^^-
-   |         |       |
-   |         |       borrowed value does not live long enough
-   |         borrow later used here
+   |                 ^^^^^^ borrowed value does not live long enough
 ...
 LL |     }
    |     - `z` dropped here while still borrowed
@@ -36,7 +35,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
   --> $DIR/regions-escape-loop-via-vec.rs:9:9
    |
 LL |     let mut _y = vec![&mut x];
-   |                       ------ borrow of `x` occurs here
+   |                       ------ `x` is borrowed here
 ...
 LL |         _y.push(&mut z);
    |         --------------- borrow later used here
index 65d10c1305b8c8480a4899e5667afc1b783f9ef7..bae0befcacaa7876877b6c77d1dbc7d3bc9a766c 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `x` does not live long enough
 LL |     let bad = {
    |         --- borrow later stored here
 LL |         let x = 1;
+   |             - binding `x` declared here
 LL |         let y = &x;
    |                 ^^ borrowed value does not live long enough
 ...
index bcd07e116477769fa44e720d4a0237f53908877c..b0267fa6f43b073ff832b88df3c52e889bf9abcb 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `x` does not live long enough
 LL |     let lock = {
    |         ---- borrow later stored here
 LL |         let x = 1;
+   |             - binding `x` declared here
 LL |         Mutex::new(&x)
    |                    ^^ borrowed value does not live long enough
 LL |     };
@@ -15,6 +16,7 @@ error[E0597]: `x` does not live long enough
 LL |     let lock = {
    |         ---- borrow later stored here
 LL |         let x = 1;
+   |             - binding `x` declared here
 LL |         RwLock::new(&x)
    |                     ^^ borrowed value does not live long enough
 LL |     };
@@ -25,7 +27,9 @@ error[E0597]: `x` does not live long enough
    |
 LL |     let (_tx, rx) = {
    |          --- borrow later used here
-...
+LL |         let x = 1;
+   |             - binding `x` declared here
+LL |         let (tx, rx) = mpsc::channel();
 LL |         let _ = tx.send(&x);
    |                         ^^ borrowed value does not live long enough
 LL |         (tx, rx)
index 5d493a3e4ee5555cfb2dd559196e8e1b11e1c5ca..28b1c5fe7152a950a55fc81f491831298d49e9b8 100644 (file)
@@ -12,6 +12,8 @@ LL |         *lock.lock().unwrap() = &z;
 error[E0597]: `z` does not live long enough
   --> $DIR/send-is-not-static-std-sync.rs:16:33
    |
+LL |         let z = 2;
+   |             - binding `z` declared here
 LL |         *lock.lock().unwrap() = &z;
    |                                 ^^ borrowed value does not live long enough
 LL |     }
@@ -34,6 +36,8 @@ LL |         *lock.write().unwrap() = &z;
 error[E0597]: `z` does not live long enough
   --> $DIR/send-is-not-static-std-sync.rs:30:34
    |
+LL |         let z = 2;
+   |             - binding `z` declared here
 LL |         *lock.write().unwrap() = &z;
    |                                  ^^ borrowed value does not live long enough
 LL |     }
@@ -56,6 +60,8 @@ LL |         tx.send(&z).unwrap();
 error[E0597]: `z` does not live long enough
   --> $DIR/send-is-not-static-std-sync.rs:46:17
    |
+LL |         let z = 2;
+   |             - binding `z` declared here
 LL |         tx.send(&z).unwrap();
    |                 ^^ borrowed value does not live long enough
 LL |     }
index f87c32d1ad0c6dd542eae38e86879ee1ceea5b0a..f2fefca414ec42813e2868baf2f08eb2df9a43dd 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `c2` does not live long enough
   --> $DIR/vec-must-not-hide-type-from-dropck.rs:117:24
    |
+LL |     let (mut c1, mut c2);
+   |                  ------ binding `c2` declared here
+...
 LL |     c1.v[0].v.set(Some(&c2));
    |                        ^^^ borrowed value does not live long enough
 ...
@@ -15,6 +18,9 @@ LL | }
 error[E0597]: `c1` does not live long enough
   --> $DIR/vec-must-not-hide-type-from-dropck.rs:119:24
    |
+LL |     let (mut c1, mut c2);
+   |          ------ binding `c1` declared here
+...
 LL |     c2.v[0].v.set(Some(&c1));
    |                        ^^^ borrowed value does not live long enough
 LL |
index 684e7845313252be913bab7143748de1f38ab1a5..73f27144af423fcf6b66e7889d49fd7954913195 100644 (file)
@@ -1,6 +1,9 @@
 error[E0597]: `x` does not live long enough
   --> $DIR/vec_refs_data_with_early_death.rs:17:12
    |
+LL |     let x: i8 = 3;
+   |         - binding `x` declared here
+...
 LL |     v.push(&x);
    |            ^^ borrowed value does not live long enough
 ...
@@ -15,6 +18,9 @@ LL | }
 error[E0597]: `y` does not live long enough
   --> $DIR/vec_refs_data_with_early_death.rs:19:12
    |
+LL |     let y: i8 = 4;
+   |         - binding `y` declared here
+...
 LL |     v.push(&y);
    |            ^^ borrowed value does not live long enough
 ...
index 6b0b008208f17145097e6eb6197b6ef54a679247..64c2d0f1606652c4c9ca3b519b72e557e4aeac03 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `pointer` does not live long enough
 LL |     let dangling = {
    |         -------- borrow later stored here
 LL |         let pointer = Box::new(42);
+   |             ------- binding `pointer` declared here
 LL |         f2.xmute(&pointer)
    |                  ^^^^^^^^ borrowed value does not live long enough
 LL |     };
index ef07a89315f4088ddd653b649a5e0d8cf1f99fd3..e22411b13b776b968140a6716005dc1c2384d11e 100644 (file)
@@ -9,6 +9,8 @@ LL | fn f<'a: 'static>(_: &'a i32) {}
 error[E0597]: `x` does not live long enough
   --> $DIR/static-lifetime-bound.rs:5:7
    |
+LL |     let x = 0;
+   |         - binding `x` declared here
 LL |     f(&x);
    |     --^^-
    |     | |
index cbdb94877bdb7fbf897d0020c928bc6d718646a8..0f179438a1263bacb0dbed76f3d8df47ec93981d 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `a` because it is borrowed
   --> $DIR/borrow-for-loop-head.rs:4:18
    |
+LL |     let a = vec![1, 2, 3];
+   |         - binding `a` declared here
 LL |     for i in &a {
    |              -- borrow of `a` occurs here
 LL |         for j in a {
index 1d3dff3be3476d4b0678d0881b06c855fc7ca905..94acda73c4efe2bc4aacb938093afe7aa1c6c23f 100644 (file)
@@ -7,7 +7,7 @@ LL |     func(|| {
    |          -- captured by this `FnMut` closure
 LL |         // Shouldn't suggest `move ||.as_ref()` here
 LL |         move || {
-   |         ^^^^^^^ move out of `var` occurs here
+   |         ^^^^^^^ `var` is moved here
 LL |
 LL |             var = Some(NotCopyable);
    |             ---
index ade552c4bab41a0dc45c5c500247cce82888300d..c7af71a421438b7ac9e595ef443df5f895563bee 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `s` does not live long enough
   --> $DIR/check-trait-object-bounds-3.rs:15:34
    |
+LL |         let s = String::from("abcdef");
+   |             - binding `s` declared here
 LL |         z = f::<dyn X<Y = &str>>(&s);
    |             ---------------------^^-
    |             |                    |
index 5cfb64901233ea79e780e6613e3da060cdeb0581..ae70202ab7ccd5d145640988c605c6ae9e51627e 100644 (file)
@@ -1,6 +1,8 @@
 error[E0597]: `person` does not live long enough
   --> $DIR/coercion-generic-regions.rs:17:24
    |
+LL |     let person = "Fred".to_string();
+   |         ------ binding `person` declared here
 LL |     let person: &str = &person;
    |                        ^^^^^^^
    |                        |
index c4f8294e26356a81f183af1fbb8b991eca42cc75..89360c44e78b45de94145848ed48cdebd67e0b38 100644 (file)
@@ -1,6 +1,9 @@
 error[E0505]: cannot move out of `v` because it is borrowed
   --> $DIR/issue-97381.rs:26:14
    |
+LL |     let v = [1, 2, 3]
+   |         - binding `v` declared here
+...
 LL |     let el = &v[0];
    |               - borrow of `v` occurs here
 LL |
index ea079e30d9c395858450c640a2bf29bc2da0f22d..28941cb0a9e4033296ed05666e0a03684d30630b 100644 (file)
@@ -4,6 +4,7 @@ error[E0597]: `my_string` does not live long enough
 LL |         let result: Result<(), &str> = try {
    |             ------ borrow later stored here
 LL |             let my_string = String::from("");
+   |                 --------- binding `my_string` declared here
 LL |             let my_str: & str = & my_string;
    |                                 ^^^^^^^^^^^ borrowed value does not live long enough
 ...
@@ -14,10 +15,10 @@ error[E0506]: cannot assign to `i` because it is borrowed
   --> $DIR/try-block-bad-lifetime.rs:29:13
    |
 LL |         let k = &mut i;
-   |                 ------ borrow of `i` occurs here
+   |                 ------ `i` is borrowed here
 ...
 LL |             i = 10;
-   |             ^^^^^^ assignment to borrowed `i` occurs here
+   |             ^^^^^^ `i` is assigned to here but it was already borrowed
 LL |         };
 LL |         ::std::mem::drop(k);
    |                          - borrow later used here
@@ -38,10 +39,10 @@ error[E0506]: cannot assign to `i` because it is borrowed
   --> $DIR/try-block-bad-lifetime.rs:32:9
    |
 LL |         let k = &mut i;
-   |                 ------ borrow of `i` occurs here
+   |                 ------ `i` is borrowed here
 ...
 LL |         i = 40;
-   |         ^^^^^^ assignment to borrowed `i` occurs here
+   |         ^^^^^^ `i` is assigned to here but it was already borrowed
 LL |
 LL |         let i_ptr = if let Err(i_ptr) = j { i_ptr } else { panic ! ("") };
    |                                         - borrow later used here
index f738b03eed6b8441cba5d88252b8dd6ddb39a1cb..71c7e460c3992cc8a2018505a5adf992738dfab4 100644 (file)
@@ -2,10 +2,10 @@ error[E0506]: cannot assign to `i` because it is borrowed
   --> $DIR/try-block-maybe-bad-lifetime.rs:17:9
    |
 LL |             &i
-   |             -- borrow of `i` occurs here
+   |             -- `i` is borrowed here
 LL |         };
 LL |         i = 0;
-   |         ^^^^^ assignment to borrowed `i` occurs here
+   |         ^^^^^ `i` is assigned to here but it was already borrowed
 LL |         let _ = i;
 LL |         do_something_with(x);
    |                           - borrow later used here
@@ -32,10 +32,10 @@ error[E0506]: cannot assign to `i` because it is borrowed
   --> $DIR/try-block-maybe-bad-lifetime.rs:40:9
    |
 LL |             j = &i;
-   |                 -- borrow of `i` occurs here
+   |                 -- `i` is borrowed here
 LL |         };
 LL |         i = 0;
-   |         ^^^^^ assignment to borrowed `i` occurs here
+   |         ^^^^^ `i` is assigned to here but it was already borrowed
 LL |         let _ = i;
 LL |         do_something_with(j);
    |                           - borrow later used here
index 21d6b4fde7e905f94f49affc7d58a1770be38199..98fe97c5c1814e5051bb02c8ae49a3f1e21253e1 100644 (file)
@@ -4,7 +4,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
 LL |     let f = || x += 1;
    |             -- - borrow occurs due to use of `x` in closure
    |             |
-   |             borrow of `x` occurs here
+   |             `x` is borrowed here
 LL |     let _y = x;
    |              ^ use of borrowed `x`
 LL |     f;
index cbdb4dd0fb5c8cd939aa1f7f68e8ab7960899f50..23aa18d7156ac9509033767b276349fd76ef8981 100644 (file)
@@ -16,14 +16,14 @@ error[E0506]: cannot assign to `factorial` because it is borrowed
   --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:20:5
    |
 LL |     let f = |x: u32| -> u32 {
-   |             --------------- borrow of `factorial` occurs here
+   |             --------------- `factorial` is borrowed here
 LL |         let g = factorial.as_ref().unwrap();
    |                 --------- borrow occurs due to use in closure
 ...
 LL |     factorial = Some(Box::new(f));
    |     ^^^^^^^^^
    |     |
-   |     assignment to borrowed `factorial` occurs here
+   |     `factorial` is assigned to here but it was already borrowed
    |     borrow later used here
 
 error[E0597]: `factorial` does not live long enough
@@ -47,12 +47,12 @@ LL |     let mut factorial: Option<Box<dyn Fn(u32) -> u32 + 'static>> = None;
    |                        ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static`
 LL |
 LL |     let f = |x: u32| -> u32 {
-   |             --------------- borrow of `factorial` occurs here
+   |             --------------- `factorial` is borrowed here
 LL |         let g = factorial.as_ref().unwrap();
    |                 --------- borrow occurs due to use in closure
 ...
 LL |     factorial = Some(Box::new(f));
-   |     ^^^^^^^^^ assignment to borrowed `factorial` occurs here
+   |     ^^^^^^^^^ `factorial` is assigned to here but it was already borrowed
 
 error: aborting due to 4 previous errors
 
index 2a3ca14433f62ffeaec52fb189a016064eda8d35..e47785c465ac6a8614c1fe21eaabd9a9a1e64cc3 100644 (file)
@@ -23,6 +23,8 @@ LL | fn move_then_borrow<T: Not<Output=T> + Clone + Copy>(x: T) {
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/unop-move-semantics.rs:15:6
    |
+LL | fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
+   |                                    - binding `x` declared here
 LL |     let m = &x;
    |             -- borrow of `x` occurs here
 ...
@@ -35,6 +37,9 @@ LL |     use_mut(n); use_imm(m);
 error[E0505]: cannot move out of `y` because it is borrowed
   --> $DIR/unop-move-semantics.rs:17:6
    |
+LL | fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
+   |                                          ----- binding `y` declared here
+LL |     let m = &x;
 LL |     let n = &mut y;
    |             ------ borrow of `y` occurs here
 ...
index 008e2a002bbb06829e637a8f8c88b1b048822108..258f67db5ce4b50a9185ac46ad3e9613ed2df121 100644 (file)
@@ -1,6 +1,8 @@
 error[E0505]: cannot move out of `a` because it is borrowed
   --> $DIR/variance-issue-20533.rs:28:14
    |
+LL |         let a = AffineU32(1);
+   |             - binding `a` declared here
 LL |         let x = foo(&a);
    |                     -- borrow of `a` occurs here
 LL |         drop(a);
@@ -11,6 +13,8 @@ LL |         drop(x);
 error[E0505]: cannot move out of `a` because it is borrowed
   --> $DIR/variance-issue-20533.rs:34:14
    |
+LL |         let a = AffineU32(1);
+   |             - binding `a` declared here
 LL |         let x = bar(&a);
    |                     -- borrow of `a` occurs here
 LL |         drop(a);
@@ -21,6 +25,8 @@ LL |         drop(x);
 error[E0505]: cannot move out of `a` because it is borrowed
   --> $DIR/variance-issue-20533.rs:40:14
    |
+LL |         let a = AffineU32(1);
+   |             - binding `a` declared here
 LL |         let x = baz(&a);
    |                     -- borrow of `a` occurs here
 LL |         drop(a);