about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2019-01-14Rollup merge of #57585 - estebank:trailing-semicolon, r=petrochenkovMazdak Farrokhzad-24/+35
Recover from item trailing semicolon CC https://github.com/rust-lang/rfcs/pull/2479 r? @petrochenkov
2019-01-14Rollup merge of #57572 - Centril:unaccept-extern-in-path, r=petrochenkovMazdak Farrokhzad-10/+3
Unaccept `extern_in_paths` Based on completed fcp-close in https://github.com/rust-lang/rust/issues/55600, this removes `extern_in_path` (e.g. `extern::foo::bar`) from the language. The changes are primarily reversing https://github.com/rust-lang/rust/commit/32db83b16e06cb5cca72d0e6a648a8008eda0fac. Closes https://github.com/rust-lang/rust/issues/55600 r? @petrochenkov
2019-01-14Rollup merge of #57540 - estebank:eval-more, r=petrochenkovMazdak Farrokhzad-31/+122
Modify some parser diagnostics to continue evaluating beyond the parser Continue evaluating further errors after parser errors on: - trailing type argument attribute - lifetime in incorrect location - incorrect binary literal - missing `for` in `impl Trait for Foo` - type argument in `where` clause - incorrect float literal - incorrect `..` in pattern - associated types - incorrect discriminator value variant error and others. All of these were found by making `continue-parse-after-error` `true` by default to identify errors that would need few changes. There are now only a handful of errors that have any change with `continue-parse-after-error` enabled. These changes make it so `rust` _won't_ stop evaluation after finishing parsing, enabling type checking errors to be displayed on the existing code without having to fix the parse errors. Each commit has an individual diagnostic change with their corresponding tests. CC #48724.
2019-01-13Recover from item trailing semicolonEsteban Küber-24/+35
2019-01-13Rollup merge of #57004 - nnethercote:TS-change-Stream, r=petrochenkovMazdak Farrokhzad-5/+5
Make `TokenStream` less recursive. `TokenStream` is currently recursive in *two* ways: - the `TokenTree` variant contains a `ThinTokenStream`, which can contain a `TokenStream`; - the `TokenStream` variant contains a `Vec<TokenStream>`. The latter is not necessary and causes significant complexity. This commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`. This reduces complexity significantly. In particular, `StreamCursor` is eliminated, and `Cursor` becomes much simpler, consisting now of just a `TokenStream` and an index. The commit also removes the `Extend` impl for `TokenStream`, because it is only used in tests. (The commit also removes those tests.) Overall, the commit reduces the number of lines of code by almost 200.
2019-01-13remove extern_in_paths.Mazdak Farrokhzad-10/+3
2019-01-12Suggest correct location for lifetime parameters in useEsteban Küber-9/+43
2019-01-11Add label for invalid literal suffixEsteban Küber-0/+2
2019-01-11Tweak incorrect discriminator value variant errorEsteban Küber-7/+13
2019-01-11Small tweaks to parser errorsEsteban Küber-7/+20
2019-01-11Tweak type argument after assoc type errorEsteban Küber-2/+9
2019-01-11Continue evaluating after finding incorrect .. in patternEsteban Küber-3/+10
2019-01-11Continue evaluating after incorrect float literalEsteban Küber-1/+5
2019-01-11Continue evaluating after type argument in where clauseEsteban Küber-2/+6
2019-01-11Continue evaluating after missing `for` in `impl Trait for Foo`Esteban Küber-1/+7
2019-01-11Continue evaluating after parsing incorrect binary literalEsteban Küber-1/+1
2019-01-11Continue parsing after lifetime in incorrect locationEsteban Küber-2/+6
2019-01-11Continue parser after trailing type argument attributeEsteban Küber-2/+6
2019-01-11stabilize top level or-pats in if/while let.Mazdak Farrokhzad-2/+3
2019-01-08Make `TokenStream` less recursive.Nicholas Nethercote-5/+5
`TokenStream` is currently recursive in *two* ways: - the `TokenTree` variant contains a `ThinTokenStream`, which can contain a `TokenStream`; - the `TokenStream` variant contains a `Vec<TokenStream>`. The latter is not necessary and causes significant complexity. This commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`. This reduces complexity significantly. In particular, `StreamCursor` is eliminated, and `Cursor` becomes much simpler, consisting now of just a `TokenStream` and an index. The commit also removes the `Extend` impl for `TokenStream`, because it is only used in tests. (The commit also removes those tests.) Overall, the commit reduces the number of lines of code by almost 200.
2019-01-02Auto merge of #57251 - petrochenkov:reregr, r=varkorbors-1/+2
syntax: Fix regression in diagnostics for patterns in trait method parameters Fixes https://github.com/rust-lang/rust/issues/55036
2019-01-01Auto merge of #57209 - estebank:suggest-raw-ident, r=petrochenkovbors-0/+12
Suggest using raw identifiers in 2018 edition when using keywords
2019-01-01syntax: Fix regression in diagnostics for patterns in trait method parametersVadim Petrochenkov-1/+2
2018-12-31Do not use unicode character in diagnostic helpEsteban Küber-1/+1
2018-12-31Use structured suggestion for braceless unicode escape squenceEsteban Küber-6/+30
2018-12-31Address review commentsEsteban Küber-12/+13
- Suggest raw ident escaping in all editions - Keep primary label in all cases
2018-12-31Suggest using raw identifiers in 2018 edition when using keywordsEsteban Küber-1/+12
2018-12-27Address review comments and CI failuresVadim Petrochenkov-0/+1
2018-12-27Fix `trace_macros` and `log_syntax`Vadim Petrochenkov-1/+1
2018-12-27Get rid of `Block::recovered`Vadim Petrochenkov-6/+6
2018-12-25Remove licensesMark Rousskov-90/+0
2018-12-23Rollup merge of #56964 - nnethercote:TokenStream-IsJoint, r=petrochenkovMazdak Farrokhzad-3/+2
Remove `TokenStream::JointTree`. This is done by adding a new `IsJoint` field to `TokenStream::Tree`, which simplifies a lot of `match` statements. And likewise for `CursorKind`. The commit also adds a new method `TokenTree:stream()` which can replace a choice between `.into()` and `.joint()`.
2018-12-20Auto merge of #56647 - petrochenkov:dcrate2, r=alexcrichtonbors-1/+3
Rework treatment of `$crate` in procedural macros Important clarification: `$crate` below means "processed `$crate`" or "output `$crate`". In the input of a decl macro `$crate` is just two separate tokens, but in the *output of a decl macro* `$crate` is a single keyword identifier (https://github.com/rust-lang/rust/issues/55640#issuecomment-435692791). First of all, this PR removes the `eliminate_crate_var` hack. `$crate::foo` is no longer replaced with `::foo` or `::crate_name::foo` in the input of derive proc macros, it's passed to the macro instead with its precise span and hygiene data, and can be treated as any other path segment keyword (like `crate` or `self`) after that. (Note: `eliminate_crate_var` was never used for non-derive proc macros.) This creates an annoying problem - derive macros still may stringify their input before processing and expect `$crate` survive that stringification and refer to the same crate (the Rust 1.15-1.29 way of doing things). Moreover, the input of proc macro attributes and derives (but not fn-like proc macros) also effectively survives stringification before being passed to the macro (also for legacy implementation reasons). So we kind of resurrect the `eliminate_crate_var` hack in reduced form, but apply it only to AST pretty-printing. If an AST fragment is pretty-printed, the resulting *text* will have `$crate` replaced with `crate` or `::crate_name`. This should be enough to keep all the legacy cases working. Closes https://github.com/rust-lang/rust/issues/55640 Closes https://github.com/rust-lang/rust/issues/56622 r? @ghost
2018-12-20Remove `TokenStream::JointTree`.Nicholas Nethercote-3/+2
This is done by adding a new `IsJoint` field to `TokenStream::Tree`, which simplifies a lot of `match` statements. And likewise for `CursorKind`. The commit also adds a new method `TokenTree:stream()` which can replace a choice between `.into()` and `.joint()`.
2018-12-19Do not interpret mismatches from pretty-printed `$crate` as token stream ↵Vadim Petrochenkov-1/+3
invalidation
2018-12-19Auto merge of #56613 - Zoxc:query-perf1, r=michaelwoeristerbors-0/+1
Tweak query code for performance Split from https://github.com/rust-lang/rust/pull/56509 r? @michaelwoerister
2018-12-19Rollup merge of #56910 - estebank:unclosed-eof, r=oli-obkPietro Albini-1/+9
Do not point at delim spans for complete correct blocks Fix #56834.
2018-12-19Rollup merge of #56820 - ljedrz:format_tweaks, r=alexcrichtonPietro Albini-0/+3
format-related tweaks - remove an unreachable condition - inline one-liners related to `parse_expr` (called in succession) - refactor `report_invalid_references` - refactor `verify_arg_type` - minor stylistic improvements
2018-12-17Do not point at delim spans for complete correct blocksEsteban Küber-1/+9
2018-12-17Tweak query code for performanceJohn Kåre Alsaker-0/+1
2018-12-17Auto merge of #56737 - nnethercote:TokenStream-improvements, r=petrochenkovbors-9/+9
`TokenStream` improvements Some `TokenStream` improvements: shrinking `TokenStream` and some other types, and some other code clean-ups.
2018-12-15Auto merge of #56584 - davidtwco:issue-53990, r=nikomatsakisbors-4/+15
2018 edition - confusing error message when declaring unnamed parameters Fixes #53990. This PR adds a note providing context for the change to argument names being required in the 2018 edition for trait methods and a suggestion for the fix.
2018-12-14Rollup merge of #56699 - nnethercote:SymbolIndex, r=oli-obkkennytm-0/+4
Use a `newtype_index!` within `Symbol`. This shrinks `Option<Symbol>` from 8 bytes to 4 bytes, which shrinks `Token` from 24 bytes to 16 bytes. This reduces instruction counts by up to 1% across a range of benchmarks. r? @oli-obk
2018-12-14Rollup merge of #56658 - Xanewok:non-panicking-file-parser, r=petrochenkovkennytm-8/+29
Add non-panicking `maybe_new_parser_from_file` variant Add (seemingly?) missing `maybe_new_parser_from_file` constructor variant. Disclaimer: I'm not certain this is the correct approach - just found out we don't have this when working on a Rustfmt PR to catch/prevent more Rust parser panics: https://github.com/rust-lang/rustfmt/pull/3240 and tried to make it work somehow.
2018-12-14format: inline one-liners related to parse_exprljedrz-0/+3
2018-12-12Rename `TokenStream::concat` and remove `TokenStream::concat_rc_vec`.Nicholas Nethercote-9/+9
`TokenStream::new` is a better name for the former, and the latter is now just equivalent to `TokenStream::Stream`.
2018-12-12XXX: SymbolIndexNicholas Nethercote-0/+4
2018-12-12Use a `newtype_index!` within `Symbol`.Nicholas Nethercote-0/+4
This shrinks `Option<Symbol>` from 8 bytes to 4 bytes, which shrinks `Token` from 24 bytes to 16 bytes. This reduces instruction counts by up to 1% across a range of benchmarks.
2018-12-10Remove `tokenstream::Delimited`.Nicholas Nethercote-79/+78
Because it's an extra type layer that doesn't really help; in a couple of places it actively gets in the way, and overall removing it makes the code nicer. It does, however, move `tokenstream::TokenTree` further away from the `TokenTree` in `quote.rs`. More importantly, this change reduces the size of `TokenStream` from 48 bytes to 40 bytes on x86-64, which is enough to slightly reduce instruction counts on numerous benchmarks, the best by 1.5%. Note that `open_tt` and `close_tt` have gone from being methods on `Delimited` to associated methods of `TokenTree`.
2018-12-09Add missing, non-panicking `maybe_new_parser_from_file` variantIgor Matuszewski-8/+29