diff options
| author | Yan Chen <ychen2@futurewei.com> | 2022-09-20 14:44:55 -0700 |
|---|---|---|
| committer | Yan Chen <ychen2@futurewei.com> | 2022-09-28 15:27:56 -0700 |
| commit | b3bf931aa2ca95c60ec49b7f6519a1e74dae3c1d (patch) | |
| tree | 28f0ba12afa5d933b57666bee116233298e25bcc /src | |
| parent | 432abd86f231c908f6df3cdd779e83f35084be90 (diff) | |
| download | rust-b3bf931aa2ca95c60ec49b7f6519a1e74dae3c1d.tar.gz rust-b3bf931aa2ca95c60ec49b7f6519a1e74dae3c1d.zip | |
Fix missing explanation of where borrowed reference is used when the borrow occurs in loop iteration
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr | 5 | ||||
| -rw-r--r-- | src/test/ui/borrowck/two-phase-across-loop.stderr | 5 | ||||
| -rw-r--r-- | src/test/ui/nll/closures-in-loops.stderr | 16 |
3 files changed, 18 insertions, 8 deletions
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr index 15ac737606d..d2b845619c7 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr @@ -25,7 +25,10 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time --> $DIR/borrowck-mut-borrow-linear-errors.rs:12:30 | LL | _ => { addr.push(&mut x); } - | ^^^^^^ `x` was mutably borrowed here in the previous iteration of the loop + | ----------^^^^^^- + | | | + | | `x` was mutably borrowed here in the previous iteration of the loop + | first borrow used here, in later iteration of loop error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/two-phase-across-loop.stderr b/src/test/ui/borrowck/two-phase-across-loop.stderr index 95896c6bbf9..22f9b39dfee 100644 --- a/src/test/ui/borrowck/two-phase-across-loop.stderr +++ b/src/test/ui/borrowck/two-phase-across-loop.stderr @@ -2,7 +2,10 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time --> $DIR/two-phase-across-loop.rs:17:22 | LL | strings.push(foo.get_string()); - | ^^^^^^^^^^^^^^^^ `foo` was mutably borrowed here in the previous iteration of the loop + | -------------^^^^^^^^^^^^^^^^- + | | | + | | `foo` was mutably borrowed here in the previous iteration of the loop + | first borrow used here, in later iteration of loop error: aborting due to previous error diff --git a/src/test/ui/nll/closures-in-loops.stderr b/src/test/ui/nll/closures-in-loops.stderr index 2be0460df1f..1c1a31d356d 100644 --- a/src/test/ui/nll/closures-in-loops.stderr +++ b/src/test/ui/nll/closures-in-loops.stderr @@ -13,17 +13,21 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time --> $DIR/closures-in-loops.rs:13:16 | LL | v.push(|| x = String::new()); - | ^^ - borrows occur due to use of `x` in closure - | | - | `x` was mutably borrowed here in the previous iteration of the loop + | -------^^------------------- + | | | | + | | | borrows occur due to use of `x` in closure + | | `x` was mutably borrowed here in the previous iteration of the loop + | first borrow used here, in later iteration of loop error[E0524]: two closures require unique access to `x` at the same time --> $DIR/closures-in-loops.rs:20:16 | LL | v.push(|| *x = String::new()); - | ^^ -- borrows occur due to use of `x` in closure - | | - | closures are constructed here in different iterations of loop + | -------^^-------------------- + | | | | + | | | borrows occur due to use of `x` in closure + | | closures are constructed here in different iterations of loop + | first borrow used here, in later iteration of loop error: aborting due to 3 previous errors |
