diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-09-01 22:08:59 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-09-01 23:25:33 -0700 |
| commit | 9c173f17c0fb10a3923da890c1204e0a71d3c9c7 (patch) | |
| tree | be9eb6a7f717bd898bd5006dfebb1f0e92583b9b /src/comp | |
| parent | 1d3eb4911a227500c51858cdb830fe27cb5b9ca7 (diff) | |
| download | rust-9c173f17c0fb10a3923da890c1204e0a71d3c9c7.tar.gz rust-9c173f17c0fb10a3923da890c1204e0a71d3c9c7.zip | |
Remove lots of estr code from rustc. Issue #855
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/front/attr.rs | 4 | ||||
| -rw-r--r-- | src/comp/front/test.rs | 2 | ||||
| -rw-r--r-- | src/comp/metadata/encoder.rs | 2 | ||||
| -rw-r--r-- | src/comp/metadata/tydecode.rs | 1 | ||||
| -rw-r--r-- | src/comp/metadata/tyencode.rs | 1 | ||||
| -rw-r--r-- | src/comp/middle/alias.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/gc.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/shape.rs | 3 | ||||
| -rw-r--r-- | src/comp/middle/trans.rs | 56 | ||||
| -rw-r--r-- | src/comp/middle/trans_alt.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/ty.rs | 37 | ||||
| -rw-r--r-- | src/comp/middle/typeck.rs | 18 | ||||
| -rw-r--r-- | src/comp/syntax/ast.rs | 6 | ||||
| -rw-r--r-- | src/comp/syntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/env.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/fmt.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/ident_to_str.rs | 3 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 8 | ||||
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 3 | ||||
| -rw-r--r-- | src/comp/syntax/visit.rs | 1 | ||||
| -rw-r--r-- | src/comp/util/common.rs | 4 | ||||
| -rw-r--r-- | src/comp/util/ppaux.rs | 1 |
22 files changed, 32 insertions, 130 deletions
diff --git a/src/comp/front/attr.rs b/src/comp/front/attr.rs index ae104e62fa3..731e05125da 100644 --- a/src/comp/front/attr.rs +++ b/src/comp/front/attr.rs @@ -84,7 +84,7 @@ fn get_meta_item_value_str(meta: &@ast::meta_item) -> option::t<istr> { alt meta.node { ast::meta_name_value(_, v) { alt v.node { - ast::lit_str(s, _) { option::some(s) } + ast::lit_str(s) { option::some(s) } _ { option::none } } } @@ -196,7 +196,7 @@ fn span<@T>(item: &T) -> ast::spanned<T> { fn mk_name_value_item_str(name: ast::ident, value: &istr) -> @ast::meta_item { - let value_lit = span(ast::lit_str(value, ast::sk_unique)); + let value_lit = span(ast::lit_str(value)); ret mk_name_value_item(name, value_lit); } diff --git a/src/comp/front/test.rs b/src/comp/front/test.rs index 5103ffab827..ae2a663c3db 100644 --- a/src/comp/front/test.rs +++ b/src/comp/front/test.rs @@ -253,7 +253,7 @@ fn mk_test_desc_rec(cx: &test_ctxt, test: test) -> @ast::expr { ast_util::path_name_i(path)]; let name_lit: ast::lit = - nospan(ast::lit_str(ast_util::path_name_i(path), ast::sk_unique)); + nospan(ast::lit_str(ast_util::path_name_i(path))); let name_expr: ast::expr = {id: cx.next_node_id(), node: ast::expr_lit(@name_lit), diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs index 7ed760c32dc..e1a9e54a6c5 100644 --- a/src/comp/metadata/encoder.rs +++ b/src/comp/metadata/encoder.rs @@ -460,7 +460,7 @@ fn encode_meta_item(ebml_w: &ebml::writer, mi: &meta_item) { } meta_name_value(name, value) { alt value.node { - lit_str(value, _) { + 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(str::bytes(name)); diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs index 23ba2fa01a6..c72bc020288 100644 --- a/src/comp/metadata/tydecode.rs +++ b/src/comp/metadata/tydecode.rs @@ -193,7 +193,6 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t { } } 'c' { ret ty::mk_char(st.tcx); } - 's' { ret ty::mk_str(st.tcx); } 'S' { ret ty::mk_istr(st.tcx); } 't' { assert (next(st) as char == '['); diff --git a/src/comp/metadata/tyencode.rs b/src/comp/metadata/tyencode.rs index c76cd75a285..46015f72cf8 100644 --- a/src/comp/metadata/tyencode.rs +++ b/src/comp/metadata/tyencode.rs @@ -113,7 +113,6 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) { } } ty::ty_char. { w.write_char('c'); } - ty::ty_str. { w.write_char('s'); } ty::ty_istr. { w.write_char('S'); } ty::ty_tag(def, tys) { w.write_str(~"t["); diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs index 7b255ab1fc6..e957bb7163d 100644 --- a/src/comp/middle/alias.rs +++ b/src/comp/middle/alias.rs @@ -282,7 +282,7 @@ fn check_for(cx: &ctx, local: &@ast::local, seq: &@ast::expr, blk: &ast::blk, let seq_t = ty::expr_ty(cx.tcx, seq); alt ty::struct(cx.tcx, seq_t) { ty::ty_vec(mt) { if mt.mut != ast::imm { unsafe = some(seq_t); } } - ty::ty_str. | ty::ty_istr. {/* no-op */ } + ty::ty_istr. {/* no-op */ } _ { cx.tcx.sess.span_unimpl(seq.span, ~"unknown seq type " + util::ppaux::ty_to_str(cx.tcx, seq_t)); diff --git a/src/comp/middle/gc.rs b/src/comp/middle/gc.rs index d9858057970..f0e366f0e9e 100644 --- a/src/comp/middle/gc.rs +++ b/src/comp/middle/gc.rs @@ -137,7 +137,7 @@ fn type_is_gc_relevant(cx: &ty::ctxt, ty: ty::t) -> bool { ty::ty_constr(sub, _) { ret type_is_gc_relevant(cx, sub); } - ty::ty_str. | ty::ty_box(_) | ty::ty_uniq(_) | ty::ty_fn(_, _, _, _, _) + ty::ty_box(_) | ty::ty_uniq(_) | ty::ty_fn(_, _, _, _, _) | ty::ty_native_fn(_, _, _) | ty::ty_obj(_) | ty::ty_param(_, _) | ty::ty_res(_, _, _) { ret true; diff --git a/src/comp/middle/shape.rs b/src/comp/middle/shape.rs index 181eaa0251a..0a6364f4bda 100644 --- a/src/comp/middle/shape.rs +++ b/src/comp/middle/shape.rs @@ -305,9 +305,6 @@ fn shape_of(ccx: &@crate_ctxt, t: ty::t) -> [u8] { ty::ty_machine(ast::ty_i64.) { s += [shape_i64]; } - ty::ty_str. { - s += [shape_evec, 1u8, 1u8, 0u8, shape_u8]; - } ty::ty_istr. { s += [shape_ivec]; add_bool(s, true); // type is POD diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index f756cbd3201..6d69a8c8c40 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -202,7 +202,6 @@ fn type_of_inner(cx: &@crate_ctxt, sp: &span, t: ty::t) -> TypeRef { } } ty::ty_char. { llty = T_char(); } - ty::ty_str. { llty = T_ptr(T_str()); } ty::ty_istr. { llty = T_ptr(T_ivec(T_i8())); } ty::ty_tag(did, _) { llty = type_of_tag(cx, sp, did, t); } ty::ty_box(mt) { llty = T_ptr(T_box(type_of_inner(cx, sp, mt.ty))); } @@ -1334,12 +1333,6 @@ fn incr_refcnt_of_boxed(cx: &@block_ctxt, box_ptr: ValueRef) -> @block_ctxt { fn make_free_glue(bcx: &@block_ctxt, v0: ValueRef, t: ty::t) { // NB: v is an *alias* of type t here, not a direct value. let bcx = alt ty::struct(bcx_tcx(bcx), t) { - ty::ty_str. { - let v = Load(bcx, v0); - if !bcx_ccx(bcx).sess.get_opts().do_gc { - trans_non_gc_free(bcx, v) - } else { bcx } - } ty::ty_box(body_mt) { let v = Load(bcx, v0); let body = GEP(bcx, v, [C_int(0), C_int(abi::box_rc_field_body)]); @@ -1397,7 +1390,6 @@ fn make_drop_glue(bcx: &@block_ctxt, v0: ValueRef, t: ty::t) { // NB: v0 is an *alias* of type t here, not a direct value. let ccx = bcx_ccx(bcx); let bcx = alt ty::struct(ccx.tcx, t) { - ty::ty_str. { decr_refcnt_maybe_free(bcx, v0, v0, t) } ty::ty_vec(_) { ivec::make_drop_glue(bcx, v0, t) } ty::ty_istr. { ivec::make_drop_glue(bcx, v0, t) } ty::ty_box(_) { decr_refcnt_maybe_free(bcx, v0, v0, t) } @@ -1843,10 +1835,6 @@ fn iter_sequence(cx: @block_ctxt, v: ValueRef, t: ty::t, f: &val_and_ty_fn) alt ty::struct(bcx_tcx(cx), t) { - ty::ty_str. { - let et = ty::mk_mach(bcx_tcx(cx), ast::ty_u8); - ret iter_sequence_body(cx, v, et, f, true, false); - } ty::ty_vec(elt) { ret iter_sequence_body(cx, v, elt.ty, f, false, true); } @@ -2263,8 +2251,7 @@ fn trans_crate_lit(cx: &@crate_ctxt, lit: &ast::lit) -> ValueRef { ast::lit_char(c) { ret C_integral(T_char(), c as uint, False); } ast::lit_bool(b) { ret C_bool(b); } ast::lit_nil. { ret C_nil(); } - ast::lit_str(s, ast::sk_rc.) { ret C_str(cx, s); } - ast::lit_str(s, ast::sk_unique.) { + ast::lit_str(s) { cx.sess.span_unimpl(lit.span, ~"unique string in this context"); } } @@ -2272,7 +2259,7 @@ fn trans_crate_lit(cx: &@crate_ctxt, lit: &ast::lit) -> ValueRef { fn trans_lit(cx: &@block_ctxt, lit: &ast::lit) -> result { alt lit.node { - ast::lit_str(s, ast::sk_unique.) { ret ivec::trans_istr(cx, s); } + ast::lit_str(s) { ret ivec::trans_istr(cx, s); } _ { ret rslt(cx, trans_crate_lit(bcx_ccx(cx), lit)); } } } @@ -2351,10 +2338,6 @@ fn trans_evec_append(cx: &@block_ctxt, t: ty::t, lhs: ValueRef, rhs: ValueRef) -> result { let elt_ty = ty::sequence_element_type(bcx_tcx(cx), t); let skip_null = C_bool(false); - alt ty::struct(bcx_tcx(cx), t) { - ty::ty_str. { skip_null = C_bool(true); } - _ { } - } let bcx = cx; let ti = none::<@tydesc_info>; let llvec_tydesc = get_tydesc(bcx, t, false, tps_normal, ti).result; @@ -5529,45 +5512,20 @@ fn create_main_wrapper(ccx: &@crate_ctxt, sp: &span, main_llfn: ValueRef, ccx.sess.span_fatal(sp, ~"multiple 'main' functions"); } - let (main_takes_argv, main_takes_istr) = + let main_takes_argv = alt ty::struct(ccx.tcx, main_node_type) { ty::ty_fn(_, args, _, _, _) { - if std::vec::len(args) == 0u { - (false, false) - } else { - alt ty::struct(ccx.tcx, args[0].ty) { - ty::ty_vec({ty: t, _}) { - alt ty::struct(ccx.tcx, t) { - ty::ty_str. { (true, false) } - ty::ty_istr. { (true, true) } - } - } - } - } + std::vec::len(args) != 0u } }; let llfn = create_main(ccx, sp, main_llfn, - main_takes_argv, main_takes_istr); + main_takes_argv); ccx.main_fn = some(llfn); - // FIXME: This is a transitional way to let the runtime know - // it needs to feed us istrs - 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)); - llvm::LLVMSetGlobalConstant(lltakesistr, True); - llvm::LLVMSetLinkage(lltakesistr, - lib::llvm::LLVMExternalLinkage as llvm::Linkage); - fn create_main(ccx: &@crate_ctxt, sp: &span, main_llfn: ValueRef, - takes_argv: bool, takes_istr: bool) -> ValueRef { - let unit_ty = if takes_istr { - ty::mk_istr(ccx.tcx) - } else { - ty::mk_str(ccx.tcx) - }; + takes_argv: bool) -> ValueRef { + let unit_ty = ty::mk_istr(ccx.tcx); let ivecarg_ty: ty::arg = {mode: ty::mo_val, ty: diff --git a/src/comp/middle/trans_alt.rs b/src/comp/middle/trans_alt.rs index 9157ea579ad..535082131da 100644 --- a/src/comp/middle/trans_alt.rs +++ b/src/comp/middle/trans_alt.rs @@ -408,7 +408,7 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef], } lit(l) { test_val = Load(bcx, val); - kind = alt l.node { ast::lit_str(_, _) { compare } _ { switch } }; + kind = alt l.node { ast::lit_str(_) { compare } _ { switch } }; } } } diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 0815a862b8c..3c7e7de91f8 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -78,7 +78,6 @@ export mk_res; export mk_param; export mk_ptr; export mk_rec; -export mk_str; export mk_tag; export mk_tup; export mk_type; @@ -133,7 +132,6 @@ export ty_res; export ty_param; export ty_ptr; export ty_rec; -export ty_str; export ty_tag; export ty_tup; export ty_type; @@ -252,7 +250,6 @@ tag sty { ty_uint; ty_machine(ast::ty_mach); ty_char; - ty_str; ty_istr; ty_tag(def_id, [t]); ty_box(mt); @@ -335,15 +332,13 @@ const idx_f64: uint = 14u; const idx_char: uint = 15u; -const idx_str: uint = 16u; +const idx_istr: uint = 16u; -const idx_istr: uint = 17u; +const idx_type: uint = 17u; -const idx_type: uint = 18u; +const idx_bot: uint = 18u; -const idx_bot: uint = 19u; - -const idx_first_others: uint = 20u; +const idx_first_others: uint = 19u; type type_store = interner::interner<@raw_t>; @@ -369,7 +364,6 @@ fn populate_type_store(cx: &ctxt) { intern(cx, ty_machine(ast::ty_f32), none); intern(cx, ty_machine(ast::ty_f64), none); intern(cx, ty_char, none); - intern(cx, ty_str, none); intern(cx, ty_istr, none); intern(cx, ty_type, none); intern(cx, ty_bot, none); @@ -449,7 +443,6 @@ fn mk_raw_ty(cx: &ctxt, st: &sty, _in_cname: &option::t<istr>) -> @raw_t { ty_uint. {/* no-op */ } ty_machine(_) {/* no-op */ } ty_char. {/* no-op */ } - ty_str. {/* no-op */ } ty_istr. {/* no-op */ } ty_type. {/* no-op */ } ty_native(_) {/* no-op */ } @@ -537,8 +530,6 @@ fn mk_mach(_cx: &ctxt, tm: &ast::ty_mach) -> t { fn mk_char(_cx: &ctxt) -> t { ret idx_char; } -fn mk_str(_cx: &ctxt) -> t { ret idx_str; } - fn mk_istr(_cx: &ctxt) -> t { ret idx_istr; } fn mk_tag(cx: &ctxt, did: &ast::def_id, tys: &[t]) -> t { @@ -624,7 +615,6 @@ fn walk_ty(cx: &ctxt, walker: ty_walk, ty: t) { ty_float. {/* no-op */ } ty_machine(_) {/* no-op */ } ty_char. {/* no-op */ } - ty_str. {/* no-op */ } ty_istr. {/* no-op */ } ty_type. {/* no-op */ } ty_native(_) {/* no-op */ } @@ -688,7 +678,6 @@ fn fold_ty(cx: &ctxt, fld: fold_mode, ty_0: t) -> t { ty_float. {/* no-op */ } ty_machine(_) {/* no-op */ } ty_char. {/* no-op */ } - ty_str. {/* no-op */ } ty_istr. {/* no-op */ } ty_type. {/* no-op */ } ty_native(_) {/* no-op */ } @@ -831,7 +820,6 @@ fn type_is_copyable(cx: &ctxt, ty: t) -> bool { fn type_is_sequence(cx: &ctxt, ty: t) -> bool { alt struct(cx, ty) { - ty_str. { ret true; } ty_istr. { ret true; } ty_vec(_) { ret true; } _ { ret false; } @@ -840,7 +828,6 @@ fn type_is_sequence(cx: &ctxt, ty: t) -> bool { fn type_is_str(cx: &ctxt, ty: t) -> bool { alt struct(cx, ty) { - ty_str. { ret true; } ty_istr. { ret true; } _ { ret false; } } @@ -848,9 +835,6 @@ fn type_is_str(cx: &ctxt, ty: t) -> bool { fn sequence_is_interior(cx: &ctxt, ty: t) -> bool { alt struct(cx, ty) { - ty::ty_str. { - ret false; - } ty::ty_vec(_) { ret true; } ty::ty_istr. { ret true; } _ { cx.sess.bug(~"sequence_is_interior called on non-sequence type"); } @@ -859,7 +843,6 @@ fn sequence_is_interior(cx: &ctxt, ty: t) -> bool { fn sequence_element_type(cx: &ctxt, ty: t) -> t { alt struct(cx, ty) { - ty_str. { ret mk_mach(cx, ast::ty_u8); } ty_istr. { ret mk_mach(cx, ast::ty_u8); } ty_vec(mt) { ret mt.ty; } _ { cx.sess.bug( @@ -898,7 +881,6 @@ fn type_is_box(cx: &ctxt, ty: t) -> bool { fn type_is_boxed(cx: &ctxt, ty: t) -> bool { alt struct(cx, ty) { - ty_str. { ret true; } ty_box(_) { ret true; } _ { ret false; } } @@ -1020,12 +1002,6 @@ fn type_kind(cx: &ctxt, ty: t) -> ast::kind { } - // Those things with refcounts-to-interior are just shared. - ty_str. { - result = kind_shared; - } - - // FIXME: obj is broken for now, since we aren't asserting // anything about its fields. ty_obj(_) { @@ -1240,7 +1216,7 @@ fn type_is_pod(cx: &ctxt, ty: t) -> bool { // Boxed types - ty_str. | ty_istr. | ty_box(_) | ty_vec(_) | ty_fn(_, _, _, _, _) | + ty_istr. | ty_box(_) | ty_vec(_) | ty_fn(_, _, _, _, _) | ty_native_fn(_, _, _) | ty_obj(_) { result = false; } @@ -1392,7 +1368,6 @@ fn hash_type_structure(st: &sty) -> uint { } } ty_char. { ret 15u; } - ty_str. { ret 16u; } ty_istr. { ret 17u; } ty_tag(did, tys) { let h = hash_def(18u, did); @@ -2151,7 +2126,6 @@ mod unify { ty::ty_machine(_) { ret struct_cmp(cx, expected, actual); } ty::ty_float. { ret struct_cmp(cx, expected, actual); } ty::ty_char. { ret struct_cmp(cx, expected, actual); } - ty::ty_str. { ret struct_cmp(cx, expected, actual); } ty::ty_istr. { ret struct_cmp(cx, expected, actual); } ty::ty_type. { ret struct_cmp(cx, expected, actual); } ty::ty_native(ex_id) { @@ -2759,7 +2733,6 @@ fn is_binopable(cx: &ctxt, ty: t, op: ast::binop) -> bool { ty_machine(ast::ty_f64.) { tycat_float } ty_char. { tycat_int } ty_ptr(_) { tycat_int } - ty_str. { tycat_str } ty_istr. { tycat_str } ty_vec(_) { tycat_vec } ty_rec(_) { tycat_struct } diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 2357ab1e420..daa6e5f368d 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -326,7 +326,6 @@ fn ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) -> ast::ty_float. { typ = ty::mk_float(tcx); } ast::ty_machine(tm) { typ = ty::mk_mach(tcx, tm); } ast::ty_char. { typ = ty::mk_char(tcx); } - ast::ty_str. { typ = ty::mk_str(tcx); } ast::ty_istr. { typ = ty::mk_istr(tcx); } ast::ty_box(mt) { typ = ty::mk_box(tcx, ast_mt_to_mt(tcx, getter, mt)); @@ -1308,8 +1307,7 @@ fn gather_locals(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id, // AST fragment checking fn check_lit(ccx: @crate_ctxt, lit: &@ast::lit) -> ty::t { alt lit.node { - ast::lit_str(_, ast::sk_rc.) { ret ty::mk_str(ccx.tcx); } - ast::lit_str(_, ast::sk_unique.) { ret ty::mk_istr(ccx.tcx); } + ast::lit_str(_) { ret ty::mk_istr(ccx.tcx); } ast::lit_char(_) { ret ty::mk_char(ccx.tcx); } ast::lit_int(_) { ret ty::mk_int(ccx.tcx); } ast::lit_float(_) { ret ty::mk_float(ccx.tcx); } @@ -1869,13 +1867,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier, alt expr_opt { none. {/* do nothing */ } some(e) { - // FIXME: istr transitional. Should be: - // check_expr_with(fcx, e, ty::mk_str(tcx)); - check_expr(fcx, e); - if !are_compatible(fcx, expr_ty(tcx, e), ty::mk_str(tcx)) - && !are_compatible(fcx, expr_ty(tcx, e), ty::mk_istr(tcx)) { - check_expr_with(fcx, e, ty::mk_str(tcx)); - } + check_expr_with(fcx, e, ty::mk_istr(tcx)); } } write::bot_ty(tcx, id); @@ -1974,7 +1966,6 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier, let elt_ty; let ety = expr_ty(tcx, seq); alt structure_of(fcx, expr.span, ety) { - ty::ty_str. { elt_ty = ty::mk_mach(tcx, ast::ty_u8); } ty::ty_vec(vec_elt_ty) { elt_ty = vec_elt_ty.ty; } ty::ty_istr. { elt_ty = ty::mk_mach(tcx, ast::ty_u8); } _ { @@ -2294,10 +2285,6 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier, } alt structure_of(fcx, expr.span, base_t) { ty::ty_vec(mt) { write::ty_only_fixup(fcx, id, mt.ty); } - ty::ty_str. { - let typ = ty::mk_mach(tcx, ast::ty_u8); - write::ty_only_fixup(fcx, id, typ); - } ty::ty_istr. { let typ = ty::mk_mach(tcx, ast::ty_u8); write::ty_only_fixup(fcx, id, typ); @@ -2755,7 +2742,6 @@ fn arg_is_argv_ty(tcx: &ty::ctxt, a: &ty::arg) -> bool { ty::ty_vec(mt) { if mt.mut != ast::imm { ret false; } alt ty::struct(tcx, mt.ty) { - ty::ty_str. { ret true; } ty::ty_istr. { ret true; } _ { ret false; } } diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index f6a34e5c544..7e1a7942f75 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -160,9 +160,6 @@ type field = spanned<field_>; tag check_mode { checked; unchecked; } -// FIXME: temporary -tag seq_kind { sk_unique; sk_rc; } - type expr = {id: node_id, node: expr_, span: span}; tag expr_ { @@ -241,7 +238,7 @@ tag mac_ { type lit = spanned<lit_>; tag lit_ { - lit_str(istr, seq_kind); + lit_str(istr); lit_char(char); lit_int(int); lit_uint(uint); @@ -304,7 +301,6 @@ tag ty_ { ty_float; ty_machine(ty_mach); ty_char; - ty_str; ty_istr; // interior string ty_box(mt); ty_vec(mt); // interior vector diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs index 274cb2dbd40..2dcc43ef178 100644 --- a/src/comp/syntax/ext/base.rs +++ b/src/comp/syntax/ext/base.rs @@ -104,7 +104,7 @@ fn expr_to_str(cx: &ext_ctxt, expr: @ast::expr, error: &istr) -> istr { alt expr.node { ast::expr_lit(l) { alt l.node { - ast::lit_str(s, _) { ret s; } + ast::lit_str(s) { ret s; } _ { cx.span_fatal(l.span, error); } } } diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs index ed493137369..487b12d0bc2 100644 --- a/src/comp/syntax/ext/env.rs +++ b/src/comp/syntax/ext/env.rs @@ -36,7 +36,7 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr, } 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_unique)); + ret make_new_lit(cx, sp, ast::lit_str(s)); } // // Local Variables: diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs index abc73dc7c41..91a83b06267 100644 --- a/src/comp/syntax/ext/fmt.rs +++ b/src/comp/syntax/ext/fmt.rs @@ -53,7 +53,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], ret @{id: cx.next_id(), node: ast::expr_lit(sp_lit), span: sp}; } fn make_new_str(cx: &ext_ctxt, sp: span, s: &istr) -> @ast::expr { - let lit = ast::lit_str(s, ast::sk_unique); + let lit = ast::lit_str(s); ret make_new_lit(cx, sp, lit); } fn make_new_int(cx: &ext_ctxt, sp: span, i: int) -> @ast::expr { diff --git a/src/comp/syntax/ext/ident_to_str.rs b/src/comp/syntax/ext/ident_to_str.rs index d989151831e..f30d6932555 100644 --- a/src/comp/syntax/ext/ident_to_str.rs +++ b/src/comp/syntax/ext/ident_to_str.rs @@ -19,7 +19,6 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr, ret make_new_lit(cx, sp, ast::lit_str(expr_to_ident(cx, args[0u], - ~"expected an ident"), - ast::sk_unique)); + ~"expected an ident"))); } diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 763172c81fa..7be1d78d730 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -708,7 +708,7 @@ fn parse_lit(p: &parser) -> ast::lit { token::LIT_CHAR(c) { p.bump(); lit = ast::lit_char(c); } token::LIT_STR(s) { p.bump(); - lit = ast::lit_str(p.get_str(s), ast::sk_unique); + lit = ast::lit_str(p.get_str(s)); } token::LPAREN. { p.bump(); @@ -895,8 +895,7 @@ fn parse_bottom_expr(p: &parser) -> @ast::expr { let sp = p.get_span(); p.bump(); let lit = - @{node: ast::lit_str(p.get_str(s), - ast::sk_unique), + @{node: ast::lit_str(p.get_str(s)), span: sp}; ex = ast::expr_lit(lit); } @@ -1503,8 +1502,7 @@ fn parse_pat(p: &parser) -> @ast::pat { let sp = p.get_span(); p.bump(); let lit = - @{node: ast::lit_str(p.get_str(s), - ast::sk_unique), + @{node: ast::lit_str(p.get_str(s)), span: sp}; hi = lit.span.hi; pat = ast::pat_lit(lit); diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index a78006417a4..257404e7f65 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -278,7 +278,6 @@ fn print_type(s: &ps, ty: &@ast::ty) { word(s.s, ast_util::ty_mach_to_str(tm)); } ast::ty_char. { word(s.s, ~"char"); } - ast::ty_str. { word(s.s, ~"str"); } ast::ty_istr. { word(s.s, ~"str"); } ast::ty_box(mt) { word(s.s, ~"@"); print_mt(s, mt); } ast::ty_vec(mt) { @@ -1505,7 +1504,7 @@ fn print_literal(s: &ps, lit: &@ast::lit) { _ { } } alt lit.node { - ast::lit_str(st, kind) { + ast::lit_str(st) { print_string(s, st); } ast::lit_char(ch) { diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs index c51e7b3192d..7cd281afdca 100644 --- a/src/comp/syntax/visit.rs +++ b/src/comp/syntax/visit.rs @@ -120,7 +120,6 @@ fn visit_ty<E>(t: &@ty, e: &E, v: &vt<E>) { ty_uint. {/* no-op */ } ty_machine(_) {/* no-op */ } ty_char. {/* no-op */ } - ty_str. {/* no-op */ } ty_istr. {/* no-op */ } ty_box(mt) { v.visit_ty(mt.ty, e, v); } ty_vec(mt) { v.visit_ty(mt.ty, e, v); } diff --git a/src/comp/util/common.rs b/src/comp/util/common.rs index 89d52834b99..822cdbe0533 100644 --- a/src/comp/util/common.rs +++ b/src/comp/util/common.rs @@ -103,9 +103,9 @@ fn local_rhs_span(l: &@ast::local, def: &span) -> span { fn lit_eq(l: &@ast::lit, m: &@ast::lit) -> bool { alt l.node { - ast::lit_str(s, kind_s) { + ast::lit_str(s) { alt m.node { - ast::lit_str(t, kind_t) { ret s == t && kind_s == kind_t; } + ast::lit_str(t) { ret s == t } _ { ret false; } } } diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs index 8fec8e54727..f227836f492 100644 --- a/src/comp/util/ppaux.rs +++ b/src/comp/util/ppaux.rs @@ -119,7 +119,6 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> istr { ty_uint. { ~"uint" } ty_machine(tm) { ty_mach_to_str(tm) } ty_char. { ~"char" } - ty_str. { ~"str" } ty_istr. { ~"istr" } ty_box(tm) { ~"@" + mt_to_str(cx, tm) } ty_uniq(t) { ~"~" + ty_to_str(cx, t) } |
