diff options
| author | Eric Holk <ericholk@microsoft.com> | 2024-10-01 12:44:10 -0700 |
|---|---|---|
| committer | Eric Holk <ericholk@microsoft.com> | 2024-10-01 12:44:10 -0700 |
| commit | 9b52fb555835224e085170b67857a250dd6f176b (patch) | |
| tree | 5ef02510b61237d8283411010d95db4b70cb4e5b | |
| parent | 3dfb30c70a2a8da87eefa01a56d753d1698866c9 (diff) | |
| download | rust-9b52fb555835224e085170b67857a250dd6f176b.tar.gz rust-9b52fb555835224e085170b67857a250dd6f176b.zip | |
Split out method receivers in feature gate test
| -rw-r--r-- | tests/ui/feature-gates/feature-gate-pin_ergonomics.rs | 4 | ||||
| -rw-r--r-- | tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr | 27 |
2 files changed, 6 insertions, 25 deletions
diff --git a/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs b/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs index d56a046fd62..3382504af9d 100644 --- a/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs +++ b/tests/ui/feature-gates/feature-gate-pin_ergonomics.rs @@ -15,8 +15,10 @@ fn foo(_: Pin<&mut Foo>) { fn bar(mut x: Pin<&mut Foo>) { foo(x); foo(x); //~ ERROR use of moved value: `x` +} - x.foo(); //~ ERROR use of moved value: `x` +fn baz(mut x: Pin<&mut Foo>) { + x.foo(); x.foo(); //~ ERROR use of moved value: `x` } diff --git a/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr b/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr index bc49088f3d7..430b7866241 100644 --- a/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr +++ b/tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr @@ -17,31 +17,10 @@ LL | fn foo(_: Pin<&mut Foo>) { | in this function error[E0382]: use of moved value: `x` - --> $DIR/feature-gate-pin_ergonomics.rs:19:5 + --> $DIR/feature-gate-pin_ergonomics.rs:22:5 | -LL | fn bar(mut x: Pin<&mut Foo>) { - | ----- move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait -LL | foo(x); -LL | foo(x); - | - value moved here -LL | -LL | x.foo(); - | ^ value used here after move - | -note: consider changing this parameter type in function `foo` to borrow instead if owning the value isn't necessary - --> $DIR/feature-gate-pin_ergonomics.rs:12:11 - | -LL | fn foo(_: Pin<&mut Foo>) { - | --- ^^^^^^^^^^^^^ this parameter takes ownership of the value - | | - | in this function - -error[E0382]: use of moved value: `x` - --> $DIR/feature-gate-pin_ergonomics.rs:20:5 - | -LL | fn bar(mut x: Pin<&mut Foo>) { +LL | fn baz(mut x: Pin<&mut Foo>) { | ----- move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait -... LL | x.foo(); | ----- `x` moved due to this method call LL | x.foo(); @@ -57,6 +36,6 @@ help: consider reborrowing the `Pin` instead of moving it LL | x.as_mut().foo(); | +++++++++ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0382`. |
