Commit Graph

163 Commits

Author SHA1 Message Date
csmoe 64f61c7888 remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
Santiago Pastorino 28db2c9e95
Make all projection base names be proj_base 2019-09-13 09:30:23 -03:00
Santiago Pastorino 07a706ecf5
Avoid math and use patterns to grab projection base 2019-09-13 09:29:57 -03:00
Santiago Pastorino e9c41148c0
Convert Place's projection to a boxed slice 2019-09-09 18:16:49 -03:00
Eduard-Mihai Burtescu b565ece5d8 Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`. 2019-08-16 15:20:27 +03:00
Saleem Jaffer 654519d3c5 use PanicInfo and UnsupportedOpInfo 2019-07-29 13:35:59 +05:30
Ralf Jung 495f9509fe use PanicMessage type for MIR assertion errors 2019-07-24 10:24:55 +02:00
Mark Rousskov 52e9e44c7f
Rollup merge of #60951 - saleemjaffer:mir_better_error_enum, r=oli-obk
more specific errors in src/librustc/mir/interpret/error.rs

Implements [this](https://github.com/rust-rfcs/const-eval/issues/4)
2019-07-23 12:51:02 -04:00
Saleem Jaffer 3730ed9e5b renames EvalErrorPanic to PanicMessage 2019-07-23 16:42:46 +05:30
Saleem Jaffer 90426ed642 moving some variants from InterpError to EvalErrorPanic 2019-07-23 13:37:04 +05:30
Santiago Pastorino 2ffd3c64f9 Avoid cloning Place in limit_capture_mutability 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
Wesley Wiser aabaf12155 Fix leak when early returning out of `box` syntax
Fixes #62289
2019-07-11 20:12:19 -04:00
Matthew Jasper 3131427784 Use `Local`s instead of `Place`s in MIR drop generation 2019-06-25 22:41:22 +01:00
Santiago Pastorino 099f9e4e8a Implement From<Local> for Place and PlaceBase 2019-06-25 15:46:23 +02:00
John Kåre Alsaker 007aabae93 Remove unnecessary lift calls 2019-06-14 21:11:50 +02:00
John Kåre Alsaker d3e1181b1c Use a single lifetime for MIR construction 2019-06-12 19:27:00 +02:00
Matthew Jasper 5cfa70f760 Add `is_ref_for_guard` method 2019-06-03 12:59:08 +01:00
Santiago Pastorino 5e4d83e972 Rename Place::local to Place::local_or_deref_local 2019-05-28 18:50:55 +02:00
Santiago Pastorino 38ecea4c11 Use Place::local 2019-05-27 23:03:38 +02:00
Matthew Jasper 615c23f6ec Remove unused parameter from in(_opt)?_scope 2019-05-21 19:37:38 +01:00
Mazdak Farrokhzad 5cccda1770 Remove hir::ExprKind::If and replace it with lowering to hir::ExprKind::Match. 2019-05-10 19:41:10 +02:00
bors e232636693 Auto merge of #59897 - tmandry:variantful-generators, r=eddyb
Multi-variant layouts for generators

This allows generators to overlap fields using variants, but doesn't do any such overlapping yet. It creates one variant for every state of the generator (unresumed, returned, panicked, plus one for every yield), and puts every stored local in each of the yield-point variants.

Required for optimizing generator layouts (#52924).

There was quite a lot of refactoring needed for this change. I've done my best in later commits to eliminate assumptions in the code that only certain kinds of types are multi-variant, and to centralize knowledge of the inner mechanics of generators in as few places as possible.

This change also emits debuginfo about the fields contained in each variant, as well as preserving debuginfo about stored locals while running in the generator.

Also, fixes #59972.

Future work:
- Use this change for an optimization pass that actually overlaps locals within the generator struct (#52924)
- In the type layout fields, don't include locals that are uninitialized for a particular variant, so miri and UB sanitizers can check our memory (see https://github.com/rust-lang/rust/issues/59972#issuecomment-483058172)
- Preserve debuginfo scopes across generator yield points
2019-05-04 03:18:14 +00:00
varkor 7261bd88ac Update existing usages 2019-04-25 22:05:04 +01:00
Tyler Mandry 5a7af5480c Support variantful generators
This allows generators to overlap fields using variants.
2019-04-25 10:28:09 -07:00
Tyler Mandry 70c1b6c530 Define generator discriminant type in only one place 2019-04-25 10:12:57 -07:00
Matthew Jasper e9c687b04a Evaluate hair::ExprKind::Use in into
This avoids some unnecessary moves
2019-04-24 19:38:02 +01:00
Eduard-Mihai Burtescu 82bd7196c2 rustc: don't track var_hir_id or mutability in mir::UpvarDecl. 2019-04-23 23:35:15 +03:00
Saleem Jaffer 63b4764556 refactor ExprKind to use new PointerCast enum 2019-04-16 17:36:41 +05:30
Saleem Jaffer 5be6b0beb9 basic refactor. Adding PointerCast enum 2019-04-15 20:29:13 +05:30
kenta7777 3c8caaca7d renames EvalErrorKind to InterpError 2019-04-02 01:02:18 +09:00
Taiki Endo 07021e07ed Allow closure to unsafe fn coercion 2019-04-01 00:00:43 +09:00
Oliver Scherer 5cd2806621 Revert the `LazyConst` PR 2019-03-16 21:04:10 +01:00
bors 2cfd6444a7 Auto merge of #58673 - matthewjasper:typeck-ptr-coercions, r=pnkfelix
[NLL] Type check operations with pointer types

It seems these were forgotten about. Moving to `Rvalue::AddressOf` simplifies the coercions from references, but I want this to be fixed as soon as possible.

r? @pnkfelix
2019-03-03 16:46:12 +00:00
Santiago Pastorino 0f993d5a7a Put Local, Static and Promoted as one Base variant of Place 2019-03-01 05:02:00 +01:00
Matthew Jasper 7d01aa8a48 Type check coercions to pointer types 2019-02-23 14:25:03 +00:00
bors d329d46a3f Auto merge of #58207 - nnethercote:intern_lazy_const, r=oli-obk
Make `intern_lazy_const` actually intern its argument.

Currently it just unconditionally allocates it in the arena.

For a "Clean Check" build of the the `packed-simd` benchmark, this
change reduces both the `max-rss` and `faults` counts by 59%; it
slightly (~3%) increases the instruction counts but the `wall-time` is
unchanged.

For the same builds of a few other benchmarks, `max-rss` and `faults`
drop by 1--5%, but instruction counts and `wall-time` changes are in the
noise.

Fixes #57432, fixes #57829.
2019-02-09 12:38:51 +00:00
Taiki Endo 725af30809 librustc_mir => 2018 2019-02-08 06:28:15 +09:00
Nicholas Nethercote f2871a9ce5 Make `intern_lazy_const` actually intern its argument.
Currently it just unconditionally allocates it in the arena.

For a "Clean Check" build of the the `packed-simd` benchmark, this
change reduces both the `max-rss` and `faults` counts by 59%; it
slightly (~3%) increases the instruction counts but the `wall-time` is
unchanged.

For the same builds of a few other benchmarks, `max-rss` and `faults`
drop by 1--5%, but instruction counts and `wall-time` changes are in the
noise.

Fixes #57432, fixes #57829.
2019-02-06 12:50:28 +11:00
Matthew Jasper 65fe251634 Handle lifetime annotations in unreachable code
We  equate the type in the annotation with the inferred type first so
that we have a fully inferred type to perform the well-formedness check
on.
2019-01-19 16:30:45 +00:00
Matthew Jasper ed871cb368 Use a struct for user type annotations 2019-01-19 15:15:07 +00:00
Matthew Jasper 4f3c469ad0 Remove `Region` from HAIR
Use `ReErased` for any regions that need to be created in RValue::Ref
in MIR generation.
2019-01-05 13:52:22 +00:00
Oliver Scherer b903cb9d60 Move the `Unevaluated` constant arm upwards in the type structure 2019-01-01 20:05:02 +01:00
David Wood 24a7a010d1
Refactor `UserTypeAnnotation`.
This commit refactors the `UserTypeAnnotation` type to be referred to by
an index within `UserTypeProjection`. `UserTypeAnnotation` is instead
kept in an `IndexVec` within the `Mir` struct.

Further, instead of `UserTypeAnnotation` containing canonicalized types,
it now contains normal types and the entire `UserTypeAnnotation` is
canonicalized. To support this, the type was moved from the `rustc::mir`
module to `rustc::ty` module.
2018-12-30 14:25:20 +01:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Alexander Regueiro ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Felix S. Klock II ece4f472c9 For diagnostics, set spans of drops of temps to be that of the statement's terminating semicolon. 2018-11-08 12:54:20 +01:00
Keith Yeung fba9d14779 Lower type ascriptions to HAIR and MIR 2018-09-29 10:34:30 -07:00
Mikhail Modin d0c1e5a99e rustfmt src/librustc_mir/build/expr 2018-09-06 22:34:56 +01:00
Mikhail Modin 527a29a5c6 Skip a shared borrow of a immutable local variables
issue #53643
2018-09-06 21:46:52 +01:00