diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-06-10 00:49:59 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-06-13 11:30:45 -0700 |
| commit | ce750a7dbcd2dc68db6de89956b1de3ecf9f2d0a (patch) | |
| tree | 55c2ee5be0986c2489879022d4788d6c3ac2c964 /src/rustc | |
| parent | bdd20000665a35e14b4ec2c54f893fc80fe451ef (diff) | |
| download | rust-ce750a7dbcd2dc68db6de89956b1de3ecf9f2d0a.tar.gz rust-ce750a7dbcd2dc68db6de89956b1de3ecf9f2d0a.zip | |
Box AST idents
Diffstat (limited to 'src/rustc')
46 files changed, 380 insertions, 371 deletions
diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs index c9f1b706893..4eccfa80247 100644 --- a/src/rustc/back/link.rs +++ b/src/rustc/back/link.rs @@ -291,24 +291,24 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, sha: sha1) -> link_meta { type provided_metas = - {name: option<str>, - vers: option<str>, + {name: option<@str>, + vers: option<@str>, cmh_items: [@ast::meta_item]}; fn provided_link_metas(sess: session, c: ast::crate) -> provided_metas { - let mut name: option<str> = none; - let mut vers: option<str> = none; + let mut name: option<@str> = none; + let mut vers: option<@str> = none; let mut cmh_items: [@ast::meta_item] = []; let linkage_metas = attr::find_linkage_metas(c.node.attrs); attr::require_unique_names(sess.diagnostic(), linkage_metas); for linkage_metas.each {|meta| - if attr::get_meta_item_name(meta) == "name" { + if *attr::get_meta_item_name(meta) == "name" { alt attr::get_meta_item_value_str(meta) { some(v) { name = some(v); } none { cmh_items += [meta]; } } - } else if attr::get_meta_item_name(meta) == "vers" { + } else if *attr::get_meta_item_name(meta) == "vers" { alt attr::get_meta_item_value_str(meta) { some(v) { vers = some(v); } none { cmh_items += [meta]; } @@ -321,7 +321,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, // This calculates CMH as defined above fn crate_meta_extras_hash(sha: sha1, _crate: ast::crate, metas: provided_metas, - dep_hashes: [str]) -> str { + dep_hashes: [@str]) -> str { fn len_and_str(s: str) -> str { ret #fmt["%u_%s", str::len(s), s]; } @@ -337,10 +337,10 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, let m = m_; alt m.node { ast::meta_name_value(key, value) { - sha.input_str(len_and_str(key)); + sha.input_str(len_and_str(*key)); sha.input_str(len_and_str_lit(value)); } - ast::meta_word(name) { sha.input_str(len_and_str(name)); } + ast::meta_word(name) { sha.input_str(len_and_str(*name)); } ast::meta_list(_, _) { // FIXME (#607): Implement this fail "unimplemented meta_item variant"; @@ -349,7 +349,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, } for dep_hashes.each {|dh| - sha.input_str(len_and_str(dh)); + sha.input_str(len_and_str(*dh)); } ret truncated_sha1_result(sha); @@ -362,7 +362,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, } fn crate_meta_name(sess: session, _crate: ast::crate, - output: str, metas: provided_metas) -> str { + output: str, metas: provided_metas) -> @str { ret alt metas.name { some(v) { v } none { @@ -378,19 +378,19 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, str::connect(os, ".") }; warn_missing(sess, "name", name); - name + @name } }; } fn crate_meta_vers(sess: session, _crate: ast::crate, - metas: provided_metas) -> str { + metas: provided_metas) -> @str { ret alt metas.vers { some(v) { v } none { let vers = "0.0"; warn_missing(sess, "vers", vers); - vers + @vers } }; } @@ -417,7 +417,7 @@ fn symbol_hash(tcx: ty::ctxt, sha: sha1, t: ty::t, // to be independent of one another in the crate. sha.reset(); - sha.input_str(link_meta.name); + sha.input_str(*link_meta.name); sha.input_str("-"); sha.input_str(link_meta.extras_hash); sha.input_str("-"); @@ -482,7 +482,7 @@ fn mangle(ss: path) -> str { for ss.each {|s| alt s { path_name(s) | path_mod(s) { - let sani = sanitize(s); + let sani = sanitize(*s); n += #fmt["%u%s", str::len(sani), sani]; } } } @@ -490,33 +490,34 @@ fn mangle(ss: path) -> str { n } -fn exported_name(path: path, hash: str, vers: str) -> str { +fn exported_name(path: path, hash: @str, vers: @str) -> str { ret mangle(path + [path_name(hash)] + [path_name(vers)]); } fn mangle_exported_name(ccx: @crate_ctxt, path: path, t: ty::t) -> str { let hash = get_symbol_hash(ccx, t); - ret exported_name(path, hash, ccx.link_meta.vers); + ret exported_name(path, @hash, ccx.link_meta.vers); } -fn mangle_internal_name_by_type_only(ccx: @crate_ctxt, t: ty::t, name: str) -> +fn mangle_internal_name_by_type_only(ccx: @crate_ctxt, + t: ty::t, name: @str) -> str { - let s = util::ppaux::ty_to_short_str(ccx.tcx, t); + let s = @util::ppaux::ty_to_short_str(ccx.tcx, t); let hash = get_symbol_hash(ccx, t); - ret mangle([path_name(name), path_name(s), path_name(hash)]); + ret mangle([path_name(name), path_name(s), path_name(@hash)]); } fn mangle_internal_name_by_path_and_seq(ccx: @crate_ctxt, path: path, - flav: str) -> str { - ret mangle(path + [path_name(ccx.names(flav))]); + flav: @str) -> str { + ret mangle(path + [path_name(@ccx.names(*flav))]); } fn mangle_internal_name_by_path(_ccx: @crate_ctxt, path: path) -> str { ret mangle(path); } -fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: str) -> str { - ret ccx.names(flav); +fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: @str) -> str { + ret ccx.names(*flav); } // If the user wants an exe generated we need to invoke @@ -552,8 +553,8 @@ fn link_binary(sess: session, let output = if sess.building_library { let long_libname = os::dll_filename(#fmt("%s-%s-%s", - lm.name, lm.extras_hash, lm.vers)); - #debug("link_meta.name: %s", lm.name); + *lm.name, lm.extras_hash, *lm.vers)); + #debug("link_meta.name: %s", *lm.name); #debug("long_libname: %s", long_libname); #debug("out_filename: %s", out_filename); #debug("dirname(out_filename): %s", path::dirname(out_filename)); diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs index 769f3c40e25..550e2290bfa 100644 --- a/src/rustc/driver/driver.rs +++ b/src/rustc/driver/driver.rs @@ -49,14 +49,14 @@ fn default_configuration(sess: session, argv0: str, input: input) -> }; ret [ // Target bindings. - attr::mk_word_item(os::family()), - mk("target_os", os::sysname()), - mk("target_family", os::family()), - mk("target_arch", arch), - mk("target_libc", libc), + attr::mk_word_item(@os::family()), + mk(@"target_os", os::sysname()), + mk(@"target_family", os::family()), + mk(@"target_arch", arch), + mk(@"target_libc", libc), // Build bindings. - mk("build_compiler", argv0), - mk("build_input", source_name(input))]; + mk(@"build_compiler", argv0), + mk(@"build_input", source_name(input))]; } fn build_configuration(sess: session, argv0: str, input: input) -> @@ -70,7 +70,7 @@ fn build_configuration(sess: session, argv0: str, input: input) -> { if sess.opts.test && !attr::contains_name(user_cfg, "test") { - [attr::mk_word_item("test")] + [attr::mk_word_item(@"test")] } else { [] } }; ret user_cfg + gen_cfg + default_cfg; @@ -82,7 +82,7 @@ fn parse_cfgspecs(cfgspecs: [str]) -> ast::crate_cfg { // meta_item here. At the moment we just support the meta_word variant. // #2399 let mut words = []; - for cfgspecs.each {|s| words += [attr::mk_word_item(s)]; } + for cfgspecs.each {|s| words += [attr::mk_word_item(@s)]; } ret words; } diff --git a/src/rustc/driver/session.rs b/src/rustc/driver/session.rs index 07f42a0d269..ef37c2bea51 100644 --- a/src/rustc/driver/session.rs +++ b/src/rustc/driver/session.rs @@ -199,7 +199,7 @@ fn building_library(req_crate_type: crate_type, crate: @ast::crate, alt syntax::attr::first_attr_value_str_by_name( crate.node.attrs, "crate_type") { - option::some("lib") { true } + option::some(@"lib") { true } _ { false } } } @@ -227,9 +227,9 @@ mod test { style: ast::attr_outer, value: ast_util::respan(ast_util::dummy_sp(), ast::meta_name_value( - "crate_type", + @"crate_type", ast_util::respan(ast_util::dummy_sp(), - ast::lit_str(t)))) + ast::lit_str(@t)))) }) } diff --git a/src/rustc/front/core_inject.rs b/src/rustc/front/core_inject.rs index 590a371da07..bc7048f8f09 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 2cb144a60b5..44b9356896b 100644 --- a/src/rustc/front/test.rs +++ b/src/rustc/front/test.rs @@ -70,7 +70,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) } } @@ -190,9 +190,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_, @@ -231,7 +231,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_, @@ -246,16 +246,16 @@ 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 { [] } else { ["std"] }) + path + (if is_std { [] } else { [@"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(), @@ -288,14 +288,14 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { #debug("encoding %s", ast_util::path_name_i(path)); let name_lit: ast::lit = - nospan(ast::lit_str(ast_util::path_name_i(path))); + nospan(ast::lit_str(@ast_util::path_name_i(path))); let name_expr: ast::expr = {id: cx.sess.next_node_id(), node: ast::expr_lit(@name_lit), 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); @@ -307,7 +307,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)); @@ -317,7 +317,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)); @@ -327,7 +327,7 @@ 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], @@ -379,7 +379,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()}; @@ -391,7 +391,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(), @@ -414,7 +414,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_, @@ -426,7 +426,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); @@ -434,7 +434,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { {id: cx.sess.next_node_id(), 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); @@ -447,7 +447,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { {id: cx.sess.next_node_id(), 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); diff --git a/src/rustc/metadata/common.rs b/src/rustc/metadata/common.rs index ba23dd24baa..9aa7748c5a4 100644 --- a/src/rustc/metadata/common.rs +++ b/src/rustc/metadata/common.rs @@ -132,5 +132,5 @@ fn hash_path(&&s: str) -> uint { ret h; } -type link_meta = {name: str, vers: str, extras_hash: str}; +type link_meta = {name: @str, vers: @str, extras_hash: str}; diff --git a/src/rustc/metadata/creader.rs b/src/rustc/metadata/creader.rs index 3356e8cdd65..fbb6a18edcd 100644 --- a/src/rustc/metadata/creader.rs +++ b/src/rustc/metadata/creader.rs @@ -42,7 +42,7 @@ fn read_crates(diag: span_handler, crate: ast::crate, type cache_entry = { cnum: int, span: span, - hash: str, + hash: @str, metas: @[@ast::meta_item] }; @@ -53,7 +53,7 @@ fn dump_crates(crate_cache: dvec<cache_entry>) { #debug("span: %?", entry.span); #debug("hash: %?", entry.hash); let attrs = [ - attr::mk_attr(attr::mk_list_item("link", *entry.metas)) + attr::mk_attr(attr::mk_list_item(@"link", *entry.metas)) ]; for attr::find_linkage_attrs(attrs).each {|attr| #debug("meta: %s", pprust::attr_to_str(attr)); @@ -81,11 +81,11 @@ fn warn_if_multiple_versions(diag: span_handler, if matches.len() != 1u { diag.handler().warn( - #fmt("using multiple versions of crate `%s`", name)); + #fmt("using multiple versions of crate `%s`", *name)); for matches.each {|match| diag.span_note(match.span, "used here"); let attrs = [ - attr::mk_attr(attr::mk_list_item("link", *match.metas)) + attr::mk_attr(attr::mk_list_item(@"link", *match.metas)) ]; loader::note_linkage_attrs(diag, attrs); } @@ -129,7 +129,7 @@ fn visit_item(e: env, i: @ast::item) { let native_name = alt attr::first_attr_value_str_by_name(i.attrs, "link_name") { some(nn) { - if nn == "" { + if *nn == "" { e.diag.span_fatal( i.span, "empty #[link_name] not allowed; use #[nolink]."); @@ -140,17 +140,17 @@ fn visit_item(e: env, i: @ast::item) { }; let mut already_added = false; if vec::len(attr::find_attrs_by_name(i.attrs, "nolink")) == 0u { - already_added = !cstore::add_used_library(cstore, native_name); + already_added = !cstore::add_used_library(cstore, *native_name); } let link_args = attr::find_attrs_by_name(i.attrs, "link_args"); if vec::len(link_args) > 0u && already_added { - e.diag.span_fatal(i.span, "library '" + native_name + + e.diag.span_fatal(i.span, "library '" + *native_name + "' already added: can't specify link_args."); } for link_args.each {|a| alt attr::get_meta_item_value_str(attr::attr_meta(a)) { some(linkarg) { - cstore::add_used_link_args(cstore, linkarg); + cstore::add_used_link_args(cstore, *linkarg); } none {/* fallthrough */ } } @@ -160,11 +160,11 @@ fn visit_item(e: env, i: @ast::item) { } } -fn metas_with(ident: ast::ident, key: str, +fn metas_with(ident: ast::ident, key: ast::ident, metas: [@ast::meta_item]) -> [@ast::meta_item] { - let name_items = attr::find_meta_items_by_name(metas, key); + let name_items = attr::find_meta_items_by_name(metas, *key); if name_items.is_empty() { - metas + [attr::mk_name_value_item_str(key, ident)] + metas + [attr::mk_name_value_item_str(key, *ident)] } else { metas } @@ -172,7 +172,7 @@ fn metas_with(ident: ast::ident, key: str, fn metas_with_ident(ident: ast::ident, metas: [@ast::meta_item]) -> [@ast::meta_item] { - metas_with(ident, "name", metas) + metas_with(ident, @"name", metas) } fn existing_match(e: env, metas: [@ast::meta_item], hash: str) -> @@ -180,7 +180,7 @@ fn existing_match(e: env, metas: [@ast::meta_item], hash: str) -> for e.crate_cache.each {|c| if loader::metadata_matches(*c.metas, metas) - && (hash.is_empty() || c.hash == hash) { + && (hash.is_empty() || *c.hash == hash) { ret some(c.cnum); } } @@ -226,7 +226,7 @@ fn resolve_crate(e: env, ident: ast::ident, metas: [@ast::meta_item], option::some(v) { v } option::none { ident } }; - let cmeta = @{name: cname, data: cdata, + let cmeta = @{name: *cname, data: cdata, cnum_map: cnum_map, cnum: cnum}; let cstore = e.cstore; @@ -249,10 +249,10 @@ fn resolve_crate_deps(e: env, cdata: @[u8]) -> cstore::cnum_map { for decoder::get_crate_deps(cdata).each {|dep| let extrn_cnum = dep.cnum; let cname = dep.name; - let cmetas = metas_with(dep.vers, "vers", []); + let cmetas = metas_with(dep.vers, @"vers", []); #debug("resolving dep crate %s ver: %s hash: %s", - dep.name, dep.vers, dep.hash); - alt existing_match(e, metas_with_ident(cname, cmetas), dep.hash) { + *dep.name, *dep.vers, *dep.hash); + alt existing_match(e, metas_with_ident(cname, cmetas), *dep.hash) { some(local_cnum) { #debug("already have it"); // We've already seen this crate @@ -265,7 +265,7 @@ fn resolve_crate_deps(e: env, cdata: @[u8]) -> cstore::cnum_map { // #2404 let fake_span = ast_util::dummy_sp(); let local_cnum = - resolve_crate(e, cname, cmetas, dep.hash, fake_span); + resolve_crate(e, cname, cmetas, *dep.hash, fake_span); cnum_map.insert(extrn_cnum, local_cnum); } } diff --git a/src/rustc/metadata/csearch.rs b/src/rustc/metadata/csearch.rs index 3994d9fa722..f65f6110388 100644 --- a/src/rustc/metadata/csearch.rs +++ b/src/rustc/metadata/csearch.rs @@ -64,7 +64,7 @@ fn resolve_path(cstore: cstore::cstore, cnum: ast::crate_num, [(ast::crate_num, @[u8], ast::def_id)] { let cm = cstore::get_crate_data(cstore, cnum); #debug("resolve_path %s in crates[%d]:%s", - str::connect(path, "::"), cnum, cm.name); + ast_util::path_name_i(path), cnum, cm.name); let mut result = []; for decoder::resolve_path(path, cm.data).each {|def| if def.crate == ast::local_crate { @@ -88,7 +88,7 @@ fn get_item_path(tcx: ty::ctxt, def: ast::def_id) -> ast_map::path { // FIXME #1920: This path is not always correct if the crate is not linked // into the root namespace. - [ast_map::path_mod(cdata.name)] + path + [ast_map::path_mod(@cdata.name)] + path } enum found_ast { @@ -170,7 +170,8 @@ fn get_impl_iface(tcx: ty::ctxt, def: ast::def_id) -> option<ty::t> { decoder::get_impl_iface(cdata, def.node, tcx) } -fn get_impl_method(cstore: cstore::cstore, def: ast::def_id, mname: str) +fn get_impl_method(cstore: cstore::cstore, + def: ast::def_id, mname: ast::ident) -> ast::def_id { let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_impl_method(cdata, def.node, mname) @@ -180,7 +181,8 @@ fn get_impl_method(cstore: cstore::cstore, def: ast::def_id, mname: str) for their methods (so that get_iface_methods can be reused to get class methods), classes require a slightly different version of get_impl_method. Sigh. */ -fn get_class_method(cstore: cstore::cstore, def: ast::def_id, mname: str) +fn get_class_method(cstore: cstore::cstore, + def: ast::def_id, mname: ast::ident) -> ast::def_id { let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_class_method(cdata, def.node, mname) diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs index 0bbbeafdb54..ebfa8df3b10 100644 --- a/src/rustc/metadata/cstore.rs +++ b/src/rustc/metadata/cstore.rs @@ -37,7 +37,7 @@ type cnum_map = map::hashmap<ast::crate_num, ast::crate_num>; // Multiple items may have the same def_id in crate metadata. They may be // renamed imports or reexports. This map keeps the "real" module path // and def_id. -type mod_path_map = map::hashmap<ast::def_id, str>; +type mod_path_map = map::hashmap<ast::def_id, @str>; type crate_metadata = @{name: str, data: @[u8], @@ -83,12 +83,12 @@ fn get_crate_data(cstore: cstore, cnum: ast::crate_num) -> crate_metadata { ret p(cstore).metas.get(cnum); } -fn get_crate_hash(cstore: cstore, cnum: ast::crate_num) -> str { +fn get_crate_hash(cstore: cstore, cnum: ast::crate_num) -> @str { let cdata = get_crate_data(cstore, cnum); ret decoder::get_crate_hash(cdata.data); } -fn get_crate_vers(cstore: cstore, cnum: ast::crate_num) -> str { +fn get_crate_vers(cstore: cstore, cnum: ast::crate_num) -> @str { let cdata = get_crate_data(cstore, cnum); ret decoder::get_crate_vers(cdata.data); } @@ -99,7 +99,7 @@ fn set_crate_data(cstore: cstore, cnum: ast::crate_num, vec::iter(decoder::get_crate_module_paths(data.data)) {|dp| let (did, path) = dp; let d = {crate: cnum, node: did.node}; - p(cstore).mod_path_map.insert(d, path); + p(cstore).mod_path_map.insert(d, @path); } } @@ -153,32 +153,32 @@ fn find_use_stmt_cnum(cstore: cstore, // returns hashes of crates directly used by this crate. Hashes are // sorted by crate name. -fn get_dep_hashes(cstore: cstore) -> [str] { - type crate_hash = {name: str, hash: str}; +fn get_dep_hashes(cstore: cstore) -> [@str] { + type crate_hash = {name: @str, hash: @str}; let mut result = []; for p(cstore).use_crate_map.each_value {|cnum| let cdata = cstore::get_crate_data(cstore, cnum); let hash = decoder::get_crate_hash(cdata.data); - #debug("Add hash[%s]: %s", cdata.name, hash); - result += [{name: cdata.name, hash: hash}]; + #debug("Add hash[%s]: %s", cdata.name, *hash); + result += [{name: @cdata.name, hash: hash}]; }; fn lteq(a: crate_hash, b: crate_hash) -> bool { - ret a.name <= b.name; + ret *a.name <= *b.name; } let sorted = std::sort::merge_sort(lteq, result); #debug("sorted:"); for sorted.each {|x| - #debug(" hash[%s]: %s", x.name, x.hash); + #debug(" hash[%s]: %s", *x.name, *x.hash); } - fn mapper(ch: crate_hash) -> str { ret ch.hash; } + fn mapper(ch: crate_hash) -> @str { ret ch.hash; } ret vec::map(sorted, mapper); } -fn get_path(cstore: cstore, d: ast::def_id) -> [str] { +fn get_path(cstore: cstore, d: ast::def_id) -> [ast::ident] { // let f = bind str::split_str(_, "::"); option::map_default(p(cstore).mod_path_map.find(d), [], - {|ds| str::split_str(ds, "::")}) + {|ds| str::split_str(*ds, "::").map({|x|@x})}) } // Local Variables: // mode: rust diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index dcb71c6718a..9ae0fa9842f 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -210,7 +210,7 @@ fn resolve_path(path: [ast::ident], data: @[u8]) -> [ast::def_id] { fn eq_item(data: [u8], s: str) -> bool { ret str::eq(str::from_bytes(data), s); } - let s = str::connect(path, "::"); + let s = ast_util::path_name_i(path); let md = ebml::doc(data); let paths = ebml::get_doc(md, tag_paths); let eqer = bind eq_item(_, s); @@ -235,10 +235,10 @@ fn item_path(item_doc: ebml::doc) -> ast_map::path { ebml::docs(path_doc) {|tag, elt_doc| if tag == tag_path_elt_mod { let str = ebml::doc_as_str(elt_doc); - result += [ast_map::path_mod(str)]; + result += [ast_map::path_mod(@str)]; } else if tag == tag_path_elt_name { let str = ebml::doc_as_str(elt_doc); - result += [ast_map::path_name(str)]; + result += [ast_map::path_name(@str)]; } else { // ignore tag_path_len element } @@ -249,7 +249,7 @@ fn item_path(item_doc: ebml::doc) -> ast_map::path { fn item_name(item: ebml::doc) -> ast::ident { let name = ebml::get_doc(item, tag_paths_data_name); - str::from_bytes(ebml::doc_data(name)) + @str::from_bytes(ebml::doc_data(name)) } fn lookup_item_name(data: @[u8], id: ast::node_id) -> ast::ident { @@ -302,7 +302,8 @@ fn get_impl_iface(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) item_impl_iface(lookup_item(id, cdata.data), tcx, cdata) } -fn get_impl_method(cdata: cmd, id: ast::node_id, name: str) -> ast::def_id { +fn get_impl_method(cdata: cmd, id: ast::node_id, + name: ast::ident) -> ast::def_id { let items = ebml::get_doc(ebml::doc(cdata.data), tag_items); let mut found = none; ebml::tagged_docs(find_item(id, items), tag_item_impl_method) {|mid| @@ -314,13 +315,14 @@ fn get_impl_method(cdata: cmd, id: ast::node_id, name: str) -> ast::def_id { option::get(found) } -fn get_class_method(cdata: cmd, id: ast::node_id, name: str) -> ast::def_id { +fn get_class_method(cdata: cmd, id: ast::node_id, + name: ast::ident) -> ast::def_id { let items = ebml::get_doc(ebml::doc(cdata.data), tag_items); let mut found = none; let cls_items = alt maybe_find_item(id, items) { some(it) { it } none { fail (#fmt("get_class_method: class id not found \ - when looking up method %s", name)) }}; + when looking up method %s", *name)) }}; ebml::tagged_docs(cls_items, tag_item_iface_method) {|mid| let m_did = class_member_id(mid, cdata); if item_name(mid) == name { @@ -329,7 +331,7 @@ fn get_class_method(cdata: cmd, id: ast::node_id, name: str) -> ast::def_id { } alt found { some(found) { found } - none { fail (#fmt("get_class_method: no method named %s", name)) } + none { fail (#fmt("get_class_method: no method named %s", *name)) } } } @@ -574,7 +576,7 @@ fn get_meta_items(md: ebml::doc) -> [@ast::meta_item] { ebml::tagged_docs(md, tag_meta_item_word) {|meta_item_doc| let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); let n = str::from_bytes(ebml::doc_data(nd)); - items += [attr::mk_word_item(n)]; + items += [attr::mk_word_item(@n)]; }; ebml::tagged_docs(md, tag_meta_item_name_value) {|meta_item_doc| let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); @@ -583,13 +585,13 @@ fn get_meta_items(md: ebml::doc) -> [@ast::meta_item] { let v = str::from_bytes(ebml::doc_data(vd)); // FIXME (#623): Should be able to decode meta_name_value variants, // but currently the encoder just drops them - items += [attr::mk_name_value_item_str(n, v)]; + items += [attr::mk_name_value_item_str(@n, v)]; }; ebml::tagged_docs(md, tag_meta_item_list) {|meta_item_doc| let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); let n = str::from_bytes(ebml::doc_data(nd)); let subitems = get_meta_items(meta_item_doc); - items += [attr::mk_list_item(n, subitems)]; + items += [attr::mk_list_item(@n, subitems)]; }; ret items; } @@ -620,8 +622,8 @@ fn list_meta_items(meta_items: ebml::doc, out: io::writer) { } } -fn list_crate_attributes(md: ebml::doc, hash: str, out: io::writer) { - out.write_str(#fmt("=Crate Attributes (%s)=\n", hash)); +fn list_crate_attributes(md: ebml::doc, hash: @str, out: io::writer) { + out.write_str(#fmt("=Crate Attributes (%s)=\n", *hash)); for get_attributes(md).each {|attr| out.write_str(#fmt["%s\n", pprust::attribute_to_str(attr)]); @@ -635,7 +637,7 @@ fn get_crate_attributes(data: @[u8]) -> [ast::attribute] { } type crate_dep = {cnum: ast::crate_num, name: ast::ident, - vers: str, hash: str}; + vers: @str, hash: @str}; fn get_crate_deps(data: @[u8]) -> [crate_dep] { let mut deps: [crate_dep] = []; @@ -647,9 +649,9 @@ fn get_crate_deps(data: @[u8]) -> [crate_dep] { } ebml::tagged_docs(depsdoc, tag_crate_dep) {|depdoc| deps += [{cnum: crate_num, - name: docstr(depdoc, tag_crate_dep_name), - vers: docstr(depdoc, tag_crate_dep_vers), - hash: docstr(depdoc, tag_crate_dep_hash)}]; + name: @docstr(depdoc, tag_crate_dep_name), + vers: @docstr(depdoc, tag_crate_dep_vers), + hash: @docstr(depdoc, tag_crate_dep_hash)}]; crate_num += 1; }; ret deps; @@ -660,24 +662,24 @@ fn list_crate_deps(data: @[u8], out: io::writer) { for get_crate_deps(data).each {|dep| out.write_str(#fmt["%d %s-%s-%s\n", - dep.cnum, dep.name, dep.hash, dep.vers]); + dep.cnum, *dep.name, *dep.hash, *dep.vers]); } out.write_str("\n"); } -fn get_crate_hash(data: @[u8]) -> str { +fn get_crate_hash(data: @[u8]) -> @str { let cratedoc = ebml::doc(data); let hashdoc = ebml::get_doc(cratedoc, tag_crate_hash); - ret str::from_bytes(ebml::doc_data(hashdoc)); + ret @str::from_bytes(ebml::doc_data(hashdoc)); } -fn get_crate_vers(data: @[u8]) -> str { +fn get_crate_vers(data: @[u8]) -> @str { let attrs = decoder::get_crate_attributes(data); ret alt attr::last_meta_item_value_str_by_name( attr::find_linkage_metas(attrs), "vers") { some(ver) { ver } - none { "0.0" } + none { @"0.0" } }; } diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 215f73a6d4f..e10554c79ed 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -71,8 +71,8 @@ fn reachable(ecx: @encode_ctxt, id: node_id) -> bool { } // Path table encoding -fn encode_name(ebml_w: ebml::writer, name: str) { - ebml_w.wr_tagged_str(tag_paths_data_name, name); +fn encode_name(ebml_w: ebml::writer, name: ident) { + ebml_w.wr_tagged_str(tag_paths_data_name, *name); } fn encode_def_id(ebml_w: ebml::writer, id: def_id) { @@ -92,7 +92,7 @@ fn encode_region_param(ebml_w: ebml::writer, rp: region_param) { } } -fn encode_named_def_id(ebml_w: ebml::writer, name: str, id: def_id) { +fn encode_named_def_id(ebml_w: ebml::writer, name: ident, id: def_id) { ebml_w.wr_tag(tag_paths_data_item) {|| encode_name(ebml_w, name); encode_def_id(ebml_w, id); @@ -109,7 +109,7 @@ fn encode_mutability(ebml_w: ebml::writer, mt: class_mutability) { type entry<T> = {val: T, pos: uint}; fn encode_enum_variant_paths(ebml_w: ebml::writer, variants: [variant], - path: [str], &index: [entry<str>]) { + path: [ident], &index: [entry<str>]) { for variants.each {|variant| add_to_index(ebml_w, path, index, variant.node.name); ebml_w.wr_tag(tag_paths_data_item) {|| @@ -119,15 +119,15 @@ fn encode_enum_variant_paths(ebml_w: ebml::writer, variants: [variant], } } -fn add_to_index(ebml_w: ebml::writer, path: [str], &index: [entry<str>], - name: str) { +fn add_to_index(ebml_w: ebml::writer, path: [ident], &index: [entry<str>], + name: ident) { let full_path = path + [name]; index += - [{val: str::connect(full_path, "::"), pos: ebml_w.writer.tell()}]; + [{val: ast_util::path_name_i(full_path), pos: ebml_w.writer.tell()}]; } fn encode_native_module_item_paths(ebml_w: ebml::writer, nmod: native_mod, - path: [str], &index: [entry<str>]) { + path: [ident], &index: [entry<str>]) { for nmod.items.each {|nitem| add_to_index(ebml_w, path, index, nitem.ident); encode_named_def_id(ebml_w, nitem.ident, local_def(nitem.id)); @@ -135,7 +135,7 @@ fn encode_native_module_item_paths(ebml_w: ebml::writer, nmod: native_mod, } fn encode_class_item_paths(ebml_w: ebml::writer, - items: [@class_member], path: [str], &index: [entry<str>]) { + items: [@class_member], path: [ident], &index: [entry<str>]) { for items.each {|it| alt ast_util::class_member_visibility(it) { private { cont; } @@ -152,7 +152,8 @@ fn encode_class_item_paths(ebml_w: ebml::writer, } fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, - module: _mod, path: [str], &index: [entry<str>]) { + module: _mod, path: [ident], + &index: [entry<str>]) { for module.items.each {|it| if !reachable(ecx, it.id) || !ast_util::is_exported(it.ident, module) { cont; } @@ -235,7 +236,7 @@ fn encode_iface_ref(ebml_w: ebml::writer, ecx: @encode_ctxt, t: @iface_ref) { fn encode_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, crate: @crate) -> [entry<str>] { let mut index: [entry<str>] = []; - let mut path: [str] = []; + let mut path: [ident] = []; ebml_w.start_tag(tag_paths); encode_module_item_paths(ebml_w, ecx, crate.node.module, path, index); encode_reexport_paths(ebml_w, ecx, index); @@ -249,7 +250,7 @@ fn encode_reexport_paths(ebml_w: ebml::writer, let (path, def_id) = reexport; index += [{val: path, pos: ebml_w.writer.tell()}]; ebml_w.start_tag(tag_paths_data_item); - encode_name(ebml_w, path); + encode_name(ebml_w, @path); encode_def_id(ebml_w, def_id); ebml_w.end_tag(); } @@ -374,7 +375,7 @@ fn encode_path(ebml_w: ebml::writer, ast_map::path_name(name) { (tag_path_elt_name, name) } }; - ebml_w.wr_tagged_str(tag, name); + ebml_w.wr_tagged_str(tag, *name); } ebml_w.wr_tag(tag_path) {|| @@ -439,7 +440,7 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer, instance_var(nm, _, mt, id, vis) { *index += [{val: id, pos: ebml_w.writer.tell()}]; ebml_w.start_tag(tag_items_data_item); - #debug("encode_info_for_class: doing %s %d", nm, id); + #debug("encode_info_for_class: doing %s %d", *nm, id); encode_visibility(ebml_w, vis); encode_name(ebml_w, nm); encode_path(ebml_w, path, ast_map::path_name(nm)); @@ -456,7 +457,7 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer, but it works for now -- tjc */ *global_index += [{val: m.id, pos: ebml_w.writer.tell()}]; let impl_path = path + [ast_map::path_name(m.ident)]; - #debug("encode_info_for_class: doing %s %d", m.ident, m.id); + #debug("encode_info_for_class: doing %s %d", *m.ident, m.id); encode_info_for_method(ecx, ebml_w, impl_path, should_inline(m.attrs), id, m, class_tps + m.tps); @@ -479,7 +480,7 @@ fn encode_info_for_fn(ecx: @encode_ctxt, ebml_w: ebml::writer, encode_family(ebml_w, purity_fn_family(decl.purity)); encode_type_param_bounds(ebml_w, ecx, tps); let its_ty = node_id_to_type(ecx.tcx, id); - #debug("fn name = %s ty = %s its node id = %d", ident, + #debug("fn name = %s ty = %s its node id = %d", *ident, util::ppaux::ty_to_str(ecx.tcx, its_ty), id); encode_type(ecx, ebml_w, its_ty); encode_path(ebml_w, path, ast_map::path_name(ident)); @@ -498,7 +499,7 @@ fn encode_info_for_method(ecx: @encode_ctxt, ebml_w: ebml::writer, impl_path: ast_map::path, should_inline: bool, parent_id: node_id, m: @method, all_tps: [ty_param]) { - #debug("encode_info_for_method: %d %s %u", m.id, m.ident, all_tps.len()); + #debug("encode_info_for_method: %d %s %u", m.id, *m.ident, all_tps.len()); ebml_w.start_tag(tag_items_data_item); encode_def_id(ebml_w, local_def(m.id)); encode_family(ebml_w, purity_fn_family(m.decl.purity)); @@ -627,8 +628,8 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item, /* Encode the dtor */ option::iter(m_dtor) {|dtor| *index += [{val: dtor.node.id, pos: ebml_w.writer.tell()}]; - encode_info_for_fn(ecx, ebml_w, dtor.node.id, item.ident - + "_dtor", path, if tps.len() > 0u { + encode_info_for_fn(ecx, ebml_w, dtor.node.id, @(*item.ident + + "_dtor"), path, if tps.len() > 0u { some(ii_dtor(dtor, item.ident, tps, local_def(item.id))) } else { none }, tps, ast_util::dtor_dec()); @@ -805,7 +806,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer, ebml_w.start_tag(tag_items_data); *index += [{val: crate_node_id, pos: ebml_w.writer.tell()}]; encode_info_for_mod(ecx, ebml_w, crate.node.module, - crate_node_id, [], ""); + crate_node_id, [], @""); visit::visit_crate(*crate, (), visit::mk_vt(@{ visit_expr: {|_e, _cx, _v|}, visit_item: {|i, cx, v, copy ebml_w| @@ -816,7 +817,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer, /* encode ctor, then encode items */ alt i.node { item_class(tps, _, _, ctor, m_dtor, _) { - #debug("encoding info for ctor %s %d", i.ident, + #debug("encoding info for ctor %s %d", *i.ident, ctor.node.id); *index += [{val: ctor.node.id, pos: ebml_w.writer.tell()}]; encode_info_for_fn(ecx, ebml_w, ctor.node.id, i.ident, @@ -898,7 +899,7 @@ fn encode_meta_item(ebml_w: ebml::writer, mi: meta_item) { meta_word(name) { ebml_w.start_tag(tag_meta_item_word); ebml_w.start_tag(tag_meta_item_name); - ebml_w.writer.write(str::bytes(name)); + ebml_w.writer.write(str::bytes(*name)); ebml_w.end_tag(); ebml_w.end_tag(); } @@ -907,10 +908,10 @@ fn encode_meta_item(ebml_w: ebml::writer, mi: meta_item) { lit_str(value) { ebml_w.start_tag(tag_meta_item_name_value); ebml_w.start_tag(tag_meta_item_name); - ebml_w.writer.write(str::bytes(name)); + ebml_w.writer.write(str::bytes(*name)); ebml_w.end_tag(); ebml_w.start_tag(tag_meta_item_value); - ebml_w.writer.write(str::bytes(value)); + ebml_w.writer.write(str::bytes(*value)); ebml_w.end_tag(); ebml_w.end_tag(); } @@ -920,7 +921,7 @@ fn encode_meta_item(ebml_w: ebml::writer, mi: meta_item) { meta_list(name, items) { ebml_w.start_tag(tag_meta_item_list); ebml_w.start_tag(tag_meta_item_name); - ebml_w.writer.write(str::bytes(name)); + ebml_w.writer.write(str::bytes(*name)); ebml_w.end_tag(); for items.each {|inner_item| encode_meta_item(ebml_w, *inner_item); @@ -949,22 +950,22 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute] { fn synthesize_link_attr(ecx: @encode_ctxt, items: [@meta_item]) -> attribute { - assert (ecx.link_meta.name != ""); - assert (ecx.link_meta.vers != ""); + assert (*ecx.link_meta.name != ""); + assert (*ecx.link_meta.vers != ""); let name_item = - attr::mk_name_value_item_str("name", ecx.link_meta.name); + attr::mk_name_value_item_str(@"name", *ecx.link_meta.name); let vers_item = - attr::mk_name_value_item_str("vers", ecx.link_meta.vers); + attr::mk_name_value_item_str(@"vers", *ecx.link_meta.vers); let other_items = { - let tmp = attr::remove_meta_items_by_name(items, "name"); - attr::remove_meta_items_by_name(tmp, "vers") + let tmp = attr::remove_meta_items_by_name(items, @"name"); + attr::remove_meta_items_by_name(tmp, @"vers") }; let meta_items = [name_item, vers_item] + other_items; - let link_item = attr::mk_list_item("link", meta_items); + let link_item = attr::mk_list_item(@"link", meta_items); ret attr::mk_attr(link_item); } @@ -973,7 +974,7 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute] { let mut found_link_attr = false; for crate.node.attrs.each {|attr| attrs += - if attr::get_attr_name(attr) != "link" { + if *attr::get_attr_name(attr) != "link" { [attr] } else { alt attr.node.value.node { @@ -1000,9 +1001,9 @@ fn encode_crate_deps(ebml_w: ebml::writer, cstore: cstore::cstore) { // Pull the cnums and name,vers,hash out of cstore let mut deps: [mut numdep] = [mut]; cstore::iter_crate_data(cstore) {|key, val| - let dep = {cnum: key, name: val.name, + let dep = {cnum: key, name: @val.name, vers: decoder::get_crate_vers(val.data), - hash: decoder::get_crate_hash(val.data)}; + hash: decoder::get_crate_hash(val.data)}; deps += [mut dep]; }; @@ -1036,13 +1037,13 @@ fn encode_crate_deps(ebml_w: ebml::writer, cstore: cstore::cstore) { fn encode_crate_dep(ebml_w: ebml::writer, dep: decoder::crate_dep) { ebml_w.start_tag(tag_crate_dep); ebml_w.start_tag(tag_crate_dep_name); - ebml_w.writer.write(str::bytes(dep.name)); + ebml_w.writer.write(str::bytes(*dep.name)); ebml_w.end_tag(); ebml_w.start_tag(tag_crate_dep_vers); - ebml_w.writer.write(str::bytes(dep.vers)); + ebml_w.writer.write(str::bytes(*dep.vers)); ebml_w.end_tag(); ebml_w.start_tag(tag_crate_dep_hash); - ebml_w.writer.write(str::bytes(dep.hash)); + ebml_w.writer.write(str::bytes(*dep.hash)); ebml_w.end_tag(); ebml_w.end_tag(); } diff --git a/src/rustc/metadata/loader.rs b/src/rustc/metadata/loader.rs index 2123a6179f0..2cbf529ecf0 100644 --- a/src/rustc/metadata/loader.rs +++ b/src/rustc/metadata/loader.rs @@ -44,7 +44,7 @@ fn load_library_crate(cx: ctxt) -> {ident: str, data: @[u8]} { some(t) { ret t; } none { cx.diag.span_fatal( - cx.span, #fmt["can't find crate for '%s'", cx.ident]); + cx.span, #fmt["can't find crate for '%s'", *cx.ident]); } } } @@ -69,7 +69,7 @@ fn find_library_crate_aux(cx: ctxt, filesearch: filesearch::filesearch) -> option<{ident: str, data: @[u8]}> { let crate_name = crate_name_from_metas(cx.metas); - let prefix: str = nn.prefix + crate_name + "-"; + let prefix: str = nn.prefix + *crate_name + "-"; let suffix: str = nn.suffix; let mut matches = []; @@ -107,7 +107,7 @@ fn find_library_crate_aux(cx: ctxt, some(matches[0]) } else { cx.diag.span_err( - cx.span, #fmt("multiple matching crates for `%s`", crate_name)); + cx.span, #fmt("multiple matching crates for `%s`", *crate_name)); cx.diag.handler().note("candidates:"); for matches.each {|match| cx.diag.handler().note(#fmt("path: %s", match.ident)); @@ -119,7 +119,7 @@ fn find_library_crate_aux(cx: ctxt, } } -fn crate_name_from_metas(metas: [@ast::meta_item]) -> str { +fn crate_name_from_metas(metas: [@ast::meta_item]) -> @str { let name_items = attr::find_meta_items_by_name(metas, "name"); alt vec::last_opt(name_items) { some(i) { @@ -146,7 +146,7 @@ fn crate_matches(crate_data: @[u8], metas: [@ast::meta_item], hash: str) -> let linkage_metas = attr::find_linkage_metas(attrs); if hash.is_not_empty() { let chash = decoder::get_crate_hash(crate_data); - if chash != hash { ret false; } + if *chash != hash { ret false; } } metadata_matches(linkage_metas, metas) } diff --git a/src/rustc/metadata/tydecode.rs b/src/rustc/metadata/tydecode.rs index 02ba2597d76..c6e70c6db07 100644 --- a/src/rustc/metadata/tydecode.rs +++ b/src/rustc/metadata/tydecode.rs @@ -46,7 +46,7 @@ fn parse_ident_(st: @pstate, is_last: fn@(char) -> bool) -> while !is_last(peek(st)) { rslt += str::from_byte(next_byte(st)); } - ret rslt; + ret @rslt; } @@ -210,7 +210,7 @@ fn parse_bound_region(st: @pstate) -> ty::bound_region { alt check next(st) { 's' { ty::br_self } 'a' { ty::br_anon } - '[' { ty::br_named(parse_str(st, ']')) } + '[' { ty::br_named(@parse_str(st, ']')) } } } @@ -322,7 +322,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t { assert (next(st) == '['); let mut fields: [ty::field] = []; while peek(st) != ']' { - let name = parse_str(st, '='); + let name = @parse_str(st, '='); fields += [{ident: name, mt: parse_mt(st, conv)}]; } st.pos = st.pos + 1u; diff --git a/src/rustc/metadata/tyencode.rs b/src/rustc/metadata/tyencode.rs index 051ea9e444e..a158b0b01fd 100644 --- a/src/rustc/metadata/tyencode.rs +++ b/src/rustc/metadata/tyencode.rs @@ -157,7 +157,7 @@ fn enc_bound_region(w: io::writer, br: ty::bound_region) { ty::br_anon { w.write_char('a') } ty::br_named(s) { w.write_char('['); - w.write_str(s); + w.write_str(*s); w.write_char(']') } } @@ -256,7 +256,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) { ty::ty_rec(fields) { w.write_str("R["/&); for fields.each {|field| - w.write_str(field.ident); + w.write_str(*field.ident); w.write_char('='); enc_mt(w, cx, field.mt); } diff --git a/src/rustc/middle/astencode.rs b/src/rustc/middle/astencode.rs index 0d6b158a9ae..ca84dafb535 100644 --- a/src/rustc/middle/astencode.rs +++ b/src/rustc/middle/astencode.rs @@ -83,7 +83,7 @@ fn encode_inlined_item(ecx: @e::encode_ctxt, ii: ast::inlined_item, maps: maps) { #debug["> Encoding inlined item: %s::%s (%u)", - ast_map::path_to_str(path), ii.ident(), + ast_map::path_to_str(path), *ii.ident(), ebml_w.writer.tell()]; let id_range = compute_id_range(ii); @@ -94,7 +94,7 @@ fn encode_inlined_item(ecx: @e::encode_ctxt, } #debug["< Encoded inlined fn: %s::%s (%u)", - ast_map::path_to_str(path), ii.ident(), + ast_map::path_to_str(path), *ii.ident(), ebml_w.writer.tell()]; } @@ -117,10 +117,10 @@ fn decode_inlined_item(cdata: cstore::crate_metadata, let ii = renumber_ast(xcx, raw_ii); ast_map::map_decoded_item(tcx.sess.diagnostic(), dcx.tcx.items, path, ii); - #debug["Fn named: %s", ii.ident()]; + #debug["Fn named: %s", *ii.ident()]; decode_side_tables(xcx, ast_doc); #debug["< Decoded inlined fn: %s::%s", - ast_map::path_to_str(path), ii.ident()]; + ast_map::path_to_str(path), *ii.ident()]; alt ii { ast::ii_item(i) { #debug(">>> DECODED ITEM >>>\n%s\n<<< DECODED ITEM <<<", diff --git a/src/rustc/middle/borrowck.rs b/src/rustc/middle/borrowck.rs index 66118dbc38c..f9a985da25d 100644 --- a/src/rustc/middle/borrowck.rs +++ b/src/rustc/middle/borrowck.rs @@ -241,7 +241,7 @@ enum comp_kind { comp_tuple, // elt in a tuple comp_res, // data for a resource comp_variant(ast::def_id), // internals to a variant of given enum - comp_field(str, // name of field + comp_field(ast::ident, // name of field ast::mutability), // declared mutability of field comp_index(ty::t, // type of vec/str/etc being deref'd ast::mutability) // mutability of vec content @@ -409,7 +409,7 @@ impl to_str_methods for borrowck_ctxt { fn comp_to_repr(comp: comp_kind) -> str { alt comp { - comp_field(fld, _) { fld } + comp_field(fld, _) { *fld } comp_index(*) { "[]" } comp_tuple { "()" } comp_res { "<res>" } diff --git a/src/rustc/middle/borrowck/categorization.rs b/src/rustc/middle/borrowck/categorization.rs index db22f880941..4a6f8c15147 100644 --- a/src/rustc/middle/borrowck/categorization.rs +++ b/src/rustc/middle/borrowck/categorization.rs @@ -295,14 +295,15 @@ impl public_methods for borrowck_ctxt { ret @{cat:cat_discr(cmt, alt_id) with *cmt}; } - fn cat_field<N:ast_node>(node: N, base_cmt: cmt, f_name: str) -> cmt { + fn cat_field<N:ast_node>(node: N, base_cmt: cmt, + f_name: ast::ident) -> cmt { let f_mutbl = alt field_mutbl(self.tcx, base_cmt.ty, f_name) { some(f_mutbl) { f_mutbl } none { self.tcx.sess.span_bug( node.span(), #fmt["Cannot find field `%s` in type `%s`", - f_name, ty_to_str(self.tcx, base_cmt.ty)]); + *f_name, ty_to_str(self.tcx, base_cmt.ty)]); } }; let m = alt f_mutbl { @@ -427,7 +428,7 @@ impl private_methods for borrowck_ctxt { fn field_mutbl(tcx: ty::ctxt, base_ty: ty::t, - f_name: str) -> option<ast::mutability> { + f_name: ast::ident) -> option<ast::mutability> { // Need to refactor so that records/class fields can be treated uniformly. alt ty::get(base_ty).struct { ty::ty_rec(fields) { diff --git a/src/rustc/middle/capture.rs b/src/rustc/middle/capture.rs index 64dafc09a7c..fe7aeb8e5f0 100644 --- a/src/rustc/middle/capture.rs +++ b/src/rustc/middle/capture.rs @@ -44,7 +44,7 @@ fn check_capture_clause(tcx: ty::ctxt, tcx.sess.span_warn( cap_item.span, #fmt("captured variable '%s' not used in closure", - cap_item.name)); + *cap_item.name)); } let cap_def_id = ast_util::def_id_of_def(cap_def).node; @@ -52,7 +52,7 @@ fn check_capture_clause(tcx: ty::ctxt, tcx.sess.span_err( cap_item.span, #fmt("variable '%s' captured more than once", - cap_item.name)); + *cap_item.name)); } } } @@ -68,7 +68,7 @@ fn compute_capture_vars(tcx: ty::ctxt, for (*cap_clause).each { |cap_item| #debug("Doing capture var: %s (%?)", - cap_item.name, cap_item.id); + *cap_item.name, cap_item.id); let cap_def = tcx.def_map.get(cap_item.id); let cap_def_id = ast_util::def_id_of_def(cap_def).node; diff --git a/src/rustc/middle/check_alt.rs b/src/rustc/middle/check_alt.rs index 3eb0d1e9223..ee95a8571ff 100644 --- a/src/rustc/middle/check_alt.rs +++ b/src/rustc/middle/check_alt.rs @@ -67,8 +67,8 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: [@pat]) { alt ty::get(ty).struct { ty::ty_bool { alt check ctor { - val(const_int(1i64)) { some("true") } - val(const_int(0i64)) { some("false") } + val(const_int(1i64)) { some(@"true") } + val(const_int(0i64)) { some(@"false") } } } ty::ty_enum(id, _) { @@ -83,7 +83,7 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: [@pat]) { } }; let msg = "non-exhaustive patterns" + alt ext { - some(s) { ": " + s + " not covered" } + some(s) { ": " + *s + " not covered" } none { "" } }; tcx.sess.span_err(sp, msg); diff --git a/src/rustc/middle/const_eval.rs b/src/rustc/middle/const_eval.rs index d0e4b715988..a72e7fb0208 100644 --- a/src/rustc/middle/const_eval.rs +++ b/src/rustc/middle/const_eval.rs @@ -108,11 +108,11 @@ fn eval_const_expr(tcx: middle::ty::ctxt, e: @expr) -> const_val { fn lit_to_const(lit: @lit) -> const_val { alt lit.node { - lit_str(s) { const_str(s) } + lit_str(s) { const_str(*s) } lit_int(n, _) { const_int(n) } lit_uint(n, _) { const_uint(n) } lit_int_unsuffixed(n, _) { const_int(n) } - lit_float(n, _) { const_float(option::get(float::from_str(n)) as f64) } + lit_float(n, _) { const_float(option::get(float::from_str(*n)) as f64) } lit_nil { const_int(0i64) } lit_bool(b) { const_int(b as i64) } } diff --git a/src/rustc/middle/lint.rs b/src/rustc/middle/lint.rs index d8a88819b36..a11ea4c9a62 100644 --- a/src/rustc/middle/lint.rs +++ b/src/rustc/middle/lint.rs @@ -210,7 +210,7 @@ impl methods for ctxt { for metas.each {|meta| alt meta.node { ast::meta_word(lintname) { - alt lookup_lint(self.dict, lintname) { + alt lookup_lint(self.dict, *lintname) { (name, none) { self.span_lint( self.get_level(unrecognized_warning), @@ -444,7 +444,7 @@ fn check_item_old_vecs(cx: ty::ctxt, it: @ast::item) { ast::ty_path(@{span: _, global: _, idents: ids, rp: none, types: _}, _) - if ids == ["str"] && (! uses_vstore.contains_key(t.id)) { + if ids == [@"str"] && (! uses_vstore.contains_key(t.id)) { cx.sess.span_lint( old_vecs, it.id, t.id, t.span, "deprecated str type"); diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs index 0f1edb0c415..38571680ec6 100644 --- a/src/rustc/middle/liveness.rs +++ b/src/rustc/middle/liveness.rs @@ -45,7 +45,7 @@ of `f`. */ import dvec::{dvec, extensions}; -import std::map::{hashmap, int_hash, str_hash}; +import std::map::{hashmap, int_hash, str_hash, box_str_hash}; import syntax::{visit, ast_util}; import syntax::print::pprust::{expr_to_str}; import visit::vt; @@ -134,9 +134,9 @@ enum relevant_def { rdef_var(node_id), rdef_self } type capture_info = {ln: live_node, is_move: bool, rv: relevant_def}; enum var_kind { - vk_arg(node_id, str, rmode), - vk_local(node_id, str), - vk_field(str), + vk_arg(node_id, ident, rmode), + vk_local(node_id, ident), + vk_field(ident), vk_self, vk_implicit_ret } @@ -158,7 +158,7 @@ class ir_maps { let mut num_vars: uint; let live_node_map: hashmap<node_id, live_node>; let variable_map: hashmap<node_id, variable>; - let field_map: hashmap<str, variable>; + let field_map: hashmap<ident, variable>; let capture_map: hashmap<node_id, @[capture_info]>; let mut var_kinds: [var_kind]; let mut lnks: [live_node_kind]; @@ -174,7 +174,7 @@ class ir_maps { self.live_node_map = int_hash(); self.variable_map = int_hash(); self.capture_map = int_hash(); - self.field_map = str_hash(); + self.field_map = box_str_hash(); self.var_kinds = []; self.lnks = []; } @@ -227,12 +227,12 @@ class ir_maps { } } - fn variable_name(var: variable) -> str { + fn variable_name(var: variable) -> ident { alt self.var_kinds[*var] { vk_local(_, name) | vk_arg(_, name, _) {name} - vk_field(name) {"self." + name} - vk_self {"self"} - vk_implicit_ret {"<implicit-ret>"} + vk_field(name) {@("self." + *name)} + vk_self {@"self"} + vk_implicit_ret {@"<implicit-ret>"} } } @@ -1208,7 +1208,8 @@ class liveness { } } - fn as_self_field(expr: @expr, fld: str) -> option<(live_node,variable)> { + fn as_self_field(expr: @expr, + fld: ident) -> option<(live_node,variable)> { // If we checking a constructor, then we treat self.f as a // variable. we use the live_node id that will be assigned to // the reference to self but the variable id for `f`. @@ -1429,7 +1430,7 @@ impl check_methods for @liveness { none { /* ok */ } some(lnk_exit) { self.tcx.sess.span_err( - sp, #fmt["field `self.%s` is never initialized", nm]); + sp, #fmt["field `self.%s` is never initialized", *nm]); } some(lnk) { self.report_illegal_read( @@ -1605,13 +1606,13 @@ impl check_methods for @liveness { self.tcx.sess.span_err( move_span, #fmt["illegal move from argument `%s`, which is not \ - copy or move mode", name]); + copy or move mode", *name]); ret; } vk_field(name) { self.tcx.sess.span_err( move_span, - #fmt["illegal move from field `%s`", name]); + #fmt["illegal move from field `%s`", *name]); ret; } vk_local(*) | vk_self | vk_implicit_ret { @@ -1643,12 +1644,12 @@ impl check_methods for @liveness { lnk_freevar(span) { self.tcx.sess.span_err( span, - #fmt["capture of %s: `%s`", msg, name]); + #fmt["capture of %s: `%s`", msg, *name]); } lnk_expr(span) { self.tcx.sess.span_err( span, - #fmt["use of %s: `%s`", msg, name]); + #fmt["use of %s: `%s`", msg, *name]); } lnk_exit | lnk_vdef(_) { @@ -1659,9 +1660,9 @@ impl check_methods for @liveness { } } - fn should_warn(var: variable) -> option<str> { + fn should_warn(var: variable) -> option<ident> { let name = (*self.ir).variable_name(var); - if name[0] == ('_' as u8) {none} else {some(name)} + if (*name)[0] == ('_' as u8) {none} else {some(name)} } fn warn_about_unused_args(sp: span, decl: fn_decl, entry_ln: live_node) { @@ -1712,10 +1713,10 @@ impl check_methods for @liveness { if is_assigned { self.tcx.sess.span_warn( sp, #fmt["variable `%s` is assigned to, \ - but never used", name]); + but never used", *name]); } else { self.tcx.sess.span_warn( - sp, #fmt["unused variable: `%s`", name]); + sp, #fmt["unused variable: `%s`", *name]); } } ret true; @@ -1728,7 +1729,7 @@ impl check_methods for @liveness { for self.should_warn(var).each { |name| self.tcx.sess.span_warn( sp, - #fmt["value assigned to `%s` is never read", name]); + #fmt["value assigned to `%s` is never read", *name]); } } } diff --git a/src/rustc/middle/pat_util.rs b/src/rustc/middle/pat_util.rs index 29cacf37092..706a6fb2264 100644 --- a/src/rustc/middle/pat_util.rs +++ b/src/rustc/middle/pat_util.rs @@ -9,12 +9,12 @@ import std::map::hashmap; export pat_binding_ids, pat_bindings, pat_id_map; export pat_is_variant; -type pat_id_map = std::map::hashmap<str, node_id>; +type pat_id_map = std::map::hashmap<ident, node_id>; // This is used because same-named variables in alternative patterns need to // use the node_id of their namesake in the first pattern. fn pat_id_map(dm: resolve::def_map, pat: @pat) -> pat_id_map { - let map = std::map::str_hash(); + let map = std::map::box_str_hash(); pat_bindings(dm, pat) {|p_id, _s, n| map.insert(path_to_ident(n), p_id); }; diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs index 1eeb0b0821e..fb9ae118a4a 100644 --- a/src/rustc/middle/resolve.rs +++ b/src/rustc/middle/resolve.rs @@ -9,7 +9,7 @@ import syntax::attr; import metadata::{csearch, cstore}; import driver::session::session; import util::common::is_main_name; -import std::map::{int_hash, str_hash, hashmap}; +import std::map::{int_hash, str_hash, box_str_hash, hashmap}; import vec::each; import syntax::codemap::span; import syntax::visit; @@ -68,16 +68,16 @@ enum glob_import_state { option<def>), /* module */ } -type ext_hash = hashmap<{did: def_id, ident: str, ns: namespace}, def>; +type ext_hash = hashmap<{did: def_id, ident: ast::ident, ns: namespace}, def>; fn new_ext_hash() -> ext_hash { - type key = {did: def_id, ident: str, ns: namespace}; + type key = {did: def_id, ident: ast::ident, ns: namespace}; fn hash(v: key) -> uint { - str::hash(v.ident) + ast_util::hash_def(v.did) + v.ns as uint + str::hash(*v.ident) + ast_util::hash_def(v.did) + v.ns as uint } fn eq(v1: key, v2: key) -> bool { ret ast_util::def_eq(v1.did, v2.did) && - str::eq(v1.ident, v2.ident) && v1.ns == v2.ns; + str::eq(*v1.ident, *v2.ident) && v1.ns == v2.ns; } std::map::hashmap(hash, {|a, b| a == b}) } @@ -102,7 +102,7 @@ type indexed_mod = { index: mod_index, glob_imports: dvec<glob_imp_def>, mut globbed_exports: [ident], - glob_imported_names: hashmap<str, glob_import_state>, + glob_imported_names: hashmap<ident, glob_import_state>, path: str }; @@ -132,7 +132,7 @@ type env = ext_cache: ext_hash, used_imports: {mut track: bool, mut data: [node_id]}, - reported: dvec<{ident: str, sc: scope}>, + reported: dvec<{ident: ast::ident, sc: scope}>, mut ignored_imports: [node_id], mut current_tp: option<uint>, mut resolve_unexported: bool, @@ -256,7 +256,7 @@ fn map_crate(e: @env, c: @ast::crate) { let mut path = n + "::"; list::iter(sc) {|s| alt s { - scope_item(i) { path = i.ident + "::" + path; } + scope_item(i) { path = *i.ident + "::" + path; } _ {} } } @@ -272,8 +272,8 @@ fn map_crate(e: @env, c: @ast::crate) { index: index_mod(md), glob_imports: dvec(), mut globbed_exports: [], - glob_imported_names: str_hash(), - path: path_from_scope(sc, i.ident)}); + glob_imported_names: box_str_hash(), + path: path_from_scope(sc, *i.ident)}); } ast::item_native_mod(nmd) { e.mod_map.insert(i.id, @@ -281,8 +281,8 @@ fn map_crate(e: @env, c: @ast::crate) { index: index_nmod(nmd), glob_imports: dvec(), mut globbed_exports: [], - glob_imported_names: str_hash(), - path: path_from_scope(sc, i.ident)}); + glob_imported_names: box_str_hash(), + path: path_from_scope(sc, *i.ident)}); } _ { } } @@ -340,7 +340,7 @@ fn map_crate(e: @env, c: @ast::crate) { index: index_mod(c.node.module), glob_imports: dvec(), mut globbed_exports: [], - glob_imported_names: str_hash(), + glob_imported_names: box_str_hash(), path: ""}); // Next, assemble the links for globbed imports and exports. @@ -377,10 +377,10 @@ fn check_unused_imports(e: @env, level: lint::level) { if !vec::contains(e.used_imports.data, k) { alt level { lint::warn { - e.sess.span_warn(sp, "unused import " + name); + e.sess.span_warn(sp, "unused import " + *name); } lint::error { - e.sess.span_err(sp, "unused import " + name); + e.sess.span_err(sp, "unused import " + *name); } lint::ignore { } @@ -518,7 +518,7 @@ fn resolve_names(e: @env, c: @ast::crate) { } some(fnd@ast::def_const(_)) { e.sess.span_err(p.span, "pattern variable conflicts \ - with constant '" + path_to_ident(p) + "'"); + with constant '" + *path_to_ident(p) + "'"); } // Binds a var -- nothing needs to be done _ {} @@ -701,7 +701,7 @@ fn visit_local_with_scope(e: @env, loc: @local, &&sc: scopes, v:vt<scopes>) { e.sess.span_err(loc.span, #fmt("declaration of `%s` shadows an \ enum that's in scope", - path_to_ident(path))); + *path_to_ident(path))); } _ {} } @@ -734,7 +734,7 @@ fn follow_import(e: env, &&sc: scopes, path: [ident], sp: span) -> alt dcur { some(ast::def_mod(_)) | some(ast::def_native_mod(_)) { ret dcur; } _ { - e.sess.span_err(sp, str::connect(path, "::") + + e.sess.span_err(sp, str::connect(path.map({|x|*x}), "::") + " does not name a module."); ret none; } @@ -860,7 +860,7 @@ fn resolve_import(e: env, n_id: node_id, name: ast::ident, // import alt e.imports.find(n_id) { some(resolving(sp)) { - e.imports.insert(n_id, resolved(none, none, none, @[], "", sp)); + e.imports.insert(n_id, resolved(none, none, none, @[], @"", sp)); } _ { } } @@ -897,7 +897,7 @@ fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) { alt find_fn_or_mod_scope(sc) { some(err_scope) { for e.reported.each {|rs| - if str::eq(rs.ident, name) && err_scope == rs.sc { ret; } + if str::eq(*rs.ident, *name) && err_scope == rs.sc { ret; } } e.reported.push({ident: name, sc: err_scope}); } @@ -907,10 +907,10 @@ fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) { in_mod(def) { let did = def_id_of_def(def); if did.crate == ast::local_crate { - path = e.mod_map.get(did.node).path + path; + path = @(e.mod_map.get(did.node).path + *path); } else if did.node != ast::crate_node_id { let paths = e.ext_map.get(did); - path = str::connect(paths + [path], "::"); + path = @str::connect((paths + [path]).map({|x|*x}), "::"); } } } @@ -922,7 +922,7 @@ fn unresolved_fatal(e: env, sp: span, id: ident, kind: str) -> ! { } fn mk_unresolved_msg(id: ident, kind: str) -> str { - ret #fmt["unresolved %s: %s", kind, id]; + ret #fmt["unresolved %s: %s", kind, *id]; } // Lookup helpers @@ -1010,7 +1010,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace, alt s { scope_toplevel { if ns == ns_type { - ret some(ast::def_prim_ty(alt name { + ret some(ast::def_prim_ty(alt *name { "bool" { ast::ty_bool } "int" { ast::ty_int(ast::ty_i) } "uint" { ast::ty_uint(ast::ty_u) } @@ -1045,7 +1045,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace, } ast::item_iface(tps, _, _) { if ns == ns_type { - if name == "self" { + if *name == "self" { ret some(def_self(it.id)); } ret lookup_in_ty_params(e, name, tps); @@ -1070,7 +1070,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace, } } scope_method(id, tps) { - if (name == "self" && ns == ns_val) { + if (*name == "self" && ns == ns_val) { ret some(ast::def_self(id)); } else if ns == ns_type { ret lookup_in_ty_params(e, name, tps); @@ -1135,7 +1135,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace, let mut i = vec::len(closing); while i > 0u { i -= 1u; - #debug["name=%s df=%?", name, df]; + #debug["name=%s df=%?", *name, df]; assert def_is_local(df) || def_is_self(df); let df_id = def_id_of_def(df).node; df = ast::def_upvar(df_id, @df, closing[i]); @@ -1164,7 +1164,7 @@ fn lookup_in_ty_params(e: env, name: ident, ty_params: [ast::ty_param]) -> option<def> { let mut n = 0u; for ty_params.each {|tp| - if str::eq(tp.ident, name) && alt e.current_tp { + if str::eq(*tp.ident, *name) && alt e.current_tp { some(cur) { n < cur } none { true } } { ret some(ast::def_ty_param(local_def(tp.id), n)); } n += 1u; @@ -1176,7 +1176,7 @@ fn lookup_in_pat(e: env, name: ident, pat: @ast::pat) -> option<node_id> { let mut found = none; pat_util::pat_bindings(e.def_map, pat) {|p_id, _sp, n| - if str::eq(path_to_ident(n), name) + if str::eq(*path_to_ident(n), *name) { found = some(p_id); } }; ret found; @@ -1188,7 +1188,7 @@ fn lookup_in_fn(e: env, name: ident, decl: ast::fn_decl, alt ns { ns_val { for decl.inputs.each {|a| - if str::eq(a.ident, name) { + if str::eq(*a.ident, *name) { ret some(ast::def_arg(a.id, a.mode)); } } @@ -1231,14 +1231,14 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint, alt it.node { ast::item_enum(variants, _, _) { if ns == ns_type { - if str::eq(it.ident, name) { + if str::eq(*it.ident, *name) { ret some(ast::def_ty(local_def(it.id))); } } else { alt ns { ns_val { for variants.each {|v| - if str::eq(v.node.name, name) { + if str::eq(*v.node.name, *name) { let i = v.node.id; ret some(ast::def_variant (local_def(it.id), local_def(i))); @@ -1250,7 +1250,7 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint, } } _ { - if str::eq(it.ident, name) { + if str::eq(*it.ident, *name) { let found = found_def_item(it, ns); if !is_none(found) { ret found; @@ -1521,9 +1521,9 @@ fn lookup_in_globs(e: env, globs: [glob_imp_def], sp: span, id: ident, } else { for matches.each {|match| let sp = match.path.span; - e.sess.span_note(sp, #fmt["'%s' is imported here", id]); + e.sess.span_note(sp, #fmt["'%s' is imported here", *id]); } - e.sess.span_fatal(sp, "'" + id + "' is glob-imported from" + + e.sess.span_fatal(sp, "'" + *id + "' is glob-imported from" + " multiple different modules."); } } @@ -1627,7 +1627,7 @@ fn index_view_items(view_items: [@ast::view_item], } fn index_mod(md: ast::_mod) -> mod_index { - let index = str_hash::<@list<mod_index_entry>>(); + let index = box_str_hash::<@list<mod_index_entry>>(); index_view_items(md.view_items, index); @@ -1667,7 +1667,7 @@ fn index_mod(md: ast::_mod) -> mod_index { fn index_nmod(md: ast::native_mod) -> mod_index { - let index = str_hash::<@list<mod_index_entry>>(); + let index = box_str_hash::<@list<mod_index_entry>>(); index_view_items(md.view_items, index); @@ -1727,7 +1727,7 @@ fn check_mod_name(e: env, name: ident, entries: @list<mod_index_entry>) { let mut saw_value = false; let mut entries = entries; fn dup(e: env, sp: span, word: str, name: ident) { - e.sess.span_fatal(sp, "duplicate definition of " + word + name); + e.sess.span_fatal(sp, "duplicate definition of " + word + *name); } loop { alt *entries { @@ -1817,11 +1817,11 @@ fn check_arm(e: @env, a: ast::arm, &&x: (), v: vt<()>) { "inconsistent number of bindings"); } else { for ch.seen.each {|name| - if is_none(vec::find(seen0, bind str::eq(name, _))) { + if is_none(vec::find(seen0, {|x|str::eq(*name, *x)})) { // Fight the alias checker let name_ = name; e.sess.span_err(a.pats[i].span, - "binding " + name_ + + "binding " + *name_ + " does not occur in first pattern"); } } @@ -1915,8 +1915,9 @@ fn checker(e: env, kind: str) -> checker { fn check_name(ch: checker, sp: span, name: ident) { for ch.seen.each {|s| - if str::eq(s, name) { - ch.sess.span_fatal(sp, "duplicate " + ch.kind + " name: " + name); + if str::eq(*s, *name) { + ch.sess.span_fatal( + sp, "duplicate " + ch.kind + " name: " + *name); } } } @@ -2000,7 +2001,7 @@ fn check_exports(e: @env) { e.exp_map.insert(export_id, found + [{reexp: reexp, id: target_id}]); } - fn check_export(e: @env, ident: str, _mod: @indexed_mod, + fn check_export(e: @env, ident: ident, _mod: @indexed_mod, export_id: node_id, vi: @view_item) { let mut found_something = false; if _mod.index.contains_key(ident) { @@ -2036,7 +2037,7 @@ fn check_exports(e: @env) { lookup_glob_any(e, _mod, vi.span, ident, export_id); if !found_something { e.sess.span_warn(vi.span, - #fmt("exported item %s is not defined", ident)); + #fmt("exported item %s is not defined", *ident)); } } @@ -2044,7 +2045,7 @@ fn check_exports(e: @env) { -> node_id { alt _mod.index.find(id) { none { - e.sess.span_fatal(sp, #fmt("undefined id %s in an export", id)); + e.sess.span_fatal(sp, #fmt("undefined id %s in an export", *id)); } some(ms) { let maybe_id = list_search(ms) {|m| @@ -2056,7 +2057,7 @@ fn check_exports(e: @env) { alt maybe_id { some(an_id) { an_id } _ { e.sess.span_fatal(sp, #fmt("%s does not refer \ - to an enumeration", id)); } + to an enumeration", *id)); } } } } @@ -2079,7 +2080,7 @@ fn check_exports(e: @env) { e.sess.span_err( span, #fmt("variant %s doesn't belong to \ enum %s", - variant_id.node.name, id)); + *variant_id.node.name, *id)); } } _ {} @@ -2090,7 +2091,7 @@ fn check_exports(e: @env) { } if !found { e.sess.span_err(span, #fmt("%s is not a variant", - variant_id.node.name)); + *variant_id.node.name)); } } } diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs index 2fd4374dc09..183f78ad2ac 100644 --- a/src/rustc/middle/trans/alt.rs +++ b/src/rustc/middle/trans/alt.rs @@ -78,9 +78,9 @@ fn variant_opt(tcx: ty::ctxt, pat_id: ast::node_id) -> opt { } type bind_map = [{ident: ast::ident, val: ValueRef}]; -fn assoc(key: str, list: bind_map) -> option<ValueRef> { +fn assoc(key: ast::ident, list: bind_map) -> option<ValueRef> { for vec::each(list) {|elt| - if str::eq(elt.ident, key) { ret some(elt.val); } + if str::eq(*elt.ident, *key) { ret some(elt.val); } } ret none; } @@ -194,7 +194,7 @@ fn enter_rec(dm: def_map, m: match, col: uint, fields: [ast::ident], for vec::each(fields) {|fname| let mut pat = dummy; for vec::each(fpats) {|fpat| - if str::eq(fpat.ident, fname) { pat = fpat.pat; break; } + if str::eq(*fpat.ident, *fname) { pat = fpat.pat; break; } } pats += [pat]; } @@ -287,12 +287,12 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id, } fn collect_record_fields(m: match, col: uint) -> [ast::ident] { - let mut fields = []; + let mut fields: [ast::ident] = []; for vec::each(m) {|br| alt br.pats[col].node { ast::pat_rec(fs, _) { for vec::each(fs) {|f| - if !vec::any(fields, bind str::eq(f.ident, _)) { + if !vec::any(fields, {|x| str::eq(*f.ident, *x)}) { fields += [f.ident]; } } diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 2423f04d11f..62128c4cf54 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -513,8 +513,8 @@ fn declare_tydesc(ccx: @crate_ctxt, t: ty::t) -> @tydesc_info { let mut name; //XXX this triggers duplicate LLVM symbols if false /*ccx.sess.opts.debuginfo*/ { - name = mangle_internal_name_by_type_only(ccx, t, "tydesc"); - } else { name = mangle_internal_name_by_seq(ccx, "tydesc"); } + name = mangle_internal_name_by_type_only(ccx, t, @"tydesc"); + } else { name = mangle_internal_name_by_seq(ccx, @"tydesc"); } note_unique_llvm_symbol(ccx, name); let gvar = str::as_c_str(name, {|buf| llvm::LLVMAddGlobal(ccx.llmod, ccx.tydesc_type, buf) @@ -541,9 +541,9 @@ fn declare_generic_glue(ccx: @crate_ctxt, t: ty::t, llfnty: TypeRef, let mut fn_nm; //XXX this triggers duplicate LLVM symbols if false /*ccx.sess.opts.debuginfo*/ { - fn_nm = mangle_internal_name_by_type_only(ccx, t, "glue_" + name); + fn_nm = mangle_internal_name_by_type_only(ccx, t, @("glue_" + name)); } else { - fn_nm = mangle_internal_name_by_seq(ccx, "glue_" + name); + fn_nm = mangle_internal_name_by_seq(ccx, @("glue_" + name)); } note_unique_llvm_symbol(ccx, fn_nm); let llfn = decl_cdecl_fn(ccx.llmod, fn_nm, llfnty); @@ -697,8 +697,8 @@ fn incr_refcnt_of_boxed(cx: block, box_ptr: ValueRef) { fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) { let _icx = bcx.insn_ctxt("make_visit_glue"); let mut bcx = bcx; - assert bcx.ccx().tcx.intrinsic_ifaces.contains_key("ty_visitor"); - let (iid, ty) = bcx.ccx().tcx.intrinsic_ifaces.get("ty_visitor"); + assert bcx.ccx().tcx.intrinsic_ifaces.contains_key(@"ty_visitor"); + let (iid, ty) = bcx.ccx().tcx.intrinsic_ifaces.get(@"ty_visitor"); let v = PointerCast(bcx, v, T_ptr(type_of::type_of(bcx.ccx(), ty))); bcx = reflect::emit_calls_to_iface_visit_ty(bcx, t, v, iid); build_return(bcx); @@ -1495,7 +1495,7 @@ fn trans_crate_lit(cx: @crate_ctxt, lit: ast::lit) -> ValueRef { // to actually generate from this? C_integral(T_int_ty(cx, t), i as u64, True) } - ast::lit_float(fs, t) { C_floating(fs, T_float_ty(cx, t)) } + ast::lit_float(fs, t) { C_floating(*fs, T_float_ty(cx, t)) } ast::lit_bool(b) { C_bool(b) } ast::lit_nil { C_nil() } ast::lit_str(s) { @@ -2158,7 +2158,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, real_substs: [ty::t], ast_map::node_ctor(nm, _, ct, pt) { (pt, nm, alt ct { ast_map::res_ctor(_, _, sp) { sp } ast_map::class_ctor(ct_, _) { ct_.span }}) } - ast_map::node_dtor(_, dtor, _, pt) {(pt, "drop", dtor.span)} + ast_map::node_dtor(_, dtor, _, pt) {(pt, @"drop", dtor.span)} ast_map::node_expr(*) { ccx.tcx.sess.bug("Can't monomorphize an expr") } ast_map::node_export(*) { ccx.tcx.sess.bug("Can't monomorphize an export") @@ -2184,7 +2184,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, real_substs: [ty::t], } ccx.monomorphizing.insert(fn_id, depth + 1u); - let pt = *pt + [path_name(ccx.names(name))]; + let pt = *pt + [path_name(@ccx.names(*name))]; let s = mangle_exported_name(ccx, pt, mono_ty); let mk_lldecl = {|| @@ -3382,7 +3382,7 @@ fn trans_rec(bcx: block, fields: [ast::field], let mut temp_cleanups = []; for fields.each {|fld| let ix = option::get(vec::position(ty_fields, {|ft| - str::eq(fld.node.ident, ft.ident) + str::eq(*fld.node.ident, *ft.ident) })); let dst = GEPi(bcx, addr, [0u, ix]); bcx = trans_expr_save_in(bcx, fld.node.expr, dst); @@ -3395,7 +3395,7 @@ fn trans_rec(bcx: block, fields: [ast::field], bcx = cx; // Copy over inherited fields for ty_fields.eachi {|i, tf| - if !vec::any(fields, {|f| str::eq(f.node.ident, tf.ident)}) { + if !vec::any(fields, {|f| str::eq(*f.node.ident, *tf.ident)}) { let dst = GEPi(bcx, addr, [0u, i]); let base = GEPi(bcx, base_val, [0u, i]); let val = load_if_immediate(bcx, base, tf.mt.ty); @@ -3841,7 +3841,7 @@ fn trans_log(log_ex: @ast::expr, lvl: @ast::expr, ccx.module_data.get(modname) } else { let s = link::mangle_internal_name_by_path_and_seq( - ccx, modpath, "loglevel"); + ccx, modpath, @"loglevel"); let global = str::as_c_str(s, {|buf| llvm::LLVMAddGlobal(ccx.llmod, T_i32(), buf) }); @@ -4320,7 +4320,7 @@ fn alloc_local(cx: block, local: @ast::local) -> block { let val = alloc_ty(cx, t); if cx.sess().opts.debuginfo { option::iter(simple_name) {|name| - str::as_c_str(name, {|buf| + str::as_c_str(*name, {|buf| llvm::LLVMSetValueName(val, buf) }); } @@ -4604,7 +4604,7 @@ fn trans_enum_variant(ccx: @crate_ctxt, enum_id: ast::node_id, let fn_args = vec::map(variant.node.args, {|varg| {mode: ast::expl(ast::by_copy), ty: varg.ty, - ident: "arg", + ident: @"arg", id: varg.id} }); let fcx = new_fn_ctxt_w_id(ccx, [], llfndecl, variant.node.id, @@ -5122,7 +5122,7 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id) -> str { some(s) { s } none { let s = mangle_exported_name(ccx, path + - [path_name(ccx.names("dtor"))], ty::node_id_to_type(ccx.tcx, id)); + [path_name(@ccx.names("dtor"))], ty::node_id_to_type(ccx.tcx, id)); ccx.item_symbols.insert(id, s); s } @@ -5164,7 +5164,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef { // def_ids otherwise -- one to identify the type, and one to // find the dtor symbol. let t = ty::node_id_to_type(ccx.tcx, dtor_id); - register_fn_full(ccx, i.span, my_path + [path_name("dtor")], + register_fn_full(ccx, i.span, my_path + [path_name(@"dtor")], i.id, t) } } @@ -5172,7 +5172,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef { ast_map::node_method(m, impl_id, pth) { exprt = true; let mty = ty::node_id_to_type(ccx.tcx, id); - let pth = *pth + [path_name(ccx.names("meth")), + let pth = *pth + [path_name(@ccx.names("meth")), path_name(m.ident)]; let llfn = register_fn_full(ccx, m.span, pth, id, mty); set_inline_hint_if_appr(m.attrs, llfn); @@ -5248,7 +5248,7 @@ fn trans_constant(ccx: @crate_ctxt, it: @ast::item) { let path = item_path(ccx, it); for vec::each(variants) {|variant| let p = path + [path_name(variant.node.name), - path_name("discrim")]; + path_name(@"discrim")]; let s = mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx)); let disr_val = vi[i].disr_val; note_unique_llvm_symbol(ccx, s); @@ -5376,7 +5376,7 @@ fn decl_crate_map(sess: session::session, mapmeta: link_meta, let cstore = sess.cstore; while cstore::have_crate_data(cstore, n_subcrates) { n_subcrates += 1; } let mapname = if sess.building_library { - mapmeta.name + "_" + mapmeta.vers + "_" + mapmeta.extras_hash + *mapmeta.name + "_" + *mapmeta.vers + "_" + mapmeta.extras_hash } else { "toplevel" }; let sym_name = "_rust_crate_map_" + mapname; let arrtype = T_array(int_type, n_subcrates as uint); @@ -5395,8 +5395,8 @@ fn fill_crate_map(ccx: @crate_ctxt, map: ValueRef) { while cstore::have_crate_data(cstore, i) { let cdata = cstore::get_crate_data(cstore, i); let nm = "_rust_crate_map_" + cdata.name + - "_" + cstore::get_crate_vers(cstore, i) + - "_" + cstore::get_crate_hash(cstore, i); + "_" + *cstore::get_crate_vers(cstore, i) + + "_" + *cstore::get_crate_hash(cstore, i); let cr = str::as_c_str(nm, {|buf| llvm::LLVMAddGlobal(ccx.llmod, ccx.int_type, buf) }); @@ -5506,7 +5506,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt, // crashes if the module identifer is same as other symbols // such as a function name in the module. // 1. http://llvm.org/bugs/show_bug.cgi?id=11479 - let llmod_id = link_meta.name + ".rc"; + let llmod_id = *link_meta.name + ".rc"; let llmod = str::as_c_str(llmod_id, {|buf| llvm::LLVMModuleCreateWithNameInContext diff --git a/src/rustc/middle/trans/closure.rs b/src/rustc/middle/trans/closure.rs index a32983b7966..8d97653d182 100644 --- a/src/rustc/middle/trans/closure.rs +++ b/src/rustc/middle/trans/closure.rs @@ -390,7 +390,7 @@ fn trans_expr_fn(bcx: block, let ccx = bcx.ccx(), bcx = bcx; let fty = node_id_type(bcx, id); let llfnty = type_of_fn_from_ty(ccx, fty); - let sub_path = bcx.fcx.path + [path_name("anon")]; + let sub_path = bcx.fcx.path + [path_name(@"anon")]; let s = mangle_internal_name_by_path(ccx, sub_path); let llfn = decl_internal_cdecl_fn(ccx.llmod, s, llfnty); @@ -676,7 +676,7 @@ fn trans_bind_thunk(ccx: @crate_ctxt, // construct and return that thunk. // Give the thunk a name, type, and value. - let s = mangle_internal_name_by_path_and_seq(ccx, path, "thunk"); + let s = mangle_internal_name_by_path_and_seq(ccx, path, @"thunk"); let llthunk_ty = get_pair_fn_ty(type_of(ccx, incoming_fty)); let llthunk = decl_internal_cdecl_fn(ccx.llmod, s, llthunk_ty); diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index 3bac52a949a..6474fa716b4 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -933,7 +933,7 @@ fn path_str(p: path) -> str { alt e { ast_map::path_name(s) | ast_map::path_mod(s) { if first { first = false; } else { r += "::"; } - r += s; + r += *s; } } } r @@ -966,7 +966,7 @@ fn field_idx_strict(cx: ty::ctxt, sp: span, ident: ast::ident, -> uint { alt ty::field_idx(ident, fields) { none { cx.sess.span_bug(sp, #fmt("base expr doesn't appear to \ - have a field named %s", ident)); } + have a field named %s", *ident)); } some(i) { i } } } diff --git a/src/rustc/middle/trans/debuginfo.rs b/src/rustc/middle/trans/debuginfo.rs index f45bb4d5011..f80dd130e0e 100644 --- a/src/rustc/middle/trans/debuginfo.rs +++ b/src/rustc/middle/trans/debuginfo.rs @@ -421,7 +421,7 @@ fn create_record(cx: @crate_ctxt, t: ty::t, fields: [ast::ty_field], let field_t = ty::get_field(t, field.node.ident).mt.ty; let ty_md = create_ty(cx, field_t, field.node.mt.ty); let (size, align) = size_and_align_of(cx, field_t); - add_member(scx, field.node.ident, + add_member(scx, *field.node.ident, line_from_span(cx.sess.codemap, field.span) as int, size as int, align as int, ty_md.node); } @@ -661,7 +661,7 @@ fn create_local_var(bcx: block, local: @ast::local) none { create_function(bcx.fcx).node } some(_) { create_block(bcx).node } }; - let mdnode = create_var(tg, context, name, filemd.node, + let mdnode = create_var(tg, context, *name, filemd.node, loc.line as int, tymd.node); let mdval = @{node: mdnode, data: {id: local.node.id}}; update_cache(cache, AutoVariableTag, local_var_metadata(mdval)); @@ -703,7 +703,7 @@ fn create_arg(bcx: block, arg: ast::arg, sp: span) let tymd = create_ty(cx, ty, arg.ty); let filemd = create_file(cx, loc.file.name); let context = create_function(bcx.fcx); - let mdnode = create_var(tg, context.node, arg.ident, filemd.node, + let mdnode = create_var(tg, context.node, *arg.ident, filemd.node, loc.line as int, tymd.node); let mdval = @{node: mdnode, data: {id: arg.id}}; update_cache(cache, tg, argument_metadata(mdval)); @@ -769,10 +769,10 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> { ast_map::node_expr(expr) { alt expr.node { ast::expr_fn(_, decl, _, _) { - (dbg_cx.names("fn"), decl.output, expr.id) + (@dbg_cx.names("fn"), decl.output, expr.id) } ast::expr_fn_block(decl, _, _) { - (dbg_cx.names("fn"), decl.output, expr.id) + (@dbg_cx.names("fn"), decl.output, expr.id) } _ { fcx.ccx.sess.span_bug(expr.span, "create_function: \ expected an expr_fn or fn_block here"); } @@ -810,8 +810,8 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> { let fn_metadata = [lltag(SubprogramTag), llunused(), file_node, - llstr(ident), - llstr(ident), //XXX fully-qualified C++ name + llstr(*ident), + llstr(*ident), //XXX fully-qualified C++ name llstr(""), //XXX MIPS name????? file_node, lli32(loc.line as int), diff --git a/src/rustc/middle/trans/native.rs b/src/rustc/middle/trans/native.rs index 9dec0e8dfb0..ed15741e57b 100644 --- a/src/rustc/middle/trans/native.rs +++ b/src/rustc/middle/trans/native.rs @@ -421,8 +421,8 @@ fn decl_x86_64_fn(tys: x86_64_tys, fn link_name(i: @ast::native_item) -> str { alt attr::first_attr_value_str_by_name(i.attrs, "link_name") { - none { ret i.ident; } - option::some(ln) { ret ln; } + none { ret *i.ident; } + option::some(ln) { ret *ln; } } } @@ -805,7 +805,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::native_item, let fcx = new_fn_ctxt_w_id(ccx, path, decl, item.id, some(substs), some(item.span)); let mut bcx = top_scope_block(fcx, none), lltop = bcx.llbb; - alt check item.ident { + alt check *item.ident { "size_of" { let tp_ty = substs.tys[0]; let lltp_ty = type_of::type_of(ccx, tp_ty); @@ -913,7 +913,7 @@ fn trans_crust_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl, let _icx = ccx.insn_ctxt("native::crust::build_rust_fn"); let t = ty::node_id_to_type(ccx.tcx, id); let ps = link::mangle_internal_name_by_path( - ccx, path + [ast_map::path_name("__rust_abi")]); + ccx, path + [ast_map::path_name(@"__rust_abi")]); let llty = type_of_fn_from_ty(ccx, t); let llfndecl = decl_internal_cdecl_fn(ccx.llmod, ps, llty); trans_fn(ccx, path, decl, body, llfndecl, no_self, none, id); @@ -950,7 +950,7 @@ fn trans_crust_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl, } let shim_name = link::mangle_internal_name_by_path( - ccx, path + [ast_map::path_name("__rust_stack_shim")]); + ccx, path + [ast_map::path_name(@"__rust_stack_shim")]); ret build_shim_fn_(ccx, shim_name, llrustfn, tys, lib::llvm::CCallConv, build_args, build_ret); diff --git a/src/rustc/middle/trans/reflect.rs b/src/rustc/middle/trans/reflect.rs index 4b6e92aa5ad..0eaeb651368 100644 --- a/src/rustc/middle/trans/reflect.rs +++ b/src/rustc/middle/trans/reflect.rs @@ -41,7 +41,7 @@ impl methods for reflector { fn visit(ty_name: str, args: [ValueRef]) { let tcx = self.bcx.tcx(); - let mth_idx = option::get(ty::method_idx("visit_" + ty_name, + let mth_idx = option::get(ty::method_idx(@("visit_" + ty_name), *self.visitor_methods)); let mth_ty = ty::mk_fn(tcx, self.visitor_methods[mth_idx].fty); let v = self.visitor_val; @@ -142,7 +142,7 @@ impl methods for reflector { for fields.eachi {|i, field| self.bracketed_mt("rec_field", field.mt, [self.c_uint(i), - self.c_slice(field.ident)]); + self.c_slice(*field.ident)]); } self.visit("leave_rec", [self.c_uint(vec::len(fields))]); } @@ -209,7 +209,7 @@ impl methods for reflector { for fields.eachi {|i, field| self.bracketed_mt("class_field", field.mt, [self.c_uint(i), - self.c_slice(field.ident)]); + self.c_slice(*field.ident)]); } self.visit("leave_class", [self.c_uint(vec::len(fields))]); } @@ -228,7 +228,7 @@ impl methods for reflector { let extra = [self.c_uint(i), self.c_int(v.disr_val), self.c_uint(vec::len(v.args)), - self.c_slice(v.name)]; + self.c_slice(*v.name)]; self.visit("enter_enum_variant", extra); for v.args.eachi {|j, a| self.bracketed_t("enum_variant_field", a, diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs index 2b21e3e954e..cfd779460eb 100644 --- a/src/rustc/middle/trans/shape.rs +++ b/src/rustc/middle/trans/shape.rs @@ -421,7 +421,7 @@ fn gen_enum_shapes(ccx: @crate_ctxt) -> ValueRef { let variant_shape = shape_of_variant(ccx, v); add_substr(data, variant_shape); - let zname = str::bytes(v.name) + [0u8]; + let zname = str::bytes(*v.name) + [0u8]; add_substr(data, zname); } enum_variants += [variants]; diff --git a/src/rustc/middle/trans/tvec.rs b/src/rustc/middle/trans/tvec.rs index 0760bdaf24e..1861f690f9e 100644 --- a/src/rustc/middle/trans/tvec.rs +++ b/src/rustc/middle/trans/tvec.rs @@ -233,7 +233,7 @@ fn get_base_and_len(cx: block, v: ValueRef, e_ty: ty::t) } } -fn trans_estr(bcx: block, s: str, vstore: ast::vstore, +fn trans_estr(bcx: block, s: @str, vstore: ast::vstore, dest: dest) -> block { let _icx = bcx.insn_ctxt("tvec::trans_estr"); let ccx = bcx.ccx(); @@ -242,27 +242,27 @@ fn trans_estr(bcx: block, s: str, vstore: ast::vstore, ast::vstore_fixed(_) { // "hello"/_ => "hello"/5 => [i8 x 6] in llvm - #debug("trans_estr: fixed: %s", s); - C_postr(s) + #debug("trans_estr: fixed: %s", *s); + C_postr(*s) } ast::vstore_slice(_) { // "hello" => (*i8, 6u) in llvm - #debug("trans_estr: slice '%s'", s); - C_estr_slice(ccx, s) + #debug("trans_estr: slice '%s'", *s); + C_estr_slice(ccx, *s) } ast::vstore_uniq { - let cs = PointerCast(bcx, C_cstr(ccx, s), T_ptr(T_i8())); - let len = C_uint(ccx, str::len(s)); + let cs = PointerCast(bcx, C_cstr(ccx, *s), T_ptr(T_i8())); + let len = C_uint(ccx, str::len(*s)); let c = Call(bcx, ccx.upcalls.str_new_uniq, [cs, len]); PointerCast(bcx, c, T_unique_ptr(T_unique(ccx, T_vec(ccx, T_i8())))) } ast::vstore_box { - let cs = PointerCast(bcx, C_cstr(ccx, s), T_ptr(T_i8())); - let len = C_uint(ccx, str::len(s)); + let cs = PointerCast(bcx, C_cstr(ccx, *s), T_ptr(T_i8())); + let len = C_uint(ccx, str::len(*s)); Call(bcx, ccx.upcalls.str_new_shared, [cs, len]) } }; diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs index fac2754796a..315e3be2afd 100644 --- a/src/rustc/middle/trans/type_use.rs +++ b/src/rustc/middle/trans/type_use.rs @@ -76,7 +76,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint) } ast_map::node_native_item(i@@{node: native_item_fn(_, _), _}, abi, _) { if abi == native_abi_rust_intrinsic { - let flags = alt check i.ident { + let flags = alt check *i.ident { "visit_ty" { 3u } "size_of" | "pref_align_of" | "min_align_of" | "init" | "reinterpret_cast" { use_repr } diff --git a/src/rustc/middle/tstate/auxiliary.rs b/src/rustc/middle/tstate/auxiliary.rs index b97e6b21c39..acc11572fe2 100644 --- a/src/rustc/middle/tstate/auxiliary.rs +++ b/src/rustc/middle/tstate/auxiliary.rs @@ -41,7 +41,7 @@ fn comma_str(args: [@constr_arg_use]) -> str { if comma { rslt += ", "; } else { comma = true; } alt a.node { carg_base { rslt += "*"; } - carg_ident(i) { rslt += i.ident; } + carg_ident(i) { rslt += *i.ident; } carg_lit(l) { rslt += lit_to_str(l); } } } @@ -143,11 +143,11 @@ fn log_states_err(pp: pre_and_post_state) { log_cond_err(p2); } -fn print_ident(i: ident) { log(debug, " " + i + " "); } +fn print_ident(i: ident) { log(debug, " " + *i + " "); } fn print_idents(&idents: [ident]) { if vec::len::<ident>(idents) == 0u { ret; } - log(debug, "an ident: " + vec::pop::<ident>(idents)); + log(debug, "an ident: " + *vec::pop::<ident>(idents)); print_idents(idents); } @@ -500,7 +500,7 @@ fn constraints(fcx: fn_ctxt) -> [norm_constraint] { fn match_args(fcx: fn_ctxt, occs: @dvec<pred_args>, occ: [@constr_arg_use]) -> uint { #debug("match_args: looking at %s", - constr_args_to_str(fn@(i: inst) -> str { ret i.ident; }, occ)); + constr_args_to_str(fn@(i: inst) -> str { ret *i.ident; }, occ)); for (*occs).each {|pd| log(debug, "match_args: candidate " + pred_args_to_str(pd)); @@ -581,7 +581,7 @@ fn expr_to_constr(tcx: ty::ctxt, e: @expr) -> sp_constr { fn pred_args_to_str(p: pred_args) -> str { "<" + uint::str(p.node.bit_num) + ", " + - constr_args_to_str(fn@(i: inst) -> str { ret i.ident; }, p.node.args) + constr_args_to_str(fn@(i: inst) -> str { ret *i.ident; }, p.node.args) + ">" } @@ -695,7 +695,7 @@ fn insts_to_str(stuff: [constr_arg_general_<inst>]) -> str { rslt += " " + alt i { - carg_ident(p) { p.ident } + carg_ident(p) { *p.ident } carg_base { "*" } carg_lit(_) { "[lit]" } } + " "; diff --git a/src/rustc/middle/tstate/collect_locals.rs b/src/rustc/middle/tstate/collect_locals.rs index 0d3ab5321df..a6ce1642bab 100644 --- a/src/rustc/middle/tstate/collect_locals.rs +++ b/src/rustc/middle/tstate/collect_locals.rs @@ -138,7 +138,7 @@ fn mk_fn_info(ccx: crate_ctxt, used_vars: v, ignore: ignore}; ccx.fm.insert(id, rslt); - #debug("%s has %u constraints", name, num_constraints(rslt)); + #debug("%s has %u constraints", *name, num_constraints(rslt)); } diff --git a/src/rustc/middle/tstate/states.rs b/src/rustc/middle/tstate/states.rs index 89932070a0c..2b39288152b 100644 --- a/src/rustc/middle/tstate/states.rs +++ b/src/rustc/middle/tstate/states.rs @@ -516,7 +516,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool { let stmt_ann = stmt_to_ann(fcx.ccx, *s); - #debug["[ %s ]", fcx.name]; + #debug["[ %s ]", *fcx.name]; #debug["*At beginning: stmt = %s", stmt_to_str(*s)]; #debug["*prestate = %s", tritv::to_str(stmt_ann.states.prestate)]; #debug["*poststate = %s", tritv::to_str(stmt_ann.states.prestate)]; diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index 8ffc0f36d20..02e683f4cbc 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -237,7 +237,7 @@ type ctxt = node_type_substs: hashmap<node_id, [t]>, items: ast_map::map, - intrinsic_ifaces: hashmap<str, (ast::def_id, t)>, + intrinsic_ifaces: hashmap<ast::ident, (ast::def_id, t)>, freevars: freevars::freevar_map, tcache: type_cache, rcache: creader_cache, @@ -322,7 +322,7 @@ enum region { enum bound_region { br_self, // The self region for classes, impls br_anon, // The anonymous region parameter for a given function. - br_named(str) // A named region parameter. + br_named(ast::ident) // A named region parameter. } type opt_region = option<region>; @@ -414,7 +414,7 @@ enum type_err { terr_constr_mismatch(@type_constr, @type_constr), terr_regions_differ(region, region), terr_vstores_differ(terr_vstore_kind, vstore, vstore), - terr_in_field(@type_err, str), + terr_in_field(@type_err, ast::ident), terr_sorts(t, t), terr_self_substs } @@ -516,7 +516,7 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map, node_types: @smallintmap::mk(), node_type_substs: map::int_hash(), items: amap, - intrinsic_ifaces: map::str_hash(), + intrinsic_ifaces: map::box_str_hash(), freevars: freevars, tcache: ast_util::new_def_hash(), rcache: mk_rcache(), @@ -1992,7 +1992,7 @@ fn hash_bound_region(br: bound_region) -> uint { alt br { // no idea if this is any good ty::br_self { 0u } ty::br_anon { 1u } - ty::br_named(str) { str::hash(str) } + ty::br_named(str) { str::hash(*str) } } } @@ -2298,7 +2298,7 @@ fn field_idx(id: ast::ident, fields: [field]) -> option<uint> { } fn get_field(rec_ty: t, id: ast::ident) -> field { - alt check vec::find(get_fields(rec_ty), {|f| str::eq(f.ident, id) }) { + alt check vec::find(get_fields(rec_ty), {|f| str::eq(*f.ident, *id) }) { some(f) { f } } } @@ -2490,8 +2490,8 @@ fn type_err_to_str(cx: ctxt, err: type_err) -> str { } terr_record_mutability { ret "record elements differ in mutability"; } terr_record_fields(e_fld, a_fld) { - ret "expected a record with field `" + e_fld + - "` but found one with field `" + a_fld + "`"; + ret "expected a record with field `" + *e_fld + + "` but found one with field `" + *a_fld + "`"; } terr_arg_count { ret "incorrect number of function parameters"; } terr_mode_mismatch(e_mode, a_mode) { @@ -2521,7 +2521,7 @@ fn type_err_to_str(cx: ctxt, err: type_err) -> str { vstore_to_str(cx, a_vs)); } terr_in_field(err, fname) { - ret #fmt("in field `%s`, %s", fname, type_err_to_str(cx, *err)); + ret #fmt("in field `%s`, %s", *fname, type_err_to_str(cx, *err)); } terr_sorts(exp, act) { ret #fmt("%s vs %s", ty_sort_str(cx, exp), ty_sort_str(cx, act)); @@ -2592,7 +2592,7 @@ fn ty_to_def_id(ty: t) -> option<ast::def_id> { } // Enum information -type variant_info = @{args: [t], ctor_ty: t, name: str, +type variant_info = @{args: [t], ctor_ty: t, name: ast::ident, id: ast::def_id, disr_val: int}; fn substd_enum_variants(cx: ctxt, @@ -2667,7 +2667,7 @@ fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path { *path + [ast_map::path_name(nm)] } ast_map::node_dtor(_, _, _, path) { - *path + [ast_map::path_name("dtor")] + *path + [ast_map::path_name(@"dtor")] } @@ -2861,7 +2861,7 @@ fn lookup_class_method_by_name(cx:ctxt, did: ast::def_id, name: ident, } } cx.sess.span_fatal(sp, #fmt("Class doesn't have a method \ - named %s", name)); + named %s", *name)); } else { csearch::get_class_method(cx.sess.cstore, did, name) diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index bc7f46703e0..079228ada78 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/src/rustc/middle/typeck/check.rs @@ -260,7 +260,7 @@ fn check_fn(ccx: @crate_ctxt, vec::iter2(arg_tys, decl.inputs) {|arg_ty, input| assign(input.id, some(arg_ty)); #debug["Argument %s is assigned to %s", - input.ident, fcx.locals.get(input.id).to_str()]; + *input.ident, fcx.locals.get(input.id).to_str()]; } // Add explicitly-declared locals. @@ -284,7 +284,7 @@ fn check_fn(ccx: @crate_ctxt, if !pat_util::pat_is_variant(fcx.ccx.tcx.def_map, p) { assign(p.id, none); #debug["Pattern binding %s is assigned to %s", - path.idents[0], + *path.idents[0], fcx.locals.get(p.id).to_str()]; } _ {} @@ -443,13 +443,13 @@ impl of region_scope for @fn_ctxt { fn anon_region() -> result<ty::region, str> { result::ok(self.infcx.next_region_var()) } - fn named_region(id: str) -> result<ty::region, str> { + fn named_region(id: ast::ident) -> result<ty::region, str> { empty_rscope.named_region(id).chain_err { |_e| alt self.in_scope_regions.find(ty::br_named(id)) { some(r) { result::ok(r) } - none if id == "blk" { self.block_region() } + none if *id == "blk" { self.block_region() } none { - result::err(#fmt["named region `%s` not in scope here", id]) + result::err(#fmt["named region `%s` not in scope here", *id]) } } } @@ -937,7 +937,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, self_expr: self_ex, borrow_scope: op_ex.id, node_id: callee_id, - m_name: opname, + m_name: @opname, self_ty: self_t, supplied_tps: [], include_private: false}); @@ -1113,7 +1113,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, ast::expr_vstore(ev, vst) { let typ = alt ev.node { ast::expr_lit(@{node: ast::lit_str(s), span:_}) { - let tt = ast_expr_vstore_to_vstore(fcx, ev, str::len(s), vst); + let tt = ast_expr_vstore_to_vstore(fcx, ev, str::len(*s), vst); ty::mk_estr(tcx, tt) } ast::expr_vec(args, mutbl) { @@ -1553,7 +1553,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, for fields_t.each {|f| let mut found = false; for base_fields.each {|bf| - if str::eq(f.node.ident, bf.ident) { + if str::eq(*f.node.ident, *bf.ident) { demand::suptype(fcx, f.span, bf.mt.ty, f.node.mt.ty); found = true; } @@ -1561,7 +1561,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, if !found { tcx.sess.span_fatal(f.span, "unknown field in record update: " + - f.node.ident); + *f.node.ident); } } } @@ -1645,7 +1645,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, let t_err = fcx.infcx.resolve_type_vars_if_possible(expr_t); let msg = #fmt["attempted access of field %s on type %s, but \ no public field or method with that name was found", - field, ty_to_str(tcx, t_err)]; + *field, ty_to_str(tcx, t_err)]; tcx.sess.span_err(expr.span, msg); // NB: Adding a bogus type to allow typechecking to continue fcx.write_ty(id, fcx.infcx.next_ty_var()); @@ -1690,7 +1690,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, self_expr: p, borrow_scope: expr.id, node_id: alloc_id, - m_name: "alloc", + m_name: @"alloc", self_ty: p_ty, supplied_tps: [], include_private: false}); @@ -2310,7 +2310,7 @@ fn check_bounds_are_used(ccx: @crate_ctxt, for tps_used.eachi { |i, b| if !b { ccx.tcx.sess.span_err( - span, #fmt["Type parameter %s is unused.", tps[i].ident]); + span, #fmt["Type parameter %s is unused.", *tps[i].ident]); } } } @@ -2323,7 +2323,7 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) { {mode: ast::expl(m), ty: ty} } let tcx = ccx.tcx; - let (n_tps, inputs, output) = alt it.ident { + let (n_tps, inputs, output) = alt *it.ident { "size_of" | "pref_align_of" | "min_align_of" { (1u, [], ty::mk_uint(ccx.tcx)) } "get_tydesc" { (1u, [], ty::mk_nil_ptr(tcx)) } @@ -2337,8 +2337,8 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) { "needs_drop" { (1u, [], ty::mk_bool(tcx)) } "visit_ty" { - assert ccx.tcx.intrinsic_ifaces.contains_key("ty_visitor"); - let (_, visitor_iface) = ccx.tcx.intrinsic_ifaces.get("ty_visitor"); + assert ccx.tcx.intrinsic_ifaces.contains_key(@"ty_visitor"); + let (_, visitor_iface) = ccx.tcx.intrinsic_ifaces.get(@"ty_visitor"); (1u, [arg(ast::by_ref, visitor_iface)], ty::mk_nil(tcx)) } "frame_address" { diff --git a/src/rustc/middle/typeck/check/alt.rs b/src/rustc/middle/typeck/check/alt.rs index 6965751084c..d274423c815 100644 --- a/src/rustc/middle/typeck/check/alt.rs +++ b/src/rustc/middle/typeck/check/alt.rs @@ -191,8 +191,8 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) { fields", ex_f_count, f_count]); } - fn matches(name: str, f: ty::field) -> bool { - ret str::eq(name, f.ident); + fn matches(name: ast::ident, f: ty::field) -> bool { + ret str::eq(*name, *f.ident); } for fields.each {|f| alt vec::find(ex_fields, bind matches(f.ident, _)) { @@ -203,7 +203,7 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) { tcx.sess.span_fatal(pat.span, #fmt["mismatched types: did not \ expect a record with a field `%s`", - f.ident]); + *f.ident]); } } } diff --git a/src/rustc/middle/typeck/check/method.rs b/src/rustc/middle/typeck/check/method.rs index d6d43b0d3b2..22d51093fa3 100644 --- a/src/rustc/middle/typeck/check/method.rs +++ b/src/rustc/middle/typeck/check/method.rs @@ -19,7 +19,7 @@ impl methods for lookup { // Entrypoint: fn method() -> option<method_origin> { #debug["method lookup(m_name=%s, self_ty=%s)", - self.m_name, self.fcx.infcx.ty_to_str(self.self_ty)]; + *self.m_name, self.fcx.infcx.ty_to_str(self.self_ty)]; // First, see whether this is an interface-bounded parameter let pass1 = alt ty::get(self.self_ty).struct { diff --git a/src/rustc/middle/typeck/check/regionck.rs b/src/rustc/middle/typeck/check/regionck.rs index 81977a79014..a837f1b267c 100644 --- a/src/rustc/middle/typeck/check/regionck.rs +++ b/src/rustc/middle/typeck/check/regionck.rs @@ -65,7 +65,7 @@ fn visit_pat(p: @ast::pat, &&rcx: rcx, v: rvt) { alt p.node { ast::pat_ident(path, _) if !pat_util::pat_is_variant(fcx.ccx.tcx.def_map, p) { - #debug["visit_pat binding=%s", path.idents[0]]; + #debug["visit_pat binding=%s", *path.idents[0]]; visit_node(p.id, p.span, rcx); } _ {} diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs index e81bd9d3547..afc79b52428 100644 --- a/src/rustc/middle/typeck/collect.rs +++ b/src/rustc/middle/typeck/collect.rs @@ -29,7 +29,7 @@ fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) { // there ought to be a better approach. Attributes? for crate.node.module.items.each {|crate_item| - if crate_item.ident == "intrinsic" { + if *crate_item.ident == "intrinsic" { alt crate_item.node { ast::item_mod(m) { for m.items.each {|intrinsic_item| @@ -170,7 +170,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span, self_ty: ty::t) { if impl_m.tps != if_m.tps { - tcx.sess.span_err(sp, "method `" + if_m.ident + + tcx.sess.span_err(sp, "method `" + *if_m.ident + "` has an incompatible set of type parameters"); ret; } @@ -178,7 +178,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span, if vec::len(impl_m.fty.inputs) != vec::len(if_m.fty.inputs) { tcx.sess.span_err(sp,#fmt["method `%s` has %u parameters \ but the iface has %u", - if_m.ident, + *if_m.ident, vec::len(impl_m.fty.inputs), vec::len(if_m.fty.inputs)]); ret; @@ -211,7 +211,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span, }; require_same_types( tcx, sp, impl_fty, if_fty, - {|| "method `" + if_m.ident + "` has an incompatible type"}); + {|| "method `" + *if_m.ident + "` has an incompatible type"}); ret; // Replaces bound references to the self region with `with_r`. @@ -242,7 +242,7 @@ fn check_methods_against_iface(ccx: @crate_ctxt, ccx.tcx.sess.span_err( span, #fmt["method `%s`'s purity \ not match the iface method's \ - purity", m.ident]); + purity", *m.ident]); } compare_impl_method( ccx.tcx, span, m, vec::len(tps), @@ -251,7 +251,7 @@ fn check_methods_against_iface(ccx: @crate_ctxt, none { tcx.sess.span_err( a_ifacety.path.span, - #fmt["missing method `%s`", if_m.ident]); + #fmt["missing method `%s`", *if_m.ident]); } } // alt } // |if_m| @@ -511,7 +511,7 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item) rp: ast::rp_none, // functions do not have a self ty: ty::mk_fn(ccx.tcx, tofd)}; #debug["type of %s (id %d) is %s", - it.ident, it.id, ty_to_str(tcx, tpt.ty)]; + *it.ident, it.id, ty_to_str(tcx, tpt.ty)]; ccx.tcx.tcache.insert(local_def(it.id), tpt); ret tpt; } diff --git a/src/rustc/middle/typeck/rscope.rs b/src/rustc/middle/typeck/rscope.rs index cf5d78a0f2f..2420250aa1a 100644 --- a/src/rustc/middle/typeck/rscope.rs +++ b/src/rustc/middle/typeck/rscope.rs @@ -2,7 +2,7 @@ import result::result; iface region_scope { fn anon_region() -> result<ty::region, str>; - fn named_region(id: str) -> result<ty::region, str>; + fn named_region(id: ast::ident) -> result<ty::region, str>; } enum empty_rscope { empty_rscope } @@ -10,8 +10,8 @@ impl of region_scope for empty_rscope { fn anon_region() -> result<ty::region, str> { result::err("region types are not allowed here") } - fn named_region(id: str) -> result<ty::region, str> { - if id == "static" { result::ok(ty::re_static) } + fn named_region(id: ast::ident) -> result<ty::region, str> { + if *id == "static" { result::ok(ty::re_static) } else { result::err("only the static region is allowed here") } } } @@ -27,9 +27,9 @@ impl of region_scope for type_rscope { } } } - fn named_region(id: str) -> result<ty::region, str> { + fn named_region(id: ast::ident) -> result<ty::region, str> { empty_rscope.named_region(id).chain_err { |_e| - if id == "self" { self.anon_region() } + if *id == "self" { self.anon_region() } else { result::err("named regions other than `self` are not \ allowed as part of a type declaration") @@ -47,7 +47,7 @@ impl of region_scope for @anon_rscope { fn anon_region() -> result<ty::region, str> { result::ok(self.anon) } - fn named_region(id: str) -> result<ty::region, str> { + fn named_region(id: ast::ident) -> result<ty::region, str> { self.base.named_region(id) } } @@ -61,7 +61,7 @@ impl of region_scope for @binding_rscope { fn anon_region() -> result<ty::region, str> { result::ok(ty::re_bound(ty::br_anon)) } - fn named_region(id: str) -> result<ty::region, str> { + fn named_region(id: ast::ident) -> result<ty::region, str> { self.base.named_region(id).chain_err {|_e| result::ok(ty::re_bound(ty::br_named(id))) } diff --git a/src/rustc/util/common.rs b/src/rustc/util/common.rs index dfddbab647f..e382e3835ba 100644 --- a/src/rustc/util/common.rs +++ b/src/rustc/util/common.rs @@ -72,7 +72,7 @@ fn local_rhs_span(l: @ast::local, def: span) -> span { fn is_main_name(path: syntax::ast_map::path) -> bool { // FIXME: path should be a constrained type, so we know // the call to last doesn't fail - vec::last(path) == syntax::ast_map::path_name("main") + vec::last(path) == syntax::ast_map::path_name(@"main") } // diff --git a/src/rustc/util/ppaux.rs b/src/rustc/util/ppaux.rs index 3c60cb911fe..431eb8b0aea 100644 --- a/src/rustc/util/ppaux.rs +++ b/src/rustc/util/ppaux.rs @@ -21,7 +21,7 @@ import driver::session::session; fn bound_region_to_str(cx: ctxt, br: bound_region) -> str { alt br { br_anon { "&" } - br_named(str) { #fmt["&%s", str] } + br_named(str) { #fmt["&%s", *str] } br_self if cx.sess.ppregions() { "&<self>" } br_self { "&self" } } @@ -130,7 +130,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str { _ {purity_to_str(purity) + " "} }; s += proto_to_str(proto); - alt ident { some(i) { s += " "; s += i; } _ { } } + alt ident { some(i) { s += " "; s += *i; } _ { } } s += "("; let mut strs = []; for inputs.each {|a| strs += [fn_input_to_str(cx, a)]; } @@ -152,7 +152,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str { m.fty.output, m.fty.ret_style, m.fty.constraints) + ";"; } fn field_to_str(cx: ctxt, f: field) -> str { - ret f.ident + ": " + mt_to_str(cx, f.mt); + ret *f.ident + ": " + mt_to_str(cx, f.mt); } // if there is an id, print that instead of the structural type: |
