about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser/item.rs
AgeCommit message (Collapse)AuthorLines
2019-11-10move syntax::parse -> librustc_parseMazdak Farrokhzad-2237/+0
also move MACRO_ARGUMENTS -> librustc_parse
2019-11-08ast::ItemKind::Fn: use ast::FnSigMazdak Farrokhzad-1/+1
2019-11-08ast::MethodSig -> ast::FnSigMazdak Farrokhzad-3/+3
2019-11-07move PResult to librustc_errorsMazdak Farrokhzad-2/+2
2019-11-07Rollup merge of #65974 - Centril:matcher-friendly-gating, r=petrochenkovMazdak Farrokhzad-5/+3
A scheme for more macro-matcher friendly pre-expansion gating Pre-expansion gating will now avoid gating macro matchers that did not result in `Success(...)`. That is, the following is now OK despite `box 42` being a valid `expr` and that form being pre-expansion gated: ```rust macro_rules! m { ($e:expr) => { 0 }; // This fails on the input below due to `, foo`. (box $e:expr, foo) => { 1 }; // Successful matcher, we should get `2`. } fn main() { assert_eq!(1, m!(box 42, foo)); } ``` Closes https://github.com/rust-lang/rust/issues/65846. r? @petrochenkov cc @Mark-Simulacrum
2019-11-07parser: allow ABIs from literal macro fragmentsMazdak Farrokhzad-1/+1
2019-11-07parser: don't hardcode ABIs into grammarMazdak Farrokhzad-12/+9
2019-11-06Make doc comments cheaper with `AttrKind`.Nicholas Nethercote-5/+7
`AttrKind` is a new type with two variants, `Normal` and `DocComment`. It's a big performance win (over 10% in some cases) because `DocComment` lets doc comments (which are common) be represented very cheaply. `Attribute` gets some new helper methods to ease the transition: - `has_name()`: check if the attribute name matches a single `Symbol`; for `DocComment` variants it succeeds if the symbol is `sym::doc`. - `is_doc_comment()`: check if it has a `DocComment` kind. - `{get,unwrap}_normal_item()`: extract the item from a `Normal` variant; panic otherwise. Fixes #60935.
2019-11-06revamp pre-expansion gating infraMazdak Farrokhzad-5/+3
2019-10-30Reduce ammount of errors given unclosed delimiterEsteban Küber-7/+10
When in a file with a non-terminated item, catch the error and consume the block instead of trying to recover it more granularly in order to reduce the amount of unrelated errors that would be fixed after adding the missing closing brace. Also point out the possible location of the missing closing brace.
2019-10-28Use heuristics to recover parsing of missing `;`Esteban Küber-12/+12
- Detect `,` and `:` typos where `;` was intended. - When the next token could have been the start of a new statement, detect a missing semicolon.
2019-10-25Rollup merge of #65790 - Centril:move-report-invalid, r=davidtwcoMazdak Farrokhzad-0/+20
move report_invalid_macro_expansion_item to item.rs From https://github.com/rust-lang/rust/pull/65324. r? @Mark-Simulacrum
2019-10-25move report_invalid_macro_expansion_item to item.rsMazdak Farrokhzad-0/+20
2019-10-24pre-expansion gate decl_macroMazdak Farrokhzad-0/+5
2019-10-24pre-expansion gate trait_alias.Mazdak Farrokhzad-0/+2
2019-10-24syntax: reject `trait Foo: Bar = Baz;`.Mazdak Farrokhzad-8/+20
Add test for rejecting `trait A: B1 = B2;`. Also test rejection of `trait A: = B;`.
2019-10-22refactor maybe_appendyjhmelody-2/+8
2019-10-16move syntax::ext to new crate syntax_expandMazdak Farrokhzad-3/+3
2019-10-16syntax::parse: don't depend on syntax::extMazdak Farrokhzad-2/+1
2019-10-16syntax: reduce visibilitiesMazdak Farrokhzad-3/+3
2019-10-16move diagnostics.rs into parser/Mazdak Farrokhzad-1/+2
2019-10-13syntax: consolidate function parsing in `item.rs`Mazdak Farrokhzad-205/+485
2019-10-07syntax: refactor with new `fn parse_use_tree_glob_or_nested`.Mazdak Farrokhzad-10/+11
2019-10-07syntax: unify and simplify fn signature parsing.Mazdak Farrokhzad-26/+29
2019-10-07syntax: unify trait parsing a bit.Mazdak Farrokhzad-17/+12
2019-10-07syntax: further item parsing cleanupMazdak Farrokhzad-24/+35
2019-10-07syntax: de-dups in item parsing.Mazdak Farrokhzad-50/+44
2019-10-07syntax: cleanup associated const parsing.Mazdak Farrokhzad-32/+39
2019-10-02Add missing 'bump'Aaron Hill-0/+1
2019-10-02Add support for 'extern const fn'Aaron Hill-19/+33
This works just as you might expect - an 'extern const fn' is a 'const fn' that is callable from foreign code. Currently, panicking is not allowed in consts. When RFC 2345 is stabilized, then panicking in an 'extern const fn' will produce a compile-time error when invoked at compile time, and an abort when invoked at runtime. Since this is extending the language (we're allowing the `const` keyword in a new context), I believe that this will need an FCP. However, it's a very minor change, so I didn't think that filing an RFC was necessary. This will allow libc (and other FFI crates) to make many functions `const`, without having to give up on making them `extern` as well.
2019-10-01syntax: reformat passing of `FnHeader` to `parse_item_fn`.Mazdak Farrokhzad-12/+16
2019-09-30syntax: reduce repetition in fn parsing.Mazdak Farrokhzad-26/+21
2019-09-30syntax: stylistic cleanup in item parsing.Mazdak Farrokhzad-107/+47
2019-09-30syntax: fuse more code paths together.Mazdak Farrokhzad-48/+51
2019-09-30syntax: cleanup `parse_fn_decl`.Mazdak Farrokhzad-6/+3
2019-09-30syntax: cleanup method parsing.Mazdak Farrokhzad-73/+65
2019-09-29Rollup merge of #64894 - Centril:fix-64682, r=petrochenkovMazdak Farrokhzad-26/+18
syntax: fix dropping of attribute on first param of non-method assocated fn Fixes #64682. The general idea is that we bake parsing of `self` into `parse_param_general` and then we just use standard list parsing. Overall, this simplifies the parsing and makes it more consistent. r? @petrochenkov cc @c410-f3r
2019-09-29syntax: fix #64682.Mazdak Farrokhzad-26/+18
Fuse parsing of `self` into `parse_param_general`.
2019-09-28syntax: don't keep a redundant c_variadic flag in the AST.Eduard-Mihai Burtescu-2/+1
2019-09-26Rename `ForeignItem.node` to `ForeignItem.kind`varkor-4/+4
2019-09-26Rename `Item.node` to `Item.kind`varkor-2/+2
2019-09-26Rename `Ty.node` to `Ty.kind`varkor-3/+3
2019-09-26Rename `TraitItem.node` to `TraitItem.kind`varkor-2/+2
2019-09-26Rename `ImplItem.node` to `ImplItem.kind`varkor-4/+4
2019-09-23Add parser recovery for `const $ident = $expr;`.Mazdak Farrokhzad-3/+44
Then use the diagnostics-stealing API to stash parser errors and enrich them with type information in typeck.
2019-09-15Give more `Idents` spansMatthew Jasper-1/+1
2019-09-09Resolve attributes in several placesCaio-0/+3
Arm, Field, FieldPat, GenericParam, Param, StructField and Variant
2019-09-07Aggregation of cosmetic changes made during work on REPL PRs: libsyntaxAlexander Regueiro-57/+58
2019-08-27Cleanup: Consistently use `Param` instead of `Arg` #62426Kevin Per-5/+5
2019-08-20Allow 'default async fn' to parse.Mazdak Farrokhzad-0/+1