]>
Commit | Line | Data |
---|---|---|
e1599b0c | 1 | // compile-flags: -Zunleash-the-miri-inside-of-you |
dfeec247 | 2 | |
dfeec247 XL |
3 | fn double(x: usize) -> usize { |
4 | x * 2 | |
5 | } | |
e1599b0c XL |
6 | const X: fn(usize) -> usize = double; |
7 | ||
8 | const fn bar(x: fn(usize) -> usize, y: usize) -> usize { | |
f9f354fc | 9 | x(y) |
2b03887a FG |
10 | //~^ ERROR evaluation of constant value failed |
11 | //~| ERROR evaluation of constant value failed | |
e1599b0c XL |
12 | } |
13 | ||
14 | const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday | |
15 | const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday | |
16 | ||
17 | fn main() { | |
18 | assert_eq!(Y, 4); | |
e1599b0c | 19 | assert_eq!(Z, 4); |
e1599b0c | 20 | } |