Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 4 compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust
/// ```rust,compile_fail
/// let x = 42.0;
///
/// match x {
Expand Down Expand Up @@ -1717,7 +1717,7 @@ declare_lint! {
/// [match guard]: https://doc.rust-lang.org/reference/expressions/match-expr.html#match-guards
/// [future-incompatible]: ../index.md#future-incompatible-lints
pub ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
Warn,
Deny,
"floating-point literals cannot be used in patterns",
@future_incompatible = FutureIncompatibleInfo {
reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>",
Expand Down
16 changes: 8 additions & 8 deletions 16 src/test/ui/deduplicate-diagnostics-2.deduplicate.stderr
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
warning: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:7:9
error: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:6:9
|
LL | 1.0 => {}
| ^^^
|
= note: `#[warn(illegal_floating_point_literal_pattern)]` on by default
= note: `#[deny(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
--> $DIR/deduplicate-diagnostics-2.rs:11:9
error: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:10:9
|
LL | 2.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: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:7:9
error: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:6:9
|
LL | 1.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: 3 warnings emitted
error: aborting due to 3 previous errors

20 changes: 10 additions & 10 deletions 20 src/test/ui/deduplicate-diagnostics-2.duplicate.stderr
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
warning: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:7:9
error: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:6:9
|
LL | 1.0 => {}
| ^^^
|
= note: `#[warn(illegal_floating_point_literal_pattern)]` on by default
= note: `#[deny(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
--> $DIR/deduplicate-diagnostics-2.rs:11:9
error: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:10:9
|
LL | 2.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: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:7:9
error: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:6:9
|
LL | 1.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: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:11:9
error: floating-point types cannot be used in patterns
--> $DIR/deduplicate-diagnostics-2.rs:10:9
|
LL | 2.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: 4 warnings emitted
error: aborting due to 4 previous errors

9 changes: 4 additions & 5 deletions 9 src/test/ui/deduplicate-diagnostics-2.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// build-pass
// revisions: duplicate deduplicate
//[deduplicate] compile-flags: -Z deduplicate-diagnostics=yes

fn main() {
match 0.0 {
1.0 => {} //~ WARNING floating-point types cannot be used in patterns
1.0 => {} //~ ERROR floating-point types cannot be used in patterns
//~| WARNING this was previously accepted
//~| WARNING floating-point types cannot be used in patterns
//~| ERROR floating-point types cannot be used in patterns
//~| WARNING this was previously accepted
2.0 => {} //~ WARNING floating-point types cannot be used in patterns
2.0 => {} //~ ERROR floating-point types cannot be used in patterns
//~| WARNING this was previously accepted
//[duplicate]~| WARNING floating-point types cannot be used in patterns
//[duplicate]~| ERROR floating-point types cannot be used in patterns
//[duplicate]~| WARNING this was previously accepted
_ => {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ fn main() {
let x = 0.0;
match x {
f32::INFINITY => { }
//~^ WARNING floating-point types cannot be used in patterns
//~^ ERROR floating-point types cannot be used in patterns
//~| WARNING will become a hard error in a future release
//~| WARNING floating-point types cannot be used in patterns
//~| ERROR floating-point types cannot be used in patterns
//~| WARNING this was previously accepted by the compiler but is being phased out
_ => { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated wit
LL | FOO => { }
| ^^^

warning: floating-point types cannot be used in patterns
error: floating-point types cannot be used in patterns
--> $DIR/match-forbidden-without-eq.rs:18:9
|
LL | f32::INFINITY => { }
| ^^^^^^^^^^^^^
|
= note: `#[warn(illegal_floating_point_literal_pattern)]` on by default
= note: `#[deny(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
error: floating-point types cannot be used in patterns
--> $DIR/match-forbidden-without-eq.rs:18:9
|
LL | f32::INFINITY => { }
Expand All @@ -23,5 +23,5 @@ LL | f32::INFINITY => { }
= 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>

error: aborting due to previous error; 2 warnings emitted
error: aborting due to 3 previous errors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.