about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
AgeCommit message (Collapse)AuthorLines
2022-11-11Rollup merge of #103468 - chenyukang:yukang/fix-103435-extra-parentheses, ↵Manish Goregaokar-5/+19
r=estebank Fix unused lint and parser caring about spaces to won't produce invalid code Fixes #103435
2022-11-11Auto merge of #99918 - WaffleLapkin:fnFnfun, r=estebankbors-42/+115
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-10Auto merge of #104236 - compiler-errors:rollup-adjshd6, r=compiler-errorsbors-1/+18
Rollup of 9 pull requests Successful merges: - #102763 (Some diagnostic-related nits) - #103443 (Parser: Recover from using colon as path separator in imports) - #103675 (remove redundent "<>" for ty::Slice with reference type) - #104046 (bootstrap: add support for running Miri on a file) - #104115 (Migrate crate-search element to CSS variables) - #104190 (Ignore "Change InferCtxtBuilder from enter to build" in git blame) - #104201 (Add check in GUI test for file loading failure) - #104211 (:arrow_up: rust-analyzer) - #104231 (Update mailmap) Failed merges: - #104169 (Migrate `:target` rules to use CSS variables) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-09Rollup merge of #103443 - mucinoab:recover-colon-as-path-separetor, ↵Michael Goulet-0/+17
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-10Auto merge of #103636 - chenyukang:yukang/fix-103587-sugg-if-let, ↵bors-4/+12
r=jackh276,davidtwco Recover from common if let syntax mistakes/typos Fixes #103587
2022-11-09Make span_suggestions take IntoIteratorMichael Goulet-1/+1
2022-11-08Parser: Recover from using colon as path separator in importsBruno A. Muciño-0/+17
2022-11-08Fix outdated commentWaffle Maybe-1/+1
Co-authored-by: clubby789 <jamie@hill-daniel.co.uk>
2022-11-08Remove an address comparison from the parserMaybe Waffle-6/+1
2022-11-08fix #103587, Recover from common if let syntax mistakes/typosyukang-4/+12
2022-11-07Rollup merge of #103986 - ↵Dylan DPC-4/+8
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-05Fix typoMichael Goulet-2/+2
2022-11-04Don't silently eat label before block in block-like exprMichael Goulet-4/+8
2022-11-04fake a base to suppress later extra error messageyukang-16/+13
2022-11-04fix #102806, suggest use .. to fill in the rest of the fields of Structyukang-3/+18
2022-10-28Gate some recovery behind a flagNilstrieb-6/+32
Mainly in `expr.rs`
2022-10-27Rollup merge of #103544 - Nilstrieb:no-recovery-pls, r=compiler-errorsMatthias Krüger-2/+30
Add flag to forbid recovery in the parser To start the effort of fixing #103534, this adds a new flag to the parser, which forbids the parser from doing recovery, which it shouldn't do in macros. This doesn't add any new checks for recoveries yet and is just here to bikeshed the names for the functions here before doing more. r? `@compiler-errors`
2022-10-26Fix typonils-1/+1
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2022-10-26Add documentationNilstrieb-1/+8
2022-10-26Rollup merge of #103444 - chenyukang:yukang/fix-103425-extra-diag, r=davidtwcoDylan DPC-29/+36
Remove extra type error after missing semicolon error Fixes #103425
2022-10-25Add flag to forbid recovery in the parserNilstrieb-2/+23
2022-10-25Rollup merge of #103333 - chenyukang:yukang/fix-103143, r=wesleywiserYuki Okushi-5/+11
Fix assertion failed for break_last_token and trailing token Fixes #103143
2022-10-24fix parentheses surrounding spacing issue in parseryukang-5/+19
2022-10-24fix #103425, remove extra type error after missing semicolon erroryukang-29/+36
2022-10-23Auto merge of #103431 - Dylan-DPC:rollup-oozfo89, r=Dylan-DPCbors-9/+87
Rollup of 6 pull requests Successful merges: - #101293 (Recover when unclosed char literal is parsed as a lifetime in some positions) - #101908 (Suggest let for assignment, and some code refactor) - #103192 (rustdoc: Eliminate uses of `EarlyDocLinkResolver::all_traits`) - #103226 (Check `needs_infer` before `needs_drop` during HIR generator analysis) - #103249 (resolve: Revert "Set effective visibilities for imports more precisely") - #103305 (Move some tests to more reasonable places) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-23Rollup merge of #101293 - compiler-errors:lt-is-actually-char, r=estebankDylan DPC-9/+87
Recover when unclosed char literal is parsed as a lifetime in some positions Fixes #101278
2022-10-23Migrate all diagnosticsNilstrieb-15/+15
2022-10-22Don't erroneously deny semicolons after closure expr within parentheses in a ↵Michael Goulet-0/+4
macro
2022-10-22Recover unclosed char literal being parsed as lifetimeMichael Goulet-9/+87
2022-10-21Rollup merge of #102922 - kper:bugfix/102902-filtering-json, r=oli-obkDylan DPC-1/+9
Filtering spans when emitting json According to the issue #102902, we shouldn't emit spans which have an empty span and no suggested replacement.
2022-10-20fix assertion failed for break_last_token and trailing tokenyukang-5/+11
2022-10-20Implement assertions and fixes to not emit empty spans without suggestionsKevin Per-1/+9
2022-10-18Fix the bug of next_point in spanyukang-4/+4
2022-10-14more dupe word typosRageking8-1/+1
2022-10-12Rollup merge of #102927 - compiler-errors:let, r=davidtwcoDylan DPC-6/+11
Fix `let` keyword removal suggestion in structs (1.) Fixes a bug where, given this code: ```rust struct Foo { let x: i32, } ``` We were parsing the field name as `let` instead of `x`, which causes issues later on in the type-checking phase. (2.) Also, suggestions for `let: i32` as a field regressed, displaying this extra `help:` which is removed by this PR ``` help: remove the let, the `let` keyword is not allowed in struct field definitions | 2 - let: i32, 2 + : i32, ``` (3.) Makes the suggestion text a bit more succinct, since we don't need to re-explain that `let` is not allowed in this position (since it's in a note that follows). This causes the suggestion to render inline as well. cc `@gimbles,` this addresses a few nits I mentioned in your PR.
2022-10-12Use `tidy-alphabetical` in the compilerNilstrieb-1/+2
2022-10-11Fix let removal suggestion in structMichael Goulet-6/+11
2022-10-10Rollup merge of #101789 - gimbles:let, r=estebankMatthias Krüger-1/+17
`let`'s not needed in struct field definitions Fixes #101683
2022-10-10`let` is not allowed in struct field definitionsgimbles-1/+17
Co-authored-by: jyn514 <jyn514@gmail.com> Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2022-10-10Rollup merge of #102345 - chenyukang:fix-102182-impl-trait, r=estebankYuki Okushi-2/+34
Recover from impl Trait in type param bound Fixes #102182 r? ``@estebank``
2022-10-08Stabilize half_open_range_patternsUrgau-1/+0
2022-10-08fix #102182, recover from impl Trait in type param boundyukang-2/+34
2022-10-03Add comments to `TokenCursor::desugar`.Nicholas Nethercote-1/+5
It took me some time to work out what this code was doing.
2022-10-01Rollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillotMatthias Krüger-3/+5
Remove `expr_parentheses_needed` from `ParseSess` Not sure why this method needed to exist on `ParseSess`, but we can achieve the same behavior by just inlining it everywhere.
2022-10-01Replace some `bool` params with an enumMaybe Waffle-44/+52
2022-10-01Recover wrong cased keywords starting functionsMaybe Waffle-48/+67
2022-10-01recover wrong-cased `use`s (`Use`, `USE`, etc)Maybe Waffle-3/+49
2022-09-30Rollup merge of #102493 - nnethercote:improve-size-assertions-some-more, r=lqdMatthias Krüger-8/+10
Group together more size assertions. Also add a few more assertions for some relevant token-related types. And fix an erroneous comment in `rustc_errors`. r? `@lqd`
2022-10-01Group together more size assertions.Nicholas Nethercote-8/+10
Also add a few more assertions for some relevant token-related types. And fix an erroneous comment in `rustc_errors`.
2022-09-30Rollup merge of #102350 - TaKO8Ki:incomplete-fn-in-struct-definition, ↵Matthias Krüger-11/+17
r=fee1-dead Improve errors for incomplete functions in struct definitions Given the following code: ```rust fn main() {} struct Foo { fn } ``` [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=29139f870511f6918324be5ddc26c345) The current output is: ``` Compiling playground v0.0.1 (/playground) error: functions are not allowed in struct definitions --> src/main.rs:4:5 | 4 | fn | ^^ | = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information error: could not compile `playground` due to previous error ``` In this case, rustc should suggest escaping `fn` to use it as an identifier.