Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std: Deprecate all std::os::*::raw types #31551

Merged
merged 1 commit into from
Feb 14, 2016

Commits on Feb 13, 2016

  1. std: Deprecate all std::os::*::raw types

    This commit is an implementation of [RFC 1415][rfc] which deprecates all types
    in the `std::os::*::raw` modules.
    
    [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1415-trim-std-os.md
    
    Many of the types in these modules don't actually have a canonical platform
    representation, for example the definition of `stat` on 32-bit Linux will change
    depending on whether C code is compiled with LFS support or not. Unfortunately
    the current types in `std::os::*::raw` are billed as "compatible with C", which
    in light of this means it isn't really possible.
    
    To make matters worse, platforms like Android sometimes define these types as
    *smaller* than the way they're actually represented in the `stat` structure
    itself. This means that when methods like `DirEntry::ino` are called on Android
    the result may be truncated as we're tied to returning a `ino_t` type, not the
    underlying type.
    
    The commit here incorporates two backwards-compatible components:
    
    * Deprecate all `raw` types that aren't in `std::os::raw`
    * Expand the `std::os::*::fs::MetadataExt` trait on all platforms for method
      accessors of all fields. The fields now returned widened types which are the
      same across platforms (consistency across platforms is not required, however,
      it's just convenient).
    
    and two also backwards-incompatible components:
    
    * Change the definition of all `std::os::*::raw` type aliases to
      correspond to the newly widened types that are being returned on each
      platform.
    * Change the definition of `std::os::*::raw::stat` on Linux to match the LFS
      definitions rather than the standard ones.
    
    The breaking changes here will specifically break code that assumes that `libc`
    and `std` agree on the definition of `std::os::*::raw` types, or that the `std`
    types are faithful representations of the types in C. An [audit] has been
    performed of crates.io to determine the fallout which was determined two be
    minimal, with the two found cases of breakage having been fixed now.
    
    [audit]: rust-lang/rfcs#1415 (comment)
    
    ---
    
    Ok, so after all that, we're finally able to support LFS on Linux! This commit
    then simultaneously starts using `stat64` and friends on Linux to ensure that we
    can open >4GB files on 32-bit Linux. Yay!
    
    Closes rust-lang#28978
    Closes rust-lang#30050
    Closes rust-lang#31549
    alexcrichton committed Feb 13, 2016
    Configuration menu
    Copy the full SHA
    aa23c98 View commit details
    Browse the repository at this point in the history