Box AST idents
This commit is contained in:
parent
bdd2000066
commit
ce750a7dbc
74 changed files with 629 additions and 603 deletions
|
|
@ -83,7 +83,7 @@ fn encode_inlined_item(ecx: @e::encode_ctxt,
|
|||
ii: ast::inlined_item,
|
||||
maps: maps) {
|
||||
#debug["> Encoding inlined item: %s::%s (%u)",
|
||||
ast_map::path_to_str(path), ii.ident(),
|
||||
ast_map::path_to_str(path), *ii.ident(),
|
||||
ebml_w.writer.tell()];
|
||||
|
||||
let id_range = compute_id_range(ii);
|
||||
|
|
@ -94,7 +94,7 @@ fn encode_inlined_item(ecx: @e::encode_ctxt,
|
|||
}
|
||||
|
||||
#debug["< Encoded inlined fn: %s::%s (%u)",
|
||||
ast_map::path_to_str(path), ii.ident(),
|
||||
ast_map::path_to_str(path), *ii.ident(),
|
||||
ebml_w.writer.tell()];
|
||||
}
|
||||
|
||||
|
|
@ -117,10 +117,10 @@ fn decode_inlined_item(cdata: cstore::crate_metadata,
|
|||
let ii = renumber_ast(xcx, raw_ii);
|
||||
ast_map::map_decoded_item(tcx.sess.diagnostic(),
|
||||
dcx.tcx.items, path, ii);
|
||||
#debug["Fn named: %s", ii.ident()];
|
||||
#debug["Fn named: %s", *ii.ident()];
|
||||
decode_side_tables(xcx, ast_doc);
|
||||
#debug["< Decoded inlined fn: %s::%s",
|
||||
ast_map::path_to_str(path), ii.ident()];
|
||||
ast_map::path_to_str(path), *ii.ident()];
|
||||
alt ii {
|
||||
ast::ii_item(i) {
|
||||
#debug(">>> DECODED ITEM >>>\n%s\n<<< DECODED ITEM <<<",
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ enum comp_kind {
|
|||
comp_tuple, // elt in a tuple
|
||||
comp_res, // data for a resource
|
||||
comp_variant(ast::def_id), // internals to a variant of given enum
|
||||
comp_field(str, // name of field
|
||||
comp_field(ast::ident, // name of field
|
||||
ast::mutability), // declared mutability of field
|
||||
comp_index(ty::t, // type of vec/str/etc being deref'd
|
||||
ast::mutability) // mutability of vec content
|
||||
|
|
@ -409,7 +409,7 @@ impl to_str_methods for borrowck_ctxt {
|
|||
|
||||
fn comp_to_repr(comp: comp_kind) -> str {
|
||||
alt comp {
|
||||
comp_field(fld, _) { fld }
|
||||
comp_field(fld, _) { *fld }
|
||||
comp_index(*) { "[]" }
|
||||
comp_tuple { "()" }
|
||||
comp_res { "<res>" }
|
||||
|
|
|
|||
|
|
@ -295,14 +295,15 @@ impl public_methods for borrowck_ctxt {
|
|||
ret @{cat:cat_discr(cmt, alt_id) with *cmt};
|
||||
}
|
||||
|
||||
fn cat_field<N:ast_node>(node: N, base_cmt: cmt, f_name: str) -> cmt {
|
||||
fn cat_field<N:ast_node>(node: N, base_cmt: cmt,
|
||||
f_name: ast::ident) -> cmt {
|
||||
let f_mutbl = alt field_mutbl(self.tcx, base_cmt.ty, f_name) {
|
||||
some(f_mutbl) { f_mutbl }
|
||||
none {
|
||||
self.tcx.sess.span_bug(
|
||||
node.span(),
|
||||
#fmt["Cannot find field `%s` in type `%s`",
|
||||
f_name, ty_to_str(self.tcx, base_cmt.ty)]);
|
||||
*f_name, ty_to_str(self.tcx, base_cmt.ty)]);
|
||||
}
|
||||
};
|
||||
let m = alt f_mutbl {
|
||||
|
|
@ -427,7 +428,7 @@ impl private_methods for borrowck_ctxt {
|
|||
|
||||
fn field_mutbl(tcx: ty::ctxt,
|
||||
base_ty: ty::t,
|
||||
f_name: str) -> option<ast::mutability> {
|
||||
f_name: ast::ident) -> option<ast::mutability> {
|
||||
// Need to refactor so that records/class fields can be treated uniformly.
|
||||
alt ty::get(base_ty).struct {
|
||||
ty::ty_rec(fields) {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ fn check_capture_clause(tcx: ty::ctxt,
|
|||
tcx.sess.span_warn(
|
||||
cap_item.span,
|
||||
#fmt("captured variable '%s' not used in closure",
|
||||
cap_item.name));
|
||||
*cap_item.name));
|
||||
}
|
||||
|
||||
let cap_def_id = ast_util::def_id_of_def(cap_def).node;
|
||||
|
|
@ -52,7 +52,7 @@ fn check_capture_clause(tcx: ty::ctxt,
|
|||
tcx.sess.span_err(
|
||||
cap_item.span,
|
||||
#fmt("variable '%s' captured more than once",
|
||||
cap_item.name));
|
||||
*cap_item.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ fn compute_capture_vars(tcx: ty::ctxt,
|
|||
|
||||
for (*cap_clause).each { |cap_item|
|
||||
#debug("Doing capture var: %s (%?)",
|
||||
cap_item.name, cap_item.id);
|
||||
*cap_item.name, cap_item.id);
|
||||
|
||||
let cap_def = tcx.def_map.get(cap_item.id);
|
||||
let cap_def_id = ast_util::def_id_of_def(cap_def).node;
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: [@pat]) {
|
|||
alt ty::get(ty).struct {
|
||||
ty::ty_bool {
|
||||
alt check ctor {
|
||||
val(const_int(1i64)) { some("true") }
|
||||
val(const_int(0i64)) { some("false") }
|
||||
val(const_int(1i64)) { some(@"true") }
|
||||
val(const_int(0i64)) { some(@"false") }
|
||||
}
|
||||
}
|
||||
ty::ty_enum(id, _) {
|
||||
|
|
@ -83,7 +83,7 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: [@pat]) {
|
|||
}
|
||||
};
|
||||
let msg = "non-exhaustive patterns" + alt ext {
|
||||
some(s) { ": " + s + " not covered" }
|
||||
some(s) { ": " + *s + " not covered" }
|
||||
none { "" }
|
||||
};
|
||||
tcx.sess.span_err(sp, msg);
|
||||
|
|
|
|||
|
|
@ -108,11 +108,11 @@ fn eval_const_expr(tcx: middle::ty::ctxt, e: @expr) -> const_val {
|
|||
|
||||
fn lit_to_const(lit: @lit) -> const_val {
|
||||
alt lit.node {
|
||||
lit_str(s) { const_str(s) }
|
||||
lit_str(s) { const_str(*s) }
|
||||
lit_int(n, _) { const_int(n) }
|
||||
lit_uint(n, _) { const_uint(n) }
|
||||
lit_int_unsuffixed(n, _) { const_int(n) }
|
||||
lit_float(n, _) { const_float(option::get(float::from_str(n)) as f64) }
|
||||
lit_float(n, _) { const_float(option::get(float::from_str(*n)) as f64) }
|
||||
lit_nil { const_int(0i64) }
|
||||
lit_bool(b) { const_int(b as i64) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ impl methods for ctxt {
|
|||
for metas.each {|meta|
|
||||
alt meta.node {
|
||||
ast::meta_word(lintname) {
|
||||
alt lookup_lint(self.dict, lintname) {
|
||||
alt lookup_lint(self.dict, *lintname) {
|
||||
(name, none) {
|
||||
self.span_lint(
|
||||
self.get_level(unrecognized_warning),
|
||||
|
|
@ -444,7 +444,7 @@ fn check_item_old_vecs(cx: ty::ctxt, it: @ast::item) {
|
|||
|
||||
ast::ty_path(@{span: _, global: _, idents: ids,
|
||||
rp: none, types: _}, _)
|
||||
if ids == ["str"] && (! uses_vstore.contains_key(t.id)) {
|
||||
if ids == [@"str"] && (! uses_vstore.contains_key(t.id)) {
|
||||
cx.sess.span_lint(
|
||||
old_vecs, it.id, t.id,
|
||||
t.span, "deprecated str type");
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ of `f`.
|
|||
*/
|
||||
|
||||
import dvec::{dvec, extensions};
|
||||
import std::map::{hashmap, int_hash, str_hash};
|
||||
import std::map::{hashmap, int_hash, str_hash, box_str_hash};
|
||||
import syntax::{visit, ast_util};
|
||||
import syntax::print::pprust::{expr_to_str};
|
||||
import visit::vt;
|
||||
|
|
@ -134,9 +134,9 @@ enum relevant_def { rdef_var(node_id), rdef_self }
|
|||
type capture_info = {ln: live_node, is_move: bool, rv: relevant_def};
|
||||
|
||||
enum var_kind {
|
||||
vk_arg(node_id, str, rmode),
|
||||
vk_local(node_id, str),
|
||||
vk_field(str),
|
||||
vk_arg(node_id, ident, rmode),
|
||||
vk_local(node_id, ident),
|
||||
vk_field(ident),
|
||||
vk_self,
|
||||
vk_implicit_ret
|
||||
}
|
||||
|
|
@ -158,7 +158,7 @@ class ir_maps {
|
|||
let mut num_vars: uint;
|
||||
let live_node_map: hashmap<node_id, live_node>;
|
||||
let variable_map: hashmap<node_id, variable>;
|
||||
let field_map: hashmap<str, variable>;
|
||||
let field_map: hashmap<ident, variable>;
|
||||
let capture_map: hashmap<node_id, @[capture_info]>;
|
||||
let mut var_kinds: [var_kind];
|
||||
let mut lnks: [live_node_kind];
|
||||
|
|
@ -174,7 +174,7 @@ class ir_maps {
|
|||
self.live_node_map = int_hash();
|
||||
self.variable_map = int_hash();
|
||||
self.capture_map = int_hash();
|
||||
self.field_map = str_hash();
|
||||
self.field_map = box_str_hash();
|
||||
self.var_kinds = [];
|
||||
self.lnks = [];
|
||||
}
|
||||
|
|
@ -227,12 +227,12 @@ class ir_maps {
|
|||
}
|
||||
}
|
||||
|
||||
fn variable_name(var: variable) -> str {
|
||||
fn variable_name(var: variable) -> ident {
|
||||
alt self.var_kinds[*var] {
|
||||
vk_local(_, name) | vk_arg(_, name, _) {name}
|
||||
vk_field(name) {"self." + name}
|
||||
vk_self {"self"}
|
||||
vk_implicit_ret {"<implicit-ret>"}
|
||||
vk_field(name) {@("self." + *name)}
|
||||
vk_self {@"self"}
|
||||
vk_implicit_ret {@"<implicit-ret>"}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1208,7 +1208,8 @@ class liveness {
|
|||
}
|
||||
}
|
||||
|
||||
fn as_self_field(expr: @expr, fld: str) -> option<(live_node,variable)> {
|
||||
fn as_self_field(expr: @expr,
|
||||
fld: ident) -> option<(live_node,variable)> {
|
||||
// If we checking a constructor, then we treat self.f as a
|
||||
// variable. we use the live_node id that will be assigned to
|
||||
// the reference to self but the variable id for `f`.
|
||||
|
|
@ -1429,7 +1430,7 @@ impl check_methods for @liveness {
|
|||
none { /* ok */ }
|
||||
some(lnk_exit) {
|
||||
self.tcx.sess.span_err(
|
||||
sp, #fmt["field `self.%s` is never initialized", nm]);
|
||||
sp, #fmt["field `self.%s` is never initialized", *nm]);
|
||||
}
|
||||
some(lnk) {
|
||||
self.report_illegal_read(
|
||||
|
|
@ -1605,13 +1606,13 @@ impl check_methods for @liveness {
|
|||
self.tcx.sess.span_err(
|
||||
move_span,
|
||||
#fmt["illegal move from argument `%s`, which is not \
|
||||
copy or move mode", name]);
|
||||
copy or move mode", *name]);
|
||||
ret;
|
||||
}
|
||||
vk_field(name) {
|
||||
self.tcx.sess.span_err(
|
||||
move_span,
|
||||
#fmt["illegal move from field `%s`", name]);
|
||||
#fmt["illegal move from field `%s`", *name]);
|
||||
ret;
|
||||
}
|
||||
vk_local(*) | vk_self | vk_implicit_ret {
|
||||
|
|
@ -1643,12 +1644,12 @@ impl check_methods for @liveness {
|
|||
lnk_freevar(span) {
|
||||
self.tcx.sess.span_err(
|
||||
span,
|
||||
#fmt["capture of %s: `%s`", msg, name]);
|
||||
#fmt["capture of %s: `%s`", msg, *name]);
|
||||
}
|
||||
lnk_expr(span) {
|
||||
self.tcx.sess.span_err(
|
||||
span,
|
||||
#fmt["use of %s: `%s`", msg, name]);
|
||||
#fmt["use of %s: `%s`", msg, *name]);
|
||||
}
|
||||
lnk_exit |
|
||||
lnk_vdef(_) {
|
||||
|
|
@ -1659,9 +1660,9 @@ impl check_methods for @liveness {
|
|||
}
|
||||
}
|
||||
|
||||
fn should_warn(var: variable) -> option<str> {
|
||||
fn should_warn(var: variable) -> option<ident> {
|
||||
let name = (*self.ir).variable_name(var);
|
||||
if name[0] == ('_' as u8) {none} else {some(name)}
|
||||
if (*name)[0] == ('_' as u8) {none} else {some(name)}
|
||||
}
|
||||
|
||||
fn warn_about_unused_args(sp: span, decl: fn_decl, entry_ln: live_node) {
|
||||
|
|
@ -1712,10 +1713,10 @@ impl check_methods for @liveness {
|
|||
if is_assigned {
|
||||
self.tcx.sess.span_warn(
|
||||
sp, #fmt["variable `%s` is assigned to, \
|
||||
but never used", name]);
|
||||
but never used", *name]);
|
||||
} else {
|
||||
self.tcx.sess.span_warn(
|
||||
sp, #fmt["unused variable: `%s`", name]);
|
||||
sp, #fmt["unused variable: `%s`", *name]);
|
||||
}
|
||||
}
|
||||
ret true;
|
||||
|
|
@ -1728,7 +1729,7 @@ impl check_methods for @liveness {
|
|||
for self.should_warn(var).each { |name|
|
||||
self.tcx.sess.span_warn(
|
||||
sp,
|
||||
#fmt["value assigned to `%s` is never read", name]);
|
||||
#fmt["value assigned to `%s` is never read", *name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ import std::map::hashmap;
|
|||
export pat_binding_ids, pat_bindings, pat_id_map;
|
||||
export pat_is_variant;
|
||||
|
||||
type pat_id_map = std::map::hashmap<str, node_id>;
|
||||
type pat_id_map = std::map::hashmap<ident, node_id>;
|
||||
|
||||
// This is used because same-named variables in alternative patterns need to
|
||||
// use the node_id of their namesake in the first pattern.
|
||||
fn pat_id_map(dm: resolve::def_map, pat: @pat) -> pat_id_map {
|
||||
let map = std::map::str_hash();
|
||||
let map = std::map::box_str_hash();
|
||||
pat_bindings(dm, pat) {|p_id, _s, n|
|
||||
map.insert(path_to_ident(n), p_id);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import syntax::attr;
|
|||
import metadata::{csearch, cstore};
|
||||
import driver::session::session;
|
||||
import util::common::is_main_name;
|
||||
import std::map::{int_hash, str_hash, hashmap};
|
||||
import std::map::{int_hash, str_hash, box_str_hash, hashmap};
|
||||
import vec::each;
|
||||
import syntax::codemap::span;
|
||||
import syntax::visit;
|
||||
|
|
@ -68,16 +68,16 @@ enum glob_import_state {
|
|||
option<def>), /* module */
|
||||
}
|
||||
|
||||
type ext_hash = hashmap<{did: def_id, ident: str, ns: namespace}, def>;
|
||||
type ext_hash = hashmap<{did: def_id, ident: ast::ident, ns: namespace}, def>;
|
||||
|
||||
fn new_ext_hash() -> ext_hash {
|
||||
type key = {did: def_id, ident: str, ns: namespace};
|
||||
type key = {did: def_id, ident: ast::ident, ns: namespace};
|
||||
fn hash(v: key) -> uint {
|
||||
str::hash(v.ident) + ast_util::hash_def(v.did) + v.ns as uint
|
||||
str::hash(*v.ident) + ast_util::hash_def(v.did) + v.ns as uint
|
||||
}
|
||||
fn eq(v1: key, v2: key) -> bool {
|
||||
ret ast_util::def_eq(v1.did, v2.did) &&
|
||||
str::eq(v1.ident, v2.ident) && v1.ns == v2.ns;
|
||||
str::eq(*v1.ident, *v2.ident) && v1.ns == v2.ns;
|
||||
}
|
||||
std::map::hashmap(hash, {|a, b| a == b})
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ type indexed_mod = {
|
|||
index: mod_index,
|
||||
glob_imports: dvec<glob_imp_def>,
|
||||
mut globbed_exports: [ident],
|
||||
glob_imported_names: hashmap<str, glob_import_state>,
|
||||
glob_imported_names: hashmap<ident, glob_import_state>,
|
||||
path: str
|
||||
};
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ type env =
|
|||
ext_cache: ext_hash,
|
||||
used_imports: {mut track: bool,
|
||||
mut data: [node_id]},
|
||||
reported: dvec<{ident: str, sc: scope}>,
|
||||
reported: dvec<{ident: ast::ident, sc: scope}>,
|
||||
mut ignored_imports: [node_id],
|
||||
mut current_tp: option<uint>,
|
||||
mut resolve_unexported: bool,
|
||||
|
|
@ -256,7 +256,7 @@ fn map_crate(e: @env, c: @ast::crate) {
|
|||
let mut path = n + "::";
|
||||
list::iter(sc) {|s|
|
||||
alt s {
|
||||
scope_item(i) { path = i.ident + "::" + path; }
|
||||
scope_item(i) { path = *i.ident + "::" + path; }
|
||||
_ {}
|
||||
}
|
||||
}
|
||||
|
|
@ -272,8 +272,8 @@ fn map_crate(e: @env, c: @ast::crate) {
|
|||
index: index_mod(md),
|
||||
glob_imports: dvec(),
|
||||
mut globbed_exports: [],
|
||||
glob_imported_names: str_hash(),
|
||||
path: path_from_scope(sc, i.ident)});
|
||||
glob_imported_names: box_str_hash(),
|
||||
path: path_from_scope(sc, *i.ident)});
|
||||
}
|
||||
ast::item_native_mod(nmd) {
|
||||
e.mod_map.insert(i.id,
|
||||
|
|
@ -281,8 +281,8 @@ fn map_crate(e: @env, c: @ast::crate) {
|
|||
index: index_nmod(nmd),
|
||||
glob_imports: dvec(),
|
||||
mut globbed_exports: [],
|
||||
glob_imported_names: str_hash(),
|
||||
path: path_from_scope(sc, i.ident)});
|
||||
glob_imported_names: box_str_hash(),
|
||||
path: path_from_scope(sc, *i.ident)});
|
||||
}
|
||||
_ { }
|
||||
}
|
||||
|
|
@ -340,7 +340,7 @@ fn map_crate(e: @env, c: @ast::crate) {
|
|||
index: index_mod(c.node.module),
|
||||
glob_imports: dvec(),
|
||||
mut globbed_exports: [],
|
||||
glob_imported_names: str_hash(),
|
||||
glob_imported_names: box_str_hash(),
|
||||
path: ""});
|
||||
|
||||
// Next, assemble the links for globbed imports and exports.
|
||||
|
|
@ -377,10 +377,10 @@ fn check_unused_imports(e: @env, level: lint::level) {
|
|||
if !vec::contains(e.used_imports.data, k) {
|
||||
alt level {
|
||||
lint::warn {
|
||||
e.sess.span_warn(sp, "unused import " + name);
|
||||
e.sess.span_warn(sp, "unused import " + *name);
|
||||
}
|
||||
lint::error {
|
||||
e.sess.span_err(sp, "unused import " + name);
|
||||
e.sess.span_err(sp, "unused import " + *name);
|
||||
}
|
||||
lint::ignore {
|
||||
}
|
||||
|
|
@ -518,7 +518,7 @@ fn resolve_names(e: @env, c: @ast::crate) {
|
|||
}
|
||||
some(fnd@ast::def_const(_)) {
|
||||
e.sess.span_err(p.span, "pattern variable conflicts \
|
||||
with constant '" + path_to_ident(p) + "'");
|
||||
with constant '" + *path_to_ident(p) + "'");
|
||||
}
|
||||
// Binds a var -- nothing needs to be done
|
||||
_ {}
|
||||
|
|
@ -701,7 +701,7 @@ fn visit_local_with_scope(e: @env, loc: @local, &&sc: scopes, v:vt<scopes>) {
|
|||
e.sess.span_err(loc.span,
|
||||
#fmt("declaration of `%s` shadows an \
|
||||
enum that's in scope",
|
||||
path_to_ident(path)));
|
||||
*path_to_ident(path)));
|
||||
}
|
||||
_ {}
|
||||
}
|
||||
|
|
@ -734,7 +734,7 @@ fn follow_import(e: env, &&sc: scopes, path: [ident], sp: span) ->
|
|||
alt dcur {
|
||||
some(ast::def_mod(_)) | some(ast::def_native_mod(_)) { ret dcur; }
|
||||
_ {
|
||||
e.sess.span_err(sp, str::connect(path, "::") +
|
||||
e.sess.span_err(sp, str::connect(path.map({|x|*x}), "::") +
|
||||
" does not name a module.");
|
||||
ret none;
|
||||
}
|
||||
|
|
@ -860,7 +860,7 @@ fn resolve_import(e: env, n_id: node_id, name: ast::ident,
|
|||
// import
|
||||
alt e.imports.find(n_id) {
|
||||
some(resolving(sp)) {
|
||||
e.imports.insert(n_id, resolved(none, none, none, @[], "", sp));
|
||||
e.imports.insert(n_id, resolved(none, none, none, @[], @"", sp));
|
||||
}
|
||||
_ { }
|
||||
}
|
||||
|
|
@ -897,7 +897,7 @@ fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) {
|
|||
alt find_fn_or_mod_scope(sc) {
|
||||
some(err_scope) {
|
||||
for e.reported.each {|rs|
|
||||
if str::eq(rs.ident, name) && err_scope == rs.sc { ret; }
|
||||
if str::eq(*rs.ident, *name) && err_scope == rs.sc { ret; }
|
||||
}
|
||||
e.reported.push({ident: name, sc: err_scope});
|
||||
}
|
||||
|
|
@ -907,10 +907,10 @@ fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) {
|
|||
in_mod(def) {
|
||||
let did = def_id_of_def(def);
|
||||
if did.crate == ast::local_crate {
|
||||
path = e.mod_map.get(did.node).path + path;
|
||||
path = @(e.mod_map.get(did.node).path + *path);
|
||||
} else if did.node != ast::crate_node_id {
|
||||
let paths = e.ext_map.get(did);
|
||||
path = str::connect(paths + [path], "::");
|
||||
path = @str::connect((paths + [path]).map({|x|*x}), "::");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -922,7 +922,7 @@ fn unresolved_fatal(e: env, sp: span, id: ident, kind: str) -> ! {
|
|||
}
|
||||
|
||||
fn mk_unresolved_msg(id: ident, kind: str) -> str {
|
||||
ret #fmt["unresolved %s: %s", kind, id];
|
||||
ret #fmt["unresolved %s: %s", kind, *id];
|
||||
}
|
||||
|
||||
// Lookup helpers
|
||||
|
|
@ -1010,7 +1010,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace,
|
|||
alt s {
|
||||
scope_toplevel {
|
||||
if ns == ns_type {
|
||||
ret some(ast::def_prim_ty(alt name {
|
||||
ret some(ast::def_prim_ty(alt *name {
|
||||
"bool" { ast::ty_bool }
|
||||
"int" { ast::ty_int(ast::ty_i) }
|
||||
"uint" { ast::ty_uint(ast::ty_u) }
|
||||
|
|
@ -1045,7 +1045,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace,
|
|||
}
|
||||
ast::item_iface(tps, _, _) {
|
||||
if ns == ns_type {
|
||||
if name == "self" {
|
||||
if *name == "self" {
|
||||
ret some(def_self(it.id));
|
||||
}
|
||||
ret lookup_in_ty_params(e, name, tps);
|
||||
|
|
@ -1070,7 +1070,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace,
|
|||
}
|
||||
}
|
||||
scope_method(id, tps) {
|
||||
if (name == "self" && ns == ns_val) {
|
||||
if (*name == "self" && ns == ns_val) {
|
||||
ret some(ast::def_self(id));
|
||||
} else if ns == ns_type {
|
||||
ret lookup_in_ty_params(e, name, tps);
|
||||
|
|
@ -1135,7 +1135,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace,
|
|||
let mut i = vec::len(closing);
|
||||
while i > 0u {
|
||||
i -= 1u;
|
||||
#debug["name=%s df=%?", name, df];
|
||||
#debug["name=%s df=%?", *name, df];
|
||||
assert def_is_local(df) || def_is_self(df);
|
||||
let df_id = def_id_of_def(df).node;
|
||||
df = ast::def_upvar(df_id, @df, closing[i]);
|
||||
|
|
@ -1164,7 +1164,7 @@ fn lookup_in_ty_params(e: env, name: ident, ty_params: [ast::ty_param])
|
|||
-> option<def> {
|
||||
let mut n = 0u;
|
||||
for ty_params.each {|tp|
|
||||
if str::eq(tp.ident, name) && alt e.current_tp {
|
||||
if str::eq(*tp.ident, *name) && alt e.current_tp {
|
||||
some(cur) { n < cur } none { true }
|
||||
} { ret some(ast::def_ty_param(local_def(tp.id), n)); }
|
||||
n += 1u;
|
||||
|
|
@ -1176,7 +1176,7 @@ fn lookup_in_pat(e: env, name: ident, pat: @ast::pat) -> option<node_id> {
|
|||
let mut found = none;
|
||||
|
||||
pat_util::pat_bindings(e.def_map, pat) {|p_id, _sp, n|
|
||||
if str::eq(path_to_ident(n), name)
|
||||
if str::eq(*path_to_ident(n), *name)
|
||||
{ found = some(p_id); }
|
||||
};
|
||||
ret found;
|
||||
|
|
@ -1188,7 +1188,7 @@ fn lookup_in_fn(e: env, name: ident, decl: ast::fn_decl,
|
|||
alt ns {
|
||||
ns_val {
|
||||
for decl.inputs.each {|a|
|
||||
if str::eq(a.ident, name) {
|
||||
if str::eq(*a.ident, *name) {
|
||||
ret some(ast::def_arg(a.id, a.mode));
|
||||
}
|
||||
}
|
||||
|
|
@ -1231,14 +1231,14 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint,
|
|||
alt it.node {
|
||||
ast::item_enum(variants, _, _) {
|
||||
if ns == ns_type {
|
||||
if str::eq(it.ident, name) {
|
||||
if str::eq(*it.ident, *name) {
|
||||
ret some(ast::def_ty(local_def(it.id)));
|
||||
}
|
||||
} else {
|
||||
alt ns {
|
||||
ns_val {
|
||||
for variants.each {|v|
|
||||
if str::eq(v.node.name, name) {
|
||||
if str::eq(*v.node.name, *name) {
|
||||
let i = v.node.id;
|
||||
ret some(ast::def_variant
|
||||
(local_def(it.id), local_def(i)));
|
||||
|
|
@ -1250,7 +1250,7 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint,
|
|||
}
|
||||
}
|
||||
_ {
|
||||
if str::eq(it.ident, name) {
|
||||
if str::eq(*it.ident, *name) {
|
||||
let found = found_def_item(it, ns);
|
||||
if !is_none(found) {
|
||||
ret found;
|
||||
|
|
@ -1521,9 +1521,9 @@ fn lookup_in_globs(e: env, globs: [glob_imp_def], sp: span, id: ident,
|
|||
} else {
|
||||
for matches.each {|match|
|
||||
let sp = match.path.span;
|
||||
e.sess.span_note(sp, #fmt["'%s' is imported here", id]);
|
||||
e.sess.span_note(sp, #fmt["'%s' is imported here", *id]);
|
||||
}
|
||||
e.sess.span_fatal(sp, "'" + id + "' is glob-imported from" +
|
||||
e.sess.span_fatal(sp, "'" + *id + "' is glob-imported from" +
|
||||
" multiple different modules.");
|
||||
}
|
||||
}
|
||||
|
|
@ -1627,7 +1627,7 @@ fn index_view_items(view_items: [@ast::view_item],
|
|||
}
|
||||
|
||||
fn index_mod(md: ast::_mod) -> mod_index {
|
||||
let index = str_hash::<@list<mod_index_entry>>();
|
||||
let index = box_str_hash::<@list<mod_index_entry>>();
|
||||
|
||||
index_view_items(md.view_items, index);
|
||||
|
||||
|
|
@ -1667,7 +1667,7 @@ fn index_mod(md: ast::_mod) -> mod_index {
|
|||
|
||||
|
||||
fn index_nmod(md: ast::native_mod) -> mod_index {
|
||||
let index = str_hash::<@list<mod_index_entry>>();
|
||||
let index = box_str_hash::<@list<mod_index_entry>>();
|
||||
|
||||
index_view_items(md.view_items, index);
|
||||
|
||||
|
|
@ -1727,7 +1727,7 @@ fn check_mod_name(e: env, name: ident, entries: @list<mod_index_entry>) {
|
|||
let mut saw_value = false;
|
||||
let mut entries = entries;
|
||||
fn dup(e: env, sp: span, word: str, name: ident) {
|
||||
e.sess.span_fatal(sp, "duplicate definition of " + word + name);
|
||||
e.sess.span_fatal(sp, "duplicate definition of " + word + *name);
|
||||
}
|
||||
loop {
|
||||
alt *entries {
|
||||
|
|
@ -1817,11 +1817,11 @@ fn check_arm(e: @env, a: ast::arm, &&x: (), v: vt<()>) {
|
|||
"inconsistent number of bindings");
|
||||
} else {
|
||||
for ch.seen.each {|name|
|
||||
if is_none(vec::find(seen0, bind str::eq(name, _))) {
|
||||
if is_none(vec::find(seen0, {|x|str::eq(*name, *x)})) {
|
||||
// Fight the alias checker
|
||||
let name_ = name;
|
||||
e.sess.span_err(a.pats[i].span,
|
||||
"binding " + name_ +
|
||||
"binding " + *name_ +
|
||||
" does not occur in first pattern");
|
||||
}
|
||||
}
|
||||
|
|
@ -1915,8 +1915,9 @@ fn checker(e: env, kind: str) -> checker {
|
|||
|
||||
fn check_name(ch: checker, sp: span, name: ident) {
|
||||
for ch.seen.each {|s|
|
||||
if str::eq(s, name) {
|
||||
ch.sess.span_fatal(sp, "duplicate " + ch.kind + " name: " + name);
|
||||
if str::eq(*s, *name) {
|
||||
ch.sess.span_fatal(
|
||||
sp, "duplicate " + ch.kind + " name: " + *name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2000,7 +2001,7 @@ fn check_exports(e: @env) {
|
|||
e.exp_map.insert(export_id, found + [{reexp: reexp, id: target_id}]);
|
||||
}
|
||||
|
||||
fn check_export(e: @env, ident: str, _mod: @indexed_mod,
|
||||
fn check_export(e: @env, ident: ident, _mod: @indexed_mod,
|
||||
export_id: node_id, vi: @view_item) {
|
||||
let mut found_something = false;
|
||||
if _mod.index.contains_key(ident) {
|
||||
|
|
@ -2036,7 +2037,7 @@ fn check_exports(e: @env) {
|
|||
lookup_glob_any(e, _mod, vi.span, ident, export_id);
|
||||
if !found_something {
|
||||
e.sess.span_warn(vi.span,
|
||||
#fmt("exported item %s is not defined", ident));
|
||||
#fmt("exported item %s is not defined", *ident));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2044,7 +2045,7 @@ fn check_exports(e: @env) {
|
|||
-> node_id {
|
||||
alt _mod.index.find(id) {
|
||||
none {
|
||||
e.sess.span_fatal(sp, #fmt("undefined id %s in an export", id));
|
||||
e.sess.span_fatal(sp, #fmt("undefined id %s in an export", *id));
|
||||
}
|
||||
some(ms) {
|
||||
let maybe_id = list_search(ms) {|m|
|
||||
|
|
@ -2056,7 +2057,7 @@ fn check_exports(e: @env) {
|
|||
alt maybe_id {
|
||||
some(an_id) { an_id }
|
||||
_ { e.sess.span_fatal(sp, #fmt("%s does not refer \
|
||||
to an enumeration", id)); }
|
||||
to an enumeration", *id)); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2079,7 +2080,7 @@ fn check_exports(e: @env) {
|
|||
e.sess.span_err(
|
||||
span, #fmt("variant %s doesn't belong to \
|
||||
enum %s",
|
||||
variant_id.node.name, id));
|
||||
*variant_id.node.name, *id));
|
||||
}
|
||||
}
|
||||
_ {}
|
||||
|
|
@ -2090,7 +2091,7 @@ fn check_exports(e: @env) {
|
|||
}
|
||||
if !found {
|
||||
e.sess.span_err(span, #fmt("%s is not a variant",
|
||||
variant_id.node.name));
|
||||
*variant_id.node.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ fn variant_opt(tcx: ty::ctxt, pat_id: ast::node_id) -> opt {
|
|||
}
|
||||
|
||||
type bind_map = [{ident: ast::ident, val: ValueRef}];
|
||||
fn assoc(key: str, list: bind_map) -> option<ValueRef> {
|
||||
fn assoc(key: ast::ident, list: bind_map) -> option<ValueRef> {
|
||||
for vec::each(list) {|elt|
|
||||
if str::eq(elt.ident, key) { ret some(elt.val); }
|
||||
if str::eq(*elt.ident, *key) { ret some(elt.val); }
|
||||
}
|
||||
ret none;
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ fn enter_rec(dm: def_map, m: match, col: uint, fields: [ast::ident],
|
|||
for vec::each(fields) {|fname|
|
||||
let mut pat = dummy;
|
||||
for vec::each(fpats) {|fpat|
|
||||
if str::eq(fpat.ident, fname) { pat = fpat.pat; break; }
|
||||
if str::eq(*fpat.ident, *fname) { pat = fpat.pat; break; }
|
||||
}
|
||||
pats += [pat];
|
||||
}
|
||||
|
|
@ -287,12 +287,12 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id,
|
|||
}
|
||||
|
||||
fn collect_record_fields(m: match, col: uint) -> [ast::ident] {
|
||||
let mut fields = [];
|
||||
let mut fields: [ast::ident] = [];
|
||||
for vec::each(m) {|br|
|
||||
alt br.pats[col].node {
|
||||
ast::pat_rec(fs, _) {
|
||||
for vec::each(fs) {|f|
|
||||
if !vec::any(fields, bind str::eq(f.ident, _)) {
|
||||
if !vec::any(fields, {|x| str::eq(*f.ident, *x)}) {
|
||||
fields += [f.ident];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -513,8 +513,8 @@ fn declare_tydesc(ccx: @crate_ctxt, t: ty::t) -> @tydesc_info {
|
|||
let mut name;
|
||||
//XXX this triggers duplicate LLVM symbols
|
||||
if false /*ccx.sess.opts.debuginfo*/ {
|
||||
name = mangle_internal_name_by_type_only(ccx, t, "tydesc");
|
||||
} else { name = mangle_internal_name_by_seq(ccx, "tydesc"); }
|
||||
name = mangle_internal_name_by_type_only(ccx, t, @"tydesc");
|
||||
} else { name = mangle_internal_name_by_seq(ccx, @"tydesc"); }
|
||||
note_unique_llvm_symbol(ccx, name);
|
||||
let gvar = str::as_c_str(name, {|buf|
|
||||
llvm::LLVMAddGlobal(ccx.llmod, ccx.tydesc_type, buf)
|
||||
|
|
@ -541,9 +541,9 @@ fn declare_generic_glue(ccx: @crate_ctxt, t: ty::t, llfnty: TypeRef,
|
|||
let mut fn_nm;
|
||||
//XXX this triggers duplicate LLVM symbols
|
||||
if false /*ccx.sess.opts.debuginfo*/ {
|
||||
fn_nm = mangle_internal_name_by_type_only(ccx, t, "glue_" + name);
|
||||
fn_nm = mangle_internal_name_by_type_only(ccx, t, @("glue_" + name));
|
||||
} else {
|
||||
fn_nm = mangle_internal_name_by_seq(ccx, "glue_" + name);
|
||||
fn_nm = mangle_internal_name_by_seq(ccx, @("glue_" + name));
|
||||
}
|
||||
note_unique_llvm_symbol(ccx, fn_nm);
|
||||
let llfn = decl_cdecl_fn(ccx.llmod, fn_nm, llfnty);
|
||||
|
|
@ -697,8 +697,8 @@ fn incr_refcnt_of_boxed(cx: block, box_ptr: ValueRef) {
|
|||
fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) {
|
||||
let _icx = bcx.insn_ctxt("make_visit_glue");
|
||||
let mut bcx = bcx;
|
||||
assert bcx.ccx().tcx.intrinsic_ifaces.contains_key("ty_visitor");
|
||||
let (iid, ty) = bcx.ccx().tcx.intrinsic_ifaces.get("ty_visitor");
|
||||
assert bcx.ccx().tcx.intrinsic_ifaces.contains_key(@"ty_visitor");
|
||||
let (iid, ty) = bcx.ccx().tcx.intrinsic_ifaces.get(@"ty_visitor");
|
||||
let v = PointerCast(bcx, v, T_ptr(type_of::type_of(bcx.ccx(), ty)));
|
||||
bcx = reflect::emit_calls_to_iface_visit_ty(bcx, t, v, iid);
|
||||
build_return(bcx);
|
||||
|
|
@ -1495,7 +1495,7 @@ fn trans_crate_lit(cx: @crate_ctxt, lit: ast::lit) -> ValueRef {
|
|||
// to actually generate from this?
|
||||
C_integral(T_int_ty(cx, t), i as u64, True)
|
||||
}
|
||||
ast::lit_float(fs, t) { C_floating(fs, T_float_ty(cx, t)) }
|
||||
ast::lit_float(fs, t) { C_floating(*fs, T_float_ty(cx, t)) }
|
||||
ast::lit_bool(b) { C_bool(b) }
|
||||
ast::lit_nil { C_nil() }
|
||||
ast::lit_str(s) {
|
||||
|
|
@ -2158,7 +2158,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, real_substs: [ty::t],
|
|||
ast_map::node_ctor(nm, _, ct, pt) { (pt, nm, alt ct {
|
||||
ast_map::res_ctor(_, _, sp) { sp }
|
||||
ast_map::class_ctor(ct_, _) { ct_.span }}) }
|
||||
ast_map::node_dtor(_, dtor, _, pt) {(pt, "drop", dtor.span)}
|
||||
ast_map::node_dtor(_, dtor, _, pt) {(pt, @"drop", dtor.span)}
|
||||
ast_map::node_expr(*) { ccx.tcx.sess.bug("Can't monomorphize an expr") }
|
||||
ast_map::node_export(*) {
|
||||
ccx.tcx.sess.bug("Can't monomorphize an export")
|
||||
|
|
@ -2184,7 +2184,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, real_substs: [ty::t],
|
|||
}
|
||||
ccx.monomorphizing.insert(fn_id, depth + 1u);
|
||||
|
||||
let pt = *pt + [path_name(ccx.names(name))];
|
||||
let pt = *pt + [path_name(@ccx.names(*name))];
|
||||
let s = mangle_exported_name(ccx, pt, mono_ty);
|
||||
|
||||
let mk_lldecl = {||
|
||||
|
|
@ -3382,7 +3382,7 @@ fn trans_rec(bcx: block, fields: [ast::field],
|
|||
let mut temp_cleanups = [];
|
||||
for fields.each {|fld|
|
||||
let ix = option::get(vec::position(ty_fields, {|ft|
|
||||
str::eq(fld.node.ident, ft.ident)
|
||||
str::eq(*fld.node.ident, *ft.ident)
|
||||
}));
|
||||
let dst = GEPi(bcx, addr, [0u, ix]);
|
||||
bcx = trans_expr_save_in(bcx, fld.node.expr, dst);
|
||||
|
|
@ -3395,7 +3395,7 @@ fn trans_rec(bcx: block, fields: [ast::field],
|
|||
bcx = cx;
|
||||
// Copy over inherited fields
|
||||
for ty_fields.eachi {|i, tf|
|
||||
if !vec::any(fields, {|f| str::eq(f.node.ident, tf.ident)}) {
|
||||
if !vec::any(fields, {|f| str::eq(*f.node.ident, *tf.ident)}) {
|
||||
let dst = GEPi(bcx, addr, [0u, i]);
|
||||
let base = GEPi(bcx, base_val, [0u, i]);
|
||||
let val = load_if_immediate(bcx, base, tf.mt.ty);
|
||||
|
|
@ -3841,7 +3841,7 @@ fn trans_log(log_ex: @ast::expr, lvl: @ast::expr,
|
|||
ccx.module_data.get(modname)
|
||||
} else {
|
||||
let s = link::mangle_internal_name_by_path_and_seq(
|
||||
ccx, modpath, "loglevel");
|
||||
ccx, modpath, @"loglevel");
|
||||
let global = str::as_c_str(s, {|buf|
|
||||
llvm::LLVMAddGlobal(ccx.llmod, T_i32(), buf)
|
||||
});
|
||||
|
|
@ -4320,7 +4320,7 @@ fn alloc_local(cx: block, local: @ast::local) -> block {
|
|||
let val = alloc_ty(cx, t);
|
||||
if cx.sess().opts.debuginfo {
|
||||
option::iter(simple_name) {|name|
|
||||
str::as_c_str(name, {|buf|
|
||||
str::as_c_str(*name, {|buf|
|
||||
llvm::LLVMSetValueName(val, buf)
|
||||
});
|
||||
}
|
||||
|
|
@ -4604,7 +4604,7 @@ fn trans_enum_variant(ccx: @crate_ctxt, enum_id: ast::node_id,
|
|||
let fn_args = vec::map(variant.node.args, {|varg|
|
||||
{mode: ast::expl(ast::by_copy),
|
||||
ty: varg.ty,
|
||||
ident: "arg",
|
||||
ident: @"arg",
|
||||
id: varg.id}
|
||||
});
|
||||
let fcx = new_fn_ctxt_w_id(ccx, [], llfndecl, variant.node.id,
|
||||
|
|
@ -5122,7 +5122,7 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id) -> str {
|
|||
some(s) { s }
|
||||
none {
|
||||
let s = mangle_exported_name(ccx, path +
|
||||
[path_name(ccx.names("dtor"))], ty::node_id_to_type(ccx.tcx, id));
|
||||
[path_name(@ccx.names("dtor"))], ty::node_id_to_type(ccx.tcx, id));
|
||||
ccx.item_symbols.insert(id, s);
|
||||
s
|
||||
}
|
||||
|
|
@ -5164,7 +5164,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
|
|||
// def_ids otherwise -- one to identify the type, and one to
|
||||
// find the dtor symbol.
|
||||
let t = ty::node_id_to_type(ccx.tcx, dtor_id);
|
||||
register_fn_full(ccx, i.span, my_path + [path_name("dtor")],
|
||||
register_fn_full(ccx, i.span, my_path + [path_name(@"dtor")],
|
||||
i.id, t)
|
||||
}
|
||||
}
|
||||
|
|
@ -5172,7 +5172,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
|
|||
ast_map::node_method(m, impl_id, pth) {
|
||||
exprt = true;
|
||||
let mty = ty::node_id_to_type(ccx.tcx, id);
|
||||
let pth = *pth + [path_name(ccx.names("meth")),
|
||||
let pth = *pth + [path_name(@ccx.names("meth")),
|
||||
path_name(m.ident)];
|
||||
let llfn = register_fn_full(ccx, m.span, pth, id, mty);
|
||||
set_inline_hint_if_appr(m.attrs, llfn);
|
||||
|
|
@ -5248,7 +5248,7 @@ fn trans_constant(ccx: @crate_ctxt, it: @ast::item) {
|
|||
let path = item_path(ccx, it);
|
||||
for vec::each(variants) {|variant|
|
||||
let p = path + [path_name(variant.node.name),
|
||||
path_name("discrim")];
|
||||
path_name(@"discrim")];
|
||||
let s = mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx));
|
||||
let disr_val = vi[i].disr_val;
|
||||
note_unique_llvm_symbol(ccx, s);
|
||||
|
|
@ -5376,7 +5376,7 @@ fn decl_crate_map(sess: session::session, mapmeta: link_meta,
|
|||
let cstore = sess.cstore;
|
||||
while cstore::have_crate_data(cstore, n_subcrates) { n_subcrates += 1; }
|
||||
let mapname = if sess.building_library {
|
||||
mapmeta.name + "_" + mapmeta.vers + "_" + mapmeta.extras_hash
|
||||
*mapmeta.name + "_" + *mapmeta.vers + "_" + mapmeta.extras_hash
|
||||
} else { "toplevel" };
|
||||
let sym_name = "_rust_crate_map_" + mapname;
|
||||
let arrtype = T_array(int_type, n_subcrates as uint);
|
||||
|
|
@ -5395,8 +5395,8 @@ fn fill_crate_map(ccx: @crate_ctxt, map: ValueRef) {
|
|||
while cstore::have_crate_data(cstore, i) {
|
||||
let cdata = cstore::get_crate_data(cstore, i);
|
||||
let nm = "_rust_crate_map_" + cdata.name +
|
||||
"_" + cstore::get_crate_vers(cstore, i) +
|
||||
"_" + cstore::get_crate_hash(cstore, i);
|
||||
"_" + *cstore::get_crate_vers(cstore, i) +
|
||||
"_" + *cstore::get_crate_hash(cstore, i);
|
||||
let cr = str::as_c_str(nm, {|buf|
|
||||
llvm::LLVMAddGlobal(ccx.llmod, ccx.int_type, buf)
|
||||
});
|
||||
|
|
@ -5506,7 +5506,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
|
|||
// crashes if the module identifer is same as other symbols
|
||||
// such as a function name in the module.
|
||||
// 1. http://llvm.org/bugs/show_bug.cgi?id=11479
|
||||
let llmod_id = link_meta.name + ".rc";
|
||||
let llmod_id = *link_meta.name + ".rc";
|
||||
|
||||
let llmod = str::as_c_str(llmod_id, {|buf|
|
||||
llvm::LLVMModuleCreateWithNameInContext
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ fn trans_expr_fn(bcx: block,
|
|||
let ccx = bcx.ccx(), bcx = bcx;
|
||||
let fty = node_id_type(bcx, id);
|
||||
let llfnty = type_of_fn_from_ty(ccx, fty);
|
||||
let sub_path = bcx.fcx.path + [path_name("anon")];
|
||||
let sub_path = bcx.fcx.path + [path_name(@"anon")];
|
||||
let s = mangle_internal_name_by_path(ccx, sub_path);
|
||||
let llfn = decl_internal_cdecl_fn(ccx.llmod, s, llfnty);
|
||||
|
||||
|
|
@ -676,7 +676,7 @@ fn trans_bind_thunk(ccx: @crate_ctxt,
|
|||
// construct and return that thunk.
|
||||
|
||||
// Give the thunk a name, type, and value.
|
||||
let s = mangle_internal_name_by_path_and_seq(ccx, path, "thunk");
|
||||
let s = mangle_internal_name_by_path_and_seq(ccx, path, @"thunk");
|
||||
let llthunk_ty = get_pair_fn_ty(type_of(ccx, incoming_fty));
|
||||
let llthunk = decl_internal_cdecl_fn(ccx.llmod, s, llthunk_ty);
|
||||
|
||||
|
|
|
|||
|
|
@ -933,7 +933,7 @@ fn path_str(p: path) -> str {
|
|||
alt e { ast_map::path_name(s) | ast_map::path_mod(s) {
|
||||
if first { first = false; }
|
||||
else { r += "::"; }
|
||||
r += s;
|
||||
r += *s;
|
||||
} }
|
||||
}
|
||||
r
|
||||
|
|
@ -966,7 +966,7 @@ fn field_idx_strict(cx: ty::ctxt, sp: span, ident: ast::ident,
|
|||
-> uint {
|
||||
alt ty::field_idx(ident, fields) {
|
||||
none { cx.sess.span_bug(sp, #fmt("base expr doesn't appear to \
|
||||
have a field named %s", ident)); }
|
||||
have a field named %s", *ident)); }
|
||||
some(i) { i }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ fn create_record(cx: @crate_ctxt, t: ty::t, fields: [ast::ty_field],
|
|||
let field_t = ty::get_field(t, field.node.ident).mt.ty;
|
||||
let ty_md = create_ty(cx, field_t, field.node.mt.ty);
|
||||
let (size, align) = size_and_align_of(cx, field_t);
|
||||
add_member(scx, field.node.ident,
|
||||
add_member(scx, *field.node.ident,
|
||||
line_from_span(cx.sess.codemap, field.span) as int,
|
||||
size as int, align as int, ty_md.node);
|
||||
}
|
||||
|
|
@ -661,7 +661,7 @@ fn create_local_var(bcx: block, local: @ast::local)
|
|||
none { create_function(bcx.fcx).node }
|
||||
some(_) { create_block(bcx).node }
|
||||
};
|
||||
let mdnode = create_var(tg, context, name, filemd.node,
|
||||
let mdnode = create_var(tg, context, *name, filemd.node,
|
||||
loc.line as int, tymd.node);
|
||||
let mdval = @{node: mdnode, data: {id: local.node.id}};
|
||||
update_cache(cache, AutoVariableTag, local_var_metadata(mdval));
|
||||
|
|
@ -703,7 +703,7 @@ fn create_arg(bcx: block, arg: ast::arg, sp: span)
|
|||
let tymd = create_ty(cx, ty, arg.ty);
|
||||
let filemd = create_file(cx, loc.file.name);
|
||||
let context = create_function(bcx.fcx);
|
||||
let mdnode = create_var(tg, context.node, arg.ident, filemd.node,
|
||||
let mdnode = create_var(tg, context.node, *arg.ident, filemd.node,
|
||||
loc.line as int, tymd.node);
|
||||
let mdval = @{node: mdnode, data: {id: arg.id}};
|
||||
update_cache(cache, tg, argument_metadata(mdval));
|
||||
|
|
@ -769,10 +769,10 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
|
|||
ast_map::node_expr(expr) {
|
||||
alt expr.node {
|
||||
ast::expr_fn(_, decl, _, _) {
|
||||
(dbg_cx.names("fn"), decl.output, expr.id)
|
||||
(@dbg_cx.names("fn"), decl.output, expr.id)
|
||||
}
|
||||
ast::expr_fn_block(decl, _, _) {
|
||||
(dbg_cx.names("fn"), decl.output, expr.id)
|
||||
(@dbg_cx.names("fn"), decl.output, expr.id)
|
||||
}
|
||||
_ { fcx.ccx.sess.span_bug(expr.span, "create_function: \
|
||||
expected an expr_fn or fn_block here"); }
|
||||
|
|
@ -810,8 +810,8 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
|
|||
let fn_metadata = [lltag(SubprogramTag),
|
||||
llunused(),
|
||||
file_node,
|
||||
llstr(ident),
|
||||
llstr(ident), //XXX fully-qualified C++ name
|
||||
llstr(*ident),
|
||||
llstr(*ident), //XXX fully-qualified C++ name
|
||||
llstr(""), //XXX MIPS name?????
|
||||
file_node,
|
||||
lli32(loc.line as int),
|
||||
|
|
|
|||
|
|
@ -421,8 +421,8 @@ fn decl_x86_64_fn(tys: x86_64_tys,
|
|||
|
||||
fn link_name(i: @ast::native_item) -> str {
|
||||
alt attr::first_attr_value_str_by_name(i.attrs, "link_name") {
|
||||
none { ret i.ident; }
|
||||
option::some(ln) { ret ln; }
|
||||
none { ret *i.ident; }
|
||||
option::some(ln) { ret *ln; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -805,7 +805,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::native_item,
|
|||
let fcx = new_fn_ctxt_w_id(ccx, path, decl, item.id,
|
||||
some(substs), some(item.span));
|
||||
let mut bcx = top_scope_block(fcx, none), lltop = bcx.llbb;
|
||||
alt check item.ident {
|
||||
alt check *item.ident {
|
||||
"size_of" {
|
||||
let tp_ty = substs.tys[0];
|
||||
let lltp_ty = type_of::type_of(ccx, tp_ty);
|
||||
|
|
@ -913,7 +913,7 @@ fn trans_crust_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
|||
let _icx = ccx.insn_ctxt("native::crust::build_rust_fn");
|
||||
let t = ty::node_id_to_type(ccx.tcx, id);
|
||||
let ps = link::mangle_internal_name_by_path(
|
||||
ccx, path + [ast_map::path_name("__rust_abi")]);
|
||||
ccx, path + [ast_map::path_name(@"__rust_abi")]);
|
||||
let llty = type_of_fn_from_ty(ccx, t);
|
||||
let llfndecl = decl_internal_cdecl_fn(ccx.llmod, ps, llty);
|
||||
trans_fn(ccx, path, decl, body, llfndecl, no_self, none, id);
|
||||
|
|
@ -950,7 +950,7 @@ fn trans_crust_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
|||
}
|
||||
|
||||
let shim_name = link::mangle_internal_name_by_path(
|
||||
ccx, path + [ast_map::path_name("__rust_stack_shim")]);
|
||||
ccx, path + [ast_map::path_name(@"__rust_stack_shim")]);
|
||||
ret build_shim_fn_(ccx, shim_name, llrustfn, tys,
|
||||
lib::llvm::CCallConv,
|
||||
build_args, build_ret);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ impl methods for reflector {
|
|||
|
||||
fn visit(ty_name: str, args: [ValueRef]) {
|
||||
let tcx = self.bcx.tcx();
|
||||
let mth_idx = option::get(ty::method_idx("visit_" + ty_name,
|
||||
let mth_idx = option::get(ty::method_idx(@("visit_" + ty_name),
|
||||
*self.visitor_methods));
|
||||
let mth_ty = ty::mk_fn(tcx, self.visitor_methods[mth_idx].fty);
|
||||
let v = self.visitor_val;
|
||||
|
|
@ -142,7 +142,7 @@ impl methods for reflector {
|
|||
for fields.eachi {|i, field|
|
||||
self.bracketed_mt("rec_field", field.mt,
|
||||
[self.c_uint(i),
|
||||
self.c_slice(field.ident)]);
|
||||
self.c_slice(*field.ident)]);
|
||||
}
|
||||
self.visit("leave_rec", [self.c_uint(vec::len(fields))]);
|
||||
}
|
||||
|
|
@ -209,7 +209,7 @@ impl methods for reflector {
|
|||
for fields.eachi {|i, field|
|
||||
self.bracketed_mt("class_field", field.mt,
|
||||
[self.c_uint(i),
|
||||
self.c_slice(field.ident)]);
|
||||
self.c_slice(*field.ident)]);
|
||||
}
|
||||
self.visit("leave_class", [self.c_uint(vec::len(fields))]);
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ impl methods for reflector {
|
|||
let extra = [self.c_uint(i),
|
||||
self.c_int(v.disr_val),
|
||||
self.c_uint(vec::len(v.args)),
|
||||
self.c_slice(v.name)];
|
||||
self.c_slice(*v.name)];
|
||||
self.visit("enter_enum_variant", extra);
|
||||
for v.args.eachi {|j, a|
|
||||
self.bracketed_t("enum_variant_field", a,
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ fn gen_enum_shapes(ccx: @crate_ctxt) -> ValueRef {
|
|||
let variant_shape = shape_of_variant(ccx, v);
|
||||
add_substr(data, variant_shape);
|
||||
|
||||
let zname = str::bytes(v.name) + [0u8];
|
||||
let zname = str::bytes(*v.name) + [0u8];
|
||||
add_substr(data, zname);
|
||||
}
|
||||
enum_variants += [variants];
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ fn get_base_and_len(cx: block, v: ValueRef, e_ty: ty::t)
|
|||
}
|
||||
}
|
||||
|
||||
fn trans_estr(bcx: block, s: str, vstore: ast::vstore,
|
||||
fn trans_estr(bcx: block, s: @str, vstore: ast::vstore,
|
||||
dest: dest) -> block {
|
||||
let _icx = bcx.insn_ctxt("tvec::trans_estr");
|
||||
let ccx = bcx.ccx();
|
||||
|
|
@ -242,27 +242,27 @@ fn trans_estr(bcx: block, s: str, vstore: ast::vstore,
|
|||
ast::vstore_fixed(_)
|
||||
{
|
||||
// "hello"/_ => "hello"/5 => [i8 x 6] in llvm
|
||||
#debug("trans_estr: fixed: %s", s);
|
||||
C_postr(s)
|
||||
#debug("trans_estr: fixed: %s", *s);
|
||||
C_postr(*s)
|
||||
}
|
||||
|
||||
ast::vstore_slice(_) {
|
||||
// "hello" => (*i8, 6u) in llvm
|
||||
#debug("trans_estr: slice '%s'", s);
|
||||
C_estr_slice(ccx, s)
|
||||
#debug("trans_estr: slice '%s'", *s);
|
||||
C_estr_slice(ccx, *s)
|
||||
}
|
||||
|
||||
ast::vstore_uniq {
|
||||
let cs = PointerCast(bcx, C_cstr(ccx, s), T_ptr(T_i8()));
|
||||
let len = C_uint(ccx, str::len(s));
|
||||
let cs = PointerCast(bcx, C_cstr(ccx, *s), T_ptr(T_i8()));
|
||||
let len = C_uint(ccx, str::len(*s));
|
||||
let c = Call(bcx, ccx.upcalls.str_new_uniq, [cs, len]);
|
||||
PointerCast(bcx, c,
|
||||
T_unique_ptr(T_unique(ccx, T_vec(ccx, T_i8()))))
|
||||
}
|
||||
|
||||
ast::vstore_box {
|
||||
let cs = PointerCast(bcx, C_cstr(ccx, s), T_ptr(T_i8()));
|
||||
let len = C_uint(ccx, str::len(s));
|
||||
let cs = PointerCast(bcx, C_cstr(ccx, *s), T_ptr(T_i8()));
|
||||
let len = C_uint(ccx, str::len(*s));
|
||||
Call(bcx, ccx.upcalls.str_new_shared, [cs, len])
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
|
|||
}
|
||||
ast_map::node_native_item(i@@{node: native_item_fn(_, _), _}, abi, _) {
|
||||
if abi == native_abi_rust_intrinsic {
|
||||
let flags = alt check i.ident {
|
||||
let flags = alt check *i.ident {
|
||||
"visit_ty" { 3u }
|
||||
"size_of" | "pref_align_of" | "min_align_of" |
|
||||
"init" | "reinterpret_cast" { use_repr }
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ fn comma_str(args: [@constr_arg_use]) -> str {
|
|||
if comma { rslt += ", "; } else { comma = true; }
|
||||
alt a.node {
|
||||
carg_base { rslt += "*"; }
|
||||
carg_ident(i) { rslt += i.ident; }
|
||||
carg_ident(i) { rslt += *i.ident; }
|
||||
carg_lit(l) { rslt += lit_to_str(l); }
|
||||
}
|
||||
}
|
||||
|
|
@ -143,11 +143,11 @@ fn log_states_err(pp: pre_and_post_state) {
|
|||
log_cond_err(p2);
|
||||
}
|
||||
|
||||
fn print_ident(i: ident) { log(debug, " " + i + " "); }
|
||||
fn print_ident(i: ident) { log(debug, " " + *i + " "); }
|
||||
|
||||
fn print_idents(&idents: [ident]) {
|
||||
if vec::len::<ident>(idents) == 0u { ret; }
|
||||
log(debug, "an ident: " + vec::pop::<ident>(idents));
|
||||
log(debug, "an ident: " + *vec::pop::<ident>(idents));
|
||||
print_idents(idents);
|
||||
}
|
||||
|
||||
|
|
@ -500,7 +500,7 @@ fn constraints(fcx: fn_ctxt) -> [norm_constraint] {
|
|||
fn match_args(fcx: fn_ctxt, occs: @dvec<pred_args>,
|
||||
occ: [@constr_arg_use]) -> uint {
|
||||
#debug("match_args: looking at %s",
|
||||
constr_args_to_str(fn@(i: inst) -> str { ret i.ident; }, occ));
|
||||
constr_args_to_str(fn@(i: inst) -> str { ret *i.ident; }, occ));
|
||||
for (*occs).each {|pd|
|
||||
log(debug,
|
||||
"match_args: candidate " + pred_args_to_str(pd));
|
||||
|
|
@ -581,7 +581,7 @@ fn expr_to_constr(tcx: ty::ctxt, e: @expr) -> sp_constr {
|
|||
|
||||
fn pred_args_to_str(p: pred_args) -> str {
|
||||
"<" + uint::str(p.node.bit_num) + ", " +
|
||||
constr_args_to_str(fn@(i: inst) -> str { ret i.ident; }, p.node.args)
|
||||
constr_args_to_str(fn@(i: inst) -> str { ret *i.ident; }, p.node.args)
|
||||
+ ">"
|
||||
}
|
||||
|
||||
|
|
@ -695,7 +695,7 @@ fn insts_to_str(stuff: [constr_arg_general_<inst>]) -> str {
|
|||
rslt +=
|
||||
" " +
|
||||
alt i {
|
||||
carg_ident(p) { p.ident }
|
||||
carg_ident(p) { *p.ident }
|
||||
carg_base { "*" }
|
||||
carg_lit(_) { "[lit]" }
|
||||
} + " ";
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ fn mk_fn_info(ccx: crate_ctxt,
|
|||
used_vars: v,
|
||||
ignore: ignore};
|
||||
ccx.fm.insert(id, rslt);
|
||||
#debug("%s has %u constraints", name, num_constraints(rslt));
|
||||
#debug("%s has %u constraints", *name, num_constraints(rslt));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
|
|||
fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
|
||||
let stmt_ann = stmt_to_ann(fcx.ccx, *s);
|
||||
|
||||
#debug["[ %s ]", fcx.name];
|
||||
#debug["[ %s ]", *fcx.name];
|
||||
#debug["*At beginning: stmt = %s", stmt_to_str(*s)];
|
||||
#debug["*prestate = %s", tritv::to_str(stmt_ann.states.prestate)];
|
||||
#debug["*poststate = %s", tritv::to_str(stmt_ann.states.prestate)];
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ type ctxt =
|
|||
node_type_substs: hashmap<node_id, [t]>,
|
||||
|
||||
items: ast_map::map,
|
||||
intrinsic_ifaces: hashmap<str, (ast::def_id, t)>,
|
||||
intrinsic_ifaces: hashmap<ast::ident, (ast::def_id, t)>,
|
||||
freevars: freevars::freevar_map,
|
||||
tcache: type_cache,
|
||||
rcache: creader_cache,
|
||||
|
|
@ -322,7 +322,7 @@ enum region {
|
|||
enum bound_region {
|
||||
br_self, // The self region for classes, impls
|
||||
br_anon, // The anonymous region parameter for a given function.
|
||||
br_named(str) // A named region parameter.
|
||||
br_named(ast::ident) // A named region parameter.
|
||||
}
|
||||
|
||||
type opt_region = option<region>;
|
||||
|
|
@ -414,7 +414,7 @@ enum type_err {
|
|||
terr_constr_mismatch(@type_constr, @type_constr),
|
||||
terr_regions_differ(region, region),
|
||||
terr_vstores_differ(terr_vstore_kind, vstore, vstore),
|
||||
terr_in_field(@type_err, str),
|
||||
terr_in_field(@type_err, ast::ident),
|
||||
terr_sorts(t, t),
|
||||
terr_self_substs
|
||||
}
|
||||
|
|
@ -516,7 +516,7 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map,
|
|||
node_types: @smallintmap::mk(),
|
||||
node_type_substs: map::int_hash(),
|
||||
items: amap,
|
||||
intrinsic_ifaces: map::str_hash(),
|
||||
intrinsic_ifaces: map::box_str_hash(),
|
||||
freevars: freevars,
|
||||
tcache: ast_util::new_def_hash(),
|
||||
rcache: mk_rcache(),
|
||||
|
|
@ -1992,7 +1992,7 @@ fn hash_bound_region(br: bound_region) -> uint {
|
|||
alt br { // no idea if this is any good
|
||||
ty::br_self { 0u }
|
||||
ty::br_anon { 1u }
|
||||
ty::br_named(str) { str::hash(str) }
|
||||
ty::br_named(str) { str::hash(*str) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2298,7 +2298,7 @@ fn field_idx(id: ast::ident, fields: [field]) -> option<uint> {
|
|||
}
|
||||
|
||||
fn get_field(rec_ty: t, id: ast::ident) -> field {
|
||||
alt check vec::find(get_fields(rec_ty), {|f| str::eq(f.ident, id) }) {
|
||||
alt check vec::find(get_fields(rec_ty), {|f| str::eq(*f.ident, *id) }) {
|
||||
some(f) { f }
|
||||
}
|
||||
}
|
||||
|
|
@ -2490,8 +2490,8 @@ fn type_err_to_str(cx: ctxt, err: type_err) -> str {
|
|||
}
|
||||
terr_record_mutability { ret "record elements differ in mutability"; }
|
||||
terr_record_fields(e_fld, a_fld) {
|
||||
ret "expected a record with field `" + e_fld +
|
||||
"` but found one with field `" + a_fld + "`";
|
||||
ret "expected a record with field `" + *e_fld +
|
||||
"` but found one with field `" + *a_fld + "`";
|
||||
}
|
||||
terr_arg_count { ret "incorrect number of function parameters"; }
|
||||
terr_mode_mismatch(e_mode, a_mode) {
|
||||
|
|
@ -2521,7 +2521,7 @@ fn type_err_to_str(cx: ctxt, err: type_err) -> str {
|
|||
vstore_to_str(cx, a_vs));
|
||||
}
|
||||
terr_in_field(err, fname) {
|
||||
ret #fmt("in field `%s`, %s", fname, type_err_to_str(cx, *err));
|
||||
ret #fmt("in field `%s`, %s", *fname, type_err_to_str(cx, *err));
|
||||
}
|
||||
terr_sorts(exp, act) {
|
||||
ret #fmt("%s vs %s", ty_sort_str(cx, exp), ty_sort_str(cx, act));
|
||||
|
|
@ -2592,7 +2592,7 @@ fn ty_to_def_id(ty: t) -> option<ast::def_id> {
|
|||
}
|
||||
|
||||
// Enum information
|
||||
type variant_info = @{args: [t], ctor_ty: t, name: str,
|
||||
type variant_info = @{args: [t], ctor_ty: t, name: ast::ident,
|
||||
id: ast::def_id, disr_val: int};
|
||||
|
||||
fn substd_enum_variants(cx: ctxt,
|
||||
|
|
@ -2667,7 +2667,7 @@ fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
|
|||
*path + [ast_map::path_name(nm)]
|
||||
}
|
||||
ast_map::node_dtor(_, _, _, path) {
|
||||
*path + [ast_map::path_name("dtor")]
|
||||
*path + [ast_map::path_name(@"dtor")]
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2861,7 +2861,7 @@ fn lookup_class_method_by_name(cx:ctxt, did: ast::def_id, name: ident,
|
|||
}
|
||||
}
|
||||
cx.sess.span_fatal(sp, #fmt("Class doesn't have a method \
|
||||
named %s", name));
|
||||
named %s", *name));
|
||||
}
|
||||
else {
|
||||
csearch::get_class_method(cx.sess.cstore, did, name)
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ fn check_fn(ccx: @crate_ctxt,
|
|||
vec::iter2(arg_tys, decl.inputs) {|arg_ty, input|
|
||||
assign(input.id, some(arg_ty));
|
||||
#debug["Argument %s is assigned to %s",
|
||||
input.ident, fcx.locals.get(input.id).to_str()];
|
||||
*input.ident, fcx.locals.get(input.id).to_str()];
|
||||
}
|
||||
|
||||
// Add explicitly-declared locals.
|
||||
|
|
@ -284,7 +284,7 @@ fn check_fn(ccx: @crate_ctxt,
|
|||
if !pat_util::pat_is_variant(fcx.ccx.tcx.def_map, p) {
|
||||
assign(p.id, none);
|
||||
#debug["Pattern binding %s is assigned to %s",
|
||||
path.idents[0],
|
||||
*path.idents[0],
|
||||
fcx.locals.get(p.id).to_str()];
|
||||
}
|
||||
_ {}
|
||||
|
|
@ -443,13 +443,13 @@ impl of region_scope for @fn_ctxt {
|
|||
fn anon_region() -> result<ty::region, str> {
|
||||
result::ok(self.infcx.next_region_var())
|
||||
}
|
||||
fn named_region(id: str) -> result<ty::region, str> {
|
||||
fn named_region(id: ast::ident) -> result<ty::region, str> {
|
||||
empty_rscope.named_region(id).chain_err { |_e|
|
||||
alt self.in_scope_regions.find(ty::br_named(id)) {
|
||||
some(r) { result::ok(r) }
|
||||
none if id == "blk" { self.block_region() }
|
||||
none if *id == "blk" { self.block_region() }
|
||||
none {
|
||||
result::err(#fmt["named region `%s` not in scope here", id])
|
||||
result::err(#fmt["named region `%s` not in scope here", *id])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -937,7 +937,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
|||
self_expr: self_ex,
|
||||
borrow_scope: op_ex.id,
|
||||
node_id: callee_id,
|
||||
m_name: opname,
|
||||
m_name: @opname,
|
||||
self_ty: self_t,
|
||||
supplied_tps: [],
|
||||
include_private: false});
|
||||
|
|
@ -1113,7 +1113,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
|||
ast::expr_vstore(ev, vst) {
|
||||
let typ = alt ev.node {
|
||||
ast::expr_lit(@{node: ast::lit_str(s), span:_}) {
|
||||
let tt = ast_expr_vstore_to_vstore(fcx, ev, str::len(s), vst);
|
||||
let tt = ast_expr_vstore_to_vstore(fcx, ev, str::len(*s), vst);
|
||||
ty::mk_estr(tcx, tt)
|
||||
}
|
||||
ast::expr_vec(args, mutbl) {
|
||||
|
|
@ -1553,7 +1553,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
|||
for fields_t.each {|f|
|
||||
let mut found = false;
|
||||
for base_fields.each {|bf|
|
||||
if str::eq(f.node.ident, bf.ident) {
|
||||
if str::eq(*f.node.ident, *bf.ident) {
|
||||
demand::suptype(fcx, f.span, bf.mt.ty, f.node.mt.ty);
|
||||
found = true;
|
||||
}
|
||||
|
|
@ -1561,7 +1561,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
|||
if !found {
|
||||
tcx.sess.span_fatal(f.span,
|
||||
"unknown field in record update: " +
|
||||
f.node.ident);
|
||||
*f.node.ident);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1645,7 +1645,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
|||
let t_err = fcx.infcx.resolve_type_vars_if_possible(expr_t);
|
||||
let msg = #fmt["attempted access of field %s on type %s, but \
|
||||
no public field or method with that name was found",
|
||||
field, ty_to_str(tcx, t_err)];
|
||||
*field, ty_to_str(tcx, t_err)];
|
||||
tcx.sess.span_err(expr.span, msg);
|
||||
// NB: Adding a bogus type to allow typechecking to continue
|
||||
fcx.write_ty(id, fcx.infcx.next_ty_var());
|
||||
|
|
@ -1690,7 +1690,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
|||
self_expr: p,
|
||||
borrow_scope: expr.id,
|
||||
node_id: alloc_id,
|
||||
m_name: "alloc",
|
||||
m_name: @"alloc",
|
||||
self_ty: p_ty,
|
||||
supplied_tps: [],
|
||||
include_private: false});
|
||||
|
|
@ -2310,7 +2310,7 @@ fn check_bounds_are_used(ccx: @crate_ctxt,
|
|||
for tps_used.eachi { |i, b|
|
||||
if !b {
|
||||
ccx.tcx.sess.span_err(
|
||||
span, #fmt["Type parameter %s is unused.", tps[i].ident]);
|
||||
span, #fmt["Type parameter %s is unused.", *tps[i].ident]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2323,7 +2323,7 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) {
|
|||
{mode: ast::expl(m), ty: ty}
|
||||
}
|
||||
let tcx = ccx.tcx;
|
||||
let (n_tps, inputs, output) = alt it.ident {
|
||||
let (n_tps, inputs, output) = alt *it.ident {
|
||||
"size_of" |
|
||||
"pref_align_of" | "min_align_of" { (1u, [], ty::mk_uint(ccx.tcx)) }
|
||||
"get_tydesc" { (1u, [], ty::mk_nil_ptr(tcx)) }
|
||||
|
|
@ -2337,8 +2337,8 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) {
|
|||
"needs_drop" { (1u, [], ty::mk_bool(tcx)) }
|
||||
|
||||
"visit_ty" {
|
||||
assert ccx.tcx.intrinsic_ifaces.contains_key("ty_visitor");
|
||||
let (_, visitor_iface) = ccx.tcx.intrinsic_ifaces.get("ty_visitor");
|
||||
assert ccx.tcx.intrinsic_ifaces.contains_key(@"ty_visitor");
|
||||
let (_, visitor_iface) = ccx.tcx.intrinsic_ifaces.get(@"ty_visitor");
|
||||
(1u, [arg(ast::by_ref, visitor_iface)], ty::mk_nil(tcx))
|
||||
}
|
||||
"frame_address" {
|
||||
|
|
|
|||
|
|
@ -191,8 +191,8 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
|||
fields",
|
||||
ex_f_count, f_count]);
|
||||
}
|
||||
fn matches(name: str, f: ty::field) -> bool {
|
||||
ret str::eq(name, f.ident);
|
||||
fn matches(name: ast::ident, f: ty::field) -> bool {
|
||||
ret str::eq(*name, *f.ident);
|
||||
}
|
||||
for fields.each {|f|
|
||||
alt vec::find(ex_fields, bind matches(f.ident, _)) {
|
||||
|
|
@ -203,7 +203,7 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
|||
tcx.sess.span_fatal(pat.span,
|
||||
#fmt["mismatched types: did not \
|
||||
expect a record with a field `%s`",
|
||||
f.ident]);
|
||||
*f.ident]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ impl methods for lookup {
|
|||
// Entrypoint:
|
||||
fn method() -> option<method_origin> {
|
||||
#debug["method lookup(m_name=%s, self_ty=%s)",
|
||||
self.m_name, self.fcx.infcx.ty_to_str(self.self_ty)];
|
||||
*self.m_name, self.fcx.infcx.ty_to_str(self.self_ty)];
|
||||
|
||||
// First, see whether this is an interface-bounded parameter
|
||||
let pass1 = alt ty::get(self.self_ty).struct {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ fn visit_pat(p: @ast::pat, &&rcx: rcx, v: rvt) {
|
|||
alt p.node {
|
||||
ast::pat_ident(path, _)
|
||||
if !pat_util::pat_is_variant(fcx.ccx.tcx.def_map, p) {
|
||||
#debug["visit_pat binding=%s", path.idents[0]];
|
||||
#debug["visit_pat binding=%s", *path.idents[0]];
|
||||
visit_node(p.id, p.span, rcx);
|
||||
}
|
||||
_ {}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) {
|
|||
// there ought to be a better approach. Attributes?
|
||||
|
||||
for crate.node.module.items.each {|crate_item|
|
||||
if crate_item.ident == "intrinsic" {
|
||||
if *crate_item.ident == "intrinsic" {
|
||||
alt crate_item.node {
|
||||
ast::item_mod(m) {
|
||||
for m.items.each {|intrinsic_item|
|
||||
|
|
@ -170,7 +170,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span,
|
|||
self_ty: ty::t) {
|
||||
|
||||
if impl_m.tps != if_m.tps {
|
||||
tcx.sess.span_err(sp, "method `" + if_m.ident +
|
||||
tcx.sess.span_err(sp, "method `" + *if_m.ident +
|
||||
"` has an incompatible set of type parameters");
|
||||
ret;
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span,
|
|||
if vec::len(impl_m.fty.inputs) != vec::len(if_m.fty.inputs) {
|
||||
tcx.sess.span_err(sp,#fmt["method `%s` has %u parameters \
|
||||
but the iface has %u",
|
||||
if_m.ident,
|
||||
*if_m.ident,
|
||||
vec::len(impl_m.fty.inputs),
|
||||
vec::len(if_m.fty.inputs)]);
|
||||
ret;
|
||||
|
|
@ -211,7 +211,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span,
|
|||
};
|
||||
require_same_types(
|
||||
tcx, sp, impl_fty, if_fty,
|
||||
{|| "method `" + if_m.ident + "` has an incompatible type"});
|
||||
{|| "method `" + *if_m.ident + "` has an incompatible type"});
|
||||
ret;
|
||||
|
||||
// Replaces bound references to the self region with `with_r`.
|
||||
|
|
@ -242,7 +242,7 @@ fn check_methods_against_iface(ccx: @crate_ctxt,
|
|||
ccx.tcx.sess.span_err(
|
||||
span, #fmt["method `%s`'s purity \
|
||||
not match the iface method's \
|
||||
purity", m.ident]);
|
||||
purity", *m.ident]);
|
||||
}
|
||||
compare_impl_method(
|
||||
ccx.tcx, span, m, vec::len(tps),
|
||||
|
|
@ -251,7 +251,7 @@ fn check_methods_against_iface(ccx: @crate_ctxt,
|
|||
none {
|
||||
tcx.sess.span_err(
|
||||
a_ifacety.path.span,
|
||||
#fmt["missing method `%s`", if_m.ident]);
|
||||
#fmt["missing method `%s`", *if_m.ident]);
|
||||
}
|
||||
} // alt
|
||||
} // |if_m|
|
||||
|
|
@ -511,7 +511,7 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item)
|
|||
rp: ast::rp_none, // functions do not have a self
|
||||
ty: ty::mk_fn(ccx.tcx, tofd)};
|
||||
#debug["type of %s (id %d) is %s",
|
||||
it.ident, it.id, ty_to_str(tcx, tpt.ty)];
|
||||
*it.ident, it.id, ty_to_str(tcx, tpt.ty)];
|
||||
ccx.tcx.tcache.insert(local_def(it.id), tpt);
|
||||
ret tpt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import result::result;
|
|||
|
||||
iface region_scope {
|
||||
fn anon_region() -> result<ty::region, str>;
|
||||
fn named_region(id: str) -> result<ty::region, str>;
|
||||
fn named_region(id: ast::ident) -> result<ty::region, str>;
|
||||
}
|
||||
|
||||
enum empty_rscope { empty_rscope }
|
||||
|
|
@ -10,8 +10,8 @@ impl of region_scope for empty_rscope {
|
|||
fn anon_region() -> result<ty::region, str> {
|
||||
result::err("region types are not allowed here")
|
||||
}
|
||||
fn named_region(id: str) -> result<ty::region, str> {
|
||||
if id == "static" { result::ok(ty::re_static) }
|
||||
fn named_region(id: ast::ident) -> result<ty::region, str> {
|
||||
if *id == "static" { result::ok(ty::re_static) }
|
||||
else { result::err("only the static region is allowed here") }
|
||||
}
|
||||
}
|
||||
|
|
@ -27,9 +27,9 @@ impl of region_scope for type_rscope {
|
|||
}
|
||||
}
|
||||
}
|
||||
fn named_region(id: str) -> result<ty::region, str> {
|
||||
fn named_region(id: ast::ident) -> result<ty::region, str> {
|
||||
empty_rscope.named_region(id).chain_err { |_e|
|
||||
if id == "self" { self.anon_region() }
|
||||
if *id == "self" { self.anon_region() }
|
||||
else {
|
||||
result::err("named regions other than `self` are not \
|
||||
allowed as part of a type declaration")
|
||||
|
|
@ -47,7 +47,7 @@ impl of region_scope for @anon_rscope {
|
|||
fn anon_region() -> result<ty::region, str> {
|
||||
result::ok(self.anon)
|
||||
}
|
||||
fn named_region(id: str) -> result<ty::region, str> {
|
||||
fn named_region(id: ast::ident) -> result<ty::region, str> {
|
||||
self.base.named_region(id)
|
||||
}
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ impl of region_scope for @binding_rscope {
|
|||
fn anon_region() -> result<ty::region, str> {
|
||||
result::ok(ty::re_bound(ty::br_anon))
|
||||
}
|
||||
fn named_region(id: str) -> result<ty::region, str> {
|
||||
fn named_region(id: ast::ident) -> result<ty::region, str> {
|
||||
self.base.named_region(id).chain_err {|_e|
|
||||
result::ok(ty::re_bound(ty::br_named(id)))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue