Skip to content

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

Closed

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.

Activity

  1. oli-obk commented on May 15, 2017

    @oli-obk
    Contributor

    related: #34596

  2. added
    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
    on Jun 22, 2017
  3. Enselic commented on Sep 27, 2023

    @Enselic
    Member

    Triage: This was discussed by the language team here , and it was decided that the current behavior should be kept, but that the documentation should be updated to clarify the situation.

    The documentation was updated in this PR. After some iteration over the years, we now have this wording:

    Lint Group: warnings - All lints that are set to issue warnings

    That makes the current behavior match the docs, so let's close as fixed.

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

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