-
-
Save cpu/4280a148aad1619e9b71139b48e6fc8f to your computer and use it in GitHub Desktop.
Broken attempt at fixing the libc style linter for `cfg_if`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs | |
index c1705a94e..e3933b4f1 100644 | |
--- a/src/unix/linux_like/linux/mod.rs | |
+++ b/src/unix/linux_like/linux/mod.rs | |
@@ -3393,25 +3393,28 @@ extern "C" { | |
) -> ::c_int; | |
pub fn fanotify_init(flags: ::c_uint, event_f_flags: ::c_uint) -> ::c_int; | |
- #[cfg(not(target_env = "musl"))] | |
- pub fn fanotify_mark( | |
- fd: ::c_int, | |
- flags: ::c_uint, | |
- mask: u64, | |
- dirfd: ::c_int, | |
- path: *const ::c_char, | |
- ) -> ::c_int; | |
- // Musl targets need the `mask` argument of `fanotify_mark` be specified `::c_ulonglong` | |
- // instead of `u64` or there will be a type mismatch between `long long unsigned int` and the | |
- // expected `uint64_t`. | |
- #[cfg(target_env = "musl")] | |
- pub fn fanotify_mark( | |
- fd: ::c_int, | |
- flags: ::c_uint, | |
- mask: ::c_ulonglong, | |
- dirfd: ::c_int, | |
- path: *const ::c_char, | |
- ) -> ::c_int; | |
+ cfg_if! { | |
+ if #[cfg(not(target_env = "musl"))] { | |
+ pub fn fanotify_mark( | |
+ fd: ::c_int, | |
+ flags: ::c_uint, | |
+ mask: u64, | |
+ dirfd: ::c_int, | |
+ path: *const ::c_char, | |
+ ) -> ::c_int; | |
+ } else if #[cfg(target_env = "musl")] { | |
+ // Musl targets need the `mask` argument of `fanotify_mark` be specified `::c_ulonglong` | |
+ // instead of `u64` or there will be a type mismatch between `long long unsigned int` and the | |
+ // expected `uint64_t`. | |
+ pub fn fanotify_mark( | |
+ fd: ::c_int, | |
+ flags: ::c_uint, | |
+ mask: ::c_ulonglong, | |
+ dirfd: ::c_int, | |
+ path: *const ::c_char, | |
+ ) -> ::c_int; | |
+ } | |
+ } | |
} | |
cfg_if! { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> cargo build | |
Compiling libc v0.2.68 (/home/daniel/Code/libc) | |
error: expected one of `!`, `(`, `+`, `::`, `<`, `where`, or `{`, found `;` | |
--> src/unix/linux_like/linux/mod.rs:3404:25 | |
| | |
3404 | ) -> ::c_int; | |
| ^ expected one of 7 possible tokens | |
error: aborting due to previous error | |
error: could not compile `libc`. | |
To learn more, run the command again with --verbose. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment