summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2017-12-24Auto merge of #46896 - arielb1:shadow-scope, r=eddybbors-3/+3
fix debuginfo scoping of let-statements r? @eddyb
2017-12-21fix debuginfo scoping of let-statementsAriel Ben-Yehuda-3/+3
2017-12-21Mir: Add Terminatorkind::AbortDavid Henningsson-0/+4
The Abort Terminatorkind will cause an llvm.trap function call to be emitted. Signed-off-by: David Henningsson <diwic@ubuntu.com>
2017-12-20Rollup merge of #46852 - scottmcm:asm-placecontext, r=arielb1kennytm-0/+2
Split PlaceContext::Store into Store & AsmOutput Outputs in InlineAsm can be read-write, so splitting it out is useful for things like Store-Store folding, as that's unsound for a Store-AsmOutput. This PR is intended to make no changes, just be the mechanical split of the enum. Future changes can use the split, like a MIR pass I'm working on and perhaps two-phase borrows (see this FIXME: https://github.com/rust-lang/rust/pull/46852/files#diff-74dcd7740ab2104cd2b9a3b68dd4f208R543)
2017-12-20Auto merge of #46733 - nikomatsakis:nll-master-to-rust-master-5, r=arielb1bors-1518/+1
nll part 5 Next round of changes from the nll-master branch. Extensions: - we now propagate ty-region-outlives constraints out of closures and into their creator when necessary - we fix a few ICEs that can occur by doing liveness analysis (and the resulting normalization) during type-checking - we handle the implicit region bound that assumes that each type `T` outlives the fn body - we handle normalization of inputs/outputs in fn signatures Not included in this PR (will come next): - handling `impl Trait` - tracking causal information - extended errors r? @arielb1
2017-12-19Split PlaceContext::Store into Store & AsmOutputScott McMurray-0/+2
Outputs in InlineAsm can be read-write, so splitting it out is useful for things like Store-Store folding, as it cannot be done for a Store-AsmOutput. This PR is intended to make no changes, just be the mechanical split of the enum. Future changes can use the split, like a MIR pass I'm working on and perhaps two-phase borrows.
2017-12-18Tweak "unecessary unsafe block" error spansEsteban Küber-5/+6
2017-12-15move `type_check` out of `transform` and into the `nll` moduleNiko Matsakis-1518/+1
2017-12-15Auto merge of #46537 - pnkfelix:two-phase-borrows, r=arielb1bors-17/+17
[MIR-borrowck] Two phase borrows This adds limited support for two-phase borrows as described in http://smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/ The support is off by default; you opt into it via the flag `-Z two-phase-borrows` I have written "*limited* support" above because there are simple variants of the simple `v.push(v.len())` example that one would think should work but currently do not, such as the one documented in the test compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs (To be clear, that test is not describing something that is unsound. It is just providing an explicit example of a limitation in the implementation given in this PR. I have ideas on how to fix, but I want to land the work that is in this PR first, so that I can stop repeatedly rebasing this branch.)
2017-12-13add FIXME related to constant well-formednessNiko Matsakis-0/+8
2017-12-13normalize fn sig as part of reificationNiko Matsakis-58/+86
2017-12-13Mir typeck Cast for Unsize valueSantiago Pastorino-1/+10
2017-12-13Mir typeck Cast for ClosureFnPtr valueSantiago Pastorino-3/+15
2017-12-13Mir typeck Cast for UnsafeFnPtr valueSantiago Pastorino-2/+8
2017-12-13Mir typeck Cast for ReifyFnPtr valueSantiago Pastorino-1/+18
2017-12-13Restructure a bit check_aggregate_rvalue codeSantiago Pastorino-35/+35
2017-12-13Add more debug logsSantiago Pastorino-0/+12
2017-12-13Check functions predicatesSantiago Pastorino-2/+42
2017-12-13Check Aggregate predicatesSantiago Pastorino-0/+27
2017-12-13Check NullaryOp RvalueSantiago Pastorino-2/+10
2017-12-13Check Repeat RvalueSantiago Pastorino-3/+50
2017-12-13Revised graphviz rendering API to avoid requiring borrowed state.Felix S. Klock II-17/+17
Made `do_dataflow` and related API `pub(crate)`.
2017-12-07mir-borrowck returns closure requirements, mir-typeck enforcesNiko Matsakis-2/+34
2017-12-07renumber types in `ty::Const` and relate them to `mir::Constant`Niko Matsakis-0/+47
2017-12-07rustc_mir: promote references of statics from other statics.Eduard-Mihai Burtescu-7/+16
2017-12-04Auto merge of #46319 - nikomatsakis:nll-master-to-rust-master-2, r=pnkfelixbors-1342/+78
NLL: improve inference with flow results, represent regions with bitsets, and more This PR begins with a number of edits to the NLL code and then includes a large number of smaller refactorings (these refactorings ought not to change behavior). There are a lot of commits here, but each is individually simple. The goal is to land everything up to but not including the changes to how we handle closures, which are conceptually more complex. The NLL specific changes are as follows (in order of appearance): **Modify the region inferencer's approach to free regions.** Previously, for each free region (lifetime parameter) `'a`, it would compute the set of other free regions that `'a` outlives (e.g., if we have `where 'a: 'b`, then this set would be `{'a, 'b}`). Then it would mark those free regions as "constants" and report an error if inference tried to extend `'a` to include any other region (e.g., `'c`) that is not in that outlives set. In this way, the value of `'a` would never grow beyond the maximum that could type check. The new approach is to allow `'a` to grow larger. Then, after the fact, we check over the value of `'a` and see what other free regions it is required to outlive, and we check that those outlives relationships are justified by the where clauses in scope etc. **Modify constraint generation to consider maybe-init.** When we have a "drop-live" variable `x` (i.e., a variable that will be dropped but will not be otherwise used), we now consider whether `x` is "maybe initialized" at that point. If not, then we know the drop is a no-op, and we can allow its regions to be dead. Due to limitations in the fragment code, this currently only works at the level of entire variables. **Change representation of regions to use a `BitMatrix`.** We used to use a `BTreeSet`, which was rather silly. We now use a MxN matrix of bits, where `M` is the number of variables and `N` is the number of possible elements in each set (size of the CFG + number of free regions). The remaining commits (starting from extract the `implied_bounds` code into a helper function ") are all "no-op" refactorings, I believe. ~~One concern I have is with the commit "with -Zverbose, print all details of closure substs"; this commit seems to include some "internal" stuff in the mir-dump files, such as internal interner numbers, that I fear may vary by platform. Annoying. I guess we will see.~~ (I removed this commit.) As for reviewer, @arielb1 has been reviewing the PRs, and they are certainly welcome to review this one too. But I figured it'd maybe be good to have more people taking a look and being familiar with this code, so I'll "nominate" @pnkfelix . r? @pnkfelix
2017-12-04type_check.rs: rustfmtNiko Matsakis-29/+23
2017-12-04remove unused span from `eq_types` (and rustfmt slightly)Niko Matsakis-12/+3
2017-12-04break type-checking of aggregate-kind out into helper functionNiko Matsakis-45/+52
2017-12-04make `no_late_bound_regions` a method on `Binder<T>`Niko Matsakis-1/+1
2017-12-04inform constraint generation using maybe-initPaul Daniel Faria-1325/+0
In particular, if we see a variable is DROP-LIVE, but it is not MAYBE-INIT, then we can ignore the drop. This leavess attempt to use more complex refinements of the idea (e.g., for subpaths or subfields) to future work.
2017-12-04replace constant regions with a post-inference checkNiko Matsakis-76/+132
Rather than declaring some region variables to be constant, and reporting errors when they would have to change, we instead populate each free region X with a minimal set of points (the CFG plus end(X)), and then we let inference do its thing. This may add other `end(Y)` points into X; we can then check after the fact that indeed `X: Y` holds. This requires a bit of "blame" detection to find where the bad constraint came from: we are currently using a pretty dumb algorithm. Good place for later expansion.
2017-12-04separate out the liveness constraints from the final valueNiko Matsakis-34/+47
It will be useful later for diagnostics to be able to remember where things were live.
2017-12-03Add an i128_lowering flag in TargetOptionsScott McMurray-1/+3
Not actually enabled by default anywhere yet.
2017-12-03Rollup merge of #46462 - sinkuu:copyprop_reg2, r=arielb1Corey Farwell-4/+7
Fix CopyPropagation regression (2) Remaining part of MIR copyprop regression by (I think) #45380, which I missed in #45753. ```rust fn foo(mut x: i32) -> i32 { let y = x; x = 123; // `x` is assigned only once in MIR, but cannot be propagated to `y` y } ``` So any assignment to an argument cannot be propagated.
2017-12-03Auto merge of #46334 - mikhail-m1:slice_pattern_array_drop, r=arielb1bors-0/+14
create a drop ladder for an array if any value is moved out r? @arielb1 first commit for fix https://github.com/rust-lang/rust/issues/34708 (note: this still handles the subslice case in a very broken manner)
2017-12-03Fix MIR CopyPropagation regressionShotaro Yamada-4/+7
2017-12-03funnel all unwind paths through a single Resume blockAriel Ben-Yehuda-34/+1
This simplifies analysis and borrow-checking because liveness at the resume point can always be simply propagated. Later on, the "dead" Resumes are removed.
2017-12-03add a pass to remove no-op landing padsAriel Ben-Yehuda-17/+144
2017-12-02create a drop ladder for an array if any value is moved outMikhail Modin-0/+14
2017-12-01MIR: s/lv(al(ue)?)?/place in function/variable/module names.Eduard-Mihai Burtescu-203/+201
2017-12-01MIR: s/Lvalue/Place in type names.Eduard-Mihai Burtescu-163/+163
2017-11-30Auto merge of #46299 - michaelwoerister:incr-comp-krimskrams, r=nikomatsakisbors-8/+11
incr.comp.: Some preparatory work for caching more query results. This PR * adds and updates some encoding/decoding routines for various query result types so they can be cached later, and * adds missing `[input]` annotations for a few `DepNode` variants. The situation around having to explicitly mark dep-nodes/queries as inputs is not really satisfactory. I hope we can find a way of making this more fool-proof in the future. r? @nikomatsakis
2017-11-30Auto merge of #46226 - arielb1:special-region-obligation, r=nikomatsakisbors-3/+10
avoid type-live-for-region obligations on dummy nodes Type-live-for-region obligations on DUMMY_NODE_ID cause an ICE, and it turns out that in the few cases they are needed, these obligations are not needed anyway because they are verified elsewhere. Fixes #46069. Beta-nominating because this is a regression for our new beta. r? @nikomatsakis
2017-11-28incr.comp.: Make a bunch of query results encodable.Michael Woerister-6/+9
2017-11-28incr.comp.: Make MIR encoding fit for incr.comp. caching.Michael Woerister-2/+2
2017-11-28rustc_mir: require that Copy(L) satisfies typeof L: Copy.Eduard-Mihai Burtescu-6/+23
2017-11-28MIR: split Operand::Consume into Copy and Move.Eduard-Mihai Burtescu-24/+40
2017-11-28rustc_mir: enforce that arguments are replaced with Local's only.Eduard-Mihai Burtescu-41/+14
2017-11-26improve error messagesAriel Ben-Yehuda-23/+30