rust/tests/ui/did_you_mean/issue-38147-2.rs
2023-01-11 09:32:08 +00:00

18 lines
455 B
Rust

struct Bar<'a> {
s: &'a String,
// use wonky spaces to ensure we are creating the span correctly
longer_name: & 'a Vec<u8>
}
impl<'a> Bar<'a> {
fn f(&mut self) {
self.s.push('x');
//~^ ERROR cannot borrow `*self.s` as mutable, as it is behind a `&` reference
self.longer_name.push(13);
//~^ ERROR cannot borrow `*self.longer_name` as mutable, as it is behind a `&` reference
}
}
fn main() {}