Skip to content

Dead code lint shouldn't warn about #[static_assert] statics #14226

Closed
@huonw

Description

@huonw
#[static_assert]
static X: bool = true;

fn main() {}
static-assert.rs:2:1: 2:23 warning: code is never used: `X`, #[warn(dead_code)] on by default
static-assert.rs:2 static X: bool = true;
                   ^~~~~~~~~~~~~~~~~~~~~~

These might not be used directly in the rest of the code, but they are still serving a concrete purpose, i.e. they are being semantically used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions