about summary refs log tree commit diff
path: root/src/test/run-pass/thinlto
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-03-19 10:18:13 -0400
committerGitHub <noreply@github.com>2017-03-19 10:18:13 -0400
commit9032ceae979b6fc0e74f1a3db62222eb1cfce886 (patch)
tree9bfc0191a6c1e885360dacaa32f1c01e4e9f42f1 /src/test/run-pass/thinlto
parent7b686ce4caa65efb96a9a00062d7d408f6d475cd (diff)
parent9ac628d5e84bd3664e41d53bafa3d66b303b19c1 (diff)
downloadrust-9032ceae979b6fc0e74f1a3db62222eb1cfce886.tar.gz
rust-9032ceae979b6fc0e74f1a3db62222eb1cfce886.zip
Rollup merge of #40445 - estebank:issue-18150, r=jonathandturner
Point to let when modifying field of immutable variable

Point at the immutable local variable when trying to modify one of its
fields.

Given a file:

```rust
struct Foo {
    pub v: Vec<String>
}

fn main() {
    let f = Foo { v: Vec::new() };
    f.v.push("cat".to_string());
}
```

present the following output:

```
error: cannot borrow immutable field `f.v` as mutable
 --> file.rs:7:13
  |
6 |    let f = Foo { v: Vec::new() };
  |        - this should be `mut`
7 |    f.v.push("cat".to_string());
  |    ^^^

error: aborting due to previous error
```

Fix #27593.
Diffstat (limited to 'src/test/run-pass/thinlto')
0 files changed, 0 insertions, 0 deletions