about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2020-04-30deduplicate warningsRalf Jung-1/+1
2020-04-30unleashed Miri: open all the gatesRalf Jung-3/+3
2020-04-30Add a convenience function for testing whether a static is `#[thread_local]`Oliver Scherer-5/+3
2020-04-30Auto merge of #70175 - Amanieu:remove_nlp, r=pnkfelixbors-3/+6
Remove -Z no-landing-pads flag Since #67502, `-Z no-landing-pads` will cause all attempted unwinds to abort since we don't generate a `try` / `catch`. This previously worked because `__rust_try` was located in libpanic_unwind which is always compiled with `-C panic=unwind`, but `__rust_try` is now directly inline into the crate that uses `catch_unwind`. As such, `-Z no-landing-pads` is now mostly useless and people should use `-C panic=abort` instead.
2020-04-29Allow `Unreachable` terminators unconditionallyDylan MacKenzie-7/+3
2020-04-29Allow `Downcast` projections unconditionallyDylan MacKenzie-18/+2
2020-04-29Auto merge of #67343 - ecstatic-morse:qualif-structural-match, r=pnkfelixbors-7/+73
Const qualification for `StructuralEq` Furthers #62411. Resolves #62614. The goal of this PR is to implement the logic in #67088 on the MIR instead of the HIR. It uses the `Qualif` trait to track `StructuralPartialEq`/`StructuralEq` in the final value of a `const`. Then, if we encounter a constant during HAIR lowering whose value may not be structurally matchable, we emit the `indirect_structural_match` lint. This PR contains all the tests present in #67088 and emits the proper warnings for the corner cases. This PR does not handle #65466, which would require that we be [more aggressive](https://github.com/rust-lang/rust/blob/42abbd8878d3b67238f3611b0587c704ba94f39c/src/librustc_mir_build/hair/pattern/const_to_pat.rs#L126-L130) when checking matched types for `PartialEq`. I think that should be done separately. Because this works on MIR and uses dataflow, this PR should accept more cases than #67088. Notably, the qualifs in the final value of a const are encoded cross-crate, so matching on a constant whose value is defined in another crate to be `Option::<TyWithCustomEqImpl>::None` should work. Additionally, if a `const` has branching/looping, we will only emit the warning if any possible control flow path could result in a type with a custom `PartialEq` impl ending up as the final value of a `const`. I'm not sure how #67088 handled this. AFAIK, it's not settled that these are the semantics we actually want: it's just how the `Qualif` framework happens to work. If the cross-crate part is undesirable, it would be quite easy to change the result of `mir_const_qualif().custom_eq` to `true` before encoding it in the crate metadata. This way, other crates would have to assume that all publicly exported constants may not be safe for matching. r? @pnkfelix cc @eddyb
2020-04-29Auto merge of #71518 - felix91gr:const_prop_bugfix_just_block_prop, ↵bors-21/+70
r=wesleywiser Const-prop bugfix: only add propagation inside own block for user variables A testing spinoff of #71298. This one only adds the const-prop for locals that are user variables.
2020-04-29Remove Session::no_landing_pads()Amanieu d'Antras-3/+6
2020-04-28Add `CustomEq` qualifDylan MacKenzie-1/+63
2020-04-28Pass `Substs` to `in_adt_inherently`Dylan MacKenzie-6/+10
2020-04-28Rollup merge of #71615 - RalfJung:share-machine-code, r=oli-obkDylan DPC-56/+4
share some common code for compile-time miri instances Fixes https://github.com/rust-lang/rust/issues/71129 r? @oli-obk
2020-04-28Use the query system to allocate.Camille GILLOT-7/+7
2020-04-28Introduce ArenaStorage.Camille GILLOT-2/+2
2020-04-28Polished documentation, removed not-so-useful-anymore traces, and added some ↵Félix Fischer-6/+13
doc comments in `mir/transform/const_prop.rs`
2020-04-28Allow Locals to be propagated into and from, but restricted to their own blockFélix Fischer-13/+46
2020-04-27Blocked `MutatingUseContext::Projection` for all locals of kind ↵Félix Fischer-4/+13
`LocalKind::Temp`. Added a cache of `LocalKind`s to `CanConstProp`
2020-04-27Accept `LocalDefId` as key for `mir_validated` querymarmeladema-8/+12
2020-04-27Accept `LocalDefId` as key for `mir_borrowck` querymarmeladema-2/+2
2020-04-27Return a `FxHashSet<LocalDefId>` from `mir_keys` querymarmeladema-7/+8
2020-04-27Use `LocalDefId` in `mir_built` querymarmeladema-3/+7
2020-04-27Use `LocalDefId` in `unsafety_check_result` querymarmeladema-12/+10
2020-04-27share some common code for compile-time miri instancesRalf Jung-56/+4
2020-04-27Auto merge of #71268 - estebank:devectorize, r=eddybbors-2/+1
Remove some `Vec` allocations to improve performance This claws back most of the performance lost in https://github.com/rust-lang/rust/pull/69745. r? @eddyb
2020-04-27Auto merge of #70073 - wesleywiser:mir_opt_level_0, r=oli-obkbors-53/+79
Don't run various MIR optimizations at mir-opt-level=0 Add missing checks for mir-opt-level to non-essential MIR passes. I verified that this can still bootstrap even with these passes disabled. r? @oli-obk cc @RalfJung
2020-04-26Rollup merge of #71551 - gizmondo:gen-index-vec, r=jonas-schievinkDylan DPC-21/+13
Minor refactoring around IndexVec usage in generator transformation Replace hash map with IndexVec for liveness data. Utilize IndexVec::push return value to avoid redundant object creation. r? @eddyb
2020-04-26Rollup merge of #71562 - matthiaskrgr:cl7ppy, r=Dylan-DPCDylan DPC-2/+2
fix more clippy warnings clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats} r? @Dylan-DPC
2020-04-26fix more clippy warningsMatthias Krüger-2/+2
clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}
2020-04-26Rollup merge of #70043 - mark-i-m:def-kind-more, r=eddybDylan DPC-4/+1
Add all remaining `DefKind`s. r? @eddyb or @Centril ~~I'm not sure if this is what you were thinking of. There are also a few places where I'm not sure what the correct choice is because I don't fully understand the meaning of some variants.~~ ~~In general, it feels a bit odd to add some of these as `DefKind`s (e.g. `Arm`) because they don't feel like definitions. Are there things that it makes sense not to add?~~
2020-04-25Rollup merge of #71544 - cuviper:filter_map_next, r=Mark-SimulacrumDylan DPC-2/+1
Replace filter_map().next() calls with find_map() These are semantically the same, but `find_map()` is more concise.
2020-04-25Replace hash map with IndexVec for liveness data.Alex Aktsipetrov-21/+13
Utilize IndexVec::push to avoid redundant object creation.
2020-04-25Rollup merge of #71533 - pnkfelix:revert-70566-for-const-validation-fix, ↵Dylan DPC-5/+5
r=Dylan-DPC Revert PR 70566 for const validation fix This is a port of PR #71441 but ported to the master branch, as discussed in [yesterday's T-compiler meeting](https://zulip-archive.rust-lang.org/131828tcompiler/88751weeklymeeting2020042354818.html#195065903)
2020-04-24Replace filter_map().next() calls with find_map()Josh Stone-2/+1
These are semantically the same, but `find_map()` is more concise.
2020-04-25Rollup merge of #71527 - ecstatic-morse:debug-check-consts, r=Dylan-DPCDylan DPC-10/+1
Miscellaneous cleanup in `check_consts` Just changes `RUSTC_LOG` output.
2020-04-25Rollup merge of #71330 - ecstatic-morse:const-qualif-lazy, r=oli-obkDylan DPC-72/+83
Only run dataflow for const qualification if type-based check would fail This is the optimization discussed in https://github.com/rust-lang/rust/issues/49146#issuecomment-614012476. We wait for `Qualif::in_any_value_of_ty` to return `true` before running dataflow. For bodies that deal mostly with primitive types, this will avoid running dataflow at all during const qualification. This also removes the `BitSet` used to cache `in_any_value_of_ty` for each local, which was only necessary for an old version of #64470 that also handled promotability.
2020-04-24Revert "Move early needs_subst bailout to _after_ linting."Ralf Jung-5/+5
This reverts commit 99492e41b60f21f2f461e8131605e054020d328e.
2020-04-24Remove unused `visit_local`Dylan MacKenzie-9/+0
2020-04-24Use `debug` to print illegal operations in a const contextDylan MacKenzie-1/+1
2020-04-24Remove `Option` from the return type of `def_kind`.Eduard-Mihai Burtescu-4/+1
2020-04-24Don't run various MIR optimizations at mir-opt-level=0Wesley Wiser-53/+79
Add missing checks for mir-opt-level to non-essential MIR passes.
2020-04-24Auto merge of #70820 - spastorino:replace-fragile-erroneous-const-sys, r=oli-obkbors-27/+62
Replace fragile erroneous const sys Closes #67191 r? @oli-obk
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-16/+12
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-26/+28
2020-04-23librustc_middle: return LocalDefId instead of DefId in local_def_idmarmeladema-1/+1
2020-04-23Import RequiredConstsVisitorSantiago Pastorino-2/+2
2020-04-23Rename uneval_consts to required_constsSantiago Pastorino-35/+37
2020-04-23Clean up fragile checks of optimized away constantsSantiago Pastorino-25/+10
2020-04-23Make ConstPropagator only visit basic blocks when visiting bodySantiago Pastorino-0/+6
Avoid exercising unevaluated constants and go straight to visit the blocks.
2020-04-23Make inlining carry over unevaluated constsSantiago Pastorino-1/+9
2020-04-23Add MirPass to collect Unevaluated consts in MIR bodySantiago Pastorino-1/+35