Skip to content

#[deny(warnings) isn't working on E0170 #67933

Closed
@GuillaumeGomez

Description

@GuillaumeGomez

This code compiles without errors:

#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(unreachable_patterns)]
#![allow(dead_code)]
#![deny(warnings)]

enum Foo {
    Bar,
    Baz,
}

fn fn1(e: Foo) {
    match e {
        Bar => {},
        Baz => {},
    }
}

fn main() {}

With the following output:

Compiling playground v0.0.1 (/playground)
warning[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo`
  --> src/main.rs:14:9
   |
14 |         Bar => {},
   |         ^^^ help: to match on the variant, qualify the path: `Foo::Bar`

warning[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo`
  --> src/main.rs:16:9
   |
16 |         Baz => {},
   |         ^^^ help: to match on the variant, qualify the path: `Foo::Baz`

    Finished dev [unoptimized + debuginfo] target(s) in 0.37s
     Running `target/debug/playground`

However, the #[deny(warnings)] should make it fail.

Metadata

Metadata

Assignees

Labels

A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.P-mediumMedium priorityT-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