From d42677135d2a953d1c06b85ba2f45c9b58bd7d44 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Wed, 8 Jan 2020 23:16:57 +0300 Subject: [PATCH] Address review comments --- ...duplicate-diagnostics-2.deduplicate.stderr | 28 ++++++++++++++ ...deduplicate-diagnostics-2.duplicate.stderr | 37 +++++++++++++++++++ src/test/ui/deduplicate-diagnostics-2.rs | 17 +++++++++ ...deduplicate-diagnostics.deduplicate.stderr | 9 ++++- .../deduplicate-diagnostics.duplicate.stderr | 21 ++++++++++- src/test/ui/deduplicate-diagnostics.rs | 3 ++ 6 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 src/test/ui/deduplicate-diagnostics-2.deduplicate.stderr create mode 100644 src/test/ui/deduplicate-diagnostics-2.duplicate.stderr create mode 100644 src/test/ui/deduplicate-diagnostics-2.rs diff --git a/src/test/ui/deduplicate-diagnostics-2.deduplicate.stderr b/src/test/ui/deduplicate-diagnostics-2.deduplicate.stderr new file mode 100644 index 0000000000000..7a28c6428a355 --- /dev/null +++ b/src/test/ui/deduplicate-diagnostics-2.deduplicate.stderr @@ -0,0 +1,28 @@ +warning: floating-point types cannot be used in patterns + --> $DIR/deduplicate-diagnostics-2.rs:7:9 + | +LL | 1.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 + +warning: floating-point types cannot be used in patterns + --> $DIR/deduplicate-diagnostics-2.rs:11: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 + +warning: floating-point types cannot be used in patterns + --> $DIR/deduplicate-diagnostics-2.rs:7: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 + diff --git a/src/test/ui/deduplicate-diagnostics-2.duplicate.stderr b/src/test/ui/deduplicate-diagnostics-2.duplicate.stderr new file mode 100644 index 0000000000000..4fff3a8c0f374 --- /dev/null +++ b/src/test/ui/deduplicate-diagnostics-2.duplicate.stderr @@ -0,0 +1,37 @@ +warning: floating-point types cannot be used in patterns + --> $DIR/deduplicate-diagnostics-2.rs:7:9 + | +LL | 1.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 + +warning: floating-point types cannot be used in patterns + --> $DIR/deduplicate-diagnostics-2.rs:11: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 + +warning: floating-point types cannot be used in patterns + --> $DIR/deduplicate-diagnostics-2.rs:7: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 + +warning: floating-point types cannot be used in patterns + --> $DIR/deduplicate-diagnostics-2.rs:11: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 + diff --git a/src/test/ui/deduplicate-diagnostics-2.rs b/src/test/ui/deduplicate-diagnostics-2.rs new file mode 100644 index 0000000000000..f46a7c0c1c4d8 --- /dev/null +++ b/src/test/ui/deduplicate-diagnostics-2.rs @@ -0,0 +1,17 @@ +// 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 + //~| WARNING this was previously accepted + //~| WARNING floating-point types cannot be used in patterns + //~| WARNING this was previously accepted + 2.0 => {} //~ WARNING floating-point types cannot be used in patterns + //~| WARNING this was previously accepted + //[duplicate]~| WARNING floating-point types cannot be used in patterns + //[duplicate]~| WARNING this was previously accepted + _ => {} + } +} diff --git a/src/test/ui/deduplicate-diagnostics.deduplicate.stderr b/src/test/ui/deduplicate-diagnostics.deduplicate.stderr index 1acfce506229f..5df2c687bddc2 100644 --- a/src/test/ui/deduplicate-diagnostics.deduplicate.stderr +++ b/src/test/ui/deduplicate-diagnostics.deduplicate.stderr @@ -1,8 +1,15 @@ +error[E0452]: malformed lint attribute input + --> $DIR/deduplicate-diagnostics.rs:8:8 + | +LL | #[deny("literal")] + | ^^^^^^^^^ bad attribute argument + error: cannot find derive macro `Unresolved` in this scope --> $DIR/deduplicate-diagnostics.rs:4:10 | LL | #[derive(Unresolved)] | ^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0452`. diff --git a/src/test/ui/deduplicate-diagnostics.duplicate.stderr b/src/test/ui/deduplicate-diagnostics.duplicate.stderr index 325da3b5d915b..3b100b59995f0 100644 --- a/src/test/ui/deduplicate-diagnostics.duplicate.stderr +++ b/src/test/ui/deduplicate-diagnostics.duplicate.stderr @@ -1,3 +1,9 @@ +error[E0452]: malformed lint attribute input + --> $DIR/deduplicate-diagnostics.rs:8:8 + | +LL | #[deny("literal")] + | ^^^^^^^^^ bad attribute argument + error: cannot find derive macro `Unresolved` in this scope --> $DIR/deduplicate-diagnostics.rs:4:10 | @@ -10,5 +16,18 @@ error: cannot find derive macro `Unresolved` in this scope LL | #[derive(Unresolved)] | ^^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0452]: malformed lint attribute input + --> $DIR/deduplicate-diagnostics.rs:8:8 + | +LL | #[deny("literal")] + | ^^^^^^^^^ bad attribute argument + +error[E0452]: malformed lint attribute input + --> $DIR/deduplicate-diagnostics.rs:8:8 + | +LL | #[deny("literal")] + | ^^^^^^^^^ bad attribute argument + +error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0452`. diff --git a/src/test/ui/deduplicate-diagnostics.rs b/src/test/ui/deduplicate-diagnostics.rs index 90ed344c11a26..c5d41ff2fdac3 100644 --- a/src/test/ui/deduplicate-diagnostics.rs +++ b/src/test/ui/deduplicate-diagnostics.rs @@ -5,4 +5,7 @@ //[duplicate]~| ERROR cannot find derive macro `Unresolved` in this scope struct S; +#[deny("literal")] //~ ERROR malformed lint attribute input + //[duplicate]~| ERROR malformed lint attribute input + //[duplicate]~| ERROR malformed lint attribute input fn main() {}