MCPcopy Create free account
hub / github.com/IntegralPilot/rustc_codegen_jvm / main

Function main

tests/binary/ops/src/main.rs:77–300  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75#[inline(never)]
76fn opaque_f128(value: f128) -> f128 {
77 value
78}
79
80#[inline(never)]
81fn runtime_needs_drop<T>() -> bool {
82 core::mem::needs_drop::<T>()
83}
84
85#[derive(Clone, Copy)]
86struct LookupPair(u8, u8);
87
88const fn build_lookup_table() -> [LookupPair; 256] {
89 let mut table = [LookupPair(0, 0); 256];
90 let mut index = 0;
91 while index < table.len() {
92 table[index] = LookupPair(index as u8, (index as u8).wrapping_mul(3));
93 index += 1;
94 }
95 table
96}
97
98const LOOKUP_TABLE: [LookupPair; 256] = build_lookup_table();
99
100#[inline(never)]
101fn read_large_constant(index: usize) -> (u8, u8) {
102 (LOOKUP_TABLE[index].0, LOOKUP_TABLE[index].1)
103}
104
105#[inline(never)]
106fn mutate_large_constant_copy(index: usize) -> u8 {
107 let mut table = LOOKUP_TABLE;
108 assert!(table[index].0 == index as u8);
109 table[index].0 = 211;
110 table[index].0
111}
112
113fn large_constant_value_semantics() {
114 assert!(read_large_constant(37) == (37, 111));
115 assert!(mutate_large_constant_copy(37) == 211);
116 assert!(mutate_large_constant_copy(37) == 211);
117 assert!(
118 read_large_constant(37) == (37, 111),
119 "a mutable constant copy must not modify a shared read-only table"
120 );
121}
122
123fn fixed_array_pattern_checks_every_element() {
124 let bytes = [0_u8, 0xae, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 1, 2, 3, 4];
125 assert!(!matches!(
126 bytes,
127 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, _, _, _, _]
128 ));
129 assert!(matches!(
130 bytes,
131 [0, 0xae, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 1, 2, 3, 4]
132 ));
133}
134

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected