Skip to content

Cargo install of exa fails for Rust 1.8.0 #108

@kecors

Description

@kecors

On my 64 bit Arch Linux machine I tried to use cargo to install exa, and got the following error:

$ cargo install --git https://github.com/ogham/exa
   Updating git repository `https://github.com/ogham/exa`
   Compiling exa v0.4.0 (https://github.com/ogham/exa#9b87ef1d)
.multirust/toolchains/stable/cargo/git/checkouts/exa-243d74bb3bec7b92/master/src/file.rs:226:29: 226:51 error: mismatched types:
 expected `i64`,
    found `u64` [E0308]
.multirust/toolchains/stable/cargo/git/checkouts/exa-243d74bb3bec7b92/master/src/file.rs:226             f::Blocks::Some(self.metadata.blocks())
                                                                                                                         ^~~~~~~~~~~~~~~~~~~~~~
.multirust/toolchains/stable/cargo/git/checkouts/exa-243d74bb3bec7b92/master/src/file.rs:226:29: 226:51 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to previous error
failed to compile `exa v0.4.0 (https://github.com/ogham/exa#9b87ef1d)`, intermediate artifacts can be found at `/home/kecors/target-install`

Caused by:
  Could not compile `exa`.

To learn more, run the command again with --verbose.

The release notes for 1.8.0 indicate that MetadataExt was changed and no longer returns platform specific types. In particular:

impl MetadataExt for Metadata1.1.0
...
fn blocks(&self) -> u64

Here is the code in exa at the point of the error (in file.rs):

    /// This file's number of filesystem blocks.
    ///
    /// (Not the size of each block, which we don't actually report on)
    pub fn blocks(&self) -> f::Blocks {
        if self.is_file() || self.is_link() {
            f::Blocks::Some(self.metadata.blocks())
        }
        else {
            f::Blocks::None
        }
    }

f::Blocks is defined as follows:

pub mod fields {
    use libc::{blkcnt_t, gid_t, ino_t, nlink_t, time_t, uid_t};
...
    pub enum Blocks {
        Some(blkcnt_t),
        None,
    }

Currently in exa, the Blocks enum is used only for display. It appears that this problem could be resolved by changing the Blocks enum to use u64 rather than blkcnt_t from libc.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions