From f0c6a8ebe9091bcc03807060ea7c7394c67a734c Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Sun, 24 Feb 2013 14:48:34 -0800 Subject: [PATCH] Test for struct-like variants in consts --- src/test/run-pass/const-enum-structlike.rs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/run-pass/const-enum-structlike.rs diff --git a/src/test/run-pass/const-enum-structlike.rs b/src/test/run-pass/const-enum-structlike.rs new file mode 100644 index 00000000000..83d81740759 --- /dev/null +++ b/src/test/run-pass/const-enum-structlike.rs @@ -0,0 +1,23 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum E { + S0 { s: ~str }, + S1 { u: uint } +} + +const C: E = S1 { u: 23 }; + +fn main() { + match C { + S0 { _ } => fail!(), + S1 { u } => assert u == 23 + } +}