Skip to content

Commit 1458efc

Browse files
committed
---
yaml --- r: 20771 b: refs/heads/snap-stage3 c: 7b2026b h: refs/heads/master i: 20769: ed6b5ad 20767: 557cb4a v: v3
1 parent e1de8ea commit 1458efc

File tree

22 files changed

+350
-320
lines changed

22 files changed

+350
-320
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 7d18369804f23cd04d10f33e420fbcdc8ea76ecf
4+
refs/heads/snap-stage3: 7b2026bf218c416c653faf8bb8cca770d0bb2c0d
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/cargo/cargo.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -600,21 +600,21 @@ fn load_source_packages(c: cargo, src: source) {
600600
}
601601

602602
fn build_cargo_options(argv: ~[~str]) -> options {
603-
let match = alt getopts::getopts(argv, opts()) {
603+
let matches = alt getopts::getopts(argv, opts()) {
604604
result::ok(m) { m }
605605
result::err(f) {
606606
fail fmt!{"%s", getopts::fail_str(f)};
607607
}
608608
};
609609

610-
let test = opt_present(match, ~"test");
611-
let G = opt_present(match, ~"G");
612-
let g = opt_present(match, ~"g");
613-
let help = opt_present(match, ~"h") || opt_present(match, ~"help");
614-
let len = vec::len(match.free);
610+
let test = opt_present(matches, ~"test");
611+
let G = opt_present(matches, ~"G");
612+
let g = opt_present(matches, ~"g");
613+
let help = opt_present(matches, ~"h") || opt_present(matches, ~"help");
614+
let len = vec::len(matches.free);
615615

616-
let is_install = len > 1u && match.free[1] == ~"install";
617-
let is_uninstall = len > 1u && match.free[1] == ~"uninstall";
616+
let is_install = len > 1u && matches.free[1] == ~"install";
617+
let is_uninstall = len > 1u && matches.free[1] == ~"uninstall";
618618

619619
if G && g { fail ~"-G and -g both provided"; }
620620

@@ -627,7 +627,7 @@ fn build_cargo_options(argv: ~[~str]) -> options {
627627
else if G { system_mode }
628628
else { local_mode };
629629

630-
{test: test, mode: mode, free: match.free, help: help}
630+
{test: test, mode: mode, free: matches.free, help: help}
631631
}
632632

633633
fn configure(opts: options) -> cargo {

branches/snap-stage3/src/compiletest/compiletest.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,29 @@ fn parse_config(args: ~[~str]) -> config {
4141

4242
assert (vec::is_not_empty(args));
4343
let args_ = vec::tail(args);
44-
let match =
44+
let matches =
4545
alt getopts::getopts(args_, opts) {
4646
ok(m) { m }
4747
err(f) { fail getopts::fail_str(f) }
4848
};
4949

50-
ret {compile_lib_path: getopts::opt_str(match, ~"compile-lib-path"),
51-
run_lib_path: getopts::opt_str(match, ~"run-lib-path"),
52-
rustc_path: getopts::opt_str(match, ~"rustc-path"),
53-
src_base: getopts::opt_str(match, ~"src-base"),
54-
build_base: getopts::opt_str(match, ~"build-base"),
55-
aux_base: getopts::opt_str(match, ~"aux-base"),
56-
stage_id: getopts::opt_str(match, ~"stage-id"),
57-
mode: str_mode(getopts::opt_str(match, ~"mode")),
58-
run_ignored: getopts::opt_present(match, ~"ignored"),
50+
ret {compile_lib_path: getopts::opt_str(matches, ~"compile-lib-path"),
51+
run_lib_path: getopts::opt_str(matches, ~"run-lib-path"),
52+
rustc_path: getopts::opt_str(matches, ~"rustc-path"),
53+
src_base: getopts::opt_str(matches, ~"src-base"),
54+
build_base: getopts::opt_str(matches, ~"build-base"),
55+
aux_base: getopts::opt_str(matches, ~"aux-base"),
56+
stage_id: getopts::opt_str(matches, ~"stage-id"),
57+
mode: str_mode(getopts::opt_str(matches, ~"mode")),
58+
run_ignored: getopts::opt_present(matches, ~"ignored"),
5959
filter:
60-
if vec::len(match.free) > 0u {
61-
option::some(match.free[0])
60+
if vec::len(matches.free) > 0u {
61+
option::some(matches.free[0])
6262
} else { option::none },
63-
logfile: getopts::opt_maybe_str(match, ~"logfile"),
64-
runtool: getopts::opt_maybe_str(match, ~"runtool"),
65-
rustcflags: getopts::opt_maybe_str(match, ~"rustcflags"),
66-
verbose: getopts::opt_present(match, ~"verbose")};
63+
logfile: getopts::opt_maybe_str(matches, ~"logfile"),
64+
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
65+
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
66+
verbose: getopts::opt_present(matches, ~"verbose")};
6767
}
6868

6969
fn log_config(config: config) {

branches/snap-stage3/src/libcore/dvec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl private_methods<A> for dvec<A> {
9797
}
9898

9999
#[inline(always)]
100-
fn return(-data: ~[mut A]) {
100+
fn give_back(-data: ~[mut A]) {
101101
unsafe {
102102
self.data <- data;
103103
}
@@ -120,15 +120,15 @@ impl extensions<A> for dvec<A> {
120120
*/
121121
#[inline(always)]
122122
fn swap(f: fn(-~[mut A]) -> ~[mut A]) {
123-
self.borrow(|v| self.return(f(v)))
123+
self.borrow(|v| self.give_back(f(v)))
124124
}
125125

126126
/// Returns the number of elements currently in the dvec
127127
pure fn len() -> uint {
128128
unchecked {
129129
do self.borrow |v| {
130130
let l = v.len();
131-
self.return(v);
131+
self.give_back(v);
132132
l
133133
}
134134
}
@@ -145,7 +145,7 @@ impl extensions<A> for dvec<A> {
145145
do self.borrow |v| {
146146
let mut v <- v;
147147
let result = vec::pop(v);
148-
self.return(v);
148+
self.give_back(v);
149149
result
150150
}
151151
}
@@ -175,7 +175,7 @@ impl extensions<A> for dvec<A> {
175175
do self.borrow |v| {
176176
let mut v = vec::from_mut(v);
177177
let result = vec::shift(v);
178-
self.return(vec::to_mut(v));
178+
self.give_back(vec::to_mut(v));
179179
result
180180
}
181181
}
@@ -247,7 +247,7 @@ impl extensions<A:copy> for dvec<A> {
247247
unchecked {
248248
do self.borrow |v| {
249249
let w = vec::from_mut(copy v);
250-
self.return(v);
250+
self.give_back(v);
251251
w
252252
}
253253
}

branches/snap-stage3/src/libstd/list.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,18 @@ mod tests {
192192

193193
#[test]
194194
fn test_find_success() {
195-
fn match(&&i: int) -> bool { ret i == 2; }
195+
fn match_(&&i: int) -> bool { ret i == 2; }
196196
let l = from_vec(~[0, 1, 2]);
197-
assert (list::find(l, match) == option::some(2));
197+
assert (list::find(l, match_) == option::some(2));
198198
}
199199

200200
#[test]
201201
fn test_find_fail() {
202-
fn match(&&_i: int) -> bool { ret false; }
202+
fn match_(&&_i: int) -> bool { ret false; }
203203
let l = from_vec(~[0, 1, 2]);
204204
let empty = @list::nil::<int>;
205-
assert (list::find(l, match) == option::none::<int>);
206-
assert (list::find(empty, match) == option::none::<int>);
205+
assert (list::find(l, match_) == option::none::<int>);
206+
assert (list::find(empty, match_) == option::none::<int>);
207207
}
208208

209209
#[test]

branches/snap-stage3/src/libstd/test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ type opt_res = either<test_opts, ~str>;
6868
fn parse_opts(args: ~[~str]) -> opt_res {
6969
let args_ = vec::tail(args);
7070
let opts = ~[getopts::optflag(~"ignored"), getopts::optopt(~"logfile")];
71-
let match =
71+
let matches =
7272
alt getopts::getopts(args_, opts) {
7373
ok(m) { m }
7474
err(f) { ret either::right(getopts::fail_str(f)) }
7575
};
7676

7777
let filter =
78-
if vec::len(match.free) > 0u {
79-
option::some(match.free[0])
78+
if vec::len(matches.free) > 0u {
79+
option::some(matches.free[0])
8080
} else { option::none };
8181

82-
let run_ignored = getopts::opt_present(match, ~"ignored");
83-
let logfile = getopts::opt_maybe_str(match, ~"logfile");
82+
let run_ignored = getopts::opt_present(matches, ~"ignored");
83+
let logfile = getopts::opt_maybe_str(matches, ~"logfile");
8484

8585
let test_opts = {filter: filter, run_ignored: run_ignored,
8686
logfile: logfile};

branches/snap-stage3/src/libsyntax/ext/expand.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ fn expand_expr(exts: hashmap<~str, syntax_extension>, cx: ext_ctxt,
129129
// NB: there is some redundancy between this and expand_item, below, and
130130
// they might benefit from some amount of semantic and language-UI merger.
131131
fn expand_mod_items(exts: hashmap<~str, syntax_extension>, cx: ext_ctxt,
132-
module: ast::_mod, fld: ast_fold,
132+
module_: ast::_mod, fld: ast_fold,
133133
orig: fn@(ast::_mod, ast_fold) -> ast::_mod)
134134
-> ast::_mod
135135
{
136136
// Fold the contents first:
137-
let module = orig(module, fld);
137+
let module_ = orig(module_, fld);
138138

139139
// For each item, look through the attributes. If any of them are
140140
// decorated with "item decorators", then use that function to transform
141141
// the item into a new set of items.
142-
let new_items = do vec::flat_map(module.items) |item| {
142+
let new_items = do vec::flat_map(module_.items) |item| {
143143
do vec::foldr(item.attrs, ~[item]) |attr, items| {
144144
let mname = alt attr.node.value.node {
145145
ast::meta_word(n) { n }
@@ -159,7 +159,7 @@ fn expand_mod_items(exts: hashmap<~str, syntax_extension>, cx: ext_ctxt,
159159
}
160160
};
161161

162-
ret {items: new_items with module};
162+
ret {items: new_items with module_};
163163
}
164164

165165

branches/snap-stage3/src/libsyntax/parse/parser.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ class parser {
789789
ret pexpr(self.parse_while_expr());
790790
} else if self.eat_keyword(~"loop") {
791791
ret pexpr(self.parse_loop_expr());
792-
} else if self.eat_keyword(~"alt") {
792+
} else if self.eat_keyword(~"alt") || self.eat_keyword(~"match") {
793793
ret pexpr(self.parse_alt_expr());
794794
} else if self.eat_keyword(~"fn") {
795795
let proto = self.parse_fn_ty_proto();
@@ -838,7 +838,7 @@ class parser {
838838
let e = self.parse_expr();
839839
ex = expr_assert(e);
840840
hi = e.span.hi;
841-
} else if self.eat_keyword(~"ret") {
841+
} else if self.eat_keyword(~"ret") || self.eat_keyword(~"return") {
842842
if can_begin_expr(self.token) {
843843
let e = self.parse_expr();
844844
hi = e.span.hi;
@@ -2569,7 +2569,11 @@ class parser {
25692569
}
25702570

25712571
fn parse_item_foreign_mod() -> item_info {
2572-
self.expect_keyword(~"mod");
2572+
if self.is_keyword(~"mod") {
2573+
self.expect_keyword(~"mod");
2574+
} else {
2575+
self.expect_keyword(~"module");
2576+
}
25732577
let id = self.parse_ident();
25742578
self.expect(token::LBRACE);
25752579
let more_attrs = self.parse_inner_attrs_and_next();
@@ -2714,7 +2718,7 @@ class parser {
27142718
} else {
27152719
self.parse_item_foreign_mod()
27162720
}
2717-
} else if self.eat_keyword(~"mod") {
2721+
} else if self.eat_keyword(~"mod") || self.eat_keyword(~"module") {
27182722
self.parse_item_mod()
27192723
} else if self.eat_keyword(~"type") {
27202724
self.parse_item_type()
@@ -2919,8 +2923,14 @@ class parser {
29192923
let expect_mod = vec::len(outer_attrs) > 0u;
29202924

29212925
let lo = self.span.lo;
2922-
if expect_mod || self.is_keyword(~"mod") {
2923-
self.expect_keyword(~"mod");
2926+
if expect_mod || self.is_keyword(~"mod") ||
2927+
self.is_keyword(~"module") {
2928+
2929+
if self.is_keyword(~"mod") {
2930+
self.expect_keyword(~"mod");
2931+
} else {
2932+
self.expect_keyword(~"module");
2933+
}
29242934
let id = self.parse_ident();
29252935
alt self.token {
29262936
// mod x = "foo.rs";
@@ -2958,7 +2968,11 @@ class parser {
29582968
// accept seeing the terminator next, so if we do see it then fail the
29592969
// same way parse_crate_directive would
29602970
if vec::len(first_outer_attr) > 0u && self.token == term {
2961-
self.expect_keyword(~"mod");
2971+
if self.is_keyword(~"mod") {
2972+
self.expect_keyword(~"mod");
2973+
} else {
2974+
self.expect_keyword(~"module");
2975+
}
29622976
}
29632977

29642978
let mut cdirs: ~[@crate_directive] = ~[];

branches/snap-stage3/src/libsyntax/parse/token.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,11 @@ fn restricted_keyword_table() -> hashmap<~str, ()> {
327327
~"fail", ~"false", ~"fn", ~"for",
328328
~"if", ~"iface", ~"impl", ~"import",
329329
~"let", ~"log", ~"loop",
330-
~"mod", ~"mut",
330+
~"match", ~"mod", ~"module", ~"mut",
331331
~"new",
332332
~"owned",
333333
~"pure",
334-
~"ret",
334+
~"ret", ~"return",
335335
~"struct",
336336
~"true", ~"trait", ~"type",
337337
~"unchecked", ~"unsafe",

0 commit comments

Comments
 (0)