diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-29 20:57:18 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-30 16:03:25 -0700 |
| commit | bb96ee6123082908dba86cb22344f0c23915bf06 (patch) | |
| tree | 4e5cb402fc334bc776f7e6b0c3b3d7e4bb2a4291 | |
| parent | 748bc3ca49de8ab0b890726120c40567094e43fc (diff) | |
| download | rust-bb96ee6123082908dba86cb22344f0c23915bf06.tar.gz rust-bb96ee6123082908dba86cb22344f0c23915bf06.zip | |
syntax: Prepare for Total{Eq,Ord} => {Eq,Ord}
This commit adds the groundwork for the renaming of the Total{Eq,Ord} traits.
After this commit hits a snapshot, the traits can be renamed.
| -rw-r--r-- | src/libcore/cmp.rs | 3 | ||||
| -rw-r--r-- | src/libcore/iter.rs | 3 | ||||
| -rw-r--r-- | src/librustc/middle/lint.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/totaleq.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/totalord.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/mod.rs | 5 |
6 files changed, 13 insertions, 8 deletions
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 5bf15ff18f0..80bc4f31a13 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -37,6 +37,9 @@ //! assert!(SketchyNum {num: 25} != SketchyNum {num: 57}); //! ``` +pub use Eq = self::TotalEq; +pub use Ord = self::TotalOrd; + /// Trait for values that can be compared for equality and inequality. /// /// This trait allows partial equality, where types can be unordered instead of diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index e18244280bf..4438b6ec980 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -2083,7 +2083,8 @@ pub struct RangeStep<A> { /// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping. #[inline] -pub fn range_step<A: CheckedAdd + PartialOrd + Clone + Zero>(start: A, stop: A, step: A) -> RangeStep<A> { +pub fn range_step<A: CheckedAdd + PartialOrd + + Clone + Zero>(start: A, stop: A, step: A) -> RangeStep<A> { let rev = step < Zero::zero(); RangeStep{state: start, stop: stop, step: step, rev: rev} } diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 7a11924800b..6cffd15487d 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -1650,7 +1650,7 @@ fn check_missing_doc_item(cx: &Context, it: &ast::Item) { desc); } -#[deriving(Eq)] +#[deriving(PartialEq)] enum MethodContext { TraitDefaultImpl, TraitImpl, diff --git a/src/libsyntax/ext/deriving/cmp/totaleq.rs b/src/libsyntax/ext/deriving/cmp/totaleq.rs index b76caccffec..a8124493acb 100644 --- a/src/libsyntax/ext/deriving/cmp/totaleq.rs +++ b/src/libsyntax/ext/deriving/cmp/totaleq.rs @@ -28,7 +28,7 @@ pub fn expand_deriving_totaleq(cx: &mut ExtCtxt, let block = cx.block(span, stmts, None); cx.expr_block(block) }, - |cx, sp, _, _| cx.span_bug(sp, "non matching enums in deriving(TotalEq)?"), + |cx, sp, _, _| cx.span_bug(sp, "non matching enums in deriving(Eq)?"), cx, span, substr) @@ -42,7 +42,7 @@ pub fn expand_deriving_totaleq(cx: &mut ExtCtxt, let trait_def = TraitDef { span: span, attributes: Vec::new(), - path: Path::new(vec!("std", "cmp", "TotalEq")), + path: Path::new(vec!("std", "cmp", "Eq")), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), methods: vec!( diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs index 3ca4f9e2862..c4611a552f5 100644 --- a/src/libsyntax/ext/deriving/cmp/totalord.rs +++ b/src/libsyntax/ext/deriving/cmp/totalord.rs @@ -28,7 +28,7 @@ pub fn expand_deriving_totalord(cx: &mut ExtCtxt, let trait_def = TraitDef { span: span, attributes: Vec::new(), - path: Path::new(vec!("std", "cmp", "TotalOrd")), + path: Path::new(vec!("std", "cmp", "Ord")), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), methods: vec!( @@ -117,7 +117,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span, let order = ordering_const(cx, span, self_var.cmp(&other_var)); cx.expr_path(order) } - _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(TotalOrd)`") + _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`") } }, cx, span, substr) diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index 3735248e9e2..1d8081e2ae3 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -77,10 +77,11 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt, "Encodable" => expand!(encodable::expand_deriving_encodable), "Decodable" => expand!(decodable::expand_deriving_decodable), + // NOTE: after a stage0 snap this needs treatment "PartialEq" => expand!(eq::expand_deriving_eq), - "TotalEq" => expand!(totaleq::expand_deriving_totaleq), + "Eq" | "TotalEq" => expand!(totaleq::expand_deriving_totaleq), "PartialOrd" => expand!(ord::expand_deriving_ord), - "TotalOrd" => expand!(totalord::expand_deriving_totalord), + "Ord" | "TotalOrd" => expand!(totalord::expand_deriving_totalord), "Rand" => expand!(rand::expand_deriving_rand), |
