2019-12-13 21:28:32 -06:00
|
|
|
// build-fail
|
|
|
|
|
2018-05-11 07:33:37 -05:00
|
|
|
#![warn(const_err)]
|
2018-04-08 15:26:28 -05:00
|
|
|
|
2017-07-31 09:42:42 -05:00
|
|
|
const fn foo(x: u32) -> u32 {
|
|
|
|
x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2020-01-08 14:31:08 -06:00
|
|
|
const X: u32 = 0 - 1;
|
2018-08-26 08:19:34 -05:00
|
|
|
//~^ WARN any use of this value will cause
|
2021-01-30 07:49:22 -06:00
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
2020-01-08 14:31:08 -06:00
|
|
|
const Y: u32 = foo(0 - 1);
|
2018-08-26 08:19:34 -05:00
|
|
|
//~^ WARN any use of this value will cause
|
2021-01-30 07:49:22 -06:00
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
2017-07-31 09:42:42 -05:00
|
|
|
println!("{} {}", X, Y);
|
2021-01-24 05:50:30 -06:00
|
|
|
//~^ ERROR evaluation of constant value failed
|
|
|
|
//~| ERROR evaluation of constant value failed
|
2020-01-08 14:31:08 -06:00
|
|
|
//~| WARN erroneous constant used [const_err]
|
|
|
|
//~| WARN erroneous constant used [const_err]
|
2021-01-30 07:49:22 -06:00
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
2017-07-31 09:42:42 -05:00
|
|
|
}
|