diff options
| author | Michael Sullivan <sully@msully.net> | 2012-07-12 15:03:33 -0700 |
|---|---|---|
| committer | Michael Sullivan <sully@msully.net> | 2012-07-13 17:03:49 -0700 |
| commit | 985b52be6df504ce6dcef29df61ea20ab9c9323f (patch) | |
| tree | a39c70608818cb99dce14da30f67fa9aff9f0e58 /src/rustc/front | |
| parent | e4de1602226315fcb7ee3b1d7f925b5c361f001d (diff) | |
| download | rust-985b52be6df504ce6dcef29df61ea20ab9c9323f.tar.gz rust-985b52be6df504ce6dcef29df61ea20ab9c9323f.zip | |
Support prefix notation for vstore strings. Closes #2906.
Diffstat (limited to 'src/rustc/front')
| -rw-r--r-- | src/rustc/front/core_inject.rs | 4 | ||||
| -rw-r--r-- | src/rustc/front/test.rs | 35 |
2 files changed, 21 insertions, 18 deletions
diff --git a/src/rustc/front/core_inject.rs b/src/rustc/front/core_inject.rs index 446e0f25fae..c16fbabdcce 100644 --- a/src/rustc/front/core_inject.rs +++ b/src/rustc/front/core_inject.rs @@ -30,11 +30,11 @@ fn inject_libcore_ref(sess: session, let n1 = sess.next_node_id(); let n2 = sess.next_node_id(); - let vi1 = @{node: ast::view_item_use(@"core", ~[], n1), + let vi1 = @{node: ast::view_item_use(@"core"/~, ~[], n1), attrs: ~[], vis: ast::public, span: dummy_sp()}; - let vp = spanned(ast::view_path_glob(ident_to_path(dummy_sp(), @"core"), + let vp = spanned(ast::view_path_glob(ident_to_path(dummy_sp(), @"core"/~), n2)); let vi2 = @{node: ast::view_item_import(~[vp]), attrs: ~[], diff --git a/src/rustc/front/test.rs b/src/rustc/front/test.rs index 44d68a3fcd9..dfc6286055a 100644 --- a/src/rustc/front/test.rs +++ b/src/rustc/front/test.rs @@ -192,9 +192,9 @@ fn mk_test_module(cx: test_ctxt) -> @ast::item { let item_ = ast::item_mod(testmod); // This attribute tells resolve to let us call unexported functions let resolve_unexported_attr = - attr::mk_attr(attr::mk_word_item(@"!resolve_unexported")); + attr::mk_attr(attr::mk_word_item(@"!resolve_unexported"/~)); let item: ast::item = - {ident: @"__test", + {ident: @"__test"/~, attrs: ~[resolve_unexported_attr], id: cx.sess.next_node_id(), node: item_, @@ -233,7 +233,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item { let item_ = ast::item_fn(decl, ~[], body); let item: ast::item = - {ident: @"tests", + {ident: @"tests"/~, attrs: ~[], id: cx.sess.next_node_id(), node: item_, @@ -248,17 +248,18 @@ fn mk_path(cx: test_ctxt, path: ~[ast::ident]) -> ~[ast::ident] { let is_std = { let items = attr::find_linkage_metas(cx.crate.node.attrs); alt attr::last_meta_item_value_str_by_name(items, "name") { - some(@"std") { true } + some(@"std"/~) { true } _ { false } } }; if is_std { path } - else { vec::append(~[@"std"], path) } + else { vec::append(~[@"std"/~], path) } } // The ast::ty of ~[std::test::test_desc] fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::ty { - let test_desc_ty_path = path_node(mk_path(cx, ~[@"test", @"test_desc"])); + let test_desc_ty_path = + path_node(mk_path(cx, ~[@"test"/~, @"test_desc"/~])); let test_desc_ty: ast::ty = {id: cx.sess.next_node_id(), @@ -307,7 +308,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { span: span}; let name_field: ast::field = - nospan({mutbl: ast::m_imm, ident: @"name", expr: @name_expr}); + nospan({mutbl: ast::m_imm, ident: @"name"/~, expr: @name_expr}); let fn_path = path_node(path); @@ -320,7 +321,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_field: ast::field = - nospan({mutbl: ast::m_imm, ident: @"fn", expr: fn_wrapper_expr}); + nospan({mutbl: ast::m_imm, ident: @"fn"/~, expr: fn_wrapper_expr}); let ignore_lit: ast::lit = nospan(ast::lit_bool(test.ignore)); @@ -331,7 +332,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { span: span}; let ignore_field: ast::field = - nospan({mutbl: ast::m_imm, ident: @"ignore", expr: @ignore_expr}); + nospan({mutbl: ast::m_imm, ident: @"ignore"/~, expr: @ignore_expr}); let fail_lit: ast::lit = nospan(ast::lit_bool(test.should_fail)); @@ -342,7 +343,9 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { span: span}; let fail_field: ast::field = - nospan({mutbl: ast::m_imm, ident: @"should_fail", expr: @fail_expr}); + nospan({mutbl: ast::m_imm, + ident: @"should_fail"/~, + expr: @fail_expr}); let desc_rec_: ast::expr_ = ast::expr_rec(~[name_field, fn_field, ignore_field, fail_field], @@ -397,7 +400,7 @@ fn mk_test_wrapper(cx: test_ctxt, } fn mk_main(cx: test_ctxt) -> @ast::item { - let str_pt = path_node(~[@"str"]); + let str_pt = path_node(~[@"str"/~]); let str_ty = @{id: cx.sess.next_node_id(), node: ast::ty_path(str_pt, cx.sess.next_node_id()), span: dummy_sp()}; @@ -413,7 +416,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item { let args_arg: ast::arg = {mode: ast::expl(ast::by_val), ty: @args_ty, - ident: @"args", + ident: @"args"/~, id: cx.sess.next_node_id()}; let ret_ty = {id: cx.sess.next_node_id(), @@ -436,7 +439,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item { let item_ = ast::item_fn(decl, ~[], body); let item: ast::item = - {ident: @"main", + {ident: @"main"/~, attrs: ~[], id: cx.sess.next_node_id(), node: item_, @@ -448,7 +451,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item { fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { // Get the args passed to main so we can pass the to test_main - let args_path = path_node(~[@"args"]); + let args_path = path_node(~[@"args"/~]); let args_path_expr_: ast::expr_ = ast::expr_path(args_path); @@ -457,7 +460,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { node: args_path_expr_, span: dummy_sp()}; // Call __test::test to generate the vector of test_descs - let test_path = path_node(~[@"tests"]); + let test_path = path_node(~[@"tests"/~]); let test_path_expr_: ast::expr_ = ast::expr_path(test_path); @@ -472,7 +475,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { node: test_call_expr_, span: dummy_sp()}; // Call std::test::test_main - let test_main_path = path_node(mk_path(cx, ~[@"test", @"test_main"])); + let test_main_path = path_node(mk_path(cx, ~[@"test"/~, @"test_main"/~])); let test_main_path_expr_: ast::expr_ = ast::expr_path(test_main_path); |
