about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
AgeCommit message (Collapse)AuthorLines
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/+52
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
2021-10-03Try to recover from a `=>` -> `=` or `->` typo in a match armFabian Wolff-1/+15
2021-10-01Give better error for `macro_rules name`Nixon Enraght-Moony-10/+40
2021-10-01Rollup merge of #89029 - notriddle:notriddle/issue-89013, r=estebankManish Goregaokar-5/+32
feat(rustc_parse): recover from pre-RFC-2000 const generics syntax Fixes #89013
2021-09-28Improve error messages for bad type constraintsMichael Howell-11/+20
Co-authored-by: Esteban Kuber <esteban@kuber.com.ar>
2021-09-25Check for macros in built-in attributes that don't support them.Eric Huss-1/+13
2021-09-25Move malformed attribute code to a function and fix inner attribute suggestion.Eric Huss-59/+60
Moving to a dedicated function in preparation for other validation. The suggestion given didn't consider if it was an inner attribute.
2021-09-24Rollup merge of #89221 - aDotInTheVoid:macro-error-1, r=estebankJubilee-0/+14
Give better error for `macro_rules! name!` r? ``@estebank`` ``@rustbot`` modify labels: +A-diagnostics +A-parser
2021-09-24Give better error for `macro_rules! name!`Nixon Enraght-Moony-0/+14
2021-09-24Auto merge of #88835 - FabianWolff:issue-88770, r=petrochenkovbors-2/+2
Fix error recovery in format macro parsing Fixes #88770. Basically, the assumption in the following comment is incorrect: https://github.com/rust-lang/rust/blob/b69fe57261086e70aea9d5b58819a1794bf7c121/compiler/rustc_builtin_macros/src/format.rs#L167-L172 This is only true in the first iteration of the loop, when [`p.clear_expected_tokens()`](https://github.com/rust-lang/rust/blob/b69fe57261086e70aea9d5b58819a1794bf7c121/compiler/rustc_builtin_macros/src/format.rs#L164) is called. In subsequent iterations, `p.expected_tokens` won't be empty, so `p.expect()` won't actually call `unexpected_try_recover()`: https://github.com/rust-lang/rust/blob/b69fe57261086e70aea9d5b58819a1794bf7c121/compiler/rustc_parse/src/parser/mod.rs#L487-L498 Instead, it will call `expect_one_of()`, which _can_ recover and return `Ok()`. This PR handles this case to fix the ICE in #88770.
2021-09-23Rollup merge of #89023 - Wardenfar:issue-85066, r=nagisaJubilee-0/+14
Resolve issue : Somewhat confusing error with extended_key_value_attributes Fixes #85066
2021-09-22Rollup merge of #89046 - oli-obk:fix_oflo, r=estebankthe8472-0/+4
"Fix" an overflow in byte position math r? `@estebank` help! I fixed the ICE only to brick the diagnostic. I mean, it was wrong previously (using an already expanded macro span), but it is really bad now XD
2021-09-21Rollup merge of #88795 - FabianWolff:issue-88684, r=wesleywiserthe8472-14/+47
Print a note if a character literal contains a variation selector Fixes #88684.
2021-09-20Add some more tracingOli Scherer-0/+4
2021-09-19Suggest replacing braces for brackets on array-esque invalid block exprHirochika Matsumoto-4/+54
Newcomers may write `{1, 2, 3}` for making arrays, and the current error message is not informative enough to quickly convince them what is needed to fix the error. This PR implements a diagnostic for this case, and its output looks like this: ```text error: this code is interpreted as a block expression, not an array --> src/lib.rs:1:22 | 1 | const FOO: [u8; 3] = { | ______________________^ 2 | | 1, 2, 3 3 | | }; | |_^ | = note: to define an array, one would use square brackets instead of curly braces help: try using [] instead of {} | 1 | const FOO: [u8; 3] = [ 2 | 1, 2, 3 3 | ]; | ``` Fix #87672
2021-09-19Resolve issue 85066Theo-0/+14
Fix : use struct_dummy Fix different os messages