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