summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Sago <ogham@bsago.me>2016-04-16 17:06:26 +0100
committerBenjamin Sago <ogham@bsago.me>2016-04-16 17:06:26 +0100
commitb65043d6d9b7bcd8c87ec2a9cf7f6bf826417b47 (patch)
treebdb8ebe099bf5ff2e47ee23b90a7e9d47b76d23a
parent9b87ef1da2231acef985bb08f7bd4a557167b652 (diff)
Update raw libc types for Rust 1.8.0
Fixes #108. MetadataExt now returns direct numeric types rather than platform-specific ones, so we need to adjust the functions that use these to have the new types. I've just aliased the types to specific ones so the rest of the code remains the same (file.rs is the only place that uses this) The RFC that changed this is here: https://github.com/rust-lang/rust/pull/31551
-rw-r--r--src/file.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/file.rs b/src/file.rs
index 6f95ca4..7f7c692 100644
--- a/src/file.rs
+++ b/src/file.rs
@@ -15,9 +15,9 @@ use self::fields as f;
/// Constant table copied from https://doc.rust-lang.org/src/std/sys/unix/ext/fs.rs.html#11-259
/// which is currently unstable and lacks vision for stabilization,
/// see https://github.com/rust-lang/rust/issues/27712
-#[allow(dead_code)]
+#[allow(dead_code, non_camel_case_types)]
mod modes {
- use libc::mode_t;
+ pub type mode_t = u32;
pub const USER_READ: mode_t = 0o400;
pub const USER_WRITE: mode_t = 0o200;
@@ -415,8 +415,14 @@ fn ext(path: &Path) -> Option<String> {
/// return raw numbers representing timestamps or user IDs. Instead, they will
/// return an object in this `fields` module. These objects are later rendered
/// into formatted strings in the `output/details` module.
+#[allow(non_camel_case_types)]
pub mod fields {
- use libc::{blkcnt_t, gid_t, ino_t, nlink_t, time_t, uid_t};
+ pub type blkcnt_t = u64;
+ pub type gid_t = u32;
+ pub type ino_t = u64;
+ pub type nlink_t = u64;
+ pub type time_t = i64;
+ pub type uid_t = u32;
pub enum Type {
File, Directory, Pipe, Link, Special,