Should `#[expect(warnings)]` at some point warn that there are no warnings in the annotated code?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
#[expect(warnings)]
pub fn foo() {}
Current output
rustc is happy with an expect annotation on code, that does not trigger a warning
Desired output
probably this should ask to remove the expect annotation?
Rationale and extra context
expect(warnings) is probably not the most idiomatic thing to do, but I found it in my code. And I would think that this behaves like other expect annotations.
Other cases
No response
Rust Version
rustc 1.83.0-nightly (f79a912d9 2024-09-18)
binary: rustc
commit-hash: f79a912d9edc3ad4db910c0e93672ed5c65133fa
commit-date: 2024-09-18
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0
Anything else?
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
Reproduce the annotated foo example with the reported nightly rustc version and compare its behavior with other #[expect(...)] annotations. Determine the intended handling for an expectation covering no warnings, then verify the chosen behavior with compiler tests; done means the behavior is specified and consistently tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100