Skip to content

Commit 94e8054

Browse files
committed
Enable const tests for bool methods
This change re-enables the const tests for bool::then_some and bool::then that were previously disabled with a FIXME comment referencing issue 110395. The tests verify that these methods work correctly in const contexts, which is important for compile-time evaluation. These tests check that both the eager evaluation variant (then_some) and lazy evaluation variant (then) can be used to create constant Option values at compile time. Tests added: - Const evaluation of false.then_some(0) returning None - Const evaluation of true.then_some(0) returning Some(0) - Const evaluation of false.then(zero) returning None - Const evaluation of true.then(zero) returning Some(0)
1 parent 8b6b15b commit 94e8054

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

library/coretests/tests/bool.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ fn test_bool_to_option() {
8989
assert_eq!(false.then(|| 0), None);
9090
assert_eq!(true.then(|| 0), Some(0));
9191

92-
/* FIXME(#110395)
9392
const fn zero() -> i32 {
9493
0
9594
}
@@ -103,7 +102,6 @@ fn test_bool_to_option() {
103102
assert_eq!(B, Some(0));
104103
assert_eq!(C, None);
105104
assert_eq!(D, Some(0));
106-
*/
107105
}
108106

109107
#[test]

0 commit comments

Comments
 (0)