about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform
AgeCommit message (Collapse)AuthorLines
2024-02-12Dejargnonize substShoyu Vanilla-32/+30
2024-02-12remove a bunch of dead parameters in fnyukang-13/+6
2024-02-11Auto merge of #120619 - compiler-errors:param, r=lcnrbors-4/+1
Assert that params with the same *index* have the same *name* Found this bug when trying to build libcore with the new solver, since it will canonicalize two params with the same index into *different* placeholders if those params differ by name.
2024-02-11is_closure_likeMichael Goulet-2/+2
2024-02-11Check that the ABI of the instance we are inlining is correctMichael Goulet-0/+12
2024-02-11Auto merge of #120405 - cjgillot:gvn-pointer, r=oli-obkbors-19/+115
Fold pointer operations in GVN This PR proposes 2 combinations of cast operations in MIR GVN: - a chain of `PtrToPtr` or `MutToConstPointer` casts can be folded together into a single `PtrToPtr` cast; - we attempt to evaluate more ptr ops when there is no provenance. In particular, this allows to read from static slices. This is not yet sufficient to see through slice operations that use `PtrComponents` (because that's a union), but still a step forward. r? `@ghost`
2024-02-10Auto merge of #117206 - cjgillot:jump-threading-default, r=tmiaskobors-479/+1
Enable MIR JumpThreading by default Mostly for perf r? `@ghost`
2024-02-10validation: descend from consts into staticsRalf Jung-3/+4
2024-02-10Remove unnecessary `min_specialization` after bootstrapZalathar-1/+1
These crates all needed specialization for `newtype_index!`, which will no longer be necessary when the current nightly eventually becomes the next bootstrap compiler.
2024-02-09Remove ConstGoto and SeparateConstSwitch.Camille GILLOT-478/+0
2024-02-09Enable by default.Camille GILLOT-1/+1
2024-02-09Remove untested arithmetic ops.Camille GILLOT-19/+5
2024-02-09Const-prop pointers.Camille GILLOT-0/+13
2024-02-09Split gvn wide ptr tests.Camille GILLOT-0/+3
2024-02-09Compute binary ops between pointers in GVN.Camille GILLOT-6/+60
2024-02-09Compute unsizing casts in GVN.Camille GILLOT-0/+10
2024-02-09Fold consecutive PtrToPtr casts.Camille GILLOT-13/+43
2024-02-09Auto merge of #120843 - matthiaskrgr:rollup-med37z5, r=matthiaskrgrbors-4/+5
Rollup of 8 pull requests Successful merges: - #113671 (Make privacy visitor use types more (instead of HIR)) - #120308 (core/time: avoid divisions in Duration::new) - #120693 (Invert diagnostic lints.) - #120704 (A drive-by rewrite of `give_region_a_name()`) - #120809 (Use `transmute_unchecked` in `NonZero::new`.) - #120817 (Fix more `ty::Error` ICEs in MIR passes) - #120828 (Fix `ErrorGuaranteed` unsoundness with stash/steal.) - #120831 (Startup objects disappearing from sysroot) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-09Rollup merge of #120817 - compiler-errors:more-mir-errors, r=oli-obkMatthias Krüger-2/+5
Fix more `ty::Error` ICEs in MIR passes Fixes #120791 - Add a check for `ty::Error` in the `ByMove` coroutine pass Fixes #120816 - Add a check for `ty::Error` in the MIR validator Also a drive-by fix for a FIXME I had asked oli to add r? oli-obk
2024-02-09Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwcoMatthias Krüger-2/+0
Invert diagnostic lints. That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted. r? ````@davidtwco````
2024-02-09Auto merge of #120594 - saethlin:delayed-debug-asserts, r=oli-obkbors-0/+39
Toggle assert_unsafe_precondition in codegen instead of expansion The goal of this PR is to make some of the unsafe precondition checks in the standard library available in debug builds. Some UI tests are included to verify that it does that. The diff is large, but most of it is blessing mir-opt tests and I've also split up this PR so it can be reviewed commit-by-commit. This PR: 1. Adds a new intrinsic, `debug_assertions` which is lowered to a new MIR NullOp, and only to a constant after monomorphization 2. Rewrites `assume_unsafe_precondition` to check the new intrinsic, and be monomorphic. 3. Skips codegen of the `assume` intrinsic in unoptimized builds, because that was silly before but with these checks it's *very* silly 4. The checks with the most overhead are `ptr::read`/`ptr::write` and `NonNull::new_unchecked`. I've simply added `#[cfg(debug_assertions)]` to the checks for `ptr::read`/`ptr::write` because I was unable to come up with any (good) ideas for decreasing their impact. But for `NonNull::new_unchecked` I found that the majority of callers can use a different function, often a safe one. Yes, this PR slows down the compile time of some programs. But in our benchmark suite it's never more than 1% icount, and the average icount change in debug-full programs is 0.22%. I think that is acceptable for such an improvement in developer experience. https://github.com/rust-lang/rust/issues/120539#issuecomment-1922687101
2024-02-09Don't ICE in ByMoveBody when coroutine is taintedMichael Goulet-2/+5
2024-02-08Rollup merge of #120782 - oli-obk:track_errors8, r=WaffleLapkinMatthias Krüger-0/+1
Fix mir pass ICE in the presence of other errors fixes #120779 it is impossible to add a ui test for this, because it only reproduces in build-fail, but a test that also has errors in check-fail mode can't be made build-fail 🙃 I would have to add a run-make test or sth, which is overkill for such a tiny thing imo.
2024-02-08Rollup merge of #120778 - zetanumbers:refactor_try_instance_mir, ↵Matthias Krüger-15/+10
r=compiler-errors Deduplicate `tcx.instance_mir(instance)` calls in `try_instance_mir`
2024-02-08Rollup merge of #120590 - compiler-errors:dead, r=NilstriebMatthias Krüger-7/+2
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.
2024-02-08Add a new debug_assertions instrinsic (compiler)Ben Kimock-0/+14
And in clippy
2024-02-08InstSimplify rustc_nounwind callsBen Kimock-0/+25
2024-02-08Fix mir pass ICE in the presence of other errorsOli Scherer-0/+1
2024-02-08Deduplicate `tcx.instance_mir(instance)` calls in `try_instance_mir`zetanumbers-15/+10
2024-02-08Auto merge of #120767 - matthiaskrgr:rollup-0k8ib1c, r=matthiaskrgrbors-2/+2
Rollup of 9 pull requests Successful merges: - #119592 (resolve: Unload speculatively resolved crates before freezing cstore) - #120103 (Make it so that async-fn-in-trait is compatible with a concrete future in implementation) - #120206 (hir: Make sure all `HirId`s have corresponding HIR `Node`s) - #120214 (match lowering: consistently lower bindings deepest-first) - #120688 (GVN: also turn moves into copies with projections) - #120702 (docs: also check the inline stmt during redundant link check) - #120727 (exhaustiveness: Prefer "`0..MAX` not covered" to "`_` not covered") - #120734 (Add `SubdiagnosticMessageOp` as a trait alias.) - #120739 (improve pretty printing for associated items in trait objects) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-08Continue to borrowck even if there were previous errorsOli Scherer-0/+1
2024-02-08Rollup merge of #120688 - cjgillot:gvn-partial-move, r=oli-obkMatthias Krüger-2/+2
GVN: also turn moves into copies with projections Fixes https://github.com/rust-lang/rust/issues/120613
2024-02-07Stop using is_copy_modulo_regions when building clone shimMichael Goulet-4/+1
2024-02-07Rollup merge of #120733 - klensy:trait-const-fn, r=oli-obkGuillaume Boisseau-10/+2
MirPass: make name more const Continues #120161, this time applied to `MirPass` instead of `MirLint`, locally shaves few (very few) instructions off. r? ``@cjgillot``
2024-02-07Rollup merge of #120564 - Zalathar:increment-site, r=oli-obkGuillaume Boisseau-80/+79
coverage: Split out counter increment sites from BCB node/edge counters This makes it possible for two nodes/edges in the coverage graph to share the same counter, without causing the instrumentor to inject unwanted duplicate counter-increment statements. --- ````@rustbot```` label +A-code-coverage
2024-02-07MirPass: make name more constklensy-10/+2
2024-02-06Fix drop shim for AsyncFnOnce closure, AsyncFnMut shim for AsyncFn closureMichael Goulet-26/+111
2024-02-06More comments, final tweaksMichael Goulet-1/+12
2024-02-06Construct body for by-move coroutine closure outputMichael Goulet-0/+135
2024-02-06Build a shim to call async closures with different AsyncFn trait kindsMichael Goulet-1/+122
2024-02-06Teach typeck/borrowck/solvers how to deal with async closuresMichael Goulet-2/+5
2024-02-06Add CoroutineClosure to TyKind, AggregateKind, UpvarArgsMichael Goulet-5/+14
2024-02-06Invert diagnostic lints.Nicholas Nethercote-2/+0
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-02-05Also turn moves into copies even if through projections.Camille GILLOT-2/+2
2024-02-05coverage: Make `fn_sig_span` optional, and note its quirksZalathar-11/+17
2024-02-05coverage: Hoist special handling of async function spansZalathar-26/+30
This sidesteps the normal span refinement code in cases where we know that we are only dealing with the special signature span that represents having called an async function.
2024-02-05coverage: Make unexpansion of closure bodies more preciseZalathar-18/+12
This improves the coverage instrumentation of closures declared in macros, as seen in `closure_macro.rs` and `closure_macro_async.rs`.
2024-02-02Remove dead args from functionsMichael Goulet-7/+2
2024-02-03Use `DiagnosticArgName` in a few more places.Nicholas Nethercote-1/+1
2024-02-02coverage: Split out counter increment sites from BCB node/edge countersZalathar-80/+79
This makes it possible for two nodes/edges in the coverage graph to share the same counter, without causing the instrumentor to inject unwanted duplicate counter-increment statements.