about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
2020-02-29Move directory `libsyntax` -> `librustc_ast`Vadim Petrochenkov-2681/+0
2020-02-24syntax: Remove `Nt(Impl,Trait,Foreign)Item`Vadim Petrochenkov-0/+23
2020-02-24parse/ast: move `Defaultness` into variants.Mazdak Farrokhzad-11/+17
2020-02-24parser: tweak item kind wordingMazdak Farrokhzad-6/+17
2020-02-24ast: add `Defaultness` to `Item`, making `AssocItem` an alias.Mazdak Farrokhzad-16/+7
2020-02-24add `Span` to `ast::Defaultness::Default`.Mazdak Farrokhzad-1/+1
2020-02-22parse: allow `type Foo: Ord` syntactically.Mazdak Farrokhzad-2/+2
2020-02-18Rollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkovMazdak Farrokhzad-62/+39
parse: fuse associated and extern items up to defaultness Language changes: - The grammar of extern `type` aliases is unified with associated ones, and becomes: ```rust TypeItem = "type" ident generics {":" bounds}? where_clause {"=" type}? ";" ; ``` Semantic restrictions (`ast_validation`) are added to forbid any parameters in `generics`, any bounds in `bounds`, and any predicates in `where_clause`, as well as the presence of a type expression (`= u8`). (Work still remains to fuse this with free `type` aliases, but this can be done later.) - The grammar of constants and static items (free, associated, and extern) now permits the absence of an expression, and becomes: ```rust GlobalItem = {"const" {ident | "_"} | "static" "mut"? ident} {"=" expr}? ";" ; ``` - A semantic restriction is added to enforce the presence of the expression (the body). - A semantic restriction is added to reject `const _` in associated contexts. Together, these changes allow us to fuse the grammar of associated items and extern items up to `default`ness which is the main goal of the PR. ----------------------- We are now very close to fully fusing the entirely of item parsing and their ASTs. To progress further, we must make a decision: should we parse e.g. `default use foo::bar;` and whatnot? Accepting that is likely easiest from a parsing perspective, as it does not require using look-ahead, but it is perhaps not too onerous to only accept it for `fn`s (and all their various qualifiers), `const`s, `static`s, and `type`s. r? @petrochenkov
2020-02-17ast: add a FIXMEMazdak Farrokhzad-0/+2
2020-02-17Rename `FunctionRetTy` to `FnRetTy`Yuki Okushi-7/+6
2020-02-15ast: tweak AssocItemKind::Macro commentMazdak Farrokhzad-1/+1
2020-02-15Add additional commentAaron Hill-0/+6
2020-02-15Record proc macro harness order for use during metadata deserializationAaron Hill-0/+1
Fixes #68690 When we generate the proc macro harness, we now explicitly recorder the order in which we generate entries. We then use this ordering data to deserialize the correct proc-macro-data from the crate metadata.
2020-02-15ast: make ForeignItemKind an alias of AssocItemKindMazdak Farrokhzad-30/+3
2020-02-15parse extern constsMazdak Farrokhzad-0/+4
2020-02-15parse associated statics.Mazdak Farrokhzad-0/+2
2020-02-15ast/parser: fuse `static` & `const` grammars in all contexts.Mazdak Farrokhzad-1/+1
2020-02-15ast: make `= <expr>;` optional in free statics/consts.Mazdak Farrokhzad-2/+2
2020-02-15ast: normalize `ForeignItemKind::Ty` & `AssocItemKind::TyAlias`.Mazdak Farrokhzad-2/+2
2020-02-15ast: tweak comments of Foreign/AssocItemKindMazdak Farrokhzad-13/+10
2020-02-15ast: colocate AssocItem with ForeignItemMazdak Farrokhzad-39/+39
2020-02-15ast: move Generics into AssocItemKindsMazdak Farrokhzad-3/+2
2020-02-13IsAsync -> enum Async { Yes { span: Span, .. }, No }Mazdak Farrokhzad-13/+13
use new span for better diagnostics.
2020-02-13Constness -> enum Const { Yes(Span), No }Mazdak Farrokhzad-50/+18
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-05parser: merge `fn` grammars wrt. bodies & headersMazdak Farrokhzad-2/+13
also refactor `FnKind` and `visit_assoc_item` visitors
2020-02-01syntax::print -> new crate rustc_ast_prettyMazdak Farrokhzad-2/+2
2020-02-011. move node_id to syntaxMazdak Farrokhzad-11/+1
2. invert rustc_session & syntax deps 3. drop rustc_session dep in rustc_hir
2020-01-30Use `P` for `NtTraitItem`, `NtImplItem`, and `NtForeignItem`.Nicholas Nethercote-3/+3
This commit reduces the size of `Nonterminal` from a whopping 240 bytes to 72 bytes (on x86-64), which gets it below the `memcpy` threshold. It also removes some impedance mismatches with `Annotatable`, which already uses `P` for these variants.
2020-01-26Suggest defining type parameter when appropriateEsteban Küber-0/+14
``` error[E0412]: cannot find type `T` in this scope --> file.rs:3:12 | 3 | impl Trait<T> for Struct {} | - ^ not found in this scope | | | help: you might be missing a type parameter: `<T>` ``` Fix #64298.
2020-01-20Parse `?const ?Trait`Dylan MacKenzie-0/+5
2020-01-20Add `constness` field to `ty::Predicate::Trait`Dylan MacKenzie-1/+2
2020-01-20Revert "Add a `constness` field to `ast::TraitRef`"Dylan MacKenzie-17/+3
This reverts commit fd4a6a12136c5b5d6bce4081e95890df1fd1febd.
2020-01-20Add `MaybeConst` variant to `{ast,hir}::TraitBoundModifier`Dylan MacKenzie-2/+9
2020-01-19Add `constness` field to `ast::ItemKind::Impl`Dylan MacKenzie-0/+1
2020-01-17Use named fields for `ast::ItemKind::Impl`Dylan MacKenzie-10/+13
2020-01-14Code review changes and fix rustdoc test.Ben Lewis-33/+6
2020-01-14perf: eagerly convert literals to consts, this avoids creating loads on ↵Ben Lewis-7/+34
unevaluated consts which requires a lot of unnecessary work to evaluate them further down the line.
2020-01-10Introduce `#![feature(half_open_range_patterns)]`.Mazdak Farrokhzad-1/+1
This feature adds `X..`, `..X`, and `..=X` patterns.
2020-01-09Add a `constness` field to `ast::TraitRef`Dylan MacKenzie-3/+17
This is used for both the `?const` syntax in bounds as well as the `impl const Trait` syntax. I also considered handling these separately by adding a variant of `TraitBoundModifier` and a field to `ItemKind::Impl`, but this approach was less intrusive.
2020-01-02Normalize `syntax::source_map` imports.Mazdak Farrokhzad-4/+3
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-3/+3
2019-12-28doc comments: Less attribute mimickingVadim Petrochenkov-4/+0
2019-12-23Add new folder for destructuring assignment testsvarkor-0/+1
2019-12-23Add span information to `ExprKind::Assign`varkor-1/+1
2019-12-22Format the worldMark Rousskov-128/+130
2019-12-21Rollup merge of #67355 - Centril:merge-mut, r=oli-obkMazdak Farrokhzad-10/+10
Merge `ast::Mutability` and `mir::Mutability` r? @oli-obk
2019-12-20introduce 'type AttrVec'Mazdak Farrokhzad-8/+11
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-10/+10
2. mir::Mutability -> ast::Mutability.
2019-12-20Rollup merge of #67131 - Centril:item-merge, r=petrochenkovMazdak Farrokhzad-36/+25
Merge `TraitItem` & `ImplItem into `AssocItem` In this PR we: - Merge `{Trait,Impl}Item{Kind?}` into `AssocItem{Kind?}` as discussed in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286. - This is done by using the cover grammar of both forms. - In particular, it requires that we syntactically allow (under `#[cfg(FALSE)]`): - `default`ness on `trait` items, - `impl` items without a body / definition (`const`, `type`, and `fn`), - and associated `type`s in `impl`s with bounds, e.g., `type Foo: Ord;`. - The syntactic restrictions are replaced by semantic ones in `ast_validation`. - Move syntactic restrictions around C-variadic parameters from the parser into `ast_validation`: - `fn`s in all contexts now syntactically allow `...`, - `...` can occur anywhere in the list syntactically (`fn foo(..., x: usize) {}`), - and `...` can be the sole parameter (`fn foo(...) {}`. r? @petrochenkov
2019-12-18Fix comment orderingMatthew Jasper-4/+4