about summary refs log tree commit diff
path: root/tests/ui/delegation/fn-header.rs
blob: 608aef8d9683b8e19723cc99413631f3dbec7f82 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//@ check-pass
//@ edition:2018
//@ aux-crate:fn_header_aux=fn-header-aux.rs
//@ ignore-backends: gcc

#![feature(c_variadic)]
#![feature(fn_delegation)]
#![allow(incomplete_features)]
#![deny(unused_unsafe)]

mod to_reuse {
    pub unsafe fn unsafe_fn() {}
    pub extern "C" fn extern_fn() {}
    pub const fn const_fn() {}
    pub async fn async_fn() {}
}

reuse to_reuse::unsafe_fn;
reuse to_reuse::extern_fn;
reuse to_reuse::const_fn;
reuse to_reuse::async_fn;

reuse fn_header_aux::unsafe_fn_extern;
reuse fn_header_aux::extern_fn_extern;
reuse fn_header_aux::const_fn_extern;
reuse fn_header_aux::async_fn_extern;

const fn const_check() {
    const_fn();
    const_fn_extern();
}

async fn async_check() {
    async_fn().await;
    async_fn_extern().await;
}

fn main() {
    unsafe {
        unsafe_fn();
        unsafe_fn_extern();
    }
    extern_fn();
    extern_fn_extern();
    let _: extern "C" fn() = extern_fn;
    let _: extern "C" fn() = extern_fn_extern;
}