Skip to content

Commit fbd3dcc

Browse files
committed
---
yaml --- r: 49809 b: refs/heads/auto c: 62aa8d7 h: refs/heads/master i: 49807: 72b58c1 v: v3
1 parent 70d7ae3 commit fbd3dcc

38 files changed

+600
-714
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 80c71c839acde882e53ee9505a05b81e4af33ab7
17+
refs/heads/auto: 62aa8d7de96bc6439d14db3197313604292aa314
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167

branches/auto/src/etc/emacs/rust-mode.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
(require 'cm-mode)
99
(require 'cc-mode)
10+
(eval-when-compile (require 'cl))
1011

1112
(defun rust-electric-brace (arg)
1213
(interactive "*P")

branches/auto/src/etc/kate/rust.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
</list>
1818
<list name="keywords">
1919
<item> as </item>
20-
<item> assert </item>
2120
<item> break </item>
2221
<item> const </item>
2322
<item> copy </item>
@@ -69,6 +68,7 @@
6968
<item> Shl </item>
7069
<item> Shr </item>
7170
<item> Index </item>
71+
<item> Not </item>
7272
</list>
7373
<list name="types">
7474
<item> bool </item>

branches/auto/src/libcore/clone.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,31 @@ impl Clone for () {
1919
#[inline(always)]
2020
fn clone(&self) -> () { () }
2121
}
22+
23+
macro_rules! clone_impl(
24+
($t:ty) => {
25+
impl Clone for $t {
26+
#[inline(always)]
27+
fn clone(&self) -> $t { *self }
28+
}
29+
}
30+
)
31+
32+
clone_impl!(int)
33+
clone_impl!(i8)
34+
clone_impl!(i16)
35+
clone_impl!(i32)
36+
clone_impl!(i64)
37+
38+
clone_impl!(uint)
39+
clone_impl!(u8)
40+
clone_impl!(u16)
41+
clone_impl!(u32)
42+
clone_impl!(u64)
43+
44+
clone_impl!(float)
45+
clone_impl!(f32)
46+
clone_impl!(f64)
47+
48+
clone_impl!(bool)
49+
clone_impl!(char)

branches/auto/src/libcore/core.rc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Implicitly, all crates behave as if they included the following prologue:
5151
#[warn(vecs_implicitly_copyable)];
5252
#[deny(non_camel_case_types)];
5353
#[allow(deprecated_mutable_fields)];
54+
#[deny(deprecated_self)];
5455

5556
// On Linux, link to the runtime with -lrt.
5657
#[cfg(target_os = "linux")]
@@ -142,8 +143,6 @@ pub mod option;
142143
pub mod result;
143144
pub mod either;
144145
pub mod dlist;
145-
#[path="iter-trait.rs"] #[merge = "iter-trait/dlist.rs"]
146-
pub mod dlist_iter;
147146
pub mod hashmap;
148147
pub mod cell;
149148
pub mod trie;

branches/auto/src/libcore/dlist.rs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate.
1818
1919
*/
2020

21+
use iter;
22+
use iter::BaseIter;
2123
use kinds::Copy;
2224
use managed;
2325
use option::{None, Option, Some};
@@ -489,14 +491,54 @@ pub impl<T:Copy> DList<T> {
489491
let mut v = vec::with_capacity(self.size);
490492
unsafe {
491493
// Take this out of the unchecked when iter's functions are pure
492-
for self.eachi |index,data| {
494+
for iter::eachi(&self) |index,data| {
493495
v[index] = *data;
494496
}
495497
}
496498
v
497499
}
498500
}
499501
502+
impl<T> BaseIter<T> for @mut DList<T> {
503+
/**
504+
* Iterates through the current contents.
505+
*
506+
* Attempts to access this dlist during iteration are allowed (to
507+
* allow for e.g. breadth-first search with in-place enqueues), but
508+
* removing the current node is forbidden.
509+
*/
510+
pure fn each(&self, f: fn(v: &T) -> bool) {
511+
let mut link = self.peek_n();
512+
while option::is_some(&link) {
513+
let nobe = option::get(link);
514+
fail_unless!(nobe.linked);
515+
516+
{
517+
let frozen_nobe = &*nobe;
518+
if !f(&frozen_nobe.data) { break; }
519+
}
520+
521+
// Check (weakly) that the user didn't do a remove.
522+
if self.size == 0 {
523+
fail!(~"The dlist became empty during iteration??")
524+
}
525+
if !nobe.linked ||
526+
(!((nobe.prev.is_some()
527+
|| managed::mut_ptr_eq(self.hd.expect(~"headless dlist?"),
528+
nobe))
529+
&& (nobe.next.is_some()
530+
|| managed::mut_ptr_eq(self.tl.expect(~"tailless dlist?"),
531+
nobe)))) {
532+
fail!(~"Removing a dlist node during iteration is forbidden!")
533+
}
534+
link = nobe.next_link();
535+
}
536+
}
537+
538+
#[inline(always)]
539+
pure fn size_hint(&self) -> Option<uint> { Some(self.len()) }
540+
}
541+
500542
#[cfg(test)]
501543
mod tests {
502544
use dlist::{DList, concat, from_vec, new_dlist_node};

branches/auto/src/libcore/iter-trait.rs

Lines changed: 0 additions & 89 deletions
This file was deleted.

branches/auto/src/libcore/iter-trait/dlist.rs

Lines changed: 0 additions & 59 deletions
This file was deleted.

branches/auto/src/libcore/nil.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Functions for the unit type.
1515
*/
1616

1717
#[cfg(notest)]
18-
use cmp::{Eq, Ord, TotalOrd, Ordering, Equal};
18+
use cmp::{Eq, Ord};
1919

2020
#[cfg(notest)]
2121
impl Eq for () {
@@ -37,8 +37,3 @@ impl Ord for () {
3737
pure fn gt(&self, _other: &()) -> bool { false }
3838
}
3939

40-
#[cfg(notest)]
41-
impl TotalOrd for () {
42-
#[inline(always)]
43-
pure fn cmp(&self, _other: &()) -> Ordering { Equal }
44-
}

0 commit comments

Comments
 (0)