Commit Graph

22 Commits

Author SHA1 Message Date
Matthias Krüger
ba928ba041
Rollup merge of #106960 - estebank:parse-anon-enums, r=cjgillot
Teach parser to understand fake anonymous enum syntax

Parse `Ty | OtherTy` in function argument and return types.
Parse type ascription in top level patterns.

Minimally address #100741.
2023-01-26 06:15:24 +01:00
Matthias Krüger
3693399ffc
Rollup merge of #107058 - clubby789:eqeq-homoglyph, r=wesleywiser
Recognise double-equals homoglyph

Recognise `⩵` as a homoglyph for `==`.

The first commit switches `char` to `&str`, as all previous homoglyphs corresponded to a single ASCII character, while the second implements the fix.

`@rustbot` label +A-diagnostics +A-parser
2023-01-20 07:16:10 +01:00
Matthias Krüger
df88f7e02c
Rollup merge of #106783 - WaffleLapkin:break-my-ident, r=wesleywiser
Recover labels written as identifiers

This adds recovery for `break label expr` and `continue label`, as well as a test for `break label`.
2023-01-20 07:16:08 +01:00
clubby789
1487aa9f9d Add double-equals homoglyph 2023-01-19 02:25:55 +00:00
Esteban Küber
12d18e4031 Ensure macros are not affected 2023-01-17 17:09:58 +00:00
Esteban Küber
c847a01a3b Emit fewer errors on patterns with possible type ascription 2023-01-17 01:58:37 +00:00
Esteban Küber
2d82420665 Teach parser to understand fake anonymous enum syntax
Parse `-> Ty | OtherTy`.
Parse type ascription in top level patterns.
2023-01-17 01:58:32 +00:00
David Tolnay
dab06ccdab
Emit only one nbsp error per file 2023-01-14 11:06:22 -08:00
David Tolnay
39edcfa84e
Add more nbsp to unicode-chars test 2023-01-14 11:04:36 -08:00
Matthias Krüger
8e0eecdba6
Rollup merge of #106566 - clubby789:contiguous-weird-unicode, r=cjgillot
Emit a single error for contiguous sequences of unknown tokens

Closes #106101

On encountering a sequence of identical source characters which are unknown tokens, note the amount of subsequent characters and advance past them silently. The old behavior was to emit an error and 'help' note for every single one.

`@rustbot` label +A-diagnostics +A-parser
2023-01-14 13:04:24 +01:00
Maybe Waffle
57d822a904 Recover labels written as identifiers 2023-01-13 09:18:36 +00:00
Yuki Okushi
9a2f3937fc
Rollup merge of #106608 - compiler-errors:missing-generics-verbose, r=estebank
Render missing generics suggestion verbosely

It's a bit easier to read like this, especially ones that are appending new generics onto an existing list, like ": `, T`" which render somewhat poorly inline.

Also don't suggest `dyn` as a type parameter to add, even if technically that's valid in edition 2015.
2023-01-13 16:54:22 +09:00
bors
279f1c9d8c Auto merge of #106004 - fee1-dead-contrib:const-closures, r=oli-obk
Const closures

cc https://github.com/rust-lang/rust/issues/106003
2023-01-13 05:04:48 +00:00
Michael Goulet
bf0623e363 Don't suggest dyn as parameter to add 2023-01-12 22:04:30 +00:00
Michael Goulet
950b47fb96 Render missing generics suggestion verbosely 2023-01-12 22:04:30 +00:00
Maybe Waffle
b0609889d7 Add a test for recovery of unticked labels 2023-01-12 19:25:32 +00:00
Deadbeef
4fb10c0ce4 parse const closures 2023-01-12 02:28:37 +00:00
bors
d4203eda5f Auto merge of #106537 - 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-12 02:16:16 +00:00
clubby789
a3d6bc3468 Emit a single error for contiguous sequences of Unicode homoglyphs 2023-01-12 00:15:32 +00:00
León Orell Valerian Liehr
70ddde76df
parser: recover from where clauses placed before tuple struct bodies 2023-01-11 17:54:48 +01:00
Esteban Küber
5311938531 Detect struct literal needing parentheses
Fix #82051.
2023-01-11 16:53:21 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00