about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/visit.rs
AgeCommit message (Collapse)AuthorLines
2021-09-09Revert "Implement Anonymous{Struct, Union} in the AST"Felix S. Klock II-3/+0
This reverts commit 059b68dd677808e14e560802d235ad40beeba71e. Note that this was manually adjusted to retain some of the refactoring introduced by commit 059b68dd677808e14e560802d235ad40beeba71e, so that it could likewise retain the correction introduced in commit 5b4bc05fa57be19bb5962f4b7c0f165e194e3151
2021-08-30Add let-else to ASTCameron Steffen-1/+4
2021-08-26Auto merge of #88066 - LeSeulArtichaut:patterns-cleanups, r=nagisabors-5/+2
Use if-let guards in the codebase and various other pattern cleanups Dogfooding if-let guards as experimentation for the feature. Tracking issue #51114. Conflicts with #87937.
2021-08-25Various pattern cleanupsLéo Lanteri Thauvin-5/+2
2021-08-24Move `named_asm_labels` to a HIR lintasquared31415-3/+3
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-2/+2
2021-06-10Add support for using qualified paths with structs in expression and patternRyan Levick-2/+11
position.
2021-05-16Implement Anonymous{Struct, Union} in the ASTjedel1043-0/+3
Add unnamed_fields feature gate and gate unnamed fields on parsing
2021-05-13Add support for const operands and options to global_asm!Amanieu d'Antras-31/+24
On x86, the default syntax is also switched to Intel to match asm!
2021-04-06Use AnonConst for asm! constantsAmanieu d'Antras-1/+3
2021-03-16ast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`Vadim Petrochenkov-4/+4
2021-03-16ast/hir: Rename field-related structuresVadim Petrochenkov-16/+16
StructField -> FieldDef ("field definition") Field -> ExprField ("expression field", not "field expression") FieldPat -> PatField ("pattern field", not "field pattern") Also rename visiting and other methods working on them.
2021-02-18ast: Keep expansion status for out-of-line module itemsVadim Petrochenkov-1/+6
Also remove `ast::Mod` which is mostly redundant now
2021-02-18ast: Stop using `Mod` in `Crate`Vadim Petrochenkov-10/+3
Crate root is sufficiently different from `mod` items, at least at syntactic level. Also remove customization point for "`mod` item or crate root" from AST visitors.
2021-02-01Box the biggest ast::ItemKind variantsDániel Buga-9/+9
2021-01-09ast: Remove some indirection layers from values in key-value attributesVadim Petrochenkov-7/+3
2021-01-01first pass at default values for const genericsJulian Knodt-1/+6
- Adds optional default values to const generic parameters in the AST and HIR - Parses these optional default values - Adds a `const_generics_defaults` feature gate
2020-12-09Accept arbitrary expressions in key-value attributes at parse timeVadim Petrochenkov-1/+0
2020-11-28Auto merge of #78296 - Aaron1011:fix/stmt-tokens, r=petrochenkovbors-1/+1
Properly handle attributes on statements We now collect tokens for the underlying node wrapped by `StmtKind` nstead of storing tokens directly in `Stmt`. `LazyTokenStream` now supports capturing a trailing semicolon after it is initially constructed. This allows us to avoid refactoring statement parsing to wrap the parsing of the semicolon in `parse_tokens`. Attributes on item statements (e.g. `fn foo() { #[bar] struct MyStruct; }`) are now treated as item attributes, not statement attributes, which is consistent with how we handle attributes on other kinds of statements. The feature-gating code is adjusted so that proc-macro attributes are still allowed on item statements on stable. Two built-in macros (`#[global_allocator]` and `#[test]`) needed to be adjusted to support being passed `Annotatable::Stmt`.
2020-11-26Properly handle attributes on statementsAaron Hill-1/+1
We now collect tokens for the underlying node wrapped by `StmtKind` instead of storing tokens directly in `Stmt`. `LazyTokenStream` now supports capturing a trailing semicolon after it is initially constructed. This allows us to avoid refactoring statement parsing to wrap the parsing of the semicolon in `parse_tokens`. Attributes on item statements (e.g. `fn foo() { #[bar] struct MyStruct; }`) are now treated as item attributes, not statement attributes, which is consistent with how we handle attributes on other kinds of statements. The feature-gating code is adjusted so that proc-macro attributes are still allowed on item statements on stable. Two built-in macros (`#[global_allocator]` and `#[test]`) needed to be adjusted to support being passed `Annotatable::Stmt`.
2020-11-25ast and parserb-naber-0/+3
2020-11-14Add underscore expressions for destructuring assignmentsFabian Zaiser-0/+1
Co-authored-by: varkor <github@varkor.com>
2020-11-12Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkovMara Bos-1/+5
Implement destructuring assignment for structs and slices This is the second step towards implementing destructuring assignment (RFC: rust-lang/rfcs#2909, tracking issue: #71126). This PR is the second part of #71156, which was split up to allow for easier review. Note that the first PR (#78748) is not merged yet, so it is included as the first commit in this one. I thought this would allow the review to start earlier because I have some time this weekend to respond to reviews. If ``@petrochenkov`` prefers to wait until the first PR is merged, I totally understand, of course. This PR implements destructuring assignment for (tuple) structs and slices. In order to do this, the following *parser change* was necessary: struct expressions are not required to have a base expression, i.e. `Struct { a: 1, .. }` becomes legal (in order to act like a struct pattern). Unfortunately, this PR slightly regresses the diagnostics implemented in #77283. However, it is only a missing help message in `src/test/ui/issues/issue-77218.rs`. Other instances of this diagnostic are not affected. Since I don't exactly understand how this help message works and how to fix it yet, I was hoping it's OK to regress this temporarily and fix it in a follow-up PR. Thanks to ``@varkor`` who helped with the implementation, particularly around the struct rest changes. r? ``@petrochenkov``
2020-11-12Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011bors-1/+1
Do not collect tokens for doc comments Doc comment is a single token and AST has all the information to re-create it precisely. Doc comments are also responsible for majority of calls to `collect_tokens` (with `num_calls == 1` and `num_calls == 0`, cc https://github.com/rust-lang/rust/pull/78736). (I also moved token collection into `fn parse_attribute` to deduplicate code a bit.) r? `@Aaron1011`
2020-11-11Implement destructuring assignment for structs and slicesFabian Zaiser-1/+5
Co-authored-by: varkor <github@varkor.com>
2020-11-09Do not collect tokens for doc commentsVadim Petrochenkov-1/+1
2020-11-03rustc_ast: `visit_mac` -> `visit_mac_call`Vadim Petrochenkov-8/+8
2020-11-03rustc_ast: Do not panic by default when visiting macro callsVadim Petrochenkov-7/+2
2020-11-03Expand `NtExpr` tokens only in key-value attributesVadim Petrochenkov-25/+16
2020-10-16Add check_generic_arg early passSantiago Pastorino-5/+12
2020-10-16Parse inline const expressionsSantiago Pastorino-0/+1
2020-09-10Attach `TokenStream` to `ast::Visibility`Aaron Hill-1/+1
A `Visibility` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-08-30Factor out StmtKind::MacCall fields into `MacCallStmt` structAaron Hill-1/+1
In PR #76130, I add a fourth field, which makes using a tuple variant somewhat unwieldy.
2020-08-30mv compiler to compiler/mark-0/+913