Bring back suggestion for splitting <- into < -

Closes #62632
This commit is contained in:
Ilija Tovilo 2019-08-11 23:37:05 +02:00
parent 72f8043d44
commit 91af5c2daf
No known key found for this signature in database
GPG key ID: 3F123D0ADD448198
6 changed files with 33 additions and 8 deletions

View file

@ -2,7 +2,7 @@
fn foo() {
let (x, y) = (0, 0);
x <- y; //~ ERROR expected one of
x <- y; //~ ERROR unexpected token: `<-`
}
fn main() {

View file

@ -1,8 +1,12 @@
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `<-`
error: unexpected token: `<-`
--> $DIR/bad.rs:5:7
|
LL | x <- y;
| ^^ expected one of 8 possible tokens here
| ^^
help: if you meant to write a comparison against a negative value, add a space in between `<` and `-`
|
LL | x < - y;
| ^^^
error: expected expression, found keyword `in`
--> $DIR/bad.rs:10:5

View file

@ -1,6 +1,6 @@
fn main() {
let x = -5;
if x<-1 { //~ ERROR expected `{`, found `<-`
if x<-1 { //~ ERROR unexpected token: `<-`
println!("ok");
}
}

View file

@ -1,10 +1,12 @@
error: expected `{`, found `<-`
error: unexpected token: `<-`
--> $DIR/placement-syntax.rs:3:9
|
LL | if x<-1 {
| -- ^^ expected `{`
| |
| this `if` statement has a condition, but no block
| ^^
help: if you meant to write a comparison against a negative value, add a space in between `<` and `-`
|
LL | if x< -1 {
| ^^^
error: aborting due to previous error