about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
AgeCommit message (Collapse)AuthorLines
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-5/+6
2025-07-31Auto merge of #144723 - Zalathar:rollup-f9e0rfo, r=Zalatharbors-1/+5
Rollup of 3 pull requests Successful merges: - rust-lang/rust#144657 (fix: Only "close the window" when its the last annotated file) - rust-lang/rust#144665 (Re-block SRoA on SIMD types) - rust-lang/rust#144713 (`rustc_middle::ty` cleanups) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-31Rollup merge of #144663 - Zalathar:empty-span, r=petrochenkovStuart Cook-2/+36
coverage: Re-land "Enlarge empty spans during MIR instrumentation" This allows us to assume that coverage spans will only be discarded during codegen in very unusual situations. --- This seemingly-simple change has a rather messy history: - rust-lang/rust#140847 - rust-lang/rust#141650 - rust-lang/rust#144298 - rust-lang/rust#144480 Since then, a number of related changes have landed that should make it reasonable to try again: - rust-lang/rust#144530 - rust-lang/rust#144560 - rust-lang/rust#144616 In particular, we have multiple fixes/mitigations, and a confirmed regression test for the original bug that is not triggered by re-landing the changes in this PR.
2025-07-31Rollup merge of #143672 - beepster4096:box_drop_flags_again, r=oli-obkStuart Cook-26/+28
Fix Box allocator drop elaboration New version of rust-lang/rust#131146. Clearing Box's drop flag after running its destructor can cause it to skip dropping its allocator, so just don't. Its cleared by the drop ladder code afterwards already. Unlike the last PR this also handles other types with destructors properly, in the event that we can have open drops on them in the future (by partial initialization or DerefMove or something). Finally, I also added tests for the interaction with async drop here but I discovered rust-lang/rust#143658, so one of the tests has a `knownbug` annotation. Not sure if it should be in this PR at all though. Fixes rust-lang/rust#131082 r? wesleywiser - prev. reviewer
2025-07-29Re-block SRoA on SIMD typesScott McMurray-1/+5
Fixes 144621
2025-07-30coverage: Re-land "Enlarge empty spans during MIR instrumentation"Zalathar-2/+36
This allows us to assume that coverage spans will only be discarded during codegen in very unusual situations.
2025-07-29Rollup merge of #144566 - scottmcm:align-of-slice, r=oli-obkStuart Cook-0/+31
Simplify `align_of_val::<[T]>(…)` → `align_of::<T>()` I spotted this while working on the inliner (rust-lang/rust#144561). In particular, if [`Layout::for_value`](https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.for_value) inlines, then it can be pretty easy to end up with an `align_of_val::<[T]>` today (demo: <https://rust.godbolt.org/z/Tesnscj4a>) where we can save at least a block, if not more, by using the version that's an rvalue and not a call.
2025-07-29coverage: Treat `#[automatically_derived]` as `#[coverage(off)]`Zalathar-10/+9
2025-07-29coverage: Rename `CoverageStatus` to `CoverageAttrKind`Zalathar-13/+16
This patch also prepares the affected code in `coverage_attr_on` for some subsequent changes.
2025-07-28Simplify `align_of_val::<[T]>(…)` → `align_of::<T>()`Scott McMurray-0/+31
2025-07-28Auto merge of #144377 - camsteffen:simplify-impl-of-method, r=fee1-deadbors-5/+5
Rename impl_of_method and trait_of_item This PR used to tweak the implementation of impl_of_method, but that introduced a perf regression. Rename impl_of_method and trait_of_item to impl_of_assoc and trait_of_assoc respectively. This reflects how the two functions are closely related. And it reflects the behavior more accurately as the functions check whether the input is an associated item.
2025-07-28Rename impl_of_method -> impl_of_assocCameron Steffen-3/+3
2025-07-28Rename trait_of_item -> trait_of_assocCameron Steffen-2/+2
2025-07-28Auto merge of #144543 - scottmcm:more-sroa, r=cjgillotbors-28/+8
Allow more MIR SROA This removes some guards on SROA that are no longer needed: - With https://github.com/rust-lang/compiler-team/issues/838 it no longer needs to check for SIMD - With https://github.com/rust-lang/compiler-team/issues/807 it no longer needs to check for niches - This means that `Wrapper(char)` and `Pin<&mut T>` can get SRoA'd now, where previously they weren't because the check was banning SRaA for anything with a niche -- not just things with `#[rustc_layout_scalar_valid_range_*]`. - Technically rust-lang/rust#133652 isn't complete yet, but `NonZero` and `NonNull` have already moved over, so this is fine. At worst this will mean that LLVM gets less `!range` metadata on something that wasn't already fixed by rust-lang/rust#133651 or rust-lang/rust#135236, but that's still sound, and unblocking general SRoA is worth that tradeoff.
2025-07-28Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLiibors-31/+28
Some `let chains` clean-up Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one r? compiler
2025-07-28use let chains in mir, resolve, targetKivooeo-27/+24
2025-07-28use let chains in hir, lint, mirKivooeo-4/+4
2025-07-27Allow more MIR SROAScott McMurray-28/+8
2025-07-26Revert "coverage: Enlarge empty spans during MIR instrumentation, not codegen"Zalathar-36/+2
This reverts commit f877aa7d14916f71a2f88c6d4c009e7ded7684c4.
2025-07-25span_bug instead of handling currently impossible drop casebeepster4096-7/+8
2025-07-25fix box destructor generationbeepster4096-27/+28
2025-07-23Remove useless lifetime parameter.Camille GILLOT-1/+1
2025-07-23Auto merge of #144233 - cjgillot:unsat-mir, r=oli-obkbors-8/+17
Consider parent predicates in ImpossiblePredicates pass. This pass is double edged. It avoids some ICEs (yay!) but also degrades diagnostics from constant evaluation. Fixes rust-lang/rust#121363 Fixes rust-lang/rust#131507 Fixes rust-lang/rust#140100 Fixes rust-lang/rust#140365
2025-07-23Rollup merge of #144298 - Zalathar:empty-span, r=wesleywiserMatthias Krüger-2/+36
coverage: Enlarge empty spans during MIR instrumentation, not codegen This re-lands the part of rust-lang/rust#140847 that was (hopefully) not responsible for the coverage-instrumentation regressions that caused that PR to be reverted. --- Enlarging empty spans was historically performed during MIR instrumentation, but had to be moved to codegen as part of larger changes in rust-lang/rust#134497, leading to the status quo. But now there should be no reason not to move that step back to its more logical home in instrumentaion.
2025-07-22Rename `tests/codegen` into `tests/codegen-llvm`Guillaume Gomez-1/+1
2025-07-22coverage: Enlarge empty spans during MIR instrumentation, not codegenZalathar-2/+36
This allows us to assume that coverage spans will only be discarded during codegen in very unusual situations.
2025-07-22Keep elaborating predicates.Camille GILLOT-12/+9
2025-07-22Rollup merge of #144212 - bjorn3:remove_unique_lang_item, r=oli-obk许杰友 Jieyou Xu (Joe)-2/+0
Remove the ptr_unique lang item Miri no longer uses it since https://github.com/rust-lang/miri/pull/4307.
2025-07-21Auto merge of #144238 - jhpratt:rollup-xb8aida, r=jhprattbors-4/+4
Rollup of 8 pull requests Successful merges: - rust-lang/rust#144144 (tests: Skip supported-crate-types test on musl hosts) - rust-lang/rust#144159 (opt-dist: change build_dir field to be an actual build dir) - rust-lang/rust#144162 (Debug impls for DropElaborators) - rust-lang/rust#144189 (Add non-regression test for rust-lang/rust#144168) - rust-lang/rust#144216 (Don't consider unstable fields always-inhabited) - rust-lang/rust#144229 (Miri subtree update) - rust-lang/rust#144230 (Option::as_slice: fix comment) - rust-lang/rust#144235 (Fix run-make tests on musl hosts) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-21Remove Retag for Uniquebjorn3-2/+0
2025-07-20Rollup merge of #144162 - beepster4096:drop_elaborator_debug_impls, ↵Jacob Pratt-4/+4
r=compiler-errors Debug impls for DropElaborators It's a little weird that these just have a completely empty Debug impl. Now they're `ElaborateDropsCtxt { .. }` and `DropShimElaborator { .. }`.
2025-07-20Also bail out if predicates contain errors.Camille GILLOT-2/+2
2025-07-20Consider parent predicates in ImpossiblePredicates pass.Camille GILLOT-7/+19
2025-07-20Ban projecting into SIMD types [MCP838]Scott McMurray-0/+9
2025-07-19Give a message with a span on validation errorScott McMurray-8/+10
2025-07-19Auto merge of #144166 - matthiaskrgr:rollup-wccepuo, r=matthiaskrgrbors-16/+28
Rollup of 10 pull requests Successful merges: - rust-lang/rust#141076 (fix Zip unsoundness (again)) - rust-lang/rust#142444 (adding run-make test to autodiff) - rust-lang/rust#143704 (Be a bit more careful around exotic cycles in in the inliner) - rust-lang/rust#144073 (Don't test panic=unwind in panic_main.rs on Fuchsia) - rust-lang/rust#144083 (miri sleep tests: increase slack) - rust-lang/rust#144092 (bootstrap: Detect musl hosts) - rust-lang/rust#144098 (Do not lint private-in-public for RPITIT) - rust-lang/rust#144103 (Rename `emit_unless` to `emit_unless_delay`) - rust-lang/rust#144108 (Ignore tests/run-make/link-eh-frame-terminator/rmake.rs when cross-compiling) - rust-lang/rust#144115 (fix outdated comment) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-18debug impls for drop elaboratorsbeepster4096-4/+4
2025-07-18Be a bit more careful around exotic cycles in in the inlinerMichael Goulet-16/+28
2025-07-18Generalize `unsize` and `unsize_into` destinationsOli Scherer-1/+1
2025-07-18Rollup merge of #143891 - scrabsha:push-xxtttopqoprr, r=jdonszelmannMatthias Krüger-19/+13
Port `#[coverage]` to the new attribute system r? ``````@jdonszelmann``````
2025-07-18Rollup merge of #143271 - cjgillot:gvn-types, r=oli-obkMatthias Krüger-298/+255
Store the type of each GVN value MIR is fully typed, so type information is an integral part of what defines a value. GVN currently tries to circumvent storing types, which creates all sorts of complexities. This PR stores the type along with the enum `Value` when defining a value index. This allows to simplify a lot of code. Fixes rust-lang/rust#128094 Fixes rust-lang/rust#135128 r? ``````@ghost`````` for perf
2025-07-16Port `#[coverage]` to the new attribute systemSasha Pourcelot-19/+13
2025-07-10Propagate from borrowed locals in CopyPropTomasz Miąsko-20/+6
2025-07-09Auto merge of #142707 - ashivaram23:drop_wildcard, r=dianqkbors-0/+3
Apply effects to `otherwise` edge in dataflow analysis This allows `ElaborateDrops` to remove drops when a `match` wildcard arm covers multiple no-Drop enum variants. It modifies dataflow analysis to update the `MaybeUninitializedPlaces` and `MaybeInitializedPlaces` data for a block reached through an `otherwise` edge. Fixes rust-lang/rust#142705.
2025-07-08Apply effects to otherwise edge in dataflow analysisAmogh Shivaram-0/+3
2025-07-07Rollup merge of #143551 - compiler-errors:root-sub, r=cjgillot许杰友 Jieyou Xu (Joe)-9/+2
Dont resolve instance of root in `mir_callgraph_cyclic` `Instance::try_resolve` on a default trait body method will always fail, since it's still possible to further substitute. This leads to a cycle, since in `tests/mir-opt/inline_default_trait_body.rs`, both `Trait::a` and `Trait::b` need to consider the other to be cyclical, but since we couldn't resolve a body, we'd just consider *nothing* to be cyclical. The root instance we care about when computing `mir_callgraph_cyclic` is trivial to compute (it's just `InstanceKind::Item`), so just replace it with a call to `Instance::new_raw`. r? `@cjgillot` `@oli-obk` Fixes rust-lang/rust#143534
2025-07-06Dont resolve instance of root in mir_callgraph_cyclicMichael Goulet-9/+2
2025-07-06Do not unify borrowed locals in CopyProp.Camille GILLOT-2/+2
2025-07-03Auto merge of #142890 - kornelski:unused-var-debug, r=saethlinbors-2/+4
MIR inliner maintains unused var_debug_info Only `full` debuginfo level promises variable-level debug information, but the MIR inline pass needlessly preserved the local variable debug info for the `limited` level too.
2025-07-03Rollup merge of #134006 - klensy:typos, r=nnethercoteJana Dönszelmann-15/+15
setup typos check in CI This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying? Also includes commits with actual typo fixes. MCP: https://github.com/rust-lang/compiler-team/issues/817 typos check currently turned for: * ./compiler * ./library * ./src/bootstrap * ./src/librustdoc After merging, PRs which enables checks for other crates (tools) can be implemented too. Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr. Check typos: `python x.py test tidy --extra-checks=spellcheck` Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo) Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.