Skip to content

Commit 7f23bb0

Browse files
committed
add codegen test for rust-lang#112509
1 parent ddad7fc commit 7f23bb0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ compile-flags: -O
2+
//@ min-llvm-version: 17
3+
#![crate_type = "lib"]
4+
5+
// CHECK-LABEL: @write_u8_variant_a
6+
// CHECK: getelementptr
7+
// CHECK-NEXT: icmp ugt
8+
#[no_mangle]
9+
pub fn write_u8_variant_a(
10+
bytes: &mut [u8],
11+
buf: u8,
12+
offset: usize,
13+
) -> Option<&mut [u8]> {
14+
let buf = buf.to_le_bytes();
15+
bytes
16+
.get_mut(offset..).and_then(|bytes| bytes.get_mut(..buf.len()))
17+
}

0 commit comments

Comments
 (0)