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

Rollup of 6 pull requests #103472

Closed
wants to merge 15 commits into from
Closed

Commits on Jul 21, 2022

  1. Remove redundant lifetime bound from impl Borrow for Cow

    The lifetime bound `B::Owned: 'a` is redundant and doesn't make a difference,
    because `Cow<'a, B>` comes with an implicit `B: 'a`, and associated types
    will outlive lifetimes outlived by the `Self` type (and all the trait's
    generic parameters, of which there are none in this case), so the implicit `B: 'a`
    implies `B::Owned: 'a` anyway.
    
    The explicit lifetime bound here does however end up in documentation,
    and that's confusing in my opinion, so let's remove it ^^
    steffahn committed Jul 21, 2022
    Configuration menu
    Copy the full SHA
    c03d10c View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2022

  1. Sort tests at compile time, not at startup

    Recently, another Miri user was trying to run `cargo miri test` on the
    crate `iced-x86` with `--features=code_asm,mvex`. This configuration has
    a startup time of ~18 minutes. That's ~18 minutes before any tests even
    start to run. The fact that this crate has over 26,000 tests and Miri is
    slow makes a lot of code which is otherwise a bit sloppy but fine into a
    huge runtime issue.
    
    Sorting the tests when the test harness is created instead of at startup
    time knocks just under 4 minutes out of those ~18 minutes. I have ways
    to remove most of the rest of the startup time, but this change requires
    coordinating changes of both the compiler and libtest, so I'm sending it
    separately.
    saethlin committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    df6221a View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2022

  1. Stabilize duration_checked_float

    Tracking issue:
    
    - rust-lang#83400
    lopopolo committed Oct 15, 2022
    Configuration menu
    Copy the full SHA
    95040a7 View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2022

  1. Truncate thread names on Linux and Apple targets

    These targets have system limits on the thread names, 16 and 64 bytes
    respectively, and `pthread_setname_np` returns an error if the name is
    longer. However, we're not in a context that can propagate errors when
    we call this, and we used to implicitly truncate on Linux with `prctl`,
    so now we manually truncate these names ahead of time.
    cuviper committed Oct 22, 2022
    Configuration menu
    Copy the full SHA
    7280f3d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    12e4584 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    988e75b View commit details
    Browse the repository at this point in the history
  4. Bless tests

    fee1-dead committed Oct 22, 2022
    Configuration menu
    Copy the full SHA
    b614b0e View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2022

  1. Configuration menu
    Copy the full SHA
    15cfeb3 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2022

  1. Configuration menu
    Copy the full SHA
    f53b322 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#95710 - fee1-dead-contrib:stabilize_arbitra…

    …ry_enum_discriminant, r=joshtriplett
    
    Stabilize arbitrary_enum_discriminant, take 2
    
    Documentation has been updated in rust-lang/reference#1055. cc rust-lang#86860 for previous stabilization report.
    
    Not yet marks rust-lang#60553 as done: need documentation in the rust reference.
    Dylan-DPC committed Oct 24, 2022
    Configuration menu
    Copy the full SHA
    152a966 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#99578 - steffahn:remove_redundant_bound, r=…

    …thomcc
    
    Remove redundant lifetime bound from `impl Borrow for Cow`
    
    The lifetime bound `B::Owned: 'a` is redundant and doesn't make a difference,
    because `Cow<'a, B>` comes with an implicit `B: 'a`, and associated types
    will outlive lifetimes outlived by the `Self` type (and all the trait's
    generic parameters, of which there are none in this case), so the implicit `B: 'a`
    implies `B::Owned: 'a` anyway.
    
    The explicit lifetime bound here does however [end up in documentation](https://doc.rust-lang.org/std/borrow/enum.Cow.html#impl-Borrow%3CB%3E),
    and that's confusing in my opinion, so let's remove it ^^
    
    _(Documentation right now, compare to `AsRef`, too:)_
    ![Screenshot_20220722_014055](https://user-images.githubusercontent.com/3986214/180332665-424d0c05-afb3-40d8-a330-a57a2c9a494b.png)
    Dylan-DPC committed Oct 24, 2022
    Configuration menu
    Copy the full SHA
    8b85815 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#99939 - saethlin:pre-sort-tests, r=thomcc,j…

    …ackh726
    
    Sort tests at compile time, not at startup
    
    Recently, another Miri user was trying to run `cargo miri test` on the crate `iced-x86` with `--features=code_asm,mvex`. This configuration has a startup time of ~18 minutes. That's ~18 minutes before any tests even start to run. The fact that this crate has over 26,000 tests and Miri is slow makes a lot of code which is otherwise a bit sloppy but fine into a huge runtime issue.
    
    Sorting the tests when the test harness is created instead of at startup time knocks just under 4 minutes out of those ~18 minutes. I have ways to remove most of the rest of the startup time, but this change requires coordinating changes of both the compiler and libtest, so I'm sending it separately.
    
    (except for doctests, because there is no compile-time harness)
    Dylan-DPC committed Oct 24, 2022
    Configuration menu
    Copy the full SHA
    5b72ec8 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#102271 - lopopolo:lopopolo/stabilize-durati…

    …on-try-from-secs-float, r=dtolnay
    
    Stabilize `duration_checked_float`
    
    ## Stabilization Report
    
    This stabilization report is for a stabilization of `duration_checked_float`, tracking issue: rust-lang#83400.
    
    ### Implementation History
    
    - rust-lang#82179
    - rust-lang#90247
    - rust-lang#96051
    - Changed error type to `FromFloatSecsError` in rust-lang#90247
    - rust-lang#96051 changes the rounding mode to round-to-nearest instead of truncate.
    
    ## API Summary
    
    This stabilization report proposes the following API to be stabilized in `core`, along with their re-exports in `std`:
    
    ```rust
    // core::time
    
    impl Duration {
        pub const fn try_from_secs_f32(secs: f32) -> Result<Duration, TryFromFloatSecsError>;
        pub const fn try_from_secs_f64(secs: f64) -> Result<Duration, TryFromFloatSecsError>;
    }
    
    #[derive(Debug, Clone, PartialEq, Eq)]
    pub struct TryFromFloatSecsError { ... }
    
    impl core::fmt::Display for TryFromFloatSecsError { ... }
    impl core::error::Error for TryFromFloatSecsError { ... }
    ```
    
    These functions are made const unstable under `duration_consts_float`, tracking issue rust-lang#72440.
    
    There is an open question in the tracking issue around what the error type should be called which I was hoping to resolve in the context of an FCP.
    
    In this stabilization PR, I have altered the name of the error type to `TryFromFloatSecsError`. In my opinion, the error type shares the name of the method (adjusted to accommodate both types of floats), which is consistent with other error types in `core`, `alloc` and `std` like `TryReserveError` and `TryFromIntError`.
    
    ## Experience Report
    
    Code such as this is ready to be converted to a checked API to ensure it is panic free:
    
    ```rust
    impl Time {
        pub fn checked_add_f64(&self, seconds: f64) -> Result<Self, TimeError> {
            // Fail safely during `f64` conversion to duration
            if seconds.is_nan() || seconds.is_infinite() {
                return Err(TzOutOfRangeError::new().into());
            }
    
            if seconds.is_sign_positive() {
                self.checked_add(Duration::from_secs_f64(seconds))
            } else {
                self.checked_sub(Duration::from_secs_f64(-seconds))
            }
        }
    }
    ```
    
    See: artichoke/artichoke#2194.
    
    ``@rustbot`` label +T-libs-api -T-libs
    
    cc ``@mbartlett21``
    Dylan-DPC committed Oct 24, 2022
    Configuration menu
    Copy the full SHA
    89d2387 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#103379 - cuviper:truncate-thread-name, r=th…

    …omcc
    
    Truncate thread names on Linux and Apple targets
    
    These targets have system limits on the thread names, 16 and 64 bytes
    respectively, and `pthread_setname_np` returns an error if the name is
    longer. However, we're not in a context that can propagate errors when
    we call this, and we used to implicitly truncate on Linux with `prctl`,
    so now we manually truncate these names ahead of time.
    
    r? ``@thomcc``
    Dylan-DPC committed Oct 24, 2022
    Configuration menu
    Copy the full SHA
    a3618d4 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#103466 - jruderman:patch-2, r=Dylan-DPC

    Fix grammar in docs for std::io::Read
    
    Two independent clauses were incorrectly joined by a bare comma. The simplest fix would be to switch to a semicolon, but I think it's slightly better to keep the comma and use the coordinating conjunction "so".
    Dylan-DPC committed Oct 24, 2022
    Configuration menu
    Copy the full SHA
    9968ed8 View commit details
    Browse the repository at this point in the history