2024-02-16 20:02:50 +00:00
|
|
|
//@ edition:2018
|
2022-01-22 15:35:09 -08:00
|
|
|
struct S {
|
|
|
|
|
foo: usize,
|
|
|
|
|
}
|
|
|
|
|
impl S {
|
|
|
|
|
async fn bar(&self) { //~ HELP consider changing this to be a mutable reference
|
2025-01-28 19:35:31 +00:00
|
|
|
//~| SUGGESTION mut
|
2022-01-22 15:35:09 -08:00
|
|
|
self.foo += 1; //~ ERROR cannot assign to `self.foo`, which is behind a `&` reference [E0594]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
S { foo: 1 }.bar();
|
|
|
|
|
}
|