diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/tools/rustfmt/tests/source/extern.rs | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/tools/rustfmt/tests/source/extern.rs | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/source/extern.rs b/src/tools/rustfmt/tests/source/extern.rs new file mode 100644 index 000000000..f51ba6e98 --- /dev/null +++ b/src/tools/rustfmt/tests/source/extern.rs @@ -0,0 +1,92 @@ +// rustfmt-normalize_comments: true + + extern crate foo ; + extern crate foo as bar ; + +extern crate futures; +extern crate dotenv; +extern crate chrono; + +extern crate foo; +extern crate bar; + +// #2315 +extern crate proc_macro2; +extern crate proc_macro; + +// #3128 +extern crate serde; // 1.0.78 +extern crate serde_derive; // 1.0.78 +extern crate serde_json; // 1.0.27 + + extern "C" { + fn c_func(x: *mut *mut libc::c_void); + + fn c_func(x: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, y: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY); + + #[test123] + fn foo() -> uint64_t; + +pub fn bar() ; + } + +extern { + fn DMR_GetDevice(pHDev: *mut HDEV, searchMode: DeviceSearchMode, pSearchString: *const c_char, devNr: c_uint, wildcard: c_char) -> TDMR_ERROR; + + fn quux() -> (); // Post comment + + pub type + Foo; + + type Bar; +} + +extern "Rust" { static ext: u32; + // Some comment. + pub static mut var : SomeType ; } + +extern "C" { + fn syscall(number: libc::c_long /* comment 1 */, /* comm 2 */ ... /* sup? */) -> libc::c_long; + + fn foo (x: *const c_char , ... ) -> +libc::c_long; + } + + extern { + pub fn freopen(filename: *const c_char, mode: *const c_char + , mode2: *const c_char + , mode3: *const c_char, + file: *mut FILE) + -> *mut FILE; + + + const fn foo( + + ) -> + *mut Bar; + unsafe fn foo( + + ) -> * + mut + Bar; + + pub(super) const fn foo() -> *mut Bar; + pub(crate) unsafe fn foo() -> *mut Bar; + } + +extern { + +} + +macro_rules! x { + ($tt:tt) => {}; +} + +extern "macros" { + x!(ident); + x!(#); + x![ident]; + x![#]; + x! {ident} + x! {#} +} |