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

Merged
merged 43 commits into from
Feb 29, 2024
Merged

Rollup of 7 pull requests #121804

merged 43 commits into from
Feb 29, 2024

Commits on Feb 9, 2024

  1. As Windows 10 requires certain features like CMPXCHG16B and a few oth…

    …ers and Rust plans to set Windows 10 as the minimum supported OS for target x86_64-pc-windows-msvc, I have added the cmpxchg16b and sse3 feature (as CPUs that meet the Windows 10 64-bit requirement also support SSE3. See https://walbourn.github.io/directxmath-sse3-and-ssse3/ )
    CKingX authored Feb 9, 2024
    Configuration menu
    Copy the full SHA
    d51e703 View commit details
    Browse the repository at this point in the history
  2. Update x86_64_pc_windows_msvc.rs

    Fixed a bug where adding CMPXCHG16B would fail due to different names in Rustc and LLVM
    CKingX authored Feb 9, 2024
    Configuration menu
    Copy the full SHA
    d6766e2 View commit details
    Browse the repository at this point in the history
  3. Update x86_64_pc_windows_msvc.rs

    As CMPXCHG16B is supported, I updated the max atomic width to 128-bits from 64-bits
    CKingX authored Feb 9, 2024
    Configuration menu
    Copy the full SHA
    fcb06f7 View commit details
    Browse the repository at this point in the history
  4. Update x86_64_uwp_windows_gnu.rs

    Updated x86_64-uwp-windows-gnu to use CMPXCHG16B and SSE3
    CKingX authored Feb 9, 2024
    Configuration menu
    Copy the full SHA
    abeac8f View commit details
    Browse the repository at this point in the history
  5. Possibly removed merge policy

    CKingX committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    1c6dda7 View commit details
    Browse the repository at this point in the history

Commits on Feb 13, 2024

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

Commits on Feb 20, 2024

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

Commits on Feb 26, 2024

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

Commits on Feb 27, 2024

  1. Configuration menu
    Copy the full SHA
    205319d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7c6960e View commit details
    Browse the repository at this point in the history

Commits on Feb 28, 2024

  1. Configuration menu
    Copy the full SHA
    be01e28 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ab06037 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4f7f067 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ea38166 View commit details
    Browse the repository at this point in the history
  5. Simplify

    Nadrieril committed Feb 28, 2024
    Configuration menu
    Copy the full SHA
    39441e4 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c918893 View commit details
    Browse the repository at this point in the history

Commits on Feb 29, 2024

  1. Don't cancel stashed OpaqueHiddenTypeMismatch errors.

    This gives one extra error message on one test, but is necessary to fix
    bigger problems caused by the cancellation of stashed errors.
    
    (Note: why not just avoid stashing altogether? Because that resulted in
    additional output changes.)
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    c4ec196 View commit details
    Browse the repository at this point in the history
  2. Don't cancel stashed TraitMissingMethod errors.

    This gives one extra error message on two tests, but is necessary to fix
    bigger problems caused by the cancellation of stashed errors.
    
    (Note: why not just avoid stashing altogether? Because that resulted in
    additional output changes.)
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    ec25d6d View commit details
    Browse the repository at this point in the history
  3. Overhaul how stashed diagnostics work, again.

    Stashed errors used to be counted as errors, but could then be
    cancelled, leading to `ErrorGuaranteed` soundness holes. rust-lang#120828 changed
    that, closing the soundness hole. But it introduced other difficulties
    because you sometimes have to account for pending stashed errors when
    making decisions about whether errors have occured/will occur and it's
    easy to overlook these.
    
    This commit aims for a middle ground.
    - Stashed errors (not warnings) are counted immediately as emitted
      errors, avoiding the possibility of forgetting to consider them.
    - The ability to cancel (or downgrade) stashed errors is eliminated, by
      disallowing the use of `steal_diagnostic` with errors, and introducing
      the more restrictive methods `try_steal_{modify,replace}_and_emit_err`
      that can be used instead.
    
    Other things:
    - `DiagnosticBuilder::stash` and `DiagCtxt::stash_diagnostic` now both
      return `Option<ErrorGuaranteed>`, which enables the removal of two
      `delayed_bug` calls and one `Ty::new_error_with_message` call. This is
      possible because we store error guarantees in
      `DiagCtxt::stashed_diagnostics`.
    - Storing the guarantees also saves us having to maintain a counter.
    - Calls to the `stashed_err_count` method are no longer necessary
      alongside calls to `has_errors`, which is a nice simplification, and
      eliminates two more `span_delayed_bug` calls and one FIXME comment.
    - Tests are added for three of the four fixed PRs mentioned below.
    - `issue-121108.rs`'s output improved slightly, omitting a non-useful
      error message.
    
    Fixes rust-lang#121451.
    Fixes rust-lang#121477.
    Fixes rust-lang#121504.
    Fixes rust-lang#121508.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    260ae70 View commit details
    Browse the repository at this point in the history
  4. Mark some once-again-unreachable paths as unreachable.

    This undoes the changes from rust-lang#121482 and rust-lang#121586, now that stashed errors
    will trigger more early aborts.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    b4e9f93 View commit details
    Browse the repository at this point in the history
  5. Stop miri if delayed bugs are present.

    Seems wise, since it shouldn't proceed in that case.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    9aff357 View commit details
    Browse the repository at this point in the history
  6. Reinstate emit_stashed_diagnostics in DiagCtxtInner::drop.

    I removed it in rust-lang#121206 because I thought thought it wasn't necessary.
    But then I had to add an `emit_stashed_diagnostics` call elsewhere in
    rustfmt to avoid the assertion failure (which took two attempts to get
    right, rust-lang#121487 and rust-lang#121615), and now there's an assertion failure in
    clippy as well (rust-lang/rust-clippy#12364).
    
    So this commit just reinstates the call in `DiagCtxtInner::drop`. It
    also reverts the rustfmt changes from rust-lang#121487 and rust-lang#121615, though it
    keeps the tests added for those PRs.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    82961c0 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c1f0163 View commit details
    Browse the repository at this point in the history
  8. Simplify UnusedExterns lifetimes.

    In practice, 'a and 'b and 'c are always the same. This change makes
    `UnusedExterns` more like `ArtifactNotification`, which uses a single
    lifetime 'a in multiple ways.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    869bd03 View commit details
    Browse the repository at this point in the history
  9. Use Destination more.

    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    3c3f15c View commit details
    Browse the repository at this point in the history
  10. Remove unnecessary diagnostic_width call.

    This `HumanEmitter` is only created to test if it supports colour. The
    diagnostic width isn't relevant.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    805e50e View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    ca5b79d View commit details
    Browse the repository at this point in the history
  12. Inline and remove DiagCtxt::with_tty_emitter

    It only has two call sites, and one of those doesn't set the source map.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    f9eef38 View commit details
    Browse the repository at this point in the history
  13. Rename DiagCtxt::with_emitter as DiagCtxt::new.

    Because it's now the only constructor.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    880c1c5 View commit details
    Browse the repository at this point in the history
  14. Merge HumanEmitter::{new,create}.

    They have the same signature, and the former just calls the latter.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    d372741 View commit details
    Browse the repository at this point in the history
  15. Inline and remove HumanReadableErrorType::new_emitter.

    And likewise with `ColorConfig::suggests_using_colors`. They both have a
    single call site. And note that `BufWriter::supports_color()` always
    returns false, which enables a small bit of constant folding along the
    way.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    437325b View commit details
    Browse the repository at this point in the history
  16. Inline and remove HumanEmitter::stderr.

    Because `HumanEmitter::new` is enough, in conjunction with the (renamed)
    `stderr_destination` function.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    067d7c3 View commit details
    Browse the repository at this point in the history
  17. Inline and remove JsonEmitter::{basic,stderr}.

    They are so similar to `JsonEmitter::new` it's not worth having separate
    functions, it makes the code harder to read.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    2999d8d View commit details
    Browse the repository at this point in the history
  18. Make JsonEmitter more like HumanEmitter.

    Use `derive(Setters)` to derive setters, and then change
    `JsonEmitter::new` to only have the arguments that are always used.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    9ff4487 View commit details
    Browse the repository at this point in the history
  19. Add a useful comment.

    It took me a while to work this out.
    nnethercote committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    58f4505 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    607bf65 View commit details
    Browse the repository at this point in the history
  21. Rollup merge of rust-lang#120820 - CKingX:cpu-base-minimum, r=petroch…

    …enkov,ChrisDenton
    
    Enable CMPXCHG16B, SSE3, SAHF/LAHF and 128-bit Atomics (in nightly) in Windows x64
    
    As Rust plans to set Windows 10 as the minimum supported OS for target x86_64-pc-windows-msvc, I have added the cmpxchg16b and sse3 feature. Windows 10 requires CMPXCHG16B, LAHF/SAHF, and PrefetchW as stated in the requirements [here](https://download.microsoft.com/download/c/1/5/c150e1ca-4a55-4a7e-94c5-bfc8c2e785c5/Windows%2010%20Minimum%20Hardware%20Requirements.pdf). Furthermore, CPUs that meet these requirements also have SSE3 ([see](https://walbourn.github.io/directxmath-sse3-and-ssse3/))
    GuillaumeGomez authored Feb 29, 2024
    Configuration menu
    Copy the full SHA
    36bd9ef View commit details
    Browse the repository at this point in the history
  22. Rollup merge of rust-lang#121000 - Nadrieril:keep_all_fields, r=compi…

    …ler-errors
    
    pattern_analysis: rework how we hide empty private fields
    
    Consider this:
    ```rust
    mod foo {
      pub struct Bar {
        pub a: bool,
        b: !,
      }
    }
    
    fn match_a_bar(bar: foo::Bar) -> bool {
      match bar {
        Bar { a, .. } => a,
      }
    }
    ```
    
    Because the field `b` is private, matches outside the module are not allowed to observe the fact that `Bar` is empty. In particular `match bar {}` is valid within the module `foo` but an error outside (assuming `exhaustive_patterns`).
    
    We currently handle this by hiding the field `b` when it's both private and empty. This means that the pattern `Bar { a, .. }` is lowered to `Bar(a, _)` if we're inside of `foo` and to `Bar(a)` outside. This involves a bit of a dance to keep field indices straight. But most importantly this makes pattern lowering depend on the module.
    
    In this PR, I instead do nothing special when lowering. Only during analysis do we track whether a place must be skipped.
    
    r? `@compiler-errors`
    GuillaumeGomez authored Feb 29, 2024
    Configuration menu
    Copy the full SHA
    9df7f26 View commit details
    Browse the repository at this point in the history
  23. Rollup merge of rust-lang#121376 - Nadrieril:mir-half-ranges, r=pnkfelix

    Skip unnecessary comparison with half-open range patterns
    
    This is the last remaining detail in the implementation of half-open range patterns. Until now, a half-open range pattern like `10..` was converted to `10..T::MAX` before lowering to MIR, which generated an extra pointless comparison. With this PR we don't generate it.
    GuillaumeGomez authored Feb 29, 2024
    Configuration menu
    Copy the full SHA
    2e0a26a View commit details
    Browse the repository at this point in the history
  24. Rollup merge of rust-lang#121596 - ChrisDenton:tls, r=joboet

    Use volatile access instead of `#[used]` for `on_tls_callback`
    
    The first commit adds a volatile load of `p_thread_callback` when registering a dtor so that the compiler knows if the callback is used or not. I don't believe the added volatile instruction is otherwise significant in the context. In my testing using the volatile load allowed the compiler to correctly reason about whether `on_tls_callback` is used or not, allowing it to be omitted entirely in some cases. Admittedly it usually is used due to `Thread` but that can be avoided (e.g. in DLLs or with custom entry points that avoid the offending APIs). Ideally this would be something the compiler could help a bit more with so we didn't have to use tricks like `#[used]` or volatile. But alas.
    
    I also used this as an opportunity to clean up the `unused` lints which I don't think serve a purpose any more.
    
    The second commit removes the volatile load of `_tls_used` with `#cfg[target_thread_local]` because `#[thread_local]` already implies it. And if it ever didn't then `#[thread_local]` would be broken when there aren't any dtors.
    GuillaumeGomez authored Feb 29, 2024
    Configuration menu
    Copy the full SHA
    eea8cee View commit details
    Browse the repository at this point in the history
  25. Rollup merge of rust-lang#121669 - nnethercote:count-stashed-errs-aga…

    …in, r=estebank
    
    Count stashed errors again
    
    Stashed diagnostics are such a pain. Their "might be emitted, might not" semantics messes with lots of things.
    
    rust-lang#120828 and rust-lang#121206 made some big changes to how they work, improving some things, but still leaving some problems, as seen by the issues caused by rust-lang#121206. This PR aims to fix all of them by restricting them in a way that eliminates the "might be emitted, might not" semantics while still allowing 98% of their benefit. Details in the individual commit logs.
    
    r? `@oli-obk`
    GuillaumeGomez authored Feb 29, 2024
    Configuration menu
    Copy the full SHA
    a5945b5 View commit details
    Browse the repository at this point in the history
  26. Rollup merge of rust-lang#121783 - nnethercote:emitter-cleanups, r=ol…

    …i-obk
    
    Emitter cleanups
    
    Some cleanups I made when reading emitter code. In particular, `HumanEmitter` and `JsonEmitter` have gone from three constructors to one.
    
    r? `@oli-obk`
    GuillaumeGomez authored Feb 29, 2024
    Configuration menu
    Copy the full SHA
    0e9f02d View commit details
    Browse the repository at this point in the history