about summary refs log tree commit diff
path: root/src/test/ui/parser
AgeCommit message (Collapse)AuthorLines
2022-03-06suggest removing a semicolon after derive attributesTakayuki Maeda-0/+18
use current token span
2022-03-05Auto merge of #93142 - estebank:missing-main, r=wesleywiserbors-2/+2
Do not point at whole file missing `fn main` Only point at the end of the crate. We could try making it point at the beginning of the crate, but that is confused with `DUMMY_SP`, causing the output to be *worse*. This change will make it so that VSCode will *not* underline the whole file when `main` is missing, so other errors will be visible.
2022-03-05Do not point at whole file missing `fn main`Esteban Kuber-2/+2
Only point at the end of the crate. We could try making it point at the beginning of the crate, but that is confused with `DUMMY_SP`, causing the output to be *worse*. This change will make it so that VSCode will *not* underline the whole file when `main` is missing, so other errors will be visible.
2022-03-04Do not recover from `Ty?` in macro parsingEsteban Kuber-0/+23
Follow up to #92746. Address #94510.
2022-03-01Rollup merge of #91545 - compiler-errors:deref-suggestion-improvements, ↵Dylan DPC-0/+10
r=estebank Generalize "remove `&`" and "add `*`" suggestions to more than one deref Suggest removing more than one `&` and `&mut`, along with suggesting adding more than one `*` (or a combination of the two). r? `@estebank` (since you're experienced with these types of suggestions, feel free to reassign)
2022-02-28Tweak diagnosticsEsteban Kuber-23/+67
* Recover from invalid `'label: ` before block. * Make suggestion to enclose statements in a block multipart. * Point at `match`, `while`, `loop` and `unsafe` keywords when failing to parse their expression. * Do not suggest `{ ; }`. * Do not suggest `|` when very unlikely to be what was wanted (in `let` statements).
2022-02-27Make deref suggestion betterMichael Goulet-0/+10
2022-02-24diagnostic: suggest parens when users want logical ops, but get closuresMichael Howell-1/+135
2022-02-14suggest using raw string literals when invalid escapes appearErin Petra Sofiya Moon-0/+21
i'd guess about 70% of "bad escape" cases occur when someone meant to use a raw string literal because they're passing it directly to Regex::new(). this emits an advisory (Applicability::MaybeIncorrect) help: suggestion to the user that they use an r"" string, on top of the normal notes about looking at the string literal documentation/spec.
2022-02-12Rollup merge of #93595 - compiler-errors:ice-on-lifetime-arg, r=jackh726Matthias Krüger-4/+41
fix ICE when parsing lifetime as function argument I don't really like this, but we basically need to emit an error instead of just delaying an bug, because there are too many places in the AST that aren't covered by my previous PRs... cc: https://github.com/rust-lang/rust/issues/93282#issuecomment-1028052945
2022-02-11Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"Oli Scherer-117/+44
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing changes made to 734368a200904ef9c21db86c595dc04263c87be0.
2022-02-08Auto merge of #93561 - Amanieu:more-unwind-abi, r=nagisabors-1/+1
Add more *-unwind ABI variants The following *-unwind ABIs are now supported: - "C-unwind" - "cdecl-unwind" - "stdcall-unwind" - "fastcall-unwind" - "vectorcall-unwind" - "thiscall-unwind" - "aapcs-unwind" - "win64-unwind" - "sysv64-unwind" - "system-unwind" cc `@rust-lang/wg-ffi-unwind`
2022-02-07Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakisbors-44/+117
Lazy type-alias-impl-trait Previously opaque types were processed by 1. replacing all mentions of them with inference variables 2. memorizing these inference variables in a side-table 3. at the end of typeck, resolve the inference variables in the side table and use the resolved type as the hidden type of the opaque type This worked okayish for `impl Trait` in return position, but required lots of roundabout type inference hacks and processing. This PR instead stops this process of replacing opaque types with inference variables, and just keeps the opaque types around. Whenever an opaque type `O` is compared with another type `T`, we make the comparison succeed and record `T` as the hidden type. If `O` is compared to `U` while there is a recorded hidden type for it, we grab the recorded type (`T`) and compare that against `U`. This makes implementing * https://github.com/rust-lang/rfcs/pull/2515 much simpler (previous attempts on the inference based scheme were very prone to ICEs and general misbehaviour that was not explainable except by random implementation defined oddities). r? `@nikomatsakis` fixes #93411 fixes #88236
2022-02-02Add more *-unwind ABI variantsAmanieu d'Antras-1/+1
The following *-unwind ABIs are now supported: - "C-unwind" - "cdecl-unwind" - "stdcall-unwind" - "fastcall-unwind" - "vectorcall-unwind" - "thiscall-unwind" - "aapcs-unwind" - "win64-unwind" - "sysv64-unwind" - "system-unwind"
2022-02-02fix ICE when parsing lifetime as function argumentMichael Goulet-4/+41
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-44/+117
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-02-02better suggestion for duplicated `where`Michael Goulet-0/+109
2022-01-27Improve suggestion for escaping reserved keywordsNoah Lev-82/+82
2022-01-25delay the bug once again, generalize turbofish suggestionMichael Goulet-25/+4
2022-01-25Remove delayed bug when encountering label in bad turbofishMichael Goulet-3/+41
2022-01-17Add term to ExistentialProjectionkadmin-2/+23
Also prevent ICE when adding a const in associated const equality.
2022-01-17Use Term in ProjectionPredicatekadmin-22/+4
ProjectionPredicate should be able to handle both associated types and consts so this adds the first step of that. It mainly just pipes types all the way down, not entirely sure how to handle consts, but hopefully that'll come with time.
2022-01-17Rollup merge of #92876 - compiler-errors:fix-turbofish-lifetime-suggestion, ↵Matthias Krüger-19/+60
r=nagisa Fix suggesting turbofish with lifetime arguments Now we suggest turbofish correctly given exprs like `foo<'_>`. Also fix suggestion when we have `let x = foo<bar, baz>;` which was broken.
2022-01-13Fix suggesting turbofish with lifetime argumentsMichael Goulet-19/+60
2022-01-14Parse `Ty?` as `Option<Ty>` and provide structured suggestionEsteban Kuber-34/+68
Swift has specific syntax that desugars to `Option<T>` similar to our `?` operator, which means that people might try to use it in Rust. Parse it and gracefully recover.
2021-12-29Fix whitespace in pretty printed PatKind::RangeDavid Tolnay-2/+2
2021-12-28Parse and suggest moving where clauses after equals for type aliasesJack Huey-0/+77
2021-12-18Rollup merge of #89090 - cjgillot:bare-dyn, r=jackh726Matthias Krüger-69/+37
Lint bare traits in AstConv. Removing the lint from lowering allows to: - make lowering querification easier; - have the lint implementation in only one place. r? `@estebank`
2021-12-13Update test to new error messageAlexis Bourget-15/+17
2021-12-13Fix broken span and related testsAlexis Bourget-6/+16
2021-12-13Add tests for misplaced/duplicated pub in fn declAlexis Bourget-0/+37
2021-12-12Auto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnrbors-5/+5
Stabilise `feature(const_generics_defaults)` `feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation. needs stabilisation report and maybe an RFC :sweat_smile: r? `@lcnr` cc `@rust-lang/project-const-generics`
2021-12-11Tweak assoc type obligation spansEsteban Kuber-6/+10
* Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors
2021-12-10bless testsEllen-5/+5
2021-12-09Auto merge of #91692 - matthiaskrgr:rollup-u7dvh0n, r=matthiaskrgrbors-0/+37
Rollup of 6 pull requests Successful merges: - #87599 (Implement concat_bytes!) - #89999 (Update std::env::temp_dir to use GetTempPath2 on Windows when available.) - #90796 (Remove the reg_thumb register class for asm! on ARM) - #91042 (Use Vec extend instead of repeated pushes on several places) - #91634 (Do not attempt to suggest help for overly malformed struct/function call) - #91685 (Install llvm tools to sysroot when assembling local toolchain) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-09Rollup merge of #91634 - terrarier2111:fix-recover-from-variant-ice, r=nagisaMatthias Krüger-0/+37
Do not attempt to suggest help for overly malformed struct/function call This fixes: https://github.com/rust-lang/rust/issues/91461
2021-12-09Auto merge of #91691 - matthiaskrgr:rollup-wfommdr, r=matthiaskrgrbors-1/+12
Rollup of 5 pull requests Successful merges: - #91042 (Use Vec extend instead of repeated pushes on several places) - #91476 (Improve 'cannot contain emoji' error.) - #91568 (Pretty print break and continue without redundant space) - #91645 (Implement `core::future::join!`) - #91666 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-09Rollup merge of #91476 - m-ou-se:ferris-identifier, r=estebankMatthias Krüger-1/+12
Improve 'cannot contain emoji' error. Before: ``` error: identifiers cannot contain emoji: `🦀` --> src/main.rs:2:9 | 2 | let 🦀 = 1; | ^^ ``` After: ``` error: Ferris cannot be used as an identifier --> src/main.rs:2:9 | 2 | let 🦀 = 1; | ^^ help: try using their name instead: `ferris` ``` r? `@estebank`
2021-12-08Rollup merge of #91337 - FabianWolff:issue-91227-misspelled-macro, r=nagisaMatthias Krüger-0/+36
Add a suggestion if `macro_rules` is misspelled Fixes #91227.
2021-12-08Do not attempt to suggest help for overly malformed struct/function callthreadexception-0/+37
2021-12-04Use multipart suggestions.Camille GILLOT-3/+18
2021-12-04Lint bare traits in AstConv.Camille GILLOT-69/+22
2021-12-04Do not add `;` to expected tokens list when it's wrongMichael Howell-19/+21
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-03Extend emoji-identifiers ui test.Mara Bos-1/+12
2021-12-02Rollup merge of #91435 - FabianWolff:issue-91421-if-then, r=lcnrMatthias Krüger-0/+31
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-0/+31
2021-12-01Rollup merge of #87160 - estebank:colon-recovery, r=nagisaMatthias Krüger-28/+63
When recovering from a `:` in a pattern, use adequate AST pattern If the suggestion to use `::` instead of `:` in the pattern isn't correct, a second resolution error will be emitted.
2021-11-28Add a suggestion if `macro_rules` is misspelledFabian Wolff-0/+36
2021-11-27Improve `unsafe` diagnosticthreadexception-1/+6
2021-11-25Auto merge of #91037 - c410-f3r:testsssssss, r=petrochenkovbors-648/+0
Move some tests to more reasonable directories - 10 cc #73494 r? `@petrochenkov`