diff options
| author | Michael Sullivan <sully@msully.net> | 2012-07-13 22:57:48 -0700 |
|---|---|---|
| committer | Michael Sullivan <sully@msully.net> | 2012-07-14 01:03:43 -0700 |
| commit | 92743dc2a6a14d042d4b278e4a4dde5ca198c886 (patch) | |
| tree | 2626211c99906387257880f127f96fee66a0bb4e /src/rustc/front | |
| parent | 5c5065e8bdd1a7b28810fea4b940577ff17c112c (diff) | |
Move the world over to using the new style string literals and types. Closes #2907.
Diffstat (limited to 'src/rustc/front')
| -rw-r--r-- | src/rustc/front/config.rs | 2 | ||||
| -rw-r--r-- | src/rustc/front/core_inject.rs | 6 | ||||
| -rw-r--r-- | src/rustc/front/intrinsic.rs | 8 | ||||
| -rw-r--r-- | src/rustc/front/intrinsic_inject.rs | 4 | ||||
| -rw-r--r-- | src/rustc/front/test.rs | 46 |
5 files changed, 33 insertions, 33 deletions
diff --git a/src/rustc/front/config.rs b/src/rustc/front/config.rs index a044b45b3ae..c633cf5d2af 100644 --- a/src/rustc/front/config.rs +++ b/src/rustc/front/config.rs @@ -125,7 +125,7 @@ fn in_cfg(cfg: ast::crate_cfg, attrs: ~[ast::attribute]) -> bool { fn metas_in_cfg(cfg: ast::crate_cfg, metas: ~[@ast::meta_item]) -> bool { // The "cfg" attributes on the item - let cfg_metas = attr::find_meta_items_by_name(metas, "cfg"); + let cfg_metas = attr::find_meta_items_by_name(metas, ~"cfg"); // Pull the inner meta_items from the #[cfg(meta_item, ...)] attributes, // so we can match against them. This is the list of configurations for diff --git a/src/rustc/front/core_inject.rs b/src/rustc/front/core_inject.rs index c16fbabdcce..24b1a8094e3 100644 --- a/src/rustc/front/core_inject.rs +++ b/src/rustc/front/core_inject.rs @@ -16,7 +16,7 @@ fn maybe_inject_libcore_ref(sess: session, } fn use_core(crate: @ast::crate) -> bool { - !attr::attrs_contains_name(crate.node.attrs, "no_core") + !attr::attrs_contains_name(crate.node.attrs, ~"no_core") } fn inject_libcore_ref(sess: session, @@ -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/intrinsic.rs b/src/rustc/front/intrinsic.rs index 21d8777e22d..7f2e11ecccd 100644 --- a/src/rustc/front/intrinsic.rs +++ b/src/rustc/front/intrinsic.rs @@ -64,14 +64,14 @@ mod intrinsic { fn visit_enter_rec(n_fields: uint, sz: uint, align: uint) -> bool; - fn visit_rec_field(i: uint, name: str/&, + fn visit_rec_field(i: uint, name: &str, mtbl: uint, inner: *tydesc) -> bool; fn visit_leave_rec(n_fields: uint, sz: uint, align: uint) -> bool; fn visit_enter_class(n_fields: uint, sz: uint, align: uint) -> bool; - fn visit_class_field(i: uint, name: str/&, + fn visit_class_field(i: uint, name: &str, mtbl: uint, inner: *tydesc) -> bool; fn visit_leave_class(n_fields: uint, sz: uint, align: uint) -> bool; @@ -87,12 +87,12 @@ mod intrinsic { fn visit_enter_enum_variant(variant: uint, disr_val: int, n_fields: uint, - name: str/&) -> bool; + name: &str) -> bool; fn visit_enum_variant_field(i: uint, inner: *tydesc) -> bool; fn visit_leave_enum_variant(variant: uint, disr_val: int, n_fields: uint, - name: str/&) -> bool; + name: &str) -> bool; fn visit_leave_enum(n_variants: uint, sz: uint, align: uint) -> bool; diff --git a/src/rustc/front/intrinsic_inject.rs b/src/rustc/front/intrinsic_inject.rs index 9f2741804bf..ea841c0700c 100644 --- a/src/rustc/front/intrinsic_inject.rs +++ b/src/rustc/front/intrinsic_inject.rs @@ -9,7 +9,7 @@ fn inject_intrinsic(sess: session, let intrinsic_module = @#include_str("intrinsic.rs"); - let item = parse::parse_item_from_source_str("<intrinsic>", + let item = parse::parse_item_from_source_str(~"<intrinsic>", intrinsic_module, sess.opts.cfg, ~[], ast::public, @@ -18,7 +18,7 @@ fn inject_intrinsic(sess: session, alt item { some(i) { i } none { - sess.fatal("no item found in intrinsic module"); + sess.fatal(~"no item found in intrinsic module"); } }; diff --git a/src/rustc/front/test.rs b/src/rustc/front/test.rs index f533c922531..17b92f6925e 100644 --- a/src/rustc/front/test.rs +++ b/src/rustc/front/test.rs @@ -58,7 +58,7 @@ fn strip_test_functions(crate: @ast::crate) -> @ast::crate { // When not compiling with --test we should not compile the // #[test] functions do config::strip_items(crate) |attrs| { - !attr::contains_name(attr::attr_metas(attrs), "test") + !attr::contains_name(attr::attr_metas(attrs), ~"test") } } @@ -72,7 +72,7 @@ fn fold_mod(_cx: test_ctxt, m: ast::_mod, fld: fold::ast_fold) -> ast::_mod { fn nomain(&&item: @ast::item) -> option<@ast::item> { alt item.node { ast::item_fn(_, _, _) { - if *item.ident == "main" { + if *item.ident == ~"main" { option::none } else { option::some(item) } } @@ -106,7 +106,7 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) -> ast::item_fn(decl, _, _) if decl.purity == ast::unsafe_fn { cx.sess.span_fatal( i.span, - "unsafe functions cannot be used for tests"); + ~"unsafe functions cannot be used for tests"); } _ { #debug("this is a test function"); @@ -126,7 +126,7 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) -> fn is_test_fn(i: @ast::item) -> bool { let has_test_attr = - vec::len(attr::find_attrs_by_name(i.attrs, "test")) > 0u; + vec::len(attr::find_attrs_by_name(i.attrs, ~"test")) > 0u; fn has_test_signature(i: @ast::item) -> bool { alt i.node { @@ -144,7 +144,7 @@ fn is_test_fn(i: @ast::item) -> bool { } fn is_ignored(cx: test_ctxt, i: @ast::item) -> bool { - let ignoreattrs = attr::find_attrs_by_name(i.attrs, "ignore"); + let ignoreattrs = attr::find_attrs_by_name(i.attrs, ~"ignore"); let ignoreitems = attr::attr_metas(ignoreattrs); let cfg_metas = vec::concat(vec::filter_map(ignoreitems, |&&i| attr::get_meta_item_list(i) )); @@ -156,7 +156,7 @@ fn is_ignored(cx: test_ctxt, i: @ast::item) -> bool { } fn should_fail(i: @ast::item) -> bool { - vec::len(attr::find_attrs_by_name(i.attrs, "should_fail")) > 0u + vec::len(attr::find_attrs_by_name(i.attrs, ~"should_fail")) > 0u } fn add_test_module(cx: test_ctxt, m: ast::_mod) -> ast::_mod { @@ -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_, @@ -247,19 +247,19 @@ fn mk_path(cx: test_ctxt, path: ~[ast::ident]) -> ~[ast::ident] { // the paths with std:: 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 } + alt attr::last_meta_item_value_str_by_name(items, ~"name") { + 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"/~])); + path_node(mk_path(cx, ~[@~"test", @~"test_desc"])); let test_desc_ty: ast::ty = {id: cx.sess.next_node_id(), @@ -314,7 +314,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { 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); @@ -327,7 +327,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)); @@ -338,7 +338,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)); @@ -350,7 +350,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { let fail_field: ast::field = nospan({mutbl: ast::m_imm, - ident: @"should_fail"/~, + ident: @~"should_fail", expr: @fail_expr}); let desc_rec_: ast::expr_ = @@ -406,7 +406,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_inner = @{id: cx.sess.next_node_id(), node: ast::ty_path(str_pt, cx.sess.next_node_id()), span: dummy_sp()}; @@ -425,7 +425,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(), @@ -448,7 +448,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_, @@ -460,7 +460,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); @@ -469,7 +469,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); @@ -484,7 +484,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); |
