File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( pin_ergonomics) ]
2
+ #![ allow( dead_code, incomplete_features) ]
3
+
4
+ // Make sure with pin reborrowing that we can only get one mutable reborrow of a pinned reference.
5
+
6
+ use std:: pin:: { pin, Pin } ;
7
+
8
+ fn twice ( _: Pin < & mut i32 > , _: Pin < & mut i32 > ) { }
9
+
10
+ fn main ( ) {
11
+ let x = pin ! ( 42 ) ;
12
+ twice ( x, x) ; //~ ERROR cannot borrow
13
+ }
Original file line number Diff line number Diff line change
1
+ error[E0499]: cannot borrow `*x.__pointer` as mutable more than once at a time
2
+ --> $DIR/pin-reborrow-once.rs:12:14
3
+ |
4
+ LL | twice(x, x);
5
+ | ----- - ^ second mutable borrow occurs here
6
+ | | |
7
+ | | first mutable borrow occurs here
8
+ | first borrow later used by call
9
+
10
+ error: aborting due to 1 previous error
11
+
12
+ For more information about this error, try `rustc --explain E0499`.
You can’t perform that action at this time.
0 commit comments