From ed6a0cc8a1f04228e7eed0fb0a80307a67de4283 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 30 Jan 2020 11:43:19 +0900 Subject: [PATCH] Revive test in `enum_clike_unportable_variant` --- ...ke.rs => enum_clike_unportable_variant.rs} | 13 +++++----- ...r => enum_clike_unportable_variant.stderr} | 24 ++++++++++++------- 2 files changed, 21 insertions(+), 16 deletions(-) rename tests/ui/{enums_clike.rs => enum_clike_unportable_variant.rs} (78%) rename tests/ui/{enums_clike.stderr => enum_clike_unportable_variant.stderr} (64%) diff --git a/tests/ui/enums_clike.rs b/tests/ui/enum_clike_unportable_variant.rs similarity index 78% rename from tests/ui/enums_clike.rs rename to tests/ui/enum_clike_unportable_variant.rs index 789542b1351..7379ad99f4a 100644 --- a/tests/ui/enums_clike.rs +++ b/tests/ui/enum_clike_unportable_variant.rs @@ -1,7 +1,7 @@ // ignore-x86 -#![warn(clippy::all)] -#![allow(unused)] +#![warn(clippy::enum_clike_unportable_variant)] +#![allow(unused, non_upper_case_globals)] #[repr(usize)] enum NonPortable { @@ -35,17 +35,16 @@ enum NonPortableSignedNoHint { A = 0x1_0000_0000, } -/* -FIXME: uncomment once https://github.com/rust-lang/rust/issues/31910 is fixed #[repr(usize)] -enum NonPortable2 { - X = Trait::Number, +enum NonPortable2 { + X = ::Number, Y = 0, } trait Trait { const Number: usize = 0x1_0000_0000; } -*/ + +impl Trait for usize {} fn main() {} diff --git a/tests/ui/enums_clike.stderr b/tests/ui/enum_clike_unportable_variant.stderr similarity index 64% rename from tests/ui/enums_clike.stderr rename to tests/ui/enum_clike_unportable_variant.stderr index c3390405094..bd729683e4c 100644 --- a/tests/ui/enums_clike.stderr +++ b/tests/ui/enum_clike_unportable_variant.stderr @@ -1,5 +1,5 @@ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:8:5 + --> $DIR/enum_clike_unportable_variant.rs:8:5 | LL | X = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ @@ -7,46 +7,52 @@ LL | X = 0x1_0000_0000, = note: `-D clippy::enum-clike-unportable-variant` implied by `-D warnings` error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:15:5 + --> $DIR/enum_clike_unportable_variant.rs:15:5 | LL | X = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:18:5 + --> $DIR/enum_clike_unportable_variant.rs:18:5 | LL | A = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:25:5 + --> $DIR/enum_clike_unportable_variant.rs:25:5 | LL | Z = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:26:5 + --> $DIR/enum_clike_unportable_variant.rs:26:5 | LL | A = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:28:5 + --> $DIR/enum_clike_unportable_variant.rs:28:5 | LL | C = (std::i32::MIN as isize) - 1, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:34:5 + --> $DIR/enum_clike_unportable_variant.rs:34:5 | LL | Z = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:35:5 + --> $DIR/enum_clike_unportable_variant.rs:35:5 | LL | A = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors +error: Clike enum variant discriminant is not portable to 32-bit targets + --> $DIR/enum_clike_unportable_variant.rs:40:5 + | +LL | X = ::Number, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors