summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
AgeCommit message (Collapse)AuthorLines
2022-06-21Auto merge of #95576 - DrMeepster:box_erasure, r=oli-obkbors-10/+270
Remove dereferencing of Box from codegen Through #94043, #94414, #94873, and #95328, I've been fixing issues caused by Box being treated like a pointer when it is not a pointer. However, these PRs just introduced special cases for Box. This PR removes those special cases and instead transforms a deref of Box into a deref of the pointer it contains. Hopefully, this is the end of the Box<T, A> ICEs.
2022-06-20Rollup merge of #98267 - compiler-errors:suggest-wildcard-arm, r=oli-obkMatthias Krüger-2/+2
Don't omit comma when suggesting wildcard arm after macro expr * Also adds `Span::eq_ctxt` to consolidate the various usages of `span.ctxt() == other.ctxt()` * Also fixes an unhygenic usage of spans which caused the suggestion to render weirdly when we had one arm match in a macro * Also always suggests a comma (i.e. even after a block) if we're rendering a wildcard arm in a single-line match (looks prettier :rose:) Fixes #94866
2022-06-20Rollup merge of #98235 - liuw:mir-gen-drop-magic-value, r=davidtwcoMatthias Krüger-2/+6
Drop magic value 3 from code Magic value 3 is used to create state for a yield point. It is in fact the number of reserved variants. Lift RESERVED_VARIANTS out to module scope and use it instead.
2022-06-20Drop magic value 3 from codeWei Liu-2/+6
Magic value 3 is used to create state for a yield point. It is in fact the number of reserved variants. Lift RESERVED_VARIANTS out to module scope and use it instead.
2022-06-19Use `Span::eq_ctxt` method instead of `.ctxt() == .ctxt()`Michael Goulet-2/+2
2022-06-19Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-seMatthias Krüger-2/+2
once cell renamings This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128 - Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}` - Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}` (I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc) ```@rustbot``` label +T-libs-api -T-libs
2022-06-17Auto merge of #97863 - JakobDegen:bitset-choice, r=nnethercotebors-1/+2
`BitSet` related perf improvements This commit makes two changes: 1. Changes `MaybeLiveLocals` to use `ChunkedBitSet` 2. Overrides the `fold` method for the iterator for `ChunkedBitSet` I have local benchmarks verifying that each of these changes individually yield significant perf improvements to #96451 . I'm hoping this will be true outside of that context too. If that is not the case, I'll try to gate things on where they help as needed r? `@nnethercote` who I believe was working on closely related things, cc `@tmiasko` because of the destprop pr
2022-06-16Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`Maybe Waffle-2/+2
2022-06-15fix box derefs in var debug infoDrMeepster-0/+31
2022-06-15condense duplicate code into seperate functionsDrMeepster-22/+45
2022-06-15fix typos & docsDrMeepster-6/+7
2022-06-15remove box derefs from codgenDrMeepster-10/+215
2022-06-14`BitSet` perf improvementsJakob Degen-1/+2
This commit makes two changes: 1. Changes `MaybeLiveLocals` to use `ChunkedBitSet` 2. Overrides the `fold` method for the iterator for `ChunkedBitSet`
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-23/+20
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-5/+5
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-06-12Auto merge of #98018 - scottmcm:miri-yeet, r=RalfJungbors-0/+1
Try out `yeet` in the MIR interpreter Since we got a new bootstrap, we can give this a shot. r? `@oli-obk`
2022-06-11Try out `yeet` in the MIR interpreterScott McMurray-0/+1
2022-06-12Remove duplicated implementations of borrowed locals analysisTomasz Miąsko-133/+8
2022-06-09Auto merge of #97740 - RalfJung:ctfe-cycle-spans, r=lcnrbors-10/+19
use precise spans for recursive const evaluation This fixes https://github.com/rust-lang/rust/issues/73283 by using a `TyCtxtAt` with a more precise span when the interpreter recursively calls itself. Hopefully such calls are sufficiently rare that this does not cost us too much performance. (In theory, cycles can also arise through layout computation, as layout can depend on consts -- but layout computation happens all the time so we'd have to do something to not make this terrible for performance.)
2022-06-08Rollup merge of #97597 - tmiasko:simplify-locals-side-effects, ↵Dylan DPC-3/+7
r=RalfJung,JakobDegen Preserve unused pointer to address casts Fixes #97421. cc `@RalfJung`
2022-06-07Preserve unused pointer to address castsTomasz Miąsko-3/+7
2022-06-07Remove `AlwaysLiveLocals` wrapper structTomasz Miąsko-5/+5
It is just a wrapper around a `BitSet` and doesn't have any functionality of its own.
2022-06-05Auto merge of #97697 - WaffleLapkin:no_ref_vec, r=WaffleLapkinbors-19/+17
Replace `&Vec<_>`s with `&[_]`s It's generally preferable to use `&[_]` since it's one less indirection and it can be created from types other that `Vec`. I've left `&Vec` in some locals where it doesn't really matter, in cases where `TypeFoldable` is expected (`TypeFoldable: Clone` so slice can't implement it) and in cases where it's `&TypeAliasThatIsActiallyVec`. Nothing important, really, I was just a little annoyed by `visit_generic_param_vec` :D r? `@compiler-errors`
2022-06-04const_prop_lint: ensure we have up-to-date cur_span()Ralf Jung-10/+19
2022-06-04Rollup merge of #97696 - cjgillot:normalize-inline, r=compiler-errorsMatthias Krüger-10/+15
Do not ICE when failing to normalize during inlining. Fixes https://github.com/rust-lang/rust/issues/97695
2022-06-03Do not ICE when failing to normalize during inlining.Camille GILLOT-10/+15
2022-06-03Replace `&Vec<_>`s with `&[_]`sMaybe Waffle-19/+17
2022-05-31Add a pointer to address cast kindTomasz Miąsko-2/+2
A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.
2022-05-30validate derefer, run derefer inside generatorouz-a-52/+65
2022-05-28Make TyCtxt implement Interner, make HashStable generic and move to ↵Michael Goulet-2/+2
rustc_type_ir
2022-05-28Initial fixes on top of type interner commitMichael Goulet-2/+4
2022-05-24Add dead store elimination passJakob Degen-1/+151
2022-05-23Refactor call terminator to always hold a destination placeJakob Degen-98/+92
2022-05-23Rollup merge of #97292 - compiler-errors:tcxify-rustc, r=davidtwcoDylan DPC-17/+8
Lifetime variance fixes for rustc #97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime. This is doable, since many lifetimes are already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`. Split out from #97287 so the compiler team can review independently.
2022-05-22Lifetime variance fixes for rustcMichael Goulet-17/+8
2022-05-22Remove box syntax from rustc_mir_dataflow and rustc_mir_transformest31-5/+5
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-4/+3
2022-05-19Rollup merge of #97142 - SparrowLii:inline, r=tmiaskoDylan DPC-28/+27
move processing of `source_scope_data` into `MutVisitor`'s impl of `Integrator` when inline This PR fixes the FIXME in the inline mir-opt which moves processing of `source_scope_data` into `MutVisitor`'s impl of `Integrator` when inline
2022-05-19Auto merge of #97103 - luqmana:asm-unwind-cleanup, r=Amanieu,tmiaskobors-2/+9
Update MIR passes to handle unwinding Inline Asm Some more follow up fixes from https://github.com/rust-lang/rust/pull/95864#issuecomment-1094165398 r? `@Amanieu`
2022-05-18Update MIR passes that assumed inline can never unwind.Luqman Aden-2/+9
2022-05-18move processing of `source_scope_data` into `MutVisitor`'s impl of ↵SparrowLii-28/+27
Integrator when inline mir-opt
2022-05-17Auto merge of #97111 - JohnTitor:rollup-x3vjf6u, r=JohnTitorbors-10/+10
Rollup of 7 pull requests Successful merges: - #96329 (Add a couple tests for #90887 fixes) - #97009 (Allow `unused_macro_rules` in path tests) - #97075 (Add regression test for #81804) - #97079 (Change `Successors` to `impl Iterator<Item = BasicBlock>`) - #97080 (remove the `RelateResultCompare` trait) - #97093 (Migrate `maybe_recover_from_bad_type_plus` diagnostic) - #97102 (Update function pointer call error message) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-17Rollup merge of #97079 - SparrowLii:successors, r=lcnrYuki Okushi-10/+10
Change `Successors` to `impl Iterator<Item = BasicBlock>` This PR fixes the FIXME in `compiler\rustc_middle\src\mir\mod.rs`. This can omit several `&`, `*` or `cloned` operations on Successros' generated elements
2022-05-17Auto merge of #97012 - oli-obk:🦀_intrinsics, r=davidtwcobors-5/+2
Add a query for checking whether a function is an intrinsic. work towards #93145 This will reduce churn when we add more ways to declare intrinsics r? `@scottmcm`
2022-05-17Auto merge of #96825 - kckeiks:remove-item-like-visitor-trait, r=cjgillotbors-1/+1
Retire `ItemLikeVisitor` trait Issue #95004 cc `@cjgillot`
2022-05-17Change `Successors` to `impl Iterator<Item = BasicBlock>`SparrowLii-10/+10
2022-05-16Add a query for checking whether a function is an intrinsic.Oli Scherer-5/+2
2022-05-14Auto merge of #96883 - jackh726:early-binder-2, r=oli-obkbors-13/+15
Add EarlyBinder Chalk has no concept of `Param` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L579) or `ReEarlyBound` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L1308). Everything is just "bound" - the equivalent of rustc's late-bound. It's not completely clear yet whether to move everything to the same time of binder in rustc or add `Param` and `ReEarlyBound` in Chalk. Either way, tracking when we have or haven't already substituted out these in rustc can be helpful. As a first step, I'm just adding a `EarlyBinder` newtype that is required to call `subst`. I also add a couple "transparent" `bound_*` wrappers around a couple query that are often immediately substituted. r? `@nikomatsakis`
2022-05-14Auto merge of #95826 - carbotaniuman:miri-permissive-provenance, r=RalfJungbors-3/+20
Initial work on Miri permissive-exposed-provenance Rustc portion of the changes for portions of a permissive ptr-to-int model for Miri. The main changes here are changing `ptr_get_alloc` and `get_alloc_id` to return an Option, and also making ptr-to-int casts have an expose side effect.
2022-05-13Add bound_fn_sigJack Huey-4/+4