Detect more cases of `=` to `:` typo
When a `Local` is fully parsed, but not followed by a `;`, keep the `:` span
arround and mention it. If the type could continue being parsed as an
expression, suggest replacing the `:` with a `=`.
```
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
--> file.rs:2:32
|
2 | let _: std::env::temp_dir().join("foo");
| - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
| |
| while parsing the type for `_`
| help: use `=` if you meant to assign
```
Fix #119665.
2024-02-26 18:48:32 -06:00
|
|
|
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
|
2024-03-06 15:59:03 -06:00
|
|
|
--> $DIR/recover-colon-instead-of-eq-in-local.rs:5:32
|
|
|
|
|
|
|
|
|
LL | let _: std::env::temp_dir().join(&self, push: Box<usize>);
|
|
|
|
| - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
|
|
|
|
| |
|
|
|
|
| while parsing the type for `_`
|
|
|
|
|
|
|
|
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
|
|
|
|
--> $DIR/recover-colon-instead-of-eq-in-local.rs:9:32
|
Detect more cases of `=` to `:` typo
When a `Local` is fully parsed, but not followed by a `;`, keep the `:` span
arround and mention it. If the type could continue being parsed as an
expression, suggest replacing the `:` with a `=`.
```
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
--> file.rs:2:32
|
2 | let _: std::env::temp_dir().join("foo");
| - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
| |
| while parsing the type for `_`
| help: use `=` if you meant to assign
```
Fix #119665.
2024-02-26 18:48:32 -06:00
|
|
|
|
|
|
|
|
LL | let _: std::env::temp_dir().join("foo");
|
|
|
|
| - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
|
|
|
|
| |
|
|
|
|
| while parsing the type for `_`
|
|
|
|
| help: use `=` if you meant to assign
|
|
|
|
|
2024-03-06 15:59:03 -06:00
|
|
|
error: aborting due to 2 previous errors
|
Detect more cases of `=` to `:` typo
When a `Local` is fully parsed, but not followed by a `;`, keep the `:` span
arround and mention it. If the type could continue being parsed as an
expression, suggest replacing the `:` with a `=`.
```
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
--> file.rs:2:32
|
2 | let _: std::env::temp_dir().join("foo");
| - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
| |
| while parsing the type for `_`
| help: use `=` if you meant to assign
```
Fix #119665.
2024-02-26 18:48:32 -06:00
|
|
|
|