Skip to content

Commit 19bb818

Browse files
committed
---
yaml --- r: 48109 b: refs/heads/incoming c: af645e8 h: refs/heads/master i: 48107: de62868 v: v3
1 parent d4addb5 commit 19bb818

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+133
-181
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 39b713f93ede9c5f8d6ef7bbac3e50a64518389c
9+
refs/heads/incoming: af645e848713536ac3c0a0c52de7b4d96f96fbc6
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/compiletest/header.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ pub fn load_props(testfile: &Path) -> TestProps {
5959
pp_exact = parse_pp_exact(ln, testfile);
6060
}
6161

62-
do parse_aux_build(ln).iter |ab| {
62+
for parse_aux_build(ln).each |ab| {
6363
aux_builds.push(*ab);
6464
}
6565

66-
do parse_exec_env(ln).iter |ee| {
66+
for parse_exec_env(ln).each |ee| {
6767
exec_env.push(*ee);
6868
}
6969

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

Lines changed: 12 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE language SYSTEM "language.dtd"
3-
[
4-
<!-- TODO: Kate's regex engine has very limited support for
5-
predefined char classes, so making rustIdent consistent with actual
6-
Rust identifiers will be a bit difficult -->
7-
<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
8-
<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
9-
]>
10-
<language name="Rust" version="0.6" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
2+
<!DOCTYPE language SYSTEM "language.dtd">
3+
<language name="Rust" version="0.4.0" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
114
<highlighting>
125
<list name="fn">
136
<item> fn </item>
@@ -25,7 +18,9 @@
2518
<item> drop </item>
2619
<item> else </item>
2720
<item> enum </item>
21+
<item> export </item>
2822
<item> extern </item>
23+
<item> fail </item>
2924
<item> for </item>
3025
<item> if </item>
3126
<item> impl </item>
@@ -34,6 +29,7 @@
3429
<item> loop </item>
3530
<item> match </item>
3631
<item> mod </item>
32+
<item> move </item>
3733
<item> mut </item>
3834
<item> priv </item>
3935
<item> pub </item>
@@ -47,29 +43,6 @@
4743
<item> use </item>
4844
<item> while </item>
4945
</list>
50-
<list name="traits">
51-
<item> Const </item>
52-
<item> Copy </item>
53-
<item> Send </item>
54-
<item> Owned </item>
55-
<item> Eq </item>
56-
<item> Ord </item>
57-
<item> Num </item>
58-
<item> Ptr </item>
59-
<item> Drop </item>
60-
<item> Add </item>
61-
<item> Sub </item>
62-
<item> Mul </item>
63-
<item> Div </item>
64-
<item> Modulo </item>
65-
<item> Neg </item>
66-
<item> BitAnd </item>
67-
<item> BitOr </item>
68-
<item> BitXor </item>
69-
<item> Shl </item>
70-
<item> Shr </item>
71-
<item> Index </item>
72-
</list>
7346
<list name="types">
7447
<item> bool </item>
7548
<item> int </item>
@@ -90,7 +63,6 @@
9063
<item> Either </item>
9164
<item> Option </item>
9265
<item> Result </item>
93-
<item> Self </item>
9466
</list>
9567
<list name="ctypes">
9668
<item> c_float </item>
@@ -192,33 +164,23 @@
192164
<keyword String="type" attribute="Keyword" context="Type"/>
193165
<keyword String="keywords" attribute="Keyword" context="#stay"/>
194166
<keyword String="types" attribute="Type" context="#stay"/>
195-
<keyword String="traits" attribute="Trait" context="#stay"/>
196167
<keyword String="ctypes" attribute="CType" context="#stay"/>
197168
<keyword String="self" attribute="Self" context="#stay"/>
198169
<keyword String="constants" attribute="Constant" context="#stay"/>
199170
<keyword String="cconstants" attribute="CConstant" context="#stay"/>
200171
<Detect2Chars char="/" char1="/" attribute="Comment" context="Commentar 1"/>
201172
<Detect2Chars char="/" char1="*" attribute="Comment" context="Commentar 2" beginRegion="Comment"/>
202-
<RegExpr String="0x[0-9a-fA-F_]+&rustIntSuf;" attribute="Number" context="#stay"/>
203-
<RegExpr String="0b[0-1_]+&rustIntSuf;" attribute="Number" context="#stay"/>
173+
<RegExpr String="0x[0-9a-fA-F_]+(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?" attribute="Number" context="#stay"/>
174+
<RegExpr String="0b[0-1_]+(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?" attribute="Number" context="#stay"/>
204175
<RegExpr String="[0-9][0-9_]*\.[0-9_]*([eE][+-]?[0-9_]+)?(f32|f64|f)?" attribute="Number" context="#stay"/>
205-
<RegExpr String="[0-9][0-9_]*&rustIntSuf;" attribute="Number" context="#stay"/>
206-
<Detect2Chars char="#" char1="[" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
207-
<RegExpr String="&rustIdent;::" attribute="Scope"/>
208-
<RegExpr String="&rustIdent;!" attribute="Macro"/>
209-
<RegExpr String="&apos;&rustIdent;(?!&apos;)" attribute="Lifetime"/>
176+
<RegExpr String="[0-9][0-9_]*(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?" attribute="Number" context="#stay"/>
177+
<RegExpr String="[a-zA-Z_][a-zA-Z0-9_]*::" attribute="Scope"/>
210178
<DetectChar char="{" attribute="Symbol" context="#stay" beginRegion="Brace" />
211179
<DetectChar char="}" attribute="Symbol" context="#stay" endRegion="Brace" />
212180
<DetectChar char="&quot;" attribute="String" context="String"/>
213181
<DetectChar char="&apos;" attribute="Character" context="Character"/>
214-
<DetectChar char="[" attribute="Symbol" context="#stay" beginRegion="Bracket" />
215-
<DetectChar char="]" attribute="Symbol" context="#stay" endRegion="Bracket" />
216182
<DetectIdentifier/>
217183
</context>
218-
<context attribute="Attribute" lineEndContext="#stay" name="Attribute">
219-
<DetectChar char="]" attribute="Attribute" context="#pop" endRegion="Attribute"/>
220-
<IncludeRules context="Normal"/>
221-
</context>
222184
<context attribute="Definition" lineEndContext="#stay" name="Function">
223185
<DetectSpaces/>
224186
<DetectChar char="(" attribute="Normal Text" context="#pop"/>
@@ -231,20 +193,13 @@
231193
</context>
232194
<context attribute="String" lineEndContext="#stay" name="String">
233195
<LineContinue attribute="String" context="#stay"/>
234-
<DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
196+
<HlCStringChar attribute="String Char" context="#stay"/>
235197
<DetectChar attribute="String" context="#pop" char="&quot;"/>
236198
</context>
237199
<context attribute="Character" lineEndContext="#pop" name="Character">
238-
<DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
200+
<HlCStringChar attribute="Character" context="#stay"/>
239201
<DetectChar attribute="Character" context="#pop" char="&apos;"/>
240202
</context>
241-
<context attribute="CharEscape" lineEndContext="#pop" name="CharEscape">
242-
<AnyChar String="nrt\&apos;&quot;" attribute="CharEscape" context="#pop"/>
243-
<RegExpr String="x[0-9a-fA-F]{2}" attribute="CharEscape" context="#pop"/>
244-
<RegExpr String="u[0-9a-fA-F]{4}" attribute="CharEscape" context="#pop"/>
245-
<RegExpr String="U[0-9a-fA-F]{8}" attribute="CharEscape" context="#pop"/>
246-
<RegExpr String="." attribute="Error" context="#pop"/>
247-
</context>
248203
<context attribute="Comment" lineEndContext="#pop" name="Commentar 1"/>
249204
<context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
250205
<DetectSpaces/>
@@ -256,7 +211,6 @@
256211
<itemData name="Keyword" defStyleNum="dsKeyword" color="#770088" bold="1"/>
257212
<itemData name="Self" defStyleNum="dsKeyword" color="#FF0000" bold="1"/>
258213
<itemData name="Type" defStyleNum="dsKeyword" color="#4e9a06" bold="1"/>
259-
<itemData name="Trait" defStyleNum="dsKeyword" color="#4e9a06" bold="1"/>
260214
<itemData name="CType" defStyleNum="dsNormal" color="#4e9a06"/>
261215
<itemData name="Constant" defStyleNum="dsKeyword" color="#116644"/>
262216
<itemData name="CConstant" defStyleNum="dsNormal" color="#116644"/>
@@ -265,12 +219,8 @@
265219
<itemData name="Scope" defStyleNum="dsNormal" color="#0055AA"/>
266220
<itemData name="Number" defStyleNum="dsDecVal" color="#116644"/>
267221
<itemData name="String" defStyleNum="dsString" color="#FF0000"/>
268-
<itemData name="CharEscape" defStyleNum="dsChar" color="#FF0000" bold="1"/>
222+
<itemData name="String Char" defStyleNum="dsChar" color="#FF0000"/>
269223
<itemData name="Character" defStyleNum="dsChar" color="#FF0000"/>
270-
<itemData name="Macro" defStyleNum="dsOthers"/>
271-
<itemData name="Attribute" defStyleNum="dsOthers"/>
272-
<itemData name="Lifetime" defStyleNum="dsOthers" bold="1"/>
273-
<itemData name="Error" defStyleNum="dsError"/>
274224
</itemDatas>
275225
</highlighting>
276226
<general>

branches/incoming/src/libcore/core.rc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ pub mod container;
132132
/* Common data structures */
133133

134134
pub mod option;
135-
#[path="iter-trait.rs"] #[merge = "iter-trait/option.rs"]
136-
pub mod option_iter;
137135
pub mod result;
138136
pub mod either;
139137
pub mod dvec;

branches/incoming/src/libcore/option.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ use ptr;
4848
use str;
4949
use util;
5050
use num::Zero;
51+
use iter::BaseIter;
5152

5253
/// The option type
5354
#[deriving_eq]
@@ -228,12 +229,6 @@ pub pure fn map_default<T, U>(opt: &r/Option<T>, def: U,
228229
match *opt { None => def, Some(ref t) => f(t) }
229230
}
230231
231-
#[inline(always)]
232-
pub pure fn iter<T>(opt: &r/Option<T>, f: fn(x: &r/T)) {
233-
//! Performs an operation on the contained value by reference
234-
match *opt { None => (), Some(ref t) => f(t) }
235-
}
236-
237232
#[inline(always)]
238233
pub pure fn unwrap<T>(opt: Option<T>) -> T {
239234
/*!
@@ -281,6 +276,19 @@ pub pure fn expect<T>(opt: Option<T>, reason: &str) -> T {
281276
}
282277
}
283278
279+
impl<T> BaseIter<T> for Option<T> {
280+
/// Performs an operation on the contained value by reference
281+
#[inline(always)]
282+
pure fn each(&self, f: fn(x: &self/T) -> bool) {
283+
match *self { None => (), Some(ref t) => { f(t); } }
284+
}
285+
286+
#[inline(always)]
287+
pure fn size_hint(&self) -> Option<uint> {
288+
if self.is_some() { Some(1) } else { Some(0) }
289+
}
290+
}
291+
284292
pub impl<T> Option<T> {
285293
/// Returns true if the option equals `none`
286294
#[inline(always)]
@@ -339,10 +347,6 @@ pub impl<T> Option<T> {
339347
}
340348
}
341349
342-
/// Performs an operation on the contained value by reference
343-
#[inline(always)]
344-
pure fn iter(&self, f: fn(x: &self/T)) { iter(self, f) }
345-
346350
/**
347351
Gets an immutable reference to the value inside an option.
348352
@@ -476,7 +480,7 @@ fn test_option_dance() {
476480
let x = Some(());
477481
let mut y = Some(5);
478482
let mut y2 = 0;
479-
do x.iter |_x| {
483+
for x.each |_x| {
480484
y2 = swap_unwrap(&mut y);
481485
}
482486
assert y2 == 5;

branches/incoming/src/libcore/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ mod tests {
12371237
setenv(~"HOME", ~"");
12381238
assert os::homedir().is_none();
12391239
1240-
oldhome.iter(|s| setenv(~"HOME", *s));
1240+
for oldhome.each |s| { setenv(~"HOME", *s) }
12411241
}
12421242
12431243
#[test]

branches/incoming/src/libcore/task/spawn.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ fn each_ancestor(list: &mut AncestorList,
268268
* Step 3: Maybe unwind; compute return info for our caller.
269269
*##########################################################*/
270270
if need_unwind && !nobe_is_dead {
271-
do bail_opt.iter |bail_blk| {
271+
for bail_opt.each |bail_blk| {
272272
do with_parent_tg(&mut nobe.parent_group) |tg_opt| {
273273
(*bail_blk)(tg_opt)
274274
}
@@ -317,7 +317,7 @@ impl Drop for TCB {
317317
unsafe {
318318
// If we are failing, the whole taskgroup needs to die.
319319
if rt::rust_task_is_unwinding(self.me) {
320-
self.notifier.iter(|x| { x.failed = true; });
320+
for self.notifier.each |x| { x.failed = true; }
321321
// Take everybody down with us.
322322
do access_group(&self.tasks) |tg| {
323323
kill_taskgroup(tg, self.me, self.is_main);
@@ -341,9 +341,7 @@ impl Drop for TCB {
341341

342342
fn TCB(me: *rust_task, tasks: TaskGroupArc, ancestors: AncestorList,
343343
is_main: bool, notifier: Option<AutoNotify>) -> TCB {
344-
345-
let notifier = notifier;
346-
notifier.iter(|x| { x.failed = false; });
344+
for notifier.each |x| { x.failed = false; }
347345

348346
TCB {
349347
me: me,

branches/incoming/src/librustc/metadata/encoder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
715715
let idx = encode_info_for_struct(ecx, ebml_w, path,
716716
struct_def.fields, index);
717717
/* Encode the dtor */
718-
do struct_def.dtor.iter |dtor| {
718+
for struct_def.dtor.each |dtor| {
719719
index.push(entry {val: dtor.node.id, pos: ebml_w.writer.tell()});
720720
encode_info_for_ctor(ecx,
721721
ebml_w,
@@ -767,7 +767,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
767767
encode_region_param(ecx, ebml_w, item);
768768
/* Encode the dtor */
769769
/* Encode id for dtor */
770-
do struct_def.dtor.iter |dtor| {
770+
for struct_def.dtor.each |dtor| {
771771
do ebml_w.wr_tag(tag_item_dtor) {
772772
encode_def_id(ebml_w, local_def(dtor.node.id));
773773
}
@@ -821,7 +821,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
821821
ebml_w.writer.write(str::to_bytes(def_to_str(method_def_id)));
822822
ebml_w.end_tag();
823823
}
824-
do opt_trait.iter() |associated_trait| {
824+
for opt_trait.each |associated_trait| {
825825
encode_trait_ref(ebml_w, ecx, *associated_trait);
826826
}
827827
encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident));

0 commit comments

Comments
 (0)