Skip to content

Cannot add an exception to #[deny(lint group)] with #[warn(specific lint)] #41941

Closed
@SimonSapin

Description

@SimonSapin

Test case:

#![deny(warnings)]
#![warn(illegal_floating_point_literal_pattern)]

fn main() {
    if let 0.0 = 1.0 {}
}

Expected result: compiles with a warning.

Actual result with rustc 1.19.0-nightly (978d2cf 2017-05-10): hard error:

error: floating-point literals cannot be used in patterns
 --> a.rs:5:12
  |
5 |     if let 0.0 = 1.0 {}
  |            ^^^
  |
  = note: #[deny(illegal_floating_point_literal_pattern)] implied by #[deny(warnings)]
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
note: lint level defined here
 --> a.rs:1:9
  |
1 | #![deny(warnings)]
  |         ^^^^^^^^

ERROR:rustc_lint::builtin: span mc spanspam
error: aborting due to previous error

Note that allow can add an exception, but of course it makes the warning not be shown at all:

#![deny(warnings)]
#![allow(illegal_floating_point_literal_pattern)]

fn main() {
    if let 0.0 = 1.0 {}
}

Context: I wanted to use this to unblock compiling Servo without completely hiding the problem under a metaphorical carpet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions