1. 27 5月, 2015 1 次提交
  2. 16 5月, 2015 1 次提交
  3. 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
  4. 09 5月, 2015 1 次提交
  5. 04 5月, 2015 1 次提交
  6. 02 5月, 2015 1 次提交
    • H
      Run benchmarks once, as a test by default. · d73545ce
      Huon Wilson 提交于
      E.g. if `foo.rs` looks like
      
          #![feature(test)]
          extern crate test;
      
          #[bench]
          fn bar(b: &mut test::Bencher) {
              b.iter(|| {
                  1
              })
          }
      
          #[test]
          fn baz() {}
      
          #[bench]
          fn qux(b: &mut test::Bencher) {
              b.iter(|| {
                  panic!()
              })
          }
      
      Then
      
          $ rustc --test foo.rs
          $ ./foo
      
          running 3 tests
          test baz ... ok
          test qux ... FAILED
          test bar ... ok
      
          failures:
      
          ---- qux stdout ----
          	thread 'qux' panicked at 'explicit panic', bench.rs:17
      
          failures:
              qux
      
          test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured
      
          $ ./foo --bench ba
      
          running 2 tests
          test baz ... ignored
          test bar ... bench:        97 ns/iter (+/- 74)
      
          test result: ok. 0 passed; 0 failed; 1 ignored; 1 measured
      
      In particular, the two benchmark are being run as tests in the default
      mode.
      
      This helps for the main distribution, since benchmarks are only run with
      `PLEASE_BENCH=1`, which is rarely set (and never set on the test bots),
      and helps for code-coverage tools: benchmarks are run and so don't count
      as dead code.
      
      Fixes #15842.
      d73545ce
  7. 22 4月, 2015 1 次提交
    • 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. 21 4月, 2015 1 次提交
  9. 16 4月, 2015 1 次提交
  10. 15 4月, 2015 1 次提交
  11. 02 4月, 2015 3 次提交
  12. 01 4月, 2015 3 次提交
    • N
      c35c4682
    • A
      std: Clean out #[deprecated] APIs · d4a2c941
      Alex Crichton 提交于
      This commit cleans out a large amount of deprecated APIs from the standard
      library and some of the facade crates as well, updating all users in the
      compiler and in tests as it goes along.
      d4a2c941
    • 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
  13. 30 3月, 2015 1 次提交
  14. 28 3月, 2015 2 次提交
  15. 27 3月, 2015 2 次提交
  16. 25 3月, 2015 1 次提交
    • 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
  17. 24 3月, 2015 2 次提交
    • 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
    • B
      df290f12
  18. 20 3月, 2015 2 次提交
  19. 17 3月, 2015 1 次提交
  20. 15 3月, 2015 1 次提交
  21. 14 3月, 2015 2 次提交
  22. 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
  23. 10 3月, 2015 1 次提交
  24. 07 3月, 2015 1 次提交
    • A
      test: Fix an overflow on empty benchmarks · 946a3963
      Alex Crichton 提交于
      Right now the rust upgrade in cargo is blocked on fixing this overflow. If a
      this benchmark is run it will trigger an overflow error today:
      
          #[bench]
          fn foo(b: &mut test::Bencher) {}
      
      This commit adds a check on each iteration of the loop that the maximum
      multiplier (10) doesn't overflow, and if it does just return the results so far.
      946a3963
  25. 06 3月, 2015 2 次提交
    • 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
      fix for new attributes failing. issue #22964 · 951ef9d1
      awlnx 提交于
      951ef9d1
  26. 05 3月, 2015 2 次提交
  27. 04 3月, 2015 1 次提交
  28. 01 3月, 2015 1 次提交
  29. 28 2月, 2015 1 次提交
    • 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