summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/suggest-pin-macro.rs
blob: f5b96215925b71d95eb2a20d264a5f0219bbefa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use std::pin::Pin;
use std::marker::PhantomPinned;

#[derive(Debug)]
struct Test {
    _marker: PhantomPinned,
}
impl Test {
    fn new() -> Self {
        Test {
            _marker: PhantomPinned, // This makes our type `!Unpin`
        }
    }
}

fn dummy(_: &mut Test) {}

pub fn main() {
    let mut test1 = Test::new();
    let mut test1 = unsafe { Pin::new_unchecked(&mut test1) };

    dummy(test1.get_mut()); //~ ERROR E0277
}