Conditionals and loops now have unstable features, and `feature_err` has its own error code. I think that `feature_err` should take an error code as a parameter, but don't have the energy to make this change throughout the codebase. Also, the error code system may be torn out entirely.
683 B
683 B
Control-flow expressions are not allowed inside a const context.
At the moment, if and match, as well as the looping constructs for,
while, and loop, are forbidden inside a const, static, or const fn.
const _: i32 = {
let mut x = 0;
loop {
x += 1;
if x == 4 {
break;
}
}
x
};
This will be allowed at some point in the future, but the implementation is not yet complete. See the tracking issue for conditionals or loops in a const context for the current status.