rust-lang / rust-lang/rust-clippy
Manually allow `clippy::await_holding_invalid_type`
Open
Nobody has claimed this yet.
C-bug
good first issue
I-false-negative
I-false-positive
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Description
I've designed a struct that can't across the pending point for some specified api. So I deny clippy::await_holding_invalid_type but manually allow the this lint in some cases. But it seems doesn't work.
#![deny(clippy::await_holding_invalid_type)]
struct A {} // invalid type
struct B;
async fn do_a(_a: &mut A) -> B {
B
}
#[tokio::main]
async fn main() {
let _v = {
#[allow(clippy::await_holding_invalid_type)] // doesn't work.
let mut _a = A {};
#[allow(clippy::await_holding_invalid_type)] // doesn't work.
let b = &mut _a;
#[allow(clippy::await_holding_invalid_type)] // doesn't work.
do_a(b).await
};
}
Version
rustc 1.84.0-nightly (439284741 2024-10-21)
binary: rustc
commit-hash: 4392847410ddd67f6734dd9845f9742ff9e85c83
commit-date: 2024-10-21
host: x86_64-apple-darwin
release: 1.84.0-nightly
LLVM version: 19.1.1
Additional Labels
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Rust example with Clippy's deny and allow attributes on await_holding_invalid_type. No source file or test is named; trace how this lint handles the shown bindings and attribute scopes, then verify the intended suppression behavior with a focused regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100