Auto merge of #30084 - oli-obk:const_fn, r=pnkfelix

This commit is contained in:
bors 2015-12-04 17:47:18 +00:00
commit 68c15be8b5
5 changed files with 56 additions and 29 deletions

View file

@ -14,7 +14,7 @@
struct S(i32);
const CONSTANT: S = S(0);
//~^ ERROR: constant evaluation error: non-constant path in constant expression [E0080]
//~^ ERROR: constant evaluation error: call on struct [E0080]
enum E {
V = CONSTANT,

View file

@ -17,5 +17,6 @@ extern crate const_fn_lib;
use const_fn_lib::foo;
fn main() {
let x: [usize; foo()] = []; //~ ERROR non-constant path in constant expr
let x: [usize; foo()] = [];
//~^ ERROR unimplemented constant expression: calling non-local const fn [E0250]
}

View file

@ -22,4 +22,5 @@ const FOO: Foo = Foo::new();
pub fn main() {
assert_eq!(FOO.value, 22);
let _: [&'static str; Foo::new().value as usize] = ["hey"; 22];
}

View file

@ -29,4 +29,5 @@ fn main() {
assert_eq!(DIFF, 22);
let _: [&'static str; sub(100, 99) as usize] = ["hi"];
}