about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorBrian Koropoff <bkoropoff@gmail.com>2014-09-15 19:06:27 -0700
committerBrian Koropoff <bkoropoff@gmail.com>2014-09-16 19:21:42 -0700
commit3863b68df490dab6bcaccef39039382d47ffb226 (patch)
tree91bf44046d8205bb4837fe75d4ecd74a6c138263 /src/rustllvm/RustWrapper.cpp
parent99293b16e46a14e4fb49ab2ebd02a521634c2b44 (diff)
downloadrust-3863b68df490dab6bcaccef39039382d47ffb226.tar.gz
rust-3863b68df490dab6bcaccef39039382d47ffb226.zip
Propagate restrictions against struct literals to the RHS of assignments
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
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions