]> git.lizzy.rs Git - rust.git/blob - tests/ui/did_you_mean/issue-35937.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / did_you_mean / issue-35937.rs
1 struct Foo {
2     pub v: Vec<String>
3 }
4
5 fn main() {
6     let f = Foo { v: Vec::new() };
7     f.v.push("cat".to_string()); //~ ERROR cannot borrow
8 }
9
10
11 struct S {
12     x: i32,
13 }
14 fn foo() {
15     let s = S { x: 42 };
16     s.x += 1; //~ ERROR cannot assign
17 }
18
19 fn bar(s: S) {
20     s.x += 1; //~ ERROR cannot assign
21 }