51 Commits

Author SHA1 Message Date
Santiago Pastorino
e9c41148c0
Convert Place's projection to a boxed slice 2019-09-09 18:16:49 -03:00
Wesley Wiser
4d62545687 Move def_id out add substsref 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
Oliver Scherer
9b87d22ea8 Don't abort on unevaluated constants without at least tryting to eval them 2019-08-05 17:48:04 +02:00
Santiago Pastorino
795d96d87b Place::as_place_ref is now Place::as_ref 2019-07-22 00:25:07 +02:00
Santiago Pastorino
46f81fc53d Avoid cloning Place in report_use_of_moved_or_uninitialized and friends 2019-07-20 05:08:39 +02:00
Santiago Pastorino
d0accade3e Migrate from Place enum to Place struct 2019-07-20 05:08:38 +02:00
Eduard-Mihai Burtescu
f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu
17cdd356da rustc: replace TyCtxt<'tcx, 'gcx, 'tcx> with TyCtxt<'gcx, 'tcx>. 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
2441253508 Fix fallout from deny(unused_lifetimes). 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
37799a5552 rustc: replace TyCtxt<'a, 'gcx, 'tcx> with TyCtxt<'tcx, 'gcx, 'tcx>. 2019-06-12 13:38:27 +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
varkor
21551359a5 Use assert_usize instead of unwrap_usize in several places 2019-06-02 01:55:44 +01: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
Edd Barrett
123a456a4f Make place projections concrete.
Once upon a time (commit 9bd35c07c26) there were two kinds of
projection: one for places, and one for constants. It therefore made
sense to share the `Projection` struct for both. Although the different
use-cases used different concrete types, sharing was made possible by
type-parameterisation of `Projection`.

Since then, however, the usage of projections in constants has
disappeared, meaning that (forgetting lifetimes for a moment) the
parameterised type is only every instantiated under one guise. So it may
as well be a concrete type.
2019-05-24 14:14:36 +01:00
Vadim Petrochenkov
6c187cc0c6 Change return type of TyCtxt::is_static to bool
Add `TyCtxt::is_mutable_static`
2019-04-21 14:41:51 +03:00
Santiago Pastorino
b461740f03 Make iterate take a FnOnce with PlaceBase and PlaceProjectionIter 2019-04-17 19:44:17 +02:00
Santiago Pastorino
0326f0a803 Place::iterate do not take an accumulator anymore, hide that in a private fn 2019-04-17 19:44:17 +02:00
Santiago Pastorino
53fa32fe50 Place::unroll -> Place::iterate 2019-04-17 19:44:17 +02:00
Santiago Pastorino
66fe4ff7d5 Move unroll_place to Place::unroll 2019-04-17 19:44:17 +02:00
Tyler Mandry
4122d2221e Remove adt_def from PlaceTy and make it a struct 2019-04-02 12:02:17 -07:00
Saleem Jaffer
fb93f10dac code review fixes 2019-03-24 08:59:11 +05:30
Saleem Jaffer
752544b284 adding mir::StaticKind enum for static and promoted 2019-03-23 20:18:52 +05:30
Saleem Jaffer
23c87a1f53 fixed all compilation errors 2019-03-18 15:03:30 +05:30
Saleem Jaffer
a837b8a368 cleaner code as per review 2019-03-18 15:03:30 +05:30
Saleem Jaffer
7fb1c22da1 promoted is still left in 2 places 2019-03-18 15:03:29 +05:30
Santiago Pastorino
0f993d5a7a Put Local, Static and Promoted as one Base variant of Place 2019-03-01 05:02:00 +01:00
Alexander Regueiro
c3e182cf43 rustc: doc comments 2019-02-10 23:42:32 +00:00
Taiki Endo
725af30809 librustc_mir => 2018 2019-02-08 06:28:15 +09: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
db635fc566
Kill borrows from a projection after assignment.
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-17 14:49:52 +01:00
Matthew Jasper
cdd537339e Make determining the discriminant a normal Shallow read
Enum layout optimizations mean that the discriminant of an enum may not
be stored in a tag disjoint from the rest of the fields of the enum.
Stop borrow checking as though they are.
2018-12-13 20:53:07 +00:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Andy Russell
4e35cbb22e
fix various typos in doc comments 2018-11-13 14:45:31 -05:00
Matthew Jasper
a830732090 Rename places_conflict to borrow_conflicts_with_place
This name better reflects the asymmetry of this function.
2018-09-24 23:33:13 +01:00
Matthew Jasper
ced5c2d08a Add "Shallow" borrow kind
This allows treating the "fake" match borrows differently from shared
borrows.
2018-09-24 23:33:13 +01: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
Nicholas Nethercote
130e55665f Avoid calling unroll_place() in a common case.
This reduces the execution time for `ucd-check` by 25%.
2018-08-27 18:46:36 +10:00
varkor
6f637da50c Remove Ty prefix from Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error} 2018-08-22 16:07:44 +01:00
Matthias Krüger
71120ef1e5 Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
Matthew Jasper
84dc48522d Allow borrow conflicts for promoted length 0 arrays 2018-07-31 21:35:22 +01:00
Oliver Schneider
ac54b7499b A promoted has a place and can thus be equal to itself 2018-07-23 09:51:31 +02:00
Oliver Schneider
de511438cd Promoteds are statics and statics have a place, not just a value 2018-07-23 09:51:30 +02:00
Niko Matsakis
6d0644c65a
tweak comment 2018-07-06 06:33:38 -04:00
Mikhail Modin
f247a3e490 fix for issue #8636 2018-07-05 11:34:10 +01:00
Niko Matsakis
cb34989332 add explanatory comment 2018-06-28 08:34:04 -04:00
Niko Matsakis
5c06b23025 run rustfmt 2018-06-27 13:32:00 -04:00
Niko Matsakis
497273620b don't use Iterator and zip but just invoke next manually
This micro-optimizes some if checks away; the compiler may already
have been doing it, not sure.
2018-06-27 13:01:23 -04:00
Niko Matsakis
e10414e055 avoid use of vectors etc 2018-06-27 11:47:58 -04:00