about summary refs log tree commit diff
path: root/src/test/ui/parser
AgeCommit message (Collapse)AuthorLines
2022-04-03Auto merge of #88672 - camelid:inc-parser-sugg, r=davidtwcobors-0/+277
Suggest `i += 1` when we see `i++` or `++i` Closes #83502 (for `i++` and `++i`; `--i` should be covered by #82987, and `i--` is tricky to handle). This is a continuation of #83536. r? `@estebank`
2022-03-28Remove opaque type obligation and just register opaque types as they are ↵Oli Scherer-32/+52
encountered. This also registers obligations for the hidden type immediately.
2022-03-28Revert "Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk"Oli Scherer-44/+117
This reverts commit 6499c5e7fc173a3f55b7a3bd1e6a50e9edef782d, reversing changes made to 78450d2d602b06d9b94349aaf8cece1a4acaf3a8.
2022-03-27Fix from rebaseNoah Lev-19/+27
I changed the test functions to be `pub` rather than called from a `main` function too, for easier future modification of tests.
2022-03-27Auto merge of #94495 - estebank:missing-closing-gt, r=jackh726bors-13/+134
Provide suggestion for missing `>` in a type parameter list When encountering an inproperly terminated type parameter list, provide a suggestion to close it after the last non-constraint type parameter that was successfully parsed. Fix #94058.
2022-03-27Handle `,` to `;` substitution in arg paramsEsteban Kuber-7/+19
2022-03-27Provide suggestion for missing `>` in a type parameter listEsteban Kuber-9/+118
When encountering an inproperly terminated type parameter list, provide a suggestion to close it after the last non-constraint type parameter that was successfully parsed. Fix #94058.
2022-03-27Point (again) to more expressions with their type, even if not fully resolvedEsteban Kuber-12/+27
2022-03-23Fix rustfix panic on testNoah Lev-113/+134
`run-rustfix` applies all suggestions regardless of their Applicability. There's a flag, `rustfix-only-machine-applicable`, that does what it says, but then the produced `.fixed` file would have invalid code from the suggestions that weren't applied. So, I moved the cases of postfix increment, in which case multiple suggestions are given, to the `-notfixed` test, which does not run rustfix. I also changed the Applicability to Unspecified since MaybeIncorrect requires that the code be valid, even if it's incorrect.
2022-03-23Use `multipart_suggestions`Noah Lev-12/+0
This records that the suggestions are mutually-exclusive (i.e., only one should be applied).
2022-03-23Change temporary variable name if it would conflictNoah Lev-6/+6
2022-03-23Add heuristic to avoid treating `x + +2` as incrementNoah Lev-9/+5
2022-03-23Bless testsNoah Lev-5/+9
2022-03-23Improve handling of `tmp` variable name conflictsNoah Lev-5/+80
2022-03-23Emit both subexp and standalone sugg for postfixNoah Lev-0/+15
This solves the TODO.
2022-03-23Emit structured suggestions for field accesses tooNoah Lev-2/+9
2022-03-23Refactor, handle fields better, add field testsNoah Lev-4/+48
2022-03-23Move increment checks to improve errorsNoah Lev-36/+76
2022-03-23Suggest `i += 1` when we see `i++` or `++i`Camelid-0/+79
2022-03-22diagnostics: do not suggest `fn foo({ <body> }`Michael Howell-3/+1
Instead of suggesting that the body always replace the last character on the line, presuming it must be a semicolon, the parser should instead check what the last character is, and append the body if it is anything else. Fixes #83104
2022-03-21Auto merge of #95104 - compiler-errors:remove-ascription, r=davidtwcobors-0/+80
suggest removing type ascription in bad parsing position Not sure how to test this with the non-nightly suggestion. Didn't add a new UI test because it already manifests in an existing UI test. Fixes #95014
2022-03-20fix a not emitted unmatched angle bracket errorTakayuki Maeda-0/+17
2022-03-18suggest removing type ascription in bad positionMichael Goulet-0/+80
2022-03-17Rollup merge of #91133 - terrarier2111:unsafe-diagnostic, r=jackh726Dylan DPC-1/+6
Improve `unsafe` diagnostic This fixes: https://github.com/rust-lang/rust/issues/90880 I didn't use the exact proposed messages though.
2022-03-11Format core and std macro rules, removing needless surrounding blocksDavid Tolnay-1/+1
2022-03-06Auto merge of #90076 - jackh726:wherethewhere, r=nikomatsakisbors-61/+117
Change location of where clause on GATs Closes #89122 ~Blocked on lang FCP~ r? `@nikomatsakis`
2022-03-05Review changesJack Huey-44/+106
2022-03-05Change to lintJack Huey-7/+9
2022-03-05Change syntax for TyAlias where clausesJack Huey-33/+25
2022-03-05Rollup merge of #94633 - ↵Ralf Jung-0/+18
TaKO8Ki:suggest-removing-semicolon-after-derive-attribute, r=cjgillot Suggest removing a semicolon after derive attributes closes #93942
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