| Age | Commit message (Collapse) | Author | Lines |
|
Fix fn front matter parsing ICE from invalid code.
Fixes #60075.
This PR fixes an "unreachable code" ICE that results from parsing
invalid code where the compiler is expecting the next trait item
declaration in the middle of the previous trait item due to extra
closing braces.
r? @estebank (thanks for the minimized test case)
|
|
Simplify doc comment lexing
is_doc_comment function checks the first four chars, but this is
redundant, `doc_comment` local var has the same info.
|
|
This commit fixes an "unreachable code" ICE that results from parsing
invalid code where the compiler is expecting the next trait item
declaration in the middle of the previous trait item due to extra
closing braces.
|
|
|
|
|
|
|
|
|
|
|
|
Emit ansi color codes in the `rendered` field of json diagnostics
cc @ljedrz
Implemented for https://github.com/rust-lang/rust/pull/56595#issuecomment-447645115 (x.py clippy)
|
|
Recover from missing semicolon based on the found token
When encountering one of a few keywords when a semicolon was
expected, suggest the semicolon and recover:
```
error: expected one of `.`, `;`, `?`, or an operator, found `let`
--> $DIR/recover-missing-semi.rs:4:5
|
LL | let _: usize = ()
| - help: missing semicolon here
LL |
LL | let _ = 3;
| ^^^
error[E0308]: mismatched types
--> $DIR/recover-missing-semi.rs:2:20
|
LL | let _: usize = ()
| ^^ expected usize, found ()
|
= note: expected type `usize`
found type `()`
```
|
|
Error when using `catch` after `try`
Part of https://github.com/rust-lang/rust/issues/31436
|
|
Fix lifetime on LocalInternedString::get function
cc @eddyb @nnethercote
|
|
|
|
|
|
When encountering one of a few keywords when a semicolon was
expected, suggest the semicolon and recover:
```
error: expected one of `.`, `;`, `?`, or an operator, found `let`
--> $DIR/recover-missing-semi.rs:4:5
|
LL | let _: usize = ()
| - help: missing semicolon here
LL |
LL | let _ = 3;
| ^^^
error[E0308]: mismatched types
--> $DIR/recover-missing-semi.rs:2:20
|
LL | let _: usize = ()
| ^^ expected usize, found ()
|
= note: expected type `usize`
found type `()`
```
|
|
|
|
|
|
cleanup shebang handling in the lexer
|
|
is_doc_comment function checks the first four chars, but this is
redundant, `doc_comment` local var has the same info.
|
|
|
|
|
|
|
|
|
|
r=pnkfelix
fixes rust-lang#56766
fixes #56766
|
|
|
|
Recover from parse error in tuple syntax
|
|
|
|
Use `SmallVec` in `TokenStreamBuilder`.
This reduces by 12% the number of allocations done for a "clean incremental" of `webrender_api`, which reduces the instruction count by about 0.5%.
r? @petrochenkov
|
|
This reduces by 12% the number of allocations done for a "clean
incremental" of `webrender_api`, which reduces the instruction count by
about 0.5%.
It also reduces instruction counts by up to 1.4% across a range of
rustc-perf benchmark runs.
|
|
|
|
Do not complain about unmentioned fields in recovered patterns
When the parser has to recover from malformed code in a pattern, do not
complain about missing fields.
Fix #59145.
|
|
Reject integer suffix when tuple indexing
Fix #59418.
r? @varkor
|
|
syntax: Remove warning for unnecessary path disambiguators
`rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in https://github.com/rust-lang/rust/pull/43540 (where it was introduced).
One hardcoded warning less.
Closes https://github.com/rust-lang/rust/issues/58055
r? @nikomatsakis
|
|
|
|
|
|
|
|
Expand suggestions for type ascription parse errors
Fix #51222. CC #48016, #47666, #54516, #34255.
|
|
|
|
|
|
This commit makes two changes - separating the `NodeId` that identifies
an enum variant from the `NodeId` that identifies the variant's
constructor; and no longer creating a `NodeId` for `Struct`-style enum
variants and structs.
Separation of the variant id and variant constructor id will allow the
rest of RFC 2008 to be implemented by lowering the visibility of the
variant's constructor without lowering the visbility of the variant
itself.
No longer creating a `NodeId` for `Struct`-style enum variants and
structs mostly simplifies logic as previously this `NodeId` wasn't used.
There were various cases where the `NodeId` wouldn't be used unless
there was an unit or tuple struct or enum variant but not all uses of
this `NodeId` had that condition, by removing this `NodeId`, this must
be explicitly dealt with. This change mostly applied cleanly, but there
were one or two cases in name resolution and one case in type check
where the existing logic required a id for `Struct`-style enum variants
and structs.
|
|
|
|
|
|
syntax: Better recovery for `$ty::AssocItem` and `ty!()::AssocItem`
This PR improves on https://github.com/rust-lang/rust/pull/46788 covering a few missing cases.
Fixes https://github.com/rust-lang/rust/issues/52307
Fixes https://github.com/rust-lang/rust/issues/53776
r? @estebank
|
|
|
|
|
|
|
|
Tweak incorrect escaped char diagnostic
|
|
Do not complain about non-existing fields after parse recovery
When failing to parse struct-like enum variants, the ADT gets recorded
as having no fields. Record that we have actually recovered during
parsing of this variant to avoid complaing about non-existing fields
when actually using it.
Fix #57361.
|
|
Recover from missing comma between enum variants and from bad `pub` kw
Fix #56579. Fix #56473.
|
|
|