Skip to content

Commit 0e26bb7

Browse files
committed
Revert "Implement Ord as necessary"
This reverts commit c6772b4.
1 parent 27a046e commit 0e26bb7

File tree

4 files changed

+5
-33
lines changed

4 files changed

+5
-33
lines changed

src/librustc/traits/project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub struct MismatchedProjectionTypes<'tcx> {
101101
pub err: ty::error::TypeError<'tcx>
102102
}
103103

104-
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
104+
#[derive(PartialEq, Eq, Debug)]
105105
enum ProjectionTyCandidate<'tcx> {
106106
// from a where-clause in the env or object type
107107
ParamEnv(ty::PolyProjectionPredicate<'tcx>),

src/librustc/ty/mod.rs

+1-29
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ use util::nodemap::{NodeSet, DefIdMap, FxHashMap, FxHashSet};
3939
use serialize::{self, Encodable, Encoder};
4040
use std::cell::RefCell;
4141
use std::cmp;
42-
use std::cmp::Ordering;
4342
use std::fmt;
4443
use std::hash::{Hash, Hasher};
4544
use std::iter::FromIterator;
@@ -498,20 +497,6 @@ impl<'tcx> Hash for TyS<'tcx> {
498497
}
499498
}
500499

501-
impl<'tcx> Ord for TyS<'tcx> {
502-
#[inline]
503-
fn cmp(&self, other: &TyS<'tcx>) -> Ordering {
504-
// (self as *const _).cmp(other as *const _)
505-
(self as *const TyS<'tcx>).cmp(&(other as *const TyS<'tcx>))
506-
}
507-
}
508-
impl<'tcx> PartialOrd for TyS<'tcx> {
509-
#[inline]
510-
fn partial_cmp(&self, other: &TyS<'tcx>) -> Option<Ordering> {
511-
Some(self.cmp(other))
512-
}
513-
}
514-
515500
impl<'tcx> TyS<'tcx> {
516501
pub fn is_primitive_ty(&self) -> bool {
517502
match self.sty {
@@ -581,19 +566,6 @@ impl<T> PartialEq for Slice<T> {
581566
}
582567
impl<T> Eq for Slice<T> {}
583568

584-
impl<T> Ord for Slice<T> {
585-
#[inline]
586-
fn cmp(&self, other: &Slice<T>) -> Ordering {
587-
(&self.0 as *const [T]).cmp(&(&other.0 as *const [T]))
588-
}
589-
}
590-
impl<T> PartialOrd for Slice<T> {
591-
#[inline]
592-
fn partial_cmp(&self, other: &Slice<T>) -> Option<Ordering> {
593-
Some(self.cmp(other))
594-
}
595-
}
596-
597569
impl<T> Hash for Slice<T> {
598570
fn hash<H: Hasher>(&self, s: &mut H) {
599571
(self.as_ptr(), self.len()).hash(s)
@@ -1128,7 +1100,7 @@ pub type PolySubtypePredicate<'tcx> = ty::Binder<SubtypePredicate<'tcx>>;
11281100
/// equality between arbitrary types. Processing an instance of
11291101
/// Form #2 eventually yields one of these `ProjectionPredicate`
11301102
/// instances to normalize the LHS.
1131-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
1103+
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
11321104
pub struct ProjectionPredicate<'tcx> {
11331105
pub projection_ty: ProjectionTy<'tcx>,
11341106
pub ty: Ty<'tcx>,

src/librustc/ty/sty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> {
645645
/// erase, or otherwise "discharge" these bound regions, we change the
646646
/// type from `Binder<T>` to just `T` (see
647647
/// e.g. `liberate_late_bound_regions`).
648-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
648+
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
649649
pub struct Binder<T>(pub T);
650650

651651
impl<T> Binder<T> {
@@ -745,7 +745,7 @@ impl<T> Binder<T> {
745745

746746
/// Represents the projection of an associated type. In explicit UFCS
747747
/// form this would be written `<T as Trait<..>>::N`.
748-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
748+
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
749749
pub struct ProjectionTy<'tcx> {
750750
/// The parameters of the associated item.
751751
pub substs: &'tcx Substs<'tcx>,

src/librustc/ty/subst.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use std::mem;
2929
/// To reduce memory usage, a `Kind` is a interned pointer,
3030
/// with the lowest 2 bits being reserved for a tag to
3131
/// indicate the type (`Ty` or `Region`) it points to.
32-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
32+
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
3333
pub struct Kind<'tcx> {
3434
ptr: NonZero<usize>,
3535
marker: PhantomData<(Ty<'tcx>, ty::Region<'tcx>)>

0 commit comments

Comments
 (0)