diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2024-03-05 13:26:47 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2024-03-19 16:32:01 +0000 |
| commit | 5f254d8b66f995eaeb5316b2e26ca507ebd5d0c4 (patch) | |
| tree | 5b6f58fb1f7b8052dd3b356a176a5e13c9a83a15 /tests/codegen | |
| parent | f296c162d8c6f84bcfee99c152d4fd63aaef3e38 (diff) | |
| download | rust-5f254d8b66f995eaeb5316b2e26ca507ebd5d0c4.tar.gz rust-5f254d8b66f995eaeb5316b2e26ca507ebd5d0c4.zip | |
Remove `SpecOptionPartialEq`
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/option-niche-eq.rs (renamed from tests/codegen/option-nonzero-eq.rs) | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/tests/codegen/option-nonzero-eq.rs b/tests/codegen/option-niche-eq.rs index f637b1aef97..8b8044e9b75 100644 --- a/tests/codegen/option-nonzero-eq.rs +++ b/tests/codegen/option-niche-eq.rs @@ -1,4 +1,5 @@ //@ compile-flags: -O -Zmerge-functions=disabled +//@ min-llvm-version: 18 #![crate_type = "lib"] #![feature(generic_nonzero)] @@ -7,9 +8,6 @@ use core::cmp::Ordering; use core::ptr::NonNull; use core::num::NonZero; -// See also tests/assembly/option-nonzero-eq.rs, for cases with `assume`s in the -// LLVM and thus don't optimize down clearly here, but do in assembly. - // CHECK-lABEL: @non_zero_eq #[no_mangle] pub fn non_zero_eq(l: Option<NonZero<u32>>, r: Option<NonZero<u32>>) -> bool { @@ -36,3 +34,42 @@ pub fn non_null_eq(l: Option<NonNull<u8>>, r: Option<NonNull<u8>>) -> bool { // CHECK-NEXT: ret i1 l == r } + +// CHECK-lABEL: @ordering_eq +#[no_mangle] +pub fn ordering_eq(l: Option<Ordering>, r: Option<Ordering>) -> bool { + // CHECK: start: + // CHECK-NEXT: icmp eq i8 + // CHECK-NEXT: ret i1 + l == r +} + +#[derive(PartialEq)] +pub enum EnumWithNiche { + A, + B, + C, + D, + E, + F, + G, +} + +// CHECK-lABEL: @niche_eq +#[no_mangle] +pub fn niche_eq(l: Option<EnumWithNiche>, r: Option<EnumWithNiche>) -> bool { + // CHECK: start: + // CHECK-NEXT: icmp eq i8 + // CHECK-NEXT: ret i1 + l == r +} + +// FIXME: This should work too +// // FIXME-CHECK-lABEL: @bool_eq +// #[no_mangle] +// pub fn bool_eq(l: Option<bool>, r: Option<bool>) -> bool { +// // FIXME-CHECK: start: +// // FIXME-CHECK-NEXT: icmp eq i8 +// // FIXME-CHECK-NEXT: ret i1 +// l == r +// } |
