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
This commit is contained in:
Benjamin Sago 2016-04-16 17:06:26 +01:00
parent 9b87ef1da2
commit b65043d6d9

View File

@ -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,