2019-09-21 09:09:38 -05:00
|
|
|
// compile-flags: -Zunleash-the-miri-inside-of-you
|
2019-12-13 21:28:32 -06:00
|
|
|
|
2020-01-08 14:31:08 -06:00
|
|
|
fn double(x: usize) -> usize {
|
|
|
|
x * 2
|
|
|
|
}
|
2019-09-20 11:39:13 -05:00
|
|
|
const X: fn(usize) -> usize = double;
|
|
|
|
|
2020-05-03 07:23:08 -05:00
|
|
|
const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
|
2020-04-29 02:53:22 -05:00
|
|
|
x(y)
|
2022-09-21 06:05:20 -05:00
|
|
|
//~^ ERROR evaluation of constant value failed
|
|
|
|
//~| ERROR evaluation of constant value failed
|
2019-09-20 11:39:13 -05:00
|
|
|
}
|
|
|
|
|
2019-09-21 09:09:38 -05:00
|
|
|
const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday
|
|
|
|
const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday
|
2019-09-20 11:39:13 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(Y, 4);
|
|
|
|
assert_eq!(Z, 4);
|
|
|
|
}
|