diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2017-03-11 11:11:50 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2017-03-11 14:28:29 -0800 |
| commit | 6ba494b68bede3bd8d1288f53137c8895260bec7 (patch) | |
| tree | 728a1025b58b91fe6dbd443e1ef2abf655427ef9 /src/test/run-pass/thinlto | |
| parent | f573db4f80c75f156df8a743f456bf087ec81dc2 (diff) | |
| download | rust-6ba494b68bede3bd8d1288f53137c8895260bec7.tar.gz rust-6ba494b68bede3bd8d1288f53137c8895260bec7.zip | |
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
```
Diffstat (limited to 'src/test/run-pass/thinlto')
0 files changed, 0 insertions, 0 deletions
