about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering
AgeCommit message (Collapse)AuthorLines
2022-12-25Rollup merge of #106137 - matthiaskrgr:clippy_style, r=jyn514Matthias Krüger-13/+13
fix more clippy::style findings match_result_ok obfuscated_if_else single_char_add writeln_empty_string collapsible_match iter_cloned_collect unnecessary_mut_passed r? `@compiler-errors`
2022-12-25Rollup merge of #105375 - WaffleLapkin:docfix, r=cjgillotMatthias Krüger-4/+2
Fix an outdated comment mentioning parameter that doesn't exist anymore I'm not too familiar with the code in question, but from what I see I think the new comment makes sense. r? `@cjgillot` (you touched these arguments lately https://github.com/rust-lang/rust/pull/91557/files#diff-ad0c15bbde97a607d4758ec7eaf88248be5d6b8ae084dfc84127f81e3f7a9bb4L1702, https://github.com/rust-lang/rust/pull/104048/files#diff-ad0c15bbde97a607d4758ec7eaf88248be5d6b8ae084dfc84127f81e3f7a9bb4L1682)
2022-12-25Only enable relative span hashing on nightly.Camille GILLOT-1/+1
2022-12-25Enable relative span hashing.Camille GILLOT-1/+1
2022-12-25fix more clippy::style findingsMatthias Krüger-13/+13
match_result_ok obfuscated_if_else single_char_add writeln_empty_string collapsible_match iter_cloned_collect unnecessary_mut_passed
2022-12-24Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholkMatthias Krüger-1/+1
rustc: Remove needless lifetimes
2022-12-22Fix `explicit_outlives_requirements` lint in macrosLukas Markeffsky-15/+2
Show the suggestion if and only if the bounds are from the same source context.
2022-12-21Update track_caller tests; run fmtBryan Garza-5/+2
2022-12-21Improve code based on feedback.Bryan Garza-22/+20
This patch improves the readability of some of the code by using if-let-chains. Also, make use of the `add_feature_diagnostics` function.
2022-12-21Update track_caller logic/lint after rebaseBryan Garza-26/+27
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-1/+1
2022-12-19Revert "Replace usage of `ResumeTy` in async lowering with `Context`"Andrew Pollack-36/+21
2022-12-19Rollup merge of #105864 - matthiaskrgr:compl, r=NilstriebDylan DPC-1/+1
clippy::complexity fixes filter_next needless_question_mark bind_instead_of_map manual_find derivable_impls map_identity redundant_slicing skip_while_next unnecessary_unwrap needless_bool r? `@compiler-errors`
2022-12-19clippy::complexity fixesMatthias Krüger-1/+1
filter_next needless_question_mark bind_instead_of_map manual_find derivable_impls map_identity redundant_slicing skip_while_next unnecessary_unwrap needless_bool
2022-12-18Revert "Introduce lowering_arena to avoid creating AST nodes on the fly"Nilstrieb-38/+21
This reverts commit d9a1faaa9cff6eab069ea8e5cd7862d0ae48e231. This was originally part of a larger PR that has now been closed as a different approach is taken now.
2022-12-13Rollup merge of #105464 - nbdd0121:hir, r=compiler-errorsMatthias Krüger-38/+49
Support #[track_caller] on async closures Follow up on #105180 r? ```@compiler-errors``` cc ```@cjgillot```
2022-12-12Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkovbors-2/+3
Remove `token::Lit` from `ast::MetaItemLit`. Currently `ast::MetaItemLit` represents the literal kind twice. This PR removes that redundancy. Best reviewed one commit at a time. r? `@petrochenkov`
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-2/+2
2022-12-08Move paren expr and loop HIR loweringGary Guo-28/+37
2022-12-08Support `#[track_caller]` on async closuresGary Guo-10/+12
2022-12-08Rollup merge of #105408 - cuviper:help-rpitirpit, r=compiler-errorsMatthias Krüger-17/+34
Add help for `#![feature(impl_trait_in_fn_trait_return)]` This adds a new variant `ImplTraitContext::FeatureGated`, so we can generalize the help for `return_position_impl_trait_in_trait` to also work for `impl_trait_in_fn_trait_return`. cc #99697
2022-12-07Rollup merge of #105343 - nbdd0121:hir, r=fee1-deadMatthias Krüger-106/+45
Simplify attribute handling in rustc_ast_lowering Given that attributes is stored in a separate BTreeMap, it's not necessary to pass it in when constructing `hir::Expr`. We can just construct `hir::Expr` and then call `self.lower_attrs` later if it needs attributes. As most desugaring code don't use attributes, this allows some code cleanup.
2022-12-06Add help for `#![feature(impl_trait_in_fn_trait_return)]`Josh Stone-17/+34
This adds a new variant `ImplTraitContext::FeatureGated`, so we can generalize the help for `return_position_impl_trait_in_trait` to also work for `impl_trait_in_fn_trait_return`.
2022-12-06Fix an outdated comment mentioning parameter that doesn't exist anymoreMaybe Waffle-4/+2
2022-12-06Replace usage of `ResumeTy` in async lowering with `Context`Arpad Borsos-21/+36
Replaces using `ResumeTy` / `get_context` in favor of using `&'static mut Context<'_>`. Usage of the `'static` lifetime here is technically "cheating", and replaces the raw pointer in `ResumeTy` and the `get_context` fn that pulls the correct lifetimes out of thin air.
2022-12-06Simplify attribute handling in rustc_ast_loweringGary Guo-106/+45
Given that attributes is stored in a separate BTreeMap, it's not necessary to pass it in when constructing `hir::Expr`. We can just construct `hir::Expr` and then call `self.lower_attrs` later if it needs attributes. As most desugaring code don't use attributes, this allows some code cleanup.
2022-12-05Rollup merge of #105180 - nbdd0121:async_track_caller, r=compiler-errorsMatthias Krüger-22/+38
Use proper HirId for async track_caller attribute check Fix #105134
2022-12-05Add fixme noteGary Guo-0/+2
2022-12-03Rollup merge of #104199 - SarthakSingh31:issue-97417-1, r=cjgillotMatthias Krüger-0/+8
Keep track of the start of the argument block of a closure This removes a call to `tcx.sess.source_map()` from [compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs](https://github.com/rust-lang/rust/compare/master...SarthakSingh31:issue-97417-1?expand=1#diff-8406bbc0d0b43d84c91b1933305df896ecdba0d1f9269e6744f13d87a2ab268a) as required by #97417. VsCode automatically applied `rustfmt` to the files I edited under `src/tools`. I can undo that if its a problem. r? `@cjgillot`
2022-12-03Auto merge of #105133 - oli-obk:promoted_def_ids, r=cjgillotbors-6/+19
Ensure query backtraces work for `DefId`s created after ast lowering r? `@cjgillot`
2022-12-02Fix async track caller for assoc fn and trait impl fnGary Guo-2/+2
2022-12-02Use proper HirId for async track_caller attribute checkGary Guo-20/+34
2022-12-02Remove `token::Lit` from `ast::MetaItemLit`.Nicholas Nethercote-1/+2
`token::Lit` contains a `kind` field that indicates what kind of literal it is. `ast::MetaItemLit` currently wraps a `token::Lit` but also has its own `kind` field. This means that `ast::MetaItemLit` encodes the literal kind in two different ways. This commit changes `ast::MetaItemLit` so it no longer wraps `token::Lit`. It now contains the `symbol` and `suffix` fields from `token::Lit`, but not the `kind` field, eliminating the redundancy.
2022-12-02Add `StrStyle` to `ast::LitKind::ByteStr`.Nicholas Nethercote-1/+1
This is required to distinguish between cooked and raw byte string literals in an `ast::LitKind`, without referring to an adjacent `token::Lit`. It's a prerequisite for the next commit.
2022-12-01rustc_ast_lowering: Stop lowering imports into multiple itemsVadim Petrochenkov-74/+10
Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-12-01rustc_hir: Change representation of import paths to support multiple resolutionsVadim Petrochenkov-27/+15
2022-12-01Fill in `def_span` when creating def ids.Oli Scherer-6/+19
This makes sure that ICEing because of def ids created outside of ast lowering will be able to produce a query backtrace and not cause a double panic because of trying to call the `def_span` query
2022-12-01Auto merge of #104861 - nnethercote:attr-cleanups, r=petrochenkovbors-10/+7
Attribute cleanups Best reviewed one commit at a time. r? `@petrochenkov`
2022-11-29Make TyCtxtFeed::def_id private.Camille GILLOT-1/+1
2022-11-29Only allow feeding a value to newly created definitions.Camille GILLOT-1/+1
2022-11-29Auto merge of #104947 - cjgillot:verify-hir-nest, r=oli-obkbors-1/+1
Verify that HIR parenting and Def parenting match. This relationship is relied upon for `tcx.hir_owner_parent` query to return an accurate result.
2022-11-29Avoid more `MetaItem`-to-`Attribute` conversions.Nicholas Nethercote-10/+7
There is code for converting `Attribute` (syntactic) to `MetaItem` (semantic). There is also code for the reverse direction. The reverse direction isn't really necessary; it's currently only used when generating attributes, e.g. in `derive` code. This commit adds some new functions for creating `Attributes`s directly, without involving `MetaItem`s: `mk_attr_word`, `mk_attr_name_value_str`, `mk_attr_nested_word`, and `ExtCtxt::attr_{word,name_value_str,nested_word}`. These new methods replace the old functions for creating `Attribute`s: `mk_attr_inner`, `mk_attr_outer`, and `ExtCtxt::attribute`. Those functions took `MetaItem`s as input, and relied on many other functions that created `MetaItems`, which are also removed: `mk_name_value_item`, `mk_list_item`, `mk_word_item`, `mk_nested_word_item`, `{MetaItem,MetaItemKind,NestedMetaItem}::token_trees`, `MetaItemKind::attr_args`, `MetaItemLit::{from_lit_kind,to_token}`, `ExtCtxt::meta_word`. Overall this cuts more than 100 lines of code and makes thing simpler.
2022-11-28Keep track of the start of the argument block of a closureSarthak Singh-0/+8
2022-11-28Rename `ast::Lit` as `ast::MetaItemLit`.Nicholas Nethercote-3/+3
2022-11-28Factor out a repeated expression in `lower_attr_args`.Nicholas Nethercote-9/+4
2022-11-27Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errorsbors-75/+60
Separate lifetime ident from lifetime resolution in HIR Drive-by: change how suggested generic args are computed. Fixes https://github.com/rust-lang/rust/issues/103815 I recommend reviewing commit-by-commit.
2022-11-26Verify that HIR parenting and Def parenting match.Camille GILLOT-1/+1
2022-11-26Rollup merge of #104786 - WaffleLapkin:amp-mut-help, r=compiler-errorsGuillaume Gomez-8/+4
Use the power of adding helper function to simplify code w/ `Mutability` r? `@compiler-errors`
2022-11-24nested-match mutability (proposed by the reviewer)Maybe Waffle-6/+4
2022-11-24Use kw::Empty for elided lifetimes in path.Camille GILLOT-2/+1