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 7 pull requests #74493

Merged
merged 22 commits into from
Jul 19, 2020
Merged

Rollup of 7 pull requests #74493

merged 22 commits into from
Jul 19, 2020

Commits on Jun 26, 2020

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

Commits on Jul 14, 2020

  1. Add core::ready! macro

    yoshuawuyts committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    18be370 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2020

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

Commits on Jul 17, 2020

  1. add test for rust-lang#62878

    lcnr committed Jul 17, 2020
    Configuration menu
    Copy the full SHA
    0bac361 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4fefa2c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2f28d59 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    c45e9c8 View commit details
    Browse the repository at this point in the history

Commits on Jul 18, 2020

  1. Configuration menu
    Copy the full SHA
    6cd164f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    de03a12 View commit details
    Browse the repository at this point in the history
  3. rustc_metadata: Remove some extra diagnostics for legacy plugins

    They are deprecated so doing extra work for error recovery doesn't make sense
    petrochenkov committed Jul 18, 2020
    Configuration menu
    Copy the full SHA
    926ac5a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4044cbc View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0a4217d View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    09240a4 View commit details
    Browse the repository at this point in the history
  7. impl Index<RangeFrom<usize>> for CStr

    1011X authored and dtolnay committed Jul 18, 2020
    Configuration menu
    Copy the full SHA
    f08aae6 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    30b8835 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#70817 - yoshuawuyts:task-ready, r=dtolnay

    Add core::task::ready! macro
    
    This PR adds `ready!` as a top-level macro to `libcore` following the implementation of `futures_core::ready`, tracking issue rust-lang#70922. This macro is commonly used when implementing `Future`, `AsyncRead`, `AsyncWrite` and `Stream`. And being only 5 lines, it seems like a useful and straight forward addition to std.
    
    ## Example
    
    ```rust
    use core::task::{Context, Poll};
    use core::future::Future;
    use core::pin::Pin;
    
    async fn get_num() -> usize {
        42
    }
    
    pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> {
        let mut f = get_num();
        let f = unsafe { Pin::new_unchecked(&mut f) };
    
        let num = ready!(f.poll(cx));
        // ... use num
    
        Poll::Ready(())
    }
    ```
    
    ## Naming
    
    In `async-std` we chose to nest the macro under the `task` module instead of having the macro at the top-level. This is a pattern that currently does not occur in std, mostly due to this not being possible prior to Rust 2018.
    
    This PR proposes to add the `ready` macro as `core::ready`. But another option would be to introduce it as `core::task::ready` since it's really only useful when used in conjunction with `task::{Context, Poll}`.
    
    ## Implementation questions
    
    I tried rendering the documentation locally but the macro didn't show up under `core`. I'm not sure if I quite got this right. I used the [`todo!` macro PR](https://github.com/rust-lang/rust/pull/56348/files) as a reference, and our approaches look similar.
    
    ## References
    
    - [`futures::ready`](https://docs.rs/futures/0.3.4/futures/macro.ready.html)
    - [`async_std::task::ready`](https://docs.rs/async-std/1.5.0/async_std/task/index.html)
    - [`futures_core::ready`](https://docs.rs/futures-core/0.3.4/futures_core/macro.ready.html)
    Manishearth authored Jul 18, 2020
    Configuration menu
    Copy the full SHA
    479c8ad View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#73762 - poliorcetics:trait-keyword, r=KodrAus

    Document the trait keyword
    
    Partial fix of rust-lang#34601.
    
    This document the trait keyword. To avoid doing too much and forcing more updates as functionalities evolve, I put two links to the reference, especially for trait objects. This mainly documents the "big" parts, not so much the small details that might trip someone experimenting.
    
    @rustbot modify labels: T-doc,C-enhancement
    Manishearth authored Jul 18, 2020
    Configuration menu
    Copy the full SHA
    a6266e2 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#74021 - 1011X:master, r=dtolnay

    impl Index<RangeFrom> for CStr
    
    This change implements (partial) slicing for `CStr`.
    
    Since a `CStr` must end in a null byte, it's not possible to trim from the right and still have a valid `CStr`. But, it *is* possible to trim from the left. This lets us be a bit more flexible and treat them more like strings.
    
    ```rust
    let string = CStr::from_bytes_with_nul(b"Hello World!\0");
    let result = CStr::from_bytes_with_nul(b"World!\0");
    assert_eq!(&string[6..], result);
    ```
    Manishearth authored Jul 18, 2020
    Configuration menu
    Copy the full SHA
    f305b20 View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#74071 - petrochenkov:cload3, r=matthewjasper

    rustc_metadata: Make crate loading fully speculative
    
    Instead of reporting `span_err`s on the spot crate loading errors are now wrapped into the `CrateError` enum and returned, so they are reported only at the top level `resolve_crate` call, and not reported at all if we are resolving speculatively with `maybe_resolve_crate`.
    
    As a result we can attempt loading crates for error recovery (e.g. import suggestions) without any risk of producing extra errors.
    Also, this means better separation between error reporting and actual logic.
    
    Fixes rust-lang#55103
    Fixes rust-lang#56590
    Manishearth authored Jul 18, 2020
    Configuration menu
    Copy the full SHA
    43ba840 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#74445 - lcnr:const-generic-ty-decl, r=Dylan…

    …-DPC
    
    add test for rust-lang#62878
    
    forgot to push this as part of rust-lang#74159
    
    r? @Dylan-DPC
    Manishearth authored Jul 18, 2020
    Configuration menu
    Copy the full SHA
    1a54b61 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#74459 - canova:const-unreachable-unchecked,…

    … r=oli-obk
    
    Make unreachable_unchecked a const fn
    
    This PR makes `std::hint::unreachable_unchecked` a const fn so we can use it inside a const function.
    r? @RalfJung
    Fixes rust-lang#53188.
    Manishearth authored Jul 18, 2020
    Configuration menu
    Copy the full SHA
    2fad396 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#74478 - rust-lang:revert-74416-linker-local…

    …e-utf8, r=Mark-Simulacrum
    
    Revert "Use an UTF-8 locale for the linker."
    
    Reverts rust-lang#74416
    
    This is suspected to have caused significant compile time regressions: https://perf.rust-lang.org/compare.html?start=39d5a61f2e4e237123837f5162cc275c2fd7e625&end=d3df8512d2c2afc6d2e7d8b5b951dd7f2ad77b02&stat=instructions:u
    Manishearth authored Jul 18, 2020
    Configuration menu
    Copy the full SHA
    a83e294 View commit details
    Browse the repository at this point in the history