From 5f57a508af9c43adc03a4edd575ceae41cc8cd3a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 27 Aug 2011 18:01:52 -0700 Subject: [PATCH] Convert misc compiler bits to istrs. Issue #855 --- src/comp/driver/rustc.rs | 16 ++++----- src/comp/front/attr.rs | 5 +-- src/comp/metadata/decoder.rs | 2 +- src/comp/metadata/encoder.rs | 4 +-- src/comp/middle/kind.rs | 29 ++++++++-------- src/comp/middle/trans_alt.rs | 8 ++--- src/comp/middle/ty.rs | 20 +++++------ src/comp/middle/typeck.rs | 4 +-- src/comp/syntax/ext/env.rs | 8 ++--- src/comp/syntax/ext/fmt.rs | 61 +++++++++++++++++---------------- src/comp/syntax/ext/simplext.rs | 25 +++++++------- src/comp/util/ppaux.rs | 2 +- 12 files changed, 93 insertions(+), 91 deletions(-) diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index 9bb5750aab2b..fffdcc75bf30 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -47,21 +47,21 @@ fn default_configuration(sess: session::session, ast::crate_cfg { let libc = alt sess.get_targ_cfg().os { - session::os_win32. { "msvcrt.dll" } - session::os_macos. { "libc.dylib" } - session::os_linux. { "libc.so.6" } - _ { "libc.so" } + session::os_win32. { ~"msvcrt.dll" } + session::os_macos. { ~"libc.dylib" } + session::os_linux. { ~"libc.so.6" } + _ { ~"libc.so" } }; let mk = attr::mk_name_value_item_str; ret [ // Target bindings. - mk(~"target_os", istr::to_estr(std::os::target_os())), - mk(~"target_arch", "x86"), + mk(~"target_os", std::os::target_os()), + mk(~"target_arch", ~"x86"), mk(~"target_libc", libc), // Build bindings. - mk(~"build_compiler", istr::to_estr(argv0)), - mk(~"build_input", istr::to_estr(input))]; + mk(~"build_compiler", argv0), + mk(~"build_input", input)]; } fn build_configuration(sess: session::session, argv0: &istr, input: &istr) -> diff --git a/src/comp/front/attr.rs b/src/comp/front/attr.rs index 516da981af3f..0d85a083554e 100644 --- a/src/comp/front/attr.rs +++ b/src/comp/front/attr.rs @@ -197,8 +197,9 @@ fn span<@T>(item: &T) -> ast::spanned { ret {node: item, span: ast_util::dummy_sp()}; } -fn mk_name_value_item_str(name: ast::ident, value: str) -> @ast::meta_item { - let value_lit = span(ast::lit_str(istr::from_estr(value), ast::sk_rc)); +fn mk_name_value_item_str(name: ast::ident, + value: &istr) -> @ast::meta_item { + let value_lit = span(ast::lit_str(value, ast::sk_rc)); ret mk_name_value_item(name, value_lit); } diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs index a1ab2a521c4b..92247cb55a84 100644 --- a/src/comp/metadata/decoder.rs +++ b/src/comp/metadata/decoder.rs @@ -310,7 +310,7 @@ fn get_meta_items(md: &ebml::doc) -> [@ast::meta_item] { 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 = str::unsafe_from_bytes(ebml::doc_data(vd)); + let v = istr::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)]; diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs index c5dd0fa4cefb..269a49acbe6a 100644 --- a/src/comp/metadata/encoder.rs +++ b/src/comp/metadata/encoder.rs @@ -511,10 +511,10 @@ fn synthesize_crate_attrs(ecx: &@encode_ctxt, crate: &@crate) -> [attribute] { let name_item = attr::mk_name_value_item_str( - ~"name", istr::to_estr(ecx.ccx.link_meta.name)); + ~"name", ecx.ccx.link_meta.name); let vers_item = attr::mk_name_value_item_str( - ~"vers", istr::to_estr(ecx.ccx.link_meta.vers)); + ~"vers", ecx.ccx.link_meta.vers); let other_items = { diff --git a/src/comp/middle/kind.rs b/src/comp/middle/kind.rs index 3846620103c4..74cc3b4cada5 100644 --- a/src/comp/middle/kind.rs +++ b/src/comp/middle/kind.rs @@ -112,44 +112,45 @@ fn type_and_kind(tcx: &ty::ctxt, e: &@ast::expr) -> } fn need_expr_kind(tcx: &ty::ctxt, e: &@ast::expr, k_need: ast::kind, - descr: &str) { + descr: &istr) { let tk = type_and_kind(tcx, e); - log #fmt["for %s: want %s type, got %s type %s", descr, + log #fmt["for %s: want %s type, got %s type %s", istr::to_estr(descr), kind_to_str(k_need), kind_to_str(tk.kind), istr::to_estr(util::ppaux::ty_to_str(tcx, tk.ty))]; if !kind_lteq(k_need, tk.kind) { let s = #fmt["mismatched kinds for %s: needed %s type, got %s type %s", - descr, kind_to_str(k_need), kind_to_str(tk.kind), + istr::to_estr(descr), kind_to_str(k_need), + kind_to_str(tk.kind), istr::to_estr(util::ppaux::ty_to_str(tcx, tk.ty))]; tcx.sess.span_err(e.span, istr::from_estr(s)); } } fn need_shared_lhs_rhs(tcx: &ty::ctxt, a: &@ast::expr, b: &@ast::expr, - op: &str) { - need_expr_kind(tcx, a, ast::kind_shared, op + " lhs"); - need_expr_kind(tcx, b, ast::kind_shared, op + " rhs"); + op: &istr) { + need_expr_kind(tcx, a, ast::kind_shared, op + ~" lhs"); + need_expr_kind(tcx, b, ast::kind_shared, op + ~" rhs"); } fn check_expr(tcx: &ty::ctxt, e: &@ast::expr) { alt e.node { - ast::expr_move(a, b) { need_shared_lhs_rhs(tcx, a, b, "<-"); } - ast::expr_assign(a, b) { need_shared_lhs_rhs(tcx, a, b, "="); } - ast::expr_assign_op(_, a, b) { need_shared_lhs_rhs(tcx, a, b, "op="); } - ast::expr_swap(a, b) { need_shared_lhs_rhs(tcx, a, b, "<->"); } + ast::expr_move(a, b) { need_shared_lhs_rhs(tcx, a, b, ~"<-"); } + ast::expr_assign(a, b) { need_shared_lhs_rhs(tcx, a, b, ~"="); } + ast::expr_assign_op(_, a, b) { need_shared_lhs_rhs(tcx, a, b, ~"op="); } + ast::expr_swap(a, b) { need_shared_lhs_rhs(tcx, a, b, ~"<->"); } ast::expr_copy(a) { - need_expr_kind(tcx, a, ast::kind_shared, "'copy' operand"); + need_expr_kind(tcx, a, ast::kind_shared, ~"'copy' operand"); } ast::expr_ret(option::some(a)) { - need_expr_kind(tcx, a, ast::kind_shared, "'ret' operand"); + need_expr_kind(tcx, a, ast::kind_shared, ~"'ret' operand"); } ast::expr_be(a) { - need_expr_kind(tcx, a, ast::kind_shared, "'be' operand"); + need_expr_kind(tcx, a, ast::kind_shared, ~"'be' operand"); } ast::expr_fail(option::some(a)) { - need_expr_kind(tcx, a, ast::kind_shared, "'fail' operand"); + need_expr_kind(tcx, a, ast::kind_shared, ~"'fail' operand"); } ast::expr_call(callee, _) { let tpt = ty::expr_ty_params_and_ty(tcx, callee); diff --git a/src/comp/middle/trans_alt.rs b/src/comp/middle/trans_alt.rs index 4491fca0e200..53193ad98beb 100644 --- a/src/comp/middle/trans_alt.rs +++ b/src/comp/middle/trans_alt.rs @@ -58,9 +58,9 @@ fn variant_opt(ccx: &@crate_ctxt, pat_id: ast::node_id) -> opt { } type bind_map = [{ident: ast::ident, val: ValueRef}]; -fn assoc(key: str, list: &bind_map) -> option::t { +fn assoc(key: &istr, list: &bind_map) -> option::t { for elt: {ident: ast::ident, val: ValueRef} in list { - if istr::eq(elt.ident, istr::from_estr(key)) { ret some(elt.val); } + if istr::eq(elt.ident, key) { ret some(elt.val); } } ret none; } @@ -304,7 +304,7 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef], // the actual arm block. for each @{key, val} in data.id_map.items() { bcx.fcx.lllocals.insert - (val, option::get(assoc(istr::to_estr(key), + (val, option::get(assoc(key, m[0].bound))); } let {bcx: guard_bcx, val: guard_val} = @@ -474,7 +474,7 @@ fn make_phi_bindings(bcx: &@block_ctxt, map: &[exit_node], let vals = []; for ex: exit_node in map { if ex.to as uint == our_block { - alt assoc(istr::to_estr(item.key), ex.bound) { + alt assoc(item.key, ex.bound) { some(val) { llbbs += [ex.from]; vals += [val]; } none. { } } diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 67f5b62a12ea..eec50b5f454c 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -243,7 +243,7 @@ fn method_ty_to_fn_ty(cx: &ctxt, m: method) -> t { // Never construct these manually. These are interned. type raw_t = {struct: sty, - cname: option::t, + cname: option::t, hash: uint, has_params: bool, has_vars: bool}; @@ -427,8 +427,8 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, // Type constructors -fn mk_raw_ty(cx: &ctxt, st: &sty, _in_cname: &option::t) -> @raw_t { - let cname = none; +fn mk_raw_ty(cx: &ctxt, st: &sty, _in_cname: &option::t) -> @raw_t { + let cname: option::t = none; let h = hash_type_info(st, cname); let has_params: bool = false; let has_vars: bool = false; @@ -505,11 +505,11 @@ fn mk_raw_ty(cx: &ctxt, st: &sty, _in_cname: &option::t) -> @raw_t { has_vars: has_vars}; } -fn intern(cx: &ctxt, st: &sty, cname: &option::t) { +fn intern(cx: &ctxt, st: &sty, cname: &option::t) { interner::intern(*cx.ts, mk_raw_ty(cx, st, cname)); } -fn gen_ty_full(cx: &ctxt, st: &sty, cname: &option::t) -> t { +fn gen_ty_full(cx: &ctxt, st: &sty, cname: &option::t) -> t { let raw_type = mk_raw_ty(cx, st, cname); ret interner::intern(*cx.ts, raw_type); } @@ -617,7 +617,7 @@ fn struct(cx: &ctxt, typ: t) -> sty { // Returns the canonical name of the given type. -fn cname(cx: &ctxt, typ: t) -> option::t { +fn cname(cx: &ctxt, typ: t) -> option::t { ret interner::get(*cx.ts, typ).cname; } @@ -794,7 +794,7 @@ fn fold_ty(cx: &ctxt, fld: fold_mode, ty_0: t) -> t { // Type utilities -fn rename(cx: &ctxt, typ: t, new_cname: str) -> t { +fn rename(cx: &ctxt, typ: t, new_cname: &istr) -> t { ret gen_ty_full(cx, struct(cx, typ), some(new_cname)); } @@ -1538,11 +1538,11 @@ fn hash_type_structure(st: &sty) -> uint { } } -fn hash_type_info(st: &sty, cname_opt: &option::t) -> uint { +fn hash_type_info(st: &sty, cname_opt: &option::t) -> uint { let h = hash_type_structure(st); alt cname_opt { none. {/* no-op */ } - some(s) { h += h << 5u + str::hash(s); } + some(s) { h += h << 5u + istr::hash(s); } } ret h; } @@ -1606,7 +1606,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 !str::eq(s_a, s_b) { ret false; } } + some(s_b) { if !istr::eq(s_a, s_b) { ret false; } } _ { ret false; } } } diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 446d56182f02..57baf194938d 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -417,7 +417,7 @@ fn ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) -> alt cname { none. {/* no-op */ } some(cname_str) { - typ = ty::rename(tcx, typ, istr::to_estr(cname_str)); + typ = ty::rename(tcx, typ, cname_str); } } tcx.ast_ty_to_ty_cache.insert(ast_ty, some(typ)); @@ -629,7 +629,7 @@ mod collect { ty_params: &[ast::ty_param]) -> ty::ty_param_kinds_and_ty { let methods = get_obj_method_types(cx, ob); let t_obj = ty::mk_obj(cx.tcx, ty::sort_methods(methods)); - t_obj = ty::rename(cx.tcx, t_obj, istr::to_estr(id)); + t_obj = ty::rename(cx.tcx, t_obj, id); ret {kinds: ty_param_kinds(ty_params), ty: t_obj}; } fn ty_of_obj_ctor(cx: @ctxt, id: &ast::ident, ob: &ast::_obj, diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs index a183e8f34553..23feb43d817d 100644 --- a/src/comp/syntax/ext/env.rs +++ b/src/comp/syntax/ext/env.rs @@ -28,15 +28,15 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr, let var = expr_to_str(cx, args[0], ~"#env requires a string"); alt generic_os::getenv(var) { - option::none. { ret make_new_str(cx, sp, ""); } + option::none. { ret make_new_str(cx, sp, ~""); } option::some(s) { - ret make_new_str(cx, sp, istr::to_estr(s)); + ret make_new_str(cx, sp, s); } } } -fn make_new_str(cx: &ext_ctxt, sp: codemap::span, s: str) -> @ast::expr { - ret make_new_lit(cx, sp, ast::lit_str(istr::from_estr(s), ast::sk_rc)); +fn make_new_str(cx: &ext_ctxt, sp: codemap::span, s: &istr) -> @ast::expr { + ret make_new_lit(cx, sp, ast::lit_str(s, ast::sk_rc)); } // // Local Variables: diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs index 1bdd819d7086..121300f64902 100644 --- a/src/comp/syntax/ext/fmt.rs +++ b/src/comp/syntax/ext/fmt.rs @@ -52,8 +52,8 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], let sp_lit = @{node: lit, span: sp}; ret @{id: cx.next_id(), node: ast::expr_lit(sp_lit), span: sp}; } - fn make_new_str(cx: &ext_ctxt, sp: span, s: str) -> @ast::expr { - let lit = ast::lit_str(istr::from_estr(s), ast::sk_rc); + fn make_new_str(cx: &ext_ctxt, sp: span, s: &istr) -> @ast::expr { + let lit = ast::lit_str(s, ast::sk_rc); ret make_new_lit(cx, sp, lit); } fn make_new_int(cx: &ext_ctxt, sp: span, i: int) -> @ast::expr { @@ -109,8 +109,9 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], ret [~"extfmt", ~"rt", ident]; } else { ret [~"std", ~"extfmt", ~"rt", ident]; } } - fn make_rt_path_expr(cx: &ext_ctxt, sp: span, ident: str) -> @ast::expr { - let path = make_path_vec(cx, istr::from_estr(ident)); + fn make_rt_path_expr(cx: &ext_ctxt, sp: span, + ident: &istr) -> @ast::expr { + let path = make_path_vec(cx, ident); ret make_path_expr(cx, sp, path); } // Produces an AST expression that represents a RT::conv record, @@ -122,11 +123,11 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], for f: flag in flags { let fstr; alt f { - flag_left_justify. { fstr = "flag_left_justify"; } - flag_left_zero_pad. { fstr = "flag_left_zero_pad"; } - flag_space_for_sign. { fstr = "flag_space_for_sign"; } - flag_sign_always. { fstr = "flag_sign_always"; } - flag_alternate. { fstr = "flag_alternate"; } + flag_left_justify. { fstr = ~"flag_left_justify"; } + flag_left_zero_pad. { fstr = ~"flag_left_zero_pad"; } + flag_space_for_sign. { fstr = ~"flag_space_for_sign"; } + flag_sign_always. { fstr = ~"flag_sign_always"; } + flag_alternate. { fstr = ~"flag_alternate"; } } flagexprs += [make_rt_path_expr(cx, sp, fstr)]; } @@ -135,14 +136,14 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], // this is a hack placeholder flag if vec::len::<@ast::expr>(flagexprs) == 0u { - flagexprs += [make_rt_path_expr(cx, sp, "flag_none")]; + flagexprs += [make_rt_path_expr(cx, sp, ~"flag_none")]; } ret make_vec_expr(cx, sp, flagexprs); } fn make_count(cx: &ext_ctxt, sp: span, cnt: &count) -> @ast::expr { alt cnt { count_implied. { - ret make_rt_path_expr(cx, sp, "count_implied"); + ret make_rt_path_expr(cx, sp, ~"count_implied"); } count_is(c) { let count_lit = make_new_int(cx, sp, c); @@ -158,13 +159,13 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], alt t { ty_hex(c) { alt c { - case_upper. { rt_type = "ty_hex_upper"; } - case_lower. { rt_type = "ty_hex_lower"; } + case_upper. { rt_type = ~"ty_hex_upper"; } + case_lower. { rt_type = ~"ty_hex_lower"; } } } - ty_bits. { rt_type = "ty_bits"; } - ty_octal. { rt_type = "ty_octal"; } - _ { rt_type = "ty_default"; } + ty_bits. { rt_type = ~"ty_bits"; } + ty_octal. { rt_type = ~"ty_octal"; } + _ { rt_type = ~"ty_default"; } } ret make_rt_path_expr(cx, sp, rt_type); } @@ -184,9 +185,9 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], ret make_conv_rec(cx, sp, rt_conv_flags, rt_conv_width, rt_conv_precision, rt_conv_ty); } - fn make_conv_call(cx: &ext_ctxt, sp: span, conv_type: str, cnv: &conv, - arg: @ast::expr) -> @ast::expr { - let fname = ~"conv_" + istr::from_estr(conv_type); + fn make_conv_call(cx: &ext_ctxt, sp: span, conv_type: &istr, + cnv: &conv, arg: @ast::expr) -> @ast::expr { + let fname = ~"conv_" + conv_type; let path = make_path_vec(cx, fname); let cnv_expr = make_rt_conv_expr(cx, sp, cnv); let args = [cnv_expr, arg]; @@ -241,21 +242,21 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], _ { cx.span_unimpl(sp, unsupported); } } alt cnv.ty { - ty_str. { ret make_conv_call(cx, arg.span, "str", cnv, arg); } - ty_istr. { ret make_conv_call(cx, arg.span, "istr", cnv, arg); } + ty_str. { ret make_conv_call(cx, arg.span, ~"str", cnv, arg); } + ty_istr. { ret make_conv_call(cx, arg.span, ~"istr", cnv, arg); } ty_int(sign) { alt sign { - signed. { ret make_conv_call(cx, arg.span, "int", cnv, arg); } + signed. { ret make_conv_call(cx, arg.span, ~"int", cnv, arg); } unsigned. { - ret make_conv_call(cx, arg.span, "uint", cnv, arg); + ret make_conv_call(cx, arg.span, ~"uint", cnv, arg); } } } - ty_bool. { ret make_conv_call(cx, arg.span, "bool", cnv, arg); } - ty_char. { ret make_conv_call(cx, arg.span, "char", cnv, arg); } - ty_hex(_) { ret make_conv_call(cx, arg.span, "uint", cnv, arg); } - ty_bits. { ret make_conv_call(cx, arg.span, "uint", cnv, arg); } - ty_octal. { ret make_conv_call(cx, arg.span, "uint", cnv, arg); } + ty_bool. { ret make_conv_call(cx, arg.span, ~"bool", cnv, arg); } + ty_char. { ret make_conv_call(cx, arg.span, ~"char", cnv, arg); } + ty_hex(_) { ret make_conv_call(cx, arg.span, ~"uint", cnv, arg); } + ty_bits. { ret make_conv_call(cx, arg.span, ~"uint", cnv, arg); } + ty_octal. { ret make_conv_call(cx, arg.span, ~"uint", cnv, arg); } _ { cx.span_unimpl(sp, unsupported); } } } @@ -319,12 +320,12 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], } let fmt_sp = args[0].span; let n = 0u; - let tmp_expr = make_new_str(cx, sp, ""); + let tmp_expr = make_new_str(cx, sp, ~""); let nargs = vec::len::<@ast::expr>(args); for pc: piece in pieces { alt pc { piece_string(s) { - let s_expr = make_new_str(cx, fmt_sp, s); + let s_expr = make_new_str(cx, fmt_sp, istr::from_estr(s)); tmp_expr = make_add_expr(cx, fmt_sp, tmp_expr, s_expr); } piece_conv(conv) { diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index 247b5aee150f..ccd792d78f57 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -57,8 +57,7 @@ tag matchable { } /* for when given an incompatible bit of AST */ -fn match_error(cx: &ext_ctxt, m: &matchable, expected: &str) -> ! { - let expected = istr::from_estr(expected); +fn match_error(cx: &ext_ctxt, m: &matchable, expected: &istr) -> ! { alt m { match_expr(x) { cx.span_fatal(x.span, @@ -355,7 +354,7 @@ fn transcribe_ident(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], i: &ident, _fld: ast_fold) -> ident { ret alt follow_for_trans(cx, b.find(i), idx_path) { some(match_ident(a_id)) { a_id.node } - some(m) { match_error(cx, m, "an identifier") } + some(m) { match_error(cx, m, ~"an identifier") } none. { i } } } @@ -370,7 +369,7 @@ fn transcribe_path(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], {global: false, idents: [id.node], types: []} } some(match_path(a_pth)) { a_pth.node } - some(m) { match_error(cx, m, "a path") } + some(m) { match_error(cx, m, ~"a path") } none. { p } } } @@ -395,7 +394,7 @@ fn transcribe_expr(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], } some(match_path(a_pth)) { expr_path(a_pth) } some(match_expr(a_exp)) { a_exp.node } - some(m) { match_error(cx, m, "an expression") } + some(m) { match_error(cx, m, ~"an expression") } none. { orig(e, fld) } } } @@ -412,7 +411,7 @@ fn transcribe_type(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], some(id) { alt follow_for_trans(cx, b.find(id), idx_path) { some(match_ty(ty)) { ty.node } - some(m) { match_error(cx, m, "a type") } + some(m) { match_error(cx, m, ~"a type") } none. { orig(t, fld) } } } @@ -439,7 +438,7 @@ fn transcribe_block(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], // possibly allow promotion of ident/path/expr to blocks? some(m) { - match_error(cx, m, "a block") + match_error(cx, m, ~"a block") } none. { orig(blk, fld) } } @@ -564,13 +563,13 @@ fn p_t_s_r_mac(cx: &ext_ctxt, mac: &ast::mac, s: &selector, b: &binders) { _ { cx.bug(~"broken traversal in p_t_s_r") } } } - fn no_des(cx: &ext_ctxt, sp: &span, syn: &str) -> ! { + fn no_des(cx: &ext_ctxt, sp: &span, syn: &istr) -> ! { cx.span_fatal(sp, ~"destructuring " - + istr::from_estr(syn) + ~" is not yet supported"); + + syn + ~" is not yet supported"); } alt mac.node { ast::mac_ellipsis. { cx.span_fatal(mac.span, ~"misused `...`"); } - ast::mac_invoc(_, _, _) { no_des(cx, mac.span, "macro calls"); } + ast::mac_invoc(_, _, _) { no_des(cx, mac.span, ~"macro calls"); } ast::mac_embed_type(ty) { alt ty.node { ast::ty_path(pth, _) { @@ -587,10 +586,10 @@ fn p_t_s_r_mac(cx: &ext_ctxt, mac: &ast::mac, s: &selector, b: &binders) { b.real_binders.insert( id, compose_sels(s, final_step)); } - none. { no_des(cx, pth.span, "under `#<>`"); } + none. { no_des(cx, pth.span, ~"under `#<>`"); } } } - _ { no_des(cx, ty.span, "under `#<>`"); } + _ { no_des(cx, ty.span, ~"under `#<>`"); } } } ast::mac_embed_block(blk) { @@ -608,7 +607,7 @@ fn p_t_s_r_mac(cx: &ext_ctxt, mac: &ast::mac, s: &selector, b: &binders) { b.real_binders.insert(id, compose_sels(s, final_step)); } - none. { no_des(cx, blk.span, "under `#{}`"); } + none. { no_des(cx, blk.span, ~"under `#{}`"); } } } } diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs index 4ef7cfc60a88..667a0f27fb8b 100644 --- a/src/comp/util/ppaux.rs +++ b/src/comp/util/ppaux.rs @@ -102,7 +102,7 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> istr { } alt cname(cx, typ) { some(cs) { - ret istr::from_estr(cs); + ret cs; } _ { } }