Skip to content

Commit 2bd5993

Browse files
committed
Auto merge of #54343 - blitzerr:master, r=nikomatsakis
First shot at #54015 Closes #54015
2 parents 1c5e9c6 + 671e77d commit 2bd5993

20 files changed

+345
-249
lines changed

src/librustc_mir/borrow_check/error_reporting.rs

Lines changed: 288 additions & 225 deletions
Large diffs are not rendered by default.

src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ impl<'tcx> BorrowExplanation<'tcx> {
4646
},
4747
BorrowExplanation::UsedLaterInLoop(is_in_closure, var_or_use_span) => {
4848
let message = if is_in_closure {
49-
"borrow captured here by closure in later iteration of loop"
49+
"borrow captured here by closure, in later iteration of loop"
5050
} else {
51-
"borrow used here in later iteration of loop"
51+
"borrow used here, in later iteration of loop"
5252
};
5353
err.span_label(var_or_use_span, message);
5454
},

src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | for &x in &vector {
55
| -------
66
| |
77
| immutable borrow occurs here
8-
| borrow used here in later iteration of loop
8+
| borrow used here, in later iteration of loop
99
LL | let cap = vector.capacity();
1010
LL | vector.extend(repeat(0)); //~ ERROR cannot borrow
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
@@ -17,7 +17,7 @@ LL | for &x in &vector {
1717
| -------
1818
| |
1919
| immutable borrow occurs here
20-
| borrow used here in later iteration of loop
20+
| borrow used here, in later iteration of loop
2121
...
2222
LL | vector[1] = 5; //~ ERROR cannot borrow
2323
| ^^^^^^ mutable borrow occurs here

src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ LL | borrow(&*v); //~ ERROR cannot borrow
88
| ^^^ immutable borrow occurs here
99
LL | }
1010
LL | *x = box 5;
11-
| -- borrow used here in later iteration of loop
11+
| -- borrow used here, in later iteration of loop
1212

1313
error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
1414
--> $DIR/borrowck-lend-flow-loop.rs:109:16
1515
|
1616
LL | **x += 1;
17-
| -------- borrow used here in later iteration of loop
17+
| -------- borrow used here, in later iteration of loop
1818
LL | borrow(&*v); //~ ERROR cannot borrow
1919
| ^^^ immutable borrow occurs here
2020
LL | if cond2 {

src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
44
LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
55
| ---- ^^^^^^ second mutable borrow occurs here
66
| |
7-
| borrow used here in later iteration of loop
7+
| borrow used here, in later iteration of loop
88
...
99
LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
1010
| ------ first mutable borrow occurs here
@@ -13,7 +13,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
1313
--> $DIR/borrowck-mut-borrow-linear-errors.rs:25:30
1414
|
1515
LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
16-
| ---- borrow used here in later iteration of loop
16+
| ---- borrow used here, in later iteration of loop
1717
LL | //[mir]~^ ERROR [E0499]
1818
LL | 2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
1919
| ^^^^^^ second mutable borrow occurs here

src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
44
LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
55
| ---- ^^^^^^ second mutable borrow occurs here
66
| |
7-
| borrow used here in later iteration of loop
7+
| borrow used here, in later iteration of loop
88
...
99
LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
1010
| ------ first mutable borrow occurs here
@@ -13,7 +13,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
1313
--> $DIR/borrowck-mut-borrow-linear-errors.rs:25:30
1414
|
1515
LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
16-
| ---- borrow used here in later iteration of loop
16+
| ---- borrow used here, in later iteration of loop
1717
LL | //[mir]~^ ERROR [E0499]
1818
LL | 2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
1919
| ^^^^^^ second mutable borrow occurs here

src/test/ui/borrowck/issue-41962.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ error[E0382]: use of moved value (Mir)
2020
--> $DIR/issue-41962.rs:17:21
2121
|
2222
LL | if let Some(thing) = maybe {
23-
| ^^^^^ value moved here in previous iteration of loop
23+
| ^^^^^ value moved here, in previous iteration of loop
2424
|
2525
= note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
2626

src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LL | let inner_second = &mut inner_void; //~ ERROR cannot borrow
1717
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
1818
LL | inner_second.use_mut();
1919
LL | inner_first.use_mut();
20-
| ----------- borrow used here in later iteration of loop
20+
| ----------- borrow used here, in later iteration of loop
2121

2222
error: aborting due to 2 previous errors
2323

src/test/ui/issues/issue-12041.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0382]: use of moved value: `tx`
22
--> $DIR/issue-12041.rs:18:22
33
|
44
LL | let tx = tx;
5-
| ^^ value moved here in previous iteration of loop
5+
| ^^ value moved here, in previous iteration of loop
66
|
77
= note: move occurs because `tx` has type `std::sync::mpsc::Sender<i32>`, which does not implement the `Copy` trait
88

src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let v: Vec<&str> = line.split_whitespace().collect();
55
| ^^^^ borrowed value does not live long enough
66
LL | //~^ ERROR `line` does not live long enough
77
LL | println!("accumulator before add_assign {:?}", acc.map);
8-
| ------- borrow used here in later iteration of loop
8+
| ------- borrow used here, in later iteration of loop
99
...
1010
LL | }
1111
| - `line` dropped here while still borrowed

0 commit comments

Comments
 (0)