From 08b9b97c5374f4a7523cbb189bbe0ab1ed80ed64 Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Tue, 28 Apr 2020 17:07:05 +0200 Subject: [PATCH] add test for repr(128) enum derives --- .../enum-discriminant/issue-70509-partial_eq.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/ui/enum-discriminant/issue-70509-partial_eq.rs diff --git a/src/test/ui/enum-discriminant/issue-70509-partial_eq.rs b/src/test/ui/enum-discriminant/issue-70509-partial_eq.rs new file mode 100644 index 0000000000000..e9c6104e3875a --- /dev/null +++ b/src/test/ui/enum-discriminant/issue-70509-partial_eq.rs @@ -0,0 +1,17 @@ +// run-pass +#![feature(repr128, arbitrary_enum_discriminant)] + +#[derive(PartialEq, Debug)] +#[repr(i128)] +enum Test { + A(Box) = 0, + B(usize) = u64::max_value() as i128 + 1, +} + +fn main() { + assert_ne!(Test::A(Box::new(2)), Test::B(0)); + // This previously caused a segfault. + // + // See https://github.com/rust-lang/rust/issues/70509#issuecomment-620654186 + // for a detailed explanation. +}