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

illegal_floating_point_literal_pattern warns twice #86600

Closed
rylev opened this issue Jun 24, 2021 · 0 comments · Fixed by #86888
Closed

illegal_floating_point_literal_pattern warns twice #86600

rylev opened this issue Jun 24, 2021 · 0 comments · Fixed by #86888
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. C-future-incompatibility Category: Future-incompatibility lints

Comments

@rylev
Copy link
Member

rylev commented Jun 24, 2021

With the following code (playground):

fn main() {
    let x = 42.0;

    match x {
        5.0 => {}
        _ => {}
    }
}

I expected to see one warning.

Instead, this happened:

warning: floating-point types cannot be used in patterns
 --> src/main.rs:5:9
  |
5 |         5.0 => {}
  |         ^^^
  |
  = note: `#[warn(illegal_floating_point_literal_pattern)]` on by default
  = 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>

warning: floating-point types cannot be used in patterns
 --> src/main.rs:5:9
  |
5 |         5.0 => {}
  |         ^^^
  |
  = 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>

warning: 2 warnings emitted

Meta

1.55.0-nightly

(2021-06-23 5a7834050f3a0ebcd117)
@rylev rylev added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-future-incompatibility Category: Future-incompatibility lints C-bug Category: This is a bug. labels Jun 24, 2021
@bors bors closed this as completed in e916b7c Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. C-future-incompatibility Category: Future-incompatibility lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant