about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2020-02-29Move directory `libsyntax` -> `librustc_ast`Vadim Petrochenkov-8644/+0
2020-02-28Rollup merge of #69384 - petrochenkov:nounnorm, r=CentrilMazdak Farrokhzad-32/+35
parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token` So, after https://github.com/rust-lang/rust/pull/69006, its follow-ups and an attempt to remove `Parser::prev_span` I came to the conclusion that the unnormalized token and its span is what you want in most cases, so it should be default. Normalization only makes difference in few cases where we are checking against `token::Ident` or `token::Lifetime` specifically. This PR uses `normalized_token` for those cases. Using normalization explicitly means that people writing code should remember about `NtIdent` and `NtLifetime` in general. (That is alleviated by the fact that `token.ident()` and `fn parse_ident_*` are already written.) Remembering about `NtIdent`, was, however, already the case, kind of, because the implicit normalization was performed only for the current/previous token, but not for things like `look_ahead`. As a result, most of token classification methods in `token.rs` already take `NtIdent` into account (this PR fixes a few pre-existing minor mistakes though). The next step is removing `normalized(_prev)_token` entirely and replacing it with `token.ident()` (mostly) and `token.normalize()` (occasionally). I want to make it a separate PR for that and run it though perf. `normalized_token` filled on every bump has both a potential to avoid repeated normalization, and to do unnecessary work in advance (it probably doesn't matter anyway, the normalization is very cheap). r? @Centril
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-1/+1
example: let s: String = format!("hello").into();
2020-02-24syntax: Remove `Nt(Impl,Trait,Foreign)Item`Vadim Petrochenkov-22/+23
2020-02-24Add some missing support for `NtIdent`Vadim Petrochenkov-32/+35
2020-02-24parse/ast: move `Defaultness` into variants.Mazdak Farrokhzad-29/+34
2020-02-24parser: tweak item kind wordingMazdak Farrokhzad-6/+17
2020-02-24ast: add `Defaultness` to `Item`, making `AssocItem` an alias.Mazdak Farrokhzad-22/+13
2020-02-24add `Span` to `ast::Defaultness::Default`.Mazdak Farrokhzad-1/+1
2020-02-23Rollup merge of #69376 - petrochenkov:bumpwith, r=CentrilDylan DPC-0/+33
parser: Cleanup `Parser::bump_with` and its uses Follow-up to https://github.com/rust-lang/rust/pull/69006. r? @Centril
2020-02-23Rollup merge of #69375 - Menschenkindlein:master, r=Dylan-DPCDylan DPC-2/+2
Rename CodeMap to SourceMap follow up See https://github.com/rust-lang/rust/issues/51574
2020-02-22parser: Cleanup `Parser::bump_with` and its usesVadim Petrochenkov-0/+33
2020-02-22Rename CodeMap to SourceMap follow upMaxim Zholobak-2/+2
2020-02-22parse: allow `type Foo: Ord` syntactically.Mazdak Farrokhzad-7/+9
2020-02-18Rollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkovMazdak Farrokhzad-118/+90
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-13/+12
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-3/+4
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-15visit: unify extern & assoc item visitingMazdak Farrokhzad-58/+40
2020-02-15ast: make ForeignItemKind an alias of AssocItemKindMazdak Farrokhzad-30/+3
2020-02-15parse extern constsMazdak Farrokhzad-2/+7
2020-02-15parse associated statics.Mazdak Farrokhzad-2/+4
2020-02-15ast/parser: fuse `static` & `const` grammars in all contexts.Mazdak Farrokhzad-3/+9
2020-02-15ast: make `= <expr>;` optional in free statics/consts.Mazdak Farrokhzad-9/+5
2020-02-15ast: normalize `ForeignItemKind::Ty` & `AssocItemKind::TyAlias`.Mazdak Farrokhzad-4/+12
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-10/+11
2020-02-13parser: fuse free `fn` parsing together.Mazdak Farrokhzad-3/+7
2020-02-13IsAsync -> enum Async { Yes { span: Span, .. }, No }Mazdak Farrokhzad-18/+18
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-78/+80
also refactor `FnKind` and `visit_assoc_item` visitors
2020-02-04Auto merge of #68708 - Mark-Simulacrum:stage0-step, r=pietroalbinibors-1/+0
Step stage0 to bootstrap from 1.42 This also includes a commit which fixes the rustfmt downloading logic to redownload when the rustfmt channel changes, and bumps rustfmt to a more recent version.
2020-02-01syntax: reexport attr globalsMazdak Farrokhzad-0/+1
2020-02-01syntax::print -> new crate rustc_ast_prettyMazdak Farrokhzad-3540/+5
2020-02-011. move allow_internal_unstable to rustc_attrMazdak Farrokhzad-25/+0
2. as a result, drop rustc_errors dep from syntax
2020-02-011. move node_id to syntaxMazdak Farrokhzad-14/+50
2. invert rustc_session & syntax deps 3. drop rustc_session dep in rustc_hir
2020-02-01Move builtin attribute logic to new rustc_attr crate.Mazdak Farrokhzad-1052/+0
For now, this is all the crate contains, but more attribute logic & types will be moved there over time.
2020-02-01syntax: simplify HasAttrs codeMazdak Farrokhzad-21/+11
2020-02-01pretty: remove ParseSess dependencyMazdak Farrokhzad-20/+13
2020-02-01syntax: move GLOBALS to attr moduleMazdak Farrokhzad-37/+34
2020-02-01{syntax -> rustc_ast_passes}::node_countMazdak Farrokhzad-140/+0
2020-01-31Drop cfg(bootstrap) codeMark Rousskov-1/+0
2020-01-31Auto merge of #67340 - nnethercote:shrink-Nonterminal, r=petrochenkovbors-17/+22
Shrink `Nonterminal` These commits shrink `Nonterminal` from 240 bytes to 40 bytes. When building `serde_derive` they reduce the number of `memcpy` calls from 9.6M to 7.4M, and it's a tiny win on a few other benchmarks. r? @petrochenkov
2020-01-30clarify "incorrect issue" errorAndy Russell-21/+34
2020-01-30Use `P` for `NtMeta`.Nicholas Nethercote-3/+4
This commit reduces the size of `Nonterminal` from a 72 bytes to 40 bytes (on x86-64).
2020-01-30Use `P` for `NtTraitItem`, `NtImplItem`, and `NtForeignItem`.Nicholas Nethercote-15/+19
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.