]> git.lizzy.rs Git - rust.git/commit
Auto merge of #45452 - estebank:colon-typo, r=nikomatsakis
authorbors <bors@rust-lang.org>
Wed, 8 Nov 2017 20:00:41 +0000 (20:00 +0000)
committerbors <bors@rust-lang.org>
Wed, 8 Nov 2017 20:00:41 +0000 (20:00 +0000)
commit02004ef78383cb174a41df7735a552823fa10b90
tree13ac8f02bd76e0479917b424dbe0d33a15dd611b
parent7ca430df713ad1697a9d27eb4ae0f49c8563eed4
parent9dc7abe06d2b2771b09b6dac6eef5ac83b58573f
Auto merge of #45452 - estebank:colon-typo, r=nikomatsakis

Detect `=` -> `:` typo in let bindings

When encountering a let binding type error, attempt to parse as
initializer instead. If successful, it is likely just a typo:

```rust
fn main() {
    let x: Vec::with_capacity(10);
}
```

```
error: expected type, found `10`
 --> file.rs:3:31
  |
3 |     let x: Vec::with_capacity(10, 20);
  |         --                    ^^
  |         ||
  |         |help: did you mean assign here?: `=`
  |         while parsing the type for `x`
```

Fix #43703.
src/librustc_resolve/lib.rs
src/libsyntax/parse/parser.rs