Niko Matsakis
85e1d4749e
propagate type tests from closure to closure creators
...
Currently, we only propagate type tests that exclude all regions from
the type.
2017-12-15 10:27:51 -05:00
Niko Matsakis
5804637a81
permit ClosureOutlivesRequirement
to constrain regions or types
2017-12-15 10:27:51 -05:00
Niko Matsakis
c7cfa2367b
thread through an implicit region body of the fn body
2017-12-15 10:27:50 -05:00
Niko Matsakis
02e65250e4
mild refactors of the control flow (no functional changes)
...
In the future, `check_type_tests` will also potentially propagate
constriants to its caller.
2017-12-15 10:27:49 -05:00
Niko Matsakis
47c1921b9a
move some parts of liveness to happen during type checking
...
This allows us to re-use the `normalize` method on `TypeCheck`, which
is important since normalization may create fresh region
variables. This is not an ideal solution, though, since the current
representation of "liveness constraints" (a vector of (region, point)
pairs) is rather inefficient. Could do somewhat better by converting
to indices, but it'd still be less good than the older code. Unclear
how important this is.
2017-12-15 10:27:49 -05:00
Niko Matsakis
4a940b3215
move flow_in_progress
into dataflow
and document it
2017-12-15 10:27:46 -05:00
Niko Matsakis
ebd086b67f
move LivenessResults
from nll
into liveness
analysis
2017-12-15 10:10:57 -05:00
Niko Matsakis
1c57468840
move type_check
out of transform
and into the nll
module
2017-12-15 10:10:57 -05:00
Niko Matsakis
fad3d1d7fd
dfs.rs: rustfmt
2017-12-15 10:10:56 -05:00
Niko Matsakis
6193c5cc2a
translate Verify
s into TypeTest
s and check them
2017-12-15 10:10:56 -05:00
Niko Matsakis
cd564d20ff
only propagate ClosureRegionRequirements if non-trivial
...
Before, we would always have a `Some` ClosureRegionRequirements if we
were inferring values for a closure. Now we only do is it has a
non-empty set of outlives requirements.
2017-12-15 10:10:56 -05:00
Niko Matsakis
a0f0392a6d
rename copy
to dfs
and make it customizable
2017-12-15 10:10:55 -05:00
Niko Matsakis
86334c7116
remove unnecessary intermediate vector from copy
2017-12-15 10:10:55 -05:00
Niko Matsakis
abd6d0d76e
comments for defining_ty
and compute_indices
...
Plus an extra assertion.
2017-12-13 12:20:28 -05:00
Niko Matsakis
75ac071cd6
document return value of add_live_point
2017-12-13 12:20:28 -05:00
Niko Matsakis
7a20a3f161
change to use an O(1) data structure for looking up point indices
...
Converting a `RegionElementIndex` to a `Location` is O(n) though could
trivially be O(log n), but we don't do it that much anyhow -- just on
error and debugging.
2017-12-13 12:20:28 -05:00
Niko Matsakis
77663a677d
refactor region value bitmatrix
2017-12-13 12:20:27 -05:00
Niko Matsakis
7f20b9142d
fix universal regions to handle constant expressions like [T; 22]
2017-12-13 06:03:25 -05:00
Ariel Ben-Yehuda
5a3f7cdcc7
move FlowAtLocation to be a dataflow abstraction
...
We can now use it in e.g. drop elaboration if we want to.
2017-12-10 17:46:31 +02:00
Ariel Ben-Yehuda
157231183c
start extracting things into modules
...
The borrow_check module is too big for its own good
2017-12-10 17:46:29 +02:00
Niko Matsakis
1db58d7fa5
rename Binder::new_not_binding
to Binder::dummy
...
per pnkfelix's suggestion
2017-12-07 05:28:04 -05:00
Niko Matsakis
d5ef3e262f
replace InferCtxt::fn_sig
with closure_sig
2017-12-07 05:28:01 -05:00
Niko Matsakis
05441abd2b
add closure requirement tests, improve debugging output
...
The overall format is now easier to read. Also, There is now graphviz
output, as well as a `#[rustc_regions]` annotation that dumps internal
state.
2017-12-07 05:28:00 -05:00
Niko Matsakis
ab1c1bc6bc
mir-borrowck returns closure requirements, mir-typeck enforces
2017-12-07 05:28:00 -05:00
Niko Matsakis
e5dc4ba280
renumber types in ty::Const
and relate them to mir::Constant
2017-12-07 05:27:03 -05:00
Niko Matsakis
a6adc74e87
adopt longer
and shorter
rather than fr
and outlived_fr
2017-12-04 11:30:39 -05:00
Niko Matsakis
a3935961f0
region_infer: Fix typo in comment
2017-12-04 10:36:54 -05:00
Niko Matsakis
243bf3f718
rename "free region" to "universally quantified region"
...
This has been bugging me. All the regions appear free in the source;
the real difference is that some of them are universally quantified
(those in the function signature) and some are existentially
quantified (those for which we are inferring values).
2017-12-04 09:14:38 -05:00
Niko Matsakis
e9067bd5cc
MIR dump: restructure pretty to be more extensible by other code
2017-12-04 09:14:37 -05:00
Niko Matsakis
49d2274cfe
constraint_generation: create liveness constraints more thoroughly
...
We now visit just the stuff in the CFG, and we add liveness
constraints for all the random types, regions etc that appear within
rvalues and statements.
2017-12-04 09:14:35 -05:00
Niko Matsakis
663e7a4f08
promote region_infer into its own module
2017-12-04 08:51:13 -05:00
Niko Matsakis
abd7d88139
move free_regions_map
into infer::outlives
2017-12-04 08:51:12 -05:00
Zack M. Davis
22b31758ec
region_infer: BitMatrix representation of region values
...
This should be more efficient than allocating two BTreeSets for every
region variable?—as it is written in #45670 .
2017-12-04 08:51:11 -05:00
Paul Daniel Faria
a9cb25b23a
inform constraint generation using maybe-init
...
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-04 08:51:11 -05:00