From f0fb9d2aa616d641946fed490ecebe1505104dfe Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Tue, 2 Jun 2020 00:23:47 +0200 Subject: normalize adt fields during structural match check --- src/test/ui/match/issue-72896.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/ui/match/issue-72896.rs (limited to 'src/test') diff --git a/src/test/ui/match/issue-72896.rs b/src/test/ui/match/issue-72896.rs new file mode 100644 index 00000000000..3a8b8203731 --- /dev/null +++ b/src/test/ui/match/issue-72896.rs @@ -0,0 +1,23 @@ +// run-pass +trait EnumSetType { + type Repr; +} + +enum Enum8 { } +impl EnumSetType for Enum8 { + type Repr = u8; +} + +#[derive(PartialEq, Eq)] +struct EnumSet { + __enumset_underlying: T::Repr, +} + +const CONST_SET: EnumSet = EnumSet { __enumset_underlying: 3 }; + +fn main() { + match CONST_SET { + CONST_SET => { /* ok */ } + _ => panic!("match fell through?"), + } +} -- cgit 1.4.1-3-g733a5