diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-09-01 17:27:58 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-09-01 17:27:58 -0700 |
| commit | ab6bb035e50f735cb36cc1959e5a097f076a3b74 (patch) | |
| tree | 21cb2954ef9cfe15134fec56f8888ddefce771bf /src/comp | |
| parent | 913667ba2550cbc6b8673580ef90d025d4abd205 (diff) | |
| download | rust-ab6bb035e50f735cb36cc1959e5a097f076a3b74.tar.gz rust-ab6bb035e50f735cb36cc1959e5a097f076a3b74.zip | |
Rename std::istr to std::str. Issue #855
Diffstat (limited to 'src/comp')
53 files changed, 381 insertions, 381 deletions
diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs index de8aa4bfa1b..7ff80d70ce5 100644 --- a/src/comp/back/link.rs +++ b/src/comp/back/link.rs @@ -5,7 +5,7 @@ import front::attr; import middle::ty; import metadata::encoder; import middle::trans_common::crate_ctxt; -import std::istr; +import std::str; import std::fs; import std::vec; import std::option; @@ -37,7 +37,7 @@ fn llvm_err(sess: session::session, msg: &istr) { sess.fatal(msg); } else { sess.fatal( - msg + ~": " + istr::str_from_cstr(buf)); + msg + ~": " + str::str_from_cstr(buf)); } } @@ -45,7 +45,7 @@ fn link_intrinsics(sess: session::session, llmod: ModuleRef) { let path = fs::connect(sess.get_opts().sysroot, ~"lib/intrinsics.bc"); - let membuf = istr::as_buf(path, { |buf| + let membuf = str::as_buf(path, { |buf| llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf) }); if membuf as uint == 0u { @@ -78,11 +78,11 @@ mod write { // Decides what to call an intermediate file, given the name of the output // and the extension to use. fn mk_intermediate_name(output_path: &istr, extension: &istr) -> istr { - let dot_pos = istr::index(output_path, '.' as u8); + let dot_pos = str::index(output_path, '.' as u8); let stem; if dot_pos < 0 { stem = output_path; - } else { stem = istr::substr(output_path, 0u, dot_pos as uint); } + } else { stem = str::substr(output_path, 0u, dot_pos as uint); } ret stem + ~"." + extension; } fn run_passes(sess: session::session, llmod: ModuleRef, output: &istr) { @@ -103,14 +103,14 @@ mod write { output_type_bitcode. { if opts.optimize != 0u { let filename = mk_intermediate_name(output, ~"no-opt.bc"); - istr::as_buf(filename, { |buf| + str::as_buf(filename, { |buf| llvm::LLVMWriteBitcodeToFile(llmod, buf) }); } } _ { let filename = mk_intermediate_name(output, ~"bc"); - istr::as_buf(filename, { |buf| + str::as_buf(filename, { |buf| llvm::LLVMWriteBitcodeToFile(llmod, buf) }); } @@ -185,7 +185,7 @@ mod write { let filename = mk_intermediate_name(output, ~"opt.bc"); llvm::LLVMRunPassManager(pm.llpm, llmod); - istr::as_buf(filename, { |buf| + str::as_buf(filename, { |buf| llvm::LLVMWriteBitcodeToFile(llmod, buf) }); pm = mk_pass_manager(); @@ -193,8 +193,8 @@ mod write { if opts.output_type == output_type_assembly { let _: () = - istr::as_buf(x86::get_target_triple(), { |buf_t| - istr::as_buf(output, { |buf_o| + str::as_buf(x86::get_target_triple(), { |buf_t| + str::as_buf(output, { |buf_o| llvm::LLVMRustWriteOutputFile( pm.llpm, llmod, buf_t, @@ -210,8 +210,8 @@ mod write { if opts.output_type == output_type_object || opts.output_type == output_type_exe { let _: () = - istr::as_buf(x86::get_target_triple(), { |buf_t| - istr::as_buf(output, { |buf_o| + str::as_buf(x86::get_target_triple(), { |buf_t| + str::as_buf(output, { |buf_o| llvm::LLVMRustWriteOutputFile( pm.llpm, llmod, buf_t, @@ -224,8 +224,8 @@ mod write { // If we aren't saving temps then just output the file // type corresponding to the '-c' or '-S' flag used - let _: () = istr::as_buf(x86::get_target_triple(), { |buf_t| - istr::as_buf(output, { |buf_o| + let _: () = str::as_buf(x86::get_target_triple(), { |buf_t| + str::as_buf(output, { |buf_o| llvm::LLVMRustWriteOutputFile(pm.llpm, llmod, buf_t, buf_o, @@ -243,7 +243,7 @@ mod write { // flag, then output it here llvm::LLVMRunPassManager(pm.llpm, llmod); - istr::as_buf(output, { |buf| + str::as_buf(output, { |buf| llvm::LLVMWriteBitcodeToFile(llmod, buf) }); llvm::LLVMDisposeModule(llmod); @@ -340,7 +340,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &istr, fn crate_meta_extras_hash(sha: sha1, _crate: &ast::crate, metas: &provided_metas) -> istr { fn len_and_str(s: &istr) -> istr { - ret #ifmt["%u_%s", istr::byte_len(s), s]; + ret #ifmt["%u_%s", str::byte_len(s), s]; } fn len_and_str_lit(l: &ast::lit) -> istr { @@ -383,12 +383,12 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &istr, none. { let name = { - let os = istr::split( + let os = str::split( fs::basename(output), '.' as u8); assert (vec::len(os) >= 2u); vec::pop(os); - istr::connect(os, ~".") + str::connect(os, ~".") }; warn_missing(sess, ~"name", name); name @@ -417,7 +417,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &istr, } fn truncated_sha1_result(sha: sha1) -> istr { - ret istr::substr(sha.result_str(), 0u, 16u); + ret str::substr(sha.result_str(), 0u, 16u); } @@ -458,7 +458,7 @@ fn mangle(ss: &[istr]) -> istr { let n = ~"_ZN"; // Begin name-sequence. for s: istr in ss { - n += #ifmt["%u%s", istr::byte_len(s), s]; + n += #ifmt["%u%s", str::byte_len(s), s]; } n += ~"E"; // End name-sequence. diff --git a/src/comp/back/upcall.rs b/src/comp/back/upcall.rs index 4d14145d8f7..13186bcbca4 100644 --- a/src/comp/back/upcall.rs +++ b/src/comp/back/upcall.rs @@ -1,5 +1,5 @@ -import std::istr; +import std::str; import middle::trans; import trans::decl_cdecl_fn; import middle::trans_common::T_f32; diff --git a/src/comp/back/x86.rs b/src/comp/back/x86.rs index 6823f8c2030..02b33ff105c 100644 --- a/src/comp/back/x86.rs +++ b/src/comp/back/x86.rs @@ -1,34 +1,34 @@ import lib::llvm::llvm; import lib::llvm::llvm::ModuleRef; -import std::istr; +import std::str; import std::os::target_os; fn get_module_asm() -> istr { ret ~""; } fn get_meta_sect_name() -> istr { - if istr::eq(target_os(), ~"macos") { ret ~"__DATA,__note.rustc"; } - if istr::eq(target_os(), ~"win32") { ret ~".note.rustc"; } + if str::eq(target_os(), ~"macos") { ret ~"__DATA,__note.rustc"; } + if str::eq(target_os(), ~"win32") { ret ~".note.rustc"; } ret ~".note.rustc"; } fn get_data_layout() -> istr { - if istr::eq(target_os(), ~"macos") { + if str::eq(target_os(), ~"macos") { ret ~"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" + ~"-i32:32:32-i64:32:64" + ~"-f32:32:32-f64:32:64-v64:64:64" + ~"-v128:128:128-a0:0:64-f80:128:128" + ~"-n8:16:32"; } - if istr::eq(target_os(), ~"win32") { + if str::eq(target_os(), ~"win32") { ret ~"e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32"; } ret ~"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"; } fn get_target_triple() -> istr { - if istr::eq(target_os(), ~"macos") { ret ~"i686-apple-darwin"; } - if istr::eq(target_os(), ~"win32") { ret ~"i686-pc-mingw32"; } + if str::eq(target_os(), ~"macos") { ret ~"i686-apple-darwin"; } + if str::eq(target_os(), ~"win32") { ret ~"i686-pc-mingw32"; } ret ~"i686-unknown-linux-gnu"; } // diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index 71537effd03..3ae222369dc 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -26,7 +26,7 @@ import std::map::mk_hashmap; import std::option; import std::option::some; import std::option::none; -import std::istr; +import std::str; import std::vec; import std::int; import std::io; @@ -107,7 +107,7 @@ fn parse_input_src(sess: session::session, cfg: &ast::crate_cfg, if infile != ~"-" { io::file_reader(infile) } else { io::stdin() }.read_whole_stream(); - let src = istr::unsafe_from_bytes(srcbytes); + let src = str::unsafe_from_bytes(srcbytes); let crate = parser::parse_crate_from_source_str( infile, @@ -260,7 +260,7 @@ fn version(argv0: &istr) { // FIXME: Restore after istr conversion //let env_vers = #env["CFG_VERSION"]; let env_vers = ~"FIXME"; - if istr::byte_len(env_vers) != 0u { vers = env_vers; } + if str::byte_len(env_vers) != 0u { vers = env_vers; } io::stdout().write_str( #ifmt["%s %s\n", argv0, @@ -307,40 +307,40 @@ options: } fn get_os(triple: &istr) -> session::os { - ret if istr::find(triple, ~"win32") >= 0 || - istr::find(triple, ~"mingw32") >= 0 { + ret if str::find(triple, ~"win32") >= 0 || + str::find(triple, ~"mingw32") >= 0 { session::os_win32 - } else if istr::find(triple, ~"darwin") >= 0 { + } else if str::find(triple, ~"darwin") >= 0 { session::os_macos - } else if istr::find(triple, ~"linux") >= 0 { + } else if str::find(triple, ~"linux") >= 0 { session::os_linux } else { log_err ~"Unknown operating system!"; fail }; } fn get_arch(triple: &istr) -> session::arch { - ret if istr::find(triple, ~"i386") >= 0 || - istr::find(triple, ~"i486") >= 0 || - istr::find(triple, ~"i586") >= 0 || - istr::find(triple, ~"i686") >= 0 || - istr::find(triple, ~"i786") >= 0 { + ret if str::find(triple, ~"i386") >= 0 || + str::find(triple, ~"i486") >= 0 || + str::find(triple, ~"i586") >= 0 || + str::find(triple, ~"i686") >= 0 || + str::find(triple, ~"i786") >= 0 { session::arch_x86 - } else if istr::find(triple, ~"x86_64") >= 0 { + } else if str::find(triple, ~"x86_64") >= 0 { session::arch_x64 - } else if istr::find(triple, ~"arm") >= 0 || - istr::find(triple, ~"xscale") >= 0 { + } else if str::find(triple, ~"arm") >= 0 || + str::find(triple, ~"xscale") >= 0 { session::arch_arm } else { log_err ~"Unknown architecture! " + triple; fail }; } fn get_default_sysroot(binary: &istr) -> istr { let dirname = fs::dirname(binary); - if istr::eq(dirname, binary) { ret ~"."; } + if str::eq(dirname, binary) { ret ~"."; } ret dirname; } fn build_target_config() -> @session::config { let triple: istr = - istr::str_from_cstr(llvm::llvm::LLVMRustGetHostTriple()); + str::str_from_cstr(llvm::llvm::LLVMRustGetHostTriple()); let target_cfg: @session::config = @{os: get_os(triple), arch: get_arch(triple), @@ -442,13 +442,13 @@ fn build_session(sopts: @session::options) -> session::session { } fn parse_pretty(sess: session::session, name: &istr) -> pp_mode { - if istr::eq(name, ~"normal") { + if str::eq(name, ~"normal") { ret ppm_normal; - } else if istr::eq(name, ~"expanded") { + } else if str::eq(name, ~"expanded") { ret ppm_expanded; - } else if istr::eq(name, ~"typed") { + } else if str::eq(name, ~"typed") { ret ppm_typed; - } else if istr::eq(name, ~"identified") { ret ppm_identified; } + } else if str::eq(name, ~"identified") { ret ppm_identified; } sess.fatal(~"argument to `pretty` must be one of `normal`, `typed`, or " + ~"`identified`"); } @@ -533,10 +533,10 @@ fn main(args: [istr]) { // We want to toss everything after the final '.' let parts = if !input_is_stdin(ifile) { - istr::split(ifile, '.' as u8) + str::split(ifile, '.' as u8) } else { [~"default", ~"rs"] }; vec::pop(parts); - saved_out_filename = istr::connect(parts, ~"."); + saved_out_filename = str::connect(parts, ~"."); let suffix = alt sopts.output_type { link::output_type_none. { ~"none" } @@ -591,15 +591,15 @@ fn main(args: [istr]) { bind fn (config: @session::config, filename: &istr) -> istr { if config.os == session::os_macos || config.os == session::os_linux && - istr::find(filename, ~"lib") == 0 { - ret istr::slice(filename, 3u, - istr::byte_len(filename)); + str::find(filename, ~"lib") == 0 { + ret str::slice(filename, 3u, + str::byte_len(filename)); } else { ret filename; } }(config, _); fn rmext(filename: &istr) -> istr { - let parts = istr::split(filename, '.' as u8); + let parts = str::split(filename, '.' as u8); vec::pop(parts); - ret istr::connect(parts, ~"."); + ret str::connect(parts, ~"."); } ret alt config.os { session::os_macos. { rmext(rmlib(filename)) } @@ -610,7 +610,7 @@ fn main(args: [istr]) { let cstore = sess.get_cstore(); for cratepath: istr in cstore::get_used_crate_files(cstore) { - if istr::ends_with(cratepath, ~".rlib") { + if str::ends_with(cratepath, ~".rlib") { gcc_args += [cratepath]; cont; } @@ -641,7 +641,7 @@ fn main(args: [istr]) { #ifmt["linking with gcc failed with code %d", err_code]); sess.note( #ifmt["gcc arguments: %s", - istr::connect(gcc_args, ~" ")]); + str::connect(gcc_args, ~" ")]); sess.abort_if_errors(); } // Clean up on Darwin diff --git a/src/comp/driver/session.rs b/src/comp/driver/session.rs index cf5841b1227..7f40921088d 100644 --- a/src/comp/driver/session.rs +++ b/src/comp/driver/session.rs @@ -9,7 +9,7 @@ import std::map; import std::option; import std::option::some; import std::option::none; -import std::istr; +import std::str; import syntax::parse::parser::parse_sess; tag os { os_win32; os_macos; os_linux; } diff --git a/src/comp/front/attr.rs b/src/comp/front/attr.rs index 47e557a35e5..4ad38e2274e 100644 --- a/src/comp/front/attr.rs +++ b/src/comp/front/attr.rs @@ -1,7 +1,7 @@ // Functions dealing with attributes and meta_items import std::vec; -import std::istr; +import std::str; import std::map; import std::option; import syntax::ast; diff --git a/src/comp/front/test.rs b/src/comp/front/test.rs index 1f9a1f869f3..f2eced86634 100644 --- a/src/comp/front/test.rs +++ b/src/comp/front/test.rs @@ -2,7 +2,7 @@ import std::option; import std::vec; -import std::istr; +import std::str; import syntax::ast; import syntax::ast_util; import syntax::ast_util::*; diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs index 2b185c1abbb..d59f6893815 100644 --- a/src/comp/lib/llvm.rs +++ b/src/comp/lib/llvm.rs @@ -1,6 +1,6 @@ import std::vec; -import std::istr; -import std::istr::sbuf; +import std::str; +import std::str::sbuf; import llvm::ModuleRef; import llvm::ContextRef; @@ -1070,7 +1070,7 @@ resource target_data_res(TD: TargetDataRef) { type target_data = {lltd: TargetDataRef, dtor: @target_data_res}; fn mk_target_data(string_rep: &istr) -> target_data { - let lltd = istr::as_buf(string_rep, { |buf| + let lltd = str::as_buf(string_rep, { |buf| llvm::LLVMCreateTargetData(buf) }); ret {lltd: lltd, dtor: @target_data_res(lltd)}; diff --git a/src/comp/metadata/common.rs b/src/comp/metadata/common.rs index 02f434c5c50..05c0de1bb2b 100644 --- a/src/comp/metadata/common.rs +++ b/src/comp/metadata/common.rs @@ -1,6 +1,6 @@ // EBML tag definitions and utils shared by the encoder and decoder -import std::istr; +import std::str; const tag_paths: uint = 0x01u; @@ -69,7 +69,7 @@ fn hash_node_id(node_id: &int) -> uint { ret 177573u ^ (node_id as uint); } fn hash_path(s: &istr) -> uint { let h = 5381u; - for ch: u8 in istr::bytes(s) { h = (h << 5u) + h ^ (ch as uint); } + for ch: u8 in str::bytes(s) { h = (h << 5u) + h ^ (ch as uint); } ret h; } diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs index 64b198b861a..81978664a07 100644 --- a/src/comp/metadata/creader.rs +++ b/src/comp/metadata/creader.rs @@ -14,7 +14,7 @@ import syntax::codemap::span; import back::x86; import util::common; import std::vec; -import std::istr; +import std::str; import std::fs; import std::io; import std::option; @@ -173,7 +173,7 @@ fn find_library_crate_aux(nn: &{prefix: istr, suffix: istr}, for path: istr in fs::list_dir(library_search_path) { log #ifmt["searching %s", path]; let f: istr = fs::basename(path); - if !(istr::starts_with(f, prefix) && istr::ends_with(f, suffix)) + if !(str::starts_with(f, prefix) && str::ends_with(f, suffix)) { log #ifmt["skipping %s, doesn't look like %s*%s", path, @@ -200,7 +200,7 @@ fn find_library_crate_aux(nn: &{prefix: istr, suffix: istr}, } fn get_metadata_section(filename: &istr) -> option::t<@[u8]> { - let mb = istr::as_buf(filename, { |buf| + let mb = str::as_buf(filename, { |buf| llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf) }); if mb as int == 0 { ret option::none::<@[u8]>; } @@ -208,8 +208,8 @@ fn get_metadata_section(filename: &istr) -> option::t<@[u8]> { let si = mk_section_iter(of.llof); while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False { let name_buf = llvm::LLVMGetSectionName(si.llsi); - let name = istr::str_from_cstr(name_buf); - if istr::eq(name, x86::get_meta_sect_name()) { + let name = str::str_from_cstr(name_buf); + if str::eq(name, x86::get_meta_sect_name()) { let cbuf = llvm::LLVMGetSectionContents(si.llsi); let csz = llvm::LLVMGetSectionSize(si.llsi); let cvbuf: *u8 = std::unsafe::reinterpret_cast(cbuf); diff --git a/src/comp/metadata/cstore.rs b/src/comp/metadata/cstore.rs index b286e155f7a..c5f161394bd 100644 --- a/src/comp/metadata/cstore.rs +++ b/src/comp/metadata/cstore.rs @@ -3,7 +3,7 @@ import std::vec; import std::map; -import std::istr; +import std::str; import syntax::ast; export cstore; @@ -106,7 +106,7 @@ fn get_used_libraries(cstore: &cstore) -> [istr] { } fn add_used_link_args(cstore: &cstore, args: &istr) { - p(cstore).used_link_args += istr::split(args, ' ' as u8); + p(cstore).used_link_args += str::split(args, ' ' as u8); } fn get_used_link_args(cstore: &cstore) -> [istr] { diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs index e6a44618cf9..c3365f4f57c 100644 --- a/src/comp/metadata/decoder.rs +++ b/src/comp/metadata/decoder.rs @@ -3,7 +3,7 @@ import std::ebml; import std::vec; import std::option; -import std::istr; +import std::str; import std::io; import std::map::hashmap; import syntax::ast; @@ -85,7 +85,7 @@ fn item_family(item: &ebml::doc) -> u8 { fn item_symbol(item: &ebml::doc) -> istr { let sym = ebml::get_doc(item, tag_items_data_item_symbol); - ret istr::unsafe_from_bytes(ebml::doc_data(sym)); + ret str::unsafe_from_bytes(ebml::doc_data(sym)); } fn variant_tag_id(d: &ebml::doc) -> ast::def_id { @@ -98,7 +98,7 @@ fn item_type(item: &ebml::doc, this_cnum: ast::crate_num, tcx: ty::ctxt, fn parse_external_def_id(this_cnum: ast::crate_num, extres: &external_resolver, s: &istr) -> ast::def_id { - let buf = istr::bytes(s); + let buf = str::bytes(s); let external_def_id = parse_def_id(buf); @@ -150,9 +150,9 @@ fn tag_variant_ids(item: &ebml::doc, this_cnum: ast::crate_num) -> // definition the path refers to. fn resolve_path(path: &[ast::ident], data: @[u8]) -> [ast::def_id] { fn eq_item(data: &[u8], s: &istr) -> bool { - ret istr::eq(istr::unsafe_from_bytes(data), s); + ret str::eq(str::unsafe_from_bytes(data), s); } - let s = istr::connect(path, ~"::"); + let s = str::connect(path, ~"::"); let md = ebml::new_doc(data); let paths = ebml::get_doc(md, tag_paths); let eqer = bind eq_item(_, s); @@ -272,7 +272,7 @@ fn read_path(d: &ebml::doc) -> {path: istr, pos: uint} { let desc = ebml::doc_data(d); let pos = ebml::be_uint_from_bytes(@desc, 0u, 4u); let pathbytes = vec::slice::<u8>(desc, 4u, vec::len::<u8>(desc)); - let path = istr::unsafe_from_bytes(pathbytes); + let path = str::unsafe_from_bytes(pathbytes); ret {path: path, pos: pos}; } @@ -301,15 +301,15 @@ fn get_meta_items(md: &ebml::doc) -> [@ast::meta_item] { for each meta_item_doc: ebml::doc in ebml::tagged_docs(md, tag_meta_item_word) { let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); - let n = istr::unsafe_from_bytes(ebml::doc_data(nd)); + let n = str::unsafe_from_bytes(ebml::doc_data(nd)); items += [attr::mk_word_item(n)]; } for each meta_item_doc: ebml::doc in ebml::tagged_docs(md, tag_meta_item_name_value) { let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); let vd = ebml::get_doc(meta_item_doc, tag_meta_item_value); - let n = istr::unsafe_from_bytes(ebml::doc_data(nd)); - let v = istr::unsafe_from_bytes(ebml::doc_data(vd)); + let n = str::unsafe_from_bytes(ebml::doc_data(nd)); + let v = str::unsafe_from_bytes(ebml::doc_data(vd)); // FIXME (#611): Should be able to decode meta_name_value variants, // but currently they can't be encoded items += [attr::mk_name_value_item_str(n, v)]; @@ -317,7 +317,7 @@ fn get_meta_items(md: &ebml::doc) -> [@ast::meta_item] { for each meta_item_doc: ebml::doc in ebml::tagged_docs(md, tag_meta_item_list) { let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); - let n = istr::unsafe_from_bytes(ebml::doc_data(nd)); + let n = str::unsafe_from_bytes(ebml::doc_data(nd)); let subitems = get_meta_items(meta_item_doc); items += [attr::mk_list_item(n, subitems)]; } @@ -377,7 +377,7 @@ fn get_crate_deps(data: @[u8]) -> [crate_dep] { let depsdoc = ebml::get_doc(cratedoc, tag_crate_deps); let crate_num = 1; for each depdoc: ebml::doc in ebml::tagged_docs(depsdoc, tag_crate_dep) { - let depname = istr::unsafe_from_bytes(ebml::doc_data(depdoc)); + let depname = str::unsafe_from_bytes(ebml::doc_data(depdoc)); deps += [{cnum: crate_num, ident: depname}]; crate_num += 1; } diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs index e4e8ff1bbe9..384088c59e6 100644 --- a/src/comp/metadata/encoder.rs +++ b/src/comp/metadata/encoder.rs @@ -1,7 +1,7 @@ // Metadata encoding import std::vec; -import std::istr; +import std::str; import std::uint; import std::io; import std::option; @@ -28,13 +28,13 @@ type encode_ctxt = {ccx: @crate_ctxt, type_abbrevs: abbrev_map}; // Path table encoding fn encode_name(ebml_w: &ebml::writer, name: &istr) { ebml::start_tag(ebml_w, tag_paths_data_name); - ebml_w.writer.write(istr::bytes(name)); + ebml_w.writer.write(str::bytes(name)); ebml::end_tag(ebml_w); } fn encode_def_id(ebml_w: &ebml::writer, id: &def_id) { ebml::start_tag(ebml_w, tag_def_id); - ebml_w.writer.write(istr::bytes(def_to_str(id))); + ebml_w.writer.write(str::bytes(def_to_str(id))); ebml::end_tag(ebml_w); } @@ -55,7 +55,7 @@ fn add_to_index(ebml_w: &ebml::writer, path: &[istr], index: &mutable [entry<istr>], name: &istr) { let full_path = path + [name]; index += - [{val: istr::connect(full_path, ~"::"), pos: ebml_w.writer.tell()}]; + [{val: str::connect(full_path, ~"::"), pos: ebml_w.writer.tell()}]; } fn encode_native_module_item_paths(ebml_w: &ebml::writer, nmod: &native_mod, @@ -197,7 +197,7 @@ fn encode_type_param_kinds(ebml_w: &ebml::writer, tps: &[ty_param]) { fn encode_variant_id(ebml_w: &ebml::writer, vid: &def_id) { ebml::start_tag(ebml_w, tag_items_data_item_variant); - ebml_w.writer.write(istr::bytes(def_to_str(vid))); + ebml_w.writer.write(str::bytes(def_to_str(vid))); ebml::end_tag(ebml_w); } @@ -214,20 +214,20 @@ fn encode_type(ecx: &@encode_ctxt, ebml_w: &ebml::writer, typ: ty::t) { fn encode_symbol(ecx: &@encode_ctxt, ebml_w: &ebml::writer, id: node_id) { ebml::start_tag(ebml_w, tag_items_data_item_symbol); - ebml_w.writer.write(istr::bytes(ecx.ccx.item_symbols.get(id))); + ebml_w.writer.write(str::bytes(ecx.ccx.item_symbols.get(id))); ebml::end_tag(ebml_w); } fn encode_discriminant(ecx: &@encode_ctxt, ebml_w: &ebml::writer, id: node_id) { ebml::start_tag(ebml_w, tag_items_data_item_symbol); - ebml_w.writer.write(istr::bytes(ecx.ccx.discrim_symbols.get(id))); + ebml_w.writer.write(str::bytes(ecx.ccx.discrim_symbols.get(id))); ebml::end_tag(ebml_w); } fn encode_tag_id(ebml_w: &ebml::writer, id: &def_id) { ebml::start_tag(ebml_w, tag_items_data_item_tag_id); - ebml_w.writer.write(istr::bytes(def_to_str(id))); + ebml_w.writer.write(str::bytes(def_to_str(id))); ebml::end_tag(ebml_w); } @@ -454,7 +454,7 @@ fn encode_meta_item(ebml_w: &ebml::writer, mi: &meta_item) { meta_word(name) { ebml::start_tag(ebml_w, tag_meta_item_word); ebml::start_tag(ebml_w, tag_meta_item_name); - ebml_w.writer.write(istr::bytes(name)); + ebml_w.writer.write(str::bytes(name)); ebml::end_tag(ebml_w); ebml::end_tag(ebml_w); } @@ -463,10 +463,10 @@ fn encode_meta_item(ebml_w: &ebml::writer, mi: &meta_item) { lit_str(value, _) { ebml::start_tag(ebml_w, tag_meta_item_name_value); ebml::start_tag(ebml_w, tag_meta_item_name); - ebml_w.writer.write(istr::bytes(name)); + ebml_w.writer.write(str::bytes(name)); ebml::end_tag(ebml_w); ebml::start_tag(ebml_w, tag_meta_item_value); - ebml_w.writer.write(istr::bytes(value)); + ebml_w.writer.write(str::bytes(value)); ebml::end_tag(ebml_w); ebml::end_tag(ebml_w); } @@ -476,7 +476,7 @@ fn encode_meta_item(ebml_w: &ebml::writer, mi: &meta_item) { meta_list(name, items) { ebml::start_tag(ebml_w, tag_meta_item_list); ebml::start_tag(ebml_w, tag_meta_item_name); - ebml_w.writer.write(istr::bytes(name)); + ebml_w.writer.write(str::bytes(name)); ebml::end_tag(ebml_w); for inner_item: @meta_item in items { encode_meta_item(ebml_w, *inner_item); @@ -588,7 +588,7 @@ fn encode_crate_deps(ebml_w: &ebml::writer, cstore: &cstore::cstore) { ebml::start_tag(ebml_w, tag_crate_deps); for cname: istr in get_ordered_names(cstore) { ebml::start_tag(ebml_w, tag_crate_dep); - ebml_w.writer.write(istr::bytes(cname)); + ebml_w.writer.write(str::bytes(cname)); ebml::end_tag(ebml_w); } ebml::end_tag(ebml_w); diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs index 9f5a0dca4d6..23ba2fa01a6 100644 --- a/src/comp/metadata/tydecode.rs +++ b/src/comp/metadata/tydecode.rs @@ -1,7 +1,7 @@ // Type decoding import std::vec; -import std::istr; +import std::str; import std::uint; import std::option; import std::option::none; @@ -44,7 +44,7 @@ fn parse_ident_(st: @pstate, _sd: str_def, is_last: fn(char) -> bool) -> ast::ident { let rslt = ~""; while !is_last(peek(st) as char) { - rslt += istr::unsafe_from_byte(next(st)); + rslt += str::unsafe_from_byte(next(st)); } ret rslt; } @@ -227,7 +227,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t { while peek(st) as char != ']' { let name = ~""; while peek(st) as char != '=' { - name += istr::unsafe_from_byte(next(st)); + name += str::unsafe_from_byte(next(st)); } st.pos = st.pos + 1u; fields += [{ident: name, mt: parse_mt(st, sd)}]; @@ -280,7 +280,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t { } let name = ~""; while peek(st) as char != '[' { - name += istr::unsafe_from_byte(next(st)); + name += str::unsafe_from_byte(next(st)); } let func = parse_ty_fn(st, sd); methods += @@ -345,7 +345,7 @@ fn parse_mt(st: @pstate, sd: str_def) -> ty::mt { fn parse_def(st: @pstate, sd: str_def) -> ast::def_id { let def = ~""; while peek(st) as char != '|' { - def += istr::unsafe_from_byte(next(st)); + def += str::unsafe_from_byte(next(st)); } st.pos = st.pos + 1u; ret sd(def); diff --git a/src/comp/metadata/tyencode.rs b/src/comp/metadata/tyencode.rs index fe010f589bf..c76cd75a285 100644 --- a/src/comp/metadata/tyencode.rs +++ b/src/comp/metadata/tyencode.rs @@ -1,6 +1,6 @@ // Type encoding -import std::istr; +import std::str; import std::io; import std::map::hashmap; import std::option::some; diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs index 5d42131e3af..aaa97399294 100644 --- a/src/comp/middle/alias.rs +++ b/src/comp/middle/alias.rs @@ -10,7 +10,7 @@ import syntax::codemap::span; import syntax::visit; import visit::vt; import std::vec; -import std::istr; +import std::str; import std::option; import std::option::some; import std::option::none; diff --git a/src/comp/middle/freevars.rs b/src/comp/middle/freevars.rs index 622f4bb5282..706e814a01c 100644 --- a/src/comp/middle/freevars.rs +++ b/src/comp/middle/freevars.rs @@ -5,7 +5,7 @@ import std::map; import std::map::*; import std::option; import std::int; -import std::istr; +import std::str; import std::option::*; import syntax::ast; import syntax::ast_util; diff --git a/src/comp/middle/gc.rs b/src/comp/middle/gc.rs index 3932e9c0735..d9858057970 100644 --- a/src/comp/middle/gc.rs +++ b/src/comp/middle/gc.rs @@ -10,7 +10,7 @@ import middle::ty; import std::option::none; import std::option::some; import std::ptr; -import std::istr; +import std::str; import std::unsafe; import std::vec; @@ -22,7 +22,7 @@ type ctxt = @{mutable next_tydesc_num: uint}; fn mk_ctxt() -> ctxt { ret @{mutable next_tydesc_num: 0u}; } fn add_global(ccx: &@crate_ctxt, llval: ValueRef, name: &istr) -> ValueRef { - let llglobal = istr::as_buf(name, { |buf| + let llglobal = str::as_buf(name, { |buf| lll::LLVMAddGlobal(ccx.llmod, val_ty(llval), buf) }); lll::LLVMSetInitializer(llglobal, llval); diff --git a/src/comp/middle/kind.rs b/src/comp/middle/kind.rs index 9a9807cf489..71b21110962 100644 --- a/src/comp/middle/kind.rs +++ b/src/comp/middle/kind.rs @@ -77,7 +77,7 @@ import syntax::visit; import std::vec; import std::option; -import std::istr; +import std::str; import ast::kind; import ast::kind_unique; diff --git a/src/comp/middle/mut.rs b/src/comp/middle/mut.rs index b2420252efa..bf54a5d01d6 100644 --- a/src/comp/middle/mut.rs +++ b/src/comp/middle/mut.rs @@ -1,4 +1,4 @@ -import std::{vec, istr, option}; +import std::{vec, str, option}; import option::{some, none}; import syntax::ast::*; import syntax::visit; @@ -54,7 +54,7 @@ fn expr_root(tcx: &ty::ctxt, ex: @expr, autoderef: bool) alt ty::struct(tcx, auto_unbox.t) { ty::ty_rec(fields) { for fld: ty::field in fields { - if istr::eq(ident, fld.ident) { + if str::eq(ident, fld.ident) { mut = fld.mt.mut != imm; break; } diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs index e712abaa751..117c10b0db7 100644 --- a/src/comp/middle/resolve.rs +++ b/src/comp/middle/resolve.rs @@ -32,7 +32,7 @@ import std::option; import std::option::is_none; import std::option::some; import std::option::none; -import std::istr; +import std::str; import syntax::print::pprust::*; export resolve_crate; @@ -79,7 +79,7 @@ type ext_hash = hashmap<{did: def_id, ident: istr, ns: namespace}, def>; fn new_ext_hash() -> ext_hash { type key = {did: def_id, ident: istr, ns: namespace}; fn hash(v: &key) -> uint { - ret istr::hash(v.ident) + util::common::hash_def(v.did) + + ret str::hash(v.ident) + util::common::hash_def(v.did) + alt v.ns { ns_value. { 1u } ns_type. { 2u } @@ -88,7 +88,7 @@ fn new_ext_hash() -> ext_hash { } fn eq(v1: &key, v2: &key) -> bool { ret util::common::def_eq(v1.did, v2.did) && - istr::eq(v1.ident, v2.ident) && v1.ns == v2.ns; + str::eq(v1.ident, v2.ident) && v1.ns == v2.ns; } ret std::map::mk_hashmap::<key, def>(hash, eq); } @@ -430,7 +430,7 @@ fn follow_import(e: &env, sc: &scopes, path: &[ident], sp: &span) -> ast::def_mod(_) | ast::def_native_mod(_) { ret dcur; } _ { e.sess.span_err(sp, - istr::connect(path, ~"::") + + str::connect(path, ~"::") + ~" does not name a module."); ret none; } @@ -463,7 +463,7 @@ fn resolve_import(e: &env, defid: ast::def_id, name: &ast::ident, let end_id = ids[n_idents - 1u]; // Ignore the current scope if this import would shadow itself. let sc = - if istr::eq(name, ids[0]) { std::list::cdr(sc_in) } else { sc_in }; + if str::eq(name, ids[0]) { std::list::cdr(sc_in) } else { sc_in }; if n_idents == 1u { register(e, defid, sp, end_id, sc_in, lookup_in_scope(e, sc, sp, end_id, ns_value), @@ -560,7 +560,7 @@ fn unresolved_err(e: &env, sc: &scopes, sp: &span, } let err_scope = find_fn_or_mod_scope(sc); for rs: {ident: istr, sc: scope} in e.reported { - if istr::eq(rs.ident, name) + if str::eq(rs.ident, name) && err_scope == rs.sc { ret; } } e.reported += [{ident: name, sc: err_scope}]; @@ -759,7 +759,7 @@ fn lookup_in_ty_params(name: &ident, ty_params: &[ast::ty_param]) -> option::t<def> { let i = 0u; for tp: ast::ty_param in ty_params { - if istr::eq(tp.ident, name) { ret some(ast::def_ty_arg(i, tp.kind)); } + if str::eq(tp.ident, name) { ret some(ast::def_ty_arg(i, tp.kind)); } i += 1u; } ret none::<def>; @@ -769,7 +769,7 @@ fn lookup_in_pat(name: &ident, pat: &@ast::pat) -> option::t<def_id> { let found = none; for each bound in ast_util::pat_bindings(pat) { let p_name = alt bound.node { ast::pat_bind(n) { n } }; - if istr::eq(p_name, name) { found = some(local_def(bound.id)); } + if str::eq(p_name, name) { found = some(local_def(bound.id)); } } ret found; } @@ -780,7 +780,7 @@ fn lookup_in_fn(name: &ident, decl: &ast::fn_decl, alt ns { ns_value. { for a: ast::arg in decl.inputs { - if istr::eq(a.ident, name) { + if str::eq(a.ident, name) { ret some(ast::def_arg(local_def(a.id), a.mode)); } } @@ -796,7 +796,7 @@ fn lookup_in_obj(name: &ident, ob: &ast::_obj, ty_params: &[ast::ty_param], alt ns { ns_value. { for f: ast::obj_field in ob.fields { - if istr::eq(f.ident, name) { + if str::eq(f.ident, name) { ret some(ast::def_obj_field(local_def(f.id), f.mut)); } } @@ -835,12 +835,12 @@ fn lookup_in_block(name: &ident, b: &ast::blk_, pos: uint, loc_pos: uint, alt it.node { ast::item_tag(variants, _) { if ns == ns_type { - if istr::eq(it.ident, name) { + if str::eq(it.ident, name) { ret some(ast::def_ty(local_def(it.id))); } } else if ns == ns_value { for v: ast::variant in variants { - if istr::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))); @@ -849,7 +849,7 @@ fn lookup_in_block(name: &ident, b: &ast::blk_, pos: uint, loc_pos: uint, } } _ { - if istr::eq(it.ident, name) { + if str::eq(it.ident, name) { let found = found_def_item(it, ns); if !is_none(found) { ret found; } } @@ -1332,7 +1332,7 @@ fn check_arm(e: &@env, a: &ast::arm, x: &(), v: &vt<()>) { ~"inconsistent number of bindings"); } else { for name: ident in ch.seen { - if is_none(vec::find(bind istr::eq(name, _), seen0)) { + if is_none(vec::find(bind str::eq(name, _), seen0)) { // Fight the alias checker let name_ = name; e.sess.span_err(a.pats[i].span, @@ -1428,7 +1428,7 @@ fn checker(e: &env, kind: &istr) -> checker { fn check_name(ch: &checker, sp: &span, name: &ident) { for s: ident in ch.seen { - if istr::eq(s, name) { + if str::eq(s, name) { ch.sess.span_fatal(sp, ~"duplicate " + ch.kind + ~" name: " + name); } diff --git a/src/comp/middle/shape.rs b/src/comp/middle/shape.rs index 0a000fd6f68..181eaa0251a 100644 --- a/src/comp/middle/shape.rs +++ b/src/comp/middle/shape.rs @@ -30,7 +30,7 @@ import std::vec; import std::map::hashmap; import std::option::none; import std::option::some; -import std::istr; +import std::str; import ty_ctxt = middle::ty::ctxt; @@ -86,7 +86,7 @@ fn eq_res_info(a: &res_info, b: &res_info) -> bool { fn mk_global(ccx: &@crate_ctxt, name: &istr, llval: ValueRef, internal: bool) -> ValueRef { - let llglobal = istr::as_buf(name, { |buf| + let llglobal = str::as_buf(name, { |buf| lib::llvm::llvm::LLVMAddGlobal(ccx.llmod, val_ty(llval), buf) }); lib::llvm::llvm::LLVMSetInitializer(llglobal, llval); @@ -248,7 +248,7 @@ fn s_float(_tcx: &ty_ctxt) -> u8 { fn mk_ctxt(llmod: ModuleRef) -> ctxt { let llshapetablesty = trans_common::T_named_struct(~"shapes"); - let llshapetables = istr::as_buf(~"shapes", { |buf| + let llshapetables = str::as_buf(~"shapes", { |buf| lib::llvm::llvm::LLVMAddGlobal(llmod, llshapetablesty, buf) }); diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 7bd39752be1..8aafae52820 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -13,7 +13,7 @@ // but many TypeRefs correspond to one ty::t; for instance, tup(int, int, // int) and rec(x=int, y=int, z=int) will have the same TypeRef. import std::int; -import std::istr; +import std::str; import std::uint; import std::map; import std::map::hashmap; @@ -301,7 +301,7 @@ fn sanitize(s: &istr) -> istr { c != ' ' as u8 && c != '\t' as u8 && c != ';' as u8 { let v = [c]; - result += istr::unsafe_from_bytes(v); + result += str::unsafe_from_bytes(v); } } } @@ -322,7 +322,7 @@ fn log_fn_time(ccx: &@crate_ctxt, name: &istr, start: &time::timeval, fn decl_fn(llmod: ModuleRef, name: &istr, cc: uint, llty: TypeRef) -> ValueRef { - let llfn: ValueRef = istr::as_buf(name, { |buf| + let llfn: ValueRef = str::as_buf(name, { |buf| llvm::LLVMAddFunction(llmod, buf, llty) }); llvm::LLVMSetFunctionCallConv(llfn, cc); @@ -336,7 +336,7 @@ fn decl_cdecl_fn(llmod: ModuleRef, name: &istr, llty: TypeRef) -> ValueRef { fn decl_fastcall_fn(llmod: ModuleRef, name: &istr, llty: TypeRef) -> ValueRef { let llfn = decl_fn(llmod, name, lib::llvm::LLVMFastCallConv, llty); - let _: () = istr::as_buf(~"rust", { |buf| + let _: () = str::as_buf(~"rust", { |buf| llvm::LLVMSetGC(llfn, buf) }); ret llfn; @@ -350,7 +350,7 @@ fn decl_internal_fastcall_fn(llmod: ModuleRef, name: &istr, llty: TypeRef) -> let llfn = decl_fn(llmod, name, lib::llvm::LLVMFastCallConv, llty); llvm::LLVMSetLinkage(llfn, lib::llvm::LLVMInternalLinkage as llvm::Linkage); - let _: () = istr::as_buf(~"rust", { |buf| + let _: () = str::as_buf(~"rust", { |buf| llvm::LLVMSetGC(llfn, buf) }); ret llfn; @@ -375,7 +375,7 @@ fn get_extern_const(externs: &hashmap<istr, ValueRef>, llmod: ModuleRef, if externs.contains_key(name) { ret externs.get(name); } - let c = istr::as_buf(name, { |buf| + let c = str::as_buf(name, { |buf| llvm::LLVMAddGlobal(llmod, ty, buf) }); externs.insert(name, c); @@ -1137,7 +1137,7 @@ fn declare_tydesc(cx: &@local_ctxt, sp: &span, t: ty::t, ty_params: &[uint]) name = mangle_internal_name_by_type_only(cx.ccx, t, ~"tydesc"); name = sanitize(name); } else { name = mangle_internal_name_by_seq(cx.ccx, ~"tydesc"); } - let gvar = istr::as_buf(name, { |buf| + let gvar = str::as_buf(name, { |buf| llvm::LLVMAddGlobal(ccx.llmod, ccx.tydesc_type, buf) }); let info = @@ -1501,7 +1501,7 @@ fn decr_refcnt_maybe_free(cx: &@block_ctxt, box_ptr_alias: ValueRef, // Structural comparison: a rather involved form of glue. fn maybe_name_value(cx: &@crate_ctxt, v: ValueRef, s: &istr) { if cx.sess.get_opts().save_temps { - let _: () = istr::as_buf(s, { |buf| + let _: () = str::as_buf(s, { |buf| llvm::LLVMSetValueName(v, buf) }); } @@ -3050,7 +3050,7 @@ fn lookup_discriminant(lcx: &@local_ctxt, vid: &ast::def_id) -> ValueRef { // It's an external discriminant that we haven't seen yet. assert (vid.crate != ast::local_crate); let sym = csearch::get_symbol(lcx.ccx.sess.get_cstore(), vid); - let gvar = istr::as_buf(sym, { |buf| + let gvar = str::as_buf(sym, { |buf| llvm::LLVMAddGlobal(lcx.ccx.llmod, T_int(), buf) }); llvm::LLVMSetLinkage(gvar, @@ -3998,7 +3998,7 @@ fn trans_rec(cx: &@block_ctxt, fields: &[ast::field], bcx = dst_res.bcx; let expr_provided = false; for f: ast::field in fields { - if istr::eq(f.node.ident, tf.ident) { + if str::eq(f.node.ident, tf.ident) { expr_provided = true; let lv = trans_lval(bcx, f.node.expr); bcx = move_val_if_temp(lv.res.bcx, INIT, dst_res.val, @@ -4288,7 +4288,7 @@ fn load_if_immediate(cx: &@block_ctxt, v: ValueRef, t: ty::t) -> ValueRef { fn trans_log(lvl: int, cx: &@block_ctxt, e: &@ast::expr) -> result { let lcx = cx.fcx.lcx; - let modname = istr::connect(lcx.module_path, ~"::"); + let modname = str::connect(lcx.module_path, ~"::"); let global; if lcx.ccx.module_data.contains_key(modname) { global = lcx.ccx.module_data.get(modname); @@ -4298,7 +4298,7 @@ fn trans_log(lvl: int, cx: &@block_ctxt, e: &@ast::expr) -> result { lcx.ccx, lcx.module_path, ~"loglevel"); - global = istr::as_buf(s, { |buf| + global = str::as_buf(s, { |buf| llvm::LLVMAddGlobal(lcx.ccx.llmod, T_int(), buf) }); llvm::LLVMSetGlobalConstant(global, False); @@ -4677,7 +4677,7 @@ fn new_block_ctxt(cx: &@fn_ctxt, parent: &block_parent, kind: block_kind, cx.lcx.ccx.sess.get_opts().debuginfo { s = cx.lcx.ccx.names.next(name); } - let llbb: BasicBlockRef = istr::as_buf(s, { |buf| + let llbb: BasicBlockRef = str::as_buf(s, { |buf| llvm::LLVMAppendBasicBlock(cx.llfn, buf) }); ret @{llbb: llbb, @@ -4836,7 +4836,7 @@ fn alloc_local(cx: &@block_ctxt, local: &@ast::local) -> result { alt local.node.pat.node { ast::pat_bind(ident) { if bcx_ccx(cx).sess.get_opts().debuginfo { - let _: () = istr::as_buf(ident, { |buf| + let _: () = str::as_buf(ident, { |buf| llvm::LLVMSetValueName(r.val, buf) }); } @@ -4922,19 +4922,19 @@ fn mk_standard_basic_blocks(llfn: ValueRef) -> dt: BasicBlockRef, da: BasicBlockRef, rt: BasicBlockRef} { - ret {sa: istr::as_buf(~"statuc_allocas", { |buf| + ret {sa: str::as_buf(~"statuc_allocas", { |buf| llvm::LLVMAppendBasicBlock(llfn, buf) }), - ca: istr::as_buf(~"copy_args", { |buf| + ca: str::as_buf(~"copy_args", { |buf| llvm::LLVMAppendBasicBlock(llfn, buf) }), - dt: istr::as_buf(~"derived_tydescs", { |buf| + dt: str::as_buf(~"derived_tydescs", { |buf| llvm::LLVMAppendBasicBlock(llfn, buf) }), - da: istr::as_buf(~"dynamic_allocas", { |buf| + da: str::as_buf(~"dynamic_allocas", { |buf| llvm::LLVMAppendBasicBlock(llfn, buf) }), - rt: istr::as_buf(~"return", { |buf| + rt: str::as_buf(~"return", { |buf| llvm::LLVMAppendBasicBlock(llfn, buf) })}; } @@ -5254,7 +5254,7 @@ fn trans_fn(cx: @local_ctxt, sp: &span, f: &ast::_fn, llfndecl: ValueRef, let start = time::get_time(); trans_fn_inner(cx, sp, f, llfndecl, ty_self, ty_params, id); let end = time::get_time(); - log_fn_time(cx.ccx, istr::connect(cx.path, ~"::"), + log_fn_time(cx.ccx, str::connect(cx.path, ~"::"), start, end); } @@ -5546,7 +5546,7 @@ fn create_main_wrapper(ccx: &@crate_ctxt, sp: &span, main_llfn: ValueRef, // FIXME: This is a transitional way to let the runtime know // it needs to feed us istrs - let lltakesistr = istr::as_buf(~"_rust_main_takes_istr", { |buf| + let lltakesistr = str::as_buf(~"_rust_main_takes_istr", { |buf| llvm::LLVMAddGlobal(ccx.llmod, T_int(), buf) }); llvm::LLVMSetInitializer(lltakesistr, C_uint(main_takes_istr as uint)); @@ -5597,7 +5597,7 @@ fn create_main_wrapper(ccx: &@crate_ctxt, sp: &span, main_llfn: ValueRef, // space for the function's environment. fn create_fn_pair(cx: &@crate_ctxt, ps: &istr, llfnty: TypeRef, llfn: ValueRef, external: bool) -> ValueRef { - let gvar = istr::as_buf(ps, { |buf| + let gvar = str::as_buf(ps, { |buf| llvm::LLVMAddGlobal(cx.llmod, T_fn_pair(*cx, llfnty), buf) }); let pair = C_struct([llfn, C_null(T_opaque_closure_ptr(*cx))]); @@ -5874,7 +5874,7 @@ fn collect_item_1(ccx: @crate_ctxt, i: &@ast::item, pt: &[istr], let s = mangle_exported_name(ccx, pt + [i.ident], node_id_type(ccx, i.id)); - let g = istr::as_buf(s, { |buf| + let g = str::as_buf(s, { |buf| llvm::LLVMAddGlobal(ccx.llmod, type_of(ccx, i.span, typ), buf) }); ccx.item_symbols.insert(i.id, s); @@ -5966,7 +5966,7 @@ fn trans_constant(ccx: @crate_ctxt, it: &@ast::item, pt: &[istr], ~"discrim"]; let s = mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx)); - let discrim_gvar = istr::as_buf(s, { |buf| + let discrim_gvar = str::as_buf(s, { |buf| llvm::LLVMAddGlobal(ccx.llmod, T_int(), buf) }); if n_variants != 1u { @@ -6074,19 +6074,19 @@ fn make_common_glue(sess: &session::session, output: &istr) { let task_type = T_task(); let taskptr_type = T_ptr(task_type); - let llmod = istr::as_buf(~"rust_out", { |buf| + let llmod = str::as_buf(~"rust_out", { |buf| llvm::LLVMModuleCreateWithNameInContext(buf, llvm::LLVMGetGlobalContext()) }); - let _: () = istr::as_buf(x86::get_data_layout(), { |buf| + let _: () = str::as_buf(x86::get_data_layout(), { |buf| llvm::LLVMSetDataLayout(llmod, buf) }); - let _: () = istr::as_buf(x86::get_target_triple(), { |buf| + let _: () = str::as_buf(x86::get_target_triple(), { |buf| llvm::LLVMSetTarget(llmod, buf) }); mk_target_data(x86::get_data_layout()); declare_intrinsics(llmod); - let _: () = istr::as_buf(x86::get_module_asm(), { |buf| + let _: () = str::as_buf(x86::get_module_asm(), { |buf| llvm::LLVMSetModuleInlineAsm(llmod, buf) }); make_glues(llmod, taskptr_type); @@ -6096,7 +6096,7 @@ fn make_common_glue(sess: &session::session, output: &istr) { fn create_module_map(ccx: &@crate_ctxt) -> ValueRef { let elttype = T_struct([T_int(), T_int()]); let maptype = T_array(elttype, ccx.module_data.size() + 1u); - let map = istr::as_buf(~"_rust_mod_map", { |buf| + let map = str::as_buf(~"_rust_mod_map", { |buf| llvm::LLVMAddGlobal(ccx.llmod, maptype, buf) }); llvm::LLVMSetLinkage(map, @@ -6122,7 +6122,7 @@ fn create_crate_map(ccx: &@crate_ctxt) -> ValueRef { while cstore::have_crate_data(cstore, i) { let nm = ~"_rust_crate_map_" + cstore::get_crate_data(cstore, i).name; - let cr = istr::as_buf(nm, { |buf| + let cr = str::as_buf(nm, { |buf| llvm::LLVMAddGlobal(ccx.llmod, T_int(), buf) }); subcrates += [p2i(cr)]; @@ -6136,7 +6136,7 @@ fn create_crate_map(ccx: &@crate_ctxt) -> ValueRef { let sym_name = ~"_rust_crate_map_" + mapname; let arrtype = T_array(T_int(), std::vec::len::<ValueRef>(subcrates)); let maptype = T_struct([T_int(), arrtype]); - let map = istr::as_buf(sym_name, { |buf| + let map = str::as_buf(sym_name, { |buf| llvm::LLVMAddGlobal(ccx.llmod, maptype, buf) }); llvm::LLVMSetLinkage(map, @@ -6152,11 +6152,11 @@ fn write_metadata(cx: &@crate_ctxt, crate: &@ast::crate) { let llmeta = C_postr( metadata::encoder::encode_metadata(cx, crate)); let llconst = trans_common::C_struct([llmeta]); - let llglobal = istr::as_buf(~"rust_metadata", { |buf| + let llglobal = str::as_buf(~"rust_metadata", { |buf| llvm::LLVMAddGlobal(cx.llmod, val_ty(llconst), buf) }); llvm::LLVMSetInitializer(llglobal, llconst); - let _: () = istr::as_buf(x86::get_meta_sect_name(), { |buf| + let _: () = str::as_buf(x86::get_meta_sect_name(), { |buf| llvm::LLVMSetSection(llglobal, buf) }); llvm::LLVMSetLinkage(llglobal, @@ -6164,7 +6164,7 @@ fn write_metadata(cx: &@crate_ctxt, crate: &@ast::crate) { let t_ptr_i8 = T_ptr(T_i8()); llglobal = llvm::LLVMConstBitCast(llglobal, t_ptr_i8); - let llvm_used = istr::as_buf(~"llvm.used", { |buf| + let llvm_used = str::as_buf(~"llvm.used", { |buf| llvm::LLVMAddGlobal(cx.llmod, T_array(t_ptr_i8, 1u), buf) }); llvm::LLVMSetLinkage(llvm_used, @@ -6181,14 +6181,14 @@ fn write_abi_version(ccx: &@crate_ctxt) { fn trans_crate(sess: &session::session, crate: &@ast::crate, tcx: &ty::ctxt, output: &istr, amap: &ast_map::map, mut_map: mut::mut_map) -> ModuleRef { - let llmod = istr::as_buf(~"rust_out", { |buf| + let llmod = str::as_buf(~"rust_out", { |buf| llvm::LLVMModuleCreateWithNameInContext(buf, llvm::LLVMGetGlobalContext()) }); - let _: () = istr::as_buf(x86::get_data_layout(), { |buf| + let _: () = str::as_buf(x86::get_data_layout(), { |buf| llvm::LLVMSetDataLayout(llmod, buf) }); - let _: () = istr::as_buf(x86::get_target_triple(), { |buf| + let _: () = str::as_buf(x86::get_target_triple(), { |buf| llvm::LLVMSetTarget(llmod, buf) }); let td = mk_target_data(x86::get_data_layout()); diff --git a/src/comp/middle/trans_alt.rs b/src/comp/middle/trans_alt.rs index 73a49a04c5f..a4cdb44f574 100644 --- a/src/comp/middle/trans_alt.rs +++ b/src/comp/middle/trans_alt.rs @@ -1,4 +1,4 @@ -import std::istr; +import std::str; import std::vec; import std::option; import option::some; @@ -59,7 +59,7 @@ fn variant_opt(ccx: &@crate_ctxt, pat_id: ast::node_id) -> opt { type bind_map = [{ident: ast::ident, val: ValueRef}]; fn assoc(key: &istr, list: &bind_map) -> option::t<ValueRef> { for elt: {ident: ast::ident, val: ValueRef} in list { - if istr::eq(elt.ident, key) { ret some(elt.val); } + if str::eq(elt.ident, key) { ret some(elt.val); } } ret none; } @@ -145,7 +145,7 @@ fn enter_rec(m: &match, col: uint, fields: &[ast::ident], val: ValueRef) -> for fname: ast::ident in fields { let pat = dummy; for fpat: ast::field_pat in fpats { - if istr::eq(fpat.ident, fname) { pat = fpat.pat; break; } + if str::eq(fpat.ident, fname) { pat = fpat.pat; break; } } pats += [pat]; } @@ -233,7 +233,7 @@ fn collect_record_fields(m: &match, col: uint) -> [ast::ident] { alt br.pats[col].node { ast::pat_rec(fs, _) { for f: ast::field_pat in fs { - if !vec::any(bind istr::eq(f.ident, _), fields) { + if !vec::any(bind str::eq(f.ident, _), fields) { fields += [f.ident]; } } diff --git a/src/comp/middle/trans_build.rs b/src/comp/middle/trans_build.rs index 9cad896c949..1355bbff0aa 100644 --- a/src/comp/middle/trans_build.rs +++ b/src/comp/middle/trans_build.rs @@ -1,5 +1,5 @@ -import std::{vec, istr}; -import std::istr::sbuf; +import std::{vec, str}; +import std::str::sbuf; import lib::llvm::llvm; import llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, Opcode, ModuleRef}; @@ -61,7 +61,7 @@ fn Invoke(cx: &@block_ctxt, Fn: ValueRef, Args: &[ValueRef], Then: BasicBlockRef, Catch: BasicBlockRef) -> ValueRef { assert (!cx.terminated);; cx.terminated = true; - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildInvoke(B(cx), Fn, vec::to_ptr(Args), vec::len(Args), Then, Catch, buf) }); @@ -75,212 +75,212 @@ fn Unreachable(cx: &@block_ctxt) -> ValueRef { /* Arithmetic */ fn Add(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildAdd(B(cx), LHS, RHS, buf) }); } fn NSWAdd(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildNSWAdd(B(cx), LHS, RHS, buf) }); } fn NUWAdd(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildNUWAdd(B(cx), LHS, RHS, buf) }); } fn FAdd(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFAdd(B(cx), LHS, RHS, buf) }); } fn Sub(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildSub(B(cx), LHS, RHS, buf) }); } fn NSWSub(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildNSWSub(B(cx), LHS, RHS, buf) }); } fn NUWSub(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildNUWSub(B(cx), LHS, RHS, buf) }); } fn FSub(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFSub(B(cx), LHS, RHS, buf) }); } fn Mul(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildMul(B(cx), LHS, RHS, buf) }); } fn NSWMul(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildNSWMul(B(cx), LHS, RHS, buf) }); } fn NUWMul(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildNUWMul(B(cx), LHS, RHS, buf) }); } fn FMul(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFMul(B(cx), LHS, RHS, buf) }); } fn UDiv(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildUDiv(B(cx), LHS, RHS, buf) }); } fn SDiv(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildSDiv(B(cx), LHS, RHS, buf) }); } fn ExactSDiv(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildExactSDiv(B(cx), LHS, RHS, buf) }); } fn FDiv(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFDiv(B(cx), LHS, RHS, buf) }); } fn URem(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildURem(B(cx), LHS, RHS, buf) }); } fn SRem(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildSRem(B(cx), LHS, RHS, buf) }); } fn FRem(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFRem(B(cx), LHS, RHS, buf) }); } fn Shl(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildShl(B(cx), LHS, RHS, buf) }); } fn LShr(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildLShr(B(cx), LHS, RHS, buf) }); } fn AShr(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildAShr(B(cx), LHS, RHS, buf) }); } fn And(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildAnd(B(cx), LHS, RHS, buf) }); } fn Or(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildOr(B(cx), LHS, RHS, buf) }); } fn Xor(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildXor(B(cx), LHS, RHS, buf) }); } fn BinOp(cx: &@block_ctxt, Op: Opcode, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildBinOp(B(cx), Op, LHS, RHS, buf) }); } fn Neg(cx: &@block_ctxt, V: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildNeg(B(cx), V, buf) }); } fn NSWNeg(cx: &@block_ctxt, V: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildNSWNeg(B(cx), V, buf) }); } fn NUWNeg(cx: &@block_ctxt, V: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildNUWNeg(B(cx), V, buf) }); } fn FNeg(cx: &@block_ctxt, V: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFNeg(B(cx), V, buf) }); } fn Not(cx: &@block_ctxt, V: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildNot(B(cx), V, buf) }); } /* Memory */ fn Malloc(cx: &@block_ctxt, Ty: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildMalloc(B(cx), Ty, buf) }); } fn ArrayMalloc(cx: &@block_ctxt, Ty: TypeRef, Val: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildArrayMalloc(B(cx), Ty, Val, buf) }); } fn Alloca(cx: &@block_ctxt, Ty: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildAlloca(B(cx), Ty, buf) }); } fn ArrayAlloca(cx: &@block_ctxt, Ty: TypeRef, Val: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildArrayAlloca(B(cx), Ty, Val, buf) }); } @@ -290,7 +290,7 @@ fn Free(cx: &@block_ctxt, PointerVal: ValueRef) -> ValueRef { } fn Load(cx: &@block_ctxt, PointerVal: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildLoad(B(cx), PointerVal, buf) }); } @@ -301,7 +301,7 @@ fn Store(cx: &@block_ctxt, Val: ValueRef, Ptr: ValueRef) -> ValueRef { fn GEP(cx: &@block_ctxt, Pointer: ValueRef, Indices: &[ValueRef]) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildGEP(B(cx), Pointer, vec::to_ptr(Indices), vec::len(Indices), buf) }); @@ -309,122 +309,122 @@ fn GEP(cx: &@block_ctxt, Pointer: ValueRef, fn InBoundsGEP(cx: &@block_ctxt, Pointer: ValueRef, Indices: &[ValueRef]) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildInBoundsGEP(B(cx), Pointer, vec::to_ptr(Indices), vec::len(Indices), buf) }); } fn StructGEP(cx: &@block_ctxt, Pointer: ValueRef, Idx: uint) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildStructGEP(B(cx), Pointer, Idx, buf) }); } fn GlobalString(cx: &@block_ctxt, _Str: sbuf) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildGlobalString(B(cx), _Str, buf) }); } fn GlobalStringPtr(cx: &@block_ctxt, _Str: sbuf) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildGlobalStringPtr(B(cx), _Str, buf) }); } /* Casts */ fn Trunc(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildTrunc(B(cx), Val, DestTy, buf) }); } fn ZExt(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildZExt(B(cx), Val, DestTy, buf) }); } fn SExt(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildSExt(B(cx), Val, DestTy, buf) }); } fn FPToUI(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFPToUI(B(cx), Val, DestTy, buf) }); } fn FPToSI(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFPToSI(B(cx), Val, DestTy, buf) }); } fn UIToFP(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildUIToFP(B(cx), Val, DestTy, buf) }); } fn SIToFP(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildSIToFP(B(cx), Val, DestTy, buf) }); } fn FPTrunc(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFPTrunc(B(cx), Val, DestTy, buf) }); } fn FPExt(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFPExt(B(cx), Val, DestTy, buf) }); } fn PtrToInt(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildPtrToInt(B(cx), Val, DestTy, buf) }); } fn IntToPtr(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildIntToPtr(B(cx), Val, DestTy, buf) }); } fn BitCast(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildBitCast(B(cx), Val, DestTy, buf) }); } fn ZExtOrBitCast(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildZExtOrBitCast(B(cx), Val, DestTy, buf) }); } fn SExtOrBitCast(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildSExtOrBitCast(B(cx), Val, DestTy, buf) }); } fn TruncOrBitCast(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildTruncOrBitCast(B(cx), Val, DestTy, buf) }); } @@ -432,25 +432,25 @@ fn TruncOrBitCast(cx: &@block_ctxt, Val: ValueRef, fn Cast(cx: &@block_ctxt, Op: Opcode, Val: ValueRef, DestTy: TypeRef, _Name: sbuf) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildCast(B(cx), Op, Val, DestTy, buf) }); } fn PointerCast(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildPointerCast(B(cx), Val, DestTy, buf) }); } fn IntCast(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildIntCast(B(cx), Val, DestTy, buf) }); } fn FPCast(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFPCast(B(cx), Val, DestTy, buf) }); } @@ -459,14 +459,14 @@ fn FPCast(cx: &@block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef { /* Comparisons */ fn ICmp(cx: &@block_ctxt, Op: uint, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildICmp(B(cx), Op, LHS, RHS, buf) }); } fn FCmp(cx: &@block_ctxt, Op: uint, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildFCmp(B(cx), Op, LHS, RHS, buf) }); } @@ -475,7 +475,7 @@ fn FCmp(cx: &@block_ctxt, Op: uint, LHS: ValueRef, /* Miscellaneous instructions */ fn Phi(cx: &@block_ctxt, Ty: TypeRef, vals: &[ValueRef], bbs: &[BasicBlockRef]) -> ValueRef { - let phi = istr::as_buf(~"", { |buf| + let phi = str::as_buf(~"", { |buf| llvm::LLVMBuildPhi(B(cx), Ty, buf) }); assert (vec::len::<ValueRef>(vals) == vec::len::<BasicBlockRef>(bbs)); @@ -491,14 +491,14 @@ fn AddIncomingToPhi(phi: ValueRef, vals: &[ValueRef], bbs: &[BasicBlockRef]) { } fn Call(cx: &@block_ctxt, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildCall(B(cx), Fn, vec::to_ptr(Args), vec::len(Args), buf) }); } fn FastCall(cx: &@block_ctxt, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef { - let v = istr::as_buf(~"", { |buf| + let v = str::as_buf(~"", { |buf| llvm::LLVMBuildCall(B(cx), Fn, vec::to_ptr(Args), vec::len(Args), buf) }); llvm::LLVMSetInstructionCallConv(v, lib::llvm::LLVMFastCallConv); @@ -507,7 +507,7 @@ fn FastCall(cx: &@block_ctxt, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef { fn CallWithConv(cx: &@block_ctxt, Fn: ValueRef, Args: &[ValueRef], Conv: uint) -> ValueRef { - let v = istr::as_buf(~"", { |buf| + let v = str::as_buf(~"", { |buf| llvm::LLVMBuildCall(B(cx), Fn, vec::to_ptr(Args), vec::len(Args), buf) }); llvm::LLVMSetInstructionCallConv(v, Conv); @@ -516,20 +516,20 @@ fn CallWithConv(cx: &@block_ctxt, Fn: ValueRef, Args: &[ValueRef], fn Select(cx: &@block_ctxt, If: ValueRef, Then: ValueRef, Else: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildSelect(B(cx), If, Then, Else, buf) }); } fn VAArg(cx: &@block_ctxt, list: ValueRef, Ty: TypeRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildVAArg(B(cx), list, Ty, buf) }); } fn ExtractElement(cx: &@block_ctxt, VecVal: ValueRef, Index: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildExtractElement(B(cx), VecVal, Index, buf) }); } @@ -537,45 +537,45 @@ fn ExtractElement(cx: &@block_ctxt, VecVal: ValueRef, fn InsertElement(cx: &@block_ctxt, VecVal: ValueRef, EltVal: ValueRef, Index: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildInsertElement(B(cx), VecVal, EltVal, Index, buf) }); } fn ShuffleVector(cx: &@block_ctxt, V1: ValueRef, V2: ValueRef, Mask: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildShuffleVector(B(cx), V1, V2, Mask, buf) }); } fn ExtractValue(cx: &@block_ctxt, AggVal: ValueRef, Index: uint) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildExtractValue(B(cx), AggVal, Index, buf) }); } fn InsertValue(cx: &@block_ctxt, AggVal: ValueRef, EltVal: ValueRef, Index: uint) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildInsertValue(B(cx), AggVal, EltVal, Index, buf) }); } fn IsNull(cx: &@block_ctxt, Val: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildIsNull(B(cx), Val, buf) }); } fn IsNotNull(cx: &@block_ctxt, Val: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildIsNotNull(B(cx), Val, buf) }); } fn PtrDiff(cx: &@block_ctxt, LHS: ValueRef, RHS: ValueRef) -> ValueRef { - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildPtrDiff(B(cx), LHS, RHS, buf) }); } @@ -585,12 +585,12 @@ fn Trap(cx: &@block_ctxt) -> ValueRef { let BB: BasicBlockRef = llvm::LLVMGetInsertBlock(b); let FN: ValueRef = llvm::LLVMGetBasicBlockParent(BB); let M: ModuleRef = llvm::LLVMGetGlobalParent(FN); - let T: ValueRef = istr::as_buf(~"llvm.trap", { |buf| + let T: ValueRef = str::as_buf(~"llvm.trap", { |buf| llvm::LLVMGetNamedFunction(M, buf) }); assert (T as int != 0); let Args: [ValueRef] = []; - ret istr::as_buf(~"", { |buf| + ret str::as_buf(~"", { |buf| llvm::LLVMBuildCall(b, T, vec::to_ptr(Args), vec::len(Args), buf) }); } diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index 9cee76c1db6..5a7bb4faf07 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -6,7 +6,7 @@ import std::int; import std::vec; import std::vec::to_ptr; -import std::istr; +import std::str; import std::uint; import std::map; import std::map::hashmap; @@ -547,7 +547,7 @@ fn T_struct(elts: &[TypeRef]) -> TypeRef { fn T_named_struct(name: &istr) -> TypeRef { let c = llvm::LLVMGetGlobalContext(); - ret istr::as_buf(name, { |buf| + ret str::as_buf(name, { |buf| llvm::LLVMStructCreateNamed(c, buf) }); } @@ -767,13 +767,13 @@ fn C_integral(t: TypeRef, u: uint, sign_extend: Bool) -> ValueRef { } fn C_float(s: &istr) -> ValueRef { - ret istr::as_buf(s, { |buf| + ret str::as_buf(s, { |buf| llvm::LLVMConstRealOfString(T_float(), buf) }); } fn C_floating(s: &istr, t: TypeRef) -> ValueRef { - ret istr::as_buf(s, { |buf| + ret str::as_buf(s, { |buf| llvm::LLVMConstRealOfString(t, buf) }); } @@ -800,10 +800,10 @@ fn C_u8(i: uint) -> ValueRef { ret C_integral(T_i8(), i, False); } // This is a 'c-like' raw string, which differs from // our boxed-and-length-annotated strings. fn C_cstr(cx: &@crate_ctxt, s: &istr) -> ValueRef { - let sc = istr::as_buf(s, { |buf| - llvm::LLVMConstString(buf, istr::byte_len(s), False) + let sc = str::as_buf(s, { |buf| + llvm::LLVMConstString(buf, str::byte_len(s), False) }); - let g = istr::as_buf(cx.names.next(~"str"), { |buf| + let g = str::as_buf(cx.names.next(~"str"), { |buf| llvm::LLVMAddGlobal(cx.llmod, val_ty(sc), buf) }); llvm::LLVMSetInitializer(g, sc); @@ -816,17 +816,17 @@ fn C_cstr(cx: &@crate_ctxt, s: &istr) -> ValueRef { // A rust boxed-and-length-annotated string. fn C_str(cx: &@crate_ctxt, s: &istr) -> ValueRef { let len = - istr::byte_len(s); // 'alloc' + str::byte_len(s); // 'alloc' // 'fill' // 'pad' - let cstr = istr::as_buf(s, { |buf| + let cstr = str::as_buf(s, { |buf| llvm::LLVMConstString(buf, len, False) }); let box = C_struct([C_int(abi::const_refcount as int), C_int(len + 1u as int), C_int(len + 1u as int), C_int(0), cstr]); - let g = istr::as_buf(cx.names.next(~"str"), { |buf| + let g = str::as_buf(cx.names.next(~"str"), { |buf| llvm::LLVMAddGlobal(cx.llmod, val_ty(box), buf) }); llvm::LLVMSetInitializer(g, box); @@ -837,8 +837,8 @@ fn C_str(cx: &@crate_ctxt, s: &istr) -> ValueRef { // Returns a Plain Old LLVM String: fn C_postr(s: &istr) -> ValueRef { - ret istr::as_buf(s, { |buf| - llvm::LLVMConstString(buf, istr::byte_len(s), False) + ret str::as_buf(s, { |buf| + llvm::LLVMConstString(buf, str::byte_len(s), False) }); } @@ -871,7 +871,7 @@ fn C_bytes(bytes: &[u8]) -> ValueRef { fn C_shape(ccx: &@crate_ctxt, bytes: &[u8]) -> ValueRef { let llshape = C_bytes(bytes); - let llglobal = istr::as_buf(ccx.names.next(~"shape"), { |buf| + let llglobal = str::as_buf(ccx.names.next(~"shape"), { |buf| llvm::LLVMAddGlobal(ccx.llmod, val_ty(llshape), buf) }); llvm::LLVMSetInitializer(llglobal, llshape); diff --git a/src/comp/middle/trans_ivec.rs b/src/comp/middle/trans_ivec.rs index 9b269d042c0..8beb796fd47 100644 --- a/src/comp/middle/trans_ivec.rs +++ b/src/comp/middle/trans_ivec.rs @@ -114,7 +114,7 @@ fn trans_ivec(bcx: &@block_ctxt, args: &[@ast::expr], ret rslt(bcx, vptr); } fn trans_istr(bcx: &@block_ctxt, s: istr) -> result { - let veclen = std::istr::byte_len(s) + 1u; // +1 for \0 + let veclen = std::str::byte_len(s) + 1u; // +1 for \0 let {bcx, val: sptr, _} = alloc(bcx, ty::mk_istr(bcx_tcx(bcx)), veclen); diff --git a/src/comp/middle/trans_objects.rs b/src/comp/middle/trans_objects.rs index 49da4aba9a0..6c70e8aab9f 100644 --- a/src/comp/middle/trans_objects.rs +++ b/src/comp/middle/trans_objects.rs @@ -1,6 +1,6 @@ // Translation of object-related things to LLVM IR. -import std::istr; +import std::str; import std::option; import std::vec; import option::none; @@ -396,7 +396,7 @@ tag vtbl_mthd { // Alphabetize ast::methods by ident. A helper for create_vtbl. fn ast_mthd_lteq(a: &@ast::method, b: &@ast::method) -> bool { - ret istr::lteq(a.node.ident, b.node.ident); + ret str::lteq(a.node.ident, b.node.ident); } // Alphabetize vtbl_mthds by ident. A helper for create_vtbl. @@ -404,14 +404,14 @@ fn vtbl_mthd_lteq(a: &vtbl_mthd, b: &vtbl_mthd) -> bool { alt a { normal_mthd(ma) { alt b { - normal_mthd(mb) { ret istr::lteq(ma.node.ident, mb.node.ident); } - fwding_mthd(mb) { ret istr::lteq(ma.node.ident, mb.ident); } + normal_mthd(mb) { ret str::lteq(ma.node.ident, mb.node.ident); } + fwding_mthd(mb) { ret str::lteq(ma.node.ident, mb.ident); } } } fwding_mthd(ma) { alt b { - normal_mthd(mb) { ret istr::lteq(ma.ident, mb.node.ident); } - fwding_mthd(mb) { ret istr::lteq(ma.ident, mb.ident); } + normal_mthd(mb) { ret str::lteq(ma.ident, mb.node.ident); } + fwding_mthd(mb) { ret str::lteq(ma.ident, mb.ident); } } } } @@ -430,7 +430,7 @@ fn filtering_fn(cx: @local_ctxt, m: &vtbl_mthd, addtl_meths: [@ast::method]) alt m { fwding_mthd(fm) { for am: @ast::method in addtl_meths { - if istr::eq(am.node.ident, fm.ident) { ret none; } + if str::eq(am.node.ident, fm.ident) { ret none; } } ret some(fwding_mthd(fm)); } @@ -570,7 +570,7 @@ fn finish_vtbl(cx: @local_ctxt, llmethods: [ValueRef], name: &istr) -> let vtbl = C_struct(llmethods); let vtbl_name = mangle_internal_name_by_path( cx.ccx, cx.path + [name]); - let gvar = istr::as_buf(vtbl_name, { |buf| + let gvar = str::as_buf(vtbl_name, { |buf| llvm::LLVMAddGlobal(cx.ccx.llmod, val_ty(vtbl), buf) }); llvm::LLVMSetInitializer(gvar, vtbl); diff --git a/src/comp/middle/tstate/annotate.rs b/src/comp/middle/tstate/annotate.rs index 7a5039e44ce..0be3d1776ba 100644 --- a/src/comp/middle/tstate/annotate.rs +++ b/src/comp/middle/tstate/annotate.rs @@ -4,7 +4,7 @@ import std::option::some; import std::option::none; import std::int; import std::uint; -import std::istr; +import std::str; import syntax::ast::*; import syntax::ast_util::pat_binding_ids; import syntax::visit; diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs index bdc94f803cf..62c883eb9f8 100644 --- a/src/comp/middle/tstate/auxiliary.rs +++ b/src/comp/middle/tstate/auxiliary.rs @@ -1,6 +1,6 @@ import std::vec; import std::int::str; -import std::istr; +import std::str; import std::option; import std::option::*; import std::int; diff --git a/src/comp/middle/tstate/ck.rs b/src/comp/middle/tstate/ck.rs index 8817a16cdd4..cef36843ea6 100644 --- a/src/comp/middle/tstate/ck.rs +++ b/src/comp/middle/tstate/ck.rs @@ -37,7 +37,7 @@ import std::option; import std::option::t; import std::option::some; import std::option::none; -import std::istr; +import std::str; import aux::*; import syntax::print::pprust::ty_to_str; import util::common::log_stmt_err; diff --git a/src/comp/middle/tstate/collect_locals.rs b/src/comp/middle/tstate/collect_locals.rs index dbdb3b15c16..4c6ce536d7d 100644 --- a/src/comp/middle/tstate/collect_locals.rs +++ b/src/comp/middle/tstate/collect_locals.rs @@ -1,4 +1,4 @@ -import std::istr; +import std::str; import std::uint; import std::int; import std::vec; diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs index 189b5249143..a7f38516125 100644 --- a/src/comp/middle/tstate/pre_post_conditions.rs +++ b/src/comp/middle/tstate/pre_post_conditions.rs @@ -1,6 +1,6 @@ import std::vec; -import std::istr; +import std::str; import std::option; import std::option::none; import std::option::some; diff --git a/src/comp/middle/tstate/states.rs b/src/comp/middle/tstate/states.rs index fc65961d692..e6b35121ec2 100644 --- a/src/comp/middle/tstate/states.rs +++ b/src/comp/middle/tstate/states.rs @@ -1,7 +1,7 @@ import syntax::print::pprust::path_to_str; import util::ppaux::ty_to_str; import std::vec; -import std::istr; +import std::str; import std::option; import std::option::get; import std::option::is_none; diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 5a09bfa9b6f..56ccb1b0dc5 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -1,6 +1,6 @@ import std::int; import std::vec; -import std::istr; +import std::str; import std::uint; import std::box; import std::ufind; @@ -1420,7 +1420,7 @@ fn hash_type_structure(st: &sty) -> uint { ty_native_fn(_, args, rty) { ret hash_fn(28u, args, rty); } ty_obj(methods) { let h = 29u; - for m: method in methods { h += h << 5u + istr::hash(m.ident); } + for m: method in methods { h += h << 5u + str::hash(m.ident); } ret h; } ty_var(v) { ret hash_uint(30u, v as uint); } @@ -1447,7 +1447,7 @@ fn hash_type_info(st: &sty, cname_opt: &option::t<istr>) -> uint { let h = hash_type_structure(st); alt cname_opt { none. {/* no-op */ } - some(s) { h += h << 5u + istr::hash(s); } + some(s) { h += h << 5u + str::hash(s); } } ret h; } @@ -1511,7 +1511,7 @@ fn eq_raw_ty(a: &@raw_t, b: &@raw_t) -> bool { none. { alt b.cname { none. {/* ok */ } _ { ret false; } } } some(s_a) { alt b.cname { - some(s_b) { if !istr::eq(s_a, s_b) { ret false; } } + some(s_b) { if !str::eq(s_a, s_b) { ret false; } } _ { ret false; } } } @@ -1708,7 +1708,7 @@ fn stmt_node_id(s: &@ast::stmt) -> ast::node_id { fn field_idx(sess: &session::session, sp: &span, id: &ast::ident, fields: &[field]) -> uint { let i: uint = 0u; - for f: field in fields { if istr::eq(f.ident, id) { ret i; } i += 1u; } + for f: field in fields { if str::eq(f.ident, id) { ret i; } i += 1u; } sess.span_fatal(sp, ~"unknown field '" + id + ~"' of record"); } @@ -1716,13 +1716,13 @@ fn field_idx(sess: &session::session, sp: &span, id: &ast::ident, fn method_idx(sess: &session::session, sp: &span, id: &ast::ident, meths: &[method]) -> uint { let i: uint = 0u; - for m: method in meths { if istr::eq(m.ident, id) { ret i; } i += 1u; } + for m: method in meths { if str::eq(m.ident, id) { ret i; } i += 1u; } sess.span_fatal(sp, ~"unknown method '" + id + ~"' of obj"); } fn sort_methods(meths: &[method]) -> [method] { fn method_lteq(a: &method, b: &method) -> bool { - ret istr::lteq(a.ident, b.ident); + ret str::lteq(a.ident, b.ident); } ret std::sort::merge_sort::<method>(bind method_lteq(_, _), meths); } @@ -2039,7 +2039,7 @@ mod unify { while i < expected_len { let e_meth = expected_meths[i]; let a_meth = actual_meths[i]; - if !istr::eq(e_meth.ident, a_meth.ident) { + if !str::eq(e_meth.ident, a_meth.ident) { ret ures_err(terr_obj_meths(e_meth.ident, a_meth.ident)); } let r = @@ -2316,7 +2316,7 @@ mod unify { none. { ret ures_err(terr_record_mutability); } some(m) { mut = m; } } - if !istr::eq(expected_field.ident, actual_field.ident) { + if !str::eq(expected_field.ident, actual_field.ident) { let err = terr_record_fields(expected_field.ident, actual_field.ident); diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 23153a23e29..15e6301511c 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -36,7 +36,7 @@ import middle::ty::unify::fix_ok; import middle::ty::unify::fix_err; import std::int; import std::vec; -import std::istr; +import std::str; import std::uint; import std::map; import std::map::hashmap; @@ -1443,7 +1443,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat, ex_f_count, f_count]); } fn matches(name: &istr, f: &ty::field) -> bool { - ret istr::eq(name, f.ident); + ret str::eq(name, f.ident); } for f: ast::field_pat in fields { alt vec::find(bind matches(f.ident, _), ex_fields) { @@ -2233,7 +2233,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier, for f: spanned<ty::field> in fields_t { let found = false; for bf: ty::field in base_fields { - if istr::eq(f.node.ident, bf.ident) { + if str::eq(f.node.ident, bf.ident) { demand::simple(fcx, f.span, bf.mt.ty, f.node.mt.ty); found = true; } @@ -2397,7 +2397,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier, option::t<ty::method> { for om: @ast::method in outer_obj_methods { - if istr::eq(om.node.ident, m.ident) { + if str::eq(om.node.ident, m.ident) { // We'd better be overriding with one of the same // type. Check to make sure. let new_type = ty_of_method(ccx, om); diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs index 5481229a762..d82a2302be5 100644 --- a/src/comp/syntax/ast_util.rs +++ b/src/comp/syntax/ast_util.rs @@ -1,4 +1,4 @@ -import std::istr; +import std::str; import std::option; import codemap::span; import ast::*; @@ -16,7 +16,7 @@ fn dummy_sp() -> span { ret mk_sp(0u, 0u); } fn path_name(p: &path) -> istr { path_name_i(p.node.idents) } fn path_name_i(idents: &[ident]) -> istr { - istr::connect(idents, ~"::") + str::connect(idents, ~"::") } fn local_def(id: node_id) -> def_id { ret {crate: local_crate, node: id}; } @@ -157,7 +157,7 @@ fn is_exported(i: ident, m: _mod) -> bool { for vi: @view_item in m.view_items { alt vi.node { view_item_export(ids, _) { - for id in ids { if istr::eq(i, id) { ret true; } } + for id in ids { if str::eq(i, id) { ret true; } } count += 1u; } _ {/* fall through */ } diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs index 14dc3e46448..c56ccc21921 100644 --- a/src/comp/syntax/codemap.rs +++ b/src/comp/syntax/codemap.rs @@ -1,6 +1,6 @@ import std::vec; import std::uint; -import std::istr; +import std::str; import std::term; import std::io; import std::option; @@ -148,13 +148,13 @@ fn maybe_highlight_lines(sp: &option::t<span>, cm: &codemap, io::stdout().write_str( #ifmt[~"%s:%u ", fm.name, line + 1u]); let s = get_line(fm, line as int, file); - if !istr::ends_with(s, ~"\n") { s += ~"\n"; } + if !str::ends_with(s, ~"\n") { s += ~"\n"; } io::stdout().write_str(s); } if elided { let last_line = display_lines[vec::len(display_lines) - 1u]; let s = #ifmt[~"%s:%u ", fm.name, last_line + 1u]; - let indent = istr::char_len(s); + let indent = str::char_len(s); let out = ~""; while indent > 0u { out += ~" "; indent -= 1u; } out += ~"...\n"; @@ -172,16 +172,16 @@ fn maybe_highlight_lines(sp: &option::t<span>, cm: &codemap, while num > 0u { num /= 10u; digits += 1u; } // indent past |name:## | and the 0-offset column location - let left = istr::char_len(fm.name) + digits + lo.col + 3u; + let left = str::char_len(fm.name) + digits + lo.col + 3u; let s = ~""; - while left > 0u { istr::push_char(s, ' '); left -= 1u; } + while left > 0u { str::push_char(s, ' '); left -= 1u; } s += ~"^"; let hi = lookup_char_pos(cm, option::get(sp).hi); if hi.col != lo.col { // the ^ already takes up one space let width = hi.col - lo.col - 1u; - while width > 0u { istr::push_char(s, '~'); width -= 1u; } + while width > 0u { str::push_char(s, '~'); width -= 1u; } } io::stdout().write_str(s + ~"\n"); } @@ -221,12 +221,12 @@ fn get_line(fm: filemap, line: int, file: &istr) -> istr { // If we're not done parsing the file, we're at the limit of what's // parsed. If we just slice the rest of the string, we'll print out // the remainder of the file, which is undesirable. - end = istr::byte_len(file); - let rest = istr::slice(file, begin, end); - let newline = istr::index(rest, '\n' as u8); + end = str::byte_len(file); + let rest = str::slice(file, begin, end); + let newline = str::index(rest, '\n' as u8); if newline != -1 { end = begin + (newline as uint); } } - ret istr::slice(file, begin, end); + ret str::slice(file, begin, end); } fn get_filemap(cm: codemap, filename: istr) -> filemap { diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs index 051c667e38f..84d9061c614 100644 --- a/src/comp/syntax/ext/base.rs +++ b/src/comp/syntax/ext/base.rs @@ -1,4 +1,4 @@ -import std::istr; +import std::str; import std::vec; import std::option; import std::map::hashmap; diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs index c10f835ff29..ed493137369 100644 --- a/src/comp/syntax/ext/env.rs +++ b/src/comp/syntax/ext/env.rs @@ -5,7 +5,7 @@ * interface. */ import std::vec; -import std::istr; +import std::str; import std::option; import std::generic_os; import base::*; diff --git a/src/comp/syntax/ext/expand.rs b/src/comp/syntax/ext/expand.rs index ce787c2bc6e..ad58a617f45 100644 --- a/src/comp/syntax/ext/expand.rs +++ b/src/comp/syntax/ext/expand.rs @@ -5,7 +5,7 @@ import std::option::some; import std::map::hashmap; import std::vec; -import std::istr; +import std::str; import syntax::ast::crate; import syntax::ast::expr_; diff --git a/src/comp/syntax/ext/ident_to_str.rs b/src/comp/syntax/ext/ident_to_str.rs index d2c73bfb16f..d989151831e 100644 --- a/src/comp/syntax/ext/ident_to_str.rs +++ b/src/comp/syntax/ext/ident_to_str.rs @@ -1,5 +1,5 @@ import std::vec; -import std::istr; +import std::str; import std::option; import base::*; import syntax::ast; diff --git a/src/comp/syntax/ext/ifmt.rs b/src/comp/syntax/ext/ifmt.rs index b48d73d0fc5..3b90ebeed13 100644 --- a/src/comp/syntax/ext/ifmt.rs +++ b/src/comp/syntax/ext/ifmt.rs @@ -6,7 +6,7 @@ * compiler syntax extension plugin interface. */ import std::vec; -import std::istr; +import std::str; import std::option; import std::option::none; import std::option::some; @@ -103,7 +103,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], } fn make_path_vec(cx: &ext_ctxt, ident: &ast::ident) -> [ast::ident] { fn compiling_std(cx: &ext_ctxt) -> bool { - ret istr::find(cx.crate_file_name(), ~"std.rc") >= 0; + ret str::find(cx.crate_file_name(), ~"std.rc") >= 0; } if compiling_std(cx) { ret [~"extifmt", ~"rt", ident]; diff --git a/src/comp/syntax/ext/log_syntax.rs b/src/comp/syntax/ext/log_syntax.rs index 5acad14fbb2..a8fa657c20c 100644 --- a/src/comp/syntax/ext/log_syntax.rs +++ b/src/comp/syntax/ext/log_syntax.rs @@ -1,7 +1,7 @@ import std::option; import base::*; import syntax::ast; -import std::istr; +import std::str; fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr, _body: &option::t<istr>) -> @ast::expr { diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index 2ab61e12244..2df629d3f8c 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -2,7 +2,7 @@ use std; import codemap::span; import std::vec; -import std::istr; +import std::str; import std::option; import std::map::hashmap; import std::map::new_str_hash; diff --git a/src/comp/syntax/parse/eval.rs b/src/comp/syntax/parse/eval.rs index 6318c4c769b..ee7c5a3d338 100644 --- a/src/comp/syntax/parse/eval.rs +++ b/src/comp/syntax/parse/eval.rs @@ -1,5 +1,5 @@ -import std::istr; +import std::str; import std::option; import std::option::some; import std::option::none; diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index 37eddf59abe..57720422306 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -2,7 +2,7 @@ import std::io; import std::int; import std::vec; -import std::istr; +import std::str; import std::map; import std::map::hashmap; import std::option; @@ -44,19 +44,19 @@ fn new_reader(cm: &codemap::codemap, src: &istr, filemap: codemap::filemap, fn get_str_from(start: uint) -> istr { // I'm pretty skeptical about this subtraction. What if there's a // multi-byte character before the mark? - ret istr::slice(src, start - 1u, pos - 1u); + ret str::slice(src, start - 1u, pos - 1u); } fn get_chpos() -> uint { ret chpos; } fn get_byte_pos() -> uint { ret pos; } fn curr() -> char { ret ch; } fn next() -> char { if pos < len { - ret istr::char_at(src, pos); + ret str::char_at(src, pos); } else { ret -1 as char; } } fn init() { if pos < len { - let next = istr::char_range_at(src, pos); + let next = str::char_range_at(src, pos); pos = next.next; ch = next.ch; } @@ -69,7 +69,7 @@ fn new_reader(cm: &codemap::codemap, src: &istr, filemap: codemap::filemap, codemap::next_line(fm, chpos, pos + fm.start_pos.byte); col = 0u; } - let next = istr::char_range_at(src, pos); + let next = str::char_range_at(src, pos); pos = next.next; ch = next.ch; } else { ch = -1 as char; } @@ -85,7 +85,7 @@ fn new_reader(cm: &codemap::codemap, src: &istr, filemap: codemap::filemap, } let strs: [istr] = []; let rd = - reader(cm, src, istr::byte_len(src), 0u, 0u, -1 as char, + reader(cm, src, str::byte_len(src), 0u, 0u, -1 as char, filemap.start_pos.ch, strs, filemap, itr); rd.init(); ret rd; @@ -178,15 +178,15 @@ fn scan_exponent(rdr: &reader) -> option::t<istr> { let c = rdr.curr(); let rslt = ~""; if c == 'e' || c == 'E' { - rslt += istr::unsafe_from_bytes([c as u8]); + rslt += str::unsafe_from_bytes([c as u8]); rdr.bump(); c = rdr.curr(); if c == '-' || c == '+' { - rslt += istr::unsafe_from_bytes([c as u8]); + rslt += str::unsafe_from_bytes([c as u8]); rdr.bump(); } let exponent = scan_dec_digits(rdr); - if istr::byte_len(exponent) > 0u { + if str::byte_len(exponent) > 0u { ret some(rslt + exponent); } else { rdr.err(~"scan_exponent: bad fp literal"); fail; } } else { ret none::<istr>; } @@ -196,7 +196,7 @@ fn scan_dec_digits(rdr: &reader) -> istr { let c = rdr.curr(); let rslt: istr = ~""; while is_dec_digit(c) || c == '_' { - if c != '_' { rslt += istr::unsafe_from_bytes([c as u8]); } + if c != '_' { rslt += str::unsafe_from_bytes([c as u8]); } rdr.bump(); c = rdr.curr(); } @@ -348,11 +348,11 @@ fn next_token_inner(rdr: &reader) -> token::token { let c = rdr.curr(); if is_alpha(c) || c == '_' { while is_alnum(c) || c == '_' { - istr::push_char(accum_str, c); + str::push_char(accum_str, c); rdr.bump(); c = rdr.curr(); } - if istr::eq(accum_str, ~"_") { ret token::UNDERSCORE; } + if str::eq(accum_str, ~"_") { ret token::UNDERSCORE; } let is_mod_name = c == ':' && rdr.next() == ':'; ret token::IDENT(interner::intern::<istr>( *rdr.get_interner(), @@ -493,20 +493,20 @@ fn next_token_inner(rdr: &reader) -> token::token { let escaped = rdr.curr(); rdr.bump(); alt escaped { - 'n' { istr::push_byte(accum_str, '\n' as u8); } - 'r' { istr::push_byte(accum_str, '\r' as u8); } - 't' { istr::push_byte(accum_str, '\t' as u8); } - '\\' { istr::push_byte(accum_str, '\\' as u8); } - '"' { istr::push_byte(accum_str, '"' as u8); } + 'n' { str::push_byte(accum_str, '\n' as u8); } + 'r' { str::push_byte(accum_str, '\r' as u8); } + 't' { str::push_byte(accum_str, '\t' as u8); } + '\\' { str::push_byte(accum_str, '\\' as u8); } + '"' { str::push_byte(accum_str, '"' as u8); } '\n' { consume_whitespace(rdr); } 'x' { - istr::push_char(accum_str, scan_numeric_escape(rdr, 2u)); + str::push_char(accum_str, scan_numeric_escape(rdr, 2u)); } 'u' { - istr::push_char(accum_str, scan_numeric_escape(rdr, 4u)); + str::push_char(accum_str, scan_numeric_escape(rdr, 4u)); } 'U' { - istr::push_char(accum_str, scan_numeric_escape(rdr, 8u)); + str::push_char(accum_str, scan_numeric_escape(rdr, 8u)); } c2 { rdr.err( @@ -516,7 +516,7 @@ fn next_token_inner(rdr: &reader) -> token::token { } } } - _ { istr::push_char(accum_str, ch); } + _ { str::push_char(accum_str, ch); } } } rdr.bump(); @@ -569,7 +569,7 @@ type cmnt = {style: cmnt_style, lines: [istr], pos: uint}; fn read_to_eol(rdr: &reader) -> istr { let val = ~""; while rdr.curr() != '\n' && !rdr.is_eof() { - istr::push_char(val, rdr.curr()); + str::push_char(val, rdr.curr()); rdr.bump(); } if rdr.curr() == '\n' { rdr.bump(); } @@ -634,8 +634,8 @@ fn trim_whitespace_prefix_and_push_line(lines: &mutable [istr], s: &istr, col: uint) { let s1; if all_whitespace(s, 0u, col) { - if col < istr::byte_len(s) { - s1 = istr::slice(s, col, istr::byte_len(s)); + if col < str::byte_len(s) { + s1 = str::slice(s, col, str::byte_len(s)); } else { s1 = ~""; } } else { s1 = s; } log ~"pushing line: " + s1; @@ -659,7 +659,7 @@ fn read_block_comment(rdr: &reader, code_to_the_left: bool) -> cmnt { curr_line = ~""; rdr.bump(); } else { - istr::push_char(curr_line, rdr.curr()); + str::push_char(curr_line, rdr.curr()); if rdr.curr() == '/' && rdr.next() == '*' { rdr.bump(); rdr.bump(); @@ -675,7 +675,7 @@ fn read_block_comment(rdr: &reader, code_to_the_left: bool) -> cmnt { } } } - if istr::byte_len(curr_line) != 0u { + if str::byte_len(curr_line) != 0u { trim_whitespace_prefix_and_push_line(lines, curr_line, col); } let style = if code_to_the_left { trailing } else { isolated }; @@ -722,8 +722,8 @@ type lit = {lit: istr, pos: uint}; fn gather_comments_and_literals(cm: &codemap::codemap, path: &istr, srdr: io::reader) -> {cmnts: [cmnt], lits: [lit]} { - let src = istr::unsafe_from_bytes(srdr.read_whole_stream()); - let itr = @interner::mk::<istr>(istr::hash, istr::eq); + let src = str::unsafe_from_bytes(srdr.read_whole_stream()); + let itr = @interner::mk::<istr>(str::hash, str::eq); let rdr = new_reader(cm, src, codemap::new_filemap( path, 0u, 0u), itr); diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index e22ebeb78d3..763172c81fa 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -1,7 +1,7 @@ import std::io; import std::vec; -import std::istr; +import std::str; import std::option; import std::option::some; import std::option::none; @@ -66,7 +66,7 @@ fn new_parser_from_file(sess: parse_sess, cfg: &ast::crate_cfg, path: &istr, let filemap = codemap::new_filemap( path, chpos, byte_pos); sess.cm.files += [filemap]; - let itr = @interner::mk(istr::hash, istr::eq); + let itr = @interner::mk(str::hash, str::eq); let rdr = lexer::new_reader(sess.cm, src, filemap, itr); ret new_parser(sess, cfg, rdr, ftype); } @@ -247,7 +247,7 @@ fn eat(p: &parser, tok: &token::token) -> bool { fn is_word(p: &parser, word: &istr) -> bool { ret alt p.peek() { - token::IDENT(sid, false) { istr::eq(word, p.get_str(sid)) } + token::IDENT(sid, false) { str::eq(word, p.get_str(sid)) } _ { false } }; } @@ -255,7 +255,7 @@ fn is_word(p: &parser, word: &istr) -> bool { fn eat_word(p: &parser, word: &istr) -> bool { alt p.peek() { token::IDENT(sid, false) { - if istr::eq(word, p.get_str(sid)) { + if str::eq(word, p.get_str(sid)) { p.bump(); ret true; } else { ret false; } @@ -2036,14 +2036,14 @@ fn parse_item_native_mod(p: &parser, attrs: &[ast::attribute]) -> @ast::item { let abi = ast::native_abi_cdecl; if !is_word(p, ~"mod") { let t = parse_str(p); - if istr::eq(t, ~"cdecl") { - } else if istr::eq(t, ~"rust") { + if str::eq(t, ~"cdecl") { + } else if str::eq(t, ~"rust") { abi = ast::native_abi_rust; - } else if istr::eq(t, ~"llvm") { + } else if str::eq(t, ~"llvm") { abi = ast::native_abi_llvm; - } else if istr::eq(t, ~"rust-intrinsic") { + } else if str::eq(t, ~"rust-intrinsic") { abi = ast::native_abi_rust_intrinsic; - } else if istr::eq(t, ~"x86stdcall") { + } else if str::eq(t, ~"x86stdcall") { abi = ast::native_abi_x86stdcall; } else { p.fatal(~"unsupported abi: " + t); } } @@ -2419,8 +2419,8 @@ fn is_view_item(p: &parser) -> bool { alt p.peek() { token::IDENT(sid, false) { let st = p.get_str(sid); - ret istr::eq(st, ~"use") || istr::eq(st, ~"import") || - istr::eq(st, ~"export"); + ret str::eq(st, ~"use") || str::eq(st, ~"import") || + str::eq(st, ~"export"); } _ { ret false; } } @@ -2450,7 +2450,7 @@ fn parse_crate_from_source_str(name: &istr, source: &istr, let ftype = SOURCE_FILE; let filemap = codemap::new_filemap(name, 0u, 0u); sess.cm.files += [filemap]; - let itr = @interner::mk(istr::hash, istr::eq); + let itr = @interner::mk(str::hash, str::eq); let rdr = lexer::new_reader(sess.cm, source, filemap, itr); let p = new_parser(sess, cfg, rdr, ftype); @@ -2588,9 +2588,9 @@ fn parse_crate_from_crate_file(input: &istr, cfg: &ast::crate_cfg, fn parse_crate_from_file(input: &istr, cfg: &ast::crate_cfg, sess: &parse_sess) -> @ast::crate { - if istr::ends_with(input, ~".rc") { + if str::ends_with(input, ~".rc") { parse_crate_from_crate_file(input, cfg, sess) - } else if istr::ends_with(input, ~".rs") { + } else if str::ends_with(input, ~".rs") { parse_crate_from_source_file(input, cfg, sess) } else { codemap::emit_error(none, ~"unknown input file type: " diff --git a/src/comp/syntax/parse/token.rs b/src/comp/syntax/parse/token.rs index 6ae2affdb04..24d2a3b9a6f 100644 --- a/src/comp/syntax/parse/token.rs +++ b/src/comp/syntax/parse/token.rs @@ -5,7 +5,7 @@ import std::map::new_str_hash; import util::interner; import std::int; import std::uint; -import std::istr; +import std::str; type str_num = uint; @@ -166,8 +166,8 @@ fn to_str(r: lexer::reader, t: token) -> istr { LIT_CHAR(c) { // FIXME: escape. let tmp = ~"'"; - istr::push_char(tmp, c); - istr::push_byte(tmp, '\'' as u8); + str::push_char(tmp, c); + str::push_byte(tmp, '\'' as u8); ret tmp; } LIT_BOOL(b) { if b { ret ~"true"; } else { ret ~"false"; } } diff --git a/src/comp/syntax/print/pp.rs b/src/comp/syntax/print/pp.rs index ae94fb959b5..39e5b59eb61 100644 --- a/src/comp/syntax/print/pp.rs +++ b/src/comp/syntax/print/pp.rs @@ -1,7 +1,7 @@ import std::io; import std::vec; -import std::istr; +import std::str; /* * This pretty-printer is a direct reimplementation of Philip Karlton's @@ -496,7 +496,7 @@ fn end(p: printer) { p.pretty_print(END); } fn eof(p: printer) { p.pretty_print(EOF); } fn word(p: printer, wrd: &istr) { - p.pretty_print(STRING(wrd, istr::char_len(wrd) as int)); + p.pretty_print(STRING(wrd, str::char_len(wrd) as int)); } fn huge_word(p: printer, wrd: &istr) { diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index f1382341eb9..a78006417a4 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -2,7 +2,7 @@ import std::vec; import std::int; import std::io; -import std::istr; +import std::str; import std::uint; import std::option; import parse::lexer; @@ -156,7 +156,7 @@ fn head(s: &ps, w: &istr) { // outer-box is consistent cbox(s, indent_unit); // head-box is inconsistent - ibox(s, istr::char_len(w) + 1u); + ibox(s, str::char_len(w) + 1u); // keyword that starts the head word_nbsp(s, w); } @@ -432,7 +432,7 @@ fn print_item(s: &ps, item: &@ast::item) { } word_nbsp(s, ~"mod"); word_nbsp(s, item.ident); - if !istr::eq(nmod.native_name, item.ident) { + if !str::eq(nmod.native_name, item.ident) { word_space(s, ~"="); print_string(s, nmod.native_name); nbsp(s); @@ -458,7 +458,7 @@ fn print_item(s: &ps, item: &@ast::item) { ast::item_tag(variants, params) { let newtype = vec::len(variants) == 1u && - istr::eq(item.ident, variants[0].node.name) && + str::eq(item.ident, variants[0].node.name) && vec::len(variants[0].node.args) == 1u; if newtype { ibox(s, indent_unit); @@ -1318,7 +1318,7 @@ fn print_view_item(s: &ps, item: &@ast::view_item) { } ast::view_item_import(id, ids, _) { head(s, ~"import"); - if !istr::eq(id, ids[vec::len(ids) - 1u]) { + if !str::eq(id, ids[vec::len(ids) - 1u]) { word_space(s, id); word_space(s, ~"="); } @@ -1510,7 +1510,7 @@ fn print_literal(s: &ps, lit: &@ast::lit) { } ast::lit_char(ch) { word(s.s, - ~"'" + escape_str(istr::unsafe_from_bytes([ch as u8]), '\'') + + ~"'" + escape_str(str::unsafe_from_bytes([ch as u8]), '\'') + ~"'"); } ast::lit_int(val) { word(s.s, int::str(val)); } @@ -1572,7 +1572,7 @@ fn print_comment(s: &ps, cmnt: lexer::cmnt) { for line: istr in cmnt.lines { // Don't print empty lines because they will end up as trailing // whitespace - if istr::is_not_empty(line) { + if str::is_not_empty(line) { word(s.s, line); } hardbreak(s.s); @@ -1586,7 +1586,7 @@ fn print_comment(s: &ps, cmnt: lexer::cmnt) { } else { ibox(s, 0u); for line: istr in cmnt.lines { - if istr::is_not_empty(line) { + if str::is_not_empty(line) { word(s.s, line); } hardbreak(s.s); @@ -1615,7 +1615,7 @@ fn print_string(s: &ps, st: &istr) { fn escape_str(st: &istr, to_escape: char) -> istr { let out: istr = ~""; - let len = istr::byte_len(st); + let len = str::byte_len(st); let i = 0u; while i < len { alt st[i] as char { @@ -1627,7 +1627,7 @@ fn escape_str(st: &istr, to_escape: char) -> istr { if cur == to_escape { out += ~"\\"; } // FIXME some (or all?) non-ascii things should be escaped - istr::push_char(out, cur); + str::push_char(out, cur); } } i += 1u; diff --git a/src/comp/util/common.rs b/src/comp/util/common.rs index da0fba4a96a..89d52834b99 100644 --- a/src/comp/util/common.rs +++ b/src/comp/util/common.rs @@ -1,4 +1,4 @@ -import std::istr; +import std::str; import std::map; import std::map::hashmap; import std::uint; @@ -154,7 +154,7 @@ fn call_kind_str(c: call_kind) -> istr { } fn is_main_name(path: &[ast::ident]) -> bool { - istr::eq(option::get(std::vec::last(path)), ~"main") + str::eq(option::get(std::vec::last(path)), ~"main") } // FIXME mode this to std::float when editing the stdlib no longer diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs index 5e7e7e3fd78..8fec8e54727 100644 --- a/src/comp/util/ppaux.rs +++ b/src/comp/util/ppaux.rs @@ -1,5 +1,5 @@ import std::vec; -import std::istr; +import std::str; import std::int; import std::option; import std::option::none; @@ -44,7 +44,7 @@ fn fn_ident_to_string(id: ast::node_id, i: &ast::fn_ident) -> istr { fn get_id_ident(cx: &ctxt, id: ast::def_id) -> istr { if id.crate != ast::local_crate { alt cx.ext_map.find(id) { - some(j) { istr::connect(j, ~"::") } + some(j) { str::connect(j, ~"::") } _ { fail (~"get_id_ident: can't find item in ext_map, id.crate = " + int::str(id.crate)) } } @@ -76,7 +76,7 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> istr { s += ~"("; let strs = []; for a: arg in inputs { strs += [fn_input_to_str(cx, a)]; } - s += istr::connect(strs, ~", "); + s += str::connect(strs, ~", "); s += ~")"; if struct(cx, output) != ty_nil { alt cf { @@ -128,19 +128,19 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> istr { ty_rec(elems) { let strs: [istr] = []; for fld: field in elems { strs += [field_to_str(cx, fld)]; } - ~"{" + istr::connect(strs, ~",") + ~"}" + ~"{" + str::connect(strs, ~",") + ~"}" } ty_tup(elems) { let strs = []; for elem in elems { strs += [ty_to_str(cx, elem)]; } - ~"(" + istr::connect(strs, ~",") + ~")" + ~"(" + str::connect(strs, ~",") + ~")" } ty_tag(id, tps) { let s = get_id_ident(cx, id); if vec::len::<t>(tps) > 0u { let strs: [istr] = []; for typ: t in tps { strs += [ty_to_str(cx, typ)]; } - s += ~"[" + istr::connect(strs, ~",") + ~"]"; + s += ~"[" + str::connect(strs, ~",") + ~"]"; } s } @@ -154,12 +154,12 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> istr { ty_obj(meths) { let strs = []; for m: method in meths { strs += [method_to_str(cx, m)]; } - ~"obj {\n\t" + istr::connect(strs, ~"\n\t") + ~"\n}" + ~"obj {\n\t" + str::connect(strs, ~"\n\t") + ~"\n}" } ty_res(id, _, _) { get_id_ident(cx, id) } ty_var(v) { ~"<T" + int::str(v) + ~">" } ty_param(id, _) { - ~"'" + istr::unsafe_from_bytes([('a' as u8) + (id as u8)]) + ~"'" + str::unsafe_from_bytes([('a' as u8) + (id as u8)]) } _ { ty_to_short_str(cx, typ) } } @@ -167,7 +167,7 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> istr { fn ty_to_short_str(cx: &ctxt, typ: t) -> istr { let s = encoder::encoded_ty(cx, typ); - if istr::byte_len(s) >= 32u { s = istr::substr(s, 0u, 32u); } + if str::byte_len(s) >= 32u { s = str::substr(s, 0u, 32u); } ret s; } |
