You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The #[must_use] annotation is missing on Lock::try_lock #1133
#[must_use = "the lock unlocks immediately when the guard is unused"]
pubstructGuard<'a,T: ?Sized,B:Backend>{
This means that trying to use Lock::lock without using the return value will result in a warning. However, this warning does not happen with Lock::try_lock, since it returns an Option<Guard<...>> and the Option type is not #[must_use].
To fix this, add a #[must_use] annotation to Lock::try_lock directly.
This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a Suggested-by: tag and a Link: tag to this issue. Please see https://rust-for-linux.com/contributing for details.
Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.
Activity
ZhenyuC-Dev commentedon Dec 7, 2024
I'm new to the kernel development and rust also. Can I take this one?
ojeda commentedon Dec 7, 2024
Of course, please go ahead!
rust: sync: add #[must_use] to Lock::try_lock
hz2 commentedon Dec 8, 2024
@BorisChenCZY apologizes for not seeing this before submitting the patch, i'm also new to kernel development and would enjoy working on this with you.
i can try to cc you on the current mailing list thread for this patch if you're not already on the mailing list?
rust: sync: add #[must_use] to Lock::try_lock
rust: sync: add #[must_use] to Lock::try_lock
ZhenyuC-Dev commentedon Dec 9, 2024
hz2 commentedon Dec 9, 2024
@BorisChenCZY cc'd you into the email chain for the patch, also can find the in the archive
rust: sync: add #[must_use] to Lock::try_lock
rust: sync: add #[must_use] to Lock::try_lock
rust: sync: add #[must_use] to Lock::try_lock
rust: sync: Add #[must_use] to Lock::try_lock()