summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/borrowck/borrowck-unboxed-closures.stderr
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/borrowck/borrowck-unboxed-closures.stderr')
-rw-r--r--src/test/ui/borrowck/borrowck-unboxed-closures.stderr42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
new file mode 100644
index 000000000..d46ef126d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
@@ -0,0 +1,42 @@
+error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-unboxed-closures.rs:3:5
+ |
+LL | let g = &mut f;
+ | ------ mutable borrow occurs here
+LL | f(1, 2);
+ | ^ immutable borrow occurs here
+LL | use_mut(g);
+ | - mutable borrow later used here
+
+error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-unboxed-closures.rs:7:5
+ |
+LL | fn b<F:FnMut(isize, isize) -> isize>(f: F) {
+ | - help: consider changing this to be mutable: `mut f`
+LL | f(1, 2);
+ | ^ cannot borrow as mutable
+
+error[E0382]: use of moved value: `f`
+ --> $DIR/borrowck-unboxed-closures.rs:12:5
+ |
+LL | fn c<F:FnOnce(isize, isize) -> isize>(f: F) {
+ | - move occurs because `f` has type `F`, which does not implement the `Copy` trait
+LL | f(1, 2);
+ | ------- `f` moved due to this call
+LL | f(1, 2);
+ | ^ value used here after move
+ |
+note: this value implements `FnOnce`, which causes it to be moved when called
+ --> $DIR/borrowck-unboxed-closures.rs:11:5
+ |
+LL | f(1, 2);
+ | ^
+help: consider further restricting this bound
+ |
+LL | fn c<F:FnOnce(isize, isize) -> isize + Copy>(f: F) {
+ | ++++++
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0382, E0502, E0596.
+For more information about an error, try `rustc --explain E0382`.