rust-lang/rust — pull request #17290 by bkoropoff (2014-09-16 03:49:46+00:00)
Title: Propagate restrictions against struct literals to the RHS of assignment

This prevents confusing errors when accidentally using an assignment in an `if` expression. For example:

```rust
fn main() {
let x = 1u;
if x = x {
println!("{}", x);
}
}
```

Previously, this yielded:

```
test.rs:4:16: 4:17 error: expected `:`, found `!`
test.rs:4 println!("{}", x);
^
```

With this change, it now yields:

```
test.rs:3:8: 3:13 error: mismatched types: expected `bool`, found `()` (expected bool, found ())
test.rs:3 if x = x {
^~~~~
```

Closes issue #17283

r? @nick29581