2017-03-26 19:35:46 +03:00
|
|
|
struct Foo {
|
|
|
|
pub v: Vec<String>
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let f = Foo { v: Vec::new() };
|
2017-11-20 13:13:27 +01:00
|
|
|
f.v.push("cat".to_string()); //~ ERROR cannot borrow
|
2017-03-26 19:35:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct S {
|
|
|
|
x: i32,
|
|
|
|
}
|
|
|
|
fn foo() {
|
|
|
|
let s = S { x: 42 };
|
2017-11-20 13:13:27 +01:00
|
|
|
s.x += 1; //~ ERROR cannot assign
|
2017-03-26 19:35:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn bar(s: S) {
|
2017-11-20 13:13:27 +01:00
|
|
|
s.x += 1; //~ ERROR cannot assign
|
2017-03-26 19:35:46 +03:00
|
|
|
}
|