diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
commit | 4f9fe856a25ab29345b90e7725509e9ee38a37be (patch) | |
tree | e4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /tests/ui/moves | |
parent | Adding upstream version 1.68.2+dfsg1. (diff) | |
download | rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.tar.xz rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.zip |
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/ui/moves/issue-22536-copy-mustnt-zero.rs (renamed from tests/ui/issues/issue-22536-copy-mustnt-zero.rs) | 0 | ||||
-rw-r--r-- | tests/ui/moves/move-fn-self-receiver.stderr | 2 | ||||
-rw-r--r-- | tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.fixed | 11 | ||||
-rw-r--r-- | tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.rs | 11 | ||||
-rw-r--r-- | tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr | 20 |
5 files changed, 44 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-22536-copy-mustnt-zero.rs b/tests/ui/moves/issue-22536-copy-mustnt-zero.rs index 017f36484..017f36484 100644 --- a/tests/ui/issues/issue-22536-copy-mustnt-zero.rs +++ b/tests/ui/moves/issue-22536-copy-mustnt-zero.rs diff --git a/tests/ui/moves/move-fn-self-receiver.stderr b/tests/ui/moves/move-fn-self-receiver.stderr index 7f69e5dcf..91d237b1d 100644 --- a/tests/ui/moves/move-fn-self-receiver.stderr +++ b/tests/ui/moves/move-fn-self-receiver.stderr @@ -75,6 +75,8 @@ LL | fn use_pin_box_self(self: Pin<Box<Self>>) {} error[E0505]: cannot move out of `mut_foo` because it is borrowed --> $DIR/move-fn-self-receiver.rs:50:5 | +LL | let mut mut_foo = Foo; + | ----------- binding `mut_foo` declared here LL | let ret = mut_foo.use_mut_self(); | ---------------------- borrow of `mut_foo` occurs here LL | mut_foo; diff --git a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.fixed b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.fixed new file mode 100644 index 000000000..0b9a3bae9 --- /dev/null +++ b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.fixed @@ -0,0 +1,11 @@ +// run-rustfix +use std::pin::Pin; + +fn foo(_: &mut ()) {} + +fn main() { + let mut uwu = (); + let mut r = Pin::new(&mut uwu); + foo(r.as_mut().get_mut()); + foo(r.get_mut()); //~ ERROR use of moved value +} diff --git a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.rs b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.rs new file mode 100644 index 000000000..0e952b06e --- /dev/null +++ b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.rs @@ -0,0 +1,11 @@ +// run-rustfix +use std::pin::Pin; + +fn foo(_: &mut ()) {} + +fn main() { + let mut uwu = (); + let mut r = Pin::new(&mut uwu); + foo(r.get_mut()); + foo(r.get_mut()); //~ ERROR use of moved value +} diff --git a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr new file mode 100644 index 000000000..7e513b73c --- /dev/null +++ b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr @@ -0,0 +1,20 @@ +error[E0382]: use of moved value: `r` + --> $DIR/pin-mut-reborrow-infer-var-issue-107419.rs:10:9 + | +LL | let mut r = Pin::new(&mut uwu); + | ----- move occurs because `r` has type `Pin<&mut ()>`, which does not implement the `Copy` trait +LL | foo(r.get_mut()); + | --------- `r` moved due to this method call +LL | foo(r.get_mut()); + | ^ value used here after move + | +note: `Pin::<&'a mut T>::get_mut` takes ownership of the receiver `self`, which moves `r` + --> $SRC_DIR/core/src/pin.rs:LL:COL +help: consider reborrowing the `Pin` instead of moving it + | +LL | foo(r.as_mut().get_mut()); + | +++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. |