about summary refs log tree commit diff
path: root/src/librustc/hir/lowering/expr.rs
AgeCommit message (Collapse)AuthorLines
2019-12-31librustc_ast_lowering: move the files.Mazdak Farrokhzad-1454/+0
2019-12-30Allocate inside lower_path_extra.Camille GILLOT-7/+3
2019-12-30Retire HirVec.Camille GILLOT-1/+1
2019-12-29Auto merge of #66942 - cjgillot:hirene-ty, r=Zoxcbors-16/+16
Allocate HIR on an arena 3/4 -- Ty This is the third PR in the series started by #66931 and #66936 Once again, commits don't really make sense on their own. They are mostly split by type of compile error. The additional diff is here: https://github.com/cjgillot/rust/compare/hirene-expr...hirene-ty
2019-12-27core: add IntoFuture trait and support for awaitSean McArthur-4/+20
2019-12-27Lowering for hir::Ty.Camille GILLOT-16/+16
2019-12-27Syntax for hir::Ty.Camille GILLOT-1/+1
2019-12-26Remove some type information.Camille GILLOT-11/+7
2019-12-26Fewer calls to arena.alloc.Camille GILLOT-120/+105
2019-12-26Lowering for hir::Expr.Camille GILLOT-149/+229
2019-12-26Syntax for hir::Expr.Camille GILLOT-50/+60
2019-12-23Add span information to `ExprKind::Assign`varkor-4/+7
2019-12-22Format the worldMark Rousskov-260/+139
2019-12-21Use Arena inside hir::Crate.Camille GILLOT-5/+5
2019-12-21Rollup merge of #67355 - Centril:merge-mut, r=oli-obkMazdak Farrokhzad-1/+1
Merge `ast::Mutability` and `mir::Mutability` r? @oli-obk
2019-12-20introduce 'type AttrVec'Mazdak Farrokhzad-12/+6
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-1/+1
2. mir::Mutability -> ast::Mutability.
2019-11-24Add raw address of expressions to the AST and HIRMatthew Jasper-3/+7
2019-11-21reduce size of hir::ExprKindMazdak Farrokhzad-13/+13
2019-11-14Update to use new librustc_error_codes libraryGuillaume Gomez-0/+2
2019-11-11Auto merge of #66252 - cjgillot:trees, r=oli-obkbors-18/+5
Merge repeated definitions Step forward on #66149 I may need further context to understand the need for a separate crate. Also, please tell me if you think of other definitions to merge.
2019-11-10Merge hir::CaptureClause into ast::CaptureBy.Camille GILLOT-10/+1
2019-11-10Merge hir::GeneratorMovability into ast::Movability.Camille GILLOT-6/+3
2019-11-10Merge hir::Mutability into ast::Mutability.Camille GILLOT-2/+1
2019-11-09Move next_node_id to ResolverMark Rousskov-1/+1
This doesn't migrate the pretty-printing everybody loops, which will be done in the next few commits.
2019-10-28Output previous stable error messaging when using stable build.Agustin Fernandez-5/+14
2019-10-03Auto merge of #64999 - nikomatsakis:issue-60424-async-return-inference, ↵bors-11/+19
r=cramertj extract expected return type for async fn generators Fixes #60424 cc @Centril, I know you've been eager to see this fixed. r? @cramertj
2019-10-02WIP tidy hir/lowering/expr.rsNiko Matsakis-4/+6
2019-10-02track the kind of async generator we are creatingNiko Matsakis-8/+14
2019-10-01address review commentsAlex Zatelepin-15/+13
2019-10-01fix spurious unreachable_code lints for try{} block ok-wrappingAlex Zatelepin-12/+31
2019-09-29Rollup merge of #64825 - estebank:match-unit, r=CentrilMazdak Farrokhzad-12/+11
Point at enclosing match when expecting `()` in arm When encountering code like the following: ```rust fn main() { match 3 { 4 => 1, 3 => { println!("Yep it maches."); 2 } _ => 2 } println!("Bye!") } ``` point at the enclosing `match` expression and suggest ignoring the returned value: ``` error[E0308]: mismatched types --> $DIR/match-needing-semi.rs:8:13 | LL | / match 3 { LL | | 4 => 1, LL | | 3 => { LL | | 2 | | ^ expected (), found integer LL | | } LL | | _ => 2 LL | | } | | -- help: consider using a semicolon here | |_____| | expected this to be `()` | = note: expected type `()` found type `{integer} ``` Fix #40799.
2019-09-28Point at enclosing match when expecting `()` in armEsteban Küber-12/+11
When encountering code like the following: ```rust fn main() { match 3 { 4 => 1, 3 => { println!("Yep it maches."); 2 } _ => 2 } println!("Bye!") } ``` point at the enclosing `match` expression and suggest ignoring the returned value: ``` error[E0308]: mismatched types --> $DIR/match-needing-semi.rs:8:13 | LL | / match 3 { LL | | 4 => 1, LL | | 3 => { LL | | 2 | | ^ expected (), found integer LL | | } LL | | _ => 2 LL | | } | | -- help: consider using a semicolon here | |_____| | expected this to be `()` | = note: expected type `()` found type `{integer} ``` Fix #40799.
2019-09-28syntax: don't keep a redundant c_variadic flag in the AST.Eduard-Mihai Burtescu-2/+0
2019-09-28Rollup merge of #64830 - Centril:thou-shallt-not-abort, r=estebankMazdak Farrokhzad-2/+1
Thou shallt not `.abort_if_errors()` r? @estebank
2019-09-27lowering: don't .abort_if_errors()Mazdak Farrokhzad-2/+1
2019-09-26Rename `Lit.node` to `Lit.kind`varkor-1/+1
2019-09-26Rename `Expr.node` to `Expr.kind`varkor-16/+11
For both `ast::Expr` and `hir::Expr`.
2019-09-25Rollup merge of #64508 - Centril:or-pat-hir, r=matthewjasperMazdak Farrokhzad-32/+19
or-patterns: Push `PatKind/PatternKind::Or` at top level to HIR & HAIR Following up on work in https://github.com/rust-lang/rust/pull/64111, https://github.com/rust-lang/rust/pull/63693, and https://github.com/rust-lang/rust/pull/61708, in this PR: - We change `hair::Arm.patterns: Vec<Pattern<'_>>` into `hir::Arm.pattern: Pattern<'_>`. - `fn hair::Arm::top_pats_hack` is introduced as a temporary crutch in MIR building to avoid more changes. - We change `hir::Arm.pats: HirVec<P<Pat>>` into `hir::Arm.pat: P<Pat>`. - The hacks in `rustc::hir::lowering` are removed since the representation hack is no longer necessary. - In some places, `fn hir::Arm::top_pats_hack` is introduced to leave some things as future work. - Misc changes: HIR pretty printing is adjusted to behave uniformly wrt. top/inner levels, rvalue promotion is adjusted, regionck, and dead_code is also. - Type checking is adjusted to uniformly handle or-patterns at top/inner levels. To make things compile, `p_0 | ... | p_n` is redefined as a "reference pattern" in [`fn is_non_ref_pat`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html#method.is_non_ref_pat) for now. This is done so that reference types are not eagerly stripped from the `expected: Ty<'tcx>`. - Liveness is adjusted wrt. the `unused_variables` and `unused_assignments` lints to handle top/inner levels uniformly and the handling of `fn` parameters, `let` locals, and `match` arms are unified in this respect. This is not tested for now as exhaustiveness checks are reachable and will ICE. - In `check_match`, checking `@` and by-move bindings is adjusted. However, exhaustiveness checking is not adjusted the moment and is handled by @dlrobertson in https://github.com/rust-lang/rust/pull/63688. - AST borrowck (`construct.rs`) is not adjusted as AST borrowck will be removed soon. r? @matthewjasper cc @dlrobertson @varkor @oli-obk
2019-09-17use drop-temps { .. } pseudo-notationNiko Matsakis-1/+1
DropTemps(...) looks like a function, this looks like wacko special stuff
2019-09-17introduce `lower_block_expr` convenience function, and use itNiko Matsakis-8/+3
2019-09-16adjust desugaring for async fn to correct drop orderNiko Matsakis-1/+1
Old desugaring, given a user function body { $stmts; $expr } ``` { let $param_pattern0 = $raw_param0; ... let $param_patternN = $raw_paramN; $stmts; $expr } ``` New desugaring: ``` { let $param_pattern0 = $raw_param0; ... let $param_patternN = $raw_paramN; drop-temps { $stmts; $expr } } ``` The drop-temps is an internal bit of HIR that drops temporaries from the resulting expression, but it should be equivalent to `return { $stmts; $expr }`.
2019-09-15or-patterns: remove hack from lowering.Mazdak Farrokhzad-32/+19
2019-09-10lowering: extend temporary lifetimes around awaitDavid Wood-20/+15
This commit changes the HIR lowering around `await` so that temporary lifetimes are extended. Previously, await was lowered as: ```rust { let mut pinned = future; loop { match ::std::future::poll_with_tls_context(unsafe { <::std::pin::Pin>::new_unchecked(&mut pinned) }) { ::std::task::Poll::Ready(result) => break result, ::std::task::Poll::Pending => {} } yield (); } } ``` With this commit, await is lowered as: ```rust match future { mut pinned => loop { match ::std::future::poll_with_tls_context(unsafe { <::std::pin::Pin>::new_unchecked(&mut pinned) }) { ::std::task::Poll::Ready(result) => break result, ::std::task::Poll::Pending => {} } yield (); } } ``` However, this change has the following side-effects: - All temporaries in future will be considered to live across a yield for the purpose of auto-traits. - Borrowed temporaries in future are likely to be considered to be live across the yield for the purpose of the generator transform. Signed-off-by: David Wood <david@davidtw.co>
2019-09-05or-patterns: adjust lowering of `ast::Arm` & `ast::ExprKind::Let`.Mazdak Farrokhzad-38/+39
Introduces a temporary hack to keep `Vec<P<Pat>>` in `hir::Arm.pats` so that we keep the changes more incremental.
2019-08-27Changing error messages and renaming tests #63127Kevin Per-2/+2
`async-await/no-args-non-move-async-closure` `generator/no-arguments-on-generators`
2019-08-17Remove SyntaxContext from {ast, hir}::{GlobalAsm, InlineAsm}Matthew Jasper-1/+0
We now store it in the `Span` of the expression or item.
2019-08-15`Ident::with_empty_ctxt` -> `Ident::with_dummy_span`Vadim Petrochenkov-7/+7
`Ident` has had a full span rather than just a `SyntaxContext` for a long time now.
2019-08-13Point at the right enclosing scope when using `await` in non-async fnEsteban Küber-1/+4
2019-08-10lowering: move scope & capture_clause stuff -> expr.rsMazdak Farrokhzad-1/+66