summary refs log tree commit diff
path: root/src/librustc_mir/build/expr
AgeCommit message (Collapse)AuthorLines
2019-02-21Match discriminant -> scrutineeMatthew Jasper-2/+2
2019-02-09Auto merge of #58207 - nnethercote:intern_lazy_const, r=oli-obkbors-1/+1
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-08librustc_mir => 2018Taiki Endo-21/+21
2019-02-06Make `intern_lazy_const` actually intern its argument.Nicholas Nethercote-1/+1
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-01-19Handle lifetime annotations in unreachable codeMatthew Jasper-4/+15
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-19Use a struct for user type annotationsMatthew Jasper-6/+13
2019-01-05Remove `Region` from HAIRMatthew Jasper-6/+3
Use `ReErased` for any regions that need to be created in RValue::Ref in MIR generation.
2019-01-01Move the `Unevaluated` constant arm upwards in the type structureOliver Scherer-5/+7
2018-12-30Refactor `UserTypeAnnotation`.David Wood-7/+21
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-25Remove licensesMark Rousskov-90/+0
2018-12-23Rollup merge of #56917 - sinkuu:mir_build_logicop, r=davidtwcoMazdak Farrokhzad-30/+23
Simplify MIR generation for logical operations Reduces one block and one branch from MIR generated for a logical operator.
2018-12-17Simplify MIR generation for logical opsShotaro Yamada-30/+23
2018-12-11Add a FIXME for mir build unreachable destination checkingvarkor-6/+8
2018-12-11Consider privacy in more locationsvarkor-7/+7
2018-12-11Fix handling of divergent dicriminantsvarkor-1/+0
2018-12-11Make uninhabitedness checking more intelligentvarkor-1/+1
2018-12-11Check for uninhabitedness instead of nevervarkor-3/+2
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-3/+3
2018-11-21Update as_temp.rsOliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer-1/+6
2018-11-21Update as_temp.rsOliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer-2/+4
2018-11-21Update an outdated comment in mir buildingOliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer-3/+2
2018-11-15Rollup merge of #55781 - ↵Pietro Albini-19/+67
pnkfelix:issue-54382-more-precise-spans-for-temps-and-their-drops, r=davidtwco More precise spans for temps and their drops This PR has two main enhancements: 1. when possible during code generation for a statement (like `expr();`), pass along the span of a statement, and then attribute the drops of temporaries from that statement to the statement's end-point (which will be the semicolon if it is a statement that is terminating by a semicolon). 2. when evaluating a block expression into a MIR temp, use the span of the block's tail expression (rather than the span of whole block including its statements and curly-braces) for the span of the temp. Each of these individually increases the precision of our diagnostic output; together they combine to make a much clearer picture about the control flow through the spans. Fix #54382
2018-11-08Revise the temp creation for blocks in `stmt_expr` to setup `BlockTailInfo`.Felix S. Klock II-1/+17
2018-11-08Refactor code so that block_context observations has nicely named (and ↵Felix S. Klock II-13/+3
documented) methods.
2018-11-08Narrow span of temp holding the value of a Block expression to the block's ↵Felix S. Klock II-1/+24
tail (if present).
2018-11-08For diagnostics, set spans of drops of temps to be that of the statement's ↵Felix S. Klock II-5/+24
terminating semicolon.
2018-11-07array index accesses are stable placesRalf Jung-0/+3
2018-11-02Auto merge of #55087 - levex:e0669-improve-span, r=nagisabors-2/+6
rustc: improve E0669 span E0669 refers to an operand that cannot be coerced into a single LLVM value, unfortunately right now this uses the Span for the entire inline assembly statement, which is less than ideal. This commit preserves the Span from HIR, which lets us emit the error using the Span for the operand itself in MIR. r? @nagisa cc/ @parched
2018-10-26Add the actual chain of projections to `UserTypeProjection`.Felix S. Klock II-2/+2
Update the existing NLL `patterns.rs` test accordingly. includes changes addressing review feedback: * Added example to docs for `UserTypeProjections` illustrating how we build up multiple projections when descending into a pattern with type ascriptions. * Adapted niko's suggested docs for `UserTypeProjection`. * Factored out `projection_ty` from more general `projection_ty_core` (as a drive-by, made its callback an `FnMut`, as I discovered later that I need that). * Add note to docs that `PlaceTy.field_ty(..)` does not normalize its result. * Normalize as we project out `field_ty`.
2018-10-26Checkpoint: Added abstraction over collection of projections into user type.Felix S. Klock II-1/+1
I did not think I would need this in the MIR, but in general local decls are going to need to support this. (That, or we need to be able define a least-upper-bound for a collection of types encountered via the pattern compilation.)
2018-10-26Added `mir::UserTypeProjection`, a stub for a structure that projects *into* ↵Felix S. Klock II-2/+2
a given UserTypeAnnotation. (That is, it will pull out some component type held or referenced by the type annotation.) Note: this still needs to actually do projection itself. That comes in a later commit
2018-10-26Shrink `Statement`.Nicholas Nethercote-2/+2
This commit reduces the size of `Statement` from 80 bytes to 56 bytes on 64-bit platforms, by boxing the `AscribeUserType` variant of `StatementKind`. This change reduces instruction counts on most benchmarks by 1--3%.
2018-10-19skip user-type annotations if they don't have regionsNiko Matsakis-22/+26
2018-10-17rustc: improve E0669 spanLevente Kurusa-2/+6
E0669 refers to a constraint that cannot be coerced into a single LLVM value, unfortunately right now this uses the Span for the entire inline assembly statement, which is less than ideal. This commit preserves the Span from HIR, which lets us emit the error using the Span for the operand itself in MIR. Signed-off-by: Levente Kurusa <lkurusa@acm.org>
2018-10-05Improve diagnostics for borrow-check errors that result from drops of ↵Felix S. Klock II-0/+6
temporary r-values. Changed `BorrowExplanation::UsedLaterWhenDropped` to handle both named locals and also unnamed (aka temporaries). If the dropped temporary does not implement `Drop`, then we print its full type; but when the dropped temporary is itself an ADT `D` that implements `Drop`, then diagnostic points the user directly at `D`.
2018-10-05Add flag to `mir::LocalDecl` to track whether its a temp from some subexpr a ↵Felix S. Klock II-15/+64
block tail expression. Slightly refactored the `LocalDecl` construction API in the process.
2018-10-04Auto merge of #54666 - matthewjasper:mir-function-spans, r=pnkfelixbors-1/+2
[NLL] Improve "borrow later used here" messages * In the case of two conflicting borrows, the later used message says which borrow it's referring to * If the later use is a function call (from the users point of view) say that the later use is for the call. Point just to the function. r? @pnkfelix Closes #48643
2018-10-04Auto merge of #54447 - KiChjang:issue-54331, r=nikomatsakisbors-3/+53
Lower type ascriptions to HAIR and MIR Fixes #54331. r? @nikomatsakis
2018-10-03Record whether a Call in MIR corresponds to a call in HIRMatthew Jasper-1/+2
2018-09-29avoid infinite loop in MIR loweringNiko Matsakis-4/+13
2018-09-29Lower type ascriptions to HAIR and MIRKeith Yeung-3/+44
2018-09-24Shrink StatementKind::InlineAsm.Nicholas Nethercote-2/+4
This shrinks StatementKind from 64 bytes to 48 bytes on 64-bit.
2018-09-10propagate user-ascribes types down onto resulting bindingsNiko Matsakis-0/+1
But only in very simple cases.
2018-09-06rustfmt src/librustc_mir/build/exprMikhail Modin-446/+656
2018-09-06Skip a shared borrow of a immutable local variablesMikhail Modin-15/+45
issue #53643
2018-08-24pacify the mercilous tidy: adt user-tyNiko Matsakis-2/+7
2018-08-24support user-given types in adtsNiko Matsakis-2/+2
2018-08-24add a `user_ty` annotation to `Constant`Niko Matsakis-2/+5
2018-08-22Remove Ty prefix from ↵varkor-1/+1
Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}
2018-07-26Issue #51348: lower `match` so an ident gets a distinct temp *for each* ↵Felix S. Klock II-9/+6
candidate pat. This required a bit of plumbing to keep track of candidates. But I took advantage of the hack session to try to improve the docs for the relevant structs here. (I also tried to simplify some of the related code in passing.)