Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc: Accept PartialOrd/PartialOrdEq for Eq/Ord #14492

Merged
merged 1 commit into from
May 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
//! assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
//! ```

pub use PartialEq = cmp::Eq;
pub use PartialOrd = cmp::Ord;

/// Trait for values that can be compared for equality and inequality.
///
/// This trait allows partial equality, where types can be unordered instead of
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ext/deriving/cmp/eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt,
let trait_def = TraitDef {
span: span,
attributes: Vec::new(),
path: Path::new(vec!("std", "cmp", "Eq")),
path: Path::new(vec!("std", "cmp", "PartialEq")),
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
methods: vec!(
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ext/deriving/cmp/ord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
let trait_def = TraitDef {
span: span,
attributes: Vec::new(),
path: Path::new(vec!("std", "cmp", "Ord")),
path: Path::new(vec!("std", "cmp", "PartialOrd")),
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
methods: vec!(
Expand Down
5 changes: 3 additions & 2 deletions src/libsyntax/ext/deriving/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt,
"Encodable" => expand!(encodable::expand_deriving_encodable),
"Decodable" => expand!(decodable::expand_deriving_decodable),

"Eq" => expand!(eq::expand_deriving_eq),
// NOTE this needs treatment after a stage0 snap
"PartialEq" | "Eq" => expand!(eq::expand_deriving_eq),
"TotalEq" => expand!(totaleq::expand_deriving_totaleq),
"Ord" => expand!(ord::expand_deriving_ord),
"PartialOrd" | "Ord" => expand!(ord::expand_deriving_ord),
"TotalOrd" => expand!(totalord::expand_deriving_totalord),

"Rand" => expand!(rand::expand_deriving_rand),
Expand Down