-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
If a trait implementation like the following is defined in a crate's dependency graph, educe-generated Ord implementations will fail to compile:
struct PoisonTypeInference;
impl From<&PoisonTypeInference> for *const () {
fn from(value: &PoisonTypeInference) -> Self {
value as *const PoisonTypeInference as *const ()
}
}error[E0277]: the trait bound `*const _: From<&Enum2>` is not satisfied
--> tests/ord_enum.rs:15:29
|
15 | #[derive(PartialEq, Eq, Educe)]
| ^^^^^ the trait `From<&Enum2>` is not implemented for `*const _`
|
= note: this error originates in the derive macro `Educe` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0282]: type annotations needed
--> tests/ord_enum.rs:15:29
|
15 | #[derive(PartialEq, Eq, Educe)]
| ^^^^^
| |
| cannot infer type
| cannot call a method on a raw pointer with an unknown pointee type
|
= note: this error originates in the derive macro `Educe` (in Nightly builds, run with -Z macro-backtrace for more info)
The failures come from these casts:
| ::core::cmp::Ord::cmp(&*<*const _>::from(self).cast::<#discriminant_type>(), &*<*const _>::from(other).cast::<#discriminant_type>()) |
educe/src/trait_handlers/ord/ord_enum.rs
Line 213 in bc05181
| ::core::cmp::Ord::cmp(&*<*const _>::from(self).cast::<#discriminant_type>(), &*<*const _>::from(other).cast::<#discriminant_type>()) |
I think it should be fixable by explicitly specifying *const Self instead of *const _.
Metadata
Metadata
Assignees
Labels
No labels