Skip to content

error: non-binding let on a synchronization lock #71

Closed
@tjni

Description

@tjni

Due to a new lint in rust 1.65 introduced by rust-lang/rust#97739, there is a new compilation error:

error: non-binding let on a synchronization lock
   --> src/catfs/file.rs:570:13
    |
570 |         let _ = self.page_in_res.0.lock().unwrap();
    |             ^   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this binding will immediately drop the value assigned to it
    |             |
    |             this lock is not assigned to a binding and is immediately dropped
    |
    = note: `#[deny(let_underscore_lock)]` on by default
help: consider binding to an unused variable to avoid immediately dropping the value
    |
570 |         let _unused = self.page_in_res.0.lock().unwrap();
    |             ~~~~~~~
help: consider immediately dropping the value
    |
570 |         drop(self.page_in_res.0.lock().unwrap());
    |         ~~~~~                                  +

(Ignore the line numbers as they correspond to an older version, but I was able to verify it still occurs in v0.9.0 and the code triggering the error still exists.)

I was planning to fix this, but I can't figure out what the purpose of that line is. Is this mutex being used to gate access to more things than its internal data?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions