]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/target/extern.rs
Add 'src/tools/rustfmt/' from commit '7872306edf2e11a69aaffb9434088fd66b46a863'
[rust.git] / src / tools / rustfmt / tests / target / extern.rs
1 // rustfmt-normalize_comments: true
2
3 extern crate foo;
4 extern crate foo as bar;
5
6 extern crate chrono;
7 extern crate dotenv;
8 extern crate futures;
9
10 extern crate bar;
11 extern crate foo;
12
13 // #2315
14 extern crate proc_macro;
15 extern crate proc_macro2;
16
17 // #3128
18 extern crate serde; // 1.0.78
19 extern crate serde_derive; // 1.0.78
20 extern crate serde_json; // 1.0.27
21
22 extern "C" {
23     fn c_func(x: *mut *mut libc::c_void);
24
25     fn c_func(
26         x: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,
27         y: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY,
28     );
29
30     #[test123]
31     fn foo() -> uint64_t;
32
33     pub fn bar();
34 }
35
36 extern "C" {
37     fn DMR_GetDevice(
38         pHDev: *mut HDEV,
39         searchMode: DeviceSearchMode,
40         pSearchString: *const c_char,
41         devNr: c_uint,
42         wildcard: c_char,
43     ) -> TDMR_ERROR;
44
45     fn quux() -> (); // Post comment
46
47     pub type Foo;
48
49     type Bar;
50 }
51
52 extern "Rust" {
53     static ext: u32;
54     // Some comment.
55     pub static mut var: SomeType;
56 }
57
58 extern "C" {
59     fn syscall(
60         number: libc::c_long, // comment 1
61         // comm 2
62         ... // sup?
63     ) -> libc::c_long;
64
65     fn foo(x: *const c_char, ...) -> libc::c_long;
66 }
67
68 extern "C" {
69     pub fn freopen(
70         filename: *const c_char,
71         mode: *const c_char,
72         mode2: *const c_char,
73         mode3: *const c_char,
74         file: *mut FILE,
75     ) -> *mut FILE;
76
77     const fn foo() -> *mut Bar;
78     unsafe fn foo() -> *mut Bar;
79
80     pub(super) const fn foo() -> *mut Bar;
81     pub(crate) unsafe fn foo() -> *mut Bar;
82 }
83
84 extern "C" {}