-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticA-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-future-incompatibilityCategory: Future-incompatibility lintsCategory: Future-incompatibility lintsT-langRelevant to the language teamRelevant to the language team
Description
This is a tracking issue for the compatibility lint disallowing floating point literals in patterns.
The corresponding RFC is RFC 1445. Originally, #36890 was the only tracking issue for floats in patterns, but after it was found out that the implementation of that lint doesn't cover literals (issue #41255), another lint and tracking issue were required.
The goal of this lint is to make code like this a hard error:
fn main() {
let x = 13.4;
match x {
1.0 => println!("one"),
22.4 => println!("two"),
3.67 => println!("three"),
13.4 => println!("thirteen point four"),
_ => println!("anything"),
}
}
- PR Implement the illegal_floating_point_literal_pattern compat lint #41293 introduces the lint as warn by default
- PR xxxx makes the lint deny by default
- PR xxxx makes the lint a hard error
Devlyn-Nelson
Metadata
Metadata
Assignees
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticA-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-future-incompatibilityCategory: Future-incompatibility lintsCategory: Future-incompatibility lintsT-langRelevant to the language teamRelevant to the language team
Type
Projects
Status
Idea