1. 16 5月, 2015 1 次提交
  2. 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
  3. 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
  4. 30 4月, 2015 1 次提交
  5. 29 4月, 2015 2 次提交
  6. 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
  7. 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
  8. 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
  9. 17 4月, 2015 3 次提交
  10. 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
  11. 31 3月, 2015 2 次提交
  12. 28 3月, 2015 3 次提交
  13. 27 3月, 2015 3 次提交
  14. 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
  15. 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
  16. 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
  17. 14 3月, 2015 1 次提交
  18. 13 3月, 2015 1 次提交
    • A
      Stabilize std::path · 42c4e481
      Aaron Turon 提交于
      This commit stabilizes essentially all of the new `std::path` API. The
      API itself is changed in a couple of ways (which brings it in closer
      alignment with the RFC):
      
      * `.` components are now normalized away, unless they appear at the
        start of a path. This in turn effects the semantics of e.g. asking for
        the file name of `foo/` or `foo/.`, both of which yield `Some("foo")`
        now. This semantics is what the original RFC specified, and is also
        desirable given early experience rolling out the new API.
      
      * The `parent` function now succeeds if, and only if, the path has at
        least one non-root/prefix component. This change affects `pop` as
        well.
      
      * The `Prefix` component now involves a separate `PrefixComponent`
        struct, to better allow for keeping both parsed and unparsed prefix data.
      
      In addition, the `old_path` module is now deprecated.
      
      Closes #23264
      
      [breaking-change]
      42c4e481
  19. 07 3月, 2015 1 次提交
  20. 06 3月, 2015 3 次提交
    • A
      std: Stabilize the `fs` module · 73b0b25e
      Alex Crichton 提交于
      This commit performs a stabilization pass over the `std::fs` module now that
      it's had some time to bake. The change was largely just adding `#[stable]` tags,
      but there are a few APIs that remain `#[unstable]`.
      
      The following apis are now marked `#[stable]`:
      
      * `std::fs` (the name)
      * `File`
      * `Metadata`
      * `ReadDir`
      * `DirEntry`
      * `OpenOptions`
      * `Permissions`
      * `File::{open, create}`
      * `File::{sync_all, sync_data}`
      * `File::set_len`
      * `File::metadata`
      * Trait implementations for `File` and `&File`
      * `OpenOptions::new`
      * `OpenOptions::{read, write, append, truncate, create}`
      * `OpenOptions::open` - this function was modified, however, to not attempt to
        reject cross-platform openings of directories. This means that some platforms
        will succeed in opening a directory and others will fail.
      * `Metadata::{is_dir, is_file, len, permissions}`
      * `Permissions::{readonly, set_readonly}`
      * `Iterator for ReadDir`
      * `DirEntry::path`
      * `remove_file` - like with `OpenOptions::open`, the extra windows code to
        remove a readonly file has been removed. This means that removing a readonly
        file will succeed on some platforms but fail on others.
      * `metadata`
      * `rename`
      * `copy`
      * `hard_link`
      * `soft_link`
      * `read_link`
      * `create_dir`
      * `create_dir_all`
      * `remove_dir`
      * `remove_dir_all`
      * `read_dir`
      
      The following apis remain `#[unstable]`.
      
      * `WalkDir` and `walk` - there are many methods by which a directory walk can be
        constructed, and it's unclear whether the current semantics are the right
        ones. For example symlinks are not handled super well currently. This is now
        behind a new `fs_walk` feature.
      * `File::path` - this is an extra abstraction which the standard library
        provides on top of what the system offers and it's unclear whether we should
        be doing so. This is now behind a new `file_path` feature.
      * `Metadata::{accessed, modified}` - we do not currently have a good
        abstraction for a moment in time which is what these APIs should likely be
        returning, so these remain `#[unstable]` for now. These are now behind a new
        `fs_time` feature
      * `set_file_times` - like with `Metadata::accessed`, we do not currently have
        the appropriate abstraction for the arguments here so this API remains
        unstable behind the `fs_time` feature gate.
      * `PathExt` - the precise set of methods on this trait may change over time and
        some methods may be removed. This API remains unstable behind the `path_ext`
        feature gate.
      * `set_permissions` - we may wish to expose a more granular ability to set the
        permissions on a file instead of just a blanket "set all permissions" method.
        This function remains behind the `fs` feature.
      
      The following apis are now `#[deprecated]`
      
      * The `TempDir` type is now entirely deprecated and is [located on
        crates.io][tempdir] as the `tempdir` crate with [its source][github] at
        rust-lang/tempdir.
      
      [tempdir]: https://crates.io/crates/tempdir
      [github]: https://github.com/rust-lang/tempdir
      
      The stability of some of these APIs has been questioned over the past few weeks
      in using these APIs, and it is intentional that the majority of APIs here are
      marked `#[stable]`. The `std::fs` module has a lot of room to grow and the
      material is [being tracked in a RFC issue][rfc-issue].
      
      [rfc-issue]: https://github.com/rust-lang/rfcs/issues/939
      
      [breaking-change]
      73b0b25e
    • A
      std: Stabilize the `ffi` module · 628f5d29
      Alex Crichton 提交于
      The two main sub-modules, `c_str` and `os_str`, have now had some time to bake
      in the standard library. This commits performs a sweep over the modules adding
      various stability tags.
      
      The following APIs are now marked `#[stable]`
      
      * `OsString`
      * `OsStr`
      * `OsString::from_string`
      * `OsString::from_str`
      * `OsString::new`
      * `OsString::into_string`
      * `OsString::push` (renamed from `push_os_str`, added an `AsOsStr` bound)
      * various trait implementations for `OsString`
      * `OsStr::from_str`
      * `OsStr::to_str`
      * `OsStr::to_string_lossy`
      * `OsStr::to_os_string`
      * various trait implementations for `OsStr`
      * `CString`
      * `CStr`
      * `NulError`
      * `CString::new` - this API's implementation may change as a result of
        rust-lang/rfcs#912 but the usage of `CString::new(thing)` looks like it is
        unlikely to change. Additionally, the `IntoBytes` bound is also likely to
        change but the set of implementors for the trait will not change (despite the
        trait perhaps being renamed).
      * `CString::from_vec_unchecked`
      * `CString::as_bytes`
      * `CString::as_bytes_with_nul`
      * `NulError::nul_position`
      * `NulError::into_vec`
      * `CStr::from_ptr`
      * `CStr::as_ptr`
      * `CStr::to_bytes`
      * `CStr::to_bytes_with_nul`
      * various trait implementations for `CStr`
      
      The following APIs remain `#[unstable]`
      
      * `OsStr*Ext` traits remain unstable as the organization of `os::platform` is
        uncertain still and the traits may change location.
      * `AsOsStr` remains unstable as generic conversion traits are likely to be
        rethought soon.
      
      The following APIs were deprecated
      
      * `OsString::push_os_str` is now called `push` and takes `T: AsOsStr` instead (a
        superset of the previous functionality).
      628f5d29
    • A
      fix for new attributes failing. issue #22964 · 951ef9d1
      awlnx 提交于
      951ef9d1
  21. 05 3月, 2015 1 次提交
    • A
      std: Deprecate std::old_io::fs · 95d90462
      Alex Crichton 提交于
      This commit deprecates the majority of std::old_io::fs in favor of std::fs and
      its new functionality. Some functions remain non-deprecated but are now behind a
      feature gate called `old_fs`. These functions will be deprecated once
      suitable replacements have been implemented.
      
      The compiler has been migrated to new `std::fs` and `std::path` APIs where
      appropriate as part of this change.
      95d90462
  22. 28 2月, 2015 2 次提交
    • H
      Separate most of rustc::lint::builtin into a separate crate. · 532cd5f8
      Huon Wilson 提交于
      This pulls out the implementations of most built-in lints into a
      separate crate, to reduce edit-compile-test iteration times with
      librustc_lint and increase parallelism. This should enable lints to be
      refactored, added and deleted much more easily as it slashes the
      edit-compile cycle to get a minimal working compiler to test with (`make
      rustc-stage1`) from
      
          librustc -> librustc_typeck -> ... -> librustc_driver ->
              libcore -> ... -> libstd
      
      to
      
          librustc_lint -> librustc_driver -> libcore -> ... libstd
      
      which is significantly faster, mainly due to avoiding the librustc build
      itself.
      
      The intention would be to move as much as possible of the infrastructure
      into the crate too, but the plumbing is deeply intertwined with librustc
      itself at the moment. Also, there are lints for which diagnostics are
      registered directly in the compiler code, not in their own crate
      traversal, and their definitions have to remain in librustc.
      
      This is a [breaking-change] for direct users of the compiler APIs:
      callers of `rustc::session::build_session` or
      `rustc::session::build_session_` need to manually call
      `rustc_lint::register_builtins` on their return value.
      
      This should make #22206 easier.
      532cd5f8
    • A
      std: Stabilize the `env` module · ad148919
      Alex Crichton 提交于
      Now that the `std::env` module has had some time to bake this commit marks most
      of its APIs as `#[stable]`. Some notable APIs that are **not** stable (and still
      use the same `env` feature gate) are:
      
      * `{set,get}_exit_status` - there are still questions about whether this is the
        right interface for setting/getting the exit status of a process.
      * `page_size` - this may change location in the future or perhaps name as well.
      
      This also effectively closes #22122 as the variants of `VarError` are
      `#[stable]` now. (this is done intentionally)
      ad148919
  23. 25 2月, 2015 1 次提交
    • A
      std: Move std::env to the new I/O APIs · 2d200c9c
      Alex Crichton 提交于
      This commit moves `std::env` away from the `std::old_io` error type as well as
      the `std::old_path` module. Methods returning an error now return `io::Error`
      and methods consuming or returning paths use `std::path` instead of
      `std::old_path`. This commit does not yet mark these APIs as `#[stable]`.
      
      This commit also migrates `std::old_io::TempDir` to `std::fs::TempDir` with
      essentially the exact same API. This type was added to interoperate with the new
      path API and has its own `tempdir` feature.
      
      Finally, this commit reverts the deprecation of `std::os` APIs returning the old
      path API types. This deprecation can come back once the entire `std::old_path`
      module is deprecated.
      
      [breaking-change]
      2d200c9c
  24. 18 2月, 2015 1 次提交
    • A
      std: Rename io/path features with old_ prefix · a2ebb24e
      Alex Crichton 提交于
      This commit renames the features for the `std::old_io` and `std::old_path`
      modules to `old_io` and `old_path` to help facilitate migration to the new APIs.
      
      This is a breaking change as crates which mention the old feature names now need
      to be renamed to use the new feature names.
      
      [breaking-change]
      a2ebb24e
  25. 16 2月, 2015 1 次提交
  26. 15 2月, 2015 1 次提交