1. 11 7月, 2015 1 次提交
    • A
      trans: Use LLVM's writeArchive to modify archives · 4a824275
      Alex Crichton 提交于
      We have previously always relied upon an external tool, `ar`, to modify archives
      that the compiler produces (staticlibs, rlibs, etc). This approach, however, has
      a number of downsides:
      
      * Spawning a process is relatively expensive for small compilations
      * Encoding arguments across process boundaries often incurs unnecessary overhead
        or lossiness. For example `ar` has a tough time dealing with files that have
        the same name in archives, and the compiler copies many files around to ensure
        they can be passed to `ar` in a reasonable fashion.
      * Most `ar` programs found do **not** have the ability to target arbitrary
        platforms, so this is an extra tool which needs to be found/specified when
        cross compiling.
      
      The LLVM project has had a tool called `llvm-ar` for quite some time now, but it
      wasn't available in the standard LLVM libraries (it was just a standalone
      program). Recently, however, in LLVM 3.7, this functionality has been moved to a
      library and is now accessible by consumers of LLVM via the `writeArchive`
      function.
      
      This commit migrates our archive bindings to no longer invoke `ar` by default
      but instead make a library call to LLVM to do various operations. This solves
      all of the downsides listed above:
      
      * Archive management is now much faster, for example creating a "hello world"
        staticlib is now 6x faster (50ms => 8ms). Linking dynamic libraries also
        recently started requiring modification of rlibs, and linking a hello world
        dynamic library is now 2x faster.
      * The compiler is now one step closer to "hassle free" cross compilation because
        no external tool is needed for managing archives, LLVM does the right thing!
      
      This commit does not remove support for calling a system `ar` utility currently.
      We will continue to maintain compatibility with LLVM 3.5 and 3.6 looking forward
      (so the system LLVM can be used wherever possible), and in these cases we must
      shell out to a system utility. All nightly builds of Rust, however, will stop
      needing a system `ar`.
      4a824275
  2. 02 7月, 2015 1 次提交
  3. 28 6月, 2015 1 次提交
    • J
      Begin refactor type checking state · 79d02895
      Jared Roesch 提交于
      This first patch starts by moving around pieces of state related to
      type checking. The goal is to slowly unify the type checking state
      into a single typing context. This initial patch moves the
      ParameterEnvironment into the InferCtxt and moves shared tables
      from Inherited and ty::ctxt into their own struct Tables. This
      is the foundational work to refactoring the type checker to
      enable future evolution of the language and tooling.
      79d02895
  4. 19 6月, 2015 1 次提交
  5. 18 6月, 2015 5 次提交
  6. 10 6月, 2015 1 次提交
  7. 29 5月, 2015 1 次提交
  8. 27 5月, 2015 1 次提交
  9. 19 5月, 2015 1 次提交
  10. 16 5月, 2015 1 次提交
  11. 14 5月, 2015 1 次提交
    • A
      std: Redesign Duration, implementing RFC 1040 · 556e76bb
      Alex Crichton 提交于
      This commit is an implementation of [RFC 1040][rfc] which is a redesign of the
      currently-unstable `Duration` type. The API of the type has been scaled back to
      be more conservative and it also no longer supports negative durations.
      
      [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1040-duration-reform.md
      
      The inner `duration` module of the `time` module has now been hidden (as
      `Duration` is reexported) and the feature name for this type has changed from
      `std_misc` to `duration`. All APIs accepting durations have also been audited to
      take a more flavorful feature name instead of `std_misc`.
      
      Closes #24874
      556e76bb
  12. 06 5月, 2015 1 次提交
    • A
      rustc: Fix more verbatim paths leaking to gcc · 2dc0e561
      Alex Crichton 提交于
      Turns out that a verbatim path was leaking through to gcc via the PATH
      environment variable (pointing to the bundled gcc provided by the main
      distribution) which was wreaking havoc when gcc itself was run. The fix here is
      to just stop passing verbatim paths down by adding more liberal uses of
      `fix_windows_verbatim_for_gcc`.
      
      Closes #25072
      2dc0e561
  13. 30 4月, 2015 1 次提交
  14. 29 4月, 2015 2 次提交
  15. 28 4月, 2015 1 次提交
    • A
      std: Expand the area of std::fs · 93487000
      Alex Crichton 提交于
      This commit is an implementation of [RFC 1044][rfc] which adds additional
      surface area to the `std::fs` module. All new APIs are `#[unstable]` behind
      assorted feature names for each one.
      
      [rfc]: https://github.com/rust-lang/rfcs/pull/1044
      
      The new APIs added are:
      
      * `fs::canonicalize` - bindings to `realpath` on unix and
        `GetFinalPathNameByHandle` on windows.
      * `fs::symlink_metadata` - similar to `lstat` on unix
      * `fs::FileType` and accessor methods as `is_{file,dir,symlink}`
      * `fs::Metadata::file_type` - accessor for the raw file type
      * `fs::DirEntry::metadata` - acquisition of metadata which is free on Windows
        but requires a syscall on unix.
      * `fs::DirEntry::file_type` - access the file type which may not require a
        syscall on most platforms.
      * `fs::DirEntry::file_name` - access just the file name without leading
        components.
      * `fs::PathExt::symlink_metadata` - convenience method for the top-level
        function.
      * `fs::PathExt::canonicalize` - convenience method for the top-level
        function.
      * `fs::PathExt::read_link` - convenience method for the top-level
        function.
      * `fs::PathExt::read_dir` - convenience method for the top-level
        function.
      * `std::os::raw` - type definitions for raw OS/C types available on all
        platforms.
      * `std::os::$platform` - new modules have been added for all currently supported
        platforms (e.g. those more specific than just `unix`).
      * `std::os::$platform::raw` - platform-specific type definitions. These modules
        are populated with the bare essentials necessary for lowing I/O types into
        their raw representations, and currently largely consist of the `stat`
        definition for unix platforms.
      
      This commit also deprecates `Metadata::{modified, accessed}` in favor of
      inspecting the raw representations via the lowering methods of `Metadata`.
      93487000
  16. 22 4月, 2015 2 次提交
    • K
      implement rfc 1054: split_whitespace() fn, deprecate words() · c361e13d
      kwantam 提交于
      For now, words() is left in (but deprecated), and Words is a type alias for
      struct SplitWhitespace.
      
      Also cleaned up references to s.words() throughout codebase.
      
      Closes #15628
      c361e13d
    • A
      std: Remove deprecated/unstable num functionality · eeb94886
      Alex Crichton 提交于
      This commit removes all the old casting/generic traits from `std::num` that are
      no longer in use by the standard library. This additionally removes the old
      `strconv` module which has not seen much use in quite a long time. All generic
      functionality has been supplanted with traits in the `num` crate and the
      `strconv` module is supplanted with the [rust-strconv crate][rust-strconv].
      
      [rust-strconv]: https://github.com/lifthrasiir/rust-strconv
      
      This is a breaking change due to the removal of these deprecated crates, and the
      alternative crates are listed above.
      
      [breaking-change]
      eeb94886
  17. 18 4月, 2015 1 次提交
    • N
      Rather than storing the relations between free-regions in a global · 6dfeda7d
      Niko Matsakis 提交于
      table, introduce a `FreeRegionMap` data structure. regionck computes the
      `FreeRegionMap` for each fn and stores the result into the tcx so that
      borrowck can use it (this could perhaps be refactored to have borrowck
      recompute the map, but it's a bid tedious to recompute due to the
      interaction of closures and free fns). The main reason to do this is
      because of #22779 -- using a global table was incorrect because when
      validating impl method signatures, we want to use the free region
      relationships from the *trait*, not the impl.
      
      Fixes #22779.
      6dfeda7d
  18. 17 4月, 2015 3 次提交
  19. 01 4月, 2015 2 次提交
    • A
      Test fixes and rebase conflicts, round 2 · 30532884
      Alex Crichton 提交于
      30532884
    • A
      Stabilize `std::convert` and related code · 9fc51efe
      Aaron Turon 提交于
      * Marks `#[stable]` the contents of the `std::convert` module.
      
      * Added methods `PathBuf::as_path`, `OsString::as_os_str`,
        `String::as_str`, `Vec::{as_slice, as_mut_slice}`.
      
      * Deprecates `OsStr::from_str` in favor of a new, stable, and more
        general `OsStr::new`.
      
      * Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes,
        to_cstring}` for ergonomic FFI usage.
      
      [breaking-change]
      9fc51efe
  20. 31 3月, 2015 2 次提交
  21. 28 3月, 2015 3 次提交
  22. 27 3月, 2015 3 次提交
  23. 25 3月, 2015 2 次提交
    • N
      Change lint names to plurals · e7122a5a
      Nick Cameron 提交于
      e7122a5a
    • N
      Add trivial cast lints. · 95602a75
      Nick Cameron 提交于
      This permits all coercions to be performed in casts, but adds lints to warn in those cases.
      
      Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference.
      
      [breaking change]
      
      * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed.
      * The unused casts lint has gone.
      * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are:
      - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_`
      - Casts do not influence inference of integer types. E.g., the following used to type check:
      
      ```
      let x = 42;
      let y = &x as *const u32;
      ```
      
      Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information:
      
      ```
      let x: u32 = 42;
      let y = &x as *const u32;
      ```
      95602a75
  24. 24 3月, 2015 1 次提交
    • A
      Add generic conversion traits · 8389253d
      Aaron Turon 提交于
      This commit:
      
      * Introduces `std::convert`, providing an implementation of
      RFC 529.
      
      * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all
      in favor of the corresponding generic conversion traits.
      
        Consequently, various IO APIs now take `AsRef<Path>` rather than
      `AsPath`, and so on. Since the types provided by `std` implement both
      traits, this should cause relatively little breakage.
      
      * Deprecates many `from_foo` constructors in favor of `from`.
      
      * Changes `PathBuf::new` to take no argument (creating an empty buffer,
        as per convention). The previous behavior is now available as
        `PathBuf::from`.
      
      * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait.
      
      Closes #22751
      Closes #14433
      
      [breaking-change]
      8389253d
  25. 18 3月, 2015 1 次提交
    • A
      std: Tweak some unstable features of `str` · aa88da63
      Alex Crichton 提交于
      This commit clarifies some of the unstable features in the `str` module by
      moving them out of the blanket `core` and `collections` features.
      
      The following methods were moved to the `str_char` feature which generally
      encompasses decoding specific characters from a `str` and dealing with the
      result. It is unclear if any of these methods need to be stabilized for 1.0 and
      the most conservative route for now is to continue providing them but to leave
      them as unstable under a more specific name.
      
      * `is_char_boundary`
      * `char_at`
      * `char_range_at`
      * `char_at_reverse`
      * `char_range_at_reverse`
      * `slice_shift_char`
      
      The following methods were moved into the generic `unicode` feature as they are
      specifically enabled by the `unicode` crate itself.
      
      * `nfd_chars`
      * `nfkd_chars`
      * `nfc_chars`
      * `graphemes`
      * `grapheme_indices`
      * `width`
      aa88da63