Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Closed
SimonSapin opened this issue May 12, 2017 · 2 comments
Closed
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-feature-request Category: A feature request, i.e: not implemented / a PR.

Comments

@SimonSapin
Copy link
Contributor

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.

@oli-obk
Copy link
Contributor

oli-obk commented May 15, 2017

related: #34596

@Mark-Simulacrum Mark-Simulacrum added the A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. label Jun 22, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 27, 2017
@Enselic
Copy link
Member

Enselic commented Sep 27, 2023

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.

@Enselic Enselic closed this as completed Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-feature-request Category: A feature request, i.e: not implemented / a PR.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants