Closed
Description
struct S {}
fn f(ctx: &mut S) -> String {
ctx.sleep = 0;
}
error[E0609]: no field `sleep` on type `&mut S`
--> src/lib.rs:4:9
|
4 | ctx.sleep = 0;
| ^^^^^ unknown field
error[E0308]: mismatched types
--> src/lib.rs:3:22
|
3 | fn f(ctx: &mut S) -> String {
| - ^^^^^^ expected struct `std::string::String`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
4 | ctx.sleep = 0;
| - help: consider removing this semicolon
Both of these errors are correct, but the second one should not suggest to remove the semicolon, since that won't fix anything here.