Promote 'const', 'copy', 'fn' to strict keywords
This commit is contained in:
parent
7eb10c4ce1
commit
7568dd4564
5 changed files with 22 additions and 18 deletions
|
@ -174,7 +174,7 @@ fn make_test(config: config, testfile: &Path) ->
|
||||||
test::TestDesc {
|
test::TestDesc {
|
||||||
{
|
{
|
||||||
name: make_test_name(config, testfile),
|
name: make_test_name(config, testfile),
|
||||||
fn: make_test_closure(config, testfile),
|
testfn: make_test_closure(config, testfile),
|
||||||
ignore: header::is_test_ignored(config, testfile),
|
ignore: header::is_test_ignored(config, testfile),
|
||||||
should_fail: false
|
should_fail: false
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ type TestFn = fn~();
|
||||||
// these.
|
// these.
|
||||||
type TestDesc = {
|
type TestDesc = {
|
||||||
name: TestName,
|
name: TestName,
|
||||||
fn: TestFn,
|
testfn: TestFn,
|
||||||
ignore: bool,
|
ignore: bool,
|
||||||
should_fail: bool
|
should_fail: bool
|
||||||
};
|
};
|
||||||
|
@ -238,14 +238,14 @@ fn should_sort_failures_before_printing_them() {
|
||||||
|
|
||||||
let test_a = {
|
let test_a = {
|
||||||
name: ~"a",
|
name: ~"a",
|
||||||
fn: fn~() { },
|
testfn: fn~() { },
|
||||||
ignore: false,
|
ignore: false,
|
||||||
should_fail: false
|
should_fail: false
|
||||||
};
|
};
|
||||||
|
|
||||||
let test_b = {
|
let test_b = {
|
||||||
name: ~"b",
|
name: ~"b",
|
||||||
fn: fn~() { },
|
testfn: fn~() { },
|
||||||
ignore: false,
|
ignore: false,
|
||||||
should_fail: false
|
should_fail: false
|
||||||
};
|
};
|
||||||
|
@ -367,7 +367,7 @@ fn filter_tests(opts: TestOpts,
|
||||||
fn filter(test: TestDesc) -> Option<TestDesc> {
|
fn filter(test: TestDesc) -> Option<TestDesc> {
|
||||||
if test.ignore {
|
if test.ignore {
|
||||||
return option::Some({name: test.name,
|
return option::Some({name: test.name,
|
||||||
fn: copy test.fn,
|
testfn: copy test.testfn,
|
||||||
ignore: false,
|
ignore: false,
|
||||||
should_fail: test.should_fail});
|
should_fail: test.should_fail});
|
||||||
} else { return option::None; }
|
} else { return option::None; }
|
||||||
|
@ -396,7 +396,7 @@ fn run_test(+test: TestDesc, monitor_ch: comm::Chan<MonitorMsg>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
do task::spawn |move test| {
|
do task::spawn |move test| {
|
||||||
let testfn = copy test.fn;
|
let testfn = copy test.testfn;
|
||||||
let mut result_future = None; // task::future_result(builder);
|
let mut result_future = None; // task::future_result(builder);
|
||||||
task::task().unlinked().future_result(|+r| {
|
task::task().unlinked().future_result(|+r| {
|
||||||
result_future = Some(move r);
|
result_future = Some(move r);
|
||||||
|
@ -425,7 +425,7 @@ mod tests {
|
||||||
fn f() { fail; }
|
fn f() { fail; }
|
||||||
let desc = {
|
let desc = {
|
||||||
name: ~"whatever",
|
name: ~"whatever",
|
||||||
fn: f,
|
testfn: f,
|
||||||
ignore: true,
|
ignore: true,
|
||||||
should_fail: false
|
should_fail: false
|
||||||
};
|
};
|
||||||
|
@ -441,7 +441,7 @@ mod tests {
|
||||||
fn f() { }
|
fn f() { }
|
||||||
let desc = {
|
let desc = {
|
||||||
name: ~"whatever",
|
name: ~"whatever",
|
||||||
fn: f,
|
testfn: f,
|
||||||
ignore: true,
|
ignore: true,
|
||||||
should_fail: false
|
should_fail: false
|
||||||
};
|
};
|
||||||
|
@ -458,7 +458,7 @@ mod tests {
|
||||||
fn f() { fail; }
|
fn f() { fail; }
|
||||||
let desc = {
|
let desc = {
|
||||||
name: ~"whatever",
|
name: ~"whatever",
|
||||||
fn: f,
|
testfn: f,
|
||||||
ignore: false,
|
ignore: false,
|
||||||
should_fail: true
|
should_fail: true
|
||||||
};
|
};
|
||||||
|
@ -474,7 +474,7 @@ mod tests {
|
||||||
fn f() { }
|
fn f() { }
|
||||||
let desc = {
|
let desc = {
|
||||||
name: ~"whatever",
|
name: ~"whatever",
|
||||||
fn: f,
|
testfn: f,
|
||||||
ignore: false,
|
ignore: false,
|
||||||
should_fail: true
|
should_fail: true
|
||||||
};
|
};
|
||||||
|
@ -513,8 +513,10 @@ mod tests {
|
||||||
let opts = {filter: option::None, run_ignored: true,
|
let opts = {filter: option::None, run_ignored: true,
|
||||||
logfile: option::None};
|
logfile: option::None};
|
||||||
let tests =
|
let tests =
|
||||||
~[{name: ~"1", fn: fn~() { }, ignore: true, should_fail: false},
|
~[{name: ~"1", testfn: fn~() { },
|
||||||
{name: ~"2", fn: fn~() { }, ignore: false, should_fail: false}];
|
ignore: true, should_fail: false},
|
||||||
|
{name: ~"2", testfn: fn~() { },
|
||||||
|
ignore: false, should_fail: false}];
|
||||||
let filtered = filter_tests(opts, tests);
|
let filtered = filter_tests(opts, tests);
|
||||||
|
|
||||||
assert (vec::len(filtered) == 1u);
|
assert (vec::len(filtered) == 1u);
|
||||||
|
@ -539,7 +541,7 @@ mod tests {
|
||||||
let testfn = fn~() { };
|
let testfn = fn~() { };
|
||||||
let mut tests = ~[];
|
let mut tests = ~[];
|
||||||
for vec::each(names) |name| {
|
for vec::each(names) |name| {
|
||||||
let test = {name: name, fn: copy testfn, ignore: false,
|
let test = {name: name, testfn: copy testfn, ignore: false,
|
||||||
should_fail: false};
|
should_fail: false};
|
||||||
tests += ~[test];
|
tests += ~[test];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2329,7 +2329,9 @@ impl parser {
|
||||||
| ~"owned" => {
|
| ~"owned" => {
|
||||||
self.obsolete(copy self.span,
|
self.obsolete(copy self.span,
|
||||||
ObsoleteLowerCaseKindBounds);
|
ObsoleteLowerCaseKindBounds);
|
||||||
None
|
// Bogus value, but doesn't matter, since
|
||||||
|
// is an error
|
||||||
|
Some(bound_send)
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => None
|
_ => None
|
||||||
|
|
|
@ -414,8 +414,7 @@ fn temporary_keyword_table() -> HashMap<~str, ()> {
|
||||||
fn restricted_keyword_table() -> HashMap<~str, ()> {
|
fn restricted_keyword_table() -> HashMap<~str, ()> {
|
||||||
let words = str_hash();
|
let words = str_hash();
|
||||||
let keys = ~[
|
let keys = ~[
|
||||||
~"const", ~"copy",
|
~"fail",
|
||||||
~"fail", ~"fn",
|
|
||||||
~"unsafe"
|
~"unsafe"
|
||||||
];
|
];
|
||||||
for keys.each |word| {
|
for keys.each |word| {
|
||||||
|
@ -430,9 +429,10 @@ fn strict_keyword_table() -> HashMap<~str, ()> {
|
||||||
let keys = ~[
|
let keys = ~[
|
||||||
~"as", ~"assert",
|
~"as", ~"assert",
|
||||||
~"break",
|
~"break",
|
||||||
|
~"const", ~"copy",
|
||||||
~"do", ~"drop",
|
~"do", ~"drop",
|
||||||
~"else", ~"enum", ~"export", ~"extern",
|
~"else", ~"enum", ~"export", ~"extern",
|
||||||
~"false", ~"for",
|
~"false", ~"fn", ~"for",
|
||||||
~"if", ~"impl",
|
~"if", ~"impl",
|
||||||
~"let", ~"log", ~"loop",
|
~"let", ~"log", ~"loop",
|
||||||
~"match", ~"mod", ~"move", ~"mut",
|
~"match", ~"mod", ~"move", ~"mut",
|
||||||
|
|
|
@ -335,7 +335,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
|
||||||
let fn_wrapper_expr = mk_test_wrapper(cx, fn_expr, span);
|
let fn_wrapper_expr = mk_test_wrapper(cx, fn_expr, span);
|
||||||
|
|
||||||
let fn_field: ast::field =
|
let fn_field: ast::field =
|
||||||
nospan({mutbl: ast::m_imm, ident: cx.sess.ident_of(~"fn"),
|
nospan({mutbl: ast::m_imm, ident: cx.sess.ident_of(~"testfn"),
|
||||||
expr: fn_wrapper_expr});
|
expr: fn_wrapper_expr});
|
||||||
|
|
||||||
let ignore_lit: ast::lit = nospan(ast::lit_bool(test.ignore));
|
let ignore_lit: ast::lit = nospan(ast::lit_bool(test.ignore));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue