fsext.rs: use type inference fsid_t / __fsid_t #7469
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit 2a0d58d (part of #3396 which contains a description of the changes) changed this line from libc::fsid_t to nix::sys::statfs::fsid_t. The pull-request description at #3396 indicates that this was done in order to fix the android build, and indeed using a cast to nix::sys::statfs::fsid_t takes advantage of the definition of nix::sys::statfs::fsid_t which abstracts away the different name on Android:
This cast works as long as the libc version used by nix is the same than the libc version used by coreutils.
This cast becomes invalid when using a local libc version for local debugging, and changing Cargo.toml to point to it:
The cast becomes invalid because self.f_fsid is of type libc::fsid_t (local version of libc), whereas nix::sys::statfs::fsid_t still uses the libc version downloaded by cargo from crates.io in this case.
I was getting this error:
Let's rather use type inference to deal with libc::fsid_t vs libc::__fsid_t.