Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tests/ui/pin-ergonomics/borrow-pinned-projection.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(pin_ergonomics)]
#![allow(incomplete_features)]

// This protects pinning projected places. Pinning `pair.0` must not pin
// unrelated disjoint fields, but it must reject later mutable borrows or moves
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/pin-ergonomics/borrow-pinned-projection.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: cannot borrow `pair.0` as mutable because it is pinned
--> $DIR/borrow-pinned-projection.rs:20:19
--> $DIR/borrow-pinned-projection.rs:19:19
|
LL | let _pin = &pin mut pair.0;
| --------------- pin of `pair.0` occurs here
Expand All @@ -8,7 +8,7 @@ LL | let _borrow = &mut pair.0;
| ^^^^^^^^^^^ borrow of `pair.0` as mutable occurs here

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

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

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

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

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

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

error: cannot borrow `value.field` as mutable because it is pinned
--> $DIR/borrow-pinned-projection.rs:98:13
--> $DIR/borrow-pinned-projection.rs:97:13
|
LL | let ref pin mut _pin = value;
| ---------------- pin of `value` occurs here
Expand Down
30 changes: 15 additions & 15 deletions tests/ui/pin-ergonomics/borrow-unpin.pinned.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: cannot move out of `foo` because it is pinned
--> $DIR/borrow-unpin.rs:30:14
--> $DIR/borrow-unpin.rs:29:14
|
LL | foo_pin_mut(&pin mut foo); // ok
| ------------ pin of `foo` occurs here
LL | foo_move(foo);
| ^^^ move out of `foo` occurs here

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

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

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

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

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

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

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

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

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

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

error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
--> $DIR/borrow-unpin.rs:127:17
--> $DIR/borrow-unpin.rs:126:17
|
LL | let x = &pin mut foo; // ok
| ------------ mutable borrow occurs here
Expand Down
1 change: 0 additions & 1 deletion tests/ui/pin-ergonomics/borrow-unpin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ revisions: unpin pinned
#![feature(pin_ergonomics)]
#![allow(dead_code, incomplete_features)]

// This test ensures `!Unpin` places cannot be mutably borrowed or moved after pinning.
// `Unpin` places still obey ordinary borrow rules, but expired `&pin` borrows do not pin.
Expand Down
20 changes: 10 additions & 10 deletions tests/ui/pin-ergonomics/borrow-unpin.unpin.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0505]: cannot move out of `foo` because it is borrowed
--> $DIR/borrow-unpin.rs:34:14
--> $DIR/borrow-unpin.rs:33:14
|
LL | let mut foo = Foo::default();
| ------- binding `foo` declared here
Expand All @@ -11,7 +11,7 @@ LL | foo_pin_mut(x); // ok
| - borrow later used here
|
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:19:1
--> $DIR/borrow-unpin.rs:18:1
|
LL | struct Foo;
| ^^^^^^^^^^ consider implementing `Clone` for this type
Expand All @@ -20,7 +20,7 @@ LL | let x = &pin mut foo;
| --- you could clone this value

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

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

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

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

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

error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
--> $DIR/borrow-unpin.rs:127:17
--> $DIR/borrow-unpin.rs:126:17
|
LL | let x = &pin mut foo; // ok
| ------------ mutable borrow occurs here
Expand Down
1 change: 0 additions & 1 deletion tests/ui/pin-ergonomics/borrow.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(pin_ergonomics)]
#![allow(dead_code, incomplete_features)]

// Makes sure we can handle `&pin mut place` and `&pin const place` as sugar for
// `std::pin::pin!(place)` and `Pin::new(&place)`.
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/pin-ergonomics/borrow.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: cannot borrow `x` as mutable because it is pinned
--> $DIR/borrow.rs:34:14
--> $DIR/borrow.rs:33:14
|
LL | let _x = &pin mut x;
| ---------- pin of `x` occurs here
Expand All @@ -8,7 +8,7 @@ LL | let _x = &mut x;
| ^^^^^^ borrow of `x` as mutable occurs here

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

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

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

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

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

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

error: cannot move out of `y` because it is pinned
--> $DIR/borrow.rs:60:14
--> $DIR/borrow.rs:59:14
|
LL | let ref pin const _y = y;
| ---------------- pin of `y` occurs here
Expand Down
1 change: 0 additions & 1 deletion tests/ui/pin-ergonomics/direct-borrow-requires-pin-v2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(pin_ergonomics)]
#![allow(dead_code, incomplete_features)]
//@ normalize-stderr: "\n\n\z" -> "\n"

use std::marker::PhantomPinned;
Expand Down
Loading
Loading