-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.rust-2-breakage-wishlistIn the wishlist of breaking changes that requires rust 2.0In the wishlist of breaking changes that requires rust 2.0
Description
The assert_receiver_is_total_eq
method is purely so that #[deriving]
can enforce that all the contained types are TotalEq
. It currently exists because the #[deriving]
infrastructure makes it much much much easier to work with a method on a trait than with anything else.
Preferably #[deriving]
would be refactored to allow creating a non trait function along the lines of
#[deriving(TotalEq)]
struct Foo<T> {
x: int,
y: T
}
// expands to
impl<T: TotalEq> TotalEq for Foo<T> {}
impl<T: TotalEq> Foo<T> {
#[allow(dead_code)]
fn assert_Foo_is_total_eq(&self) {
fn total_eq<T: TotalEq>(_: &T) {}
total_eq(&self.x);
total_eq(&self.y);
}
}
which would allow TotalEq
to become just trait TotalEq: Eq {}
.
(Placeholder issue for now.)
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.rust-2-breakage-wishlistIn the wishlist of breaking changes that requires rust 2.0In the wishlist of breaking changes that requires rust 2.0