Esteban Küber
1820da5211
Move diagnostic logic to its own module
...
- Move specialized borrow checker diagnostic for bindings escaping its
closure to its own module.
- Move affected tests to `ui`.
2018-01-15 11:12:25 -08:00
Niko Matsakis
d201e83f71
renumber regions in the generator interior
...
Fixes #47189 .
2018-01-11 06:05:05 -05:00
Niko Matsakis
bf02c57b16
simplify UniversalRegions::to_region_vid
to just consult the map
...
This doesn't actually fix the bug, but seems better.
2018-01-11 06:05:05 -05:00
Niko Matsakis
00ce7eed7d
resolve type and region variables in "NLL dropck"
...
Fixes #47022 .
2018-01-10 10:15:08 -05:00
bors
0a3761e63e
Auto merge of #46984 - arielb1:pre-statement-effect, r=nikomatsakis
...
NLL fixes
First, introduce pre-statement effects to dataflow to fix #46875 . Edge dataflow effects might make that redundant, but I'm not sure of the best way to integrate them with liveness etc., and if this is a hack, this is one of the cleanest hacks I've seen.
And I want a small fix to avoid the torrent of bug reports.
Second, fix linking of projections to fix #46974
r? @pnkfelix
2018-01-03 21:06:21 +00:00
Ariel Ben-Yehuda
bd1bd76cd8
fix linking of place projections
...
projections other than dereferences of `&mut` used to do no linking. Fix
that.
Fixes #46974 .
2017-12-24 14:56:52 +02:00
David Henningsson
dd6127e4af
Mir: Add Terminatorkind::Abort
...
The Abort Terminatorkind will cause an llvm.trap function call to be
emitted.
Signed-off-by: David Henningsson <diwic@ubuntu.com>
2017-12-21 04:43:27 +01:00
Niko Matsakis
d925f4d1dd
fix truncated comment
2017-12-20 16:51:33 -05:00
Santiago Pastorino
95b6148e31
Add nll_dump_cause helper to Session
2017-12-20 14:38:12 -05:00
Niko Matsakis
508a831dca
use report_generic_bound_failure
when we can in the compiler
2017-12-20 14:38:12 -05:00
Niko Matsakis
6b39781df6
connect NLL machinery to the NiceRegionError
code
2017-12-20 14:38:12 -05:00
Niko Matsakis
e28d03f38b
only dump causes if we have nothing better
2017-12-20 14:38:11 -05:00
Santiago Pastorino
3a185a510d
Add three point error handling to borrowck
...
Closes #45988
2017-12-20 14:38:10 -05:00
Niko Matsakis
93afb1affc
connect NLL type checker to the impl trait code
...
We now add the suitable `impl Trait` constraints.
2017-12-20 14:04:52 -05:00
Niko Matsakis
da63aaa7ab
extract input_output
code into its own module
...
No functional change.
2017-12-20 14:04:52 -05:00
Niko Matsakis
a66c6512aa
pass UniversalRegions
to MIR type-checker instead of fields
...
No functional change.
2017-12-20 14:04:52 -05:00
Niko Matsakis
4a967c9df7
propagate region_bound_pairs
into MIR type-check
2017-12-20 14:04:51 -05:00
Niko Matsakis
fe89f4ba86
get the DefiningTy
from the body_owner_kind
not type
...
The type isn't a good idea because we want to treat constants
uniformly, regardless of what type of value they produce.
2017-12-20 14:04:51 -05:00
Niko Matsakis
0e64a756f8
integrate -Znll-dump-cause into borrowck
2017-12-20 14:04:51 -05:00
Niko Matsakis
594c386549
dump out causal information for "free region" errors
...
The result is not especially illuminating, but that's ok.
2017-12-20 14:04:51 -05:00
Paul Daniel Faria
e447b54bc3
Add tracking of causes for nll
2017-12-20 14:04:50 -05:00
Niko Matsakis
f6741d0a7a
region_infer/values.rs: rustfmt
2017-12-20 14:04:50 -05:00
Niko Matsakis
1816ede386
be specific about what kind of normalization we mean
2017-12-19 04:28:45 -05:00
Niko Matsakis
3d826e5681
remove dead is_foo_free_region
helpers
...
Only `is_local_free_region` is used.
2017-12-19 04:26:56 -05:00
Niko Matsakis
3c56c3610e
fix comment on check_type_tests
2017-12-19 04:21:57 -05:00
Niko Matsakis
03bfb0f316
tweak comment on TypeTest
to be more accurate
2017-12-19 04:18:15 -05:00
Niko Matsakis
4f43c5b1e7
stop dumping DefPath into "failed type test" errors
...
The prior messages were not stable across platforms.
2017-12-15 17:04:48 -05:00
Niko Matsakis
0f8ef0ca1a
more concise debug output when dumping the value of a region
2017-12-15 10:27:54 -05:00
Niko Matsakis
0d6bd42abb
make blame_span
deterministic
2017-12-15 10:27:54 -05:00
Niko Matsakis
e9824c50ed
impose inputs/ouputs on MIR after the fact
...
The input/output types found in `UniversalRegions` are not normalized.
The old code used to assign them directly into the MIR, which would
lead to errors when there was a projection in a argument or return
type. This also led to some special cases in the `renumber` code.
We now renumber uniformly but then pass the input/output types into
the MIR type-checker, which equates them with the types found in MIR.
This allows us to normalize at the same time.
2017-12-15 10:27:53 -05:00
Niko Matsakis
3fcb13ae45
handle projections with regions
2017-12-15 10:27:52 -05:00
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