Commit Graph

107 Commits

Author SHA1 Message Date
csmoe 64f61c7888 remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
Albin Stjerna 28312b5b06 Rustfmt the files I touched 2019-09-04 10:52:03 +02:00
Albin Stjerna 9f39e001df Polonius: Rename `parent` and `var_starts_path` 2019-09-04 09:46:44 +02:00
Albin Stjerna 6b09477e91 Polonius: emit initialization/move tracking facts
- var_starts_path
- parent
- initialized_at
- moved_out_at

This also switches to the intended emission of `var_drop_used` fact emission,
where that fact is always emitted on a drop-use of a variable, regardless of its
initialization status, as Polonius now handles that.
2019-09-04 09:46:44 +02:00
Albin Stjerna 996ba932cc NLL: Adapt to the new Polonius types 2019-09-04 09:44:40 +02:00
Wesley Wiser 73814654b2 Move promoted out of mir::Body 2019-08-22 06:36:30 -04:00
Oliver Scherer 7710820d18 Fiddle param env through to `try_eval_bits` in most places 2019-08-05 17:48:05 +02:00
Albin Stjerna ac0a3d106b polonius: add generation of liveneness-related facts
Notably contains an ugly hack to generate initialization information for
variables that will go away when we have that functionality in Polonius.
2019-07-12 22:48:02 +02:00
Niko Matsakis eca55b58d6 rename to "member constraints" 2019-07-02 12:25:22 -04:00
Niko Matsakis 3b5a7276d2 construct pick-constraints and give them to region inference 2019-07-02 12:15:20 -04:00
Niko Matsakis d9596692a5 implement PickConstraintSet type 2019-07-02 12:15:20 -04:00
Eduard-Mihai Burtescu f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
Jad Ghalayini 80ff07f30d Changed usages of `mir` in librustc::mir and librustc_mir to `body` 2019-06-09 16:05:05 -04:00
Claude-Alban RANÉLY-VERGÉ-DÉPRÉ 6e5e0daff2 Changes the type `mir::Mir` into `mir::Body`
The commit should have changed comments as well.
At the time of writting, it passes the tidy and check tool.

Revisions asked by eddyb :
- Renamed of all the occurences of {visit/super}_mir
- Renamed test structures `CachedMir` to `Cached`

Fixing the missing import on `AggregateKind`
2019-05-28 19:17:51 +02:00
Nicholas Nethercote fb084a48e2 Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions. 2019-05-13 09:29:22 +10:00
Eduard-Mihai Burtescu 61fcbfcd59 rustc_mir: don't rely on mir::UpvarDecl in the MIR borrowck. 2019-04-23 17:27:54 +03:00
Albin Stjerna c440c0a0fd update polonius-engine 2019-04-10 22:44:07 +02:00
Lucas Molas d6ede9192d nll: remove `NllLivenessMap` and `LiveVar`
Extract the `compute` logic (now renamed `compute_live_locals`) from
`NllLivenessMap` to the `liveness` module. Remove the unused structures.
2019-02-15 21:40:24 -03:00
Ralf Jung 544b3a1bb4 fix rebase fallout 2019-02-09 12:19:04 +01:00
Taiki Endo d2514523db Use real try blocks 2019-02-08 20:08:08 +09:00
Taiki Endo 725af30809 librustc_mir => 2018 2019-02-08 06:28:15 +09:00
David Wood 162dcdc16f
Add user type annotations to MIR dump.
This commit writes the user type annotations to the MIR dump so that
they are visible again.
2018-12-30 14:30:58 +01:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
bors 817dda7df0 Auto merge of #56649 - davidtwco:issue-46589, r=pnkfelix
MIR borrowck doesn't accept the example of iterating and updating a mutable reference

Fixes #46589.

r? @pnkfelix or @nikomatsakis
2018-12-20 07:22:15 +00:00
David Wood 7b628e18a3
Add required lifetime parameter to BitDenotation.
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-17 17:26:24 +01:00
John Kåre Alsaker a70babed03 Use a function to access the Hir map to be able to turn it into a query later 2018-12-06 17:24:36 +01:00
Niko Matsakis 784746f57e convert placeholder region vids in NLL mode as we see them 2018-10-27 08:41:12 -04:00
Niko Matsakis 018c515f07 move `PlaceholderIndices` into `MirTypeckRegionConstraints` struct 2018-10-27 08:41:12 -04:00
Matthew Jasper 2a3969a3f7 Use new region infer errors for explaining borrows
This gives at least some explanation for why a borrow is expected to
last for a certain free region. Also:

* Reports E0373: "closure may outlive the current function" with NLL.
* Special cases the case of returning a reference to (or value
  referencing) a local variable or temporary (E0515).
* Special case assigning a reference to a local variable in a closure
  to a captured variable.
2018-10-21 12:35:00 +01:00
ljedrz d28aed6dc4 Prefer unwrap_or_else to unwrap_or in case of function calls/allocations 2018-10-19 09:45:45 +02:00
Matthew Jasper 825810734b Improve closure region bound errors
Now use the category and span that are associated to the most
interesting bound that led to the closure bound.
2018-10-06 10:00:26 +01:00
Niko Matsakis cdb95b0f21 build up the placeholder indices as we go
Avoids a linear walk over the regions at the end.
2018-10-04 11:02:40 -04:00
Matthew Jasper 4603fb8862 Rework checking for borrows conflicting with drops
Previously, we would split the drop access into multiple checks for each
field of a struct/tuple/closure and through `Box` dereferences. This
changes this to check if the borrow is accessed by the drop in
places_conflict.

This also allows us to handle enums in a simpler way, since we don't
have to construct any new places.
2018-09-23 20:27:41 +01:00
Niko Matsakis db169e53e5 move `annotate` onto a method of `UniversalRegions`
This allows it to print out the "late-bound regions" from the closure
context more easily. Besides, all the state that is being printed it
is private to the `UniversalRegions`.
2018-09-07 17:08:21 -04:00
bors a8c11d216b Auto merge of #53575 - matthewjasper:unsized-is-an-error, r=estebank
Don't reduce E0161 to a warning in NLL migrate mode

This error has been on stable for a while, and allowing such code cause the compile to later ICE (since we can't codegen it). Errors `box UNSIZED EXPR` with unsized locals because it's not compatible with the current evaluation order (create the box before evaluating the expressions).

cc #53469 (fixes the ICE in this case)
cc @qnighy
2018-09-06 21:02:35 +00:00
Niko Matsakis 12f50a6e75 implement liveness tracing, remove old liveness system 2018-08-27 13:57:55 -04:00
Matthew Jasper b83fe42237 Hard error for unsized values more often
* Sized checking in MIR should be a hard error in all borrowck modes
* box operands should be an error even with unsized locals
2018-08-22 21:36:10 +01:00
Scott McMurray 9e64ce1799 Parse try blocks with the try keyword instead of do catch placeholder 2018-08-19 16:53:05 -07:00
Niko Matsakis d1ce8e846b move `liveness_map` into the `liveness` module 2018-08-07 14:52:59 -04:00
Niko Matsakis fb1702f301 compute liveness later 2018-08-07 14:52:59 -04:00
Niko Matsakis 67c96edce6 revert #52991 2018-08-06 09:00:08 -04:00
Niko Matsakis 2e2ea26a83 remove unused tcx argument 2018-08-05 07:42:18 +02:00
Niko Matsakis e79656c5b7 support `X = &*Y` reborrows 2018-08-03 08:15:55 +02:00
Niko Matsakis 341a07c4c3 compute union-find of locals flowing into the output of statics
Co-authored-by: lqd <remy.rakic+github@gmail.com>
Co-authored-by: nikomatsakis <niko@alum.mit.edu>
2018-08-02 22:02:59 +03:00
Niko Matsakis d1e67fcacd remove universal-region-relation computation from universal_regions 2018-07-31 02:31:40 +02:00
Niko Matsakis 3bca170bc7 introduce, but do not use, `free_region_relation` computation
This duplicates, effectively, existing code in the universal regions
computation.
2018-07-31 02:26:06 +02:00
Niko Matsakis b913df06f2 remove `num_universal_regions` etc from RegionValueElements 2018-07-25 06:38:22 +03:00
Niko Matsakis 2fda456ddf extract `region_value_str` helper 2018-07-25 06:38:21 +03:00
Niko Matsakis f277b394af generate extra liveness constraints before regioncx is created 2018-07-25 06:38:21 +03:00
Felix S. Klock II 87e729f58a thread the `errors_buffer` down into `nll::type_check`.
Right now its solely used for `check_local`, which ... I guess is not surprising?
2018-07-23 14:20:20 +02:00