mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
15 lines
321 B
Rust
15 lines
321 B
Rust
// edition:2018
|
|
struct S {
|
|
foo: usize,
|
|
}
|
|
impl S {
|
|
async fn bar(&self) { //~ HELP consider changing this to be a mutable reference
|
|
//~| SUGGESTION &mut self
|
|
self.foo += 1; //~ ERROR cannot assign to `self.foo`, which is behind a `&` reference [E0594]
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
S { foo: 1 }.bar();
|
|
}
|