Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple_unsafe_ops_per_block false positive when future is awaited inside unsafe block #13879

Open
MolotovCherry opened this issue Dec 26, 2024 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@MolotovCherry
Copy link

MolotovCherry commented Dec 26, 2024

Summary

multiple_unsafe_ops_per_block lint complains about multiple unsafe op calls if future is awaited inside unsafe block

That is, the following code complains about 2 unsafe ops in the unsafe block containing the await, despite there being no visible unsafety in user code

let fut = foo();
unsafe { fut.await; } 

Reproducer

#![warn(clippy::multiple_unsafe_ops_per_block)]

async fn foo() {}
    
async fn bar() {
  let fut = foo();
  unsafe { fut.await; } 
}

Version

Reproduced in rust playground

clippy 0.1.83 (2024-11-26 90b35a6)
rustc 1.85.0-nightly (2024-12-24 409998c4e8cae45344fd)

Additional Labels

No response

@MolotovCherry MolotovCherry added the C-bug Category: Clippy is not doing the correct thing label Dec 26, 2024
@MolotovCherry MolotovCherry changed the title multiple_unsafe_ops_per_block complains about multiple unsafe ops in unsafe block when future is awaited inside unsafe block multiple_unsafe_ops_per_block false positive when future is awaited inside unsafe block Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

1 participant