mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-05 21:24:12 +00:00
18 lines
455 B
Rust
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() {}
|