about summary refs log tree commit diff
path: root/src/librustc_mir/build/expr
AgeCommit message (Collapse)AuthorLines
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.)
2018-07-23Promoteds are statics and statics have a place, not just a valueOliver Schneider-12/+7
2018-07-20MIR changes to improve NLL cannot mutate errorsMatthew Jasper-1/+116
Alway use unique instead of mutable borrows immutable upvars. Mark variables that are references for a match guard
2018-07-13Auto merge of #52046 - cramertj:fix-generator-mir, r=eddybbors-2/+6
Ensure StorageDead is created even if variable initialization fails Rebase and slight cleanup of https://github.com/rust-lang/rust/pull/51109 Fixes https://github.com/rust-lang/rust/issues/49232 r? @eddyb
2018-07-12Ensure StorageDead is created even if variable initialization failsTaylor Cramer-2/+6
2018-07-03Fix various nll unused mut errorsMatthew Jasper-4/+23
2018-06-27Generate a direct assignment in MIR for `let x = y;`Matthew Jasper-26/+34
2018-06-19Thread info about form of variable bindings, including spans of arg types, ↵Felix S. Klock II-1/+1
down into `mir::LocalDecls`. As a drive-by: the ref_for_guards created by `fn declare_binding` should not have been tagged as user_variables in the first place. These secret internal locals are *pointers* to user variables, but themselves are not such (IMO. For now at least.)
2018-05-30rustc: rename mir::LocalDecl's syntactic_source_info to source_info.Eduard-Mihai Burtescu-1/+1
2018-05-30rustc: turn mir::LocalDecl's visibility_source_info into a SourceScope.Eduard-Mihai Burtescu-1/+1
2018-05-30rustc: rename mir::LocalDecl's source_info to visibility_source_info.Eduard-Mihai Burtescu-1/+1
2018-05-30rustc: turn mir::LocalDecl's syntactic_scope into a SourceInfo.Eduard-Mihai Burtescu-1/+1
2018-05-29Expand two-phase-borrows so that a case like this still compiles:Felix S. Klock II-2/+3
```rust fn main() { fn reuse<X>(_: &mut X) {} let mut t = 2f64; match t { ref mut _b if { false } => { reuse(_b); } _ => {} } } ``` Note: The way this is currently written is confusing; when `autoref` is off, then the arm body bindings (introduced by `bind_matched_candidate_for_arm_body`) are *also* used for the guard. (Any attempt to fix this needs to still ensure that the bindings used by the guard are introduced before the guard is evaluated.) (Once we turn NLL on by default, we can presumably simplify all of that.)