1
Fork 0

Use generic NonZero in tests.

This commit is contained in:
Markus Reiter 2024-02-22 14:59:52 +01:00
parent 710048f790
commit b2fbb8a053
No known key found for this signature in database
GPG key ID: 245293B51702655B
43 changed files with 519 additions and 516 deletions

View file

@ -1,9 +1,9 @@
//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0
#![crate_type = "lib"]
#![feature(generic_nonzero)]
use std::mem::MaybeUninit;
use std::num::NonZeroU16;
use std::num::NonZero;
pub struct Bytes {
a: u8,
@ -99,14 +99,14 @@ pub fn load_int(x: &u16) -> u16 {
// CHECK-LABEL: @load_nonzero_int
#[no_mangle]
pub fn load_nonzero_int(x: &NonZeroU16) -> NonZeroU16 {
pub fn load_nonzero_int(x: &NonZero<u16>) -> NonZero<u16> {
// CHECK: load i16, ptr %x, align 2, !range ![[NONZEROU16_RANGE:[0-9]+]], !noundef !{{[0-9]+}}
*x
}
// CHECK-LABEL: @load_option_nonzero_int
#[no_mangle]
pub fn load_option_nonzero_int(x: &Option<NonZeroU16>) -> Option<NonZeroU16> {
pub fn load_option_nonzero_int(x: &Option<NonZero<u16>>) -> Option<NonZero<u16>> {
// CHECK: load i16, ptr %x, align 2, !noundef ![[NOUNDEF]]{{$}}
*x
}