Playground Link
When while is used in a const fn on stable, it produces an error message: `if`, `match`, `&&` and `||` are not stable in const fn. This is a bit confusing because the function does not explicitly contain if, match, &&, or ||.
I would expect the error message to also mention that while is disallowed, or say that "loops are not allowed in const fn" (which it does when loop {} construct is encountered).
(It seems like it would be even better to have a specific error message for the disallowed construct that the compiler encounters rather than just providing a list of disallowed constructs, if this is possible architecturally.)
rustc version
rustc 1.35.0 (3c235d560 2019-05-20)
binary: rustc
commit-hash: 3c235d5600393dfe6c36eeed34042efad8d4f26e
commit-date: 2019-05-20
host: x86_64-apple-darwin
release: 1.35.0
LLVM version: 8.0
Playground Link
When
whileis used in aconst fnon stable, it produces an error message:`if`, `match`, `&&` and `||` are not stable in const fn. This is a bit confusing because the function does not explicitly containif,match,&&, or||.I would expect the error message to also mention that
whileis disallowed, or say that "loops are not allowed in const fn" (which it does whenloop {}construct is encountered).(It seems like it would be even better to have a specific error message for the disallowed construct that the compiler encounters rather than just providing a list of disallowed constructs, if this is possible architecturally.)
rustc version