| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Fix #79161.
|
|
Also update tests
|
|
Detect diff markers in the parser
Partly address #32059.
|
|
|
|
|
|
|
|
Partly address #32059.
|
|
Recover `fn` keyword as `Fn` trait in bounds
`impl fn()` -> `impl Fn()`
Fixes #82515
|
|
r=compiler-errors
Always suggest as `MachineApplicable` in `recover_intersection_pat`
This resolves one FIXME in `recover_intersection_pat` by always applying `MachineApplicable` when suggesting, as `bindings_after_at` is now stable.
This also separates a test to apply `// run-rustfix`.
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
|
|
Allow .. to be parsed as let initializer
.. and ..= are valid expressions, however when used in a let statement
it is not parsed.
Fixes #105634
|
|
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
|
|
.. and ..= are valid expressions, however when used in a let statement
it is not parsed.
|
|
Suggest impl in the scenario of typo with fn
Fixes #105366
|
|
Properly handle postfix inc/dec in standalone and subexpr scenarios
Fixes #104867
r? `@estebank`
|
|
available
|
|
|
|
|
|
|
|
propagate the error from parsing enum variant to the parser and emit out
While parsing enum variant, the error message always disappear
Because the error message that emit out is from main error of parser
The information of enum variant disappears while parsing enum variant with error
We only check the syntax of expecting token, i.e, in case https://github.com/rust-lang/rust/issues/103869
It will error it without telling the message that this error is from pasring enum variant.
Propagate the sub-error from parsing enum variant to the main error of parser by chaining it with map_err
Check the sub-error before emitting the main error of parser and attach it.
Fix https://github.com/rust-lang/rust/issues/103869
|
|
|
|
Because the error message that emit out is from main error of parser
The information of enum variant disappears while parsing enum variant with error
We only check the syntax of expecting token, i.e, in case #103869
It will error it without telling the message that this error is from pasring enum variant.
Propagate the sub-error from parsing enum variant to the main error of parser by chaining it with map_err
Check the sub-error before emitting the main error of parser and attach it.
Fix #103869
|
|
|
|
|
|
|
|
Fixes #104620.
|
|
|
|
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
|
|
|
|
r=davidtwco
Slightly improve error message for invalid identifier
fixes #104088
|
|
Show note where the macro failed to match
When feeding the wrong tokens, it used to fail with a very generic error that wasn't very helpful. This change tries to help by noting where specifically the matching went wrong.
```rust
macro_rules! uwu {
(a a a b) => {};
}
uwu! { a a a c }
```
```diff
error: no rules expected the token `c`
--> macros.rs:5:14
|
1 | macro_rules! uwu {
| ---------------- when calling this macro
...
4 | uwu! { a a a c }
| ^ no rules expected this token in macro call
|
+note: while trying to match `b`
+ --> macros.rs:2:12
+ |
+2 | (a a a b) => {};
+ | ^
```
|
|
|
|
|
|
|
|
|
|
This shows a small note on what the macro matcher was currently
processing to aid with "no rules expected the token X" errors.
|
|
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
|
|
Fix ICE #103748
Fixes #103748
|
|
|
|
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.
|
|
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
|
|
|
|
Unescaping cleanups
Some code improvements, and some error message improvements.
Best reviewed one commit at a time.
r? ````@matklad````
|
|
|
|
r=jackh726,wesleywiser
Avoid possible infinite loop when next_point reaching the end of file
Fixes #103451
If we return a span with `lo` = `hi`, `span_to_snippet` will always get `Ok("")`, which may introduce infinite loop if we don't care.
This PR make `find_width_of_character_at_span` return `width` with 1, so that `span_to_snippet` will get an `Err`.
|
|
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)
|
|
Make underscore_literal_suffix a hard error.
It's been a warning for 5.5 years. Time to make it a hard error.
Closes #42326.
r? ``@pnkfelix``
|