mirror of
https://github.com/rust-lang/rust
synced 2024-10-14 12:33:57 +00:00
add codegen test for #112509
This commit is contained in:
parent
f37c576dbd
commit
beabc5647b
17
tests/codegen/issues/issue-112509-slice-get-andthen-get.rs
Normal file
17
tests/codegen/issues/issue-112509-slice-get-andthen-get.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
//@ compile-flags: -O
|
||||
//@ min-llvm-version: 17
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK-LABEL: @write_u8_variant_a
|
||||
// CHECK: getelementptr
|
||||
// CHECK-NEXT: icmp ugt
|
||||
#[no_mangle]
|
||||
pub fn write_u8_variant_a(
|
||||
bytes: &mut [u8],
|
||||
buf: u8,
|
||||
offset: usize,
|
||||
) -> Option<&mut [u8]> {
|
||||
let buf = buf.to_le_bytes();
|
||||
bytes
|
||||
.get_mut(offset..).and_then(|bytes| bytes.get_mut(..buf.len()))
|
||||
}
|
Loading…
Reference in a new issue