summaryrefslogtreecommitdiffstats
path: root/tests/ui/typeck/dont-record-adjustments-when-pointing-at-arg.rs
blob: 0c2d71707c9f0c8ec4a0f4e45248e01c5420e80d (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
27
28
29
pub trait NSWindow: Sized {
    fn frame(self) -> () {
        unimplemented!()
    }
    fn setFrame_display_(self, display: ()) {}
}
impl NSWindow for () {}

pub struct NSRect {}

use std::ops::Deref;
struct MainThreadSafe<T = ()>(T);
impl<T> Deref for MainThreadSafe<T> {
    type Target = T;

    fn deref(&self) -> &T {
        unimplemented!()
    }
}

fn main() {
    || {
        let ns_window = MainThreadSafe(());
        // Don't record adjustments twice for `*ns_window`
        (*ns_window).frame();
        ns_window.setFrame_display_(0);
        //~^ ERROR mismatched types
    };
}