From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../try-block/try-block-maybe-bad-lifetime.stderr | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr (limited to 'src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr') diff --git a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr new file mode 100644 index 000000000..c9f2a3ed9 --- /dev/null +++ b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr @@ -0,0 +1,42 @@ +error[E0506]: cannot assign to `i` because it is borrowed + --> $DIR/try-block-maybe-bad-lifetime.rs:17:9 + | +LL | &i + | -- borrow of `i` occurs here +LL | }; +LL | i = 0; + | ^^^^^ assignment to borrowed `i` occurs here +LL | let _ = i; +LL | do_something_with(x); + | - borrow later used here + +error[E0382]: borrow of moved value: `x` + --> $DIR/try-block-maybe-bad-lifetime.rs:28:24 + | +LL | let x = String::new(); + | - move occurs because `x` has type `String`, which does not implement the `Copy` trait +... +LL | ::std::mem::drop(x); + | - value moved here +LL | }; +LL | println!("{}", x); + | ^ value borrowed here after move + | + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0506]: cannot assign to `i` because it is borrowed + --> $DIR/try-block-maybe-bad-lifetime.rs:40:9 + | +LL | j = &i; + | -- borrow of `i` occurs here +LL | }; +LL | i = 0; + | ^^^^^ assignment to borrowed `i` occurs here +LL | let _ = i; +LL | do_something_with(j); + | - borrow later used here + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0382, E0506. +For more information about an error, try `rustc --explain E0382`. -- cgit v1.2.3