about summary refs log tree commit diff
path: root/src/librustc_parse/parser/item.rs
AgeCommit message (Collapse)AuthorLines
2020-02-13parser: address review commentsMazdak Farrokhzad-1/+1
2020-02-13parser: move `ban_async_in_2015` to `fn` parsing & improve it.Mazdak Farrokhzad-0/+12
2020-02-13parser: inline `parse_assoc_fn` and friends.Mazdak Farrokhzad-42/+21
2020-02-13parser: solidify `fn` parsing with `parse_fn`.Mazdak Farrokhzad-23/+30
2020-02-13parser: fuse free `fn` parsing together.Mazdak Farrokhzad-86/+25
2020-02-13parser_fn_front_matter: allow `const .. extern`Mazdak Farrokhzad-53/+52
2020-02-13IsAsync -> enum Async { Yes { span: Span, .. }, No }Mazdak Farrokhzad-35/+9
use new span for better diagnostics.
2020-02-13Constness -> enum Const { Yes(Span), No }Mazdak Farrokhzad-43/+34
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-05parser: merge `fn` grammars wrt. bodies & headersMazdak Farrokhzad-66/+49
also refactor `FnKind` and `visit_assoc_item` visitors
2020-02-05parse_ty_common: use `enum`s instead of `bool`s.Mazdak Farrokhzad-3/+4
2020-02-02Rollup merge of #68769 - Centril:unwrap, r=petrochenkovMazdak Farrokhzad-4/+3
parser: avoid re-wrapping NtItem r? @petrochenkov
2020-02-02Rollup merge of #68764 - Centril:self-semantic, r=petrochenkovMazdak Farrokhzad-42/+22
parser: syntactically allow `self` in all `fn` contexts Part of https://github.com/rust-lang/rust/pull/68728. `self` parameters are now *syntactically* allowed as the first parameter irrespective of item context (and in function pointers). Instead, semantic validation (`ast_validation`) is used. r? @petrochenkov
2020-02-02parser: avoid re-wrapping NtItemMazdak Farrokhzad-4/+3
2020-02-02parser: address review comments re. `self`.Mazdak Farrokhzad-19/+7
2020-02-02parser: move restrictions re. `self` to `ast_validation`.Mazdak Farrokhzad-34/+26
2020-02-01syntax::print -> new crate rustc_ast_prettyMazdak Farrokhzad-1/+1
2020-01-31Auto merge of #68633 - JohnTitor:avoid-ice-in-diagnostics, r=estebankbors-17/+23
Avoid ICE in macro's diagnostics Fixes #68629 r? @estebank
2020-01-30Change Applicability to `HasPlaceholders`Yuki Okushi-1/+1
2020-01-30Use `P` for `NtTraitItem`, `NtImplItem`, and `NtForeignItem`.Nicholas Nethercote-17/+17
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-29Avoid ICE in macro's diagnosticsYuki Okushi-17/+23
2020-01-21Rollup merge of #68140 - ecstatic-morse:const-trait-bound-opt-out, r=oli-obkMazdak Farrokhzad-12/+6
Implement `?const` opt-out for trait bounds For now, such bounds are treated exactly the same as unprefixed ones in all contexts. [RFC 2632](https://github.com/rust-lang/rfcs/pull/2632) does not specify whether such bounds are forbidden outside of `const` contexts, so they are allowed at the moment. Prior to this PR, the constness of a trait bound/impl was stored in `TraitRef`. Now, the constness of an `impl` is stored in `ast::ItemKind::Impl` and the constness of a bound in `ast::TraitBoundModifer`. Additionally, constness of trait bounds is now stored in an additional field of `ty::Predicate::Trait`, and the combination of the constness of the item along with any `TraitBoundModifier` determines the constness of the bound in accordance with the RFC. Encoding the constness of impls at the `ty` level is left for a later PR. After a discussion in \#wg-grammar on Discord, it was decided that the grammar should not encode the mutual exclusivity of trait bound modifiers. The grammar for trait bound modifiers remains `[?const] [?]`. To encode this, I add a dummy variant to `ast::TraitBoundModifier` that is used when the syntax `?const ?` appears. This variant causes an error in AST validation and disappears during HIR lowering. cc #67794 r? @oli-obk
2020-01-19Store `impl const` in `ItemKind::Impl`Dylan MacKenzie-12/+4
2020-01-19Add `constness` field to `ast::ItemKind::Impl`Dylan MacKenzie-0/+2
2020-01-18remove rustc_error_codes deps except in rustc_driverMazdak Farrokhzad-1/+0
2020-01-17Use named fields for `ast::ItemKind::Impl`Dylan MacKenzie-10/+10
2020-01-11Rollup merge of #68084 - estebank:ice-68000, r=varkorMazdak Farrokhzad-3/+3
Do not ICE on unicode next point Use `shrink_to_hi` instead of `next_point` and fix `next_point`. Fix #68000, fix #68091, fix #68092.
2020-01-10Change `next_point` when `shrink_to_hi` is more appropriateEsteban Küber-2/+2
2020-01-09Do not ICE on unicode next pointEsteban Küber-1/+1
Use `shrink_to_hi` instead of `next_point` Fix #68000.
2020-01-10Rollup merge of #68073 - Centril:fix-68062, r=estebankMazdak Farrokhzad-1/+1
expect `fn` after `const unsafe` / `const extern` Fixes #68062 r? @estebank @petrochenkov cc @Aaron1011
2020-01-10Rollup merge of #68071 - estebank:ice-67995, r=CentrilMazdak Farrokhzad-1/+5
Extend support of `_` in type parameters - Account for `impl Trait<_>`. - Provide a reasonable `Span` for empty `Generics` in `impl`s. - Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`. - Fix #67995. Follow up to #67597.
2020-01-09Reject `const` in inherent implsDylan MacKenzie-3/+12
2020-01-09Parse `impl const Trait for Ty` syntaxDylan MacKenzie-3/+11
2020-01-09Extend support of `_` in type parametersEsteban Küber-1/+5
- Account for `impl Trait<_>`. - Provide a reasonable `Span` for empty `Generics` in `impl`s. - Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`. - Fix #67995.
2020-01-09expect `fn` after `const unsafe` / `const extern`Mazdak Farrokhzad-1/+1
2020-01-08- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}Mazdak Farrokhzad-2/+1
- remove syntax::{help!, span_help!, span_note!} - remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!} - lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints - inline syntax::{struct_span_warn!, diagnostic_used!} - stringify_error_code! -> error_code! & use it more. - find_plugin_registrar: de-fatalize an error - de-fatalize metadata errors - move type_error_struct! to rustc_typeck - struct_span_err! -> rustc_errors
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-3/+3
2019-12-31parser::item: remove .fatal callsMazdak Farrokhzad-8/+7
2019-12-31parser: span_fatal -> struct_span_errMazdak Farrokhzad-3/+1
2019-12-31de-fatalize some errorsMazdak Farrokhzad-1/+1
2019-12-31parser: call .struct_span_err directlyMazdak Farrokhzad-12/+8
2019-12-23extract parse_not_exprMazdak Farrokhzad-4/+4
2019-12-22Format the worldMark Rousskov-288/+262
2019-12-22Rollup merge of #67148 - Centril:ty-polish, r=estebankMazdak Farrokhzad-5/+2
Refactor type & bounds parsing thoroughly PR is based on https://github.com/rust-lang/rust/pull/67131 with first one from this PR being ` extract parse_ty_tuple_or_parens`. Also fixes #67146. r? @estebank
2019-12-21extract parse_array_or_slice_tyMazdak Farrokhzad-5/+2
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-4/+3
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-10/+10
2. mir::Mutability -> ast::Mutability.
2019-12-12`AssocImplKind::{Method -> Fn}`.Mazdak Farrokhzad-1/+1
2019-12-12More c-variadic errors as semantic restrictions.Mazdak Farrokhzad-45/+10
2019-12-12Move `allow_c_varadic` logic to `ast_validation`.Mazdak Farrokhzad-14/+2