Rollup merge of #106897 - estebank:issue-99430, r=davidtwco

Tweak E0597

CC #99430
This commit is contained in:
Matthias Krüger 2023-01-25 22:19:52 +01:00 committed by GitHub
commit 9e3f330656
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
230 changed files with 853 additions and 354 deletions

View file

@ -37,7 +37,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
desc, 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.span_label(span, format!("use of borrowed {}", borrow_desc));
err err
} }
@ -250,8 +250,8 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
desc, desc,
); );
err.span_label(borrow_span, format!("borrow of {} occurs here", desc)); err.span_label(borrow_span, format!("{} is borrowed here", desc));
err.span_label(span, format!("assignment to borrowed {} occurs here", desc)); err.span_label(span, format!("{} is assigned to here but it was already borrowed", desc));
err err
} }

View file

@ -1736,7 +1736,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
&self.local_names, &self.local_names,
&mut err, &mut err,
"", "",
None, Some(borrow_span),
None, None,
); );
} }

View file

@ -1,6 +1,8 @@
//! Print diagnostics to explain why values are borrowed. //! Print diagnostics to explain why values are borrowed.
use rustc_errors::{Applicability, Diagnostic}; use rustc_errors::{Applicability, Diagnostic};
use rustc_hir as hir;
use rustc_hir::intravisit::Visitor;
use rustc_index::vec::IndexVec; use rustc_index::vec::IndexVec;
use rustc_infer::infer::NllRegionVariableOrigin; use rustc_infer::infer::NllRegionVariableOrigin;
use rustc_middle::mir::{ use rustc_middle::mir::{
@ -11,6 +13,7 @@ use rustc_middle::ty::adjustment::PointerCast;
use rustc_middle::ty::{self, RegionVid, TyCtxt}; use rustc_middle::ty::{self, RegionVid, TyCtxt};
use rustc_span::symbol::{kw, Symbol}; use rustc_span::symbol::{kw, Symbol};
use rustc_span::{sym, DesugaringKind, Span}; use rustc_span::{sym, DesugaringKind, Span};
use rustc_trait_selection::traits::error_reporting::FindExprBySpan;
use crate::region_infer::{BlameConstraint, ExtraConstraintInfo}; use crate::region_infer::{BlameConstraint, ExtraConstraintInfo};
use crate::{ use crate::{
@ -63,6 +66,36 @@ impl<'tcx> BorrowExplanation<'tcx> {
borrow_span: Option<Span>, borrow_span: Option<Span>,
multiple_borrow_span: Option<(Span, 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)
| hir::ExprKind::Unary(hir::UnOp::Deref, inner)
| hir::ExprKind::Field(inner, _)
| hir::ExprKind::MethodCall(_, inner, _, _)
| hir::ExprKind::Index(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 { match *self {
BorrowExplanation::UsedLater(later_use_kind, var_or_use_span, path_span) => { BorrowExplanation::UsedLater(later_use_kind, var_or_use_span, path_span) => {
let message = match later_use_kind { let message = match later_use_kind {

View file

@ -448,7 +448,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
}; };
self.note_type_does_not_implement_copy(err, &place_desc, place_ty, Some(span), ""); 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"));
} }
} }
} }

View file

@ -2825,7 +2825,7 @@ pub struct FindExprBySpan<'hir> {
} }
impl<'hir> FindExprBySpan<'hir> { impl<'hir> FindExprBySpan<'hir> {
fn new(span: Span) -> Self { pub fn new(span: Span) -> Self {
Self { span, result: None, ty_result: None } Self { span, result: None, ty_result: None }
} }
} }

View file

@ -1,6 +1,8 @@
error[E0597]: `arena` does not live long enough error[E0597]: `arena` does not live long enough
--> $DIR/dropck-tarena-cycle-checked.rs:116:7 --> $DIR/dropck-tarena-cycle-checked.rs:116:7
| |
LL | let arena = TypedArena::default();
| ----- binding `arena` declared here
LL | f(&arena); LL | f(&arena);
| ^^^^^^ borrowed value does not live long enough | ^^^^^^ borrowed value does not live long enough
LL | } LL | }

View file

@ -1,6 +1,8 @@
error[E0597]: `arena` does not live long enough error[E0597]: `arena` does not live long enough
--> $DIR/dropck-tarena-unsound-drop.rs:41:7 --> $DIR/dropck-tarena-unsound-drop.rs:41:7
| |
LL | let arena: TypedArena<C> = TypedArena::default();
| ----- binding `arena` declared here
LL | f(&arena); LL | f(&arena);
| ^^^^^^ borrowed value does not live long enough | ^^^^^^ borrowed value does not live long enough
LL | } LL | }

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `a` because it is borrowed
--> $DIR/type-check-4.rs:14:9 --> $DIR/type-check-4.rs:14:9
| |
LL | let p = &a; LL | let p = &a;
| -- borrow of `a` occurs here | -- `a` is borrowed here
LL | asm!("{}", out(reg) a); LL | asm!("{}", out(reg) a);
| ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `a` occurs here | ^^^^^^^^^^^^^^^^^^^^^^ `a` is assigned to here but it was already borrowed
LL | LL |
LL | println!("{}", p); LL | println!("{}", p);
| - borrow later used here | - 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 --> $DIR/type-check-4.rs:22:28
| |
LL | let p = &mut a; LL | let p = &mut a;
| ------ borrow of `a` occurs here | ------ `a` is borrowed here
LL | asm!("{}", in(reg) a); LL | asm!("{}", in(reg) a);
| ^ use of borrowed `a` | ^ use of borrowed `a`
LL | LL |

View file

@ -1,6 +1,9 @@
error[E0505]: cannot move out of `x` because it is borrowed error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/associated-types-outlives.rs:22:14 --> $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 } LL | 's: loop { y = denormalise(&x); break }
| -- borrow of `x` occurs here | -- borrow of `x` occurs here
LL | drop(x); LL | drop(x);

View 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 { LL | pub async fn async_fn(x: &mut i32) -> &i32 {
| - let's call the lifetime of this reference `'1` | - let's call the lifetime of this reference `'1`
LL | let y = &*x; LL | let y = &*x;
| --- borrow of `*x` occurs here | --- `*x` is borrowed here
LL | *x += 1; LL | *x += 1;
| ^^^^^^^ assignment to borrowed `*x` occurs here | ^^^^^^^ `*x` is assigned to here but it was already borrowed
LL | y LL | y
| - returning this value requires that `*x` is borrowed for `'1` | - 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 --> $DIR/issue-74072-lifetime-name-annotations.rs:16:9
| |
LL | let y = &*x; LL | let y = &*x;
| --- borrow of `*x` occurs here | --- `*x` is borrowed here
LL | *x += 1; LL | *x += 1;
| ^^^^^^^ assignment to borrowed `*x` occurs here | ^^^^^^^ `*x` is assigned to here but it was already borrowed
LL | y LL | y
| - returning this value requires that `*x` is borrowed for `'1` | - returning this value requires that `*x` is borrowed for `'1`
LL | })() LL | })()
@ -28,9 +28,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
LL | (async move || -> &i32 { LL | (async move || -> &i32 {
| - let's call the lifetime of this reference `'1` | - let's call the lifetime of this reference `'1`
LL | let y = &*x; LL | let y = &*x;
| --- borrow of `*x` occurs here | --- `*x` is borrowed here
LL | *x += 1; LL | *x += 1;
| ^^^^^^^ assignment to borrowed `*x` occurs here | ^^^^^^^ `*x` is assigned to here but it was already borrowed
LL | y LL | y
| - returning this value requires that `*x` is borrowed for `'1` | - 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 --> $DIR/issue-74072-lifetime-name-annotations.rs:32:9
| |
LL | let y = &*x; LL | let y = &*x;
| --- borrow of `*x` occurs here | --- `*x` is borrowed here
LL | *x += 1; LL | *x += 1;
| ^^^^^^^ assignment to borrowed `*x` occurs here | ^^^^^^^ `*x` is assigned to here but it was already borrowed
LL | y LL | y
| - returning this value requires that `*x` is borrowed for `'1` | - returning this value requires that `*x` is borrowed for `'1`
LL | } LL | }

View 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) { LL | pub async fn async_fn(x: &mut i32) -> (&i32, &i32) {
| - let's call the lifetime of this reference `'1` | - let's call the lifetime of this reference `'1`
LL | let y = &*x; LL | let y = &*x;
| --- borrow of `*x` occurs here | --- `*x` is borrowed here
LL | *x += 1; LL | *x += 1;
| ^^^^^^^ assignment to borrowed `*x` occurs here | ^^^^^^^ `*x` is assigned to here but it was already borrowed
LL | (&32, y) LL | (&32, y)
| -------- returning this value requires that `*x` is borrowed for `'1` | -------- returning this value requires that `*x` is borrowed for `'1`

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `a` because it is borrowed
--> $DIR/ret-ref.rs:16:5 --> $DIR/ret-ref.rs:16:5
| |
LL | let future = multiple_named_lifetimes(&a, &b); LL | let future = multiple_named_lifetimes(&a, &b);
| -- borrow of `a` occurs here | -- `a` is borrowed here
LL | a += 1; LL | a += 1;
| ^^^^^^ assignment to borrowed `a` occurs here | ^^^^^^ `a` is assigned to here but it was already borrowed
LL | b += 1; LL | b += 1;
LL | let p = future.await; LL | let p = future.await;
| ------ borrow later used here | ------ borrow later used here
@ -13,10 +13,10 @@ error[E0506]: cannot assign to `b` because it is borrowed
--> $DIR/ret-ref.rs:17:5 --> $DIR/ret-ref.rs:17:5
| |
LL | let future = multiple_named_lifetimes(&a, &b); LL | let future = multiple_named_lifetimes(&a, &b);
| -- borrow of `b` occurs here | -- `b` is borrowed here
LL | a += 1; LL | a += 1;
LL | b += 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; LL | let p = future.await;
| ------ borrow later used here | ------ borrow later used here
@ -24,10 +24,10 @@ error[E0506]: cannot assign to `a` because it is borrowed
--> $DIR/ret-ref.rs:28:5 --> $DIR/ret-ref.rs:28:5
| |
LL | let future = multiple_named_lifetimes(&a, &b); LL | let future = multiple_named_lifetimes(&a, &b);
| -- borrow of `a` occurs here | -- `a` is borrowed here
LL | let p = future.await; LL | let p = future.await;
LL | a += 1; LL | a += 1;
| ^^^^^^ assignment to borrowed `a` occurs here | ^^^^^^ `a` is assigned to here but it was already borrowed
LL | b += 1; LL | b += 1;
LL | drop(p); LL | drop(p);
| - borrow later used here | - borrow later used here

View file

@ -9,7 +9,7 @@ impl AddAssign for Int {
} }
fn main() { fn main() {
let mut x = Int(1); let mut x = Int(1); //~ NOTE binding `x` declared here
x x
//~^ NOTE borrow of `x` occurs here //~^ NOTE borrow of `x` occurs here
+= +=

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `x` because it is borrowed error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/augmented-assignments.rs:16:5 --> $DIR/augmented-assignments.rs:16:5
| |
LL | let mut x = Int(1);
| ----- binding `x` declared here
LL | x LL | x
| - borrow of `x` occurs here | - borrow of `x` occurs here
... ...

View 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 error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/binop-move-semantics.rs:21:5 --> $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; LL | let m = &x;
| -- borrow of `x` occurs here | -- 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 error[E0505]: cannot move out of `y` because it is borrowed
--> $DIR/binop-move-semantics.rs:23:5 --> $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; LL | let n = &mut y;
| ------ borrow of `y` occurs here | ------ borrow of `y` occurs here
... ...

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `x` because it is borrowed error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/borrow-tuple-fields.rs:12:13 --> $DIR/borrow-tuple-fields.rs:12:13
| |
LL | let x: (Box<_>, _) = (Box::new(1), 2);
| - binding `x` declared here
LL | let r = &x.0; LL | let r = &x.0;
| ---- borrow of `x.0` occurs here | ---- borrow of `x.0` occurs here
LL | let y = x; LL | let y = x;
@ -32,6 +34,8 @@ LL | a.use_ref();
error[E0505]: cannot move out of `x` because it is borrowed error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/borrow-tuple-fields.rs:28:13 --> $DIR/borrow-tuple-fields.rs:28:13
| |
LL | let x = Foo(Box::new(1), 2);
| - binding `x` declared here
LL | let r = &x.0; LL | let r = &x.0;
| ---- borrow of `x.0` occurs here | ---- borrow of `x.0` occurs here
LL | let y = x; LL | let y = x;

View file

@ -2,7 +2,7 @@ error[E0503]: cannot use `y` because it was mutably borrowed
--> $DIR/borrowck-anon-fields-variant.rs:16:19 --> $DIR/borrowck-anon-fields-variant.rs:16:19
| |
LL | Foo::Y(ref mut a, _) => a, LL | Foo::Y(ref mut a, _) => a,
| --------- borrow of `y.0` occurs here | --------- `y.0` is borrowed here
... ...
LL | let b = match y { LL | let b = match y {
| ^ use of borrowed `y.0` | ^ 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 --> $DIR/borrowck-anon-fields-variant.rs:34:19
| |
LL | Foo::Y(ref mut a, _) => a, LL | Foo::Y(ref mut a, _) => a,
| --------- borrow of `y.0` occurs here | --------- `y.0` is borrowed here
... ...
LL | let b = match y { LL | let b = match y {
| ^ use of borrowed `y.0` | ^ use of borrowed `y.0`

View file

@ -2,10 +2,10 @@ error[E0506]: cannot assign to `p.x` because it is borrowed
--> $DIR/borrowck-assign-comp.rs:10:5 --> $DIR/borrowck-assign-comp.rs:10:5
| |
LL | let q = &p; LL | let q = &p;
| -- borrow of `p.x` occurs here | -- `p.x` is borrowed here
... ...
LL | p.x = 5; 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; LL | q.x;
| --- borrow later used here | --- 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 --> $DIR/borrowck-assign-comp.rs:20:5
| |
LL | let q = &p.y; LL | let q = &p.y;
| ---- borrow of `p` occurs here | ---- `p` is borrowed here
LL | p = Point {x: 5, y: 7}; 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 | p.x; // silence warning
LL | *q; // stretch loan LL | *q; // stretch loan
| -- borrow later used here | -- 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 --> $DIR/borrowck-assign-comp.rs:31:5
| |
LL | let q = &p.y; LL | let q = &p.y;
| ---- borrow of `p.y` occurs here | ---- `p.y` is borrowed here
LL | p.y = 5; LL | p.y = 5;
| ^^^^^^^ assignment to borrowed `p.y` occurs here | ^^^^^^^ `p.y` is assigned to here but it was already borrowed
LL | *q; LL | *q;
| -- borrow later used here | -- borrow later used here

View 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 --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9
| |
LL | let z = copy_borrowed_ptr(&mut y); LL | let z = copy_borrowed_ptr(&mut y);
| ------ borrow of `y` occurs here | ------ `y` is borrowed here
LL | *y.pointer += 1; LL | *y.pointer += 1;
| ^^^^^^^^^^^^^^^ use of borrowed `y` | ^^^^^^^^^^^^^^^ 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 --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9
| |
LL | let z = copy_borrowed_ptr(&mut y); LL | let z = copy_borrowed_ptr(&mut y);
| ------ borrow of `*y.pointer` occurs here | ------ `*y.pointer` is borrowed here
LL | *y.pointer += 1; 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; LL | *z.pointer += 1;
| --------------- borrow later used here | --------------- borrow later used here

View file

@ -1,6 +1,9 @@
error[E0505]: cannot move out of `a` because it is borrowed error[E0505]: cannot move out of `a` because it is borrowed
--> $DIR/borrowck-bad-nested-calls-move.rs:25:9 --> $DIR/borrowck-bad-nested-calls-move.rs:25:9
| |
LL | let mut a: Box<_> = Box::new(1);
| ----- binding `a` declared here
...
LL | add( LL | add(
| --- borrow later used by call | --- borrow later used by call
LL | &*a, LL | &*a,
@ -11,6 +14,8 @@ LL | a);
error[E0505]: cannot move out of `a` because it is borrowed error[E0505]: cannot move out of `a` because it is borrowed
--> $DIR/borrowck-bad-nested-calls-move.rs:32:9 --> $DIR/borrowck-bad-nested-calls-move.rs:32:9
| |
LL | let mut a: Box<_> = Box::new(1);
| ----- binding `a` declared here
LL | add( LL | add(
| --- borrow later used by call | --- borrow later used by call
LL | &*a, LL | &*a,

View file

@ -49,9 +49,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
LL | let c2 = || x * 5; LL | let c2 = || x * 5;
| -- - borrow occurs due to use in closure | -- - borrow occurs due to use in closure
| | | |
| borrow of `x` occurs here | `x` is borrowed here
LL | x = 5; LL | x = 5;
| ^^^^^ assignment to borrowed `x` occurs here | ^^^^^ `x` is assigned to here but it was already borrowed
LL | LL |
LL | drop(c2); LL | drop(c2);
| -- borrow later used here | -- borrow later used here
@ -62,9 +62,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
LL | let c1 = || get(&x); LL | let c1 = || get(&x);
| -- - borrow occurs due to use in closure | -- - borrow occurs due to use in closure
| | | |
| borrow of `x` occurs here | `x` is borrowed here
LL | x = 5; LL | x = 5;
| ^^^^^ assignment to borrowed `x` occurs here | ^^^^^ `x` is assigned to here but it was already borrowed
LL | LL |
LL | drop(c1); LL | drop(c1);
| -- borrow later used here | -- borrow later used here
@ -75,9 +75,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
LL | let c1 = || get(&*x); LL | let c1 = || get(&*x);
| -- -- borrow occurs due to use in closure | -- -- borrow occurs due to use in closure
| | | |
| borrow of `*x` occurs here | `*x` is borrowed here
LL | *x = 5; LL | *x = 5;
| ^^^^^^ assignment to borrowed `*x` occurs here | ^^^^^^ `*x` is assigned to here but it was already borrowed
LL | LL |
LL | drop(c1); LL | drop(c1);
| -- borrow later used here | -- 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); LL | let c1 = || get(&*x.f);
| -- ---- borrow occurs due to use in closure | -- ---- borrow occurs due to use in closure
| | | |
| borrow of `*x.f` occurs here | `*x.f` is borrowed here
LL | *x.f = 5; LL | *x.f = 5;
| ^^^^^^^^ assignment to borrowed `*x.f` occurs here | ^^^^^^^^ `*x.f` is assigned to here but it was already borrowed
LL | LL |
LL | drop(c1); LL | drop(c1);
| -- borrow later used here | -- borrow later used here

View file

@ -45,7 +45,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:37:9 --> $DIR/borrowck-describe-lvalue.rs:37:9
| |
LL | let x = f.x(); LL | let x = f.x();
| ----- borrow of `f` occurs here | ----- `f` is borrowed here
LL | f.x; LL | f.x;
| ^^^ use of borrowed `f` | ^^^ use of borrowed `f`
LL | drop(x); 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 --> $DIR/borrowck-describe-lvalue.rs:44:9
| |
LL | let x = g.x(); LL | let x = g.x();
| ----- borrow of `g` occurs here | ----- `g` is borrowed here
LL | g.0; LL | g.0;
| ^^^ use of borrowed `g` | ^^^ use of borrowed `g`
LL | drop(x); 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 --> $DIR/borrowck-describe-lvalue.rs:51:9
| |
LL | let x = &mut h.0; LL | let x = &mut h.0;
| -------- borrow of `h.0` occurs here | -------- `h.0` is borrowed here
LL | h.0; LL | h.0;
| ^^^ use of borrowed `h.0` | ^^^ use of borrowed `h.0`
LL | drop(x); 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 --> $DIR/borrowck-describe-lvalue.rs:59:20
| |
LL | let x = e.x(); LL | let x = e.x();
| ----- borrow of `e` occurs here | ----- `e` is borrowed here
LL | match e { LL | match e {
LL | Baz::X(value) => value LL | Baz::X(value) => value
| ^^^^^ use of borrowed `e` | ^^^^^ 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 --> $DIR/borrowck-describe-lvalue.rs:67:9
| |
LL | let x = &mut u.a; LL | let x = &mut u.a;
| -------- borrow of `u.a` occurs here | -------- `u.a` is borrowed here
LL | u.a; LL | u.a;
| ^^^ use of borrowed `u.a` | ^^^ use of borrowed `u.a`
LL | drop(x); 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 --> $DIR/borrowck-describe-lvalue.rs:74:9
| |
LL | let x = f.x(); LL | let x = f.x();
| ----- borrow of `*f` occurs here | ----- `*f` is borrowed here
LL | f.x; LL | f.x;
| ^^^ use of borrowed `*f` | ^^^ use of borrowed `*f`
LL | drop(x); 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 --> $DIR/borrowck-describe-lvalue.rs:81:9
| |
LL | let x = g.x(); LL | let x = g.x();
| ----- borrow of `*g` occurs here | ----- `*g` is borrowed here
LL | g.0; LL | g.0;
| ^^^ use of borrowed `*g` | ^^^ use of borrowed `*g`
LL | drop(x); 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 --> $DIR/borrowck-describe-lvalue.rs:88:9
| |
LL | let x = &mut h.0; LL | let x = &mut h.0;
| -------- borrow of `h.0` occurs here | -------- `h.0` is borrowed here
LL | h.0; LL | h.0;
| ^^^ use of borrowed `h.0` | ^^^ use of borrowed `h.0`
LL | drop(x); 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 --> $DIR/borrowck-describe-lvalue.rs:96:20
| |
LL | let x = e.x(); LL | let x = e.x();
| ----- borrow of `*e` occurs here | ----- `*e` is borrowed here
LL | match *e { LL | match *e {
LL | Baz::X(value) => value LL | Baz::X(value) => value
| ^^^^^ use of borrowed `*e` | ^^^^^ 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 --> $DIR/borrowck-describe-lvalue.rs:105:9
| |
LL | let x = &mut u.a; LL | let x = &mut u.a;
| -------- borrow of `u.a` occurs here | -------- `u.a` is borrowed here
LL | u.a; LL | u.a;
| ^^^ use of borrowed `u.a` | ^^^ use of borrowed `u.a`
LL | drop(x); LL | drop(x);
@ -149,7 +149,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:113:15 --> $DIR/borrowck-describe-lvalue.rs:113:15
| |
LL | let x = &mut v; LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ `v` is borrowed here
LL | match v { LL | match v {
LL | &[x, _, .., _, _] => println!("{}", x), LL | &[x, _, .., _, _] => println!("{}", x),
| ^ use of borrowed `v` | ^ 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 --> $DIR/borrowck-describe-lvalue.rs:118:18
| |
LL | let x = &mut v; LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ `v` is borrowed here
... ...
LL | &[_, x, .., _, _] => println!("{}", x), LL | &[_, x, .., _, _] => println!("{}", x),
| ^ use of borrowed `v` | ^ 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 --> $DIR/borrowck-describe-lvalue.rs:123:25
| |
LL | let x = &mut v; LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ `v` is borrowed here
... ...
LL | &[_, _, .., x, _] => println!("{}", x), LL | &[_, _, .., x, _] => println!("{}", x),
| ^ use of borrowed `v` | ^ 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 --> $DIR/borrowck-describe-lvalue.rs:128:28
| |
LL | let x = &mut v; LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ `v` is borrowed here
... ...
LL | &[_, _, .., _, x] => println!("{}", x), LL | &[_, _, .., _, x] => println!("{}", x),
| ^ use of borrowed `v` | ^ 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 --> $DIR/borrowck-describe-lvalue.rs:139:15
| |
LL | let x = &mut v; LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ `v` is borrowed here
LL | match v { LL | match v {
LL | &[x @ ..] => println!("{:?}", x), LL | &[x @ ..] => println!("{:?}", x),
| ^ use of borrowed `v` | ^ 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 --> $DIR/borrowck-describe-lvalue.rs:144:18
| |
LL | let x = &mut v; LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ `v` is borrowed here
... ...
LL | &[_, x @ ..] => println!("{:?}", x), LL | &[_, x @ ..] => println!("{:?}", x),
| ^ use of borrowed `v` | ^ 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 --> $DIR/borrowck-describe-lvalue.rs:149:15
| |
LL | let x = &mut v; LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ `v` is borrowed here
... ...
LL | &[x @ .., _] => println!("{:?}", x), LL | &[x @ .., _] => println!("{:?}", x),
| ^ use of borrowed `v` | ^ 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 --> $DIR/borrowck-describe-lvalue.rs:154:18
| |
LL | let x = &mut v; LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ `v` is borrowed here
... ...
LL | &[_, x @ .., _] => println!("{:?}", x), LL | &[_, x @ .., _] => println!("{:?}", x),
| ^ use of borrowed `v` | ^ 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 --> $DIR/borrowck-describe-lvalue.rs:166:15
| |
LL | let x = &mut e; LL | let x = &mut e;
| ------ borrow of `e` occurs here | ------ `e` is borrowed here
LL | match e { LL | match e {
| ^ use of borrowed `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 --> $DIR/borrowck-describe-lvalue.rs:232:9
| |
LL | let x = &mut v; LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ `v` is borrowed here
LL | v[0].y; LL | v[0].y;
| ^^^^ use of borrowed `v` | ^^^^ 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 --> $DIR/borrowck-describe-lvalue.rs:232:9
| |
LL | let x = &mut v; LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ `v` is borrowed here
LL | v[0].y; LL | v[0].y;
| ^^^^^^ use of borrowed `v` | ^^^^^^ use of borrowed `v`
... ...

View file

@ -41,6 +41,8 @@ LL | let p = &x.b;
error[E0505]: cannot move out of `x.b` because it is borrowed error[E0505]: cannot move out of `x.b` because it is borrowed
--> $DIR/borrowck-field-sensitivity.rs:34:10 --> $DIR/borrowck-field-sensitivity.rs:34:10
| |
LL | let x = A { a: 1, b: Box::new(2) };
| - binding `x` declared here
LL | let p = &x.b; LL | let p = &x.b;
| ---- borrow of `x.b` occurs here | ---- borrow of `x.b` occurs here
LL | drop(x.b); LL | drop(x.b);
@ -51,6 +53,8 @@ LL | drop(**p);
error[E0505]: cannot move out of `x.b` because it is borrowed error[E0505]: cannot move out of `x.b` because it is borrowed
--> $DIR/borrowck-field-sensitivity.rs:41:14 --> $DIR/borrowck-field-sensitivity.rs:41:14
| |
LL | let x = A { a: 1, b: Box::new(2) };
| - binding `x` declared here
LL | let p = &x.b; LL | let p = &x.b;
| ---- borrow of `x.b` occurs here | ---- borrow of `x.b` occurs here
LL | let _y = A { a: 3, .. x }; LL | let _y = A { a: 3, .. x };

View 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 --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:6:9
| |
LL | let b = &mut _a; LL | let b = &mut _a;
| ------- borrow of `_a` occurs here | ------- `_a` is borrowed here
... ...
LL | _a = 4; LL | _a = 4;
| ^^^^^^ assignment to borrowed `_a` occurs here | ^^^^^^ `_a` is assigned to here but it was already borrowed
... ...
LL | drop(b); LL | drop(b);
| - borrow later used here | - borrow later used here

View file

@ -13,10 +13,10 @@ error[E0506]: cannot assign to `**y` because it is borrowed
--> $DIR/borrowck-issue-14498.rs:25:5 --> $DIR/borrowck-issue-14498.rs:25:5
| |
LL | let p = &y; LL | let p = &y;
| -- borrow of `**y` occurs here | -- `**y` is borrowed here
LL | let q = &***p; LL | let q = &***p;
LL | **y = 2; LL | **y = 2;
| ^^^^^^^ assignment to borrowed `**y` occurs here | ^^^^^^^ `**y` is assigned to here but it was already borrowed
LL | drop(p); LL | drop(p);
| - borrow later used here | - 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 --> $DIR/borrowck-issue-14498.rs:35:5
| |
LL | let p = &y; LL | let p = &y;
| -- borrow of `**y` occurs here | -- `**y` is borrowed here
LL | let q = &***p; LL | let q = &***p;
LL | **y = 2; LL | **y = 2;
| ^^^^^^^ assignment to borrowed `**y` occurs here | ^^^^^^^ `**y` is assigned to here but it was already borrowed
LL | drop(p); LL | drop(p);
| - borrow later used here | - 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 --> $DIR/borrowck-issue-14498.rs:45:5
| |
LL | let p = &y; LL | let p = &y;
| -- borrow of `**y` occurs here | -- `**y` is borrowed here
LL | let q = &***p; LL | let q = &***p;
LL | **y = 2; LL | **y = 2;
| ^^^^^^^ assignment to borrowed `**y` occurs here | ^^^^^^^ `**y` is assigned to here but it was already borrowed
LL | drop(p); LL | drop(p);
| - borrow later used here | - 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 --> $DIR/borrowck-issue-14498.rs:55:5
| |
LL | let p = &y; LL | let p = &y;
| -- borrow of `**y` occurs here | -- `**y` is borrowed here
LL | let q = &***p; LL | let q = &***p;
LL | **y = 2; LL | **y = 2;
| ^^^^^^^ assignment to borrowed `**y` occurs here | ^^^^^^^ `**y` is assigned to here but it was already borrowed
LL | drop(p); LL | drop(p);
| - borrow later used here | - 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 --> $DIR/borrowck-issue-14498.rs:65:5
| |
LL | let p = &y.a; LL | let p = &y.a;
| ---- borrow of `**y.a` occurs here | ---- `**y.a` is borrowed here
LL | let q = &***p; LL | let q = &***p;
LL | **y.a = 2; 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); LL | drop(p);
| - borrow later used here | - 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 --> $DIR/borrowck-issue-14498.rs:75:5
| |
LL | let p = &y.a; LL | let p = &y.a;
| ---- borrow of `**y.a` occurs here | ---- `**y.a` is borrowed here
LL | let q = &***p; LL | let q = &***p;
LL | **y.a = 2; 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); LL | drop(p);
| - borrow later used here | - 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 --> $DIR/borrowck-issue-14498.rs:85:5
| |
LL | let p = &y.a; LL | let p = &y.a;
| ---- borrow of `**y.a` occurs here | ---- `**y.a` is borrowed here
LL | let q = &***p; LL | let q = &***p;
LL | **y.a = 2; 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); LL | drop(p);
| - borrow later used here | - 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 --> $DIR/borrowck-issue-14498.rs:95:5
| |
LL | let p = &y.a; LL | let p = &y.a;
| ---- borrow of `**y.a` occurs here | ---- `**y.a` is borrowed here
LL | let q = &***p; LL | let q = &***p;
LL | **y.a = 2; 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); LL | drop(p);
| - borrow later used here | - borrow later used here

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
--> $DIR/borrowck-lend-flow-match.rs:12:13 --> $DIR/borrowck-lend-flow-match.rs:12:13
| |
LL | Some(ref r) => { LL | Some(ref r) => {
| ----- borrow of `x` occurs here | ----- `x` is borrowed here
LL | x = Some(1); LL | x = Some(1);
| ^^^^^^^^^^^ assignment to borrowed `x` occurs here | ^^^^^^^^^^^ `x` is assigned to here but it was already borrowed
LL | drop(r); LL | drop(r);
| - borrow later used here | - borrow later used here

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `v` because it is borrowed error[E0505]: cannot move out of `v` because it is borrowed
--> $DIR/borrowck-loan-blocks-move-cc.rs:14:19 --> $DIR/borrowck-loan-blocks-move-cc.rs:14:19
| |
LL | let v: Box<_> = Box::new(3);
| - binding `v` declared here
LL | let w = &v; LL | let w = &v;
| -- borrow of `v` occurs here | -- borrow of `v` occurs here
LL | thread::spawn(move|| { LL | thread::spawn(move|| {
@ -15,6 +17,8 @@ LL | w.use_ref();
error[E0505]: cannot move out of `v` because it is borrowed error[E0505]: cannot move out of `v` because it is borrowed
--> $DIR/borrowck-loan-blocks-move-cc.rs:24:19 --> $DIR/borrowck-loan-blocks-move-cc.rs:24:19
| |
LL | let v: Box<_> = Box::new(3);
| - binding `v` declared here
LL | let w = &v; LL | let w = &v;
| -- borrow of `v` occurs here | -- borrow of `v` occurs here
LL | thread::spawn(move|| { LL | thread::spawn(move|| {

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `v` because it is borrowed error[E0505]: cannot move out of `v` because it is borrowed
--> $DIR/borrowck-loan-blocks-move.rs:11:10 --> $DIR/borrowck-loan-blocks-move.rs:11:10
| |
LL | let v = Box::new(3);
| - binding `v` declared here
LL | let w = &v; LL | let w = &v;
| -- borrow of `v` occurs here | -- borrow of `v` occurs here
LL | take(v); LL | take(v);

View 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 --> $DIR/borrowck-loan-of-static-data-issue-27616.rs:16:5
| |
LL | let alias: &'static mut String = s; 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` | type annotation requires that `*s` is borrowed for `'static`
... ...
LL | *s = String::new(); 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 error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0503]: cannot use `p` because it was mutably borrowed
--> $DIR/borrowck-loan-rcvr-overloaded-op.rs:38:5 --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:38:5
| |
LL | let q = &mut p; LL | let q = &mut p;
| ------ borrow of `p` occurs here | ------ `p` is borrowed here
LL | LL |
LL | p + 3; LL | p + 3;
| ^ use of borrowed `p` | ^ use of borrowed `p`

View file

@ -1,6 +1,8 @@
error[E0597]: `z.1` does not live long enough error[E0597]: `z.1` does not live long enough
--> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:3:15 --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:3:15
| |
LL | let mut z = (0, 0);
| ----- binding `z` declared here
LL | *x = Some(&mut z.1); LL | *x = Some(&mut z.1);
| ----------^^^^^^^^- | ----------^^^^^^^^-
| | | | | |

View file

@ -2,7 +2,7 @@ error[E0503]: cannot use `foo` because it was mutably borrowed
--> $DIR/borrowck-match-already-borrowed.rs:9:19 --> $DIR/borrowck-match-already-borrowed.rs:9:19
| |
LL | let p = &mut foo; LL | let p = &mut foo;
| -------- borrow of `foo` occurs here | -------- `foo` is borrowed here
LL | let _ = match foo { LL | let _ = match foo {
| ^^^ use of borrowed `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 --> $DIR/borrowck-match-already-borrowed.rs:12:16
| |
LL | let p = &mut foo; LL | let p = &mut foo;
| -------- borrow of `foo` occurs here | -------- `foo` is borrowed here
... ...
LL | Foo::A(x) => x LL | Foo::A(x) => x
| ^ use of borrowed `foo` | ^ 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 --> $DIR/borrowck-match-already-borrowed.rs:22:9
| |
LL | let r = &mut x; LL | let r = &mut x;
| ------ borrow of `x` occurs here | ------ `x` is borrowed here
LL | let _ = match x { LL | let _ = match x {
LL | x => x + 1, LL | x => x + 1,
| ^ use of borrowed `x` | ^ 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 --> $DIR/borrowck-match-already-borrowed.rs:23:9
| |
LL | let r = &mut x; LL | let r = &mut x;
| ------ borrow of `x` occurs here | ------ `x` is borrowed here
... ...
LL | y => y + 2, LL | y => y + 2,
| ^ use of borrowed `x` | ^ use of borrowed `x`

View file

@ -10,7 +10,7 @@ LL | let _h = to_fn_once(move || -> isize { *bar });
| | | | | |
| | variable moved due to use in closure | | variable moved due to use in closure
| | move occurs because `bar` has type `Box<isize>`, which does not implement the `Copy` trait | | 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 error: aborting due to previous error

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `*a` because it is borrowed error[E0505]: cannot move out of `*a` because it is borrowed
--> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:12:13 --> $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; LL | let b = &a;
| -- borrow of `a` occurs here | -- borrow of `a` occurs here
LL | LL |

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `t0` because it is borrowed error[E0505]: cannot move out of `t0` because it is borrowed
--> $DIR/borrowck-move-mut-base-ptr.rs:10:14 --> $DIR/borrowck-move-mut-base-ptr.rs:10:14
| |
LL | fn foo(t0: &mut isize) {
| -- binding `t0` declared here
LL | let p: &isize = &*t0; // Freezes `*t0` LL | let p: &isize = &*t0; // Freezes `*t0`
| ---- borrow of `*t0` occurs here | ---- borrow of `*t0` occurs here
LL | let t1 = t0; LL | let t1 = t0;

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `a.x` because it is borrowed error[E0505]: cannot move out of `a.x` because it is borrowed
--> $DIR/borrowck-move-subcomponent.rs:15:14 --> $DIR/borrowck-move-subcomponent.rs:15:14
| |
LL | let a : S = S { x : Box::new(1) };
| - binding `a` declared here
LL | let pb = &a; LL | let pb = &a;
| -- borrow of `a` occurs here | -- borrow of `a` occurs here
LL | let S { x: ax } = a; LL | let S { x: ax } = a;

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `x1` because it is borrowed error[E0505]: cannot move out of `x1` because it is borrowed
--> $DIR/borrowck-multiple-captures.rs:12:19 --> $DIR/borrowck-multiple-captures.rs:12:19
| |
LL | let x1: Box<_> = Box::new(1);
| -- binding `x1` declared here
LL | let p1 = &x1; LL | let p1 = &x1;
| --- borrow of `x1` occurs here | --- borrow of `x1` occurs here
... ...
@ -16,6 +18,8 @@ LL | borrow(&*p1);
error[E0505]: cannot move out of `x2` because it is borrowed error[E0505]: cannot move out of `x2` because it is borrowed
--> $DIR/borrowck-multiple-captures.rs:12:19 --> $DIR/borrowck-multiple-captures.rs:12:19
| |
LL | let x2: Box<_> = Box::new(2);
| -- binding `x2` declared here
LL | let p2 = &x2; LL | let p2 = &x2;
| --- borrow of `x2` occurs here | --- borrow of `x2` occurs here
LL | thread::spawn(move|| { LL | thread::spawn(move|| {
@ -77,6 +81,8 @@ LL | drop(x);
error[E0505]: cannot move out of `x` because it is borrowed error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/borrowck-multiple-captures.rs:38:19 --> $DIR/borrowck-multiple-captures.rs:38:19
| |
LL | let x: Box<_> = Box::new(1);
| - binding `x` declared here
LL | let p = &x; LL | let p = &x;
| -- borrow of `x` occurs here | -- borrow of `x` occurs here
LL | thread::spawn(move|| { LL | thread::spawn(move|| {

View 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 --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:31:5
| |
LL | let i = &v[0].f; LL | let i = &v[0].f;
| - borrow of `v` occurs here | - `v` is borrowed here
LL | v = MyVec { x: MyPtr { x: Foo { f: 23 } } }; 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 |
LL | read(*i); LL | read(*i);
| -- borrow later used here | -- borrow later used here

View file

@ -42,9 +42,9 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:71:5 --> $DIR/borrowck-overloaded-index-autoderef.rs:71:5
| |
LL | let p = &f.foo[&s]; LL | let p = &f.foo[&s];
| ----- borrow of `f.foo` occurs here | ----- `f.foo` is borrowed here
LL | f.foo = g; 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(); LL | p.use_ref();
| ----------- borrow later used here | ----------- 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 --> $DIR/borrowck-overloaded-index-autoderef.rs:77:5
| |
LL | let p = &f.foo[&s]; LL | let p = &f.foo[&s];
| ----- borrow of `*f` occurs here | ----- `*f` is borrowed here
LL | *f = g; LL | *f = g;
| ^^^^^^ assignment to borrowed `*f` occurs here | ^^^^^^ `*f` is assigned to here but it was already borrowed
LL | p.use_ref(); LL | p.use_ref();
| ----------- borrow later used here | ----------- 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 --> $DIR/borrowck-overloaded-index-autoderef.rs:83:5
| |
LL | let p = &mut f.foo[&s]; LL | let p = &mut f.foo[&s];
| ----- borrow of `f.foo` occurs here | ----- `f.foo` is borrowed here
LL | f.foo = g; 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(); LL | p.use_mut();
| ----------- borrow later used here | ----------- 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 --> $DIR/borrowck-overloaded-index-autoderef.rs:89:5
| |
LL | let p = &mut f.foo[&s]; LL | let p = &mut f.foo[&s];
| ----- borrow of `*f` occurs here | ----- `*f` is borrowed here
LL | *f = g; LL | *f = g;
| ^^^^^^ assignment to borrowed `*f` occurs here | ^^^^^^ `*f` is assigned to here but it was already borrowed
LL | p.use_mut(); LL | p.use_mut();
| ----------- borrow later used here | ----------- borrow later used here

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `s` because it is borrowed error[E0505]: cannot move out of `s` because it is borrowed
--> $DIR/borrowck-overloaded-index-move-index.rs:50:22 --> $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; LL | let rs = &mut s;
| ------ borrow of `s` occurs here | ------ borrow of `s` occurs here
LL | LL |
@ -13,6 +15,8 @@ LL | use_mut(rs);
error[E0505]: cannot move out of `s` because it is borrowed error[E0505]: cannot move out of `s` because it is borrowed
--> $DIR/borrowck-overloaded-index-move-index.rs:53:7 --> $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; LL | let rs = &mut s;
| ------ borrow of `s` occurs here | ------ borrow of `s` occurs here
... ...

View file

@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed
--> $DIR/borrowck-pat-reassign-binding.rs:10:11 --> $DIR/borrowck-pat-reassign-binding.rs:10:11
| |
LL | Some(ref i) => { LL | Some(ref i) => {
| ----- borrow of `x` occurs here | ----- `x` is borrowed here
LL | // But on this branch, `i` is an outstanding borrow LL | // But on this branch, `i` is an outstanding borrow
LL | x = Some(*i+1); LL | x = Some(*i+1);
| ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here | ^^^^^^^^^^^^^^ `x` is assigned to here but it was already borrowed
LL | drop(i); LL | drop(i);
| - borrow later used here | - borrow later used here

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `x` because it is borrowed error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/borrowck-unary-move.rs:3:10 --> $DIR/borrowck-unary-move.rs:3:10
| |
LL | fn foo(x: Box<isize>) -> isize {
| - binding `x` declared here
LL | let y = &*x; LL | let y = &*x;
| --- borrow of `*x` occurs here | --- borrow of `*x` occurs here
LL | free(x); LL | free(x);

View file

@ -2,7 +2,7 @@ error[E0503]: cannot use `u.c` because it was mutably borrowed
--> $DIR/borrowck-union-borrow-nested.rs:24:21 --> $DIR/borrowck-union-borrow-nested.rs:24:21
| |
LL | let ra = &mut u.s.a; 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; LL | let b = u.c;
| ^^^ use of borrowed `u.s.a` | ^^^ use of borrowed `u.s.a`
LL | ra.use_mut(); LL | ra.use_mut();

View file

@ -12,9 +12,9 @@ error[E0506]: cannot assign to `u.a` because it is borrowed
--> $DIR/borrowck-union-borrow.rs:28:13 --> $DIR/borrowck-union-borrow.rs:28:13
| |
LL | let ra = &u.a; LL | let ra = &u.a;
| ---- borrow of `u.a` occurs here | ---- `u.a` is borrowed here
LL | u.a = 1; 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); LL | drop(ra);
| -- borrow later used here | -- 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 --> $DIR/borrowck-union-borrow.rs:49:13
| |
LL | let ra = &u.a; LL | let ra = &u.a;
| ---- borrow of `u.b` occurs here | ---- `u.b` is borrowed here
LL | u.b = 1; 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); LL | drop(ra);
| -- borrow later used here | -- 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 --> $DIR/borrowck-union-borrow.rs:60:21
| |
LL | let ra = &mut u.a; LL | let ra = &mut u.a;
| -------- borrow of `u.a` occurs here | -------- `u.a` is borrowed here
LL | let a = u.a; LL | let a = u.a;
| ^^^ use of borrowed `u.a` | ^^^ use of borrowed `u.a`
LL | drop(ra); 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 --> $DIR/borrowck-union-borrow.rs:70:13
| |
LL | let rma = &mut u.a; LL | let rma = &mut u.a;
| -------- borrow of `u.a` occurs here | -------- `u.a` is borrowed here
LL | u.a = 1; 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); LL | drop(rma);
| --- borrow later used here | --- 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 --> $DIR/borrowck-union-borrow.rs:81:21
| |
LL | let ra = &mut u.a; LL | let ra = &mut u.a;
| -------- borrow of `u.a` occurs here | -------- `u.a` is borrowed here
LL | let b = u.b; LL | let b = u.b;
| ^^^ use of borrowed `u.a` | ^^^ use of borrowed `u.a`
LL | LL |
@ -119,9 +119,9 @@ error[E0506]: cannot assign to `u.b` because it is borrowed
--> $DIR/borrowck-union-borrow.rs:92:13 --> $DIR/borrowck-union-borrow.rs:92:13
| |
LL | let rma = &mut u.a; LL | let rma = &mut u.a;
| -------- borrow of `u.b` occurs here | -------- `u.b` is borrowed here
LL | u.b = 1; 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); LL | drop(rma);
| --- borrow later used here | --- borrow later used here

View file

@ -2,7 +2,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/borrowck-use-mut-borrow.rs:11:10 --> $DIR/borrowck-use-mut-borrow.rs:11:10
| |
LL | let p = &mut x; LL | let p = &mut x;
| ------ borrow of `x` occurs here | ------ `x` is borrowed here
LL | drop(x); LL | drop(x);
| ^ use of borrowed `x` | ^ use of borrowed `x`
LL | *p = 2; 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 --> $DIR/borrowck-use-mut-borrow.rs:18:10
| |
LL | let p = &mut x.a; LL | let p = &mut x.a;
| -------- borrow of `x.a` occurs here | -------- `x.a` is borrowed here
LL | drop(x); LL | drop(x);
| ^ use of borrowed `x.a` | ^ use of borrowed `x.a`
LL | *p = 3; 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 --> $DIR/borrowck-use-mut-borrow.rs:25:10
| |
LL | let p = &mut x; LL | let p = &mut x;
| ------ borrow of `x` occurs here | ------ `x` is borrowed here
LL | drop(x.a); LL | drop(x.a);
| ^^^ use of borrowed `x` | ^^^ use of borrowed `x`
LL | p.a = 3; 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 --> $DIR/borrowck-use-mut-borrow.rs:32:10
| |
LL | let p = &mut x.a; LL | let p = &mut x.a;
| -------- borrow of `x.a` occurs here | -------- `x.a` is borrowed here
LL | drop(x.a); LL | drop(x.a);
| ^^^ use of borrowed `x.a` | ^^^ use of borrowed `x.a`
LL | *p = 3; 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 --> $DIR/borrowck-use-mut-borrow.rs:39:13
| |
LL | let p = &mut x; LL | let p = &mut x;
| ------ borrow of `x` occurs here | ------ `x` is borrowed here
LL | let y = A { b: 3, .. x }; LL | let y = A { b: 3, .. x };
| ^^^^^^^^^^^^^^^^ use of borrowed `x` | ^^^^^^^^^^^^^^^^ use of borrowed `x`
LL | drop(y); 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 --> $DIR/borrowck-use-mut-borrow.rs:47:13
| |
LL | let p = &mut x.a; LL | let p = &mut x.a;
| -------- borrow of `x.a` occurs here | -------- `x.a` is borrowed here
LL | let y = A { b: 3, .. x }; LL | let y = A { b: 3, .. x };
| ^^^^^^^^^^^^^^^^ use of borrowed `x.a` | ^^^^^^^^^^^^^^^^ use of borrowed `x.a`
LL | drop(y); 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 --> $DIR/borrowck-use-mut-borrow.rs:55:10
| |
LL | let p = &mut x; LL | let p = &mut x;
| ------ borrow of `x` occurs here | ------ `x` is borrowed here
LL | drop(*x); LL | drop(*x);
| ^^ use of borrowed `x` | ^^ use of borrowed `x`
LL | **p = 2; 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 --> $DIR/borrowck-use-mut-borrow.rs:62:10
| |
LL | let p = &mut x; LL | let p = &mut x;
| ------ borrow of `x` occurs here | ------ `x` is borrowed here
LL | drop(*x.b); LL | drop(*x.b);
| ^^^^ use of borrowed `x` | ^^^^ use of borrowed `x`
LL | p.a = 3; 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 --> $DIR/borrowck-use-mut-borrow.rs:69:10
| |
LL | let p = &mut x.b; LL | let p = &mut x.b;
| -------- borrow of `x.b` occurs here | -------- `x.b` is borrowed here
LL | drop(*x.b); LL | drop(*x.b);
| ^^^^ use of borrowed `x.b` | ^^^^ use of borrowed `x.b`
LL | **p = 3; LL | **p = 3;

View file

@ -2,10 +2,10 @@ error[E0506]: cannot assign to `a[_]` because it is borrowed
--> $DIR/borrowck-vec-pattern-move-tail.rs:8:5 --> $DIR/borrowck-vec-pattern-move-tail.rs:8:5
| |
LL | [1, 2, ref tail @ ..] => tail, LL | [1, 2, ref tail @ ..] => tail,
| -------- borrow of `a[_]` occurs here | -------- `a[_]` is borrowed here
... ...
LL | a[2] = 0; 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]); LL | println!("t[0]: {}", t[0]);
| ---- borrow later used here | ---- borrow later used here

View file

@ -5,9 +5,9 @@ fn a() {
let mut vec = [Box::new(1), Box::new(2), Box::new(3)]; let mut vec = [Box::new(1), Box::new(2), Box::new(3)];
match vec { match vec {
[box ref _a, _, _] => { [box ref _a, _, _] => {
//~^ NOTE borrow of `vec[_]` occurs here //~^ NOTE `vec[_]` is borrowed here
vec[0] = Box::new(4); //~ ERROR cannot assign vec[0] = Box::new(4); //~ ERROR cannot assign
//~^ NOTE assignment to borrowed `vec[_]` occurs here //~^ NOTE `vec[_]` is assigned to here
_a.use_ref(); _a.use_ref();
//~^ NOTE borrow later used here //~^ NOTE borrow later used here
} }
@ -19,9 +19,9 @@ fn b() {
let vec: &mut [Box<isize>] = &mut vec; let vec: &mut [Box<isize>] = &mut vec;
match vec { match vec {
&mut [ref _b @ ..] => { &mut [ref _b @ ..] => {
//~^ borrow of `vec[_]` occurs here //~^ `vec[_]` is borrowed here
vec[0] = Box::new(4); //~ ERROR cannot assign vec[0] = Box::new(4); //~ ERROR cannot assign
//~^ NOTE assignment to borrowed `vec[_]` occurs here //~^ NOTE `vec[_]` is assigned to here
_b.use_ref(); _b.use_ref();
//~^ NOTE borrow later used here //~^ NOTE borrow later used here
} }

View file

@ -2,10 +2,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed
--> $DIR/borrowck-vec-pattern-nesting.rs:9:13 --> $DIR/borrowck-vec-pattern-nesting.rs:9:13
| |
LL | [box ref _a, _, _] => { LL | [box ref _a, _, _] => {
| ------ borrow of `vec[_]` occurs here | ------ `vec[_]` is borrowed here
LL | LL |
LL | vec[0] = Box::new(4); LL | vec[0] = Box::new(4);
| ^^^^^^ assignment to borrowed `vec[_]` occurs here | ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
LL | LL |
LL | _a.use_ref(); LL | _a.use_ref();
| ------------ borrow later used here | ------------ 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 --> $DIR/borrowck-vec-pattern-nesting.rs:23:13
| |
LL | &mut [ref _b @ ..] => { LL | &mut [ref _b @ ..] => {
| ------ borrow of `vec[_]` occurs here | ------ `vec[_]` is borrowed here
LL | LL |
LL | vec[0] = Box::new(4); LL | vec[0] = Box::new(4);
| ^^^^^^ assignment to borrowed `vec[_]` occurs here | ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
LL | LL |
LL | _b.use_ref(); LL | _b.use_ref();
| ------------ borrow later used here | ------------ borrow later used here

View file

@ -5,7 +5,7 @@ LL | $this.width.unwrap()
| ^^^^^^^^^^^ use of borrowed `*self` | ^^^^^^^^^^^ use of borrowed `*self`
... ...
LL | let r = &mut *self; LL | let r = &mut *self;
| ---------- borrow of `*self` occurs here | ---------- `*self` is borrowed here
LL | r.get_size(width!(self)) LL | r.get_size(width!(self))
| -------- ------------ in this macro invocation | -------- ------------ in this macro invocation
| | | |

View file

@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed
--> $DIR/issue-52713-bug.rs:12:5 --> $DIR/issue-52713-bug.rs:12:5
| |
LL | let y = &x; LL | let y = &x;
| -- borrow of `x` occurs here | -- `x` is borrowed here
... ...
LL | x += 1; LL | x += 1;
| ^^^^^^ assignment to borrowed `x` occurs here | ^^^^^^ `x` is assigned to here but it was already borrowed
LL | println!("{}", y); LL | println!("{}", y);
| - borrow later used here | - borrow later used here

View file

@ -4,10 +4,10 @@ error[E0506]: cannot assign to `greeting` because it is borrowed
LL | let res = (|| (|| &greeting)())(); LL | let res = (|| (|| &greeting)())();
| -- -------- borrow occurs due to use in closure | -- -------- borrow occurs due to use in closure
| | | |
| borrow of `greeting` occurs here | `greeting` is borrowed here
LL | LL |
LL | greeting = "DEALLOCATED".to_string(); 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); LL | println!("thread result: {:?}", res);
| --- borrow later used here | --- borrow later used here

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-1.rs:21:9 --> $DIR/issue-81365-1.rs:21:9
| |
LL | let first = &self.target_field; LL | let first = &self.target_field;
| ---- borrow of `self.container_field` occurs here | ---- `self.container_field` is borrowed here
LL | self.container_field = true; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here
| |

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-10.rs:21:9 --> $DIR/issue-81365-10.rs:21:9
| |
LL | let first = &self.deref().target_field; 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; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-11.rs:27:9 --> $DIR/issue-81365-11.rs:27:9
| |
LL | let first = &mut self.target_field; 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; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here

View 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 --> $DIR/issue-81365-2.rs:25:9
| |
LL | let first = &self.container.target_field; 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; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here
| |

View 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 --> $DIR/issue-81365-3.rs:32:9
| |
LL | let first = &self.target_field; 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; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here
| |

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.outer_field` because it is borrowed
--> $DIR/issue-81365-4.rs:33:9 --> $DIR/issue-81365-4.rs:33:9
| |
LL | let first = &self.target_field; LL | let first = &self.target_field;
| ---- borrow of `self.outer_field` occurs here | ---- `self.outer_field` is borrowed here
LL | self.outer_field = true; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here
| |

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-5.rs:28:9 --> $DIR/issue-81365-5.rs:28:9
| |
LL | let first = self.get(); LL | let first = self.get();
| ---------- borrow of `self.container_field` occurs here | ---------- `self.container_field` is borrowed here
LL | self.container_field = true; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here
| |

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-6.rs:18:9 --> $DIR/issue-81365-6.rs:18:9
| |
LL | let first = &self[0]; LL | let first = &self[0];
| ---- borrow of `self.container_field` occurs here | ---- `self.container_field` is borrowed here
LL | self.container_field = true; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here
| |

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `c.container_field` because it is borrowed
--> $DIR/issue-81365-7.rs:20:5 --> $DIR/issue-81365-7.rs:20:5
| |
LL | let first = &c.target_field; LL | let first = &c.target_field;
| - borrow of `c.container_field` occurs here | - `c.container_field` is borrowed here
LL | c.container_field = true; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here
| |

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-8.rs:21:9 --> $DIR/issue-81365-8.rs:21:9
| |
LL | let first = &(*self).target_field; LL | let first = &(*self).target_field;
| ------- borrow of `self.container_field` occurs here | ------- `self.container_field` is borrowed here
LL | self.container_field = true; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here
| |

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-9.rs:21:9 --> $DIR/issue-81365-9.rs:21:9
| |
LL | let first = &Deref::deref(self).target_field; 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; 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; LL | first;
| ----- borrow later used here | ----- borrow later used here

View 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 --> $DIR/two-phase-allow-access-during-reservation.rs:26:19
| |
LL | /*1*/ let p = &mut i; // (reservation of `i` starts here) LL | /*1*/ let p = &mut i; // (reservation of `i` starts here)
| ------ borrow of `i` occurs here | ------ `i` is borrowed here
LL | LL |
LL | /*2*/ let j = i; // OK: `i` is only reserved here LL | /*2*/ let j = i; // OK: `i` is only reserved here
| ^ use of borrowed `i` | ^ 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 --> $DIR/two-phase-allow-access-during-reservation.rs:31:19
| |
LL | /*1*/ let p = &mut i; // (reservation of `i` starts here) 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; LL | /*4*/ let k = i;
| ^ use of borrowed `i` | ^ use of borrowed `i`

View 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 --> $DIR/two-phase-surprise-no-conflict.rs:21:23
| |
LL | let _mut_borrow = &mut *self; LL | let _mut_borrow = &mut *self;
| ---------- borrow of `*self` occurs here | ---------- `*self` is borrowed here
LL | let _access = self.cx; LL | let _access = self.cx;
| ^^^^^^^ use of borrowed `*self` | ^^^^^^^ use of borrowed `*self`
LL | LL |

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `alloc` because it is borrowed error[E0505]: cannot move out of `alloc` because it is borrowed
--> $DIR/leak-alloc.rs:26:10 --> $DIR/leak-alloc.rs:26:10
| |
LL | let alloc = Alloc {};
| ----- binding `alloc` declared here
LL | let boxed = Box::new_in(10, alloc.by_ref()); LL | let boxed = Box::new_in(10, alloc.by_ref());
| -------------- borrow of `alloc` occurs here | -------------- borrow of `alloc` occurs here
LL | let theref = Box::leak(boxed); LL | let theref = Box::leak(boxed);

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `s` because it is borrowed error[E0505]: cannot move out of `s` because it is borrowed
--> $DIR/btreemap_dropck.rs:15:10 --> $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))]); LL | let _map = BTreeMap::from_iter([((), PrintOnDrop(&s))]);
| -- borrow of `s` occurs here | -- borrow of `s` occurs here
LL | drop(s); LL | drop(s);

View file

@ -107,7 +107,9 @@ error[E0597]: `ap1` does not live long enough
--> $DIR/variadic-ffi-4.rs:28:11 --> $DIR/variadic-ffi-4.rs:28:11
| |
LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { 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; LL | ap0 = &mut ap1;
| ------^^^^^^^^ | ------^^^^^^^^
| | | | | |

View file

@ -2,7 +2,7 @@ error[E0503]: cannot use `arr` because it was mutably borrowed
--> $DIR/arrays.rs:14:5 --> $DIR/arrays.rs:14:5
| |
LL | let mut c = || { LL | let mut c = || {
| -- borrow of `arr` occurs here | -- `arr` is borrowed here
LL | arr[0] += 10; LL | arr[0] += 10;
| --- borrow occurs due to use of `arr` in closure | --- 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 --> $DIR/arrays.rs:14:5
| |
LL | let mut c = || { LL | let mut c = || {
| -- borrow of `arr` occurs here | -- `arr` is borrowed here
LL | arr[0] += 10; LL | arr[0] += 10;
| --- borrow occurs due to use of `arr` in closure | --- 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 --> $DIR/arrays.rs:29:5
| |
LL | let c = || { LL | let c = || {
| -- borrow of `arr[_]` occurs here | -- `arr[_]` is borrowed here
LL | println!("{:#?}", &arr[3..4]); LL | println!("{:#?}", &arr[3..4]);
| --- borrow occurs due to use in closure | --- borrow occurs due to use in closure
... ...
LL | arr[1] += 10; LL | arr[1] += 10;
| ^^^^^^^^^^^^ assignment to borrowed `arr[_]` occurs here | ^^^^^^^^^^^^ `arr[_]` is assigned to here but it was already borrowed
LL | LL |
LL | c(); LL | c();
| - borrow later used here | - borrow later used here
@ -44,12 +44,12 @@ error[E0506]: cannot assign to `arr[_]` because it is borrowed
--> $DIR/arrays.rs:43:5 --> $DIR/arrays.rs:43:5
| |
LL | let c = || { LL | let c = || {
| -- borrow of `arr[_]` occurs here | -- `arr[_]` is borrowed here
LL | println!("{}", arr[3]); LL | println!("{}", arr[3]);
| --- borrow occurs due to use in closure | --- borrow occurs due to use in closure
... ...
LL | arr[1] += 10; LL | arr[1] += 10;
| ^^^^^^^^^^^^ assignment to borrowed `arr[_]` occurs here | ^^^^^^^^^^^^ `arr[_]` is assigned to here but it was already borrowed
LL | LL |
LL | c(); LL | c();
| - borrow later used here | - borrow later used here
@ -58,7 +58,7 @@ error[E0503]: cannot use `arr` because it was mutably borrowed
--> $DIR/arrays.rs:57:20 --> $DIR/arrays.rs:57:20
| |
LL | let mut c = || { LL | let mut c = || {
| -- borrow of `arr` occurs here | -- `arr` is borrowed here
LL | arr[1] += 10; LL | arr[1] += 10;
| --- borrow occurs due to use of `arr` in closure | --- borrow occurs due to use of `arr` in closure
... ...

View file

@ -2,12 +2,12 @@ error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed
--> $DIR/box.rs:21:5 --> $DIR/box.rs:21:5
| |
LL | let mut c = || { 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"); LL | e.0.0.m.x = format!("not-x");
| --------- borrow occurs due to use in closure | --------- borrow occurs due to use in closure
... ...
LL | e.0.0.m.x = format!("not-x"); 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 |
LL | c(); LL | c();
| - borrow later used here | - 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 --> $DIR/box.rs:55:5
| |
LL | let c = || { 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); LL | println!("{}", e.0.0.m.x);
| --------- borrow occurs due to use in closure | --------- borrow occurs due to use in closure
... ...
LL | e.0.0.m.x = format!("not-x"); 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 |
LL | c(); LL | c();
| - borrow later used here | - borrow later used here

View file

@ -11,7 +11,7 @@ union A {
fn main() { fn main() {
let mut a = A { y: 1 }; let mut a = A { y: 1 };
let mut c = || { let mut c = || {
//~^ borrow of `a.y` occurs here //~^ `a.y` is borrowed here
let _ = unsafe { &a.y }; let _ = unsafe { &a.y };
let _ = &mut a; let _ = &mut a;
//~^ borrow occurs due to use in closure //~^ borrow occurs due to use in closure
@ -19,7 +19,7 @@ fn main() {
}; };
a.y = 1; a.y = 1;
//~^ cannot assign to `a.y` because it is borrowed [E0506] //~^ cannot assign to `a.y` because it is borrowed [E0506]
//~| assignment to borrowed `a.y` occurs here //~| `a.y` is assigned to here
c(); c();
//~^ borrow later used here //~^ borrow later used here
} }

View file

@ -2,13 +2,13 @@ error[E0506]: cannot assign to `a.y` because it is borrowed
--> $DIR/union.rs:20:5 --> $DIR/union.rs:20:5
| |
LL | let mut c = || { LL | let mut c = || {
| -- borrow of `a.y` occurs here | -- `a.y` is borrowed here
... ...
LL | let _ = &mut a; LL | let _ = &mut a;
| - borrow occurs due to use in closure | - borrow occurs due to use in closure
... ...
LL | a.y = 1; LL | a.y = 1;
| ^^^^^^^ assignment to borrowed `a.y` occurs here | ^^^^^^^ `a.y` is assigned to here but it was already borrowed
... ...
LL | c(); LL | c();
| - borrow later used here | - borrow later used here

View file

@ -13,10 +13,10 @@ error[E0506]: cannot assign to `**x` because it is borrowed
--> $DIR/coerce-overloaded-autoderef-fail.rs:17:5 --> $DIR/coerce-overloaded-autoderef-fail.rs:17:5
| |
LL | let y = borrow(x); LL | let y = borrow(x);
| - borrow of `**x` occurs here | - `**x` is borrowed here
LL | let z = borrow(x); LL | let z = borrow(x);
LL | **x += 1; LL | **x += 1;
| ^^^^^^^^ assignment to borrowed `**x` occurs here | ^^^^^^^^ `**x` is assigned to here but it was already borrowed
LL | LL |
LL | drop((y, z)); LL | drop((y, z));
| - borrow later used here | - borrow later used here

View file

@ -4,6 +4,7 @@ error[E0597]: `y` does not live long enough
LL | let x: &'static u32 = { LL | let x: &'static u32 = {
| ------------ type annotation requires that `y` is borrowed for `'static` | ------------ type annotation requires that `y` is borrowed for `'static`
LL | let y = 42; LL | let y = 42;
| - binding `y` declared here
LL | &y LL | &y
| ^^ borrowed value does not live long enough | ^^ borrowed value does not live long enough
LL | }; LL | };

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `a` because it is borrowed error[E0505]: cannot move out of `a` because it is borrowed
--> $DIR/drop-with-active-borrows-1.rs:4:10 --> $DIR/drop-with-active-borrows-1.rs:4:10
| |
LL | let a = "".to_string();
| - binding `a` declared here
LL | let b: Vec<&str> = a.lines().collect(); LL | let b: Vec<&str> = a.lines().collect();
| --------- borrow of `a` occurs here | --------- borrow of `a` occurs here
LL | drop(a); LL | drop(a);

View file

@ -1,6 +1,9 @@
error[E0597]: `c_shortest` does not live long enough error[E0597]: `c_shortest` does not live long enough
--> $DIR/dropck-eyepatch-extern-crate.rs:46:23 --> $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); LL | dt = Dt("dt", &c_shortest);
| ^^^^^^^^^^^ borrowed value does not live long enough | ^^^^^^^^^^^ borrowed value does not live long enough
... ...
@ -15,6 +18,9 @@ LL | }
error[E0597]: `c_shortest` does not live long enough error[E0597]: `c_shortest` does not live long enough
--> $DIR/dropck-eyepatch-extern-crate.rs:68:32 --> $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); LL | pt = Pt("pt", &c_long, &c_shortest);
| ^^^^^^^^^^^ borrowed value does not live long enough | ^^^^^^^^^^^ borrowed value does not live long enough
... ...

View file

@ -1,6 +1,9 @@
error[E0597]: `c_shortest` does not live long enough error[E0597]: `c_shortest` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:64:23 --> $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); LL | dt = Dt("dt", &c_shortest);
| ^^^^^^^^^^^ borrowed value does not live long enough | ^^^^^^^^^^^ borrowed value does not live long enough
... ...
@ -15,6 +18,9 @@ LL | }
error[E0597]: `c_shortest` does not live long enough error[E0597]: `c_shortest` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:86:32 --> $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); LL | pt = Pt("pt", &c_long, &c_shortest);
| ^^^^^^^^^^^ borrowed value does not live long enough | ^^^^^^^^^^^ borrowed value does not live long enough
... ...

View file

@ -1,6 +1,9 @@
error[E0597]: `c_shortest` does not live long enough error[E0597]: `c_shortest` does not live long enough
--> $DIR/dropck-eyepatch.rs:88:23 --> $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); LL | dt = Dt("dt", &c_shortest);
| ^^^^^^^^^^^ borrowed value does not live long enough | ^^^^^^^^^^^ borrowed value does not live long enough
... ...
@ -15,6 +18,9 @@ LL | }
error[E0597]: `c_shortest` does not live long enough error[E0597]: `c_shortest` does not live long enough
--> $DIR/dropck-eyepatch.rs:110:32 --> $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); LL | pt = Pt("pt", &c_long, &c_shortest);
| ^^^^^^^^^^^ borrowed value does not live long enough | ^^^^^^^^^^^ borrowed value does not live long enough
... ...

View file

@ -1,6 +1,8 @@
error[E0597]: `v` does not live long enough error[E0597]: `v` does not live long enough
--> $DIR/dropck-union.rs:37:18 --> $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)); LL | v.0.set(Some(&v));
| ^^ borrowed value does not live long enough | ^^ borrowed value does not live long enough
LL | } LL | }

View file

@ -2,7 +2,7 @@ error[E0597]: `o2` does not live long enough
--> $DIR/dropck_trait_cycle_checked.rs:111:13 --> $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()); 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); LL | o1.set0(&o2);
| ^^^ borrowed value does not live long enough | ^^^ 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 --> $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()); 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.set0(&o2);
LL | o1.set1(&o3); LL | o1.set1(&o3);
| ^^^ borrowed value does not live long enough | ^^^ 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 --> $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()); 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); LL | o2.set0(&o2);
| ^^^ borrowed value does not live long enough | ^^^ 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 --> $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()); 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); LL | o2.set1(&o3);
| ^^^ borrowed value does not live long enough | ^^^ 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 --> $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()); 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); LL | o3.set0(&o1);
| ^^^ borrowed value does not live long enough | ^^^ 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 --> $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()); 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); LL | o3.set1(&o2);
| ^^^ borrowed value does not live long enough | ^^^ borrowed value does not live long enough

View file

@ -3,7 +3,9 @@ error[E0597]: `f1` does not live long enough
| |
LL | fn baz<'a>() { LL | fn baz<'a>() {
| -- lifetime `'a` defined here | -- 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; LL | let f2: &Fat<[isize; 3]> = &f1;
| ^^^ borrowed value does not live long enough | ^^^ borrowed value does not live long enough
LL | let f3: &'a Fat<[isize]> = f2; LL | let f3: &'a Fat<[isize]> = f2;
@ -18,6 +20,8 @@ error[E0597]: `f1` does not live long enough
LL | fn baz<'a>() { LL | fn baz<'a>() {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here
... ...
LL | let f1 = Fat { ptr: Foo };
| -- binding `f1` declared here
LL | let f2: &Fat<Foo> = &f1; LL | let f2: &Fat<Foo> = &f1;
| ^^^ borrowed value does not live long enough | ^^^ borrowed value does not live long enough
LL | let f3: &'a Fat<dyn Bar> = f2; LL | let f3: &'a Fat<dyn Bar> = f2;
@ -32,6 +36,8 @@ error[E0597]: `f1` does not live long enough
LL | fn baz<'a>() { LL | fn baz<'a>() {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here
... ...
LL | let f1 = ([1, 2, 3],);
| -- binding `f1` declared here
LL | let f2: &([isize; 3],) = &f1; LL | let f2: &([isize; 3],) = &f1;
| ^^^ borrowed value does not live long enough | ^^^ borrowed value does not live long enough
LL | let f3: &'a ([isize],) = f2; LL | let f3: &'a ([isize],) = f2;
@ -46,6 +52,8 @@ error[E0597]: `f1` does not live long enough
LL | fn baz<'a>() { LL | fn baz<'a>() {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here
... ...
LL | let f1 = (Foo,);
| -- binding `f1` declared here
LL | let f2: &(Foo,) = &f1; LL | let f2: &(Foo,) = &f1;
| ^^^ borrowed value does not live long enough | ^^^ borrowed value does not live long enough
LL | let f3: &'a (dyn Bar,) = f2; LL | let f3: &'a (dyn Bar,) = f2;

View file

@ -2,7 +2,7 @@ error[E0503]: cannot use `value` because it was mutably borrowed
--> $DIR/E0503.rs:4:16 --> $DIR/E0503.rs:4:16
| |
LL | let _borrow = &mut value; LL | let _borrow = &mut value;
| ---------- borrow of `value` occurs here | ---------- `value` is borrowed here
LL | let _sum = value + 1; LL | let _sum = value + 1;
| ^^^^^ use of borrowed `value` | ^^^^^ use of borrowed `value`
LL | _borrow.use_mut(); LL | _borrow.use_mut();

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `fancy_num` because it is borrowed error[E0505]: cannot move out of `fancy_num` because it is borrowed
--> $DIR/E0504.rs:9:13 --> $DIR/E0504.rs:9:13
| |
LL | let fancy_num = FancyNum { num: 5 };
| --------- binding `fancy_num` declared here
LL | let fancy_ref = &fancy_num; LL | let fancy_ref = &fancy_num;
| ---------- borrow of `fancy_num` occurs here | ---------- borrow of `fancy_num` occurs here
LL | LL |

View file

@ -1,6 +1,9 @@
error[E0505]: cannot move out of `x` because it is borrowed error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/E0505.rs:9:13 --> $DIR/E0505.rs:9:13
| |
LL | let x = Value{};
| - binding `x` declared here
LL | {
LL | let _ref_to_val: &Value = &x; LL | let _ref_to_val: &Value = &x;
| -- borrow of `x` occurs here | -- borrow of `x` occurs here
LL | eat(x); LL | eat(x);

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `fancy_num` because it is borrowed
--> $DIR/E0506.rs:8:5 --> $DIR/E0506.rs:8:5
| |
LL | let fancy_ref = &fancy_num; LL | let fancy_ref = &fancy_num;
| ---------- borrow of `fancy_num` occurs here | ---------- `fancy_num` is borrowed here
LL | fancy_num = FancyNum { num: 6 }; 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 |
LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num); LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
| ------------- borrow later used here | ------------- borrow later used here

View file

@ -1,6 +1,8 @@
error[E0597]: `y` does not live long enough error[E0597]: `y` does not live long enough
--> $DIR/E0597.rs:8:16 --> $DIR/E0597.rs:8:16
| |
LL | let y = 0;
| - binding `y` declared here
LL | x.x = Some(&y); LL | x.x = Some(&y);
| ^^ borrowed value does not live long enough | ^^ borrowed value does not live long enough
LL | LL |

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `x` because it is borrowed error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/implied-bounds-unnorm-associated-type-4.rs:21:10 --> $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, ()); LL | let y = f(&x, ());
| -- borrow of `x` occurs here | -- borrow of `x` occurs here
LL | drop(x); LL | drop(x);

View file

@ -1,6 +1,8 @@
error[E0505]: cannot move out of `x` because it is borrowed error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/implied-bounds-unnorm-associated-type.rs:20:10 --> $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, ()); LL | let y = f(&x, ());
| -- borrow of `x` occurs here | -- borrow of `x` occurs here
LL | drop(x); LL | drop(x);

View file

@ -1,6 +1,9 @@
error[E0597]: `*cell` does not live long enough error[E0597]: `*cell` does not live long enough
--> $DIR/dropck.rs:10:40 --> $DIR/dropck.rs:10:40
| |
LL | let (mut gen, cell);
| ---- binding `cell` declared here
LL | cell = Box::new(RefCell::new(0));
LL | let ref_ = Box::leak(Box::new(Some(cell.borrow_mut()))); LL | let ref_ = Box::leak(Box::new(Some(cell.borrow_mut())));
| ^^^^^^^^^^^^^^^^^ borrowed value does not live long enough | ^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
... ...

View 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> { LL | fn bug<'a, T: ?Sized + Fun<F<'a> = [u8]>>(_ : Box<T>) -> &'static T::F<'a> {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here
LL | let a = [0; 1]; LL | let a = [0; 1];
| - binding `a` declared here
LL | let _x = T::identity(&a); LL | let _x = T::identity(&a);
| ------------^^- | ------------^^-
| | | | | |

View file

@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
--> $DIR/hrtb-identity-fn-borrows.rs:14:5 --> $DIR/hrtb-identity-fn-borrows.rs:14:5
| |
LL | let y = f.call(&x); LL | let y = f.call(&x);
| -- borrow of `x` occurs here | -- `x` is borrowed here
LL | x = 5; LL | x = 5;
| ^^^^^ assignment to borrowed `x` occurs here | ^^^^^ `x` is assigned to here but it was already borrowed
... ...
LL | drop(y); LL | drop(y);
| - borrow later used here | - borrow later used here

View file

@ -4,6 +4,7 @@ error[E0597]: `bar` does not live long enough
LL | let x = { LL | let x = {
| - borrow later stored here | - borrow later stored here
LL | let bar = 22; LL | let bar = 22;
| --- binding `bar` declared here
LL | Foo::new(&bar).into() LL | Foo::new(&bar).into()
| ^^^^ borrowed value does not live long enough | ^^^^ borrowed value does not live long enough
LL | LL |
@ -16,6 +17,7 @@ error[E0597]: `y` does not live long enough
LL | let x = { LL | let x = {
| - borrow later stored here | - borrow later stored here
LL | let y = (); LL | let y = ();
| - binding `y` declared here
LL | foo(&y) LL | foo(&y)
| ^^ borrowed value does not live long enough | ^^ borrowed value does not live long enough
LL | LL |
@ -28,6 +30,7 @@ error[E0597]: `y` does not live long enough
LL | let x = { LL | let x = {
| - borrow later stored here | - borrow later stored here
LL | let y = (); LL | let y = ();
| - binding `y` declared here
LL | foo(&y) LL | foo(&y)
| ^^ borrowed value does not live long enough | ^^ borrowed value does not live long enough
LL | LL |

View file

@ -1,6 +1,8 @@
error[E0597]: `x` does not live long enough error[E0597]: `x` does not live long enough
--> $DIR/assoc-ty-wf-used-to-get-assoc-ty.rs:24:31 --> $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); LL | let _: &'static u8 = test(&x, &&3);
| -----^^------ | -----^^------
| | | | | |

View file

@ -4,6 +4,7 @@ error[E0597]: `y` does not live long enough
LL | fn foo<'a>() { LL | fn foo<'a>() {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here
LL | let y = (); LL | let y = ();
| - binding `y` declared here
LL | equate(InvariantRef::new(&y), const { InvariantRef::<'a>::NEW }); LL | equate(InvariantRef::new(&y), const { InvariantRef::<'a>::NEW });
| ------------------^^- | ------------------^^-
| | | | | |

View file

@ -2,10 +2,10 @@ error[E0506]: cannot assign to `*refr` because it is borrowed
--> $DIR/issue-40288.rs:16:5 --> $DIR/issue-40288.rs:16:5
| |
LL | save_ref(&*refr, &mut out); LL | save_ref(&*refr, &mut out);
| ------ borrow of `*refr` occurs here | ------ `*refr` is borrowed here
... ...
LL | *refr = 3; LL | *refr = 3;
| ^^^^^^^^^ assignment to borrowed `*refr` occurs here | ^^^^^^^^^ `*refr` is assigned to here but it was already borrowed
... ...
LL | println!("{:?}", out[0]); LL | println!("{:?}", out[0]);
| ------ borrow later used here | ------ borrow later used here

View file

@ -2,7 +2,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
--> $DIR/issue-45697-1.rs:20:9 --> $DIR/issue-45697-1.rs:20:9
| |
LL | let z = copy_borrowed_ptr(&mut y); LL | let z = copy_borrowed_ptr(&mut y);
| ------ borrow of `y` occurs here | ------ `y` is borrowed here
LL | *y.pointer += 1; LL | *y.pointer += 1;
| ^^^^^^^^^^^^^^^ use of borrowed `y` | ^^^^^^^^^^^^^^^ 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 --> $DIR/issue-45697-1.rs:20:9
| |
LL | let z = copy_borrowed_ptr(&mut y); LL | let z = copy_borrowed_ptr(&mut y);
| ------ borrow of `*y.pointer` occurs here | ------ `*y.pointer` is borrowed here
LL | *y.pointer += 1; 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; LL | *z.pointer += 1;
| --------------- borrow later used here | --------------- borrow later used here

View file

@ -2,7 +2,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
--> $DIR/issue-45697.rs:20:9 --> $DIR/issue-45697.rs:20:9
| |
LL | let z = copy_borrowed_ptr(&mut y); LL | let z = copy_borrowed_ptr(&mut y);
| ------ borrow of `y` occurs here | ------ `y` is borrowed here
LL | *y.pointer += 1; LL | *y.pointer += 1;
| ^^^^^^^^^^^^^^^ use of borrowed `y` | ^^^^^^^^^^^^^^^ 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 --> $DIR/issue-45697.rs:20:9
| |
LL | let z = copy_borrowed_ptr(&mut y); LL | let z = copy_borrowed_ptr(&mut y);
| ------ borrow of `*y.pointer` occurs here | ------ `*y.pointer` is borrowed here
LL | *y.pointer += 1; 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; LL | *z.pointer += 1;
| --------------- borrow later used here | --------------- borrow later used here

View file

@ -1,11 +1,10 @@
error[E0597]: `z` does not live long enough error[E0597]: `z` does not live long enough
--> $DIR/issue-46471-1.rs:4:9 --> $DIR/issue-46471-1.rs:4:9
| |
LL | let mut z = 0;
| ----- binding `z` declared here
LL | &mut z LL | &mut z
| ^^^^^^ | ^^^^^^ borrowed value does not live long enough
| |
| borrowed value does not live long enough
| borrow later used here
LL | }; LL | };
| - `z` dropped here while still borrowed | - `z` dropped here while still borrowed

View file

@ -1,6 +1,8 @@
error[E0597]: `line` does not live long enough error[E0597]: `line` does not live long enough
--> $DIR/issue-52126-assign-op-invariance.rs:34:28 --> $DIR/issue-52126-assign-op-invariance.rs:34:28
| |
LL | for line in vec!["123456789".to_string(), "12345678".to_string()] {
| ---- binding `line` declared here
LL | let v: Vec<&str> = line.split_whitespace().collect(); LL | let v: Vec<&str> = line.split_whitespace().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
... ...

View file

@ -1,6 +1,8 @@
error[E0597]: `foo` does not live long enough error[E0597]: `foo` does not live long enough
--> $DIR/issue-90600-expected-return-static-indirect.rs:7:32 --> $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); LL | let refcell = RefCell::new(&mut foo);
| ^^^^^^^^ borrowed value does not live long enough | ^^^^^^^^ borrowed value does not live long enough
LL | LL |

View file

@ -1,6 +1,8 @@
error[E0597]: `mutex` does not live long enough error[E0597]: `mutex` does not live long enough
--> $DIR/format-args-temporaries-in-write.rs:41:27 --> $DIR/format-args-temporaries-in-write.rs:41:27
| |
LL | let mutex = Mutex;
| ----- binding `mutex` declared here
LL | write!(Out, "{}", mutex.lock()) /* no semicolon */ LL | write!(Out, "{}", mutex.lock()) /* no semicolon */
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| | | |
@ -16,6 +18,8 @@ LL | };
error[E0597]: `mutex` does not live long enough error[E0597]: `mutex` does not live long enough
--> $DIR/format-args-temporaries-in-write.rs:47:29 --> $DIR/format-args-temporaries-in-write.rs:47:29
| |
LL | let mutex = Mutex;
| ----- binding `mutex` declared here
LL | writeln!(Out, "{}", mutex.lock()) /* no semicolon */ LL | writeln!(Out, "{}", mutex.lock()) /* no semicolon */
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| | | |

Some files were not shown because too many files have changed in this diff Show more