summary refs log tree commit diff
path: root/src/librustc_mir/dataflow
AgeCommit message (Collapse)AuthorLines
2020-01-13Don't suppress move errors for union fieldsMatthew Jasper-9/+22
2019-12-11more privateMark Mansi-8/+4
2019-12-11fix importsMark Mansi-6/+8
2019-12-09Remove `uniform_array_move_out` passesMatthew Jasper-38/+93
These passes were buggy, MIR building is now responsible for canonicalizing `ConstantIndex` projections and `MoveData` is responsible for splitting `Subslice` projections.
2019-12-09Make const index and subslice array projections more usefulMatthew Jasper-4/+5
* `min_length` is now exact for const index elements. * const index elements are always from the start. * make array `Subslice` `PlaceElems` count both `from` and `to` from the start.
2019-12-05rustc: Apply clearer naming to BodyAndCache, fix Deref impl, remove unneeded ↵Paul Daniel Faria-3/+3
Index impl, remove body fn rustc_codegen_ssa: Fix BodyAndCache reborrow to Body and change instances of body() call to derefence rustc_mir: Fix BodyAndCache reborrow to Body and change intances of body() call to derefence
2019-12-02Remove HasLocalDecls impl from BodyCache's, properly reborrow to Body, ↵Paul Daniel Faria-17/+17
rename all body_cache back to body
2019-12-02Fix tidy errorsPaul Daniel Faria-1/+3
2019-12-02Simplify BodyCache impl and fix all remaining type errors in librustc_mir ↵Paul Daniel Faria-4/+4
(lifetime errors still exist)
2019-12-02Add predecessors fn to ReadOnlyBodyCache, fix more Body -> ↵Paul Daniel Faria-11/+11
(ReadOnly)BodyCache type errors
2019-12-02Stop invalidating predecessors cache when accessing unique basic block, ↵Paul Daniel Faria-1/+1
invalidate cache when accessing unique terminator
2019-11-21Track pointers to statics in MIRMatthew Jasper-1/+3
2019-10-22Move Place::elem methods and friends to TyCtxtSantiago Pastorino-1/+1
2019-10-22Intern place projectionSantiago Pastorino-3/+3
2019-10-22Pattern match over PlaceRef rather than PlaceSantiago Pastorino-3/+5
This prepares the code base for when projection is interned. Place's projection field is going to be `&List<PlaceElem<'tcx>>` so we won't be able to pattern match against it.
2019-10-15Rollup merge of #65389 - ecstatic-morse:zero-sized-array-no-drop, r=eddybTyler Mandry-13/+4
Return `false` from `needs_drop` for all zero-sized arrays. Resolves #65348. This changes the result of the `needs_drop` query from `true` to `false` for types such as `[Box<i32>; 0]`. I believe this change to be sound because a zero-sized array can never actually hold a value. This is an elegant way of resolving #65348 and #64945, but obviously it has much broader implications.
2019-10-13Remove special case for zero-sized arrays from indirectly mut localsDylan MacKenzie-13/+4
2019-10-13ast: remove implicit pprust dependency via Display.Mazdak Farrokhzad-3/+3
Instead just use `pprust::path_to_string(..)` where needed. This has two benefits: a) The AST definition is now independent of printing it. (Therefore we get closer to extracting a data-crate.) b) Debugging should be easier as program flow is clearer.
2019-10-07Auto merge of #61430 - matthewjasper:drop-on-into-panic, r=oli-obkbors-8/+30
Make `into` schedule drop for the destination closes #47949
2019-10-02Do not mark unitinitialized locals as requiring storageMatthew Jasper-8/+30
2019-10-02Rollup merge of #64967 - ecstatic-morse:issue-64945, r=oli-obkMazdak Farrokhzad-15/+31
Don't mark borrows of zero-sized arrays as indirectly mutable Resolves #64945 r? @oli-obk
2019-10-01Update example table to match current outputDylan MacKenzie-19/+19
2019-10-01Reset row background for each blockDylan MacKenzie-0/+1
Now the first row of each basic block is always light instead of changing seemingly at random.
2019-10-01Don't mark zero-sized arrays as indirectly mutable when borrowedDylan MacKenzie-15/+31
2019-09-30Add graphviz debug output for generic dataflowDylan MacKenzie-5/+510
2019-09-30Allow `ResultsCursor` to borrow the underlying `Results`Dylan MacKenzie-8/+16
2019-09-30Fix typo in docsDylan MacKenzie-1/+1
2019-09-29remove indexed_vec re-export from rustc_data_structurescsmoe-11/+11
2019-09-29remove bit_set re-export from rustc_data_structurescsmoe-5/+5
2019-09-28Correct `IndirectlyMutableLocals` docsDylan MacKenzie-8/+4
2019-09-28Give usage instructions `IndirectlyMutableLocals` docsDylan MacKenzie-3/+7
2019-09-28Explain why `visit_terminator` does nothing for `IndirectlyMutableLocals`Dylan MacKenzie-0/+3
2019-09-28Don't treat locals as mutably borrowed after they're droppedDylan MacKenzie-12/+5
2019-09-28Add analysis to determine if a local is indirectly mutableDylan MacKenzie-4/+157
This adds a dataflow analysis that determines if a reference to a given `Local` or part of a `Local` that would allow mutation exists before a point in the CFG. If no such reference exists, we know for sure that that `Local` cannot have been mutated via an indirect assignment or function call.
2019-09-27Remove global_tcx from TyCtxtMark Rousskov-2/+1
The non-global context was removed; there's only one context now. This is a noop method that only serves to confuse readers -- remove it.
2019-09-25Rename `sty` to `kind`varkor-3/+3
2019-09-19Rollup merge of #64566 - ecstatic-morse:generic-dataflow, r=oli-obkMazdak Farrokhzad-0/+513
A more generic interface for dataflow analysis #64470 requires a transfer function that is slightly more complex than the typical `gen`/`kill` one. Namely, it must copy state bits between locals when assignments occur (see #62547 for an attempt to make this fit into the existing framework). This PR contains a dataflow interface that allows for arbitrary transfer functions. The trade-off is efficiency: we can no longer coalesce transfer functions for blocks and must visit each statement individually while iterating to fixpoint. Another issue is that poorly behaved transfer functions can result in an analysis that fails to converge. `gen`/`kill` sets do not have this problem. I believe that, in order to guarantee convergence, flipping a bit from `false` to `true` in the entry set cannot cause an output bit to go from `true` to `false` (negate all preceding booleans when `true` is the bottom value). Perhaps someone with a more formal background can confirm and we can add a section to the docs? This approach is not maximally generic: it still requires that the lattice used for analysis is the powerset of values of `Analysis::Idx` for the `mir::Body` of interest. This can be done at a later date. Also, this is the bare minimum to get #64470 working. I've not adapted the existing debug framework to work with the new analysis, so there are no `rustc_peek` tests either. I'm planning to do this after #64470 is merged. Finally, my ultimate plan is to make the existing, `gen`/`kill`-based `BitDenotation` a special case of `generic::Analysis`. Currently they share a ton of code. I should be able to do this without changing any implementers of `BitDenotation`. Something like: ```rust struct GenKillAnalysis<A: BitDenotation> { trans_for_block: IndexVec<BasicBlock, GenKillSet<A::Idx>>, analysis: A, } impl<A> generic::Analysis for GenKillAnalysis<A> { // specializations of `apply_{partial,whole}_block_effect`... } ``` r? @pnkfelix
2019-09-18Rollup merge of #64532 - ecstatic-morse:dataflow-cursor-get, r=tmandryTyler Mandry-26/+2
Replace `state_for_location` with `DataflowResultsCursor` These are two different ways of getting the same data from the result of a dataflow analysis. However, `state_for_location` goes quadratic if you try to call it for every statement in the body.
2019-09-18Rollup merge of #64207 - sinkuu:pub_dataflow, r=tmandryTyler Mandry-9/+9
Make rustc_mir::dataflow module pub (for clippy) I'm working on fixing false-positives of a MIR-based clippy lint (https://github.com/rust-lang/rust-clippy/pull/4509), and in need of the dataflow infrastructure.
2019-09-18Fix bug where `is_call_return_effect_applied` was never setDylan MacKenzie-0/+1
2019-09-18Add summary of the current state and future plansDylan MacKenzie-0/+18
2019-09-18Publish `rustc_mir::dataflow` and remove `#[allow(unused)]`Dylan MacKenzie-5/+0
2019-09-18Fix typoDylan MacKenzie-1/+1
2019-09-18Use an associated const for `name`Dylan MacKenzie-2/+2
2019-09-18Fix `Analysis` exampleDylan MacKenzie-2/+4
2019-09-17Add ignore reason to placate `tidy`Dylan MacKenzie-1/+1
2019-09-17Temporarily add `#[allow(unused)]` for CIDylan MacKenzie-0/+2
This can be removed once dataflow-based const validation is merged.
2019-09-17Document new dataflow analysisDylan MacKenzie-0/+50
2019-09-17Add generic dataflow implDylan MacKenzie-0/+445
2019-09-16Remove `dataflow::state_for_location`Dylan MacKenzie-28/+0