summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.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-borrow-from-owned-ptr.stderr')
-rw-r--r--tests/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr119
1 files changed, 119 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr b/tests/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr
new file mode 100644
index 000000000..c2351aacd
--- /dev/null
+++ b/tests/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr
@@ -0,0 +1,119 @@
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:18:17
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- first mutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1;
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+ | ----- first borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:25:17
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- mutable borrow occurs here
+LL | let _bar2 = &foo.bar1;
+ | ^^^^^^^^^ immutable borrow occurs here
+LL | *bar1;
+ | ----- mutable borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:32:17
+ |
+LL | let bar1 = &foo.bar1;
+ | --------- immutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1;
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+ | ----- immutable borrow later used here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:64:21
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- first mutable borrow occurs here
+LL | match *foo {
+LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL | *bar1;
+ | ----- first borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:73:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ mutable borrow occurs here
+LL | let _foo1 = &foo.bar1;
+ | ^^^^^^^^^ immutable borrow occurs here
+LL | let _foo2 = &*foo;
+LL | *bar1;
+ | ----- mutable borrow later used here
+
+error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:74:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ mutable borrow occurs here
+LL | let _foo1 = &foo.bar1;
+LL | let _foo2 = &*foo;
+ | ^^^^^ immutable borrow occurs here
+LL | *bar1;
+ | ----- mutable borrow later used here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:81:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ first mutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1;
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+ | ----- first borrow later used here
+
+error[E0499]: cannot borrow `*foo` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:88:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ first mutable borrow occurs here
+LL | let _foo2 = &mut *foo;
+ | ^^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+ | ----- first borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:95:17
+ |
+LL | let bar1 = &foo.bar1.int1;
+ | -------------- immutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1;
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+ | ----- immutable borrow later used here
+
+error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:102:17
+ |
+LL | let bar1 = &foo.bar1.int1;
+ | -------------- immutable borrow occurs here
+LL | let _foo2 = &mut *foo;
+ | ^^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+ | ----- immutable borrow later used here
+
+error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:122:16
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ^^^^^^^^^^^^^ cannot borrow as mutable
+ |
+help: consider changing this to be mutable
+ |
+LL | let mut foo = make_foo();
+ | +++
+
+error: aborting due to 11 previous errors
+
+Some errors have detailed explanations: E0499, E0502, E0596.
+For more information about an error, try `rustc --explain E0499`.