about summary refs log tree commit diff
path: root/src/librustc_parse/parser
AgeCommit message (Collapse)AuthorLines
2020-03-27split parse_angle_args into loop / single stepMazdak Farrokhzad-63/+67
2020-03-27parse: move constraint/arg restriction to ast_validation.Mazdak Farrokhzad-53/+23
2020-03-26Rollup merge of #70428 - Centril:move-to-mod, r=petrochenkovDylan DPC-2/+4
`error_bad_item_kind`: add help text For example, this adds: ``` = help: consider moving the `use` import out to a nearby module scope ``` r? @petrochenkov @estebank Fixes https://github.com/rust-lang/rust/issues/37205.
2020-03-26error_bad_item_kind: add help textMazdak Farrokhzad-2/+4
2020-03-26parse: recover on `const fn()` / `async fn()`.Mazdak Farrokhzad-18/+30
2020-03-26Throw error when encountering `...` instead of `..` while destructing a patternRakshith Ravi-0/+21
Added tests and stderr output
2020-03-26Rollup merge of #69878 - estebank:chained-ops, r=CentrilMazdak Farrokhzad-52/+103
Tweak chained operators diagnostic Use more selective spans Improve suggestion output Be more selective when displaying suggestions Silence some knock-down type errors r? @Centril
2020-03-25review commentsEsteban Küber-26/+25
2020-03-25Tweak chained operators diagnosticEsteban Küber-46/+98
Use more selective spans Improve suggestion output Be more selective when displaying suggestions Silence some knock-down type errors
2020-03-25Rename `def_span` to `guess_head_span`Esteban Küber-1/+1
2020-03-23Rollup merge of #70248 - Centril:unroot, r=petrochenkovMazdak Farrokhzad-5/+0
parser: simplify & remove unused field r? @petrochenkov
2020-03-22Rollup merge of #70254 - matthiaskrgr:cl4ppy, r=CentrilDylan DPC-7/+1
couple more clippy fixes (let_and_return, if_same_then_else) * summarize if-else-code with identical blocks (clippy::if_same_then_else) * don't create variable bindings just to return the bound value immediately (clippy::let_and_return)
2020-03-22Rollup merge of #70209 - Centril:recover-quant-closure, r=petrochenkovDylan DPC-14/+40
parser: recover on `for<'a> |...| body` closures When encountering `for` and `<` is 1 token ahead, interpret this as an explicitly quantified generic closure and recover, rather than attempting to parse a `for` loop. This provides both improved diagnostics as well as an insurance policy for the ability to use this as the syntax for generic closures in the future. As requested by r? @eddyb
2020-03-22summarize if-else-code with identical blocks (clippy::if_same_then_else)Matthias Krüger-7/+1
2020-03-21parse: nix unused `root_module_name`.Mazdak Farrokhzad-5/+0
2020-03-21recover on `for<'a> |...| body` closures.Mazdak Farrokhzad-14/+40
2020-03-21Rollup merge of #70187 - matthiaskrgr:cl2ppy, r=Mark-SimulacrumMazdak Farrokhzad-8/+8
more clippy fixes * remove redundant returns (clippy::needless_return) * remove redundant import (clippy::single_component_path_imports) * remove redundant format!() call (clippy::useless_format) * don't use ok() before calling expect() (clippy::ok_expect)
2020-03-20remove redundant returns (clippy::needless_return)Matthias Krüger-8/+8
2020-03-20can_begin_literal_maybe_minus: `true` on `"-"? lit` NTs.Mazdak Farrokhzad-2/+3
2020-03-18fix rebase falloutMazdak Farrokhzad-7/+4
2020-03-18tweak outline module parsing spansMazdak Farrokhzad-1/+1
2020-03-18{rustc_parse::parser -> rustc_expand}::moduleMazdak Farrokhzad-307/+0
2020-03-18move Directory -> parser::moduleMazdak Farrokhzad-3/+18
2020-03-18parse: module parsing -> item.rsMazdak Farrokhzad-65/+66
2020-03-18outline modules: parse -> expand.Mazdak Farrokhzad-98/+50
2020-03-18extract error_on_circular_moduleMazdak Farrokhzad-9/+19
2020-03-18extract parse_external_moduleMazdak Farrokhzad-5/+15
2020-03-18de-fatalize outline module parsingMazdak Farrokhzad-20/+17
2020-03-18expand: use push_directoryMazdak Farrokhzad-2/+2
2020-03-18decouple eval_src_mod from ParserMazdak Farrokhzad-40/+29
2020-03-18decouple push_directory from ParserMazdak Farrokhzad-18/+23
2020-03-18detach submod_path from ParserMazdak Farrokhzad-187/+192
2020-03-18extract error_on_circular_moduleMazdak Farrokhzad-10/+20
2020-03-18extract parse_modMazdak Farrokhzad-17/+18
2020-03-18submod_path: use id.spanMazdak Farrokhzad-7/+5
2020-03-18simplify submod_pathMazdak Farrokhzad-14/+12
2020-03-18extract error_decl_mod_in_blockMazdak Farrokhzad-13/+12
2020-03-18extract error_cannot_declare_mod_hereMazdak Farrokhzad-27/+27
2020-03-18submod_path_from_attr: simplify & documentMazdak Farrokhzad-12/+13
2020-03-16Rollup merge of #69989 - petrochenkov:nolegacy, r=eddyb,matthewjasperDylan DPC-3/+3
resolve/hygiene: `macro_rules` are not "legacy" The "modern" vs "legacy" naming was introduced by jseyfried during initial implementation of macros 2.0. At this point it's clear that `macro_rules` are not going anywhere and won't be deprecated in the near future. So this PR changes the naming "legacy" (when it implies "macro_rules") to "macro_rules". This should also help people reading this code because it's wasn't obvious that "legacy" actually meant "macro_rules" in these contexts. The most contentious renaming here is probably ``` fn modern -> fn normalize_to_macros_2_0 fn modern_and_legacy -> fn normalize_to_macro_rules ``` Other alternatives that I could think of are `normalize_to_opaque`/`normalize_to_semitransparent`, or `strip_non_opaque`/`strip_transparent`, but they seemed less intuitive. The documentation to these functions can be found in `symbol.rs`. r? @matthewjasper
2020-03-16Rollup merge of #69520 - kornelski:e69492, r=cramertjDylan DPC-25/+10
Make error message clearer about creating new module This is a partial improvement for #69492
2020-03-16Other `legacy` -> `macro_rules`Vadim Petrochenkov-1/+1
2020-03-16ast/hir: `MacroDef::legacy` -> `MacroDef::macro_rules`Vadim Petrochenkov-2/+2
2020-03-15Rollup merge of #69589 - petrochenkov:maccall, r=CentrilMazdak Farrokhzad-31/+23
ast: `Mac`/`Macro` -> `MacCall` It's now obvious that these refer to macro calls rather than to macro definitions. It's also a single name instead of two different names in different places. `rustc_expand` usually calls macro calls in a wide sense (including attributes and derives) "macro invocations", but structures and variants renamed in this PR are only relevant to fn-like macros, so it's simpler and clearer to just call them calls. cc https://github.com/rust-lang/rust/pull/63586#discussion_r314232513 r? @eddyb
2020-03-12ast: `Mac`/`Macro` -> `MacCall`Vadim Petrochenkov-31/+23
2020-03-12Rollup merge of #69722 - estebank:negative-impl-span-ast, r=CentrilMazdak Farrokhzad-7/+11
Tweak output for invalid negative impl AST errors Use more accurate spans for negative `impl` errors. r? @Centril
2020-03-11Rollup merge of #69760 - Centril:parse-expr-improve, r=estebankMazdak Farrokhzad-240/+281
Improve expression & attribute parsing This PR includes misc improvements to expression and attribute parsing. 1. Some code simplifications 2. Better recovery for various block forms, e.g. `loop statements }` (missing `{` after `loop`). (See e.g., `block-no-opening-brace.rs` among others for examples.) 3. Added recovery for e.g., `unsafe $b` where `$b` refers to a `block` macro fragment. (See `bad-interpolated-block.rs` for examples.) 4. ^--- These are done so that code sharing in block parsing is increased. 5. Added recovery for e.g., `'label: loop { ... }` (See `labeled-no-colon-expr.rs`.) 6. Added recovery for e.g., `&'lifetime expr` (See `regions-out-of-scope-slice.rs`.) 7. Added recovery for e.g., `fn foo() = expr;` (See `fn-body-eq-expr-semi.rs`.) 8. Simplified attribute parsing code & slightly improved diagnostics. 9. Added recovery for e.g., `Box<('a) + Trait>`. 10. Added recovery for e.g, `if true #[attr] {} else #[attr] {} else #[attr] if true {}`. r? @estebank
2020-03-10parse: Tweak the function parameter edition checkVadim Petrochenkov-3/+1
Move anon-params tests to ui/anon-params.
2020-03-10parse_if_expr: recover on attributesMazdak Farrokhzad-8/+38
2020-03-10trait-object-lifetime-parens: improve recovery.Mazdak Farrokhzad-6/+11