about summary refs log tree commit diff
path: root/tests/ui/pin-macro/pin_move.rs
blob: 0f6d34fad951f7919626e74b25b0b560f825207c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//@ edition:2024

use core::marker::PhantomPinned;
use core::pin::pin;

fn a() {
    struct NotCopy<T>(T);
    #[allow(unused_mut)]
    let mut pointee = NotCopy(PhantomPinned);
    pin!(pointee);
    let _moved = pointee;
    //~^ ERROR use of moved value
}

fn b() {
    struct NotCopy<T>(T);
    let mut pointee = NotCopy(PhantomPinned);
    pin!(*&mut pointee);
    //~^ ERROR cannot move
    let _moved = pointee;
}

fn main() {
    a();
    b();
}