summary refs log tree commit diff
path: root/tests/ui/lint/dead-code/allow-unconstructed-pub-struct.rs
blob: 8cd1524045b15bb4b23517552e6a419095cf6535 (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
30
31
32
33
//@ check-pass

mod ffi {
    use super::*;

    extern "C" {
        pub fn DomPromise_AddRef(promise: *const Promise);
        pub fn DomPromise_Release(promise: *const Promise);
    }
}

#[repr(C)]
#[allow(unused)]
pub struct Promise {
    private: [u8; 0],
    __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
}

pub unsafe trait RefCounted {
    unsafe fn addref(&self);
    unsafe fn release(&self);
}

unsafe impl RefCounted for Promise {
    unsafe fn addref(&self) {
        ffi::DomPromise_AddRef(self)
    }
    unsafe fn release(&self) {
        ffi::DomPromise_Release(self)
    }
}

fn main() {}