Expose try_destructure_mir_constant_for_diagnostics directly to clippy
Otherwise clippy tries to use the query in ways that incremental caching will inevitably cause problems with.
Hopefully gets rid of https://github.com/rust-lang/rust/issues/83085 for good
[beta] backport
This PR backports:
- #115785: Only suggest turbofish in patterns if we may recover
- #115527: Don't require `Drop` for `[PhantomData<T>; N]` where `N` and `T` are generic, if `T` requires `Drop`
- #115389: fix(resolve): update def if binding is warning ambiguity
- #115215: Remove assert that checks type equality
r? `@Mark-Simulacrum`
[beta] backport
This PR backports:
- #115559: implied bounds: do not ICE on unconstrained region vars
- #115446: fix version for abi_thiscall to 1.73.0, which was forgotten to change when stabilized and (later) moved to beta
- #115276: rustdoc: correctly deal with self ty params when eliding default object lifetimes
r? `@Mark-Simulacrum`
[beta] backports
- Contents of reachable statics is reachable #115114
- Revert "Suggest using `Arc` on `!Send`/`!Sync` types" #115311
- Stop emitting non-power-of-two vectors in (non-portable-SIMD) codegen #115236
- Do not forget to pass DWARF fragment information to LLVM. #115139
- rustdoc: use unicode-aware checks for redundant explicit link fastpath #115070
r? cuviper
coverage: Give the instrumentor its own counter type, separate from MIR
Within the MIR representation of coverage data, `CoverageKind` is an important part of `StatementKind::Coverage`, but the `InstrumentCoverage` pass also uses it heavily as an internal data structure. This means that any change to `CoverageKind` also needs to update all of the internal parts of `InstrumentCoverage` that manipulate it directly, making the MIR representation difficult to modify.
---
This change fixes that by giving the instrumentor its own `BcbCounter` type for internal use, which is then converted to a `CoverageKind` when injecting coverage information into MIR.
The main change is mostly mechanical, because the initial `BcbCounter` is drop-in compatible with `CoverageKind`, minus the unnecessary `CoverageKind::Unreachable` variant.
I've then removed the `function_source_hash` field from `BcbCounter::Counter`, as a small example of how the two types can now usefully differ from each other. Every counter in a MIR-level function should have the same source hash, so we can supply the hash during the conversion to `CoverageKind::Counter` instead.
---
*Background:* BCB stands for “basic coverage block”, which is a node in the simplified control-flow graph used by coverage instrumentation. The instrumentor pass uses the function's actual MIR control-flow graph to build a simplified BCB graph, then assigns coverage counters and counter expressions to various nodes/edges in that simplified graph, and then finally injects corresponding coverage information into the underlying MIR.
Fix a stack overflow with long else if chains
This fixes stack overflows when running the `issue-74564-if-expr-stack-overflow.rs` test with the parallel compiler.
Add MIR validation for unwind out from nounwind functions + fixes to make validation pass
`@Nilstrieb` This is the MIR validation you asked in https://github.com/rust-lang/rust/pull/112403#discussion_r1222739722.
Two passes need to be fixed to get the validation to pass:
* `RemoveNoopLandingPads` currently unconditionally introduce a resume block (even there is none to begin with!), changed to not do that
* Generator state transform introduces a `assert` which may unwind, and its drop elaboration also introduces many new `UnwindAction`s, so in this case run the AbortUnwindingCalls after the transformation.
I believe this PR should also fixRust-for-Linux/linux#1016, cc `@ojeda`
r? `@Nilstrieb`