Closed
Description
I would expect this program to print true
. As of rustc 1.30.0-nightly (33b923f 2018-08-18) it prints false
. If you change const fn
to fn
then it prints true
as expected.
#![feature(const_fn, const_let)]
const fn id(condition: bool) -> bool {
let mut ret = true;
// If condition is true, we short circuit and ret remains true.
// If condition is false, we assign ret = false.
let _ = condition || { ret = false; true };
ret
}
fn main() {
println!("{}", id(true));
}
Mentioning @oli-obk.
Mentioning const_let tracking issue #48821.