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 17 pull requests #81089

Merged
merged 60 commits into from
Jan 16, 2021
Merged

Rollup of 17 pull requests #81089

merged 60 commits into from
Jan 16, 2021

Commits on Dec 18, 2020

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

Commits on Dec 23, 2020

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

Commits on Jan 4, 2021

  1. TrustedRandomAaccess spec composes incorrectly for nested iter::Zips

    After partially consuming a Zip adapter and then wrapping it into
    another Zip where the adapters use their TrustedRandomAccess specializations
    leads to the outer adapter returning elements which should have already been
    consumed.
    the8472 committed Jan 4, 2021
    Configuration menu
    Copy the full SHA
    af2983a View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2021

  1. Re-stabilize Weak::as_ptr &friends for unsized T

    As per T-lang consensus, this uses a branch to handle the dangling case.
    The discussed optimization of only doing the branch in the T: ?Sized
    case is left for a followup patch, as doing so is not trivial
    (as it requires specialization for correctness, not just optimization).
    CAD97 committed Jan 7, 2021
    Configuration menu
    Copy the full SHA
    6bc772c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f00b458 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b10b9e2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1e578c9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4901c55 View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2021

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

Commits on Jan 10, 2021

  1. Configuration menu
    Copy the full SHA
    5ccef56 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    12f1795 View commit details
    Browse the repository at this point in the history
  3. Update issue-78938-async-block.rs

    Fix whitespace
    sledgehammervampire committed Jan 10, 2021
    Configuration menu
    Copy the full SHA
    2b9c8ff View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9e345a5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    757bd23 View commit details
    Browse the repository at this point in the history

Commits on Jan 11, 2021

  1. Configuration menu
    Copy the full SHA
    b5b6760 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    04b6036 View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2021

  1. Configuration menu
    Copy the full SHA
    3ee3071 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4362da1 View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2021

  1. Configuration menu
    Copy the full SHA
    b2f5048 View commit details
    Browse the repository at this point in the history
  2. Put all feature gate tests under feature-gates/

    There was one directory that had only a single test and there was also a
    test in the top-level directory. This moves both of them to
    `feature-gates/`.
    camelid committed Jan 13, 2021
    Configuration menu
    Copy the full SHA
    c200036 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7f41465 View commit details
    Browse the repository at this point in the history
  4. Bless test output

    sledgehammervampire committed Jan 13, 2021
    Configuration menu
    Copy the full SHA
    f5c4287 View commit details
    Browse the repository at this point in the history
  5. Fix whitespace

    sledgehammervampire committed Jan 13, 2021
    Configuration menu
    Copy the full SHA
    a9ead34 View commit details
    Browse the repository at this point in the history
  6. Apply suggestions from code review

    Co-authored-by: Ralf Jung <[email protected]>
    CAD97 and RalfJung authored Jan 13, 2021
    Configuration menu
    Copy the full SHA
    c14e919 View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2021

  1. Configuration menu
    Copy the full SHA
    174135f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    63deae5 View commit details
    Browse the repository at this point in the history

Commits on Jan 15, 2021

  1. Configuration menu
    Copy the full SHA
    5468d98 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0660b8b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3e9c95b View commit details
    Browse the repository at this point in the history
  4. Use Result and rename to filter_map

    The use of Result allows for making use of a reconstructed original value on failed
    projections.
    udoprog committed Jan 15, 2021
    Configuration menu
    Copy the full SHA
    e8757af View commit details
    Browse the repository at this point in the history
  5. Remove doctree::Import

    CraftSpider committed Jan 15, 2021
    Configuration menu
    Copy the full SHA
    e3274fd View commit details
    Browse the repository at this point in the history
  6. Address nit

    CraftSpider committed Jan 15, 2021
    Configuration menu
    Copy the full SHA
    2a0c9e2 View commit details
    Browse the repository at this point in the history
  7. Fix JSON test

    CraftSpider committed Jan 15, 2021
    Configuration menu
    Copy the full SHA
    e42c1b9 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    31b17f5 View commit details
    Browse the repository at this point in the history
  9. Add a regression test for rust-lang#50041

    AFAICT the test case never landed alongside the fix for the issue.
    nagisa committed Jan 15, 2021
    Configuration menu
    Copy the full SHA
    af0d099 View commit details
    Browse the repository at this point in the history

Commits on Jan 16, 2021

  1. Configuration menu
    Copy the full SHA
    c625b97 View commit details
    Browse the repository at this point in the history
  2. doctest: Reset errors before dropping the parse session

    The first parse is to collect whether the code contains macros, has
    `main`, and uses other crates. In that pass we ignore errors as those
    will be reported when the test file is actually built.
    
    For that we need to reset errors in the `Diagnostic` otherwise when
    dropping it unhandled errors will be reported as compiler bugs.
    
    Fixes rust-lang#80992
    osa1 committed Jan 16, 2021
    Configuration menu
    Copy the full SHA
    eef383f View commit details
    Browse the repository at this point in the history
  3. Add a test

    osa1 committed Jan 16, 2021
    Configuration menu
    Copy the full SHA
    0ef5557 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b681631 View commit details
    Browse the repository at this point in the history
  5. Add a regression test for rust-lang#76281

    This has been fixed between 1.47.0-nightly (663d2f5 2020-08-22) and 1.47.0-nightly (5180f3d 2020-08-23).
    JohnTitor committed Jan 16, 2021
    Configuration menu
    Copy the full SHA
    8797986 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9952632 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    78d9192 View commit details
    Browse the repository at this point in the history
  8. Add test for rust-lang#34792

    bugadani committed Jan 16, 2021
    Configuration menu
    Copy the full SHA
    bdc7ff7 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#78455 - udoprog:refcell-opt-map, r=KodrAus

    Introduce {Ref, RefMut}::try_map for optional projections in RefCell
    
    This fills a usability gap of `RefCell` I've personally encountered to perform optional projections, mostly into collections such as `RefCell<Vec<T>>` or `RefCell<HashMap<U, T>>`:
    
    > This kind of API was briefly featured under Open questions in rust-lang#10514 back in 2013 (!)
    
    ```rust
    let values = RefCell::new(vec![1, 2, 3, 4]);
    let b = Ref::opt_map(values.borrow(), |vec| vec.get(2));
    ```
    
    It primarily avoids this alternative approach to accomplish the same kind of projection which is both rather noisy and panicky:
    ```rust
    let values = RefCell::new(vec![1, 2, 3, 4]);
    
    let b = if values.get(2).is_some() {
        Some(Ref::map(values.borrow(), |vec| vec.get(2).unwrap()))
    } else {
        None
    };
    ```
    
    ### Open questions
    
    The naming `opt_map` is preliminary. I'm not aware of prior art in std to lean on here, but this name should probably be improved if this functionality is desirable.
    
    Since `opt_map` consumes the guard, and alternative syntax might be more appropriate which instead *tries* to perform the projection, allowing the original borrow to be recovered in case it fails:
    
    ```rust
    pub fn try_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Result<Ref<'b, U>, Self>
    where
        F: FnOnce(&T) -> Option<&U>;
    ```
    
    This would be more in line with the `try_map` method [provided by parking lot](https://docs.rs/lock_api/0/lock_api/struct.RwLockWriteGuard.html#method.try_map).
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    6bb06f4 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#80144 - rust-lang:frewsxcv-patch-3, r=nikom…

    …atsakis
    
    Remove giant badge in README
    
    Is it meant to be this big? I haven't seen any other open source project with this sort of thing
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    d2b63d4 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#80614 - 1000teslas:issue-78938-fix, r=tmandry

    Explain why borrows can't be held across yield point in async blocks
    
    For rust-lang#78938.
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    af5b0d9 View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#80670 - the8472:fix-zip-trusted-random-acce…

    …ss-composition, r=m-ou-se
    
    TrustedRandomAaccess specialization composes incorrectly for nested iter::Zips
    
    I found this while working on improvements for TRA.
    
    After partially consuming a Zip adapter and then wrapping it into another Zip where the adapters use their `TrustedRandomAccess` specializations leads to the outer adapter returning elements which should have already been consumed.
    
    If the optimizer gets tripped up by the addition this might affect performance for chained `zip()` iterators even when the inner one is not partially advanced but it would require more extensive fixes to `TrustedRandomAccess` to communicate those offsets earlier.
    
    Included test fails on nightly, [playground link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=24fa1edf8a104ff31f5a24830593b01f)
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    d8843d9 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#80681 - ChrisJefferson:logic-error-doc, r=m…

    …-ou-se
    
    Clarify what the effects of a 'logic error' are
    
    This clarifies what a 'logic error' is (which is a term used to describe what happens if you put things in a hash table or btree and then use something like a refcell to break the internal ordering). This tries to be as vague as possible, as we don't really want to promise what happens, except "bad things, but not UB". This was discussed in rust-lang#80657
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    40d2506 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#80764 - CAD97:weak-unsized-as-ptr-again, r=…

    …RalfJung
    
    Re-stabilize Weak::as_ptr and friends for unsized T
    
    As per [T-lang consensus](https://hackmd.io/7r3_is6uTz-163fsOV8Vfg), this uses a branch to handle the dangling case. The discussed optimization of only doing the branch in the T: ?Sized case is left for a followup patch, as doing so is not trivial (as it requires specialization) and not _obviously_ better (as it requires using `wrapping_offset` rather than `offset` more).
    
    <details><summary>Basically said optimization</summary>
    
    Specialize on `T: Sized`:
    
    ```rust
    fn as_ptr(&self) -> *const T {
        if [ T is Sized ] || !is_dangling(ptr) {
            (ptr as *mut T).set_ptr_value( (ptr as *mut u8).wrapping_offset(data_offset) )
        } else {
            ptr::null()
        }
    }
    
    fn from_raw(*const T) -> Self {
        if [ T is Sized ] || !ptr.is_null() {
            let ptr = (ptr as *mut RcBox).set_ptr_value( (ptr as *mut u8).wrapping_offset(-data_offset) );
            Weak { ptr }
        } else {
            Weak::new()
        }
    }
    ```
    
    (but with more `set_ptr_value` to avoid `Sized` restrictions and maintain metadata.)
    
    Written in this fashion, this is not a correctness-critical specialization (i.e. so long as `[ T is Sized ]` is false for unsized `T`, it can be `rand()` for sized `T` without breaking correctness), but it's still touchy, so I'd rather do it in another PR with separate review.
    
    ---
    </details>
    
    This effectively reverts rust-lang#80422 and re-establishes rust-lang#74160. T-libs [previously signed off](rust-lang#74160 (comment)) on this stable API change in rust-lang#74160.
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    5702cfa View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#80901 - jyn514:better-colors, r=Mark-Simula…

    …crum
    
    Make `x.py --color always` apply to logging too
    
    Follow-up to rust-lang#78548, rust-lang#79004.
    
    r? ```@Mark-Simulacrum```
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    5b5aa10 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#80902 - JohnTitor:issue-76281, r=Mark-Simul…

    …acrum
    
    Add a regression test for rust-lang#76281
    
    This has been fixed between 1.47.0-nightly (663d2f5 2020-08-22) and 1.47.0-nightly (5180f3d 2020-08-23). Maybe fixed by rust-lang#73526?
    
    Created `wasm` dir, it currently has only one test but I'll move some wasm-related tests there as a follow-up.
    
    Closes rust-lang#76281
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    b3aa880 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#80941 - JohnTitor:ref-mut-pat-in-loops, r=v…

    …arkor
    
    Do not suggest invalid code in pattern with loop
    
    Fixes rust-lang#80913
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    79a8499 View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#80968 - KodrAus:stabilize/poll_map, r=Mark-…

    …Simulacrum
    
    Stabilize the poll_map feature
    
    Stabilizes the `poll_map` feature as tracked by rust-lang#63514 (with a completed FCP).
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    dba6c9c View commit details
    Browse the repository at this point in the history
  19. Rollup merge of rust-lang#80971 - camelid:feature-gate-testsuite-orga…

    …nization, r=Mark-Simulacrum
    
    Put all feature gate tests under `feature-gates/`
    
    There was one directory that had only a single test and there was also a
    test in the top-level directory. This moves both of them to
    `feature-gates/`.
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    4a48651 View commit details
    Browse the repository at this point in the history
  20. Rollup merge of rust-lang#81021 - CraftSpider:rustdoc-remove-import, …

    …r=jyn514
    
    Remove doctree::Import
    
    Per the title. Part of cleaning up doctree
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    1368e81 View commit details
    Browse the repository at this point in the history
  21. Rollup merge of rust-lang#81040 - osa1:fix_80992, r=jyn514

    doctest: Reset errors before dropping the parse session
    
    The first parse is to collect whether the code contains macros, has
    `main`, and uses other crates. In that pass we ignore errors as those
    will be reported when the test file is actually built.
    
    For that we need to reset errors in the `Diagnostic` otherwise when
    dropping it unhandled errors will be reported as compiler bugs.
    
    Fixes rust-lang#80992
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    9df8dcb View commit details
    Browse the repository at this point in the history
  22. Rollup merge of rust-lang#81060 - nagisa:nagisa/regression-50041, r=M…

    …ark-Simulacrum
    
    Add a regression test for rust-lang#50041
    
    AFAICT the test case never landed alongside the fix for the issue.
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    b67689b View commit details
    Browse the repository at this point in the history
  23. Rollup merge of rust-lang#81065 - osa1:cranelift_semicolon_warning, r…

    …=jyn514
    
    codegen_cranelift: Fix redundant semicolon warn
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    61be4e8 View commit details
    Browse the repository at this point in the history
  24. Rollup merge of rust-lang#81069 - ogoffart:rc_new_cyclic_doc, r=Mark-…

    …Simulacrum
    
    Add sample code for Rc::new_cyclic
    m-ou-se authored Jan 16, 2021
    Configuration menu
    Copy the full SHA
    dd86fc6 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    a6b2e1f View commit details
    Browse the repository at this point in the history