Skip to content

Commit 5764e08

Browse files
P8L1frank-king
authored andcommitted
Remove redundant pin ergonomics UI test allows
1 parent 54731a0 commit 5764e08

11 files changed

Lines changed: 54 additions & 60 deletions

tests/ui/pin-ergonomics/borrow-pinned-projection.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(pin_ergonomics)]
2-
#![allow(incomplete_features)]
32

43
// This protects pinning projected places. Pinning `pair.0` must not pin
54
// unrelated disjoint fields, but it must reject later mutable borrows or moves

tests/ui/pin-ergonomics/borrow-pinned-projection.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: cannot borrow `pair.0` as mutable because it is pinned
2-
--> $DIR/borrow-pinned-projection.rs:20:19
2+
--> $DIR/borrow-pinned-projection.rs:19:19
33
|
44
LL | let _pin = &pin mut pair.0;
55
| --------------- pin of `pair.0` occurs here
@@ -8,7 +8,7 @@ LL | let _borrow = &mut pair.0;
88
| ^^^^^^^^^^^ borrow of `pair.0` as mutable occurs here
99

1010
error: cannot borrow `pair.0` as mutable because it is pinned
11-
--> $DIR/borrow-pinned-projection.rs:32:19
11+
--> $DIR/borrow-pinned-projection.rs:31:19
1212
|
1313
LL | let ref pin mut _pin = pair.0;
1414
| ---------------- pin of `pair.0` occurs here
@@ -17,7 +17,7 @@ LL | let _borrow = &mut pair.0;
1717
| ^^^^^^^^^^^ borrow of `pair.0` as mutable occurs here
1818

1919
error: cannot move out of `pair.0` because it is pinned
20-
--> $DIR/borrow-pinned-projection.rs:44:18
20+
--> $DIR/borrow-pinned-projection.rs:43:18
2121
|
2222
LL | let _pin = &pin mut pair.0;
2323
| --------------- pin of `pair.0` occurs here
@@ -26,7 +26,7 @@ LL | let _moved = pair.0;
2626
| ^^^^^^ move out of `pair.0` occurs here
2727

2828
error: cannot move out of `pair.0` because it is pinned
29-
--> $DIR/borrow-pinned-projection.rs:56:18
29+
--> $DIR/borrow-pinned-projection.rs:55:18
3030
|
3131
LL | let ref pin mut _pin = pair.0;
3232
| ---------------- pin of `pair.0` occurs here
@@ -35,7 +35,7 @@ LL | let _moved = pair.0;
3535
| ^^^^^^ move out of `pair.0` occurs here
3636

3737
error: cannot move out of `value.field` because it is pinned
38-
--> $DIR/borrow-pinned-projection.rs:71:18
38+
--> $DIR/borrow-pinned-projection.rs:70:18
3939
|
4040
LL | let _ = &pin mut value;
4141
| -------------- pin of `value` occurs here
@@ -44,7 +44,7 @@ LL | let _moved = value.field;
4444
| ^^^^^^^^^^^ move out of `value.field` occurs here
4545

4646
error: cannot move out of `value.field` because it is pinned
47-
--> $DIR/borrow-pinned-projection.rs:80:18
47+
--> $DIR/borrow-pinned-projection.rs:79:18
4848
|
4949
LL | let ref pin mut _pin = value;
5050
| ---------------- pin of `value` occurs here
@@ -53,7 +53,7 @@ LL | let _moved = value.field;
5353
| ^^^^^^^^^^^ move out of `value.field` occurs here
5454

5555
error: cannot borrow `value.field` as mutable because it is pinned
56-
--> $DIR/borrow-pinned-projection.rs:89:13
56+
--> $DIR/borrow-pinned-projection.rs:88:13
5757
|
5858
LL | let _ = &pin mut value;
5959
| -------------- pin of `value` occurs here
@@ -62,7 +62,7 @@ LL | let _ = &mut value.field;
6262
| ^^^^^^^^^^^^^^^^ borrow of `value.field` as mutable occurs here
6363

6464
error: cannot borrow `value.field` as mutable because it is pinned
65-
--> $DIR/borrow-pinned-projection.rs:98:13
65+
--> $DIR/borrow-pinned-projection.rs:97:13
6666
|
6767
LL | let ref pin mut _pin = value;
6868
| ---------------- pin of `value` occurs here

tests/ui/pin-ergonomics/borrow-unpin.pinned.stderr

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: cannot move out of `foo` because it is pinned
2-
--> $DIR/borrow-unpin.rs:30:14
2+
--> $DIR/borrow-unpin.rs:29:14
33
|
44
LL | foo_pin_mut(&pin mut foo); // ok
55
| ------------ pin of `foo` occurs here
66
LL | foo_move(foo);
77
| ^^^ move out of `foo` occurs here
88

99
error[E0505]: cannot move out of `foo` because it is borrowed
10-
--> $DIR/borrow-unpin.rs:34:14
10+
--> $DIR/borrow-unpin.rs:33:14
1111
|
1212
LL | let mut foo = Foo::default();
1313
| ------- binding `foo` declared here
@@ -19,7 +19,7 @@ LL | foo_pin_mut(x); // ok
1919
| - borrow later used here
2020
|
2121
note: if `Foo` implemented `Clone`, you could clone the value
22-
--> $DIR/borrow-unpin.rs:14:1
22+
--> $DIR/borrow-unpin.rs:13:1
2323
|
2424
LL | struct Foo(PhantomPinned);
2525
| ^^^^^^^^^^ consider implementing `Clone` for this type
@@ -28,15 +28,15 @@ LL | let x = &pin mut foo;
2828
| --- you could clone this value
2929

3030
error: cannot move out of `foo` because it is pinned
31-
--> $DIR/borrow-unpin.rs:41:14
31+
--> $DIR/borrow-unpin.rs:40:14
3232
|
3333
LL | foo_pin_mut(&pin mut foo); // ok
3434
| ------------ pin of `foo` occurs here
3535
LL | foo_move(foo);
3636
| ^^^ move out of `foo` occurs here
3737

3838
error[E0505]: cannot move out of `foo` because it is borrowed
39-
--> $DIR/borrow-unpin.rs:45:14
39+
--> $DIR/borrow-unpin.rs:44:14
4040
|
4141
LL | let mut foo = Foo::default();
4242
| ------- binding `foo` declared here
@@ -48,7 +48,7 @@ LL | foo_pin_mut(x); // ok
4848
| - borrow later used here
4949
|
5050
note: if `Foo` implemented `Clone`, you could clone the value
51-
--> $DIR/borrow-unpin.rs:14:1
51+
--> $DIR/borrow-unpin.rs:13:1
5252
|
5353
LL | struct Foo(PhantomPinned);
5454
| ^^^^^^^^^^ consider implementing `Clone` for this type
@@ -57,15 +57,15 @@ LL | let x = &pin mut foo; // ok
5757
| --- you could clone this value
5858

5959
error: cannot move out of `foo` because it is pinned
60-
--> $DIR/borrow-unpin.rs:52:14
60+
--> $DIR/borrow-unpin.rs:51:14
6161
|
6262
LL | foo_pin_ref(&pin const foo); // ok
6363
| -------------- pin of `foo` occurs here
6464
LL | foo_move(foo);
6565
| ^^^ move out of `foo` occurs here
6666

6767
error[E0505]: cannot move out of `foo` because it is borrowed
68-
--> $DIR/borrow-unpin.rs:56:14
68+
--> $DIR/borrow-unpin.rs:55:14
6969
|
7070
LL | let foo = Foo::default();
7171
| --- binding `foo` declared here
@@ -77,7 +77,7 @@ LL | foo_pin_ref(x);
7777
| - borrow later used here
7878
|
7979
note: if `Foo` implemented `Clone`, you could clone the value
80-
--> $DIR/borrow-unpin.rs:14:1
80+
--> $DIR/borrow-unpin.rs:13:1
8181
|
8282
LL | struct Foo(PhantomPinned);
8383
| ^^^^^^^^^^ consider implementing `Clone` for this type
@@ -86,7 +86,7 @@ LL | let x = &pin const foo; // ok
8686
| --- you could clone this value
8787

8888
error: cannot move out of `foo` because it is pinned
89-
--> $DIR/borrow-unpin.rs:65:14
89+
--> $DIR/borrow-unpin.rs:64:14
9090
|
9191
LL | let ref pin mut _x = foo;
9292
| -------------- pin of `foo` occurs here
@@ -95,7 +95,7 @@ LL | foo_move(foo);
9595
| ^^^ move out of `foo` occurs here
9696

9797
error: cannot borrow `foo` as mutable because it is pinned
98-
--> $DIR/borrow-unpin.rs:73:13
98+
--> $DIR/borrow-unpin.rs:72:13
9999
|
100100
LL | let ref pin mut _x = foo;
101101
| -------------- pin of `foo` occurs here
@@ -104,7 +104,7 @@ LL | foo_mut(&mut foo);
104104
| ^^^^^^^^ borrow of `foo` as mutable occurs here
105105

106106
error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
107-
--> $DIR/borrow-unpin.rs:83:13
107+
--> $DIR/borrow-unpin.rs:82:13
108108
|
109109
LL | let x = &pin mut foo; // ok
110110
| ------------ mutable borrow occurs here
@@ -114,7 +114,7 @@ LL | foo_pin_mut(x);
114114
| - mutable borrow later used here
115115

116116
error[E0499]: cannot borrow `foo` as mutable more than once at a time
117-
--> $DIR/borrow-unpin.rs:105:17
117+
--> $DIR/borrow-unpin.rs:104:17
118118
|
119119
LL | let x = &pin mut foo; // ok
120120
| ------------ first mutable borrow occurs here
@@ -124,7 +124,7 @@ LL | foo_pin_mut(x);
124124
| - first borrow later used here
125125

126126
error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
127-
--> $DIR/borrow-unpin.rs:116:17
127+
--> $DIR/borrow-unpin.rs:115:17
128128
|
129129
LL | let x = &pin const foo; // ok
130130
| -------------- immutable borrow occurs here
@@ -134,7 +134,7 @@ LL | foo_pin_ref(x);
134134
| - immutable borrow later used here
135135

136136
error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
137-
--> $DIR/borrow-unpin.rs:127:17
137+
--> $DIR/borrow-unpin.rs:126:17
138138
|
139139
LL | let x = &pin mut foo; // ok
140140
| ------------ mutable borrow occurs here

tests/ui/pin-ergonomics/borrow-unpin.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ revisions: unpin pinned
22
#![feature(pin_ergonomics)]
3-
#![allow(dead_code, incomplete_features)]
43

54
// This test ensures `!Unpin` places cannot be mutably borrowed or moved after pinning.
65
// `Unpin` places still obey ordinary borrow rules, but expired `&pin` borrows do not pin.

tests/ui/pin-ergonomics/borrow-unpin.unpin.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0505]: cannot move out of `foo` because it is borrowed
2-
--> $DIR/borrow-unpin.rs:34:14
2+
--> $DIR/borrow-unpin.rs:33:14
33
|
44
LL | let mut foo = Foo::default();
55
| ------- binding `foo` declared here
@@ -11,7 +11,7 @@ LL | foo_pin_mut(x); // ok
1111
| - borrow later used here
1212
|
1313
note: if `Foo` implemented `Clone`, you could clone the value
14-
--> $DIR/borrow-unpin.rs:19:1
14+
--> $DIR/borrow-unpin.rs:18:1
1515
|
1616
LL | struct Foo;
1717
| ^^^^^^^^^^ consider implementing `Clone` for this type
@@ -20,7 +20,7 @@ LL | let x = &pin mut foo;
2020
| --- you could clone this value
2121

2222
error[E0505]: cannot move out of `foo` because it is borrowed
23-
--> $DIR/borrow-unpin.rs:45:14
23+
--> $DIR/borrow-unpin.rs:44:14
2424
|
2525
LL | let mut foo = Foo::default();
2626
| ------- binding `foo` declared here
@@ -32,7 +32,7 @@ LL | foo_pin_mut(x); // ok
3232
| - borrow later used here
3333
|
3434
note: if `Foo` implemented `Clone`, you could clone the value
35-
--> $DIR/borrow-unpin.rs:19:1
35+
--> $DIR/borrow-unpin.rs:18:1
3636
|
3737
LL | struct Foo;
3838
| ^^^^^^^^^^ consider implementing `Clone` for this type
@@ -41,7 +41,7 @@ LL | let x = &pin mut foo; // ok
4141
| --- you could clone this value
4242

4343
error[E0505]: cannot move out of `foo` because it is borrowed
44-
--> $DIR/borrow-unpin.rs:56:14
44+
--> $DIR/borrow-unpin.rs:55:14
4545
|
4646
LL | let foo = Foo::default();
4747
| --- binding `foo` declared here
@@ -53,7 +53,7 @@ LL | foo_pin_ref(x);
5353
| - borrow later used here
5454
|
5555
note: if `Foo` implemented `Clone`, you could clone the value
56-
--> $DIR/borrow-unpin.rs:19:1
56+
--> $DIR/borrow-unpin.rs:18:1
5757
|
5858
LL | struct Foo;
5959
| ^^^^^^^^^^ consider implementing `Clone` for this type
@@ -62,7 +62,7 @@ LL | let x = &pin const foo; // ok
6262
| --- you could clone this value
6363

6464
error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
65-
--> $DIR/borrow-unpin.rs:83:13
65+
--> $DIR/borrow-unpin.rs:82:13
6666
|
6767
LL | let x = &pin mut foo; // ok
6868
| ------------ mutable borrow occurs here
@@ -72,7 +72,7 @@ LL | foo_pin_mut(x);
7272
| - mutable borrow later used here
7373

7474
error[E0499]: cannot borrow `foo` as mutable more than once at a time
75-
--> $DIR/borrow-unpin.rs:105:17
75+
--> $DIR/borrow-unpin.rs:104:17
7676
|
7777
LL | let x = &pin mut foo; // ok
7878
| ------------ first mutable borrow occurs here
@@ -82,7 +82,7 @@ LL | foo_pin_mut(x);
8282
| - first borrow later used here
8383

8484
error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
85-
--> $DIR/borrow-unpin.rs:116:17
85+
--> $DIR/borrow-unpin.rs:115:17
8686
|
8787
LL | let x = &pin const foo; // ok
8888
| -------------- immutable borrow occurs here
@@ -92,7 +92,7 @@ LL | foo_pin_ref(x);
9292
| - immutable borrow later used here
9393

9494
error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
95-
--> $DIR/borrow-unpin.rs:127:17
95+
--> $DIR/borrow-unpin.rs:126:17
9696
|
9797
LL | let x = &pin mut foo; // ok
9898
| ------------ mutable borrow occurs here

tests/ui/pin-ergonomics/borrow.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(pin_ergonomics)]
2-
#![allow(dead_code, incomplete_features)]
32

43
// Makes sure we can handle `&pin mut place` and `&pin const place` as sugar for
54
// `std::pin::pin!(place)` and `Pin::new(&place)`.

tests/ui/pin-ergonomics/borrow.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: cannot borrow `x` as mutable because it is pinned
2-
--> $DIR/borrow.rs:34:14
2+
--> $DIR/borrow.rs:33:14
33
|
44
LL | let _x = &pin mut x;
55
| ---------- pin of `x` occurs here
@@ -8,7 +8,7 @@ LL | let _x = &mut x;
88
| ^^^^^^ borrow of `x` as mutable occurs here
99

1010
error: cannot move out of `x` because it is pinned
11-
--> $DIR/borrow.rs:35:14
11+
--> $DIR/borrow.rs:34:14
1212
|
1313
LL | let _x = &pin mut x;
1414
| ---------- pin of `x` occurs here
@@ -17,7 +17,7 @@ LL | let _x = x;
1717
| ^ move out of `x` occurs here
1818

1919
error: cannot borrow `y` as mutable because it is pinned
20-
--> $DIR/borrow.rs:43:14
20+
--> $DIR/borrow.rs:42:14
2121
|
2222
LL | let _y = &pin const y;
2323
| ------------ pin of `y` occurs here
@@ -26,7 +26,7 @@ LL | let _y = &mut y;
2626
| ^^^^^^ borrow of `y` as mutable occurs here
2727

2828
error: cannot move out of `y` because it is pinned
29-
--> $DIR/borrow.rs:44:14
29+
--> $DIR/borrow.rs:43:14
3030
|
3131
LL | let _y = &pin const y;
3232
| ------------ pin of `y` occurs here
@@ -35,7 +35,7 @@ LL | let _y = y;
3535
| ^ move out of `y` occurs here
3636

3737
error: cannot borrow `x` as mutable because it is pinned
38-
--> $DIR/borrow.rs:51:14
38+
--> $DIR/borrow.rs:50:14
3939
|
4040
LL | let ref pin mut _x = x;
4141
| -------------- pin of `x` occurs here
@@ -44,7 +44,7 @@ LL | let _x = &mut x;
4444
| ^^^^^^ borrow of `x` as mutable occurs here
4545

4646
error: cannot move out of `x` because it is pinned
47-
--> $DIR/borrow.rs:52:14
47+
--> $DIR/borrow.rs:51:14
4848
|
4949
LL | let ref pin mut _x = x;
5050
| -------------- pin of `x` occurs here
@@ -53,7 +53,7 @@ LL | let _x = x;
5353
| ^ move out of `x` occurs here
5454

5555
error: cannot borrow `y` as mutable because it is pinned
56-
--> $DIR/borrow.rs:59:14
56+
--> $DIR/borrow.rs:58:14
5757
|
5858
LL | let ref pin const _y = y;
5959
| ---------------- pin of `y` occurs here
@@ -62,7 +62,7 @@ LL | let _y = &mut y;
6262
| ^^^^^^ borrow of `y` as mutable occurs here
6363

6464
error: cannot move out of `y` because it is pinned
65-
--> $DIR/borrow.rs:60:14
65+
--> $DIR/borrow.rs:59:14
6666
|
6767
LL | let ref pin const _y = y;
6868
| ---------------- pin of `y` occurs here

tests/ui/pin-ergonomics/direct-borrow-requires-pin-v2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(pin_ergonomics)]
2-
#![allow(dead_code, incomplete_features)]
32
//@ normalize-stderr: "\n\n\z" -> "\n"
43

54
use std::marker::PhantomPinned;

0 commit comments

Comments
 (0)