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 #120622

Closed
wants to merge 28 commits into from

Commits on Jan 21, 2024

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

Commits on Jan 25, 2024

  1. Add tests

    Nadrieril committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    3ea464f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    96ff1a4 View commit details
    Browse the repository at this point in the history
  3. Clarify the binding dance

    Nadrieril committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    e902878 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    09d4613 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0825ad3 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2024

  1. Configuration menu
    Copy the full SHA
    cda3588 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1254ee4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9f14fc4 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2024

  1. Reconstify Add

    fee1-dead committed Jan 27, 2024
    Configuration menu
    Copy the full SHA
    adde32b View commit details
    Browse the repository at this point in the history
  2. make effect infer variables suggestable in diagnostics

    it works when a non-const context that does not enable effects
    calls into a const effects-enabled trait. We'd simply suggest the
    non-const trait bound in this case consistent to its fallback.
    fee1-dead committed Jan 27, 2024
    Configuration menu
    Copy the full SHA
    b80d44e View commit details
    Browse the repository at this point in the history
  3. fix ui tests

    these ui changes are closer to what was there before const_trait_impl changes.
    fee1-dead committed Jan 27, 2024
    Configuration menu
    Copy the full SHA
    2e1e574 View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2024

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

Commits on Jan 30, 2024

  1. limit the names_possiblilities to less than 3

    Co-authored-by: Urgau <3616612+Urgau@users.noreply.github.com>
    chenyukang and Urgau committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    0213c87 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ca243e7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d34b0fa View commit details
    Browse the repository at this point in the history
  4. 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
  5. 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

Commits on Jan 31, 2024

  1. Configuration menu
    Copy the full SHA
    f622e83 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    815d312 View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2024

  1. Ignore test-panic-abort tests on Android

    Until rust-lang#120567 is fixed.
    tmandry committed Feb 2, 2024
    Configuration menu
    Copy the full SHA
    48f664b View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2024

  1. Rollup merge of rust-lang#116284 - RalfJung:no-nan-match, r=cjgillot

    make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern
    
    These arms would never be hit anyway, so the pattern makes little sense. We have had a future-compat lint against float matches in general for a *long* time, so I hope we can get away with immediately making this a hard error.
    
    This is part of implementing rust-lang/rfcs#3535.
    
    Closes rust-lang#41620 by removing the lint.
    
    rust-lang/reference#1456 updates the reference to match.
    matthiaskrgr committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    c873c12 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#120060 - saethlin:mir-opt-bless-targets, r=…

    …wesleywiser
    
    Use the same mir-opt bless targets on all platforms
    
    This undoes some of the implementation in rust-lang#119035, but not the effect. Sorry for the churn, I've learned a lot about how all this works over the past few weeks.
    
    The objective here is to make `x test mir-opt --bless` use the same set of targets on all platforms. It didn't do that from the start because bootstrap assumes that a target linker is available, so the availability of cross-linkers is how we ended up with `MIR_OPT_BLESS_TARGET_MAPPING` and poor support for blessing mir-opt tests from Aarch64 MacOS. This PR corrects that.
    
    So I've adjusted the bless targets for mir-opt tests, as well as tweaked some of the logic in bootstrap about linker configuration so that we don't try to access the cache of cc/linker configuration when doing the mir-opt builds.
    
    While working on that I realized that if I swapped from the `cargo rustc -p std` strategy to `cargo check` on the sysroot, I could use the existing code for check builds to bypass some linker logic. Sweet.
    
    But just doing that doesn't work, because then mir-opt tests complain that they can't find an rlib for any of the standard library crates. That happens because nearly all the mir-opt tests are attempting to build `CrateType::Executable`. We already have all the MIR required for mir-opt tests from the rmeta files, but since rustc think we're trying to build an executable it demands we have access to all the upstream monomorphizations that only exist in rlibs, not the meta files in a MIR-only sysroot.
    
    So to fix that, I've swapped all the mir-opt tests be passed `--crate-type=rlib`. That works, but leaves us with a few broken mir-opt tests which I've blessed or fixed up; we also lose MIR for some functions so I added `-Clink-dead-code` to paper over that. The inlining changes are because changing the crate-type perturbs the hashes that are compared here to sometimes let us do inlining even in a possibly-recursive call: https://github.com/rust-lang/rust/blob/4cb17b4e78e0540e49d2da884cc621a6bf6f47fa/compiler/rustc_mir_transform/src/inline.rs#L332-L341
    matthiaskrgr committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    6e5c565 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#120214 - Nadrieril:fix-120210, r=pnkfelix

    match lowering: consistently lower bindings deepest-first
    
    Currently when lowering match expressions to MIR, we do a funny little dance with the order of bindings. I attempt to explain it in the third commit: we handle refutable (i.e. needing a test) patterns differently than irrefutable ones. This leads to inconsistencies, as reported in rust-lang#120210. The reason we need a dance at all is for situations like:
    
    ```rust
    fn foo1(x: NonCopyStruct) {
        let y @ NonCopyStruct { copy_field: z } = x;
        // the above should turn into
        let z = x.copy_field;
        let y = x;
    }
    ```
    
    Here the `y `@`` binding will move out of `x`, so we need to copy the field first.
    
    I believe that the inconsistency came about when we fixed rust-lang#69971, and didn't notice that the fix didn't extend to refutable patterns. My guess then is that ordering bindings by "deepest-first, otherwise source order" is a sound choice. This PR implements that (at least I hope, match lowering is hard to follow 🥲).
    
    Fixes rust-lang#120210
    
    r? `@oli-obk` since you merged the original fix to rust-lang#69971
    cc `@matthewjasper`
    matthiaskrgr committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    4790a1f View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#120326 - tmandry:abort-in-tests, r=cuviper

    Actually abort in -Zpanic-abort-tests
    
    When a test fails in panic=abort, it can be useful to have a debugger or other tooling hook into the `abort()` call for debugging. Doing this some other way would require it to hard code details of Rust's panic machinery.
    
    There's no reason we couldn't have done this in the first place; using a single exit code for "success" or "failed" was just simpler. Now we are aware of the special exit codes for posix and windows platforms, logging a special error if an unrecognized code is used on those platforms, and falling back to just "failure" on other platforms.
    
    This continues to account for `#[should_panic]` inside the test process itself, so there's no risk of misinterpreting a random call to `abort()` as an expected panic. Any exit code besides `TR_OK` is logged as a test failure.
    
    As an added benefit, this would allow us to support panic=immediate_abort (but not `#[should_panic]`), without noise about unexpected exit codes when a test fails.
    matthiaskrgr committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    2efd952 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#120381 - fee1-dead-contrib:reconstify-add, …

    …r=compiler-errors
    
    Reconstify `Add`
    
    r? project-const-traits
    
    I'm not happy with the ui test changes (or failures because I did not bless them and include the diffs in this PR). There is at least some bugs I need to look and try fix:
    
    1. A third duplicated diagnostic when a consumer crate that does not have `effects` enabled has a trait selection error for an upstream const_trait trait. See tests/ui/ufcs/ufcs-qpath-self-mismatch.rs.
    2. For some reason, making `Add` a const trait would stop us from suggesting `T: Add` when we try to add two `T`s without that bound. See tests/ui/suggestions/issue-97677.rs
    matthiaskrgr committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    ada4d0d View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#120396 - estebank:method-on-unbounded-type-…

    …param, r=nnethercote
    
    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.
    matthiaskrgr committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    f42d6ca View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#120435 - chenyukang:yukang-fix-120427-cfg-n…

    …ame, r=Urgau,Nilstrieb
    
    Suggest name value cfg when only value is used for check-cfg
    
    Fixes rust-lang#120427
    r? ````@Nilstrieb````
    matthiaskrgr committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    622dad4 View commit details
    Browse the repository at this point in the history