allow const function calls in consts that are used in patterns

closes #30117
This commit is contained in:
Oliver Schneider 2015-12-01 17:37:01 +01:00 committed by Oliver 'ker' Schneider
parent d75f861518
commit d23800f3f2
2 changed files with 12 additions and 2 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -8,15 +8,20 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(const_fn)]
const FOO: isize = 10;
const BAR: isize = 3;
const fn foo() -> isize { 4 }
const BOO: isize = foo();
pub fn main() {
let x: isize = 3;
let y = match x {
FOO => 1,
BAR => 2,
BOO => 4,
_ => 3
};
assert_eq!(y, 2);