summary refs log tree commit diff
path: root/src/librustc_mir/dataflow
AgeCommit message (Collapse)AuthorLines
2019-02-10rustc: doc commentsAlexander Regueiro-31/+24
2019-02-08librustc_mir => 2018Taiki Endo-62/+63
2019-01-30Pass correct arguments to places_conflictMatthew Jasper-1/+1
The borrow place *must* be a place that we track borrows for, otherwise we will likely ICE.
2018-12-28Remove unnecessary borrow generationMatthew Jasper-14/+0
2018-12-25Remove licensesMark Rousskov-111/+0
2018-12-20Auto merge of #56741 - RalfJung:retag-to-raw, r=oli-obkbors-2/+0
treat ref-to-raw cast like a reborrow: do a special kind of retag r? @oli-obk Cc @nikomatsakis
2018-12-20Auto merge of #56649 - davidtwco:issue-46589, r=pnkfelixbors-125/+162
MIR borrowck doesn't accept the example of iterating and updating a mutable reference Fixes #46589. r? @pnkfelix or @nikomatsakis
2018-12-18treat ref-to-raw cast like a reborrow: do a special kind of retagRalf Jung-2/+0
2018-12-17Add required lifetime parameter to BitDenotation.David Wood-115/+121
This avoids all sorts of confusing issues with using both `dest_place` and `self` in the `propagate_call_return` function in the `BitDenotation` implementation for `Borrows`.
2018-12-17Kill borrows from a projection after assignment.David Wood-23/+54
This commit extends previous work to kill borrows from a local after assignment into that local to kill borrows from a projection after assignment into a prefix of that place.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-8/+8
2018-12-06Rollup merge of #56500 - ljedrz:cleanup_rest_of_const_lifetimes, r=zackmdavisPietro Albini-2/+2
cleanup: remove static lifetimes from consts A follow-up to https://github.com/rust-lang/rust/pull/56497.
2018-12-05Rollup merge of #56388 - matthewjasper:more-lexical-mir-cleanup, r=nikomatsakisPietro Albini-8/+1
More MIR borrow check cleanup * Fix some rustc doc links * Remove the `region_map` field from `BorrowSet` * Use `visit_local` to find 2PB activations r? @nikomatsakis
2018-12-04cleanup: remove static lifetimes from constsljedrz-2/+2
2018-12-01remove some uses of try!Mark Mansi-1/+1
2018-11-30Remove the `region_map` field from `BorrowSet`Matthew Jasper-8/+1
2018-11-18Only handle ReVar regions in NLL borrowckMatthew Jasper-82/+9
Now that lexical MIR borrowck is gone, there's no need to store Regions unnecessarily.
2018-11-18Remove mir::StatementKind::EndRegionMatthew Jasper-6/+1
Since lexical MIR borrow check is gone, and validation no longer uses these, they can be removed.
2018-11-15Auto merge of #55716 - RalfJung:escape-to-raw, r=oli-obkbors-1/+3
Add escape-to-raw MIR statement Add a new MIR "ghost state statement": Escaping a ptr to permit raw accesses. ~~This includes #55549, [click here](https://github.com/RalfJung/rust/compare/miri-visitor...RalfJung:escape-to-raw) for just the new commits.~~
2018-11-11Auto merge of #55657 - davidtwco:issue-55651, r=pnkfelixbors-0/+14
NLL Diagnostic Review 3: Unions not reinitialized after assignment into field Fixes #55651, #55652. This PR makes two changes: First, it updates the dataflow builder to add an init for the place containing a union if there is an assignment into the field of that union. Second, it stops a "use of uninitialized" error occuring when there is an assignment into the field of an uninitialized union that was previously initialized. Making this assignment would re-initialize the union, as tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`. The check for previous initialization ensures that we do not start supporting partial initialization yet (cc #21232, #54499, #54986). This PR also fixes #55652 which was marked as requiring investigation as the changes in this PR add an error that was previously missing (and mentioned in the review comments) and confirms that the error that was present is correct and a result of earlier partial initialization changes in NLL. r? @pnkfelix (due to earlier work with partial initialization) cc @nikomatsakis
2018-11-07no more action on ref or cast, but add new MIR statement for escaping a ptr ↵Ralf Jung-1/+3
to raw
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-2/+2
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-06refactor: use shorthand fieldsteresy-2/+2
2018-11-03Unions reinitialized after assignment into field.David Wood-0/+14
This commit makes two changes: First, it updates the dataflow builder to add an init for the place containing a union if there is an assignment into the field of that union. Second, it stops a "use of uninitialized" error occuring when there is an assignment into the field of an uninitialized union that was previously initialized. Making this assignment would re-initialize the union, as tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`. The check for previous initialization ensures that we do not start supporting partial initialization yet (cc #21232, #54499, #54986).
2018-11-02Auto merge of #55087 - levex:e0669-improve-span, r=nagisabors-1/+1
rustc: improve E0669 span E0669 refers to an operand that cannot be coerced into a single LLVM value, unfortunately right now this uses the Span for the entire inline assembly statement, which is less than ideal. This commit preserves the Span from HIR, which lets us emit the error using the Span for the operand itself in MIR. r? @nagisa cc/ @parched
2018-11-02Auto merge of #55316 - RalfJung:retagging, r=oli-obkbors-2/+2
Add Retagging statements This adds a `Retag` statement kind to MIR, used to perform the retagging operation from [Stacked Borrows](https://www.ralfj.de/blog/2018/08/07/stacked-borrows.html). It also kills the old `Validate` statements that I added last year. NOTE: This includes https://github.com/rust-lang/rust/pull/55270. Only [these commits are new](https://github.com/RalfJung/rust/compare/stacked-borrows-ng...RalfJung:retagging).
2018-11-01Use `SmallVec` within `MoveData`.Nicholas Nethercote-9/+10
This reduces allocation counts significantly in a few benchmarks, reducing instruction counts by up to 2%.
2018-10-29Emit Retag statements, kill Validate statementsRalf Jung-2/+2
Also "rename" -Zmir-emit-validate to -Zmir-emit-retag, which is just a boolean (yes or no).
2018-10-22Replace the `run_passes!` macro with a regular functionWesley Wiser-15/+0
As suggested in the feedback for #55244. When I replaced the macro with a function, rustc started complaining that there were two unused functions so I also removed those.
2018-10-19Prefer `Default::default` over `FxHash*::default` in struct constructorsOliver Scherer-2/+1
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-3/+3
2018-10-17rustc: improve E0669 spanLevente Kurusa-1/+1
E0669 refers to a constraint that cannot be coerced into a single LLVM value, unfortunately right now this uses the Span for the entire inline assembly statement, which is less than ideal. This commit preserves the Span from HIR, which lets us emit the error using the Span for the operand itself in MIR. Signed-off-by: Levente Kurusa <lkurusa@acm.org>
2018-10-05Remove graphviz::IntoCowljedrz-3/+2
2018-10-03Record whether a Call in MIR corresponds to a call in HIRMatthew Jasper-2/+8
2018-09-24Shrink StatementKind::InlineAsm.Nicholas Nethercote-1/+1
This shrinks StatementKind from 64 bytes to 48 bytes on 64-bit.
2018-09-24Shrink StatementKind::Assign.Nicholas Nethercote-1/+1
This shrinks StatementKind from 80 bytes to 64 bytes on 64-bit.
2018-09-22Auto merge of #54188 - lqd:fallout-53695, r=nikomatsakisbors-2/+2
NLL: disallow creation of immediately unusable variables Fix #53695 Original description follows ---- This WIP PR is for discussing the impact of fixing #53695 by injecting a fake read in let patterns. (Travis will fail, at least the `mir-opt` suite is failing in its current state)
2018-09-22Rollup merge of #54370 - nnethercote:better-domain_size, r=nikomatsakisPietro Albini-3/+3
Improve handling of type bounds in `bit_set.rs`. Currently, `BitSet` doesn't actually know its own domain size; it just knows how many words it contains. We can make it better.
2018-09-20Auto merge of #54255 - spastorino:use-of-moved-value-error, r=nikomatsakisbors-0/+14
Inspect parents paths when checking for moves Closes #52669
2018-09-20Improve handling of type bounds in `bit_set.rs`.Nicholas Nethercote-3/+3
Currently, `BitSet` doesn't actually know its own domain size; it just knows how many words it contains. To improve things, this commit makes the following changes. - It changes `BitSet` and `SparseBitSet` to store their own domain size, and do more precise bounds and same-size checks with it. It also changes the signature of `BitSet::to_string()` (and puts it within `impl ToString`) now that the domain size need not be passed in from outside. - It uses `derive(RustcDecodable, RustcEncodable)` for `BitSet`. This required adding code to handle `PhantomData` in `libserialize`. - As a result, it removes the domain size from `HybridBitSet`, making a lot of that code nicer. - Both set_up_to() and clear_above() were overly general, working with arbitrary sizes when they are only needed for the domain size. The commit removes the former, degeneralizes the latter, and removes the (overly general) tests. - Changes `GrowableBitSet::grow()` to `ensure()`, fixing a bug where a (1-based) domain size was confused with a (0-based) element index. - Changes `BitMatrix` to store its row count, and do more precise bounds checks with it. - Changes `ty_params` in `select.rs` from a `BitSet` to a `GrowableBitSet` because it repeatedly failed the new, more precise bounds checks. (Changing the type was simpler than computing an accurate domain size.) - Various other minor improvements.
2018-09-18Refactor 'ReadForMatch' into 'FakeRead' and add the cause of the fake readRemy Rakic-2/+2
2018-09-18Auto merge of #54286 - nnethercote:BitSet, r=pnkfelixbors-116/+109
Merge `bitvec.rs` and `indexed_set.rs` Because it's not good to have two separate implementations. Also, I will combine the best parts of each to improve NLL memory usage on some benchmarks significantly.
2018-09-18Eliminate `BitwiseOperator`.Nicholas Nethercote-30/+28
`BitwiseOperator` is an unnecessarily low-level thing. This commit replaces it with `BitSetOperator`, which works on `BitSet`s instead of words. Within `bit_set.rs`, the commit eliminates `Intersect`, `Union`, and `Subtract` by instead passing a function to `bitwise()`.
2018-09-18Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.Nicholas Nethercote-89/+84
Currently we have two files implementing bitsets (and 2D bit matrices). This commit combines them into one, taking the best features from each. This involves renaming a lot of things. The high level changes are as follows. - bitvec.rs --> bit_set.rs - indexed_set.rs --> (removed) - BitArray + IdxSet --> BitSet (merged, see below) - BitVector --> GrowableBitSet - {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet - BitMatrix --> BitMatrix - SparseBitMatrix --> SparseBitMatrix The changes within the bitset types themselves are as follows. ``` OLD OLD NEW BitArray<C> IdxSet<T> BitSet<T> -------- ------ ------ grow - grow new - (remove) new_empty new_empty new_empty new_filled new_filled new_filled - to_hybrid to_hybrid clear clear clear set_up_to set_up_to set_up_to clear_above - clear_above count - count contains(T) contains(&T) contains(T) contains_all - superset is_empty - is_empty insert(T) add(&T) insert(T) insert_all - insert_all() remove(T) remove(&T) remove(T) words words words words_mut words_mut words_mut - overwrite overwrite merge union union - subtract subtract - intersect intersect iter iter iter ``` In general, when choosing names I went with: - names that are more obvious (e.g. `BitSet` over `IdxSet`). - names that are more like the Rust libraries (e.g. `T` over `C`, `insert` over `add`); - names that are more set-like (e.g. `union` over `merge`, `superset` over `contains_all`, `domain_size` over `num_bits`). Also, using `T` for index arguments seems more sensible than `&T` -- even though the latter is standard in Rust collection types -- because indices are always copyable. It also results in fewer `&` and `*` sigils in practice.
2018-09-17Inspect parents paths when checking for movesSantiago Pastorino-0/+14
2018-09-15Make rustc::middle::region::Scope's fields publicMarshall Bowers-1/+4
2018-09-15Auto merge of #54177 - nnethercote:streamline-bit-stuff, r=Mark-Simulacrumbors-7/+8
Remove bitslice.rs As the comment in `bitslice.rs` says: > FIXME: merge with `bitvec`
2018-09-14Remove `Iter` and `SparseIter` in indexed_set.rs.Nicholas Nethercote-3/+4
Because they're just thin wrappers around `BitIter` and `slice::Iter`.
2018-09-13Remove bitslice.rs.Nicholas Nethercote-4/+4
This requires the following changes. - It moves parts of bitslice.rs into bitvec.rs: `bitwise()`, `BitwiseOperator`, `bits_to_string()`. - It changes `IdxSet` to just be a wrapper around `BitArray`. - It changes `BitArray` and `BitVec` to use `usize` words instead of `u128` words. (`BitSlice` and `IdxSet` already use `usize`.) Local profiling showed `usize` was better. - It moves some operations from `IdxSet` into `BitArray`: `new_filled()`, `clear()`, `set_up_to()`, `trim_to()` (renamed `clear_above()`), `words()` and `words_mut()`, `encode()` and `decode(). The `IdxSet` operations now just call the `BitArray` operations. - It replaces `BitArray`'s iterator implementation with `IdxSet`'s, because the latter is more concise. It also removes the buggy `size_hint` function from `BitArray`'s iterator, which counted the number of *words* rather than the number of *bits*. `IdxSet`'s iterator is now just a thin wrapper around `BitArray`'s iterator. - It moves some unit tests from `indexed_set.rs` to `bitvec.rs`.
2018-09-10add the `AscribeUserType` statement kindNiko Matsakis-2/+2
Make it have the semantics of subtype.