about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
AgeCommit message (Collapse)AuthorLines
2023-01-23Add suggestion to remove if in let...else blockEdward Shen-1/+10
Adds an additional hint to failures where we encounter an else keyword while we're parsing an if-let block. This is likely that the user has accidentally mixed if-let and let...else together.
2023-01-12Auto merge of #106537 - ↵bors-0/+24
fmease:recover-where-clause-before-tuple-struct-body, r=estebank Recover from where clauses placed before tuple struct bodies Open to any suggestions regarding the phrasing of the diagnostic. Fixes #100790. `@rustbot` label A-diagnostics r? diagnostics
2023-01-11parser: recover from where clauses placed before tuple struct bodiesLeón Orell Valerian Liehr-0/+24
2023-01-11Detect struct literal needing parenthesesEsteban Küber-0/+18
Fix #82051.
2022-12-27Recover `fn` keyword as `Fn` trait in boundsMichael Goulet-0/+8
2022-12-10fix #105366, suggest impl in the scenario of typo with fnyukang-0/+8
2022-11-21Match crate and slug namesmejrs-120/+114
2022-11-18Rollup merge of #103405 - chenyukang:yukang/fix-103381-and-if, r=compiler-errorsMatthias Krüger-0/+8
Detect incorrect chaining of if and if let conditions and recover Fixes #103381
2022-11-16Use `token::Lit` in `ast::ExprKind::Lit`.Nicholas Nethercote-90/+0
Instead of `ast::Lit`. Literal lowering now happens at two different times. Expression literals are lowered when HIR is crated. Attribute literals are lowered during parsing. This commit changes the language very slightly. Some programs that used to not compile now will compile. This is because some invalid literals that are removed by `cfg` or attribute macros will no longer trigger errors. See this comment for more details: https://github.com/rust-lang/rust/pull/102944#issuecomment-1277476773
2022-11-15fix #104088, Slightly improve error message for invalid identifieryukang-0/+8
2022-11-15fix #103381, Detect incorrect chaining of if and if let conditionsyukang-0/+8
2022-11-14Rollup merge of #104223 - fmease:recover-fn-ptr-with-generics, r=estebankMatthias Krüger-0/+21
Recover from function pointer types with generic parameter list Give a more helpful error when encountering function pointer types with a generic parameter list like `fn<'a>(&'a str) -> bool` or `fn<T>(T) -> T` and suggest moving lifetime parameters to a `for<>` parameter list. I've added a bunch of extra code to properly handle (unlikely?) corner cases like `for<'a> fn<'b>()` (where there already exists a `for<>` parameter list) correctly suggesting `for<'a, 'b> fn()` (merging the lists). If you deem this useless, I can simplify the code by suggesting nothing at all in this case. I am quite open to suggestions regarding the wording of the diagnostic messages. Fixes #103487. ``@rustbot`` label A-diagnostics r? diagnostics
2022-11-11Rollup merge of #103468 - chenyukang:yukang/fix-103435-extra-parentheses, ↵Manish Goregaokar-2/+4
r=estebank Fix unused lint and parser caring about spaces to won't produce invalid code Fixes #103435
2022-11-11Recover from fn ptr tys with generic param listLeón Orell Valerian Liehr-0/+21
2022-11-08use subdiagnostic for sugesting add letyukang-1/+1
2022-11-08fix #103587, Recover from common if let syntax mistakes/typosyukang-0/+9
2022-11-04fake a base to suppress later extra error messageyukang-1/+1
2022-11-04fix #102806, suggest use .. to fill in the rest of the fields of Structyukang-0/+9
2022-11-01Rollup merge of #103575 - Xiretza:suggestions-style-attr, r=davidtwcoManish Goregaokar-24/+47
Change #[suggestion_*] attributes to use style="..." As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20tool_only_span_suggestion), this changes `#[(multipart_)suggestion_{short,verbose,hidden}(...)]` attributes to plain `#[(multipart_)suggestion(...)]` attributes with a `style = "{short,verbose,hidden}"` parameter. It also adds a new style, `tool-only`, that corresponds to `tool_only_span_suggestion`/`tool_only_multipart_suggestion` and causes the suggestion to not be shown in human-readable output at all. Best reviewed commit-by-commit, there's a bit of noise in there. cc #100717 `@compiler-errors` r? `@davidtwco`
2022-11-01Auto merge of #103217 - mejrs:track, r=eholkbors-0/+2
Track where diagnostics were created. This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`. For example, the following code... ```rust struct A; struct B; fn main(){ let _: A = B; } ``` ...now emits the following error message: ``` error[E0308]: mismatched types --> src\main.rs:5:16 | 5 | let _: A = B; | - ^ expected struct `A`, found struct `B` | | | expected due to this -Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31 ```
2022-10-31Add more track_callermejrs-0/+2
2022-10-26Convert all #[suggestion_*] attributes to #[suggestion(style = "...")]Xiretza-24/+47
Using the following command: find compiler/ -type f -name '*.rs' -exec perl -i -gpe \ 's/(#\[\w*suggestion)_(short|verbose|hidden)\(\s*(\S+,)?/\1(\3style = "\2",/g' \ '{}' +
2022-10-24fix parentheses surrounding spacing issue in parseryukang-2/+4
2022-10-23Migrate all diagnosticsNilstrieb-184/+170
2022-09-27Implement IntoDiagnosticArg for rustc_ast::token::Token(Kind)Xiretza-24/+29
2022-09-27Don't unnecessarily stringify paths in diagnosticsXiretza-3/+4
2022-09-27Migrate even more diagnostics in rustc_parse to diagnostic structsXiretza-0/+211
2022-09-27Migrate "struct literal body without path" error to diagnostic structXiretza-0/+18
2022-09-27Migrate "expected semicolon" diagnostics to diagnostic structsXiretza-0/+51
2022-09-27Migrate "expected identifier" diagnostics to diagnostic structsXiretza-1/+94
2022-09-27Migrate more rustc_parse diagnostics to diagnostic structsXiretza-5/+94
2022-09-27Move rustc_parse diagnostic structs to separate moduleXiretza-0/+783