Skip to content

Commit c287afb

Browse files
committed
libcore: DSTify ops traits, Equiv
This commit relaxes constraints on generics and traits within the `core::ops` module and for the `Equiv` trait.
1 parent 004db80 commit c287afb

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/libcore/cmp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ pub trait PartialOrd for Sized?: PartialEq {
241241
/// container types; e.g. it is often desirable to be able to use `&str`
242242
/// values to look up entries in a container with `String` keys.
243243
#[experimental = "Better solutions may be discovered."]
244-
pub trait Equiv<T> for Sized? {
244+
pub trait Equiv<Sized? T> for Sized? {
245245
/// Implement this function to decide equivalent values.
246246
fn equiv(&self, other: &T) -> bool;
247247
}

src/libcore/ops.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub trait Drop {
112112
* ```
113113
*/
114114
#[lang="add"]
115-
pub trait Add<RHS,Result> {
115+
pub trait Add<Sized? RHS,Result> for Sized? {
116116
/// The method for the `+` operator
117117
fn add(&self, rhs: &RHS) -> Result;
118118
}
@@ -153,7 +153,7 @@ add_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
153153
* ```
154154
*/
155155
#[lang="sub"]
156-
pub trait Sub<RHS,Result> {
156+
pub trait Sub<Sized? RHS, Result> for Sized? {
157157
/// The method for the `-` operator
158158
fn sub(&self, rhs: &RHS) -> Result;
159159
}
@@ -194,7 +194,7 @@ sub_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
194194
* ```
195195
*/
196196
#[lang="mul"]
197-
pub trait Mul<RHS,Result> {
197+
pub trait Mul<Sized? RHS, Result> for Sized? {
198198
/// The method for the `*` operator
199199
fn mul(&self, rhs: &RHS) -> Result;
200200
}
@@ -235,7 +235,7 @@ mul_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
235235
* ```
236236
*/
237237
#[lang="div"]
238-
pub trait Div<RHS,Result> {
238+
pub trait Div<Sized? RHS, Result> for Sized? {
239239
/// The method for the `/` operator
240240
fn div(&self, rhs: &RHS) -> Result;
241241
}
@@ -276,7 +276,7 @@ div_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
276276
* ```
277277
*/
278278
#[lang="rem"]
279-
pub trait Rem<RHS,Result> {
279+
pub trait Rem<Sized? RHS, Result> for Sized? {
280280
/// The method for the `%` operator
281281
fn rem(&self, rhs: &RHS) -> Result;
282282
}
@@ -331,7 +331,7 @@ rem_float_impl!(f64, fmod)
331331
* ```
332332
*/
333333
#[lang="neg"]
334-
pub trait Neg<Result> {
334+
pub trait Neg<Result> for Sized? {
335335
/// The method for the unary `-` operator
336336
fn neg(&self) -> Result;
337337
}
@@ -388,7 +388,7 @@ neg_uint_impl!(u64, i64)
388388
* ```
389389
*/
390390
#[lang="not"]
391-
pub trait Not<Result> {
391+
pub trait Not<Result> for Sized? {
392392
/// The method for the unary `!` operator
393393
fn not(&self) -> Result;
394394
}
@@ -430,7 +430,7 @@ not_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64)
430430
* ```
431431
*/
432432
#[lang="bitand"]
433-
pub trait BitAnd<RHS,Result> {
433+
pub trait BitAnd<Sized? RHS, Result> for Sized? {
434434
/// The method for the `&` operator
435435
fn bitand(&self, rhs: &RHS) -> Result;
436436
}
@@ -471,7 +471,7 @@ bitand_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64)
471471
* ```
472472
*/
473473
#[lang="bitor"]
474-
pub trait BitOr<RHS,Result> {
474+
pub trait BitOr<Sized? RHS, Result> for Sized? {
475475
/// The method for the `|` operator
476476
fn bitor(&self, rhs: &RHS) -> Result;
477477
}
@@ -512,7 +512,7 @@ bitor_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64)
512512
* ```
513513
*/
514514
#[lang="bitxor"]
515-
pub trait BitXor<RHS,Result> {
515+
pub trait BitXor<Sized? RHS, Result> for Sized? {
516516
/// The method for the `^` operator
517517
fn bitxor(&self, rhs: &RHS) -> Result;
518518
}
@@ -553,7 +553,7 @@ bitxor_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64)
553553
* ```
554554
*/
555555
#[lang="shl"]
556-
pub trait Shl<RHS,Result> {
556+
pub trait Shl<Sized? RHS, Result> for Sized? {
557557
/// The method for the `<<` operator
558558
fn shl(&self, rhs: &RHS) -> Result;
559559
}
@@ -596,7 +596,7 @@ shl_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64)
596596
* ```
597597
*/
598598
#[lang="shr"]
599-
pub trait Shr<RHS,Result> {
599+
pub trait Shr<Sized? RHS, Result> for Sized? {
600600
/// The method for the `>>` operator
601601
fn shr(&self, rhs: &RHS) -> Result;
602602
}
@@ -669,7 +669,7 @@ pub trait Index<Sized? Index, Sized? Result> for Sized? {
669669
* ```
670670
*/
671671
#[lang="index_mut"]
672-
pub trait IndexMut<Sized? Index, Result> for Sized? {
672+
pub trait IndexMut<Sized? Index, Sized? Result> for Sized? {
673673
/// The method for the indexing (`Foo[Bar]`) operation
674674
fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result;
675675
}
@@ -712,7 +712,7 @@ pub trait IndexMut<Sized? Index, Result> for Sized? {
712712
* ```
713713
*/
714714
#[lang="slice"]
715-
pub trait Slice<Idx, Sized? Result> for Sized? {
715+
pub trait Slice<Sized? Idx, Sized? Result> for Sized? {
716716
/// The method for the slicing operation foo[]
717717
fn as_slice_<'a>(&'a self) -> &'a Result;
718718
/// The method for the slicing operation foo[from..]
@@ -761,7 +761,7 @@ pub trait Slice<Idx, Sized? Result> for Sized? {
761761
* ```
762762
*/
763763
#[lang="slice_mut"]
764-
pub trait SliceMut<Idx, Sized? Result> for Sized? {
764+
pub trait SliceMut<Sized? Idx, Sized? Result> for Sized? {
765765
/// The method for the slicing operation foo[]
766766
fn as_mut_slice_<'a>(&'a mut self) -> &'a mut Result;
767767
/// The method for the slicing operation foo[from..]
@@ -800,7 +800,7 @@ pub trait SliceMut<Idx, Sized? Result> for Sized? {
800800
* ```
801801
*/
802802
#[lang="deref"]
803-
pub trait Deref<Sized? Result> {
803+
pub trait Deref<Sized? Result> for Sized? {
804804
/// The method called to dereference a value
805805
fn deref<'a>(&'a self) -> &'a Result;
806806
}
@@ -859,21 +859,21 @@ impl<'a, Sized? T> DerefMut<T> for &'a mut T {
859859

860860
/// A version of the call operator that takes an immutable receiver.
861861
#[lang="fn"]
862-
pub trait Fn<Args,Result> {
862+
pub trait Fn<Args,Result> for Sized? {
863863
/// This is called when the call operator is used.
864864
extern "rust-call" fn call(&self, args: Args) -> Result;
865865
}
866866

867867
/// A version of the call operator that takes a mutable receiver.
868868
#[lang="fn_mut"]
869-
pub trait FnMut<Args,Result> {
869+
pub trait FnMut<Args,Result> for Sized? {
870870
/// This is called when the call operator is used.
871871
extern "rust-call" fn call_mut(&mut self, args: Args) -> Result;
872872
}
873873

874874
/// A version of the call operator that takes a by-value receiver.
875875
#[lang="fn_once"]
876-
pub trait FnOnce<Args,Result> {
876+
pub trait FnOnce<Args,Result> for Sized? {
877877
/// This is called when the call operator is used.
878878
extern "rust-call" fn call_once(self, args: Args) -> Result;
879879
}

0 commit comments

Comments
 (0)