Skip to content

Commit 9b52fb5

Browse files
committed
Split out method receivers in feature gate test
1 parent 3dfb30c commit 9b52fb5

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

tests/ui/feature-gates/feature-gate-pin_ergonomics.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ fn foo(_: Pin<&mut Foo>) {
1515
fn bar(mut x: Pin<&mut Foo>) {
1616
foo(x);
1717
foo(x); //~ ERROR use of moved value: `x`
18+
}
1819

19-
x.foo(); //~ ERROR use of moved value: `x`
20+
fn baz(mut x: Pin<&mut Foo>) {
21+
x.foo();
2022
x.foo(); //~ ERROR use of moved value: `x`
2123
}
2224

tests/ui/feature-gates/feature-gate-pin_ergonomics.stderr

+3-24
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,10 @@ LL | fn foo(_: Pin<&mut Foo>) {
1717
| in this function
1818

1919
error[E0382]: use of moved value: `x`
20-
--> $DIR/feature-gate-pin_ergonomics.rs:19:5
20+
--> $DIR/feature-gate-pin_ergonomics.rs:22:5
2121
|
22-
LL | fn bar(mut x: Pin<&mut Foo>) {
23-
| ----- move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait
24-
LL | foo(x);
25-
LL | foo(x);
26-
| - value moved here
27-
LL |
28-
LL | x.foo();
29-
| ^ value used here after move
30-
|
31-
note: consider changing this parameter type in function `foo` to borrow instead if owning the value isn't necessary
32-
--> $DIR/feature-gate-pin_ergonomics.rs:12:11
33-
|
34-
LL | fn foo(_: Pin<&mut Foo>) {
35-
| --- ^^^^^^^^^^^^^ this parameter takes ownership of the value
36-
| |
37-
| in this function
38-
39-
error[E0382]: use of moved value: `x`
40-
--> $DIR/feature-gate-pin_ergonomics.rs:20:5
41-
|
42-
LL | fn bar(mut x: Pin<&mut Foo>) {
22+
LL | fn baz(mut x: Pin<&mut Foo>) {
4323
| ----- move occurs because `x` has type `Pin<&mut Foo>`, which does not implement the `Copy` trait
44-
...
4524
LL | x.foo();
4625
| ----- `x` moved due to this method call
4726
LL | x.foo();
@@ -57,6 +36,6 @@ help: consider reborrowing the `Pin` instead of moving it
5736
LL | x.as_mut().foo();
5837
| +++++++++
5938

60-
error: aborting due to 3 previous errors
39+
error: aborting due to 2 previous errors
6140

6241
For more information about this error, try `rustc --explain E0382`.

0 commit comments

Comments
 (0)