Support prefix notation for vstore strings. Closes #2906.
This commit is contained in:
parent
e4de160222
commit
985b52be6d
46 changed files with 252 additions and 237 deletions
|
|
@ -67,8 +67,8 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: ~[@pat]) {
|
|||
alt ty::get(ty).struct {
|
||||
ty::ty_bool {
|
||||
alt check ctor {
|
||||
val(const_int(1i64)) { some(@"true") }
|
||||
val(const_int(0i64)) { some(@"false") }
|
||||
val(const_int(1i64)) { some(@"true"/~) }
|
||||
val(const_int(0i64)) { some(@"false"/~) }
|
||||
}
|
||||
}
|
||||
ty::ty_enum(id, _) {
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ fn check_item_old_vecs(cx: ty::ctxt, it: @ast::item) {
|
|||
}
|
||||
ast::ty_path(@{span: _, global: _, idents: ids,
|
||||
rp: none, types: _}, _)
|
||||
if ids == ~[@"str"] && (! uses_vstore.contains_key(t.id)) {
|
||||
if ids == ~[@"str"/~] && (! uses_vstore.contains_key(t.id)) {
|
||||
cx.sess.span_lint(
|
||||
old_strs, t.id, it.id,
|
||||
t.span, "deprecated str type");
|
||||
|
|
|
|||
|
|
@ -290,8 +290,8 @@ class ir_maps {
|
|||
alt self.var_kinds[*var] {
|
||||
vk_local(_, name) | vk_arg(_, name, _) {name}
|
||||
vk_field(name) {@("self." + *name)}
|
||||
vk_self {@"self"}
|
||||
vk_implicit_ret {@"<implicit-ret>"}
|
||||
vk_self {@"self"/~}
|
||||
vk_implicit_ret {@"<implicit-ret>"/~}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ impl methods for determine_rp_ctxt {
|
|||
fn region_is_relevant(r: @ast::region) -> bool {
|
||||
alt r.node {
|
||||
ast::re_anon {self.anon_implies_rp}
|
||||
ast::re_named(@"self") {true}
|
||||
ast::re_named(@"self"/~) {true}
|
||||
ast::re_named(_) {false}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -885,7 +885,7 @@ fn resolve_import(e: env, n_id: node_id, name: ast::ident,
|
|||
// import
|
||||
alt e.imports.find(n_id) {
|
||||
some(resolving(sp)) {
|
||||
e.imports.insert(n_id, resolved(none, none, none, @~[], @"", sp));
|
||||
e.imports.insert(n_id, resolved(none, none, none, @~[], @""/~, sp));
|
||||
}
|
||||
_ { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -560,22 +560,22 @@ class PrimitiveTypeTable {
|
|||
new(atom_table: @AtomTable) {
|
||||
self.primitive_types = atom_hashmap();
|
||||
|
||||
self.intern(atom_table, @"bool", ty_bool);
|
||||
self.intern(atom_table, @"char", ty_int(ty_char));
|
||||
self.intern(atom_table, @"float", ty_float(ty_f));
|
||||
self.intern(atom_table, @"f32", ty_float(ty_f32));
|
||||
self.intern(atom_table, @"f64", ty_float(ty_f64));
|
||||
self.intern(atom_table, @"int", ty_int(ty_i));
|
||||
self.intern(atom_table, @"i8", ty_int(ty_i8));
|
||||
self.intern(atom_table, @"i16", ty_int(ty_i16));
|
||||
self.intern(atom_table, @"i32", ty_int(ty_i32));
|
||||
self.intern(atom_table, @"i64", ty_int(ty_i64));
|
||||
self.intern(atom_table, @"str", ty_str);
|
||||
self.intern(atom_table, @"uint", ty_uint(ty_u));
|
||||
self.intern(atom_table, @"u8", ty_uint(ty_u8));
|
||||
self.intern(atom_table, @"u16", ty_uint(ty_u16));
|
||||
self.intern(atom_table, @"u32", ty_uint(ty_u32));
|
||||
self.intern(atom_table, @"u64", ty_uint(ty_u64));
|
||||
self.intern(atom_table, @"bool"/~, ty_bool);
|
||||
self.intern(atom_table, @"char"/~, ty_int(ty_char));
|
||||
self.intern(atom_table, @"float"/~, ty_float(ty_f));
|
||||
self.intern(atom_table, @"f32"/~, ty_float(ty_f32));
|
||||
self.intern(atom_table, @"f64"/~, ty_float(ty_f64));
|
||||
self.intern(atom_table, @"int"/~, ty_int(ty_i));
|
||||
self.intern(atom_table, @"i8"/~, ty_int(ty_i8));
|
||||
self.intern(atom_table, @"i16"/~, ty_int(ty_i16));
|
||||
self.intern(atom_table, @"i32"/~, ty_int(ty_i32));
|
||||
self.intern(atom_table, @"i64"/~, ty_int(ty_i64));
|
||||
self.intern(atom_table, @"str"/~, ty_str);
|
||||
self.intern(atom_table, @"uint"/~, ty_uint(ty_u));
|
||||
self.intern(atom_table, @"u8"/~, ty_uint(ty_u8));
|
||||
self.intern(atom_table, @"u16"/~, ty_uint(ty_u16));
|
||||
self.intern(atom_table, @"u32"/~, ty_uint(ty_u32));
|
||||
self.intern(atom_table, @"u64"/~, ty_uint(ty_u64));
|
||||
}
|
||||
|
||||
fn intern(atom_table: @AtomTable, string: @str/~,
|
||||
|
|
@ -651,7 +651,7 @@ class Resolver {
|
|||
self.type_ribs = @dvec();
|
||||
self.xray_context = NoXray;
|
||||
|
||||
self.self_atom = (*self.atom_table).intern(@"self");
|
||||
self.self_atom = (*self.atom_table).intern(@"self"/~);
|
||||
self.primitive_type_table = @PrimitiveTypeTable(self.atom_table);
|
||||
|
||||
self.namespaces = ~[ ModuleNS, TypeNS, ValueNS, ImplNS ];
|
||||
|
|
@ -4234,7 +4234,7 @@ class Resolver {
|
|||
current_module = module;
|
||||
}
|
||||
BlockParentLink(module, node_id) {
|
||||
atoms.push((*self.atom_table).intern(@"<opaque>"));
|
||||
atoms.push((*self.atom_table).intern(@"<opaque>"/~));
|
||||
current_module = module;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -486,8 +486,8 @@ fn declare_tydesc(ccx: @crate_ctxt, t: ty::t) -> @tydesc_info {
|
|||
let llalign = llalign_of(ccx, llty);
|
||||
//XXX this triggers duplicate LLVM symbols
|
||||
let name = if false /*ccx.sess.opts.debuginfo*/ {
|
||||
mangle_internal_name_by_type_only(ccx, t, @"tydesc")
|
||||
} else { mangle_internal_name_by_seq(ccx, @"tydesc") };
|
||||
mangle_internal_name_by_type_only(ccx, t, @"tydesc"/~)
|
||||
} else { mangle_internal_name_by_seq(ccx, @"tydesc"/~) };
|
||||
note_unique_llvm_symbol(ccx, name);
|
||||
log(debug, #fmt("+++ declare_tydesc %s %s", ty_to_str(ccx.tcx, t), name));
|
||||
let gvar = str::as_c_str(name, |buf| {
|
||||
|
|
@ -667,8 +667,8 @@ fn incr_refcnt_of_boxed(cx: block, box_ptr: ValueRef) {
|
|||
fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) {
|
||||
let _icx = bcx.insn_ctxt("make_visit_glue");
|
||||
let mut bcx = bcx;
|
||||
assert bcx.ccx().tcx.intrinsic_defs.contains_key(@"ty_visitor");
|
||||
let (iid, ty) = bcx.ccx().tcx.intrinsic_defs.get(@"ty_visitor");
|
||||
assert bcx.ccx().tcx.intrinsic_defs.contains_key(@"ty_visitor"/~);
|
||||
let (iid, ty) = bcx.ccx().tcx.intrinsic_defs.get(@"ty_visitor"/~);
|
||||
let v = PointerCast(bcx, v, T_ptr(type_of::type_of(bcx.ccx(), ty)));
|
||||
bcx = reflect::emit_calls_to_trait_visit_ty(bcx, t, v, iid);
|
||||
build_return(bcx);
|
||||
|
|
@ -2131,7 +2131,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
|
|||
must_cast: true};
|
||||
}
|
||||
ast_map::node_ctor(nm, _, ct, _, pt) { (pt, nm, ct.span) }
|
||||
ast_map::node_dtor(_, dtor, _, pt) {(pt, @"drop", dtor.span)}
|
||||
ast_map::node_dtor(_, dtor, _, pt) {(pt, @"drop"/~, dtor.span)}
|
||||
ast_map::node_expr(*) { ccx.tcx.sess.bug("Can't monomorphize an expr") }
|
||||
ast_map::node_export(*) {
|
||||
ccx.tcx.sess.bug("Can't monomorphize an export")
|
||||
|
|
@ -3825,7 +3825,7 @@ fn trans_log(log_ex: @ast::expr, lvl: @ast::expr,
|
|||
ccx.module_data.get(modname)
|
||||
} else {
|
||||
let s = link::mangle_internal_name_by_path_and_seq(
|
||||
ccx, modpath, @"loglevel");
|
||||
ccx, modpath, @"loglevel"/~);
|
||||
let global = str::as_c_str(s, |buf| {
|
||||
llvm::LLVMAddGlobal(ccx.llmod, T_i32(), buf)
|
||||
});
|
||||
|
|
@ -4563,7 +4563,7 @@ fn trans_enum_variant(ccx: @crate_ctxt, enum_id: ast::node_id,
|
|||
let fn_args = vec::map(variant.node.args, |varg|
|
||||
{mode: ast::expl(ast::by_copy),
|
||||
ty: varg.ty,
|
||||
ident: @"arg",
|
||||
ident: @"arg"/~,
|
||||
id: varg.id});
|
||||
let fcx = new_fn_ctxt_w_id(ccx, ~[], llfndecl, variant.node.id,
|
||||
param_substs, none);
|
||||
|
|
@ -5215,7 +5215,7 @@ fn trans_constant(ccx: @crate_ctxt, it: @ast::item) {
|
|||
let path = item_path(ccx, it);
|
||||
for vec::each(variants) |variant| {
|
||||
let p = vec::append(path, ~[path_name(variant.node.name),
|
||||
path_name(@"discrim")]);
|
||||
path_name(@"discrim"/~)]);
|
||||
let s = mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx));
|
||||
let disr_val = vi[i].disr_val;
|
||||
note_unique_llvm_symbol(ccx, s);
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ fn trans_expr_fn(bcx: block,
|
|||
let ccx = bcx.ccx(), bcx = bcx;
|
||||
let fty = node_id_type(bcx, id);
|
||||
let llfnty = type_of_fn_from_ty(ccx, fty);
|
||||
let sub_path = vec::append_one(bcx.fcx.path, path_name(@"anon"));
|
||||
let sub_path = vec::append_one(bcx.fcx.path, path_name(@"anon"/~));
|
||||
let s = mangle_internal_name_by_path(ccx, sub_path);
|
||||
let llfn = decl_internal_cdecl_fn(ccx.llmod, s, llfnty);
|
||||
|
||||
|
|
|
|||
|
|
@ -1001,7 +1001,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
|||
let _icx = ccx.insn_ctxt("foreign::foreign::build_rust_fn");
|
||||
let t = ty::node_id_to_type(ccx.tcx, id);
|
||||
let ps = link::mangle_internal_name_by_path(
|
||||
ccx, vec::append_one(path, ast_map::path_name(@"__rust_abi")));
|
||||
ccx, vec::append_one(path, ast_map::path_name(@"__rust_abi"/~)));
|
||||
let llty = type_of_fn_from_ty(ccx, t);
|
||||
let llfndecl = decl_internal_cdecl_fn(ccx.llmod, ps, llty);
|
||||
trans_fn(ccx, path, decl, body, llfndecl, no_self, none, id);
|
||||
|
|
@ -1039,7 +1039,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
|||
|
||||
let shim_name = link::mangle_internal_name_by_path(
|
||||
ccx, vec::append_one(path,
|
||||
ast_map::path_name(@"__rust_stack_shim")));
|
||||
ast_map::path_name(@"__rust_stack_shim"/~)));
|
||||
ret build_shim_fn_(ccx, shim_name, llrustfn, tys,
|
||||
lib::llvm::CCallConv,
|
||||
build_args, build_ret);
|
||||
|
|
|
|||
|
|
@ -297,8 +297,8 @@ fn emit_calls_to_trait_visit_ty(bcx: block, t: ty::t,
|
|||
visitor_iid: def_id) -> block {
|
||||
|
||||
let final = sub_block(bcx, "final");
|
||||
assert bcx.ccx().tcx.intrinsic_defs.contains_key(@"tydesc");
|
||||
let (_, tydesc_ty) = bcx.ccx().tcx.intrinsic_defs.get(@"tydesc");
|
||||
assert bcx.ccx().tcx.intrinsic_defs.contains_key(@"tydesc"/~);
|
||||
let (_, tydesc_ty) = bcx.ccx().tcx.intrinsic_defs.get(@"tydesc"/~);
|
||||
let tydesc_ty = type_of::type_of(bcx.ccx(), tydesc_ty);
|
||||
let r = reflector({
|
||||
visitor_val: visitor_val,
|
||||
|
|
|
|||
|
|
@ -730,7 +730,7 @@ fn simplify_type(tcx: ty::ctxt, typ: ty::t) -> ty::t {
|
|||
ty::ty_class(did, substs) {
|
||||
let simpl_fields = (if is_some(ty::ty_dtor(tcx, did)) {
|
||||
// remember the drop flag
|
||||
~[{ident: @"drop", mt: {ty:
|
||||
~[{ident: @"drop"/~, mt: {ty:
|
||||
ty::mk_u8(tcx),
|
||||
mutbl: ast::m_mutbl}}] }
|
||||
else { ~[] }) +
|
||||
|
|
|
|||
|
|
@ -2661,7 +2661,7 @@ fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
|
|||
vec::append_one(*path, ast_map::path_name(nm))
|
||||
}
|
||||
ast_map::node_dtor(_, _, _, path) {
|
||||
vec::append_one(*path, ast_map::path_name(@"dtor"))
|
||||
vec::append_one(*path, ast_map::path_name(@"dtor"/~))
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1625,7 +1625,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
|||
let p_ty = fcx.expr_ty(p);
|
||||
|
||||
let lkup = method::lookup(fcx, p, p, expr.id, alloc_id,
|
||||
@"alloc", p_ty, ~[], false);
|
||||
@"alloc"/~, p_ty, ~[], false);
|
||||
alt lkup.method() {
|
||||
some(entry) {
|
||||
fcx.ccx.method_map.insert(alloc_id, entry);
|
||||
|
|
@ -2282,10 +2282,10 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) {
|
|||
(1u, ~[], ty::mk_nil_ptr(tcx))
|
||||
}
|
||||
"visit_tydesc" {
|
||||
assert ccx.tcx.intrinsic_defs.contains_key(@"tydesc");
|
||||
assert ccx.tcx.intrinsic_defs.contains_key(@"ty_visitor");
|
||||
let (_, tydesc_ty) = ccx.tcx.intrinsic_defs.get(@"tydesc");
|
||||
let (_, visitor_trait) = ccx.tcx.intrinsic_defs.get(@"ty_visitor");
|
||||
assert ccx.tcx.intrinsic_defs.contains_key(@"tydesc"/~);
|
||||
assert ccx.tcx.intrinsic_defs.contains_key(@"ty_visitor"/~);
|
||||
let (_, tydesc_ty) = ccx.tcx.intrinsic_defs.get(@"tydesc"/~);
|
||||
let (_, visitor_trait) = ccx.tcx.intrinsic_defs.get(@"ty_visitor"/~);
|
||||
let td_ptr = ty::mk_ptr(ccx.tcx, {ty: tydesc_ty,
|
||||
mutbl: ast::m_imm});
|
||||
(0u, ~[arg(ast::by_val, td_ptr),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue