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 9 pull requests #120621

Closed
wants to merge 28 commits into from

Commits on Jan 30, 2024

  1. Configuration menu
    Copy the full SHA
    d34b0fa View commit details
    Browse the repository at this point in the history
  2. Account for unbounded type param receiver in suggestions

    When encountering
    
    ```rust
    fn f<T>(a: T, b: T) -> std::cmp::Ordering {
        a.cmp(&b) //~ ERROR E0599
    }
    ```
    
    output
    
    ```
    error[E0599]: no method named `cmp` found for type parameter `T` in the current scope
      --> $DIR/method-on-unbounded-type-param.rs:2:7
       |
    LL | fn f<T>(a: T, b: T) -> std::cmp::Ordering {
       |      - method `cmp` not found for this type parameter
    LL |     a.cmp(&b)
       |       ^^^ method cannot be called on `T` due to unsatisfied trait bounds
       |
       = help: items from traits can only be used if the type parameter is bounded by the trait
    help: the following traits define an item `cmp`, perhaps you need to restrict type parameter `T` with one of them:
       |
    LL | fn f<T: Ord>(a: T, b: T) -> std::cmp::Ordering {
       |       +++++
    LL | fn f<T: Iterator>(a: T, b: T) -> std::cmp::Ordering {
       |       ++++++++++
    ```
    
    Fix rust-lang#120186.
    estebank committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    20b1c2a View commit details
    Browse the repository at this point in the history
  3. fix rebase

    estebank committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    9ccc770 View commit details
    Browse the repository at this point in the history
  4. Account for non-overlapping unmet trait bounds in suggestion

    When a method not found on a type parameter could have been provided by any
    of multiple traits, suggest each trait individually, instead of a single
    suggestion to restrict the type parameter with *all* of them.
    
    Before:
    
    ```
    error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied
      --> $DIR/method-on-unbounded-type-param.rs:5:10
       |
    LL |     (&a).cmp(&b)
       |          ^^^ method cannot be called on `&T` due to unsatisfied trait bounds
       |
       = note: the following trait bounds were not satisfied:
               `T: Ord`
               which is required by `&T: Ord`
               `&T: Iterator`
               which is required by `&mut &T: Iterator`
               `T: Iterator`
               which is required by `&mut T: Iterator`
    help: consider restricting the type parameters to satisfy the trait bounds
       |
    LL | fn g<T>(a: T, b: T) -> std::cmp::Ordering where T: Iterator, T: Ord {
       |                                           +++++++++++++++++++++++++
    ```
    
    After:
    
    ```
    error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied
      --> $DIR/method-on-unbounded-type-param.rs:5:10
       |
    LL |     (&a).cmp(&b)
       |          ^^^ method cannot be called on `&T` due to unsatisfied trait bounds
       |
       = note: the following trait bounds were not satisfied:
               `T: Ord`
               which is required by `&T: Ord`
               `&T: Iterator`
               which is required by `&mut &T: Iterator`
               `T: Iterator`
               which is required by `&mut T: Iterator`
       = help: items from traits can only be used if the type parameter is bounded by the trait
    help: the following traits define an item `cmp`, perhaps you need to restrict type parameter `T` with one of them:
       |
    LL | fn g<T: Ord>(a: T, b: T) -> std::cmp::Ordering {
       |       +++++
    LL | fn g<T: Iterator>(a: T, b: T) -> std::cmp::Ordering {
       |       ++++++++++
    ```
    
    Fix rust-lang#108428.
    estebank committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    5c41409 View commit details
    Browse the repository at this point in the history

Commits on Jan 31, 2024

  1. riscv only supports split_debuginfo=off for now

    Disable packed/unpacked options for riscv linux/android.
    Other riscv targets already only have the off option.
    
    The packed/unpacked options might be supported in the future.
    See upstream issue for more details:
    llvm/llvm-project#56642
    
    Fixes rust-lang#110224
    kxxt committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    471af8c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0f55e1b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a5042de View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3cc601a View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2024

  1. Simplify codegen diagnostic handling.

    To send a diagnostic from a codegen thread to the main thread,
    `SharedEmitter` currently converts the `rustc_errors::Diagnostic` into a
    one or more `rustc_codegen_ssa::Diagnostic`s, sends them, and then
    `SharedEmitterMain` reconstructs them at the other end into a
    `rustc_errors::Diagnostic`. This is a lossy operation, because of
    differences between the two `Diagnostic` types.
    
    Instead we can just clone the `rustc_errors::Diagnostic` and send it
    directly. Maybe in the past `rustc_errors::Diagnostic` wasn't `Send`?
    But it works now. Much simpler and nicer.
    nnethercote committed Feb 2, 2024
    Configuration menu
    Copy the full SHA
    2d73a5d View commit details
    Browse the repository at this point in the history
  2. Remove SharedEmitterMessage::AbortIfErrors.

    It's now always paired with a `SharedEmitterMessage::Diagnostic`, so the
    two message kinds can be combined.
    nnethercote committed Feb 2, 2024
    Configuration menu
    Copy the full SHA
    a5404f1 View commit details
    Browse the repository at this point in the history
  3. miri: normalize struct tail in ABI compat check

    Lukas Markeffsky committed Feb 2, 2024
    Configuration menu
    Copy the full SHA
    30e7b87 View commit details
    Browse the repository at this point in the history
  4. Make Emitter::emit_diagnostic consuming.

    All the other `emit`/`emit_diagnostic` methods were recently made
    consuming (e.g. rust-lang#119606), but this one wasn't. But it makes sense to.
    
    Much of this is straightforward, and lots of `clone` calls are avoided.
    There are a couple of tricky bits.
    - `Emitter::primary_span_formatted` no longer takes a `Diagnostic` and
      returns a pair. Instead it takes the two fields from `Diagnostic` that
      it used (`span` and `suggestions`) as `&mut`, and modifies them. This
      is necessary to avoid the cloning of `diag.children` in two emitters.
    - `from_errors_diagnostic` is rearranged so various uses of `diag` occur
      before the consuming `emit_diagnostic` call.
    nnethercote committed Feb 2, 2024
    Configuration menu
    Copy the full SHA
    226b3f3 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a2a3c61 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    009f970 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    0c4d089 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    0f3976b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    6b2a824 View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2024

  1. Configuration menu
    Copy the full SHA
    a27e45a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4c694db View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#120507 - estebank:issue-108428, r=davidtwco

    Account for non-overlapping unmet trait bounds in suggestion
    
    When a method not found on a type parameter could have been provided by any
    of multiple traits, suggest each trait individually, instead of a single
    suggestion to restrict the type parameter with *all* of them.
    
    Before:
    
    ```
    error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied
      --> $DIR/method-on-unbounded-type-param.rs:5:10
       |
    LL |     (&a).cmp(&b)
       |          ^^^ method cannot be called on `&T` due to unsatisfied trait bounds
       |
       = note: the following trait bounds were not satisfied:
               `T: Ord`
               which is required by `&T: Ord`
               `&T: Iterator`
               which is required by `&mut &T: Iterator`
               `T: Iterator`
               which is required by `&mut T: Iterator`
    help: consider restricting the type parameters to satisfy the trait bounds
       |
    LL | fn g<T>(a: T, b: T) -> std::cmp::Ordering where T: Iterator, T: Ord {
       |                                           +++++++++++++++++++++++++
    ```
    
    After:
    
    ```
    error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied
      --> $DIR/method-on-unbounded-type-param.rs:5:10
       |
    LL |     (&a).cmp(&b)
       |          ^^^ method cannot be called on `&T` due to unsatisfied trait bounds
       |
       = note: the following trait bounds were not satisfied:
               `T: Ord`
               which is required by `&T: Ord`
               `&T: Iterator`
               which is required by `&mut &T: Iterator`
               `T: Iterator`
               which is required by `&mut T: Iterator`
       = help: items from traits can only be used if the type parameter is bounded by the trait
    help: the following traits define an item `cmp`, perhaps you need to restrict type parameter `T` with one of them:
       |
    LL | fn g<T: Ord>(a: T, b: T) -> std::cmp::Ordering {
       |       +++++
    LL | fn g<T: Iterator>(a: T, b: T) -> std::cmp::Ordering {
       |       ++++++++++
    ```
    
    Fix rust-lang#108428.
    
    Follow up to rust-lang#120396, only last commit is relevant.
    matthiaskrgr authored Feb 3, 2024
    Configuration menu
    Copy the full SHA
    4d3da90 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#120518 - kxxt:riscv-split-debug-info, r=com…

    …piler-errors
    
    riscv only supports split_debuginfo=off for now
    
    Disable packed/unpacked options for riscv linux/android. Other riscv targets already only have the off option.
    
    The packed/unpacked options might be supported in the future. See upstream issue for more details:
    llvm/llvm-project#56642
    
    Fixes rust-lang#110224
    matthiaskrgr authored Feb 3, 2024
    Configuration menu
    Copy the full SHA
    2cd1d6e View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#120521 - reitermarkus:generic-nonzero-const…

    …ructors, r=dtolnay,oli-obk
    
    Make `NonZero` constructors generic.
    
    This makes `NonZero` constructors generic, so that `NonZero::new` can be used without turbofish syntax.
    
    Tracking issue: rust-lang#120257
    
    ~~I cannot figure out how to make this work with `const` traits. Not sure if I'm using it wrong or whether there's a bug:~~
    
    ```rust
    101 |         if n == T::ZERO {
        |            ^^^^^^^^^^^^ expected `host`, found `true`
        |
        = note: expected constant `host`
                   found constant `true`
    ```
    
    r? `@dtolnay`
    matthiaskrgr authored Feb 3, 2024
    Configuration menu
    Copy the full SHA
    4dc8ec8 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#120527 - GnomedDev:atomicu32-handle, r=petr…

    …ochenkov
    
    Switch OwnedStore handle count to AtomicU32
    
    This is already panics if overflowing a u32, so let's use the smaller int size to save a tiny bit of memory.
    matthiaskrgr authored Feb 3, 2024
    Configuration menu
    Copy the full SHA
    fb81c95 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#120550 - oli-obk:track_errors8, r=estebank

    Continue to borrowck even if there were previous errors
    
    but only from the perspective of the whole compiler. Individual items should not get borrowcked if their MIR is tainted by errors.
    
    r? `@estebank` `@nnethercote`
    matthiaskrgr authored Feb 3, 2024
    Configuration menu
    Copy the full SHA
    ae43dab View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#120575 - nnethercote:simplify-codegen-diag-…

    …handling, r=estebank
    
    Simplify codegen diagnostic handling
    
    Some nice improvements. Details in the individual commit logs.
    
    r? `@estebank`
    matthiaskrgr authored Feb 3, 2024
    Configuration menu
    Copy the full SHA
    21775ce View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#120587 - lukas-code:miri-tail-normalize, r=…

    …RalfJung
    
    miri: normalize struct tail in ABI compat check
    
    fixes rust-lang/miri#3282
    extracted from rust-lang#120354, see rust-lang#120354 (comment) for context
    
    r? `@RalfJung`
    matthiaskrgr authored Feb 3, 2024
    Configuration menu
    Copy the full SHA
    051ad6e View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#120590 - compiler-errors:dead, r=Nilstrieb

    Remove unused args from functions
    
    `#[instrument]` suppresses the unused arguments from a function, *and* suppresses unused methods too! This PR removes things which are only used via `#[instrument]` calls, and fixes some other errors (privacy?) that I will comment inline.
    
    It's possible that some of these arguments were being passed in for the purposes of being instrumented, but I am unconvinced by most of them.
    matthiaskrgr authored Feb 3, 2024
    Configuration menu
    Copy the full SHA
    8242560 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#120607 - conradludgate:fix-120603, r=dtolnay

    fix rust-lang#120603 by adding a check in default_read_buf
    
    Fixes rust-lang#120603 by checking the returned read n is in-bounds of the cursor.
    
    Interestingly, I noticed that `BorrowedBuf` side-steps this issue by using checked accesses. Maybe this can be switched to unchecked to mirror what BufReader does https://github.com/rust-lang/rust/blob/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/core/src/io/borrowed_buf.rs#L95
    matthiaskrgr authored Feb 3, 2024
    Configuration menu
    Copy the full SHA
    e502cbf View commit details
    Browse the repository at this point in the history