diff --git a/src/test/run-pass/const-enum-byref-self.rs b/src/test/run-pass/const-enum-byref-self.rs new file mode 100644 index 00000000000..cd939bc14d4 --- /dev/null +++ b/src/test/run-pass/const-enum-byref-self.rs @@ -0,0 +1,25 @@ +// 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 { V, VV(int) } +const C: E = V; + +impl E { + fn method(&self) { + match *self { + V => {} + VV(*) => fail + } + } +} + +fn main() { + C.method() +} diff --git a/src/test/run-pass/const-enum-byref.rs b/src/test/run-pass/const-enum-byref.rs new file mode 100644 index 00000000000..8ee9e79670b --- /dev/null +++ b/src/test/run-pass/const-enum-byref.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 { V, VV(int) } +const C: E = V; + +fn f(a: &E) { + match *a { + V => {} + VV(*) => fail + } +} + +fn main() { + f(&C) +}