Skip to content

Commit 60168a7

Browse files
committed
Power-of-two int tests
Most of the tests had to be deleted; the various power_of_two functions use `intrinsics::ctlz_nonzero` internally, so they can't be made const before rust-lang#66275 is merged.
1 parent 9aa0a1f commit 60168a7

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

src/test/ui/consts/const-int-pow-rpass.rs

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,11 @@
55
const IS_POWER_OF_TWO_A: bool = 0u32.is_power_of_two();
66
const IS_POWER_OF_TWO_B: bool = 32u32.is_power_of_two();
77
const IS_POWER_OF_TWO_C: bool = 33u32.is_power_of_two();
8-
9-
const NEXT_POWER_OF_TWO_A: u32 = 0u32.next_power_of_two();
10-
const NEXT_POWER_OF_TWO_B: u8 = 2u8.next_power_of_two();
11-
const NEXT_POWER_OF_TWO_C: u8 = 3u8.next_power_of_two();
12-
const NEXT_POWER_OF_TWO_D: u8 = 127u8.next_power_of_two();
13-
14-
const CHECKED_NEXT_POWER_OF_TWO_A: Option<u32> = 0u32.checked_next_power_of_two();
15-
const CHECKED_NEXT_POWER_OF_TWO_B: Option<u8> = 2u8.checked_next_power_of_two();
16-
const CHECKED_NEXT_POWER_OF_TWO_C: Option<u8> = 3u8.checked_next_power_of_two();
17-
const CHECKED_NEXT_POWER_OF_TWO_D: Option<u8> = 127u8.checked_next_power_of_two();
18-
const CHECKED_NEXT_POWER_OF_TWO_E: Option<u8> = 129u8.checked_next_power_of_two();
19-
20-
const WRAPPING_NEXT_POWER_OF_TWO_A: u32 = 0u32.wrapping_next_power_of_two();
21-
const WRAPPING_NEXT_POWER_OF_TWO_B: u8 = 2u8.wrapping_next_power_of_two();
22-
const WRAPPING_NEXT_POWER_OF_TWO_C: u8 = 3u8.wrapping_next_power_of_two();
23-
const WRAPPING_NEXT_POWER_OF_TWO_D: u8 = 127u8.wrapping_next_power_of_two();
24-
const WRAPPING_NEXT_POWER_OF_TWO_E: u8 = u8::max_value().wrapping_next_power_of_two();
8+
const IS_POWER_OF_TWO_D: bool = 3u8.is_power_of_two();
259

2610
fn main() {
2711
assert!(!IS_POWER_OF_TWO_A);
2812
assert!(IS_POWER_OF_TWO_B);
2913
assert!(!IS_POWER_OF_TWO_C);
30-
31-
assert_eq!(NEXT_POWER_OF_TWO_A, 2);
32-
assert_eq!(NEXT_POWER_OF_TWO_B, 2);
33-
assert_eq!(NEXT_POWER_OF_TWO_C, 4);
34-
assert_eq!(NEXT_POWER_OF_TWO_D, 128);
35-
36-
assert_eq!(CHECKED_NEXT_POWER_OF_TWO_A, Some(2));
37-
assert_eq!(CHECKED_NEXT_POWER_OF_TWO_B, Some(2));
38-
assert_eq!(CHECKED_NEXT_POWER_OF_TWO_C, Some(4));
39-
assert_eq!(CHECKED_NEXT_POWER_OF_TWO_D, Some(128));
40-
assert_eq!(CHECKED_NEXT_POWER_OF_TWO_E, None);
41-
42-
assert_eq!(WRAPPING_NEXT_POWER_OF_TWO_A, 2);
43-
assert_eq!(WRAPPING_NEXT_POWER_OF_TWO_B, 2);
44-
assert_eq!(WRAPPING_NEXT_POWER_OF_TWO_C, 4);
45-
assert_eq!(WRAPPING_NEXT_POWER_OF_TWO_D, 128);
46-
assert_eq!(WRAPPING_NEXT_POWER_OF_TWO_E, 0);
14+
assert!(!IS_POWER_OF_TWO_D);
4715
}

0 commit comments

Comments
 (0)