]> git.lizzy.rs Git - rust.git/blob - tests/ui/did_you_mean/issue-38147-2.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / did_you_mean / issue-38147-2.rs
1 struct Bar<'a> {
2     s: &'a String,
3     // use wonky spaces to ensure we are creating the span correctly
4     longer_name:   &   'a     Vec<u8>
5 }
6
7 impl<'a> Bar<'a> {
8     fn f(&mut self) {
9         self.s.push('x');
10         //~^ ERROR cannot borrow `*self.s` as mutable, as it is behind a `&` reference
11
12         self.longer_name.push(13);
13         //~^ ERROR cannot borrow `*self.longer_name` as mutable, as it is behind a `&` reference
14     }
15 }
16
17 fn main() {}