about summary refs log tree commit diff
path: root/compiler/rustc_parse
AgeCommit message (Collapse)AuthorLines
2021-12-08Rollup merge of #91337 - FabianWolff:issue-91227-misspelled-macro, r=nagisaMatthias Krüger-4/+25
Add a suggestion if `macro_rules` is misspelled Fixes #91227.
2021-12-08Do not attempt to suggest help for overly malformed struct/function callthreadexception-20/+27
2021-12-08Rollup merge of #91531 - notriddle:notriddle/issue-87647-expected-semicolon, ↵Matthias Krüger-29/+113
r=estebank Do not add `;` to expected tokens list when it's wrong There's a few spots where semicolons are checked for to do error recovery, and should not be suggested (or checked for other stuff). Fixes #87647
2021-12-06Expect extern fn with no body when parsingMichael Howell-1/+1
Also add a test case for inserting a semicolon on extern fns. Without this fix, we got an error like this: error: expected one of `->`, `where`, or `{`, found `}` --> chk.rs:3:1 | 2 | fn foo() | --- - expected one of `->`, `where`, or `{` | | | while parsing this `fn` 3 | } | ^ unexpected token Since this is inside an extern block, you're required to write function prototypes with no body. This fixes a regression, and adds a test case for it.
2021-12-06Add better comments for FnParseModeMichael Howell-2/+49
2021-12-05Rollup merge of #90022 - hkmatsumoto:self-upper-as-generic-parameter, r=jackh726Matthias Krüger-0/+13
Explain why `Self` is invalid in generic parameters Close #89985. r? `@estebank`
2021-12-04Do not add `;` to expected tokens list when it's wrongMichael Howell-29/+66
There's a few spots where semicolons are checked for to do error recovery, and should not be suggested (or checked for other stuff). Fixes #87647
2021-12-02Rollup merge of #91435 - FabianWolff:issue-91421-if-then, r=lcnrMatthias Krüger-10/+41
Improve diagnostic for missing half of binary operator in `if` condition Fixes #91421. I've also changed it so that it doesn't consume the `else` token in the error case, because it will try to consume it again afterwards, leading to this incorrect error message (where the `else` reported as missing is actually there): ``` error: expected one of `.`, `;`, `?`, `else`, or an operator, found `{` --> src/main.rs:4:12 | 4 | } else { 4 }; | ^ expected one of `.`, `;`, `?`, `else`, or an operator ``` r? `@lcnr`
2021-12-01Improve diagnostic for missing half of binary operator in `if` conditionFabian Wolff-10/+41
2021-12-01Rollup merge of #91313 - petrochenkov:cratexp, r=Aaron1011Matthias Krüger-1/+7
expand: Turn `ast::Crate` into a first class expansion target And stop creating a fake `mod` item for the crate root when expanding a crate, thus addressing FIXMEs left in https://github.com/rust-lang/rust/pull/82238, and making a step towards a proper support for crate-level macro attributes (cc #54726). I haven't added token collection support for the whole crate in this PR, maybe later. r? `@Aaron1011`
2021-11-29review comments: clean upEsteban Kuber-173/+185
2021-11-28Add a suggestion if `macro_rules` is misspelledFabian Wolff-4/+25
2021-11-28expand: Turn `ast::Crate` into a first class expansion targetVadim Petrochenkov-1/+7
And stop creating a fake `mod` item for the crate root when expanding a crate.
2021-11-27Improve `unsafe` diagnosticthreadexception-3/+25
2021-11-25Reject generic arguments on mod style interpolated pathDavid Tolnay-10/+24
2021-11-25Let qpath contain NtTy: <$:ty as $:ty>::restDavid Tolnay-0/+10
2021-11-25When recovering from a `:` in a pattern, use adequate AST patternEsteban Küber-16/+87
2021-11-25Auto merge of #88781 - estebank:emoji-idents, r=oli-obkbors-2/+19
Tokenize emoji as if they were valid identifiers In the lexer, consider emojis to be valid identifiers and reject them later to avoid knock down parse errors. Partially address #86102.
2021-11-25Auto merge of #85346 - estebank:issue-84946, r=nagisa,varkorbors-54/+160
Account for incorrect `impl Foo<const N: ty> {}` syntax Fix #84946
2021-11-24Tweak span and add more testsEsteban Kuber-5/+2
2021-11-24Account for incorrect `impl Foo<const N: ty> {}` syntaxEsteban Küber-54/+163
Fix #84946
2021-11-23Auto merge of #91149 - notriddle:notriddle/rustdoc-doctest-semicolon, r=jyn514bors-1/+1
fix(doctest): detect extern crate items in statement doctests This partially reverts #91026, because rustdoc needs to detect the extern statements, even when they appear inside implicit `main()`. It does not entirely revert it, so the old bug is still fixed, by duplicating some of the logic from `parse_mod` instead of trying to use it directly. Fixes #91134
2021-11-23review comment: plural of emoji is emojiEsteban Kuber-1/+1
2021-11-23Account for confusable codepoints when recovering emoji identifiersEsteban Kuber-3/+14
2021-11-23Tokenize emoji as if they were valid indentifiersEsteban Kuber-0/+6
In the lexer, consider emojis to be valid identifiers and reject them later to avoid knock down parse errors.
2021-11-22fix(doctest): detect extern crate items in statement doctestsMichael Howell-1/+1
This partially reverts #91026, because rustdoc needs to detect the extern statements, even when they appear inside implicit `main()`. It does not entirely revert it, so the old bug is still fixed, by duplicating some of the logic from `parse_mod` instead of trying to use it directly. Fixes #91134
2021-11-22Split inline const to two feature gatesGary Guo-5/+9
2021-11-20Rollup merge of #90994 - Badel2:issue-90993, r=estebankMatthias Krüger-1/+1
Fix ICE `#90993`: add missing call to cancel Fix #90993
2021-11-20Fix float ICEthreadexception-0/+2
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-11-20Fix ICE `#90993`: add missing call to cancelBadel2-1/+1
2021-11-16Inline printable function5225225-5/+7
2021-11-16Suggest removing the non-printing characters5225225-1/+16
2021-11-16Print full char literal on error if any are non-printing5225225-0/+10
2021-11-12rustc_feature: Convert `BuiltinAttribute` from tuple to a structVadim Petrochenkov-6/+5
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-14/+15
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-04Remove now unused feature from rustc_parseHans Kratz-1/+0
2021-11-04Optimize literal, doc comment lint as well, extract function.Hans Kratz-39/+2
2021-11-04Create subslice as that leads to a smaller code size.Hans Kratz-3/+4
2021-11-04Optimize bidi character detection.Hans Kratz-6/+40
2021-11-01fix formattingPietro Albini-1/+1
2021-10-31Lint against RTL unicode codepoints in literals and commentsEsteban Küber-8/+53
Address CVE-2021-42574.
2021-10-22Rollup merge of #89257 - aDotInTheVoid:macro-error-2, r=estebankYuki Okushi-10/+40
Give better error for `macro_rules name` follow up to #89221 r? ``@estebank`` ``@rustbot`` modify labels: +A-diagnostics +A-parser
2021-10-19Explain why `Self` is invalid in generic parametersHirochika Matsumoto-0/+13
2021-10-18Rollup merge of #89990 - petrochenkov:idempty, r=wesleywiserMatthias Krüger-4/+4
rustc_span: `Ident::invalid` -> `Ident::empty` The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s as well.
2021-10-18Rollup merge of #89974 - est31:let_else_if_error, r=nagisaMatthias Krüger-5/+16
Nicer error message if the user attempts to do let...else if Gives a nice "conditional `else if` is not supported for `let...else`" error when encountering a `let...else if` pattern, as suggested in the [let...else tracking issue](https://github.com/rust-lang/rust/issues/87335#issuecomment-944846205).
2021-10-17Nicer error message if the user attempts to do let...else ifest31-5/+16
2021-10-17rustc_span: `Ident::invalid` -> `Ident::empty`Vadim Petrochenkov-4/+4
The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s.
2021-10-17Some "parenthesis" and "parentheses" fixesr00ster91-6/+6
2021-10-07some clippy::perf fixesMatthias Krüger-1/+1
2021-10-04Use `TokenKind::similar_tokens()`Fabian Wolff-1/+4