You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Ok struct compiles just right, but the Err one fails with
error: expected one of `(`, `+`, `,`, `::`, `<`, `=`, or `>`, found `+=`
--> main.rs:2:21
|
2 | struct Err<T: Clone += ()> { t: T }
| ^^ expected one of 7 possible tokens here
error: aborting due to previous error
I think this behavior is wrong: for tokens like >> or || use use "context sensitive" lexing.
The text was updated successfully, but these errors were encountered:
Yeah, "token splitting" (&& -> & & or += -> + =) is done very inconsistently.
It's not done automatically, but manually if the code author expects the split version to result in valid code sometimes. It looks like nobody expected + = to be a fragment of valid code in this position.
parser: Split `+=` into `+` and `=` where `+` is explicitly requested (such as generics)
Added functions in tokens to check whether a token leads with `+`. Used them when parsing to allow for token splitting of `+=` into `+` and `=`.
Fixes#47856
Consider this code:
The
Ok
struct compiles just right, but theErr
one fails withI think this behavior is wrong: for tokens like
>>
or||
use use "context sensitive" lexing.The text was updated successfully, but these errors were encountered: