]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/source/extern.rs
Rollup merge of #100804 - GuillaumeGomez:search-results-color-ayu, r=notriddle
[rust.git] / src / tools / rustfmt / tests / source / extern.rs
1 // rustfmt-normalize_comments: true
2
3  extern crate       foo    ;   
4     extern crate       foo       as bar    ;   
5
6 extern crate futures;
7 extern crate dotenv;
8 extern crate chrono;
9
10 extern crate foo;
11 extern crate bar;
12
13 // #2315
14 extern crate proc_macro2;
15 extern crate proc_macro;
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(x: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, y: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY);
26
27     #[test123]
28     fn foo() -> uint64_t;
29
30 pub fn bar() ;
31    }
32
33 extern {
34         fn DMR_GetDevice(pHDev: *mut HDEV, searchMode: DeviceSearchMode, pSearchString: *const c_char, devNr: c_uint, wildcard: c_char) -> TDMR_ERROR;
35         
36     fn quux() -> (); // Post comment
37
38   pub      type
39       Foo;
40
41           type   Bar;
42 }
43
44 extern "Rust" { static ext:  u32;
45     // Some comment.
46      pub static  mut var : SomeType ; }
47
48 extern "C" {
49             fn syscall(number: libc::c_long /* comment 1 */, /* comm 2 */ ... /* sup? */) -> libc::c_long;
50
51     fn  foo  (x:  *const c_char ,    ...   ) ->
52 libc::c_long;
53         }
54
55    extern    {  
56                        pub fn freopen(filename: *const c_char, mode: *const c_char
57                                , mode2: *const c_char
58                                , mode3: *const c_char,
59                                file: *mut FILE)
60                               -> *mut FILE;
61
62
63        const fn foo(
64
65        ) ->
66                             *mut Bar;
67        unsafe fn foo(
68
69        ) -> *
70        mut
71        Bar;
72
73        pub(super) const fn foo() -> *mut Bar;
74        pub(crate) unsafe fn foo() -> *mut Bar;
75    }
76
77 extern {
78
79 }
80
81 macro_rules! x {
82     ($tt:tt) => {};
83 }
84
85 extern "macros" {
86     x!(ident);
87     x!(#);
88     x![ident];
89     x![#];
90     x! {ident}
91     x! {#}
92 }