Skip to content

Commit 60ab72a

Browse files
committed
---
yaml --- r: 103559 b: refs/heads/auto c: 4d7d101 h: refs/heads/master i: 103557: 5a9e144 103555: 8889791 103551: 3dbf3b0 v: v3
1 parent 08ac624 commit 60ab72a

32 files changed

+169
-107
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 4c90a7f018e19f94d7c32a96bf608fbd3ab56e12
16+
refs/heads/auto: 4d7d101a76deea69e9078d9ed6bb93ecca70e52a
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/RELEASES.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,8 @@ Version 0.2 (March 2012)
745745
* Merged per-platform std::{os*, fs*} to core::{libc, os}
746746
* Extensive cleanup, regularization in libstd, libcore
747747

748-
Version 0.1 (January 20, 2012)
749-
-------------------------------
748+
Version 0.1 (January 2012)
749+
---------------------------
750750

751751
* Most language features work, including:
752752
* Unique pointers, unique closures, move semantics

branches/auto/src/libcollections/btree.rs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BTree<K, V> {
9292
}
9393
}
9494

95+
impl<K: TotalOrd, V: TotalEq> Eq for BTree<K, V> {
96+
fn eq(&self, other: &BTree<K, V>) -> bool {
97+
self.equals(other)
98+
}
99+
}
95100

96101
impl<K: TotalOrd, V: TotalEq> TotalEq for BTree<K, V> {
97102
///Testing equality on BTrees by comparing the root.
@@ -100,6 +105,12 @@ impl<K: TotalOrd, V: TotalEq> TotalEq for BTree<K, V> {
100105
}
101106
}
102107

108+
impl<K: TotalOrd, V: TotalEq> Ord for BTree<K, V> {
109+
fn lt(&self, other: &BTree<K, V>) -> bool {
110+
self.cmp(other) == Less
111+
}
112+
}
113+
103114
impl<K: TotalOrd, V: TotalEq> TotalOrd for BTree<K, V> {
104115
///Returns an ordering based on the root nodes of each BTree.
105116
fn cmp(&self, other: &BTree<K, V>) -> Ordering {
@@ -191,6 +202,12 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for Node<K, V> {
191202
}
192203
}
193204

205+
impl<K: TotalOrd, V: TotalEq> Eq for Node<K, V> {
206+
fn eq(&self, other: &Node<K, V>) -> bool {
207+
self.equals(other)
208+
}
209+
}
210+
194211
impl<K: TotalOrd, V: TotalEq> TotalEq for Node<K, V> {
195212
///Returns whether two nodes are equal based on the keys of each element.
196213
///Two nodes are equal if all of their keys are the same.
@@ -215,6 +232,12 @@ impl<K: TotalOrd, V: TotalEq> TotalEq for Node<K, V> {
215232
}
216233
}
217234

235+
impl<K: TotalOrd, V: TotalEq> Ord for Node<K, V> {
236+
fn lt(&self, other: &Node<K, V>) -> bool {
237+
self.cmp(other) == Less
238+
}
239+
}
240+
218241
impl<K: TotalOrd, V: TotalEq> TotalOrd for Node<K, V> {
219242
///Implementation of TotalOrd for Nodes.
220243
fn cmp(&self, other: &Node<K, V>) -> Ordering {
@@ -380,13 +403,25 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for Leaf<K, V> {
380403
}
381404
}
382405

406+
impl<K: TotalOrd, V: TotalEq> Eq for Leaf<K, V> {
407+
fn eq(&self, other: &Leaf<K, V>) -> bool {
408+
self.equals(other)
409+
}
410+
}
411+
383412
impl<K: TotalOrd, V: TotalEq> TotalEq for Leaf<K, V> {
384413
///Implementation of equals function for leaves that compares LeafElts.
385414
fn equals(&self, other: &Leaf<K, V>) -> bool {
386415
self.elts.equals(&other.elts)
387416
}
388417
}
389418

419+
impl<K: TotalOrd, V: TotalEq> Ord for Leaf<K, V> {
420+
fn lt(&self, other: &Leaf<K, V>) -> bool {
421+
self.cmp(other) == Less
422+
}
423+
}
424+
390425
impl<K: TotalOrd, V: TotalEq> TotalOrd for Leaf<K, V> {
391426
///Returns an ordering based on the first element of each Leaf.
392427
fn cmp(&self, other: &Leaf<K, V>) -> Ordering {
@@ -602,13 +637,25 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for Branch<K, V> {
602637
}
603638
}
604639

640+
impl<K: TotalOrd, V: TotalEq> Eq for Branch<K, V> {
641+
fn eq(&self, other: &Branch<K, V>) -> bool {
642+
self.equals(other)
643+
}
644+
}
645+
605646
impl<K: TotalOrd, V: TotalEq> TotalEq for Branch<K, V> {
606647
///Equals function for Branches--compares all the elements in each branch
607648
fn equals(&self, other: &Branch<K, V>) -> bool {
608649
self.elts.equals(&other.elts)
609650
}
610651
}
611652

653+
impl<K: TotalOrd, V: TotalEq> Ord for Branch<K, V> {
654+
fn lt(&self, other: &Branch<K, V>) -> bool {
655+
self.cmp(other) == Less
656+
}
657+
}
658+
612659
impl<K: TotalOrd, V: TotalEq> TotalOrd for Branch<K, V> {
613660
///Compares the first elements of two branches to determine an ordering
614661
fn cmp(&self, other: &Branch<K, V>) -> Ordering {
@@ -663,13 +710,25 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for LeafElt<K, V> {
663710
}
664711
}
665712

713+
impl<K: TotalOrd, V: TotalEq> Eq for LeafElt<K, V> {
714+
fn eq(&self, other: &LeafElt<K, V>) -> bool {
715+
self.equals(other)
716+
}
717+
}
718+
666719
impl<K: TotalOrd, V: TotalEq> TotalEq for LeafElt<K, V> {
667720
///TotalEq for LeafElts
668721
fn equals(&self, other: &LeafElt<K, V>) -> bool {
669722
self.key.equals(&other.key) && self.value.equals(&other.value)
670723
}
671724
}
672725

726+
impl<K: TotalOrd, V: TotalEq> Ord for LeafElt<K, V> {
727+
fn lt(&self, other: &LeafElt<K, V>) -> bool {
728+
self.cmp(other) == Less
729+
}
730+
}
731+
673732
impl<K: TotalOrd, V: TotalEq> TotalOrd for LeafElt<K, V> {
674733
///Returns an ordering based on the keys of the LeafElts.
675734
fn cmp(&self, other: &LeafElt<K, V>) -> Ordering {
@@ -705,13 +764,25 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BranchElt<K, V> {
705764
}
706765
}
707766

767+
impl<K: TotalOrd, V: TotalEq> Eq for BranchElt<K, V>{
768+
fn eq(&self, other: &BranchElt<K, V>) -> bool {
769+
self.equals(other)
770+
}
771+
}
772+
708773
impl<K: TotalOrd, V: TotalEq> TotalEq for BranchElt<K, V>{
709774
///TotalEq for BranchElts
710775
fn equals(&self, other: &BranchElt<K, V>) -> bool {
711776
self.key.equals(&other.key)&&self.value.equals(&other.value)
712777
}
713778
}
714779

780+
impl<K: TotalOrd, V: TotalEq> Ord for BranchElt<K, V> {
781+
fn lt(&self, other: &BranchElt<K, V>) -> bool {
782+
self.cmp(other) == Less
783+
}
784+
}
785+
715786
impl<K: TotalOrd, V: TotalEq> TotalOrd for BranchElt<K, V> {
716787
///Fulfills TotalOrd for BranchElts
717788
fn cmp(&self, other: &BranchElt<K, V>) -> Ordering {

branches/auto/src/libcollections/dlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ impl<A: Eq> Eq for DList<A> {
607607
}
608608
}
609609

610-
impl<A: Eq + Ord> Ord for DList<A> {
610+
impl<A: Ord> Ord for DList<A> {
611611
fn lt(&self, other: &DList<A>) -> bool {
612612
iter::order::lt(self.iter(), other.iter())
613613
}

branches/auto/src/libextra/workcache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ use std::io::{File, MemWriter};
8888
*
8989
*/
9090

91-
#[deriving(Clone, Eq, Encodable, Decodable, TotalOrd, TotalEq)]
91+
#[deriving(Clone, Eq, Encodable, Decodable, Ord, TotalOrd, TotalEq)]
9292
struct WorkKey {
9393
kind: ~str,
9494
name: ~str

branches/auto/src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use syntax::attr::AttrMetaMethods;
4646
use syntax::crateid::CrateId;
4747
use syntax::parse::token;
4848

49-
#[deriving(Clone, Eq, TotalOrd, TotalEq)]
49+
#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq)]
5050
pub enum OutputType {
5151
OutputTypeBitcode,
5252
OutputTypeAssembly,

branches/auto/src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ pub enum EntryFnType {
166166
EntryNone,
167167
}
168168

169-
#[deriving(Eq, Clone, TotalOrd, TotalEq)]
169+
#[deriving(Eq, Ord, Clone, TotalOrd, TotalEq)]
170170
pub enum CrateType {
171171
CrateTypeExecutable,
172172
CrateTypeDylib,

branches/auto/src/librustc/middle/const_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ pub fn lit_to_const(lit: &Lit) -> const_val {
525525
}
526526
}
527527

528-
fn compare_vals<T : Eq + Ord>(a: T, b: T) -> Option<int> {
528+
fn compare_vals<T: Ord>(a: T, b: T) -> Option<int> {
529529
Some(if a == b { 0 } else if a < b { -1 } else { 1 })
530530
}
531531
pub fn compare_const_vals(a: &const_val, b: &const_val) -> Option<int> {

branches/auto/src/librustc/middle/ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,13 +633,13 @@ impl Region {
633633
}
634634
}
635635

636-
#[deriving(Clone, Eq, TotalOrd, TotalEq, Hash, Encodable, Decodable, Show)]
636+
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
637637
pub struct FreeRegion {
638638
scope_id: NodeId,
639639
bound_region: BoundRegion
640640
}
641641

642-
#[deriving(Clone, Eq, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
642+
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
643643
pub enum BoundRegion {
644644
/// An anonymous region parameter for a given fn (&T)
645645
BrAnon(uint),

branches/auto/src/librustdoc/html/render.rs

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ use std::io;
3939
use std::io::{fs, File, BufferedWriter};
4040
use std::str;
4141
use std::vec;
42-
use std::vec_ng::Vec;
4342
use collections::{HashMap, HashSet};
4443

4544
use sync::Arc;
@@ -161,13 +160,6 @@ pub struct Cache {
161160
priv search_index: ~[IndexItem],
162161
priv privmod: bool,
163162
priv public_items: NodeSet,
164-
165-
// In rare case where a structure is defined in one module but implemented
166-
// in another, if the implementing module is parsed before defining module,
167-
// then the fully qualified name of the structure isn't presented in `paths`
168-
// yet when its implementation methods are being indexed. Caches such methods
169-
// and their parent id here and indexes them at the end of crate parsing.
170-
priv orphan_methods: Vec<(ast::NodeId, clean::Item)>,
171163
}
172164

173165
/// Helper struct to render all source code to HTML pages
@@ -257,31 +249,10 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> {
257249
extern_locations: HashMap::new(),
258250
privmod: false,
259251
public_items: public_items,
260-
orphan_methods: Vec::new(),
261252
}
262253
});
263254
cache.stack.push(krate.name.clone());
264255
krate = cache.fold_crate(krate);
265-
{
266-
// Attach all orphan methods to the type's definition if the type
267-
// has since been learned.
268-
let Cache { search_index: ref mut index,
269-
orphan_methods: ref meths, paths: ref paths, ..} = cache;
270-
for &(ref pid, ref item) in meths.iter() {
271-
match paths.find(pid) {
272-
Some(&(ref fqp, _)) => {
273-
index.push(IndexItem {
274-
ty: shortty(item),
275-
name: item.name.clone().unwrap(),
276-
path: fqp.slice_to(fqp.len() - 1).connect("::"),
277-
desc: shorter(item.doc_value()).to_owned(),
278-
parent: Some(*pid),
279-
});
280-
},
281-
None => {}
282-
}
283-
};
284-
}
285256

286257
// Add all the static files
287258
let mut dst = cx.dst.join(krate.name.as_slice());
@@ -556,33 +527,26 @@ impl DocFolder for Cache {
556527
clean::TyMethodItem(..) |
557528
clean::StructFieldItem(..) |
558529
clean::VariantItem(..) => {
559-
(Some(*self.parent_stack.last().unwrap()),
560-
Some(self.stack.slice_to(self.stack.len() - 1)))
530+
Some((Some(*self.parent_stack.last().unwrap()),
531+
self.stack.slice_to(self.stack.len() - 1)))
561532

562533
}
563534
clean::MethodItem(..) => {
564535
if self.parent_stack.len() == 0 {
565-
(None, None)
536+
None
566537
} else {
567538
let last = self.parent_stack.last().unwrap();
568-
let path = match self.paths.find(last) {
569-
Some(&(_, "trait")) =>
570-
Some(self.stack.slice_to(self.stack.len() - 1)),
571-
// The current stack not necessarily has correlation for
572-
// where the type was defined. On the other hand,
573-
// `paths` always has the right information if present.
574-
Some(&(ref fqp, "struct")) | Some(&(ref fqp, "enum")) =>
575-
Some(fqp.slice_to(fqp.len() - 1)),
576-
Some(..) => Some(self.stack.as_slice()),
577-
None => None
539+
let amt = match self.paths.find(last) {
540+
Some(&(_, "trait")) => self.stack.len() - 1,
541+
Some(..) | None => self.stack.len(),
578542
};
579-
(Some(*last), path)
543+
Some((Some(*last), self.stack.slice_to(amt)))
580544
}
581545
}
582-
_ => (None, Some(self.stack.as_slice()))
546+
_ => Some((None, self.stack.as_slice()))
583547
};
584548
match parent {
585-
(parent, Some(path)) if !self.privmod => {
549+
Some((parent, path)) if !self.privmod => {
586550
self.search_index.push(IndexItem {
587551
ty: shortty(&item),
588552
name: s.to_owned(),
@@ -591,12 +555,7 @@ impl DocFolder for Cache {
591555
parent: parent,
592556
});
593557
}
594-
(Some(parent), None) if !self.privmod => {
595-
// We have a parent, but we don't know where they're
596-
// defined yet. Wait for later to index this item.
597-
self.orphan_methods.push((parent, item.clone()))
598-
}
599-
_ => {}
558+
Some(..) | None => {}
600559
}
601560
}
602561
None => {}

branches/auto/src/libstd/cmp.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ pub trait Eq {
4242
}
4343

4444
/// Trait for equality comparisons where `a == b` and `a != b` are strict inverses.
45-
pub trait TotalEq {
46-
fn equals(&self, other: &Self) -> bool;
45+
pub trait TotalEq: Eq {
46+
/// This method must return the same value as `eq`. It exists to prevent
47+
/// deriving `TotalEq` from fields not implementing the `TotalEq` trait.
48+
fn equals(&self, other: &Self) -> bool {
49+
self.eq(other)
50+
}
4751
}
4852

4953
macro_rules! totaleq_impl(
@@ -76,7 +80,7 @@ totaleq_impl!(char)
7680
pub enum Ordering { Less = -1, Equal = 0, Greater = 1 }
7781

7882
/// Trait for types that form a total order
79-
pub trait TotalOrd: TotalEq {
83+
pub trait TotalOrd: TotalEq + Ord {
8084
fn cmp(&self, other: &Self) -> Ordering;
8185
}
8286

@@ -161,16 +165,14 @@ pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
161165
* (cf. IEEE 754-2008 section 5.11).
162166
*/
163167
#[lang="ord"]
164-
pub trait Ord {
168+
pub trait Ord: Eq {
165169
fn lt(&self, other: &Self) -> bool;
166170
#[inline]
167171
fn le(&self, other: &Self) -> bool { !other.lt(self) }
168172
#[inline]
169173
fn gt(&self, other: &Self) -> bool { other.lt(self) }
170174
#[inline]
171175
fn ge(&self, other: &Self) -> bool { !self.lt(other) }
172-
173-
// FIXME (#12068): Add min/max/clamp default methods
174176
}
175177

176178
/// The equivalence relation. Two values may be equivalent even if they are

0 commit comments

Comments
 (0)