about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/expr.rs
AgeCommit message (Collapse)AuthorLines
2022-10-11wip: trying to enable #[track_caller] on async fnEric Holk-1/+19
2022-10-11rustc_hir: Less error-prone methods for accessing `PartialRes` resolutionVadim Petrochenkov-6/+2
2022-09-29Mark ignore(illustrative) on docs in compiler/rustc_ast_lowering/src/expr.rsreez12g-3/+3
2022-09-24separate definitions and `HIR` ownersTakayuki Maeda-1/+1
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-16Rollup merge of #101825 - spastorino:fix-rpit-changes, r=oli-obkGuillaume Gomez-51/+47
Fix back RPIT changes r? `@oli-obk` cc `@compiler-errors`
2022-09-14Pass ImplTraitContext as &, there's no need for that to be &mutSantiago Pastorino-18/+16
2022-09-14Revert "Rollup merge of #101496 - ↵Santiago Pastorino-33/+31
spastorino:lower_lifetime_binder_api_changes, r=oli-obk" This reverts commit 953a6b3da7016d41816951ad0930922f558c16d0, reversing changes made to b5ffbd32d4838a460a73ce9aa106a4e1856e52c0.
2022-09-14make `mk_attr_id` part of `ParseSess`SparrowLii-1/+1
2022-09-12Impove diagnostic for .await-ing non-futuresLukas Markeffsky-3/+9
2022-09-09Make async fn in traits workMichael Goulet-2/+3
2022-09-08Auto merge of #101577 - Dylan-DPC:rollup-l9xw7i7, r=Dylan-DPCbors-31/+32
Rollup of 7 pull requests Successful merges: - #98933 (Opaque types' generic params do not imply anything about their hidden type's lifetimes) - #101041 (translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Pt. 2) - #101424 (Adjust and slightly generalize operator error suggestion) - #101496 (Allow lower_lifetime_binder receive a closure) - #101501 (Allow lint passes to be bound by `TyCtxt`) - #101515 (Recover from typo where == is used in place of =) - #101545 (Remove unnecessary `PartialOrd` and `Ord`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-08Rollup merge of #101496 - spastorino:lower_lifetime_binder_api_changes, ↵Dylan DPC-31/+32
r=oli-obk Allow lower_lifetime_binder receive a closure ``@oli-obk`` requested this and other changes as a way of simplifying https://github.com/rust-lang/rust/pull/101345. This is just going to make the diff of https://github.com/rust-lang/rust/pull/101345 smaller. r? ``@oli-obk`` ``@cjgillot``
2022-09-08Introduce `DotDotPos`.Nicholas Nethercote-4/+7
This shrinks `hir::Pat` from 88 to 72 bytes.
2022-09-07Allow lower_lifetime_binder receive a closureSantiago Pastorino-31/+32
2022-09-06Pass ImplTraitContext as &mut to avoid the need of ↵Santiago Pastorino-16/+18
ImplTraitContext::reborrow later on
2022-09-06Auto merge of #101241 - camsteffen:refactor-binding-annotations, r=cjgillotbors-3/+3
`BindingAnnotation` refactor * `ast::BindingMode` is deleted and replaced with `hir::BindingAnnotation` (which is moved to `ast`) * `BindingAnnotation` is changed from an enum to a tuple struct e.g. `BindingAnnotation(ByRef::No, Mutability::Mut)` * Associated constants added for convenience `BindingAnnotation::{NONE, REF, MUT, REF_MUT}` One goal is to make it more clear that `BindingAnnotation` merely represents syntax `ref mut` and not the actual binding mode. This was especially confusing since we had `ast::BindingMode`->`hir::BindingAnnotation`->`thir::BindingMode`. I wish there were more symmetry between `ByRef` and `Mutability` (variant) naming (maybe `Mutable::Yes`?), and I also don't love how long the name `BindingAnnotation` is, but this seems like the best compromise. Ideas welcome.
2022-09-05Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, ↵bors-4/+4
r=cjgillot Separate the receiver from arguments in HIR Related to #100232 cc `@cjgillot`
2022-09-05separate the receiver from arguments in HIRTakayuki Maeda-4/+4
2022-09-05Address review comments.Nicholas Nethercote-1/+1
2022-09-05Make `hir::PathSegment::hir_id` non-optional.Nicholas Nethercote-1/+2
2022-09-05Make `hir::PathSegment::res` non-optional.Nicholas Nethercote-2/+3
2022-09-02Refactor and re-use BindingAnnotationCameron Steffen-3/+3
2022-09-01Auto merge of #100869 - nnethercote:replace-ThinVec, r=spastorinobors-2/+2
Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec` `rustc_data_structures::thin_vec::ThinVec` looks like this: ``` pub struct ThinVec<T>(Option<Box<Vec<T>>>); ``` It's just a zero word if the vector is empty, but requires two allocations if it is non-empty. So it's only usable in cases where the vector is empty most of the time. This commit removes it in favour of `thin_vec::ThinVec`, which is also word-sized, but stores the length and capacity in the same allocation as the elements. It's good in a wider variety of situation, e.g. in enum variants where the vector is usually/always non-empty. The commit also: - Sorts some `Cargo.toml` dependency lists, to make additions easier. - Sorts some `use` item lists, to make additions easier. - Changes `clean_trait_ref_with_bindings` to take a `ThinVec<TypeBinding>` rather than a `&[TypeBinding]`, because this avoid some unnecessary allocations. r? `@spastorino`
2022-08-30Change fatal diagnostic to an error.JeanCASPAR-1/+7
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2022-08-29Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec`.Nicholas Nethercote-2/+2
`rustc_data_structures::thin_vec::ThinVec` looks like this: ``` pub struct ThinVec<T>(Option<Box<Vec<T>>>); ``` It's just a zero word if the vector is empty, but requires two allocations if it is non-empty. So it's only usable in cases where the vector is empty most of the time. This commit removes it in favour of `thin_vec::ThinVec`, which is also word-sized, but stores the length and capacity in the same allocation as the elements. It's good in a wider variety of situation, e.g. in enum variants where the vector is usually/always non-empty. The commit also: - Sorts some `Cargo.toml` dependency lists, to make additions easier. - Sorts some `use` item lists, to make additions easier. - Changes `clean_trait_ref_with_bindings` to take a `ThinVec<TypeBinding>` rather than a `&[TypeBinding]`, because this avoid some unnecessary allocations.
2022-08-27remove span_fatal from ast_loweringJean CASPAR-3/+3
2022-08-22Migrate all span_err(...) in ast_lowering to SessionDiagnosticJean CASPAR-5/+3
2022-08-22Migrate ast_lowering::expr to SessionDiagnosticJean CASPAR-76/+18
2022-08-22Use `AttrVec` in more places.Nicholas Nethercote-26/+24
In some places we use `Vec<Attribute>` and some places we use `ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points where we have to convert between `Vec` and `ThinVec`. This commit changes the places that use `Vec<Attribute>` to use `AttrVec`. A lot of this is mechanical and boring, but there are some interesting parts: - It adds a few new methods to `ThinVec`. - It implements `MapInPlace` for `ThinVec`, and introduces a macro to avoid the repetition of this trait for `Vec`, `SmallVec`, and `ThinVec`. Overall, it makes the code a little nicer, and has little effect on performance. But it is a precursor to removing `rustc_data_structures::thin_vec::ThinVec` and replacing it with `thin_vec::ThinVec`, which is implemented more efficiently.
2022-08-11Check attributes on struct expression fields.Eric Huss-1/+3
Attributes on struct expression fields were not being checked for validity. This adds the fields as HIR nodes so that `CheckAttrVisitor` can visit those nodes to check their attributes.
2022-08-11Rollup merge of #100307 - nnethercote:fix-96847, r=cjgillotMatthias Krüger-3/+1
Fix #96847 r? `@petrochenkov`
2022-08-11Avoid lowering a `MacArgs::Eq` twice.Nicholas Nethercote-3/+1
Fixes #96847.
2022-08-10Do not consider method call receiver as an argument in AST.Camille GILLOT-2/+4
2022-08-04with_lifetime_binder is now lower_lifetime_binder and doesn't need a closureSantiago Pastorino-32/+31
2022-08-04Completely remove captures flagSantiago Pastorino-21/+7
2022-08-04Add captures flag to capture or not while loweringSantiago Pastorino-7/+21
2022-07-12Add an indirection for closures in `hir::ExprKind`Maybe Waffle-14/+21
This helps bring `hir::Expr` size down, `Closure` was the biggest variant, especially after `for<>` additions.
2022-07-12Lower closure binders to hir & properly check themMaybe Waffle-19/+29
2022-07-12Parse closure bindersMaybe Waffle-0/+24
This is first step in implementing RFC 3216. - Parse `for<'a>` before closures in ast - Error in lowering - Add `closure_lifetime_binder` feature
2022-07-06Remove `sess` field from LoweringContext.Camille GILLOT-13/+20
2022-06-21Use CreateParameter mode for closures too.Camille GILLOT-23/+34
2022-06-17Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoeristerbors-12/+5
Split up `Definitions` and `ResolverAstLowering`. Split off https://github.com/rust-lang/rust/pull/95573 r? `@michaelwoerister`
2022-06-15Rollup merge of #98110 - cjgillot:closure-brace, r=Aaron1011Yuki Okushi-20/+20
Make `ExprKind::Closure` a struct variant. Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`. r? ``@Aaron1011``
2022-06-14Separate `source_span` and `expn_that_defined` from `Definitions`.Camille GILLOT-8/+1
2022-06-14Do not modify the resolver outputs.Camille GILLOT-2/+2
2022-06-14Make ResolverAstLowering a struct.Camille GILLOT-3/+3
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-1/+1
2022-06-12Make `ExprKind::Closure` a struct variant.Camille GILLOT-20/+20
2022-06-01Remove #[rustc_box] attr during loweringest31-3/+6
2022-06-01Add #[rustc_box]est31-1/+13
This commit adds an alternative content boxing syntax, and uses it inside alloc. The usage inside the very performance relevant code in liballoc is the only remaining relevant usage of box syntax in the compiler (outside of tests, which are comparatively easy to port). box syntax was originally designed to be used by all Rust developers. This introduces a replacement syntax more tailored to only being used inside the Rust compiler, and with it, lays the groundwork for eventually removing box syntax.