From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- ...wck-borrow-mut-base-ptr-in-aliasable-loc.stderr | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr (limited to 'tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr') diff --git a/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr b/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr new file mode 100644 index 000000000..ce9f7aa05 --- /dev/null +++ b/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr @@ -0,0 +1,34 @@ +error[E0594]: cannot assign to `**t1`, which is behind a `&` reference + --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5 + | +LL | let t1 = t0; + | -- consider changing this binding's type to be: `&mut &mut isize` +LL | let p: &isize = &**t0; +LL | **t1 = 22; + | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written + +error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:21 + | +LL | let t1 = &mut *t0; + | -------- mutable borrow occurs here +LL | let p: &isize = &**t0; + | ^^^^^ immutable borrow occurs here +LL | **t1 = 22; + | --------- mutable borrow later used here + +error[E0596]: cannot borrow `**t0` as mutable, as it is behind a `&` reference + --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:26 + | +LL | let x: &mut isize = &mut **t0; + | ^^^^^^^^^ `t0` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | +help: consider changing this to be a mutable reference + | +LL | fn foo4(t0: &mut &mut isize) { + | ~~~~~~~~~~~~~~~ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0502, E0594, E0596. +For more information about an error, try `rustc --explain E0502`. -- cgit v1.2.3