about summary refs log tree commit diff
path: root/src/librustc_mir/transform/check_consts/validation.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-655/+0
2020-08-24hir: consistent use and naming of lang itemsDavid Wood-2/+2
This commit adjusts the naming of various lang items so that they are consistent and don't include prefixes containing the target or "LangItem". In addition, lang item variants are no longer exported from the `lang_items` module. Signed-off-by: David Wood <david@davidtw.co>
2020-08-18Moved coverage counter injection from BasicBlock to Statement.Rich Kadel-0/+1
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-1/+1
2020-07-15InstanceDef::ItemBastian Kauschke-2/+2
2020-07-04ConstCx to LocalDefIdBastian Kauschke-9/+9
2020-07-01Rollup merge of #73778 - nbdd0121:const_likely, r=oli-obkManish Goregaokar-2/+5
Make `likely` and `unlikely` const, gated by feature `const_unlikely` This PR also contains a fix to allow `#[allow_internal_unstable]` to work properly with `#[rustc_const_unstable]`. cc @RalfJung @nagisa r? @oli-obk
2020-06-28Stop checking for `while` and `loop` in a const contextDylan MacKenzie-6/+0
2020-06-28MIR const-checkingDylan MacKenzie-10/+1
2020-06-28Remove `control_flow_destroyed` and properly lower `&&` and `||`Dylan MacKenzie-40/+0
2020-06-27Fix ICE for lib featuresGary Guo-2/+2
2020-06-26Fix allow_internal_unstable with rustc_const_unstableGary Guo-2/+5
2020-06-23Rollup merge of #73515 - christianpoveda:livedrop-diagnostics, r=oli-obkManish Goregaokar-1/+4
Add second message for LiveDrop errors This is an attempt to fix https://github.com/rust-lang/rust/issues/72907 by adding a second message to the `LiveDrop` diagnostics. Changing from this ``` error[E0493]: destructors cannot be evaluated at compile-time --> src/lib.rs:7:9 | 7 | let mut always_returned = None; | ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors error: aborting due to previous error ``` to this ``` error[E0493]: destructors cannot be evaluated at compile-time --> foo.rs:6:9 | 6 | let mut always_returned = None; | ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors ... 10 | always_returned = never_returned; | --------------- value is dropped here error: aborting due to previous error ``` r? @RalfJung @ecstatic-morse
2020-06-19add second message for livedrop errorsChristian Poveda-1/+4
2020-06-16rename location field of Drop terminators to placeRalf Jung-2/+2
2020-06-13Add `CheckLiveDrops` passDylan MacKenzie-0/+6
2020-06-13Make `Qualifs` getters publicDylan MacKenzie-3/+3
2020-06-13Move `check_op` logic to `ops` moduleDylan MacKenzie-22/+7
2020-06-07rename FalseEdges -> FalseEdgeRalf Jung-1/+1
2020-06-01test miri-unleash TLS accessesRalf Jung-5/+1
2020-05-30Make TLS accesses explicit in MIROliver Scherer-5/+7
2020-05-23take mir::PlaceElem by valueBastian Kauschke-1/+1
2020-05-18Add asm! to MIRAmanieu d'Antras-0/+4
2020-05-09Rollup merge of #71942 - nnethercote:shrink-LocalDecl, r=matthewjasperDylan DPC-1/+1
Shrink `LocalDecl` `LocalDecl` contributes 4-8% of peak heap memory usage on a range of benchmarks. This PR reduces its size from 128 bytes to 56 bytes on 64-bit, and does some clean-ups as well. r? @matthewjasper
2020-05-08Rollup merge of #71989 - ecstatic-morse:const-context-enum, r=oli-obkDylan DPC-13/+12
Use a single enum for the kind of a const context This adds a `ConstContext` enum to the `rustc_hir` crate and method that can be called via `tcx.hir()` to get the `ConstContext` for a given body owner. This arose from discussion in #71824. r? @oli-obk
2020-05-07Use `hir::ConstContext` instead of local enumsDylan MacKenzie-13/+12
2020-05-06Shrink `LocalDecl` by 56 bytes.Nicholas Nethercote-1/+1
By boxing `local_info`.
2020-05-04Import dataflow impls via the `impls` submoduleDylan MacKenzie-1/+1
2020-05-03Auto merge of #71631 - RalfJung:miri-unleash-the-gates, r=oli-obkbors-4/+4
Miri: unleash all feature gates IMO it is silly to unleash features that do not even have a feature gate yet, but not unleash features that do. The only thing this achieves is making unleashed mode annoying to use as we have to figure out the feature flags to enable (and not always do the error messages say what that flag is). Given that the point of `-Z unleash-the-miri-inside-of-you` is to debug the Miri internals, I see no good reason for this extra hurdle. I cannot imagine a situation where we'd use that flag, realize the program also requires some feature gate, and then be like "oh I guess if this feature is unstable I will do something else". Instead, we'll always just add that flag to the code as well, so requiring the flag achieves nothing. r? @oli-obk @ecstatic-morse Fixes https://github.com/rust-lang/rust/issues/71630
2020-05-03Reflect API changes on current masterDylan MacKenzie-1/+1
2020-05-03Support backward dataflow analysesDylan MacKenzie-3/+3
2020-05-03warn about each skipped feature gateRalf Jung-7/+1
2020-05-02fix miri-unleash delayed sanity checkingRalf Jung-0/+2
2020-05-02explain why we use def_spanRalf Jung-0/+1
2020-05-02make sure the miri-unleash-flag is not used to circumvent feature gatesRalf Jung-0/+3
2020-04-30Rollup merge of #71688 - ecstatic-morse:const-downcast, r=oli-obkTyler Mandry-4/+1
Allow `Downcast` projections unconditionally in const-checking `ProjectionElem::Downcast` sounds scary, but it's really just the projection we use to access a particular enum variant. They usually appear in the lowering of a `match` statement, so they have been associated with control flow in const-checking, but they don't do any control flow by themselves. We already have a HIR pass that looks for `if` and `match` (even ones that have 1 or fewer reachable branches). That pass is double-checked by a MIR pass that looks for `SwitchInt`s and `FakeRead`s for match scrutinees. In my opinion, there's no need to look for `Downcast` as well. r? @oli-obk
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-4/+2
2020-04-29Allow `Downcast` projections unconditionallyDylan MacKenzie-4/+1
2020-04-28Add `CustomEq` qualifDylan MacKenzie-1/+27
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-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-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-1/+1
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-1/+1
2020-04-23Lazily run dataflow for const qualificationDylan MacKenzie-43/+56
2020-04-23Don't cache result of `in_any_value_of_ty` for localsDylan MacKenzie-53/+51
This was needed by an early version of dataflow-based const qualification where `QualifCursor` needed to return a full `BitSet` with the current state.
2020-04-23Make type alias privateDylan MacKenzie-1/+1