Skip to content

Compilation warning does not appear even if #[must_use] is used in a non-function. #93906

Closed
@Danue1

Description

@Danue1

I tried this code:

fn main() {
    #[must_use]
    {}
}

I expected to see this happen: Warning that it is unused.

Instead, this happened: Not warning.

Meta

rustc --version --verbose:

rustc 1.58.1 (db9d1b20b 2022-01-20)
binary: rustc
commit-hash: db9d1b20bba1968c1ec1fc49616d4742c1725b4b
commit-date: 2022-01-20
host: aarch64-apple-darwin
release: 1.58.1
LLVM version: 13.0.0

Metadata

Metadata

Labels

C-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions