summary refs log tree commit diff
path: root/tests/ui/parser/issues
AgeCommit message (Collapse)AuthorLines
2024-01-28Handle methodcalls & operators in patternsLieselotte-8/+8
2024-01-13Bless testsGeorge-lewis-0/+1
Update tests
2024-01-11Silence follow up errors if astconv already erroredOli Scherer-15/+3
2024-01-09Avoid silencing relevant follow-up errorsOli Scherer-1/+8
2024-01-05Auto merge of #118297 - shepmaster:warn-dead-tuple-fields, r=WaffleLapkinbors-2/+2
Merge `unused_tuple_struct_fields` into `dead_code` This implicitly upgrades the lint from `allow` to `warn` and places it into the `unused` lint group. [Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Moving.20.60unused_tuple_struct_fields.60.20from.20allow.20to.20warn)
2024-01-04macro_rules: Less hacky heuristic for using `tt` metavariable spansVadim Petrochenkov-6/+6
2024-01-02Adjust compiler tests for unused_tuple_struct_fields -> dead_codeJake Goulding-2/+2
2023-12-28Don't expect bodyless arms if the pattern can never be a never patternLieselotte-3/+3
2023-12-12Improve an error involving attribute values.Nicholas Nethercote-3/+5
Attribute values must be literals. The error you get when that doesn't hold is pretty bad, e.g.: ``` unexpected expression: 1 + 1 ``` You also get the same error if the attribute value is a literal, but an invalid literal, e.g.: ``` unexpected expression: "foo"suffix ``` This commit does two things. - Changes the error message to "attribute value must be a literal", which gives a better idea of what the problem is and how to fix it. It also no longer prints the invalid expression, because the carets below highlight it anyway. - Separates the "not a literal" case from the "invalid literal" case. Which means invalid literals now get the specific error at the literal level, rather than at the attribute level.
2023-12-08Auto merge of #118527 - Nadrieril:never_patterns_parse, r=compiler-errorsbors-3/+3
never_patterns: Parse match arms with no body Never patterns are meant to signal unreachable cases, and thus don't take bodies: ```rust let ptr: *const Option<!> = ...; match *ptr { None => { foo(); } Some(!), } ``` This PR makes rustc accept the above, and enforces that an arm has a body xor is a never pattern. This affects parsing of match arms even with the feature off, so this is delicate. (Plus this is my first non-trivial change to the parser). ~~The last commit is optional; it introduces a bit of churn to allow the new suggestions to be machine-applicable. There may be a better solution? I'm not sure.~~ EDIT: I removed that commit r? `@compiler-errors`
2023-12-03Parse a pattern with no armNadrieril-3/+3
2023-12-03Auto merge of #118542 - chenyukang:yukang-fix-parser-ice-118531, r=cjgillotbors-0/+106
Fix parser ICE from attrs Fixes #118531, Fixes #118530.
2023-12-02Fix parser ICE from attrsyukang-0/+106
2023-11-29Always emit help when failing to parse enum variantEsteban Küber-0/+2
2023-11-29Fix test and move to more appropriate directoryEsteban Küber-54/+0
2023-11-29Change enum parse recoveryEsteban Küber-2/+8
2023-11-29Bubble parse error when expecting `)`Esteban Küber-9/+5
2023-11-29Make `parse_pat_ident` not recover bad nameEsteban Küber-25/+1
2023-11-24Show number in error message even for one errorNilstrieb-131/+131
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-17Rollup merge of #117338 - workingjubilee:asmjs-meets-thanatos, r=b-naberMatthias Krüger-1/+0
Remove asmjs Fulfills [MCP 668](https://github.com/rust-lang/compiler-team/issues/668). `asmjs-unknown-emscripten` does not work as-specified, and lacks essential upstream support for generating asm.js, so it should not exist at all.
2023-11-17Rollup merge of #117990 - estebank:issue-100825-part-deux, r=NilstriebMatthias Krüger-3/+3
Tweak error and move tests r? `@Nilstrieb` Split off #117565.
2023-11-16Smaller span for unnessary `mut` suggestionEsteban Küber-3/+3
2023-11-14Detect more `=>` typosEsteban Küber-0/+39
Handle and recover `match expr { pat >= { arm } }`.
2023-11-08Rollup merge of #117282 - clubby789:recover-wrong-function-header, r=TaKO8KiGuillaume Gomez-2/+86
Recover from incorrectly ordered/duplicated function keywords Fixes #115714
2023-11-07Auto merge of #117297 - clubby789:fn-trait-missing-paren, r=TaKO8Kibors-0/+27
Give a better diagnostic for missing parens in Fn* bounds Fixes #108109 It would be nice to try and recover here, but I'm not sure it's worth the effort, especially as the bounds on the recovered function would be incorrect.
2023-11-01Give a better diagnostic for missing parens in Fn* boundsclubby789-0/+27
2023-11-01Recover from missing param list in function definitionsclubby789-0/+32
2023-10-28Remove asmjs from testsJubilee Young-1/+0
2023-10-27Recover from incorrectly ordered/duplicated function keywordsclubby789-2/+86
2023-10-24mv testsEsteban Küber-0/+1464
2023-10-12Detect ruby-style closure in parserEsteban Küber-2/+17
When parsing a closure without a body that is surrounded by a block, suggest moving the opening brace after the closure head. Fix #116608.
2023-10-06Rollup merge of #116400 - estebank:issue-78585, r=WaffleLapkinJubilee-20/+17
Detect missing `=>` after match guard during parsing ``` error: expected one of `,`, `:`, or `}`, found `.` --> $DIR/missing-fat-arrow.rs:25:14 | LL | Some(a) if a.value == b { | - while parsing this struct LL | a.value = 1; | -^ expected one of `,`, `:`, or `}` | | | while parsing this struct field | help: try naming a field | LL | a: a.value = 1; | ++ help: you might have meant to start a match arm after the match guard | LL | Some(a) if a.value == b => { | ++ ``` Fix #78585.
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-0/+3
2023-10-03Detect missing `=>` after match guard during parsingEsteban Küber-20/+17
``` error: expected one of `,`, `:`, or `}`, found `.` --> $DIR/missing-fat-arrow.rs:25:14 | LL | Some(a) if a.value == b { | - while parsing this struct LL | a.value = 1; | -^ expected one of `,`, `:`, or `}` | | | while parsing this struct field | help: try naming a field | LL | a: a.value = 1; | ++ help: you might have meant to start a match arm after the match guard | LL | Some(a) if a.value == b => { | ++ ``` Fix #78585.
2023-09-28Tweak wording of missing angle backets in qualified pathEsteban Küber-1/+6
2023-09-21add UI test for delimiter errorsyukang-0/+44
2023-09-12Only suggest turbofish in patterns if we may recoverLeón Orell Valerian Liehr-0/+21
2023-09-06Add explanatory note to 'expected item' errorGurinder Singh-0/+19
2023-08-15Clean up some bad ui testing annotationsMichael Goulet-3/+8
2023-08-07relocate tests to pass tidydarklyspaced-0/+15
2023-08-03Rollup merge of #114300 - MU001999:fix/turbofish-pat, r=estebankMatthias Krüger-6/+16
Suggests turbofish in patterns Fixes #114112 r? ```@estebank```
2023-08-01Suggests turbofish in patternsMu001999-6/+16
2023-07-31parser: more friendly hints for handling `async move` in the 2015 editionbohan-0/+12
2023-06-27Rollup merge of #112518 - chenyukang:yukang-fix-112458, r=davidtwcoMatthias Krüger-0/+19
Detect actual span for getting unexpected token from parsing macros Fixes #112458
2023-06-11Detect actual span for getting unexpected token from parsing macrosyukang-0/+19
2023-06-10reword the message to suggest surrounding with parenthesesyukang-4/+4
2023-06-10take care module name for suggesting surround the struct literal in parenthesesyukang-0/+78
2023-05-27Rollup merge of #111181 - bvanjoi:fix-issue-111148, r=davidtwcoMatthias Krüger-0/+10
fix(parse): return unpected when current token is EOF close https://github.com/rust-lang/rust/issues/111148 #111148 panic occurred because [FatalError.raise()](https://github.com/bvanjoi/rust/blob/master/compiler/rustc_parse/src/parser/mod.rs#LL540C3-L540C3) was encountered which caused by `Eof` and `Pound`(the last token) had same span, when parsing `#` in `fn a<<i<Y<w<>#`. <img width="825" alt="image" src="https://user-images.githubusercontent.com/30187863/236612589-9e2c6a0b-18cd-408c-b636-c12a51cbcf1c.png"> There are a few ways to solve this problem: - Change the action assign for [self.last_unexpected_token_span](https://github.com/rust-lang/rust/blob/master/compiler/rustc_parse/src/parser/diagnostics.rs#L592), for example, if current token is `Eof`, then return Error directly. - Avoid triggering the `FatalError` when the current token is `Eof`. I have chosen the second option because executing `expected_one_of_not_found` when the token is `Eof` but not in `ediable` seems reasonable.
2023-05-13fmtyukang-2/+1
2023-05-13Fix ice caused by shorthand fields in NoFieldsForFnCallyukang-0/+22