diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/borrowck/borrowck-closures-two-mut.stderr | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/borrowck/borrowck-closures-two-mut.stderr')
-rw-r--r-- | tests/ui/borrowck/borrowck-closures-two-mut.stderr | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-closures-two-mut.stderr b/tests/ui/borrowck/borrowck-closures-two-mut.stderr new file mode 100644 index 000000000..21e329f43 --- /dev/null +++ b/tests/ui/borrowck/borrowck-closures-two-mut.stderr @@ -0,0 +1,75 @@ +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/borrowck-closures-two-mut.rs:12:24 + | +LL | let c1 = to_fn_mut(|| x = 4); + | -- - first borrow occurs due to use of `x` in closure + | | + | first mutable borrow occurs here +LL | let c2 = to_fn_mut(|| x = 5); + | ^^ - second borrow occurs due to use of `x` in closure + | | + | second mutable borrow occurs here +LL | drop((c1, c2)); + | -- first borrow later used here + +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/borrowck-closures-two-mut.rs:23:24 + | +LL | let c1 = to_fn_mut(|| set(&mut x)); + | -- - first borrow occurs due to use of `x` in closure + | | + | first mutable borrow occurs here +LL | let c2 = to_fn_mut(|| set(&mut x)); + | ^^ - second borrow occurs due to use of `x` in closure + | | + | second mutable borrow occurs here +LL | drop((c1, c2)); + | -- first borrow later used here + +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/borrowck-closures-two-mut.rs:30:24 + | +LL | let c1 = to_fn_mut(|| x = 5); + | -- - first borrow occurs due to use of `x` in closure + | | + | first mutable borrow occurs here +LL | let c2 = to_fn_mut(|| set(&mut x)); + | ^^ - second borrow occurs due to use of `x` in closure + | | + | second mutable borrow occurs here +LL | drop((c1, c2)); + | -- first borrow later used here + +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/borrowck-closures-two-mut.rs:37:24 + | +LL | let c1 = to_fn_mut(|| x = 5); + | -- - first borrow occurs due to use of `x` in closure + | | + | first mutable borrow occurs here +LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure) + | ^^ - second borrow occurs due to use of `x` in closure + | | + | second mutable borrow occurs here +LL | +LL | drop((c1, c2)); + | -- first borrow later used here + +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/borrowck-closures-two-mut.rs:49:24 + | +LL | let c1 = to_fn_mut(|| set(&mut *x.f)); + | -- ---- first borrow occurs due to use of `x` in closure + | | + | first mutable borrow occurs here +LL | let c2 = to_fn_mut(|| set(&mut *x.f)); + | ^^ ---- second borrow occurs due to use of `x` in closure + | | + | second mutable borrow occurs here +LL | +LL | drop((c1, c2)); + | -- first borrow later used here + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0499`. |