Skip to content

Commit b65043d

Browse files
committed
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: rust-lang/rust#31551
1 parent 9b87ef1 commit b65043d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/file.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use self::fields as f;
1515
/// Constant table copied from https://doc.rust-lang.org/src/std/sys/unix/ext/fs.rs.html#11-259
1616
/// which is currently unstable and lacks vision for stabilization,
1717
/// see https://github.com/rust-lang/rust/issues/27712
18-
#[allow(dead_code)]
18+
#[allow(dead_code, non_camel_case_types)]
1919
mod modes {
20-
use libc::mode_t;
20+
pub type mode_t = u32;
2121

2222
pub const USER_READ: mode_t = 0o400;
2323
pub const USER_WRITE: mode_t = 0o200;
@@ -415,8 +415,14 @@ fn ext(path: &Path) -> Option<String> {
415415
/// return raw numbers representing timestamps or user IDs. Instead, they will
416416
/// return an object in this `fields` module. These objects are later rendered
417417
/// into formatted strings in the `output/details` module.
418+
#[allow(non_camel_case_types)]
418419
pub mod fields {
419-
use libc::{blkcnt_t, gid_t, ino_t, nlink_t, time_t, uid_t};
420+
pub type blkcnt_t = u64;
421+
pub type gid_t = u32;
422+
pub type ino_t = u64;
423+
pub type nlink_t = u64;
424+
pub type time_t = i64;
425+
pub type uid_t = u32;
420426

421427
pub enum Type {
422428
File, Directory, Pipe, Link, Special,

0 commit comments

Comments
 (0)