about summary refs log tree commit diff
path: root/tests/ui/parser/issues
AgeCommit message (Collapse)AuthorLines
2024-03-25Rollup merge of #122910 - compiler-errors:unit-struct-in-path-pat-only, ↵Matthias Krüger-6/+7
r=petrochenkov Validate that we're only matching on unit struct for path pattern Resolution doesn't validate that we only really take `CtorKind::Unit` in path patterns, since all it sees is `Res::SelfCtor(def_id)`. Check this instead during pattern typeck. r? petrochenkov Fixes #122809
2024-03-24Rollup merge of #122217 - estebank:issue-119685, r=fmeaseMatthias Krüger-4/+4
Handle str literals written with `'` lexed as lifetime Given `'hello world'` and `'1 str', provide a structured suggestion for a valid string literal: ``` error[E0762]: unterminated character literal --> $DIR/lex-bad-str-literal-as-char-3.rs:2:26 | LL | println!('hello world'); | ^^^^ | help: if you meant to write a `str` literal, use double quotes | LL | println!("hello world"); | ~ ~ ``` ``` error[E0762]: unterminated character literal --> $DIR/lex-bad-str-literal-as-char-1.rs:2:20 | LL | println!('1 + 1'); | ^^^^ | help: if you meant to write a `str` literal, use double quotes | LL | println!("1 + 1"); | ~ ~ ``` Fix #119685.
2024-03-22Validate that we're only matching on unit struct for path patternMichael Goulet-6/+7
2024-03-18Provide structured suggestion for `#![feature(foo)]`Esteban Küber-1/+4
``` error: `S2<'_>` is forbidden as the type of a const generic parameter --> $DIR/lifetime-in-const-param.rs:5:23 | LL | struct S<'a, const N: S2>(&'a ()); | ^^ | = note: the only supported types are integers, `bool` and `char` help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types | LL + #![feature(adt_const_params)] | ``` Fix #55941.
2024-03-17review comment: `str` -> string in messagesEsteban Küber-2/+2
2024-03-17Use shorter span for existing `'` -> `"` structured suggestionEsteban Küber-2/+2
2024-03-09Improve diagnostics for parenthesized type argumentsDaniel Sedlak-0/+76
2024-03-01Detect more cases of `=` to `:` typoEsteban Küber-7/+7
When a `Local` is fully parsed, but not followed by a `;`, keep the `:` span arround and mention it. If the type could continue being parsed as an expression, suggest replacing the `:` with a `=`. ``` error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.` --> file.rs:2:32 | 2 | let _: std::env::temp_dir().join("foo"); | - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=` | | | while parsing the type for `_` | help: use `=` if you meant to assign ``` Fix #119665.
2024-02-18macro_rules: Preserve all metavariable spans in a global side tableVadim Petrochenkov-6/+11
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-116/+116
2024-02-08Continue to borrowck even if there were previous errorsOli Scherer-20/+43
2024-02-05Rollup merge of #116284 - RalfJung:no-nan-match, r=cjgillotMatthias Krüger-1/+0
make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern These arms would never be hit anyway, so the pattern makes little sense. We have had a future-compat lint against float matches in general for a *long* time, so I hope we can get away with immediately making this a hard error. This is part of implementing https://github.com/rust-lang/rfcs/pull/3535. Closes https://github.com/rust-lang/rust/issues/41620 by removing the lint. https://github.com/rust-lang/reference/pull/1456 updates the reference to match.
2024-01-31Remove a has_errors check that does not prevent follow up error noiseOli Scherer-1/+18
2024-01-28Handle methodcalls & operators in patternsLieselotte-8/+8
2024-01-26remove illegal_floating_point_literal_pattern lintRalf Jung-1/+0
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