diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index b7b32722a10..8ccfb6dd1f4 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -4,10 +4,14 @@ /// Interfaces used for comparison. +#[cfg(notest)] +#[lang="ord"] trait Ord { pure fn lt(&&other: self) -> bool; } +#[cfg(notest)] +#[lang="eq"] trait Eq { pure fn eq(&&other: self) -> bool; } diff --git a/src/rustc/middle/lang_items.rs b/src/rustc/middle/lang_items.rs index b6b88b55485..488602019b3 100644 --- a/src/rustc/middle/lang_items.rs +++ b/src/rustc/middle/lang_items.rs @@ -23,42 +23,52 @@ import str_eq = str::eq; struct LanguageItems { - let mut const_trait: Option; - let mut copy_trait: Option; - let mut send_trait: Option; - let mut owned_trait: Option; + mut const_trait: Option; + mut copy_trait: Option; + mut send_trait: Option; + mut owned_trait: Option; - let mut add_trait: Option; - let mut sub_trait: Option; - let mut mul_trait: Option; - let mut div_trait: Option; - let mut modulo_trait: Option; - let mut neg_trait: Option; - let mut bitxor_trait: Option; - let mut bitand_trait: Option; - let mut bitor_trait: Option; - let mut shl_trait: Option; - let mut shr_trait: Option; - let mut index_trait: Option; + mut add_trait: Option; + mut sub_trait: Option; + mut mul_trait: Option; + mut div_trait: Option; + mut modulo_trait: Option; + mut neg_trait: Option; + mut bitxor_trait: Option; + mut bitand_trait: Option; + mut bitor_trait: Option; + mut shl_trait: Option; + mut shr_trait: Option; + mut index_trait: Option; - new() { - self.const_trait = None; - self.copy_trait = None; - self.send_trait = None; - self.owned_trait = None; + mut eq_trait: Option; + mut ord_trait: Option; +} - self.add_trait = None; - self.sub_trait = None; - self.mul_trait = None; - self.div_trait = None; - self.modulo_trait = None; - self.neg_trait = None; - self.bitxor_trait = None; - self.bitand_trait = None; - self.bitor_trait = None; - self.shl_trait = None; - self.shr_trait = None; - self.index_trait = None; +mod LanguageItems { + fn make() -> LanguageItems { + LanguageItems { + const_trait: None, + copy_trait: None, + send_trait: None, + owned_trait: None, + + add_trait: None, + sub_trait: None, + mul_trait: None, + div_trait: None, + modulo_trait: None, + neg_trait: None, + bitxor_trait: None, + bitand_trait: None, + bitor_trait: None, + shl_trait: None, + shr_trait: None, + index_trait: None, + + eq_trait: None, + ord_trait: None + } } } @@ -93,6 +103,9 @@ struct LanguageItemCollector { self.item_refs.insert(~"shl", &mut self.items.shl_trait); self.item_refs.insert(~"shr", &mut self.items.shr_trait); self.item_refs.insert(~"index", &mut self.items.index_trait); + + self.item_refs.insert(~"eq", &mut self.items.eq_trait); + self.item_refs.insert(~"ord", &mut self.items.ord_trait); } fn match_and_collect_meta_item(item_def_id: def_id, @@ -202,7 +215,7 @@ fn collect() { } fn collect_language_items(crate: @crate, session: session) -> LanguageItems { - let items = LanguageItems(); + let items = LanguageItems::make(); let collector = LanguageItemCollector(crate, session, &items); collector.collect(); copy items