-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-lintArea: New lintsArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.Call for participation: Medium difficulty level problem and requires some initial experience.T-ASTType: Requires working with the ASTType: Requires working with the AST
Description
We should lint labels that aren't used anywhere, as in
fn unused_label() {
'label: for i in 1..2 {
if i > 4 { continue }
}
}
To do this, we can use a Visitor to walk any FnDecl, collecting all used labels in a HashSet, then for all loops lint labels whose name isn't in the set. We also probably want to store the function's Block somewhere so we can clear the set in its check_block_post method – or perhaps I'll add another rustc PR with a check_fn_post method for both LintPasses.
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.Call for participation: Medium difficulty level problem and requires some initial experience.T-ASTType: Requires working with the ASTType: Requires working with the AST