about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
AgeCommit message (Collapse)AuthorLines
2022-09-05Address review comments.Nicholas Nethercote-5/+6
2022-09-05Make `hir::PathSegment::hir_id` non-optional.Nicholas Nethercote-10/+14
2022-09-05Make `hir::PathSegment::res` non-optional.Nicholas Nethercote-16/+25
2022-09-02Refactor and re-use BindingAnnotationCameron Steffen-32/+19
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-3/+0
by module
2022-09-01Directly use the `instrument` macro instead of its full pathOli Scherer-15/+15
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-09-01Auto merge of #100707 - dzvon:fix-typo, r=davidtwcobors-1/+1
Fix a bunch of typo This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-31Rollup merge of #101049 - JeanCASPAR:remove-span_fatal-from-ast_lowering, ↵Matthias Krüger-3/+18
r=davidtwco Remove span fatal from ast lowering Now the crate `rustc_ast_lowering` is fully migrated to `SessionDiagnostic`. r? ``@davidtwco``
2022-08-30Change fatal diagnostic to an error.JeanCASPAR-1/+7
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2022-08-29Revert let_chains stabilizationNilstrieb-0/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
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-29Use `&'hir Mod` everywhere.Nicholas Nethercote-4/+8
For consistency, and because it makes HIR measurement simpler and more accurate.
2022-08-29Use `&'hir Ty` everywhere.Nicholas Nethercote-2/+2
For consistency, and because it makes HIR measurement simpler and more accurate.
2022-08-29Use `&'hir Expr` everywhere.Nicholas Nethercote-6/+10
For consistency, and because it makes HIR measurement simpler and more accurate.
2022-08-27remove span_fatal from ast_loweringJean CASPAR-3/+12
2022-08-26Rollup merge of #100724 - ↵Michael Goulet-262/+463
JeanCASPAR:migrate-ast_lowering-to-session-diagnostic, r=davidtwco Migrate ast lowering to session diagnostic I migrated the whole rustc_ast_lowering crate to session diagnostic *except* the for the use of `span_fatal` at /compiler/rustc_ast_lowering/src/expr.rs#L1268 because `#[fatal(...)]` is not yet supported (see https://github.com/rust-lang/rust/pull/100694).
2022-08-23Remove the symbol from `ast::LitKind::Err`.Nicholas Nethercote-1/+1
Because it's never used meaningfully.
2022-08-22Resolve conflictsJean CASPAR-18/+18
2022-08-22Changes made in response to feedbackJean CASPAR-17/+23
2022-08-22Migrate all span_err(...) in ast_lowering to SessionDiagnosticJean CASPAR-14/+30
2022-08-22Migrate ast_lowering::pat to SessionDiagnosticJean CASPAR-25/+46
2022-08-22Migrate ast_lowering::ast to SessionDiagnosticJean CASPAR-100/+185
2022-08-22Migrate ast_lowering::expr to SessionDiagnosticJean CASPAR-80/+92
2022-08-22Migrate ast_lowering::lib and ast_lowering::item to SessionDiagnosticJean CASPAR-32/+70
2022-08-22Migrate ast_lowering::path to SessionDiagnosticJean CASPAR-15/+38
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-17Rollup merge of #100018 - nnethercote:clean-up-LitKind, r=petrochenkovMatthias Krüger-1/+1
Clean up `LitKind` r? ``@petrochenkov``
2022-08-16Rollup merge of #100610 - nnethercote:ast-and-parser-tweaks, r=spastorinoDylan DPC-2/+1
Ast and parser tweaks r? `@spastorino`
2022-08-16Auto merge of #100441 - nnethercote:shrink-ast-Attribute, r=petrochenkovbors-6/+7
Shrink `ast::Attribute`. r? `@ghost`
2022-08-16Auto merge of #100611 - matthiaskrgr:rollup-rxj10ur, r=matthiaskrgrbors-2/+2
Rollup of 6 pull requests Successful merges: - #100338 (when there are 3 or more return statements in the loop) - #100384 (Add support for generating unique profraw files by default when using `-C instrument-coverage`) - #100460 (Update the minimum external LLVM to 13) - #100567 (Add missing closing quote) - #100590 (Suggest adding an array length if possible) - #100600 (Rename Machine memory hooks to suggest when they run) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-16Rollup merge of #100590 - TaKO8Ki:suggest-adding-array-length, r=compiler-errorsMatthias Krüger-2/+2
Suggest adding an array length if possible fixes #100448
2022-08-16Rename some things related to literals.Nicholas Nethercote-1/+1
- Rename `ast::Lit::token` as `ast::Lit::token_lit`, because its type is `token::Lit`, which is not a token. (This has been confusing me for a long time.) reasonable because we have an `ast::token::Lit` inside an `ast::Lit`. - Rename `LitKind::{from,to}_lit_token` as `LitKind::{from,to}_token_lit`, to match the above change and `token::Lit`.
2022-08-16Auto merge of #100237 - cjgillot:no-special-hash-hir, r=nagisabors-4/+2
Remove manual implementations of HashStable for hir::Expr and hir::Ty. We do not need to force hashing HIR bodies inside those nodes. The contents of bodies are not accessible from the `hir_owner` query which used `hash_without_bodies`. When the content of a body is required, the access is still done using `hir_owner_nodes`, which continues hashing HIR bodies.
2022-08-16Remove `{ast,hir}::WhereEqPredicate::id`.Nicholas Nethercote-2/+1
These fields are unused.
2022-08-16Shrink `ast::Attribute`.Nicholas Nethercote-6/+7
2022-08-16suggest adding an array length if possibleTakayuki Maeda-2/+2
2022-08-15Auto merge of #96745 - ehuss:even-more-attribute-validation, r=cjgillotbors-7/+28
Visit attributes in more places. This adds 3 loosely related changes (I can split PRs if desired): - Attribute checking on pattern struct fields. - Attribute checking on struct expression fields. - Lint level visiting on pattern struct fields, struct expression fields, and generic parameters. There are still some lints which ignore lint levels in various positions. This is a consequence of how the lints themselves are implemented. For example, lint levels on associated consts don't work with `unused_braces`.
2022-08-12Adjust cfgsMark Rousskov-1/+0
2022-08-11Make Node::ExprField a child of Node::Expr.Eric Huss-5/+7
This was incorrectly inserting the ExprField as a sibling of the struct expression. This required adjusting various parts which were looking at parent node of a field expression to find the struct.
2022-08-11Add visitors for PatField and ExprField.Eric Huss-5/+7
This helps simplify the code. It also fixes it to use the correct parent when lowering. One consequence is the `non_snake_case` lint needed to change the way it looked for parent nodes in a struct pattern. This also includes a small fix to use the correct `Target` for expression field attribute validation.
2022-08-11Check attributes on struct expression fields.Eric Huss-1/+8
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-11Check attributes on pattern fields.Eric Huss-6/+16
Attributes on pattern struct fields were not being checked for validity. This adds the fields as HIR nodes so that the `CheckAttrVisitor` can visit those nodes to check their attributes.
2022-08-11Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillotMatthias Krüger-8/+5
Simplify visitors By removing some unused arguments. r? `@cjgillot`
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-11Simplify `rustc_ast::visit::Visitor::visit_poly_trait_ref`.Nicholas Nethercote-6/+3
It is passed an argument that is never used.
2022-08-11Simplify `rustc_hir::intravisit::Visitor::visit_variant_data`.Nicholas Nethercote-2/+2
It has four arguments that are never used. This avoids lots of argument passing in functions that feed into `visit_variant_data`.
2022-08-10Do not consider method call receiver as an argument in AST.Camille GILLOT-2/+4