Skip to content

unused_labels lint does not ignore '_label #66382

Closed

Description

This code

#![warn(unused_labels)]

fn main() {
    '_unused: loop {
        println!("hello world");
        break;
    }
}

yields this message

warning: unused label
 --> src/main.rs:4:5
  |
4 |     '_unused: loop {
  |     ^^^^^^^^
  |
note: lint level defined here
 --> src/main.rs:1:9
  |
1 | #![warn(unused_labels)]
  |         ^^^^^^^^^^^^^

I think this is not intended behavior: labels beginning with _ should be ignored by this lint, just as identifiers beginning with _ are ignored by similar lints in other contexts.

Right now I think this blocks Issue #66325, since we wouldn't want to start warn-by-default until it is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions