Skip to content

Revive test in enum_clike_unportable_variant #5107

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

Merged
merged 1 commit into from
Jan 30, 2020
Merged
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
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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<T: Trait> {
X = Trait::Number,
enum NonPortable2 {
X = <usize as Trait>::Number,
Y = 0,
}

trait Trait {
const Number: usize = 0x1_0000_0000;
}
*/

impl Trait for usize {}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
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,
| ^^^^^^^^^^^^^^^^^
|
= 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 = <usize as Trait>::Number,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 9 previous errors