Skip to content

unused_labels lint does not ignore '_label #66382

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
BartMassey opened this issue Nov 13, 2019 · 0 comments · Fixed by #66419
Closed

unused_labels lint does not ignore '_label #66382

BartMassey opened this issue Nov 13, 2019 · 0 comments · Fixed by #66419
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@BartMassey
Copy link
Contributor

BartMassey commented Nov 13, 2019

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.

@jonas-schievink jonas-schievink added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 13, 2019
JohnTitor added a commit to JohnTitor/rust that referenced this issue Nov 15, 2019
Don't warn labels beginning with `_` on unused_labels lint

Fixes rust-lang#66382

r? @varkor
JohnTitor added a commit to JohnTitor/rust that referenced this issue Nov 15, 2019
Don't warn labels beginning with `_` on unused_labels lint

Fixes rust-lang#66382

r? @varkor
@bors bors closed this as completed in 26eb909 Nov 15, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants