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 10 pull requests #122012

Merged
merged 31 commits into from
Mar 5, 2024
Merged

Rollup of 10 pull requests #122012

merged 31 commits into from
Mar 5, 2024

Commits on Feb 17, 2024

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

Commits on Feb 18, 2024

  1. time complexity for push

    20jasper committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    cb8ce9d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bb6dca0 View commit details
    Browse the repository at this point in the history
  3. time complexity for pop

    20jasper committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    0a5d684 View commit details
    Browse the repository at this point in the history
  4. time complexity for insert

    20jasper committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    d2f825f View commit details
    Browse the repository at this point in the history
  5. intradoc link for vec

    20jasper committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    ef1a584 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    a9cfeb3 View commit details
    Browse the repository at this point in the history
  7. Fix error in push docs

    Copying is O(n)—not the memory allocation
    20jasper committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    bc52e5d View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2024

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

Commits on Feb 25, 2024

  1. Make push docs more vague

    20jasper committed Feb 25, 2024
    Configuration menu
    Copy the full SHA
    74151cb View commit details
    Browse the repository at this point in the history

Commits on Feb 27, 2024

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

Commits on Mar 1, 2024

  1. Add regression test

    oli-obk committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    f5f11e1 View commit details
    Browse the repository at this point in the history

Commits on Mar 2, 2024

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

Commits on Mar 3, 2024

  1. Use root obligation on E0277 for some cases

    When encountering trait bound errors that satisfy some heuristics that
    tell us that the relevant trait for the user comes from the root
    obligation and not the current obligation, we use the root predicate for
    the main message.
    
    This allows to talk about "X doesn't implement Pattern<'_>" over the
    most specific case that just happened to fail, like  "char doesn't
    implement Fn(&mut char)" in
    `tests/ui/traits/suggest-dereferences/root-obligation.rs`
    
    The heuristics are:
    
     - the type of the leaf predicate is (roughly) the same as the type
       from the root predicate, as a proxy for "we care about the root"
     - the leaf trait and the root trait are different, so as to avoid
       talking about `&mut T: Trait` and instead remain talking about
       `T: Trait` instead
     - the root trait is not `Unsize`, as to avoid talking about it in
       `tests/ui/coercion/coerce-issue-49593-box-never.rs`.
    
    ```
    error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied
      --> $DIR/root-obligation.rs:6:38
       |
    LL |         .filter(|c| "aeiou".contains(c))
       |                             -------- ^ the trait `Fn<(char,)>` is not implemented for `&char`, which is required by `&char: Pattern<'_>`
       |                             |
       |                             required by a bound introduced by this call
       |
       = note: required for `&char` to implement `FnOnce<(char,)>`
       = note: required for `&char` to implement `Pattern<'_>`
    note: required by a bound in `core::str::<impl str>::contains`
      --> $SRC_DIR/core/src/str/mod.rs:LL:COL
    help: consider dereferencing here
       |
    LL |         .filter(|c| "aeiou".contains(*c))
       |                                      +
    ```
    
    Fix rust-lang#79359, fix rust-lang#119983, fix rust-lang#118779, cc rust-lang#118415 (the suggestion needs
    to change).
    estebank committed Mar 3, 2024
    Configuration menu
    Copy the full SHA
    f0c9311 View commit details
    Browse the repository at this point in the history
  2. Be more lax in .into_iter() suggestion when encountering Iterator

    … methods on non-`Iterator`
    
    ```
    error[E0599]: no method named `map` found for struct `Vec<bool>` in the current scope
      --> $DIR/vec-on-unimplemented.rs:3:23
       |
    LL |     vec![true, false].map(|v| !v).collect::<Vec<_>>();
       |                       ^^^ `Vec<bool>` is not an iterator
       |
    help: call `.into_iter()` first
       |
    LL |     vec![true, false].into_iter().map(|v| !v).collect::<Vec<_>>();
       |                       ++++++++++++
    ```
    
    We used to provide some help through `rustc_on_unimplemented` on non-`impl Trait` and non-type-params, but this lets us get rid of some otherwise unnecessary conditions in the annotation on `Iterator`.
    estebank committed Mar 3, 2024
    Configuration menu
    Copy the full SHA
    89a3c19 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    40f9dcc View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2024

  1. Merge the impl trait in assoc type collector into the opaque type col…

    …lector and use a runtime switch instead
    oli-obk committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    8364a06 View commit details
    Browse the repository at this point in the history
  2. Abort on arity mismatch

    As this can cause panics on array accesses later.
    Nadrieril committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    2af01a2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fb91610 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    86e88fc View commit details
    Browse the repository at this point in the history
  5. typo

    Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
    RalfJung and lqd authored Mar 4, 2024
    Configuration menu
    Copy the full SHA
    681dc38 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2024

  1. Rollup merge of rust-lang#121213 - Takashiidobe:takashi/example-for-r…

    …c-into-inner, r=cuviper
    
    Add an example to demonstrate how Rc::into_inner works
    
    This PR adds an example to Rc::into_inner, since it didn't have one previously.
    matthiaskrgr authored Mar 5, 2024
    Configuration menu
    Copy the full SHA
    c2f6c0b View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#121262 - 20jasper:add-vector-time-complexit…

    …y, r=cuviper
    
    Add vector time complexity
    
    Added time complexity for `Vec` methods `push`, `push_within_capacity`, `pop`, and `insert`.
    
    <details>
    
    <summary> Reference images </summary>
    
    ![`Vec::push` documentation](https://github.com/rust-lang/rust/assets/78604367/dc966bbd-e92e-45a6-af82-35afabfa79a9)
    
    ![`Vec::push_within_capacity` documentation](https://github.com/rust-lang/rust/assets/78604367/9aadaf48-46ed-4fad-bdd5-74b98a61f4bb)
    
    ![`Vec::pop` documentation](https://github.com/rust-lang/rust/assets/78604367/88ec0389-a346-4ea5-a3b7-17caf514dd8b)
    
    ![`Vec::insert` documentation](https://github.com/rust-lang/rust/assets/78604367/960c15c3-ef8e-4aa7-badc-35ce80f6f221)
    
    </details>
    
    I followed a convention to use `#Time complexity` that I found in [the `BinaryHeap` documentation](https://doc.rust-lang.org/std/collections/struct.BinaryHeap.html#time-complexity-1). Looking through the rest of standard library collections, there is not a consistent way to handle this.
    
    [`Vec::swap_remove`](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.swap_remove) does not have a dedicated section for time complexity but does list it.
    
    [`VecDeque::rotate_left`](https://doc.rust-lang.org/std/collections/struct.VecDeque.html#complexity) uses a `#complexity` heading.
    matthiaskrgr authored Mar 5, 2024
    Configuration menu
    Copy the full SHA
    22827fd View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#121287 - zachs18:rc-into-raw-must-use, r=cu…

    …viper
    
    Clarify/add `must_use` message for Rc/Arc/Weak::into_raw.
    
    The current `#[must_use]` messages for `{sync,rc}::Weak::into_raw` ("`self` will be dropped if the result is not used") are misleading, as `self` is consumed and will *not* be dropped.
    
    This PR changes their `#[must_use]` message to the same as `Arc::into_raw`'s[ current `#[must_use]` message](https://github.com/rust-lang/rust/blob/d5735645753e990a72446094f703df9b5e421555/library/alloc/src/sync.rs#L1482) ("losing the pointer will leak memory"), and also adds it to `Rc::into_raw`, which is not currently `#[must_use]`.
    matthiaskrgr authored Mar 5, 2024
    Configuration menu
    Copy the full SHA
    7265130 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#121664 - compiler-errors:adjust-error-yield…

    …-lowering, r=spastorino
    
    Adjust error `yield`/`await` lowering
    
    Adjust the lowering of `yield`/`await` outside of their correct scopes so that we no longer make orpan HIR exprs.
    
    Previously, `yield EXPR` would be lowered directly to `hir::TyKind::Error` (which I'll call `<error>`) which means that `EXPR` was not present in the HIR, but now we lower it to `{ EXPR; <error> }` so that `EXPR` is not orphaned.
    
    Fixes rust-lang#121096
    matthiaskrgr authored Mar 5, 2024
    Configuration menu
    Copy the full SHA
    94bb2d2 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#121826 - estebank:e0277-root-obligation-2, …

    …r=oli-obk
    
    Use root obligation on E0277 for some cases
    
    When encountering trait bound errors that satisfy some heuristics that tell us that the relevant trait for the user comes from the root obligation and not the current obligation, we use the root predicate for the main message.
    
    This allows to talk about "X doesn't implement Pattern<'_>" over the most specific case that just happened to fail, like  "char doesn't implement Fn(&mut char)" in
    `tests/ui/traits/suggest-dereferences/root-obligation.rs`
    
    The heuristics are:
    
     - the type of the leaf predicate is (roughly) the same as the type from the root predicate, as a proxy for "we care about the root"
     - the leaf trait and the root trait are different, so as to avoid talking about `&mut T: Trait` and instead remain talking about `T: Trait` instead
     - the root trait is not `Unsize`, as to avoid talking about it in `tests/ui/coercion/coerce-issue-49593-box-never.rs`.
    
    ```
    error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied
      --> $DIR/root-obligation.rs:6:38
       |
    LL |         .filter(|c| "aeiou".contains(c))
       |                             -------- ^ the trait `Fn<(char,)>` is not implemented for `&char`, which is required by `&char: Pattern<'_>`
       |                             |
       |                             required by a bound introduced by this call
       |
       = note: required for `&char` to implement `FnOnce<(char,)>`
       = note: required for `&char` to implement `Pattern<'_>`
    note: required by a bound in `core::str::<impl str>::contains`
      --> $SRC_DIR/core/src/str/mod.rs:LL:COL
    help: consider dereferencing here
       |
    LL |         .filter(|c| "aeiou".contains(*c))
       |                                      +
    ```
    
    Fix rust-lang#79359, fix rust-lang#119983, fix rust-lang#118779, cc rust-lang#118415 (the suggestion needs to change), cc rust-lang#121398 (doesn't fix the underlying issue).
    matthiaskrgr authored Mar 5, 2024
    Configuration menu
    Copy the full SHA
    35f6eee View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#121838 - oli-obk:impl_trait_in_assoc_tys_fi…

    …x, r=compiler-errors
    
    Use the correct logic for nested impl trait in assoc types
    
    Previously we accidentally continued with the TAIT visitor, which allowed more than we wanted to.
    
    r? ```@compiler-errors```
    matthiaskrgr authored Mar 5, 2024
    Configuration menu
    Copy the full SHA
    20dde1e View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#121913 - Zoxc:query-fix, r=compiler-errors

    Don't panic when waiting on poisoned queries
    
    This fixes a bug introduced in rust-lang#119086.
    matthiaskrgr authored Mar 5, 2024
    Configuration menu
    Copy the full SHA
    c483e63 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#121987 - Nadrieril:abort-on-arity-mismatch,…

    … r=compiler-errors
    
    pattern analysis: abort on arity mismatch
    
    This is one more PR replacing panics by `Err()` aborts. I recently audited all the `unwrap()` calls, but I had forgotten about array accesses. (Again [discovered by rust-analyzer](rust-lang/rust-analyzer#16746)).
    
    r? ```@compiler-errors```
    matthiaskrgr authored Mar 5, 2024
    Configuration menu
    Copy the full SHA
    44bd2b5 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#121993 - Zoxc:query-stack-panic-queries, r=…

    …compiler-errors
    
    Avoid using unnecessary queries when printing the query stack in panics
    
    This should fix rust-lang#121974. Alternative to rust-lang#121981.
    matthiaskrgr authored Mar 5, 2024
    Configuration menu
    Copy the full SHA
    87dc3fc View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#121997 - RalfJung:cast-float-ty, r=compiler…

    …-errors
    
    interpret/cast: make more matches on FloatTy properly exhaustive
    
    Actually implementing these is pretty trivial (at least once all the scalar methods are added, which happens in rust-lang#121926), but I'm staying consistent with the other f16/f128 PRs. Also adding adding all the tests to Miri would be quite a lot of work.
    
    There's probably some way to reduce the code duplication here with more use of generics... but that's a future refactor.^^
    
    r? ```@tgross35```
    matthiaskrgr authored Mar 5, 2024
    Configuration menu
    Copy the full SHA
    92ff43d View commit details
    Browse the repository at this point in the history