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/unsized-locals/borrow-after-move.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/unsized-locals/borrow-after-move.stderr')
-rw-r--r-- | tests/ui/unsized-locals/borrow-after-move.stderr | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/tests/ui/unsized-locals/borrow-after-move.stderr b/tests/ui/unsized-locals/borrow-after-move.stderr new file mode 100644 index 000000000..9e3c345dd --- /dev/null +++ b/tests/ui/unsized-locals/borrow-after-move.stderr @@ -0,0 +1,85 @@ +warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/borrow-after-move.rs:1:12 + | +LL | #![feature(unsized_locals, unsized_fn_params)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0382]: borrow of moved value: `x` + --> $DIR/borrow-after-move.rs:21:24 + | +LL | let y = *x; + | -- value moved here +LL | drop_unsized(y); +LL | println!("{}", &x); + | ^^ value borrowed here after move + | + = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait + +error[E0382]: borrow of moved value: `y` + --> $DIR/borrow-after-move.rs:23:24 + | +LL | let y = *x; + | - move occurs because `y` has type `str`, which does not implement the `Copy` trait +LL | drop_unsized(y); + | - value moved here +... +LL | println!("{}", &y); + | ^^ value borrowed here after move + | +note: consider changing this parameter type in function `drop_unsized` to borrow instead if owning the value isn't necessary + --> $DIR/borrow-after-move.rs:14:31 + | +LL | fn drop_unsized<T: ?Sized>(_: T) {} + | ------------ ^ this parameter takes ownership of the value + | | + | in this function + +error[E0382]: borrow of moved value: `x` + --> $DIR/borrow-after-move.rs:31:24 + | +LL | let y = *x; + | -- value moved here +LL | y.foo(); +LL | println!("{}", &x); + | ^^ value borrowed here after move + | + = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait + +error[E0382]: borrow of moved value: `y` + --> $DIR/borrow-after-move.rs:33:24 + | +LL | let y = *x; + | - move occurs because `y` has type `str`, which does not implement the `Copy` trait +LL | y.foo(); + | ----- `y` moved due to this method call +... +LL | println!("{}", &y); + | ^^ value borrowed here after move + | +note: `Foo::foo` takes ownership of the receiver `self`, which moves `y` + --> $DIR/borrow-after-move.rs:5:12 + | +LL | fn foo(self) -> String; + | ^^^^ + +error[E0382]: borrow of moved value: `x` + --> $DIR/borrow-after-move.rs:40:24 + | +LL | let x = "hello".to_owned().into_boxed_str(); + | - move occurs because `x` has type `Box<str>`, which does not implement the `Copy` trait +LL | x.foo(); + | - value moved here +LL | println!("{}", &x); + | ^^ value borrowed here after move + | +help: consider cloning the value if the performance cost is acceptable + | +LL | x.clone().foo(); + | ++++++++ + +error: aborting due to 5 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0382`. |