about summary refs log tree commit diff
path: root/src/test/ui/parser
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-26706/+0
2023-01-08Do not emit structured suggestion for turbofish with wrong spanEsteban Küber-0/+14
Fix #79161.
2023-01-02Print correct base for too-large literalsclubby789-0/+6
Also update tests
2022-12-29Rollup merge of #106242 - estebank:diff-markers, r=jyn514Matthias Krüger-0/+318
Detect diff markers in the parser Partly address #32059.
2022-12-28Add support for diff3 formatEsteban Küber-2/+7
2022-12-28Tweak wordingEsteban Küber-33/+77
2022-12-28Account for ADT bodies and struct expressionsEsteban Küber-0/+112
2022-12-28Detect diff markers in the parserEsteban Küber-0/+157
Partly address #32059.
2022-12-28Rollup merge of #106176 - compiler-errors:fn-kw-as-fn-trait, r=estebankMatthias Krüger-74/+90
Recover `fn` keyword as `Fn` trait in bounds `impl fn()` -> `impl Fn()` Fixes #82515
2022-12-27Rollup merge of #106066 - JohnTitor:rm-bindings-after-at-fixme, ↵Matthias Krüger-23/+75
r=compiler-errors Always suggest as `MachineApplicable` in `recover_intersection_pat` This resolves one FIXME in `recover_intersection_pat` by always applying `MachineApplicable` when suggesting, as `bindings_after_at` is now stable. This also separates a test to apply `// run-rustfix`. Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-12-27Recover `fn` keyword as `Fn` trait in boundsMichael Goulet-74/+90
2022-12-25Auto merge of #105701 - RedDocMD:bug-105634, r=cjgillotbors-0/+8
Allow .. to be parsed as let initializer .. and ..= are valid expressions, however when used in a let statement it is not parsed. Fixes #105634
2022-12-23Always suggest as `MachineApplicable` in `recover_intersection_pat`Yuki Okushi-23/+75
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-12-16Little fixesDeep Majumder-1/+1
2022-12-14Allow .. to be parsed as let initializerDeep Majumder-0/+8
.. and ..= are valid expressions, however when used in a let statement it is not parsed.
2022-12-14Rollup merge of #105502 - chenyukang:yukang/fix-105366-impl, r=estebankMatthias Krüger-0/+37
Suggest impl in the scenario of typo with fn Fixes #105366
2022-12-14Auto merge of #104875 - chenyukang:yukang/fix-104867-inc, r=estebankbors-22/+360
Properly handle postfix inc/dec in standalone and subexpr scenarios Fixes #104867 r? `@estebank`
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-20/+10
available
2022-12-11Move testsCaio-0/+67
2022-12-10fix #105366, suggest impl in the scenario of typo with fnyukang-0/+37
2022-12-08Point at LHS on binop type err if relevantEsteban Küber-7/+21
2022-12-06Rollup merge of #105098 - lyming2007:issue-103869-fix, r=eholkMatthias Krüger-0/+28
propagate the error from parsing enum variant to the parser and emit out While parsing enum variant, the error message always disappear Because the error message that emit out is from main error of parser The information of enum variant disappears while parsing enum variant with error We only check the syntax of expecting token, i.e, in case https://github.com/rust-lang/rust/issues/103869 It will error it without telling the message that this error is from pasring enum variant. Propagate the sub-error from parsing enum variant to the main error of parser by chaining it with map_err Check the sub-error before emitting the main error of parser and attach it. Fix https://github.com/rust-lang/rust/issues/103869
2022-12-03suggest parenthesis around ExprWithBlock BinOp ExprWithBlockLukas Markeffsky-1/+66
2022-12-01While parsing enum variant, the error message always disappearYiming Lei-0/+28
Because the error message that emit out is from main error of parser The information of enum variant disappears while parsing enum variant with error We only check the syntax of expecting token, i.e, in case #103869 It will error it without telling the message that this error is from pasring enum variant. Propagate the sub-error from parsing enum variant to the main error of parser by chaining it with map_err Check the sub-error before emitting the main error of parser and attach it. Fix #103869
2022-11-26will not suggest for postfix operator when can not handle precedences wellyukang-10/+38
2022-11-26add start_stmt to handle postfix incrementyukang-8/+177
2022-11-25fix #104867, Properly handle postfix inc/dec in standalone and subexpr scenariosyukang-22/+163
2022-11-23Fix an ICE parsing a malformed attribute.Nicholas Nethercote-0/+12
Fixes #104620.
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-14/+6
2022-11-18Rollup merge of #103405 - chenyukang:yukang/fix-103381-and-if, r=compiler-errorsMatthias Krüger-0/+168
Detect incorrect chaining of if and if let conditions and recover Fixes #103381
2022-11-16Use `token::Lit` in `ast::ExprKind::Lit`.Nicholas Nethercote-43/+29
Instead of `ast::Lit`. Literal lowering now happens at two different times. Expression literals are lowered when HIR is crated. Attribute literals are lowered during parsing. This commit changes the language very slightly. Some programs that used to not compile now will compile. This is because some invalid literals that are removed by `cfg` or attribute macros will no longer trigger errors. See this comment for more details: https://github.com/rust-lang/rust/pull/102944#issuecomment-1277476773
2022-11-16Add some more bad suffix cases in a test.Nicholas Nethercote-17/+75
2022-11-15Rollup merge of #104309 - chenyukang:yukang/fix-104088-identifier-error, ↵Matthias Krüger-0/+67
r=davidtwco Slightly improve error message for invalid identifier fixes #104088
2022-11-15Rollup merge of #103439 - Nilstrieb:help-me-with-my-macro, r=estebankMatthias Krüger-0/+12
Show note where the macro failed to match When feeding the wrong tokens, it used to fail with a very generic error that wasn't very helpful. This change tries to help by noting where specifically the matching went wrong. ```rust macro_rules! uwu { (a a a b) => {}; } uwu! { a a a c } ``` ```diff error: no rules expected the token `c` --> macros.rs:5:14 | 1 | macro_rules! uwu { | ---------------- when calling this macro ... 4 | uwu! { a a a c } | ^ no rules expected this token in macro call | +note: while trying to match `b` + --> macros.rs:2:12 + | +2 | (a a a b) => {}; + | ^ ```
2022-11-15move testcase for tidyyukang-0/+12
2022-11-15fix #104088, Slightly improve error message for invalid identifieryukang-0/+55
2022-11-15move testcase for tidyyukang-0/+12
2022-11-15fix #103381, Detect incorrect chaining of if and if let conditionsyukang-0/+168
2022-11-14Show a note where a macro failed to matchNilstrieb-0/+12
This shows a small note on what the macro matcher was currently processing to aid with "no rules expected the token X" errors.
2022-11-14Rollup merge of #104223 - fmease:recover-fn-ptr-with-generics, r=estebankMatthias Krüger-0/+142
Recover from function pointer types with generic parameter list Give a more helpful error when encountering function pointer types with a generic parameter list like `fn<'a>(&'a str) -> bool` or `fn<T>(T) -> T` and suggest moving lifetime parameters to a `for<>` parameter list. I've added a bunch of extra code to properly handle (unlikely?) corner cases like `for<'a> fn<'b>()` (where there already exists a `for<>` parameter list) correctly suggesting `for<'a, 'b> fn()` (merging the lists). If you deem this useless, I can simplify the code by suggesting nothing at all in this case. I am quite open to suggestions regarding the wording of the diagnostic messages. Fixes #103487. ``@rustbot`` label A-diagnostics r? diagnostics
2022-11-11Rollup merge of #104202 - camsteffen:103748, r=estebankDylan DPC-0/+59
Fix ICE #103748 Fixes #103748
2022-11-11Recover from fn ptr tys with generic param listLeón Orell Valerian Liehr-0/+142
2022-11-11Auto merge of #99918 - WaffleLapkin:fnFnfun, r=estebankbors-0/+154
Recover wrong-cased keywords that start items (_this pr was inspired by [this tweet](https://twitter.com/Azumanga/status/1552982326409367561)_) r? `@estebank` We've talked a bit about this recovery, but I just wanted to make sure that this is the right approach :) For now I've only added the case insensitive recovery to `use`s, since most other items like `impl` blocks, modules, functions can start with multiple keywords which complicates the matter.
2022-11-09Rollup merge of #103443 - mucinoab:recover-colon-as-path-separetor, ↵Michael Goulet-0/+39
r=compiler-errors Parser: Recover from using colon as path separator in imports I don't know if this is the right approach, any feedback is welcome. r? ```@compiler-errors``` Fixes #103269
2022-11-09Add domain size check to fix ICECameron Steffen-0/+59
2022-11-09Rollup merge of #103919 - nnethercote:unescaping-cleanups, r=matkladDylan DPC-30/+30
Unescaping cleanups Some code improvements, and some error message improvements. Best reviewed one commit at a time. r? ````@matklad````
2022-11-08Parser: Recover from using colon as path separator in importsBruno A. Muciño-0/+39
2022-11-08Rollup merge of #103521 - chenyukang:yukang/fix-103451-avoid-hang, ↵Manish Goregaokar-0/+37
r=jackh726,wesleywiser Avoid possible infinite loop when next_point reaching the end of file Fixes #103451 If we return a span with `lo` = `hi`, `span_to_snippet` will always get `Ok("")`, which may introduce infinite loop if we don't care. This PR make `find_width_of_character_at_span` return `width` with 1, so that `span_to_snippet` will get an `Err`.
2022-11-07Rollup merge of #103986 - ↵Dylan DPC-0/+219
compiler-errors:oh-no-bad-block-should-not-have-label, r=lcnr Don't silently eat label before block in block-like expr Fixes #103983 cc #92823 (where the regression was introduced)
2022-11-07Rollup merge of #103914 - nnethercote:close-42326, r=petrochenkovYuki Okushi-9/+21
Make underscore_literal_suffix a hard error. It's been a warning for 5.5 years. Time to make it a hard error. Closes #42326. r? ``@pnkfelix``