Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/trait_handlers/ord/ord_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl TraitHandler for OrdEnumHandler {
} else {
let discriminant_cmp = quote! {
unsafe {
::core::cmp::Ord::cmp(&*<*const _>::from(self).cast::<#discriminant_type>(), &*<*const _>::from(other).cast::<#discriminant_type>())
::core::cmp::Ord::cmp(&*<*const Self>::from(self).cast::<#discriminant_type>(), &*<*const Self>::from(other).cast::<#discriminant_type>())
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/trait_handlers/partial_ord/partial_ord_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl TraitHandler for PartialOrdEnumHandler {
} else {
let discriminant_cmp = quote! {
unsafe {
::core::cmp::Ord::cmp(&*<*const _>::from(self).cast::<#discriminant_type>(), &*<*const _>::from(other).cast::<#discriminant_type>())
::core::cmp::Ord::cmp(&*<*const Self>::from(self).cast::<#discriminant_type>(), &*<*const Self>::from(other).cast::<#discriminant_type>())
}
};

Expand Down
8 changes: 8 additions & 0 deletions tests/ord_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,3 +630,11 @@ fn use_partial_ord_attr_ignore() {
assert_eq!(Ordering::Less, Enum::Tuple(1, 2).cmp(&Enum::Tuple(1, 3)));
assert_eq!(Ordering::Equal, Enum::Tuple(2, 2).cmp(&Enum::Tuple(1, 2)));
}

struct PoisonTypeInference;

impl From<&PoisonTypeInference> for *const () {
fn from(value: &PoisonTypeInference) -> Self {
value as *const PoisonTypeInference as *const ()
}
}