| Age | Commit message (Collapse) | Author | Lines |
|
Instead of loading the Fluent resources for every crate in
`rustc_error_messages`, each crate generates typed identifiers for its
own diagnostics and creates a static which are pulled together in the
`rustc_driver` crate and provided to the diagnostic emitter.
Signed-off-by: David Wood <david.wood@huawei.com>
|
|
Migrate some of `rustc_parse` to derive diagnostics
`@rustbot` label +A-translation
r? rust-lang/diagnostics
cc #100717
|
|
|
|
lenko-d:default_value_for_a_lifetime_generic_parameter_produces_confusing_diagnostic, r=compiler-errors
Recover from lifetimes with default lifetimes in generic args
Fixes [#107492](https://github.com/rust-lang/rust/issues/107492)
|
|
|
|
|
|
Improve diagnostic for missing space in range pattern
Improves the diagnostic in #107425 by turning it into a note explaining the parsing issue.
r? `@compiler-errors`
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)] does not allow multiple subdiagnostics on one
variant, as in NonItemInItemListSub::Other.
|
|
|
|
|
|
|
|
|
|
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.
|
|
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
|
|
|
|
Fix #82051.
|
|
|
|
|
|
|
|
Detect incorrect chaining of if and if let conditions and recover
Fixes #103381
|
|
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
|
|
|
|
|
|
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
|
|
r=estebank
Fix unused lint and parser caring about spaces to won't produce invalid code
Fixes #103435
|
|
|
|
|
|
|
|
|
|
|
|
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`
|
|
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
```
|
|
|
|
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' \
'{}' +
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|