mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 04:08:40 +00:00
librustc: change driver::session::Session::str_of to return @~str
This commit is contained in:
parent
b90ccc9a38
commit
68746cd4fb
@ -655,7 +655,7 @@ pub fn mangle(sess: Session, ss: path) -> ~str {
|
|||||||
|
|
||||||
for ss.each |s| {
|
for ss.each |s| {
|
||||||
match *s { path_name(s) | path_mod(s) => {
|
match *s { path_name(s) | path_mod(s) => {
|
||||||
let sani = sanitize(sess.str_of(s));
|
let sani = sanitize(*sess.str_of(s));
|
||||||
n += fmt!("%u%s", str::len(sani), sani);
|
n += fmt!("%u%s", str::len(sani), sani);
|
||||||
} }
|
} }
|
||||||
}
|
}
|
||||||
|
@ -253,8 +253,8 @@ pub impl Session {
|
|||||||
self.debugging_opt(no_monomorphic_collapse)
|
self.debugging_opt(no_monomorphic_collapse)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn str_of(id: ast::ident) -> ~str {
|
fn str_of(id: ast::ident) -> @~str {
|
||||||
/*bad*/copy *self.parse_sess.interner.get(id)
|
self.parse_sess.interner.get(id)
|
||||||
}
|
}
|
||||||
fn ident_of(+st: ~str) -> ast::ident {
|
fn ident_of(+st: ~str) -> ast::ident {
|
||||||
self.parse_sess.interner.intern(@st)
|
self.parse_sess.interner.intern(@st)
|
||||||
|
@ -104,13 +104,13 @@ pub fn reachable(ecx: @encode_ctxt, id: node_id) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn encode_name(ecx: @encode_ctxt, ebml_w: writer::Encoder, name: ident) {
|
fn encode_name(ecx: @encode_ctxt, ebml_w: writer::Encoder, name: ident) {
|
||||||
ebml_w.wr_tagged_str(tag_paths_data_name, ecx.tcx.sess.str_of(name));
|
ebml_w.wr_tagged_str(tag_paths_data_name, *ecx.tcx.sess.str_of(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn encode_impl_type_basename(ecx: @encode_ctxt, ebml_w: writer::Encoder,
|
fn encode_impl_type_basename(ecx: @encode_ctxt, ebml_w: writer::Encoder,
|
||||||
name: ident) {
|
name: ident) {
|
||||||
ebml_w.wr_tagged_str(tag_item_impl_type_basename,
|
ebml_w.wr_tagged_str(tag_item_impl_type_basename,
|
||||||
ecx.tcx.sess.str_of(name));
|
*ecx.tcx.sess.str_of(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn encode_def_id(ebml_w: writer::Encoder, id: def_id) {
|
pub fn encode_def_id(ebml_w: writer::Encoder, id: def_id) {
|
||||||
@ -305,7 +305,7 @@ fn encode_path(ecx: @encode_ctxt, ebml_w: writer::Encoder,
|
|||||||
ast_map::path_name(name) => (tag_path_elt_name, name)
|
ast_map::path_name(name) => (tag_path_elt_name, name)
|
||||||
};
|
};
|
||||||
|
|
||||||
ebml_w.wr_tagged_str(tag, ecx.tcx.sess.str_of(name));
|
ebml_w.wr_tagged_str(tag, *ecx.tcx.sess.str_of(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
do ebml_w.wr_tag(tag_path) {
|
do ebml_w.wr_tag(tag_path) {
|
||||||
@ -333,7 +333,7 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: writer::Encoder,
|
|||||||
let (ident, did) = (item.ident, item.id);
|
let (ident, did) = (item.ident, item.id);
|
||||||
debug!("(encoding info for module) ... encoding impl %s \
|
debug!("(encoding info for module) ... encoding impl %s \
|
||||||
(%?/%?)",
|
(%?/%?)",
|
||||||
ecx.tcx.sess.str_of(ident),
|
*ecx.tcx.sess.str_of(ident),
|
||||||
did,
|
did,
|
||||||
ast_map::node_id_to_str(ecx.tcx.items, did, ecx.tcx
|
ast_map::node_id_to_str(ecx.tcx.items, did, ecx.tcx
|
||||||
.sess.parse_sess.interner));
|
.sess.parse_sess.interner));
|
||||||
@ -353,15 +353,15 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: writer::Encoder,
|
|||||||
match ecx.reexports2.find(&id) {
|
match ecx.reexports2.find(&id) {
|
||||||
Some(ref exports) => {
|
Some(ref exports) => {
|
||||||
debug!("(encoding info for module) found reexports for %d", id);
|
debug!("(encoding info for module) found reexports for %d", id);
|
||||||
for (*exports).each |exp| {
|
for exports.each |exp| {
|
||||||
debug!("(encoding info for module) reexport '%s' for %d",
|
debug!("(encoding info for module) reexport '%s' for %d",
|
||||||
exp.name, id);
|
*exp.name, id);
|
||||||
ebml_w.start_tag(tag_items_data_item_reexport);
|
ebml_w.start_tag(tag_items_data_item_reexport);
|
||||||
ebml_w.start_tag(tag_items_data_item_reexport_def_id);
|
ebml_w.start_tag(tag_items_data_item_reexport_def_id);
|
||||||
ebml_w.wr_str(def_to_str(exp.def_id));
|
ebml_w.wr_str(def_to_str(exp.def_id));
|
||||||
ebml_w.end_tag();
|
ebml_w.end_tag();
|
||||||
ebml_w.start_tag(tag_items_data_item_reexport_name);
|
ebml_w.start_tag(tag_items_data_item_reexport_name);
|
||||||
ebml_w.wr_str(exp.name);
|
ebml_w.wr_str(*exp.name);
|
||||||
ebml_w.end_tag();
|
ebml_w.end_tag();
|
||||||
ebml_w.end_tag();
|
ebml_w.end_tag();
|
||||||
}
|
}
|
||||||
@ -447,7 +447,7 @@ fn encode_info_for_struct(ecx: @encode_ctxt, ebml_w: writer::Encoder,
|
|||||||
global_index.push({val: id, pos: ebml_w.writer.tell()});
|
global_index.push({val: id, pos: ebml_w.writer.tell()});
|
||||||
ebml_w.start_tag(tag_items_data_item);
|
ebml_w.start_tag(tag_items_data_item);
|
||||||
debug!("encode_info_for_struct: doing %s %d",
|
debug!("encode_info_for_struct: doing %s %d",
|
||||||
tcx.sess.str_of(nm), id);
|
*tcx.sess.str_of(nm), id);
|
||||||
encode_visibility(ebml_w, vis);
|
encode_visibility(ebml_w, vis);
|
||||||
encode_name(ecx, ebml_w, nm);
|
encode_name(ecx, ebml_w, nm);
|
||||||
encode_path(ecx, ebml_w, path, ast_map::path_name(nm));
|
encode_path(ecx, ebml_w, path, ast_map::path_name(nm));
|
||||||
@ -470,7 +470,7 @@ fn encode_info_for_ctor(ecx: @encode_ctxt, ebml_w: writer::Encoder,
|
|||||||
encode_type_param_bounds(ebml_w, ecx, tps);
|
encode_type_param_bounds(ebml_w, ecx, tps);
|
||||||
let its_ty = node_id_to_type(ecx.tcx, id);
|
let its_ty = node_id_to_type(ecx.tcx, id);
|
||||||
debug!("fn name = %s ty = %s its node id = %d",
|
debug!("fn name = %s ty = %s its node id = %d",
|
||||||
ecx.tcx.sess.str_of(ident),
|
*ecx.tcx.sess.str_of(ident),
|
||||||
ty_to_str(ecx.tcx, its_ty), id);
|
ty_to_str(ecx.tcx, its_ty), id);
|
||||||
encode_type(ecx, ebml_w, its_ty);
|
encode_type(ecx, ebml_w, its_ty);
|
||||||
encode_path(ecx, ebml_w, path, ast_map::path_name(ident));
|
encode_path(ecx, ebml_w, path, ast_map::path_name(ident));
|
||||||
@ -515,7 +515,7 @@ fn encode_info_for_method(ecx: @encode_ctxt,
|
|||||||
m: @method,
|
m: @method,
|
||||||
+all_tps: ~[ty_param]) {
|
+all_tps: ~[ty_param]) {
|
||||||
debug!("encode_info_for_method: %d %s %u", m.id,
|
debug!("encode_info_for_method: %d %s %u", m.id,
|
||||||
ecx.tcx.sess.str_of(m.ident), all_tps.len());
|
*ecx.tcx.sess.str_of(m.ident), all_tps.len());
|
||||||
ebml_w.start_tag(tag_items_data_item);
|
ebml_w.start_tag(tag_items_data_item);
|
||||||
encode_def_id(ebml_w, local_def(m.id));
|
encode_def_id(ebml_w, local_def(m.id));
|
||||||
match m.self_ty.node {
|
match m.self_ty.node {
|
||||||
@ -678,7 +678,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: writer::Encoder,
|
|||||||
ebml_w,
|
ebml_w,
|
||||||
dtor.node.id,
|
dtor.node.id,
|
||||||
ecx.tcx.sess.ident_of(
|
ecx.tcx.sess.ident_of(
|
||||||
ecx.tcx.sess.str_of(item.ident) +
|
*ecx.tcx.sess.str_of(item.ident) +
|
||||||
~"_dtor"),
|
~"_dtor"),
|
||||||
path,
|
path,
|
||||||
if tps.len() > 0u {
|
if tps.len() > 0u {
|
||||||
@ -1186,7 +1186,7 @@ fn encode_crate_dep(ecx: @encode_ctxt, ebml_w: writer::Encoder,
|
|||||||
dep: decoder::crate_dep) {
|
dep: decoder::crate_dep) {
|
||||||
ebml_w.start_tag(tag_crate_dep);
|
ebml_w.start_tag(tag_crate_dep);
|
||||||
ebml_w.start_tag(tag_crate_dep_name);
|
ebml_w.start_tag(tag_crate_dep_name);
|
||||||
ebml_w.writer.write(str::to_bytes(ecx.tcx.sess.str_of(dep.name)));
|
ebml_w.writer.write(str::to_bytes(*ecx.tcx.sess.str_of(dep.name)));
|
||||||
ebml_w.end_tag();
|
ebml_w.end_tag();
|
||||||
ebml_w.start_tag(tag_crate_dep_vers);
|
ebml_w.start_tag(tag_crate_dep_vers);
|
||||||
ebml_w.writer.write(str::to_bytes(*dep.vers));
|
ebml_w.writer.write(str::to_bytes(*dep.vers));
|
||||||
|
@ -175,7 +175,7 @@ fn enc_bound_region(w: io::Writer, cx: @ctxt, br: ty::bound_region) {
|
|||||||
}
|
}
|
||||||
ty::br_named(s) => {
|
ty::br_named(s) => {
|
||||||
w.write_char('[');
|
w.write_char('[');
|
||||||
w.write_str(cx.tcx.sess.str_of(s));
|
w.write_str(*cx.tcx.sess.str_of(s));
|
||||||
w.write_char(']')
|
w.write_char(']')
|
||||||
}
|
}
|
||||||
ty::br_cap_avoid(id, br) => {
|
ty::br_cap_avoid(id, br) => {
|
||||||
@ -282,7 +282,7 @@ fn enc_sty(w: io::Writer, cx: @ctxt, +st: ty::sty) {
|
|||||||
ty::ty_rec(fields) => {
|
ty::ty_rec(fields) => {
|
||||||
w.write_str(&"R[");
|
w.write_str(&"R[");
|
||||||
for fields.each |field| {
|
for fields.each |field| {
|
||||||
w.write_str(cx.tcx.sess.str_of(field.ident));
|
w.write_str(*cx.tcx.sess.str_of(field.ident));
|
||||||
w.write_char('=');
|
w.write_char('=');
|
||||||
enc_mt(w, cx, field.mt);
|
enc_mt(w, cx, field.mt);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ pub fn encode_inlined_item(ecx: @e::encode_ctxt,
|
|||||||
maps: Maps) {
|
maps: Maps) {
|
||||||
debug!("> Encoding inlined item: %s::%s (%u)",
|
debug!("> Encoding inlined item: %s::%s (%u)",
|
||||||
ast_map::path_to_str(path, ecx.tcx.sess.parse_sess.interner),
|
ast_map::path_to_str(path, ecx.tcx.sess.parse_sess.interner),
|
||||||
ecx.tcx.sess.str_of(ii.ident()),
|
*ecx.tcx.sess.str_of(ii.ident()),
|
||||||
ebml_w.writer.tell());
|
ebml_w.writer.tell());
|
||||||
|
|
||||||
let id_range = ast_util::compute_id_range_for_inlined_item(ii);
|
let id_range = ast_util::compute_id_range_for_inlined_item(ii);
|
||||||
@ -108,7 +108,7 @@ pub fn encode_inlined_item(ecx: @e::encode_ctxt,
|
|||||||
|
|
||||||
debug!("< Encoded inlined fn: %s::%s (%u)",
|
debug!("< Encoded inlined fn: %s::%s (%u)",
|
||||||
ast_map::path_to_str(path, ecx.tcx.sess.parse_sess.interner),
|
ast_map::path_to_str(path, ecx.tcx.sess.parse_sess.interner),
|
||||||
ecx.tcx.sess.str_of(ii.ident()),
|
*ecx.tcx.sess.str_of(ii.ident()),
|
||||||
ebml_w.writer.tell());
|
ebml_w.writer.tell());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,10 +132,10 @@ pub fn decode_inlined_item(cdata: cstore::crate_metadata,
|
|||||||
to_id_range: to_id_range});
|
to_id_range: to_id_range});
|
||||||
let raw_ii = decode_ast(ast_doc);
|
let raw_ii = decode_ast(ast_doc);
|
||||||
let ii = renumber_ast(xcx, raw_ii);
|
let ii = renumber_ast(xcx, raw_ii);
|
||||||
debug!("Fn named: %s", tcx.sess.str_of(ii.ident()));
|
debug!("Fn named: %s", *tcx.sess.str_of(ii.ident()));
|
||||||
debug!("< Decoded inlined fn: %s::%s",
|
debug!("< Decoded inlined fn: %s::%s",
|
||||||
ast_map::path_to_str(path, tcx.sess.parse_sess.interner),
|
ast_map::path_to_str(path, tcx.sess.parse_sess.interner),
|
||||||
tcx.sess.str_of(ii.ident()));
|
*tcx.sess.str_of(ii.ident()));
|
||||||
ast_map::map_decoded_item(tcx.sess.diagnostic(),
|
ast_map::map_decoded_item(tcx.sess.diagnostic(),
|
||||||
dcx.tcx.items, path, ii);
|
dcx.tcx.items, path, ii);
|
||||||
decode_side_tables(xcx, ast_doc);
|
decode_side_tables(xcx, ast_doc);
|
||||||
|
@ -143,13 +143,13 @@ pub fn check_exhaustive(cx: @MatchCheckCtxt, sp: span, pats: ~[@pat]) {
|
|||||||
match ty::get(ty).sty {
|
match ty::get(ty).sty {
|
||||||
ty::ty_bool => {
|
ty::ty_bool => {
|
||||||
match (*ctor) {
|
match (*ctor) {
|
||||||
val(const_bool(true)) => Some(~"true"),
|
val(const_bool(true)) => Some(@~"true"),
|
||||||
val(const_bool(false)) => Some(~"false"),
|
val(const_bool(false)) => Some(@~"false"),
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::ty_enum(id, _) => {
|
ty::ty_enum(id, _) => {
|
||||||
let vid = match (*ctor) {
|
let vid = match *ctor {
|
||||||
variant(id) => id,
|
variant(id) => id,
|
||||||
_ => fail!(~"check_exhaustive: non-variant ctor"),
|
_ => fail!(~"check_exhaustive: non-variant ctor"),
|
||||||
};
|
};
|
||||||
@ -163,8 +163,8 @@ pub fn check_exhaustive(cx: @MatchCheckCtxt, sp: span, pats: ~[@pat]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::ty_unboxed_vec(*) | ty::ty_evec(*) => {
|
ty::ty_unboxed_vec(*) | ty::ty_evec(*) => {
|
||||||
match (*ctor) {
|
match *ctor {
|
||||||
vec(n) => Some(fmt!("vectors of length %u", n)),
|
vec(n) => Some(@fmt!("vectors of length %u", n)),
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ pub fn check_exhaustive(cx: @MatchCheckCtxt, sp: span, pats: ~[@pat]) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let msg = ~"non-exhaustive patterns" + match ext {
|
let msg = ~"non-exhaustive patterns" + match ext {
|
||||||
Some(ref s) => ~": " + (*s) + ~" not covered",
|
Some(ref s) => ~": " + **s + ~" not covered",
|
||||||
None => ~""
|
None => ~""
|
||||||
};
|
};
|
||||||
cx.tcx.sess.span_err(sp, msg);
|
cx.tcx.sess.span_err(sp, msg);
|
||||||
|
@ -383,11 +383,11 @@ impl IrMaps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn variable_name(&mut self, var: Variable) -> ~str {
|
fn variable_name(&mut self, var: Variable) -> @~str {
|
||||||
match copy self.var_kinds[*var] {
|
match copy self.var_kinds[*var] {
|
||||||
Local(LocalInfo {ident: nm, _}) |
|
Local(LocalInfo {ident: nm, _}) |
|
||||||
Arg(_, nm, _) => self.tcx.sess.str_of(nm),
|
Arg(_, nm, _) => self.tcx.sess.str_of(nm),
|
||||||
ImplicitRet => ~"<implicit-ret>"
|
ImplicitRet => @~"<implicit-ret>"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1777,7 +1777,7 @@ impl @Liveness {
|
|||||||
self.tcx.sess.span_err(
|
self.tcx.sess.span_err(
|
||||||
move_expr.span,
|
move_expr.span,
|
||||||
fmt!("illegal move from argument `%s`, which is not \
|
fmt!("illegal move from argument `%s`, which is not \
|
||||||
copy or move mode", self.tcx.sess.str_of(name)));
|
copy or move mode", *self.tcx.sess.str_of(name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Local(*) | ImplicitRet => {
|
Local(*) | ImplicitRet => {
|
||||||
@ -1798,7 +1798,7 @@ impl @Liveness {
|
|||||||
move_expr.span,
|
move_expr.span,
|
||||||
fmt!("`%s` moved into closure environment here \
|
fmt!("`%s` moved into closure environment here \
|
||||||
because its type is moved by default",
|
because its type is moved by default",
|
||||||
name));
|
*name));
|
||||||
}
|
}
|
||||||
expr_path(*) => {
|
expr_path(*) => {
|
||||||
self.report_illegal_read(
|
self.report_illegal_read(
|
||||||
@ -1838,7 +1838,7 @@ impl @Liveness {
|
|||||||
move_expr.span,
|
move_expr.span,
|
||||||
fmt!("%s`%s` moved here because %s has type %s, \
|
fmt!("%s`%s` moved here because %s has type %s, \
|
||||||
which is moved by default (use `copy` to override)",
|
which is moved by default (use `copy` to override)",
|
||||||
expr_descr, name, pronoun,
|
expr_descr, *name, pronoun,
|
||||||
ty_to_str(self.tcx, move_expr_ty)));
|
ty_to_str(self.tcx, move_expr_ty)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1858,12 +1858,12 @@ impl @Liveness {
|
|||||||
FreeVarNode(span) => {
|
FreeVarNode(span) => {
|
||||||
self.tcx.sess.span_err(
|
self.tcx.sess.span_err(
|
||||||
span,
|
span,
|
||||||
fmt!("capture of %s: `%s`", msg, name));
|
fmt!("capture of %s: `%s`", msg, *name));
|
||||||
}
|
}
|
||||||
ExprNode(span) => {
|
ExprNode(span) => {
|
||||||
self.tcx.sess.span_err(
|
self.tcx.sess.span_err(
|
||||||
span,
|
span,
|
||||||
fmt!("use of %s: `%s`", msg, name));
|
fmt!("use of %s: `%s`", msg, *name));
|
||||||
}
|
}
|
||||||
ExitNode | VarDefNode(_) => {
|
ExitNode | VarDefNode(_) => {
|
||||||
self.tcx.sess.span_bug(
|
self.tcx.sess.span_bug(
|
||||||
@ -1873,9 +1873,9 @@ impl @Liveness {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_warn(var: Variable) -> Option<~str> {
|
fn should_warn(var: Variable) -> Option<@~str> {
|
||||||
let name = self.ir.variable_name(var);
|
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(decl: fn_decl, entry_ln: LiveNode) {
|
fn warn_about_unused_args(decl: fn_decl, entry_ln: LiveNode) {
|
||||||
@ -1913,11 +1913,11 @@ impl @Liveness {
|
|||||||
// FIXME(#3266)--make liveness warnings lintable
|
// FIXME(#3266)--make liveness warnings lintable
|
||||||
self.tcx.sess.span_warn(
|
self.tcx.sess.span_warn(
|
||||||
sp, fmt!("variable `%s` is assigned to, \
|
sp, fmt!("variable `%s` is assigned to, \
|
||||||
but never used", *name));
|
but never used", **name));
|
||||||
} else {
|
} else {
|
||||||
// FIXME(#3266)--make liveness warnings lintable
|
// FIXME(#3266)--make liveness warnings lintable
|
||||||
self.tcx.sess.span_warn(
|
self.tcx.sess.span_warn(
|
||||||
sp, fmt!("unused variable: `%s`", *name));
|
sp, fmt!("unused variable: `%s`", **name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1931,7 +1931,7 @@ impl @Liveness {
|
|||||||
// FIXME(#3266)--make liveness warnings lintable
|
// FIXME(#3266)--make liveness warnings lintable
|
||||||
self.tcx.sess.span_warn(
|
self.tcx.sess.span_warn(
|
||||||
sp,
|
sp,
|
||||||
fmt!("value assigned to `%s` is never read", *name));
|
fmt!("value assigned to `%s` is never read", **name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -629,7 +629,7 @@ pub impl mem_categorization_ctxt {
|
|||||||
self.tcx.sess.span_bug(
|
self.tcx.sess.span_bug(
|
||||||
node.span(),
|
node.span(),
|
||||||
fmt!("Cannot find field `%s` in type `%s`",
|
fmt!("Cannot find field `%s` in type `%s`",
|
||||||
self.tcx.sess.str_of(f_name),
|
*self.tcx.sess.str_of(f_name),
|
||||||
ty_to_str(self.tcx, base_cmt.ty)));
|
ty_to_str(self.tcx, base_cmt.ty)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -995,7 +995,7 @@ pub impl mem_categorization_ctxt {
|
|||||||
self.ptr_sigil(ptr), derefs)
|
self.ptr_sigil(ptr), derefs)
|
||||||
}
|
}
|
||||||
cat_comp(cmt, comp) => {
|
cat_comp(cmt, comp) => {
|
||||||
fmt!("%s.%s", self.cat_to_repr(cmt.cat), self.comp_to_repr(comp))
|
fmt!("%s.%s", self.cat_to_repr(cmt.cat), *self.comp_to_repr(comp))
|
||||||
}
|
}
|
||||||
cat_discr(cmt, _) => self.cat_to_repr(cmt.cat)
|
cat_discr(cmt, _) => self.cat_to_repr(cmt.cat)
|
||||||
}
|
}
|
||||||
@ -1018,13 +1018,13 @@ pub impl mem_categorization_ctxt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn comp_to_repr(&self, comp: comp_kind) -> ~str {
|
fn comp_to_repr(&self, comp: comp_kind) -> @~str {
|
||||||
match comp {
|
match comp {
|
||||||
comp_field(fld, _) => self.tcx.sess.str_of(fld),
|
comp_field(fld, _) => self.tcx.sess.str_of(fld),
|
||||||
comp_index(*) => ~"[]",
|
comp_index(*) => @~"[]",
|
||||||
comp_tuple => ~"()",
|
comp_tuple => @~"()",
|
||||||
comp_anon_field => ~"<anonymous field>",
|
comp_anon_field => @~"<anonymous field>",
|
||||||
comp_variant(_) => ~"<enum>"
|
comp_variant(_) => @~"<enum>"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,7 +1043,7 @@ pub impl mem_categorization_ctxt {
|
|||||||
}
|
}
|
||||||
lp_comp(lp, comp) => {
|
lp_comp(lp, comp) => {
|
||||||
fmt!("%s.%s", self.lp_to_str(lp),
|
fmt!("%s.%s", self.lp_to_str(lp),
|
||||||
self.comp_to_repr(comp))
|
*self.comp_to_repr(comp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ pub type TraitMap = @HashMap<node_id,@DVec<def_id>>;
|
|||||||
pub type ExportMap2 = HashMap<node_id, ~[Export2]>;
|
pub type ExportMap2 = HashMap<node_id, ~[Export2]>;
|
||||||
|
|
||||||
pub struct Export2 {
|
pub struct Export2 {
|
||||||
name: ~str, // The name of the target.
|
name: @~str, // The name of the target.
|
||||||
def_id: def_id, // The definition of the target.
|
def_id: def_id, // The definition of the target.
|
||||||
reexport: bool, // Whether this is a reexport.
|
reexport: bool, // Whether this is a reexport.
|
||||||
}
|
}
|
||||||
@ -1006,12 +1006,12 @@ pub impl Resolver {
|
|||||||
self.session.span_err(sp,
|
self.session.span_err(sp,
|
||||||
fmt!("duplicate definition of %s %s",
|
fmt!("duplicate definition of %s %s",
|
||||||
namespace_to_str(ns),
|
namespace_to_str(ns),
|
||||||
self.session.str_of(name)));
|
*self.session.str_of(name)));
|
||||||
do child.span_for_namespace(ns).iter() |sp| {
|
do child.span_for_namespace(ns).iter() |sp| {
|
||||||
self.session.span_note(*sp,
|
self.session.span_note(*sp,
|
||||||
fmt!("first definition of %s %s here:",
|
fmt!("first definition of %s %s here:",
|
||||||
namespace_to_str(ns),
|
namespace_to_str(ns),
|
||||||
self.session.str_of(name)));
|
*self.session.str_of(name)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (child, new_parent);
|
return (child, new_parent);
|
||||||
@ -1549,7 +1549,7 @@ pub impl Resolver {
|
|||||||
fn handle_external_def(def: def,
|
fn handle_external_def(def: def,
|
||||||
modules: HashMap<def_id, @Module>,
|
modules: HashMap<def_id, @Module>,
|
||||||
child_name_bindings: @mut NameBindings,
|
child_name_bindings: @mut NameBindings,
|
||||||
final_ident: ~str,
|
final_ident: &str,
|
||||||
ident: ident,
|
ident: ident,
|
||||||
new_parent: ReducedGraphParent) {
|
new_parent: ReducedGraphParent) {
|
||||||
match def {
|
match def {
|
||||||
@ -1634,7 +1634,7 @@ pub impl Resolver {
|
|||||||
debug!("(building reduced graph for \
|
debug!("(building reduced graph for \
|
||||||
external crate) ... adding \
|
external crate) ... adding \
|
||||||
trait method '%s'",
|
trait method '%s'",
|
||||||
self.session.str_of(method_name));
|
*self.session.str_of(method_name));
|
||||||
|
|
||||||
// Add it to the trait info if not static.
|
// Add it to the trait info if not static.
|
||||||
if self_ty != sty_static {
|
if self_ty != sty_static {
|
||||||
@ -1741,7 +1741,8 @@ pub impl Resolver {
|
|||||||
self.handle_external_def(def,
|
self.handle_external_def(def,
|
||||||
modules,
|
modules,
|
||||||
child_name_bindings,
|
child_name_bindings,
|
||||||
self.session.str_of(final_ident),
|
*self.session.str_of(
|
||||||
|
final_ident),
|
||||||
final_ident,
|
final_ident,
|
||||||
new_parent);
|
new_parent);
|
||||||
}
|
}
|
||||||
@ -1759,7 +1760,8 @@ pub impl Resolver {
|
|||||||
debug!("(building reduced graph for \
|
debug!("(building reduced graph for \
|
||||||
external crate) processing \
|
external crate) processing \
|
||||||
static methods for type name %s",
|
static methods for type name %s",
|
||||||
self.session.str_of(final_ident));
|
*self.session.str_of(
|
||||||
|
final_ident));
|
||||||
|
|
||||||
let (child_name_bindings, new_parent) =
|
let (child_name_bindings, new_parent) =
|
||||||
self.add_child(final_ident,
|
self.add_child(final_ident,
|
||||||
@ -1805,7 +1807,7 @@ pub impl Resolver {
|
|||||||
debug!("(building reduced graph for \
|
debug!("(building reduced graph for \
|
||||||
external crate) creating \
|
external crate) creating \
|
||||||
static method '%s'",
|
static method '%s'",
|
||||||
self.session.str_of(ident));
|
*self.session.str_of(ident));
|
||||||
|
|
||||||
let (method_name_bindings, _) =
|
let (method_name_bindings, _) =
|
||||||
self.add_child(
|
self.add_child(
|
||||||
@ -1855,7 +1857,7 @@ pub impl Resolver {
|
|||||||
directive: privacy %? %s::%s",
|
directive: privacy %? %s::%s",
|
||||||
privacy,
|
privacy,
|
||||||
self.idents_to_str(module_path.get()),
|
self.idents_to_str(module_path.get()),
|
||||||
self.session.str_of(target));
|
*self.session.str_of(target));
|
||||||
|
|
||||||
match module_.import_resolutions.find(&target) {
|
match module_.import_resolutions.find(&target) {
|
||||||
Some(resolution) => {
|
Some(resolution) => {
|
||||||
@ -1971,8 +1973,8 @@ pub impl Resolver {
|
|||||||
// We presumably emitted an error. Continue.
|
// We presumably emitted an error. Continue.
|
||||||
let idents = import_directive.module_path.get();
|
let idents = import_directive.module_path.get();
|
||||||
let msg = fmt!("failed to resolve import: %s",
|
let msg = fmt!("failed to resolve import: %s",
|
||||||
self.import_path_to_str(idents,
|
*self.import_path_to_str(idents,
|
||||||
*import_directive.subclass));
|
*import_directive.subclass));
|
||||||
self.session.span_err(import_directive.span, msg);
|
self.session.span_err(import_directive.span, msg);
|
||||||
}
|
}
|
||||||
Indeterminate => {
|
Indeterminate => {
|
||||||
@ -1989,26 +1991,28 @@ pub impl Resolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn idents_to_str(idents: ~[ident]) -> ~str {
|
fn idents_to_str(idents: ~[ident]) -> ~str {
|
||||||
let ident_strs = idents.map(|&ident| self.session.str_of(ident));
|
let ident_strs = do idents.map |ident| {
|
||||||
return str::connect(ident_strs, "::");
|
/*bad*/ copy *self.session.str_of(*ident)
|
||||||
|
};
|
||||||
|
str::connect(ident_strs, "::")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn import_directive_subclass_to_str(subclass: ImportDirectiveSubclass)
|
fn import_directive_subclass_to_str(subclass: ImportDirectiveSubclass)
|
||||||
-> ~str {
|
-> @~str {
|
||||||
match subclass {
|
match subclass {
|
||||||
SingleImport(_target, source, _ns) => self.session.str_of(source),
|
SingleImport(_target, source, _ns) => self.session.str_of(source),
|
||||||
GlobImport => ~"*"
|
GlobImport => @~"*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn import_path_to_str(idents: ~[ident], subclass: ImportDirectiveSubclass)
|
fn import_path_to_str(idents: ~[ident], subclass: ImportDirectiveSubclass)
|
||||||
-> ~str {
|
-> @~str {
|
||||||
if idents.is_empty() {
|
if idents.is_empty() {
|
||||||
self.import_directive_subclass_to_str(subclass)
|
self.import_directive_subclass_to_str(subclass)
|
||||||
} else {
|
} else {
|
||||||
fmt!("%s::%s",
|
@fmt!("%s::%s",
|
||||||
self.idents_to_str(idents),
|
self.idents_to_str(idents),
|
||||||
self.import_directive_subclass_to_str(subclass))
|
*self.import_directive_subclass_to_str(subclass))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2122,9 +2126,9 @@ pub impl Resolver {
|
|||||||
|
|
||||||
debug!("(resolving single import) resolving `%s` = `%s::%s` from \
|
debug!("(resolving single import) resolving `%s` = `%s::%s` from \
|
||||||
`%s`",
|
`%s`",
|
||||||
self.session.str_of(target),
|
*self.session.str_of(target),
|
||||||
self.module_to_str(containing_module),
|
self.module_to_str(containing_module),
|
||||||
self.session.str_of(source),
|
*self.session.str_of(source),
|
||||||
self.module_to_str(module_));
|
self.module_to_str(module_));
|
||||||
|
|
||||||
// We need to resolve both namespaces for this to succeed.
|
// We need to resolve both namespaces for this to succeed.
|
||||||
@ -2314,9 +2318,9 @@ pub impl Resolver {
|
|||||||
|
|
||||||
debug!("(resolving single module import) resolving `%s` = `%s::%s` \
|
debug!("(resolving single module import) resolving `%s` = `%s::%s` \
|
||||||
from `%s`",
|
from `%s`",
|
||||||
self.session.str_of(target),
|
*self.session.str_of(target),
|
||||||
self.module_to_str(containing_module),
|
self.module_to_str(containing_module),
|
||||||
self.session.str_of(source),
|
*self.session.str_of(source),
|
||||||
self.module_to_str(module_));
|
self.module_to_str(module_));
|
||||||
|
|
||||||
// We need to resolve the module namespace for this to succeed.
|
// We need to resolve the module namespace for this to succeed.
|
||||||
@ -2527,7 +2531,7 @@ pub impl Resolver {
|
|||||||
|
|
||||||
debug!("(resolving glob import) writing resolution `%s` in `%s` \
|
debug!("(resolving glob import) writing resolution `%s` in `%s` \
|
||||||
to `%s`, privacy=%?",
|
to `%s`, privacy=%?",
|
||||||
self.session.str_of(ident),
|
*self.session.str_of(ident),
|
||||||
self.module_to_str(containing_module),
|
self.module_to_str(containing_module),
|
||||||
self.module_to_str(module_),
|
self.module_to_str(module_),
|
||||||
dest_import_resolution.privacy);
|
dest_import_resolution.privacy);
|
||||||
@ -2575,7 +2579,7 @@ pub impl Resolver {
|
|||||||
Indeterminate => {
|
Indeterminate => {
|
||||||
debug!("(resolving module path for import) module \
|
debug!("(resolving module path for import) module \
|
||||||
resolution is indeterminate: %s",
|
resolution is indeterminate: %s",
|
||||||
self.session.str_of(name));
|
*self.session.str_of(name));
|
||||||
return Indeterminate;
|
return Indeterminate;
|
||||||
}
|
}
|
||||||
Success(target) => {
|
Success(target) => {
|
||||||
@ -2589,7 +2593,7 @@ pub impl Resolver {
|
|||||||
self.session.span_err(span,
|
self.session.span_err(span,
|
||||||
fmt!("not a \
|
fmt!("not a \
|
||||||
module: %s",
|
module: %s",
|
||||||
self.session.
|
*self.session.
|
||||||
str_of(
|
str_of(
|
||||||
name)));
|
name)));
|
||||||
return Failed;
|
return Failed;
|
||||||
@ -2603,7 +2607,7 @@ pub impl Resolver {
|
|||||||
// There are no type bindings at all.
|
// There are no type bindings at all.
|
||||||
self.session.span_err(span,
|
self.session.span_err(span,
|
||||||
fmt!("not a module: %s",
|
fmt!("not a module: %s",
|
||||||
self.session.str_of(
|
*self.session.str_of(
|
||||||
name)));
|
name)));
|
||||||
return Failed;
|
return Failed;
|
||||||
}
|
}
|
||||||
@ -2709,7 +2713,7 @@ pub impl Resolver {
|
|||||||
|
|
||||||
debug!("(resolving item in lexical scope) resolving `%s` in \
|
debug!("(resolving item in lexical scope) resolving `%s` in \
|
||||||
namespace %? in `%s`",
|
namespace %? in `%s`",
|
||||||
self.session.str_of(name),
|
*self.session.str_of(name),
|
||||||
namespace,
|
namespace,
|
||||||
self.module_to_str(module_));
|
self.module_to_str(module_));
|
||||||
|
|
||||||
@ -2949,7 +2953,7 @@ pub impl Resolver {
|
|||||||
allow_globs: bool)
|
allow_globs: bool)
|
||||||
-> ResolveResult<Target> {
|
-> ResolveResult<Target> {
|
||||||
debug!("(resolving name in module) resolving `%s` in `%s`",
|
debug!("(resolving name in module) resolving `%s` in `%s`",
|
||||||
self.session.str_of(name),
|
*self.session.str_of(name),
|
||||||
self.module_to_str(module_));
|
self.module_to_str(module_));
|
||||||
|
|
||||||
// First, check the direct children of the module.
|
// First, check the direct children of the module.
|
||||||
@ -3003,7 +3007,7 @@ pub impl Resolver {
|
|||||||
|
|
||||||
// We're out of luck.
|
// We're out of luck.
|
||||||
debug!("(resolving name in module) failed to resolve %s",
|
debug!("(resolving name in module) failed to resolve %s",
|
||||||
self.session.str_of(name));
|
*self.session.str_of(name));
|
||||||
return Failed;
|
return Failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3032,8 +3036,8 @@ pub impl Resolver {
|
|||||||
|
|
||||||
debug!("(resolving one-level naming result) resolving import `%s` = \
|
debug!("(resolving one-level naming result) resolving import `%s` = \
|
||||||
`%s` in `%s`",
|
`%s` in `%s`",
|
||||||
self.session.str_of(target_name),
|
*self.session.str_of(target_name),
|
||||||
self.session.str_of(source_name),
|
*self.session.str_of(source_name),
|
||||||
self.module_to_str(module_));
|
self.module_to_str(module_));
|
||||||
|
|
||||||
// Find the matching items in the lexical scope chain for every
|
// Find the matching items in the lexical scope chain for every
|
||||||
@ -3154,7 +3158,7 @@ pub impl Resolver {
|
|||||||
debug!("(resolving one-level renaming import) writing module \
|
debug!("(resolving one-level renaming import) writing module \
|
||||||
result %? for `%s` into `%s`",
|
result %? for `%s` into `%s`",
|
||||||
is_none(&module_result),
|
is_none(&module_result),
|
||||||
self.session.str_of(target_name),
|
*self.session.str_of(target_name),
|
||||||
self.module_to_str(module_));
|
self.module_to_str(module_));
|
||||||
|
|
||||||
import_resolution.value_target = value_result;
|
import_resolution.value_target = value_result;
|
||||||
@ -3275,7 +3279,7 @@ pub impl Resolver {
|
|||||||
(Some(d), Some(Public)) => {
|
(Some(d), Some(Public)) => {
|
||||||
debug!("(computing exports) YES: %s '%s' => %?",
|
debug!("(computing exports) YES: %s '%s' => %?",
|
||||||
if reexport { ~"reexport" } else { ~"export"},
|
if reexport { ~"reexport" } else { ~"export"},
|
||||||
self.session.str_of(ident),
|
*self.session.str_of(ident),
|
||||||
def_id_of_def(d));
|
def_id_of_def(d));
|
||||||
exports2.push(Export2 {
|
exports2.push(Export2 {
|
||||||
reexport: reexport,
|
reexport: reexport,
|
||||||
@ -3295,7 +3299,7 @@ pub impl Resolver {
|
|||||||
fn add_exports_for_module(exports2: &mut ~[Export2], module_: @Module) {
|
fn add_exports_for_module(exports2: &mut ~[Export2], module_: @Module) {
|
||||||
for module_.children.each |ident, namebindings| {
|
for module_.children.each |ident, namebindings| {
|
||||||
debug!("(computing exports) maybe export '%s'",
|
debug!("(computing exports) maybe export '%s'",
|
||||||
self.session.str_of(*ident));
|
*self.session.str_of(*ident));
|
||||||
self.add_exports_of_namebindings(&mut *exports2,
|
self.add_exports_of_namebindings(&mut *exports2,
|
||||||
*ident,
|
*ident,
|
||||||
*namebindings,
|
*namebindings,
|
||||||
@ -3311,14 +3315,14 @@ pub impl Resolver {
|
|||||||
for module_.import_resolutions.each |ident, importresolution| {
|
for module_.import_resolutions.each |ident, importresolution| {
|
||||||
if importresolution.privacy != Public {
|
if importresolution.privacy != Public {
|
||||||
debug!("(computing exports) not reexporting private `%s`",
|
debug!("(computing exports) not reexporting private `%s`",
|
||||||
self.session.str_of(*ident));
|
*self.session.str_of(*ident));
|
||||||
loop;
|
loop;
|
||||||
}
|
}
|
||||||
for [ TypeNS, ValueNS ].each |ns| {
|
for [ TypeNS, ValueNS ].each |ns| {
|
||||||
match importresolution.target_for_namespace(*ns) {
|
match importresolution.target_for_namespace(*ns) {
|
||||||
Some(target) => {
|
Some(target) => {
|
||||||
debug!("(computing exports) maybe reexport '%s'",
|
debug!("(computing exports) maybe reexport '%s'",
|
||||||
self.session.str_of(*ident));
|
*self.session.str_of(*ident));
|
||||||
self.add_exports_of_namebindings(&mut *exports2,
|
self.add_exports_of_namebindings(&mut *exports2,
|
||||||
*ident,
|
*ident,
|
||||||
target.bindings,
|
target.bindings,
|
||||||
@ -3361,7 +3365,7 @@ pub impl Resolver {
|
|||||||
match orig_module.children.find(&name) {
|
match orig_module.children.find(&name) {
|
||||||
None => {
|
None => {
|
||||||
debug!("!!! (with scope) didn't find `%s` in `%s`",
|
debug!("!!! (with scope) didn't find `%s` in `%s`",
|
||||||
self.session.str_of(name),
|
*self.session.str_of(name),
|
||||||
self.module_to_str(orig_module));
|
self.module_to_str(orig_module));
|
||||||
}
|
}
|
||||||
Some(name_bindings) => {
|
Some(name_bindings) => {
|
||||||
@ -3369,7 +3373,7 @@ pub impl Resolver {
|
|||||||
None => {
|
None => {
|
||||||
debug!("!!! (with scope) didn't find module \
|
debug!("!!! (with scope) didn't find module \
|
||||||
for `%s` in `%s`",
|
for `%s` in `%s`",
|
||||||
self.session.str_of(name),
|
*self.session.str_of(name),
|
||||||
self.module_to_str(orig_module));
|
self.module_to_str(orig_module));
|
||||||
}
|
}
|
||||||
Some(module_) => {
|
Some(module_) => {
|
||||||
@ -3543,7 +3547,7 @@ pub impl Resolver {
|
|||||||
|
|
||||||
fn resolve_item(item: @item, visitor: ResolveVisitor) {
|
fn resolve_item(item: @item, visitor: ResolveVisitor) {
|
||||||
debug!("(resolving item) resolving %s",
|
debug!("(resolving item) resolving %s",
|
||||||
self.session.str_of(item.ident));
|
*self.session.str_of(item.ident));
|
||||||
|
|
||||||
// Items with the !resolve_unexported attribute are X-ray contexts.
|
// Items with the !resolve_unexported attribute are X-ray contexts.
|
||||||
// This is used to allow the test runner to run unexported tests.
|
// This is used to allow the test runner to run unexported tests.
|
||||||
@ -4105,7 +4109,7 @@ pub impl Resolver {
|
|||||||
p.span,
|
p.span,
|
||||||
fmt!("variable `%s` from pattern #1 is \
|
fmt!("variable `%s` from pattern #1 is \
|
||||||
not bound in pattern #%u",
|
not bound in pattern #%u",
|
||||||
self.session.str_of(key), i + 1));
|
*self.session.str_of(key), i + 1));
|
||||||
}
|
}
|
||||||
Some(binding_i) => {
|
Some(binding_i) => {
|
||||||
if binding_0.binding_mode != binding_i.binding_mode {
|
if binding_0.binding_mode != binding_i.binding_mode {
|
||||||
@ -4113,7 +4117,7 @@ pub impl Resolver {
|
|||||||
binding_i.span,
|
binding_i.span,
|
||||||
fmt!("variable `%s` is bound with different \
|
fmt!("variable `%s` is bound with different \
|
||||||
mode in pattern #%u than in pattern #1",
|
mode in pattern #%u than in pattern #1",
|
||||||
self.session.str_of(key), i + 1));
|
*self.session.str_of(key), i + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4125,7 +4129,7 @@ pub impl Resolver {
|
|||||||
binding.span,
|
binding.span,
|
||||||
fmt!("variable `%s` from pattern #%u is \
|
fmt!("variable `%s` from pattern #%u is \
|
||||||
not bound in pattern #1",
|
not bound in pattern #1",
|
||||||
self.session.str_of(key), i + 1));
|
*self.session.str_of(key), i + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4209,7 +4213,7 @@ pub impl Resolver {
|
|||||||
Some(def) => {
|
Some(def) => {
|
||||||
debug!("(resolving type) resolved `%s` to \
|
debug!("(resolving type) resolved `%s` to \
|
||||||
type %?",
|
type %?",
|
||||||
self.session.str_of(
|
*self.session.str_of(
|
||||||
path.idents.last()),
|
path.idents.last()),
|
||||||
def);
|
def);
|
||||||
result_def = Some(def);
|
result_def = Some(def);
|
||||||
@ -4278,7 +4282,7 @@ pub impl Resolver {
|
|||||||
if mode == RefutableMode => {
|
if mode == RefutableMode => {
|
||||||
debug!("(resolving pattern) resolving `%s` to \
|
debug!("(resolving pattern) resolving `%s` to \
|
||||||
struct or enum variant",
|
struct or enum variant",
|
||||||
self.session.str_of(ident));
|
*self.session.str_of(ident));
|
||||||
|
|
||||||
self.enforce_default_binding_mode(
|
self.enforce_default_binding_mode(
|
||||||
pattern,
|
pattern,
|
||||||
@ -4292,13 +4296,13 @@ pub impl Resolver {
|
|||||||
shadows an enum \
|
shadows an enum \
|
||||||
variant or unit-like \
|
variant or unit-like \
|
||||||
struct in scope",
|
struct in scope",
|
||||||
self.session
|
*self.session
|
||||||
.str_of(ident)));
|
.str_of(ident)));
|
||||||
}
|
}
|
||||||
FoundConst(def) if mode == RefutableMode => {
|
FoundConst(def) if mode == RefutableMode => {
|
||||||
debug!("(resolving pattern) resolving `%s` to \
|
debug!("(resolving pattern) resolving `%s` to \
|
||||||
constant",
|
constant",
|
||||||
self.session.str_of(ident));
|
*self.session.str_of(ident));
|
||||||
|
|
||||||
self.enforce_default_binding_mode(
|
self.enforce_default_binding_mode(
|
||||||
pattern,
|
pattern,
|
||||||
@ -4313,7 +4317,7 @@ pub impl Resolver {
|
|||||||
}
|
}
|
||||||
BareIdentifierPatternUnresolved => {
|
BareIdentifierPatternUnresolved => {
|
||||||
debug!("(resolving pattern) binding `%s`",
|
debug!("(resolving pattern) binding `%s`",
|
||||||
self.session.str_of(ident));
|
*self.session.str_of(ident));
|
||||||
|
|
||||||
let is_mutable = mutability == Mutable;
|
let is_mutable = mutability == Mutable;
|
||||||
|
|
||||||
@ -4395,7 +4399,7 @@ pub impl Resolver {
|
|||||||
self.session.span_err(
|
self.session.span_err(
|
||||||
path.span,
|
path.span,
|
||||||
fmt!("not an enum variant: %s",
|
fmt!("not an enum variant: %s",
|
||||||
self.session.str_of(
|
*self.session.str_of(
|
||||||
path.idents.last())));
|
path.idents.last())));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
@ -4736,7 +4740,7 @@ pub impl Resolver {
|
|||||||
Some(dl_def(def)) => {
|
Some(dl_def(def)) => {
|
||||||
debug!("(resolving path in local ribs) resolved `%s` to \
|
debug!("(resolving path in local ribs) resolved `%s` to \
|
||||||
local: %?",
|
local: %?",
|
||||||
self.session.str_of(ident),
|
*self.session.str_of(ident),
|
||||||
def);
|
def);
|
||||||
return Some(def);
|
return Some(def);
|
||||||
}
|
}
|
||||||
@ -4764,7 +4768,7 @@ pub impl Resolver {
|
|||||||
Some(def) => {
|
Some(def) => {
|
||||||
debug!("(resolving item path in lexical scope) \
|
debug!("(resolving item path in lexical scope) \
|
||||||
resolved `%s` to item",
|
resolved `%s` to item",
|
||||||
self.session.str_of(ident));
|
*self.session.str_of(ident));
|
||||||
return Some(def);
|
return Some(def);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4785,7 +4789,7 @@ pub impl Resolver {
|
|||||||
let rib = self.type_ribs.get_elt(i);
|
let rib = self.type_ribs.get_elt(i);
|
||||||
match rib.kind {
|
match rib.kind {
|
||||||
MethodRibKind(node_id, _) =>
|
MethodRibKind(node_id, _) =>
|
||||||
for vec::each(self.crate.node.module.items) |item| {
|
for self.crate.node.module.items.each |item| {
|
||||||
if item.id == node_id {
|
if item.id == node_id {
|
||||||
match item.node {
|
match item.node {
|
||||||
item_struct(class_def, _) => {
|
item_struct(class_def, _) => {
|
||||||
@ -4793,7 +4797,7 @@ pub impl Resolver {
|
|||||||
match field.node.kind {
|
match field.node.kind {
|
||||||
unnamed_field => {},
|
unnamed_field => {},
|
||||||
named_field(ident, _, _) => {
|
named_field(ident, _, _) => {
|
||||||
if str::eq_slice(self.session.str_of(ident),
|
if str::eq_slice(*self.session.str_of(ident),
|
||||||
name) {
|
name) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -4902,8 +4906,9 @@ pub impl Resolver {
|
|||||||
None =>
|
None =>
|
||||||
self.session.span_err(expr.span,
|
self.session.span_err(expr.span,
|
||||||
fmt!("use of undeclared label \
|
fmt!("use of undeclared label \
|
||||||
`%s`", self.session.str_of(
|
`%s`",
|
||||||
label))),
|
*self.session.str_of(
|
||||||
|
label))),
|
||||||
Some(dl_def(def @ def_label(_))) =>
|
Some(dl_def(def @ def_label(_))) =>
|
||||||
self.record_def(expr.id, def),
|
self.record_def(expr.id, def),
|
||||||
Some(_) =>
|
Some(_) =>
|
||||||
@ -4998,7 +5003,7 @@ pub impl Resolver {
|
|||||||
|
|
||||||
fn search_for_traits_containing_method(name: ident) -> @DVec<def_id> {
|
fn search_for_traits_containing_method(name: ident) -> @DVec<def_id> {
|
||||||
debug!("(searching for traits containing method) looking for '%s'",
|
debug!("(searching for traits containing method) looking for '%s'",
|
||||||
self.session.str_of(name));
|
*self.session.str_of(name));
|
||||||
|
|
||||||
let found_traits = @DVec();
|
let found_traits = @DVec();
|
||||||
let mut search_module = self.current_module;
|
let mut search_module = self.current_module;
|
||||||
@ -5094,7 +5099,7 @@ pub impl Resolver {
|
|||||||
for method '%s'",
|
for method '%s'",
|
||||||
trait_def_id.crate,
|
trait_def_id.crate,
|
||||||
trait_def_id.node,
|
trait_def_id.node,
|
||||||
self.session.str_of(name));
|
*self.session.str_of(name));
|
||||||
|
|
||||||
match self.trait_info.find(&trait_def_id) {
|
match self.trait_info.find(&trait_def_id) {
|
||||||
Some(trait_info) if trait_info.contains_key(&name) => {
|
Some(trait_info) if trait_info.contains_key(&name) => {
|
||||||
@ -5102,7 +5107,7 @@ pub impl Resolver {
|
|||||||
%d:%d for method '%s'",
|
%d:%d for method '%s'",
|
||||||
trait_def_id.crate,
|
trait_def_id.crate,
|
||||||
trait_def_id.node,
|
trait_def_id.node,
|
||||||
self.session.str_of(name));
|
*self.session.str_of(name));
|
||||||
(*found_traits).push(trait_def_id);
|
(*found_traits).push(trait_def_id);
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
@ -5289,7 +5294,7 @@ pub impl Resolver {
|
|||||||
|
|
||||||
debug!("Children:");
|
debug!("Children:");
|
||||||
for module_.children.each_key |&name| {
|
for module_.children.each_key |&name| {
|
||||||
debug!("* %s", self.session.str_of(name));
|
debug!("* %s", *self.session.str_of(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("Import resolutions:");
|
debug!("Import resolutions:");
|
||||||
@ -5312,7 +5317,7 @@ pub impl Resolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("* %s:%s%s", self.session.str_of(name),
|
debug!("* %s:%s%s", *self.session.str_of(name),
|
||||||
value_repr, type_repr);
|
value_repr, type_repr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1629,7 +1629,7 @@ pub fn trans_match_inner(scope_cx: block,
|
|||||||
// Special case for empty types
|
// Special case for empty types
|
||||||
let fail_cx = @mut None;
|
let fail_cx = @mut None;
|
||||||
let f: mk_fail = || mk_fail(scope_cx, discr_expr.span,
|
let f: mk_fail = || mk_fail(scope_cx, discr_expr.span,
|
||||||
~"scrutinizing value that can't exist", fail_cx);
|
@~"scrutinizing value that can't exist", fail_cx);
|
||||||
Some(f)
|
Some(f)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -1661,7 +1661,7 @@ pub fn trans_match_inner(scope_cx: block,
|
|||||||
bcx = controlflow::join_blocks(scope_cx, dvec::unwrap(arm_cxs));
|
bcx = controlflow::join_blocks(scope_cx, dvec::unwrap(arm_cxs));
|
||||||
return bcx;
|
return bcx;
|
||||||
|
|
||||||
fn mk_fail(bcx: block, sp: span, +msg: ~str,
|
fn mk_fail(bcx: block, sp: span, msg: @~str,
|
||||||
finished: @mut Option<BasicBlockRef>) -> BasicBlockRef {
|
finished: @mut Option<BasicBlockRef>) -> BasicBlockRef {
|
||||||
match *finished { Some(bb) => return bb, _ => () }
|
match *finished { Some(bb) => return bb, _ => () }
|
||||||
let fail_cx = sub_block(bcx, ~"case_fallthrough");
|
let fail_cx = sub_block(bcx, ~"case_fallthrough");
|
||||||
|
@ -521,7 +521,7 @@ pub fn compare_scalar_types(cx: block,
|
|||||||
rslt(
|
rslt(
|
||||||
controlflow::trans_fail(
|
controlflow::trans_fail(
|
||||||
cx, None,
|
cx, None,
|
||||||
~"attempt to compare values of type type"),
|
@~"attempt to compare values of type type"),
|
||||||
C_nil())
|
C_nil())
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
@ -639,7 +639,7 @@ pub fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
|
|||||||
_ => cx.tcx().sess.bug(fmt!("iter_variant: not a function type: \
|
_ => cx.tcx().sess.bug(fmt!("iter_variant: not a function type: \
|
||||||
%s (variant name = %s)",
|
%s (variant name = %s)",
|
||||||
cx.ty_to_str(fn_ty),
|
cx.ty_to_str(fn_ty),
|
||||||
cx.sess().str_of(variant.name)))
|
*cx.sess().str_of(variant.name)))
|
||||||
}
|
}
|
||||||
return cx;
|
return cx;
|
||||||
}
|
}
|
||||||
@ -776,7 +776,7 @@ pub fn fail_if_zero(cx: block, span: span, divmod: ast::binop,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
do with_cond(cx, is_zero) |bcx| {
|
do with_cond(cx, is_zero) |bcx| {
|
||||||
controlflow::trans_fail(bcx, Some(span), /*bad*/copy text)
|
controlflow::trans_fail(bcx, Some(span), @/*bad*/copy text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1037,20 +1037,20 @@ pub fn load_if_immediate(cx: block, v: ValueRef, t: ty::t) -> ValueRef {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn trans_trace(bcx: block, sp_opt: Option<span>, +trace_str: ~str) {
|
pub fn trans_trace(bcx: block, sp_opt: Option<span>, trace_str: ~str) {
|
||||||
if !bcx.sess().trace() { return; }
|
if !bcx.sess().trace() { return; }
|
||||||
let _icx = bcx.insn_ctxt("trans_trace");
|
let _icx = bcx.insn_ctxt("trans_trace");
|
||||||
add_comment(bcx, trace_str);
|
add_comment(bcx, /*bad*/ copy trace_str);
|
||||||
let V_trace_str = C_cstr(bcx.ccx(), trace_str);
|
let V_trace_str = C_cstr(bcx.ccx(), @/*bad*/ copy trace_str);
|
||||||
let {V_filename, V_line} = match sp_opt {
|
let {V_filename, V_line} = match sp_opt {
|
||||||
Some(sp) => {
|
Some(sp) => {
|
||||||
let sess = bcx.sess();
|
let sess = bcx.sess();
|
||||||
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
|
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
|
||||||
{V_filename: C_cstr(bcx.ccx(), /*bad*/copy loc.file.name),
|
{V_filename: C_cstr(bcx.ccx(), @/*bad*/copy loc.file.name),
|
||||||
V_line: loc.line as int}
|
V_line: loc.line as int}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
{V_filename: C_cstr(bcx.ccx(), ~"<runtime>"),
|
{V_filename: C_cstr(bcx.ccx(), @~"<runtime>"),
|
||||||
V_line: 0}
|
V_line: 0}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1170,7 +1170,7 @@ pub fn new_block(cx: fn_ctxt, parent: Option<block>, +kind: block_kind,
|
|||||||
special_idents::invalid
|
special_idents::invalid
|
||||||
};
|
};
|
||||||
unsafe {
|
unsafe {
|
||||||
let llbb: BasicBlockRef = str::as_c_str(cx.ccx.sess.str_of(s), |buf| {
|
let llbb = str::as_c_str(*cx.ccx.sess.str_of(s), |buf| {
|
||||||
llvm::LLVMAppendBasicBlock(cx.llfn, buf)
|
llvm::LLVMAppendBasicBlock(cx.llfn, buf)
|
||||||
});
|
});
|
||||||
let bcx = mk_block(llbb,
|
let bcx = mk_block(llbb,
|
||||||
@ -1401,7 +1401,7 @@ pub fn alloc_local(cx: block, local: @ast::local) -> block {
|
|||||||
let val = alloc_ty(cx, t);
|
let val = alloc_ty(cx, t);
|
||||||
if cx.sess().opts.debuginfo {
|
if cx.sess().opts.debuginfo {
|
||||||
do option::iter(&simple_name) |name| {
|
do option::iter(&simple_name) |name| {
|
||||||
str::as_c_str(cx.ccx().sess.str_of(*name), |buf| {
|
str::as_c_str(*cx.ccx().sess.str_of(*name), |buf| {
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMSetValueName(val, buf)
|
llvm::LLVMSetValueName(val, buf)
|
||||||
}
|
}
|
||||||
@ -2815,7 +2815,7 @@ pub fn create_module_map(ccx: @crate_ctxt) -> ValueRef {
|
|||||||
}
|
}
|
||||||
let mut elts: ~[ValueRef] = ~[];
|
let mut elts: ~[ValueRef] = ~[];
|
||||||
for ccx.module_data.each |&key, &val| {
|
for ccx.module_data.each |&key, &val| {
|
||||||
let elt = C_struct(~[p2i(ccx, C_cstr(ccx, key)),
|
let elt = C_struct(~[p2i(ccx, C_cstr(ccx, @/*bad*/ copy key)),
|
||||||
p2i(ccx, val)]);
|
p2i(ccx, val)]);
|
||||||
elts.push(elt);
|
elts.push(elt);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ pub struct crate_ctxt {
|
|||||||
// Cache generated vtables
|
// Cache generated vtables
|
||||||
vtables: HashMap<mono_id, ValueRef>,
|
vtables: HashMap<mono_id, ValueRef>,
|
||||||
// Cache of constant strings,
|
// Cache of constant strings,
|
||||||
const_cstr_cache: HashMap<~str, ValueRef>,
|
const_cstr_cache: HashMap<@~str, ValueRef>,
|
||||||
|
|
||||||
// Reverse-direction for const ptrs cast from globals.
|
// Reverse-direction for const ptrs cast from globals.
|
||||||
// Key is an int, cast from a ValueRef holding a *T,
|
// Key is an int, cast from a ValueRef holding a *T,
|
||||||
@ -1141,14 +1141,14 @@ pub fn C_u8(i: uint) -> ValueRef {
|
|||||||
|
|
||||||
// This is a 'c-like' raw string, which differs from
|
// This is a 'c-like' raw string, which differs from
|
||||||
// our boxed-and-length-annotated strings.
|
// our boxed-and-length-annotated strings.
|
||||||
pub fn C_cstr(cx: @crate_ctxt, s: ~str) -> ValueRef {
|
pub fn C_cstr(cx: @crate_ctxt, s: @~str) -> ValueRef {
|
||||||
unsafe {
|
unsafe {
|
||||||
match cx.const_cstr_cache.find(&s) {
|
match cx.const_cstr_cache.find(&s) {
|
||||||
Some(llval) => return llval,
|
Some(llval) => return llval,
|
||||||
None => ()
|
None => ()
|
||||||
}
|
}
|
||||||
|
|
||||||
let sc = do str::as_c_str(s) |buf| {
|
let sc = do str::as_c_str(*s) |buf| {
|
||||||
llvm::LLVMConstString(buf, s.len() as c_uint, False)
|
llvm::LLVMConstString(buf, s.len() as c_uint, False)
|
||||||
};
|
};
|
||||||
let g =
|
let g =
|
||||||
@ -1166,9 +1166,9 @@ pub fn C_cstr(cx: @crate_ctxt, s: ~str) -> ValueRef {
|
|||||||
|
|
||||||
// NB: Do not use `do_spill_noroot` to make this into a constant string, or
|
// NB: Do not use `do_spill_noroot` to make this into a constant string, or
|
||||||
// you will be kicked off fast isel. See issue #4352 for an example of this.
|
// you will be kicked off fast isel. See issue #4352 for an example of this.
|
||||||
pub fn C_estr_slice(cx: @crate_ctxt, +s: ~str) -> ValueRef {
|
pub fn C_estr_slice(cx: @crate_ctxt, s: @~str) -> ValueRef {
|
||||||
unsafe {
|
unsafe {
|
||||||
let len = str::len(s);
|
let len = s.len();
|
||||||
let cs = llvm::LLVMConstPointerCast(C_cstr(cx, s), T_ptr(T_i8()));
|
let cs = llvm::LLVMConstPointerCast(C_cstr(cx, s), T_ptr(T_i8()));
|
||||||
C_struct(~[cs, C_uint(cx, len + 1u /* +1 for null */)])
|
C_struct(~[cs, C_uint(cx, len + 1u /* +1 for null */)])
|
||||||
}
|
}
|
||||||
@ -1324,7 +1324,7 @@ pub fn path_str(sess: session::Session, p: path) -> ~str {
|
|||||||
ast_map::path_name(s) | ast_map::path_mod(s) => {
|
ast_map::path_name(s) | ast_map::path_mod(s) => {
|
||||||
if first { first = false; }
|
if first { first = false; }
|
||||||
else { r += ~"::"; }
|
else { r += ~"::"; }
|
||||||
r += sess.str_of(s);
|
r += *sess.str_of(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ pub fn const_lit(cx: @crate_ctxt, e: @ast::expr, lit: ast::lit)
|
|||||||
}
|
}
|
||||||
ast::lit_bool(b) => C_bool(b),
|
ast::lit_bool(b) => C_bool(b),
|
||||||
ast::lit_nil => C_nil(),
|
ast::lit_nil => C_nil(),
|
||||||
ast::lit_str(s) => C_estr_slice(cx, /*bad*/copy *s)
|
ast::lit_str(s) => C_estr_slice(cx, s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,8 +320,8 @@ pub fn trans_check_expr(bcx: block,
|
|||||||
s: ~str)
|
s: ~str)
|
||||||
-> block {
|
-> block {
|
||||||
let _icx = bcx.insn_ctxt("trans_check_expr");
|
let _icx = bcx.insn_ctxt("trans_check_expr");
|
||||||
let expr_str = s + ~" " + expr_to_str(pred_expr, bcx.ccx().sess.intr())
|
let expr_str = @(s + ~" " + expr_to_str(pred_expr, bcx.ccx().sess.intr())
|
||||||
+ ~" failed";
|
+ ~" failed");
|
||||||
let Result {bcx, val} = {
|
let Result {bcx, val} = {
|
||||||
do with_scope_result(bcx, chk_expr.info(), ~"check") |bcx| {
|
do with_scope_result(bcx, chk_expr.info(), ~"check") |bcx| {
|
||||||
expr::trans_to_datum(bcx, pred_expr).to_result()
|
expr::trans_to_datum(bcx, pred_expr).to_result()
|
||||||
@ -329,7 +329,7 @@ pub fn trans_check_expr(bcx: block,
|
|||||||
};
|
};
|
||||||
let val = bool_to_i1(bcx, val);
|
let val = bool_to_i1(bcx, val);
|
||||||
do with_cond(bcx, Not(bcx, val)) |bcx| {
|
do with_cond(bcx, Not(bcx, val)) |bcx| {
|
||||||
trans_fail(bcx, Some(pred_expr.span), /*bad*/copy expr_str)
|
trans_fail(bcx, Some(pred_expr.span), expr_str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,13 +356,13 @@ pub fn trans_fail_expr(bcx: block,
|
|||||||
ppaux::ty_to_str(tcx, arg_datum.ty));
|
ppaux::ty_to_str(tcx, arg_datum.ty));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => return trans_fail(bcx, sp_opt, ~"explicit failure")
|
_ => trans_fail(bcx, sp_opt, @~"explicit failure")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn trans_fail(bcx: block,
|
pub fn trans_fail(bcx: block,
|
||||||
sp_opt: Option<span>,
|
sp_opt: Option<span>,
|
||||||
+fail_str: ~str)
|
fail_str: @~str)
|
||||||
-> block {
|
-> block {
|
||||||
let _icx = bcx.insn_ctxt("trans_fail");
|
let _icx = bcx.insn_ctxt("trans_fail");
|
||||||
let V_fail_str = C_cstr(bcx.ccx(), fail_str);
|
let V_fail_str = C_cstr(bcx.ccx(), fail_str);
|
||||||
@ -379,11 +379,11 @@ fn trans_fail_value(bcx: block,
|
|||||||
Some(sp) => {
|
Some(sp) => {
|
||||||
let sess = bcx.sess();
|
let sess = bcx.sess();
|
||||||
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
|
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
|
||||||
{V_filename: C_cstr(bcx.ccx(), /*bad*/copy loc.file.name),
|
{V_filename: C_cstr(bcx.ccx(), @/*bad*/ copy loc.file.name),
|
||||||
V_line: loc.line as int}
|
V_line: loc.line as int}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
{V_filename: C_cstr(bcx.ccx(), ~"<runtime>"),
|
{V_filename: C_cstr(bcx.ccx(), @~"<runtime>"),
|
||||||
V_line: 0}
|
V_line: 0}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -403,7 +403,7 @@ pub fn trans_fail_bounds_check(bcx: block, sp: span,
|
|||||||
|
|
||||||
let loc = bcx.sess().parse_sess.cm.lookup_char_pos(sp.lo);
|
let loc = bcx.sess().parse_sess.cm.lookup_char_pos(sp.lo);
|
||||||
let line = C_int(ccx, loc.line as int);
|
let line = C_int(ccx, loc.line as int);
|
||||||
let filename_cstr = C_cstr(bcx.ccx(), /*bad*/copy loc.file.name);
|
let filename_cstr = C_cstr(bcx.ccx(), @/*bad*/copy loc.file.name);
|
||||||
let filename = PointerCast(bcx, filename_cstr, T_ptr(T_i8()));
|
let filename = PointerCast(bcx, filename_cstr, T_ptr(T_i8()));
|
||||||
|
|
||||||
let args = ~[filename, line, index, len];
|
let args = ~[filename, line, index, len];
|
||||||
|
@ -60,12 +60,12 @@ const DW_ATE_signed_char: int = 0x06;
|
|||||||
const DW_ATE_unsigned: int = 0x07;
|
const DW_ATE_unsigned: int = 0x07;
|
||||||
const DW_ATE_unsigned_char: int = 0x08;
|
const DW_ATE_unsigned_char: int = 0x08;
|
||||||
|
|
||||||
fn llstr(s: ~str) -> ValueRef {
|
fn llstr(s: &str) -> ValueRef {
|
||||||
str::as_c_str(s, |sbuf| {
|
do str::as_c_str(s) |sbuf| {
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMMDString(sbuf, str::len(s) as libc::c_uint)
|
llvm::LLVMMDString(sbuf, s.len() as libc::c_uint)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
fn lltag(lltag: int) -> ValueRef {
|
fn lltag(lltag: int) -> ValueRef {
|
||||||
lli32(LLVMDebugVersion | lltag)
|
lli32(LLVMDebugVersion | lltag)
|
||||||
@ -79,10 +79,9 @@ fn lli64(val: int) -> ValueRef {
|
|||||||
fn lli1(bval: bool) -> ValueRef {
|
fn lli1(bval: bool) -> ValueRef {
|
||||||
C_i1(bval)
|
C_i1(bval)
|
||||||
}
|
}
|
||||||
fn llmdnode(elems: ~[ValueRef]) -> ValueRef {
|
fn llmdnode(elems: &[ValueRef]) -> ValueRef {
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMMDNode(vec::raw::to_ptr(elems),
|
llvm::LLVMMDNode(vec::raw::to_ptr(elems), elems.len() as libc::c_uint)
|
||||||
vec::len(elems) as libc::c_uint)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn llunused() -> ValueRef {
|
fn llunused() -> ValueRef {
|
||||||
@ -205,7 +204,7 @@ fn create_compile_unit(cx: @crate_ctxt) -> @metadata<compile_unit_md> {
|
|||||||
let unit_metadata = ~[lltag(tg),
|
let unit_metadata = ~[lltag(tg),
|
||||||
llunused(),
|
llunused(),
|
||||||
lli32(DW_LANG_RUST),
|
lli32(DW_LANG_RUST),
|
||||||
llstr(copy crate_name),
|
llstr(crate_name),
|
||||||
llstr(work_dir),
|
llstr(work_dir),
|
||||||
llstr(env!("CFG_VERSION")),
|
llstr(env!("CFG_VERSION")),
|
||||||
lli1(true), // deprecated: main compile unit
|
lli1(true), // deprecated: main compile unit
|
||||||
@ -369,7 +368,7 @@ fn create_pointer_type(cx: @crate_ctxt, t: ty::t, span: span,
|
|||||||
|
|
||||||
struct StructCtxt {
|
struct StructCtxt {
|
||||||
file: ValueRef,
|
file: ValueRef,
|
||||||
name: ~str,
|
name: @~str,
|
||||||
line: int,
|
line: int,
|
||||||
members: ~[ValueRef],
|
members: ~[ValueRef],
|
||||||
total_size: int,
|
total_size: int,
|
||||||
@ -378,17 +377,17 @@ struct StructCtxt {
|
|||||||
|
|
||||||
fn finish_structure(cx: @mut StructCtxt) -> ValueRef {
|
fn finish_structure(cx: @mut StructCtxt) -> ValueRef {
|
||||||
return create_composite_type(StructureTypeTag,
|
return create_composite_type(StructureTypeTag,
|
||||||
/*bad*/copy cx.name,
|
*cx.name,
|
||||||
cx.file,
|
cx.file,
|
||||||
cx.line,
|
cx.line,
|
||||||
cx.total_size,
|
cx.total_size,
|
||||||
cx.align,
|
cx.align,
|
||||||
0,
|
0,
|
||||||
option::None,
|
None,
|
||||||
option::Some(/*bad*/copy cx.members));
|
Some(/*bad*/copy cx.members));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_structure(file: @metadata<file_md>, +name: ~str, line: int)
|
fn create_structure(file: @metadata<file_md>, name: @~str, line: int)
|
||||||
-> @mut StructCtxt {
|
-> @mut StructCtxt {
|
||||||
let cx = @mut StructCtxt {
|
let cx = @mut StructCtxt {
|
||||||
file: file.node,
|
file: file.node,
|
||||||
@ -401,7 +400,7 @@ fn create_structure(file: @metadata<file_md>, +name: ~str, line: int)
|
|||||||
return cx;
|
return cx;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_derived_type(type_tag: int, file: ValueRef, +name: ~str, line: int,
|
fn create_derived_type(type_tag: int, file: ValueRef, name: &str, line: int,
|
||||||
size: int, align: int, offset: int, ty: ValueRef)
|
size: int, align: int, offset: int, ty: ValueRef)
|
||||||
-> ValueRef {
|
-> ValueRef {
|
||||||
let lldata = ~[lltag(type_tag),
|
let lldata = ~[lltag(type_tag),
|
||||||
@ -418,14 +417,14 @@ fn create_derived_type(type_tag: int, file: ValueRef, +name: ~str, line: int,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn add_member(cx: @mut StructCtxt,
|
fn add_member(cx: @mut StructCtxt,
|
||||||
+name: ~str,
|
name: &str,
|
||||||
line: int,
|
line: int,
|
||||||
size: int,
|
size: int,
|
||||||
align: int,
|
align: int,
|
||||||
ty: ValueRef) {
|
ty: ValueRef) {
|
||||||
cx.members.push(create_derived_type(MemberTag, cx.file, name, line,
|
cx.members.push(create_derived_type(MemberTag, cx.file, name, line,
|
||||||
size * 8, align * 8, cx.total_size,
|
size * 8, align * 8, cx.total_size,
|
||||||
ty));
|
ty));
|
||||||
cx.total_size += size * 8;
|
cx.total_size += size * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +442,7 @@ fn create_record(cx: @crate_ctxt, t: ty::t, fields: ~[ast::ty_field],
|
|||||||
let field_t = ty::get_field(cx.tcx, t, field.node.ident).mt.ty;
|
let field_t = ty::get_field(cx.tcx, t, field.node.ident).mt.ty;
|
||||||
let ty_md = create_ty(cx, field_t, field.node.mt.ty);
|
let ty_md = create_ty(cx, field_t, field.node.mt.ty);
|
||||||
let (size, align) = size_and_align_of(cx, field_t);
|
let (size, align) = size_and_align_of(cx, field_t);
|
||||||
add_member(scx, cx.sess.str_of(field.node.ident),
|
add_member(scx, *cx.sess.str_of(field.node.ident),
|
||||||
line_from_span(cx.sess.codemap, field.span) as int,
|
line_from_span(cx.sess.codemap, field.span) as int,
|
||||||
size as int, align as int, ty_md.node);
|
size as int, align as int, ty_md.node);
|
||||||
}
|
}
|
||||||
@ -466,7 +465,8 @@ fn create_boxed_type(cx: @crate_ctxt, outer: ty::t, _inner: ty::t,
|
|||||||
//let cu_node = create_compile_unit_metadata(cx, fname);
|
//let cu_node = create_compile_unit_metadata(cx, fname);
|
||||||
let uint_t = ty::mk_uint(cx.tcx);
|
let uint_t = ty::mk_uint(cx.tcx);
|
||||||
let refcount_type = create_basic_type(cx, uint_t, span);
|
let refcount_type = create_basic_type(cx, uint_t, span);
|
||||||
let scx = create_structure(file_node, ty_to_str(cx.tcx, outer), 0);
|
let scx = create_structure(file_node,
|
||||||
|
@/*bad*/ copy ty_to_str(cx.tcx, outer), 0);
|
||||||
add_member(scx, ~"refcnt", 0, sys::size_of::<uint>() as int,
|
add_member(scx, ~"refcnt", 0, sys::size_of::<uint>() as int,
|
||||||
sys::min_align_of::<uint>() as int, refcount_type.node);
|
sys::min_align_of::<uint>() as int, refcount_type.node);
|
||||||
add_member(scx, ~"boxed", 0, 8, //XXX member_size_and_align(??)
|
add_member(scx, ~"boxed", 0, 8, //XXX member_size_and_align(??)
|
||||||
@ -479,7 +479,7 @@ fn create_boxed_type(cx: @crate_ctxt, outer: ty::t, _inner: ty::t,
|
|||||||
return mdval;
|
return mdval;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_composite_type(type_tag: int, +name: ~str, file: ValueRef,
|
fn create_composite_type(type_tag: int, name: &str, file: ValueRef,
|
||||||
line: int, size: int, align: int, offset: int,
|
line: int, size: int, align: int, offset: int,
|
||||||
derived: Option<ValueRef>,
|
derived: Option<ValueRef>,
|
||||||
+members: Option<~[ValueRef]>)
|
+members: Option<~[ValueRef]>)
|
||||||
@ -515,7 +515,8 @@ fn create_vec(cx: @crate_ctxt, vec_t: ty::t, elem_t: ty::t,
|
|||||||
let fname = filename_from_span(cx, vec_ty_span);
|
let fname = filename_from_span(cx, vec_ty_span);
|
||||||
let file_node = create_file(cx, fname);
|
let file_node = create_file(cx, fname);
|
||||||
let elem_ty_md = create_ty(cx, elem_t, elem_ty);
|
let elem_ty_md = create_ty(cx, elem_t, elem_ty);
|
||||||
let scx = create_structure(file_node, ty_to_str(cx.tcx, vec_t), 0);
|
let scx = create_structure(file_node,
|
||||||
|
@/*bad*/ copy ty_to_str(cx.tcx, vec_t), 0);
|
||||||
let size_t_type = create_basic_type(cx, ty::mk_uint(cx.tcx), vec_ty_span);
|
let size_t_type = create_basic_type(cx, ty::mk_uint(cx.tcx), vec_ty_span);
|
||||||
add_member(scx, ~"fill", 0, sys::size_of::<libc::size_t>() as int,
|
add_member(scx, ~"fill", 0, sys::size_of::<libc::size_t>() as int,
|
||||||
sys::min_align_of::<libc::size_t>() as int, size_t_type.node);
|
sys::min_align_of::<libc::size_t>() as int, size_t_type.node);
|
||||||
@ -525,8 +526,8 @@ fn create_vec(cx: @crate_ctxt, vec_t: ty::t, elem_t: ty::t,
|
|||||||
let (arr_size, arr_align) = size_and_align_of(cx, elem_t);
|
let (arr_size, arr_align) = size_and_align_of(cx, elem_t);
|
||||||
let data_ptr = create_composite_type(ArrayTypeTag, ~"", file_node.node, 0,
|
let data_ptr = create_composite_type(ArrayTypeTag, ~"", file_node.node, 0,
|
||||||
arr_size, arr_align, 0,
|
arr_size, arr_align, 0,
|
||||||
option::Some(elem_ty_md.node),
|
Some(elem_ty_md.node),
|
||||||
option::Some(~[subrange]));
|
Some(~[subrange]));
|
||||||
add_member(scx, ~"data", 0, 0, // clang says the size should be 0
|
add_member(scx, ~"data", 0, 0, // clang says the size should be 0
|
||||||
sys::min_align_of::<u8>() as int, data_ptr);
|
sys::min_align_of::<u8>() as int, data_ptr);
|
||||||
let llnode = finish_structure(scx);
|
let llnode = finish_structure(scx);
|
||||||
@ -641,7 +642,7 @@ fn filename_from_span(cx: @crate_ctxt, sp: codemap::span) -> ~str {
|
|||||||
/*bad*/copy cx.sess.codemap.lookup_char_pos(sp.lo).file.name
|
/*bad*/copy cx.sess.codemap.lookup_char_pos(sp.lo).file.name
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_var(type_tag: int, context: ValueRef, +name: ~str, file: ValueRef,
|
fn create_var(type_tag: int, context: ValueRef, name: &str, file: ValueRef,
|
||||||
line: int, ret_ty: ValueRef) -> ValueRef {
|
line: int, ret_ty: ValueRef) -> ValueRef {
|
||||||
let lldata = ~[lltag(type_tag),
|
let lldata = ~[lltag(type_tag),
|
||||||
context,
|
context,
|
||||||
@ -679,7 +680,7 @@ pub fn create_local_var(bcx: block, local: @ast::local)
|
|||||||
None => create_function(bcx.fcx).node,
|
None => create_function(bcx.fcx).node,
|
||||||
Some(_) => create_block(bcx).node
|
Some(_) => create_block(bcx).node
|
||||||
};
|
};
|
||||||
let mdnode = create_var(tg, context, cx.sess.str_of(name),
|
let mdnode = create_var(tg, context, *cx.sess.str_of(name),
|
||||||
filemd.node, loc.line as int, tymd.node);
|
filemd.node, loc.line as int, tymd.node);
|
||||||
let mdval = @{node: mdnode, data: {id: local.node.id}};
|
let mdval = @{node: mdnode, data: {id: local.node.id}};
|
||||||
update_cache(cache, AutoVariableTag, local_var_metadata(mdval));
|
update_cache(cache, AutoVariableTag, local_var_metadata(mdval));
|
||||||
@ -728,7 +729,7 @@ pub fn create_arg(bcx: block, arg: ast::arg, sp: span)
|
|||||||
// XXX: This is wrong; it should work for multiple bindings.
|
// XXX: This is wrong; it should work for multiple bindings.
|
||||||
let mdnode = create_var(tg,
|
let mdnode = create_var(tg,
|
||||||
context.node,
|
context.node,
|
||||||
cx.sess.str_of(path.idents.last()),
|
*cx.sess.str_of(path.idents.last()),
|
||||||
filemd.node,
|
filemd.node,
|
||||||
loc.line as int,
|
loc.line as int,
|
||||||
tymd.node);
|
tymd.node);
|
||||||
@ -839,9 +840,9 @@ pub fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
|
|||||||
let fn_metadata = ~[lltag(SubprogramTag),
|
let fn_metadata = ~[lltag(SubprogramTag),
|
||||||
llunused(),
|
llunused(),
|
||||||
file_node,
|
file_node,
|
||||||
llstr(cx.sess.str_of(ident)),
|
llstr(*cx.sess.str_of(ident)),
|
||||||
//XXX fully-qualified C++ name:
|
//XXX fully-qualified C++ name:
|
||||||
llstr(cx.sess.str_of(ident)),
|
llstr(*cx.sess.str_of(ident)),
|
||||||
llstr(~""), //XXX MIPS name?????
|
llstr(~""), //XXX MIPS name?????
|
||||||
file_node,
|
file_node,
|
||||||
lli32(loc.line as int),
|
lli32(loc.line as int),
|
||||||
|
@ -49,7 +49,7 @@ fn abi_info(arch: session::arch) -> cabi::ABIInfo {
|
|||||||
|
|
||||||
pub fn link_name(ccx: @crate_ctxt, i: @ast::foreign_item) -> @~str {
|
pub fn link_name(ccx: @crate_ctxt, i: @ast::foreign_item) -> @~str {
|
||||||
match attr::first_attr_value_str_by_name(i.attrs, ~"link_name") {
|
match attr::first_attr_value_str_by_name(i.attrs, ~"link_name") {
|
||||||
None => @ccx.sess.str_of(i.ident),
|
None => ccx.sess.str_of(i.ident),
|
||||||
Some(ln) => ln,
|
Some(ln) => ln,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,13 +334,13 @@ pub fn trans_intrinsic(ccx: @crate_ctxt,
|
|||||||
+path: ast_map::path,
|
+path: ast_map::path,
|
||||||
substs: @param_substs,
|
substs: @param_substs,
|
||||||
ref_id: Option<ast::node_id>) {
|
ref_id: Option<ast::node_id>) {
|
||||||
debug!("trans_intrinsic(item.ident=%s)", ccx.sess.str_of(item.ident));
|
debug!("trans_intrinsic(item.ident=%s)", *ccx.sess.str_of(item.ident));
|
||||||
|
|
||||||
// XXX: Bad copy.
|
// XXX: Bad copy.
|
||||||
let fcx = new_fn_ctxt_w_id(ccx, path, decl, item.id, None,
|
let fcx = new_fn_ctxt_w_id(ccx, path, decl, item.id, None,
|
||||||
Some(copy substs), Some(item.span));
|
Some(copy substs), Some(item.span));
|
||||||
let mut bcx = top_scope_block(fcx, None), lltop = bcx.llbb;
|
let mut bcx = top_scope_block(fcx, None), lltop = bcx.llbb;
|
||||||
match ccx.sess.str_of(item.ident) {
|
match *ccx.sess.str_of(item.ident) {
|
||||||
~"atomic_cxchg" => {
|
~"atomic_cxchg" => {
|
||||||
let old = AtomicCmpXchg(bcx,
|
let old = AtomicCmpXchg(bcx,
|
||||||
get_param(decl, first_real_arg),
|
get_param(decl, first_real_arg),
|
||||||
|
@ -150,7 +150,7 @@ pub fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint {
|
|||||||
});
|
});
|
||||||
|
|
||||||
debug!("static_size_of_enum: variant %s type %s",
|
debug!("static_size_of_enum: variant %s type %s",
|
||||||
cx.tcx.sess.str_of(variant.name),
|
*cx.tcx.sess.str_of(variant.name),
|
||||||
ty_str(cx.tn, T_struct(lltypes)));
|
ty_str(cx.tn, T_struct(lltypes)));
|
||||||
|
|
||||||
let this_size = llsize_of_real(cx, T_struct(lltypes));
|
let this_size = llsize_of_real(cx, T_struct(lltypes));
|
||||||
|
@ -322,7 +322,7 @@ pub fn trans_static_method_callee(bcx: block,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
debug!("trans_static_method_callee: method_id=%?, callee_id=%?, \
|
debug!("trans_static_method_callee: method_id=%?, callee_id=%?, \
|
||||||
name=%s", method_id, callee_id, ccx.sess.str_of(mname));
|
name=%s", method_id, callee_id, *ccx.sess.str_of(mname));
|
||||||
|
|
||||||
let vtbls = resolve_vtables_in_fn_ctxt(
|
let vtbls = resolve_vtables_in_fn_ctxt(
|
||||||
bcx.fcx, ccx.maps.vtable_map.get(&callee_id));
|
bcx.fcx, ccx.maps.vtable_map.get(&callee_id));
|
||||||
@ -794,10 +794,10 @@ pub fn make_vtable(ccx: @crate_ctxt, ptrs: ~[ValueRef]) -> ValueRef {
|
|||||||
unsafe {
|
unsafe {
|
||||||
let _icx = ccx.insn_ctxt("impl::make_vtable");
|
let _icx = ccx.insn_ctxt("impl::make_vtable");
|
||||||
let tbl = C_struct(ptrs);
|
let tbl = C_struct(ptrs);
|
||||||
let vt_gvar =
|
let vtable = ccx.sess.str_of((ccx.names)(~"vtable"));
|
||||||
str::as_c_str(ccx.sess.str_of((ccx.names)(~"vtable")), |buf| {
|
let vt_gvar = do str::as_c_str(*vtable) |buf| {
|
||||||
llvm::LLVMAddGlobal(ccx.llmod, val_ty(tbl), buf)
|
llvm::LLVMAddGlobal(ccx.llmod, val_ty(tbl), buf)
|
||||||
});
|
};
|
||||||
llvm::LLVMSetInitializer(vt_gvar, tbl);
|
llvm::LLVMSetInitializer(vt_gvar, tbl);
|
||||||
llvm::LLVMSetGlobalConstant(vt_gvar, lib::llvm::True);
|
llvm::LLVMSetGlobalConstant(vt_gvar, lib::llvm::True);
|
||||||
lib::llvm::SetLinkage(vt_gvar, lib::llvm::InternalLinkage);
|
lib::llvm::SetLinkage(vt_gvar, lib::llvm::InternalLinkage);
|
||||||
@ -825,11 +825,11 @@ pub fn make_impl_vtable(ccx: @crate_ctxt,
|
|||||||
ty::mk_bare_fn(tcx, copy im.fty));
|
ty::mk_bare_fn(tcx, copy im.fty));
|
||||||
if (*im.tps).len() > 0u || ty::type_has_self(fty) {
|
if (*im.tps).len() > 0u || ty::type_has_self(fty) {
|
||||||
debug!("(making impl vtable) method has self or type params: %s",
|
debug!("(making impl vtable) method has self or type params: %s",
|
||||||
tcx.sess.str_of(im.ident));
|
*tcx.sess.str_of(im.ident));
|
||||||
C_null(T_ptr(T_nil()))
|
C_null(T_ptr(T_nil()))
|
||||||
} else {
|
} else {
|
||||||
debug!("(making impl vtable) adding method to vtable: %s",
|
debug!("(making impl vtable) adding method to vtable: %s",
|
||||||
tcx.sess.str_of(im.ident));
|
*tcx.sess.str_of(im.ident));
|
||||||
let mut m_id = method_with_name(ccx, impl_id, im.ident);
|
let mut m_id = method_with_name(ccx, impl_id, im.ident);
|
||||||
if has_tps {
|
if has_tps {
|
||||||
// If the method is in another crate, need to make an inlined
|
// If the method is in another crate, need to make an inlined
|
||||||
|
@ -147,7 +147,7 @@ pub fn monomorphic_fn(ccx: @crate_ctxt,
|
|||||||
ccx.monomorphizing.insert(fn_id, depth + 1);
|
ccx.monomorphizing.insert(fn_id, depth + 1);
|
||||||
|
|
||||||
let pt = vec::append(/*bad*/copy *pt,
|
let pt = vec::append(/*bad*/copy *pt,
|
||||||
~[path_name((ccx.names)(ccx.sess.str_of(name)))]);
|
~[path_name((ccx.names)(*ccx.sess.str_of(name)))]);
|
||||||
let s = mangle_exported_name(ccx, /*bad*/copy pt, mono_ty);
|
let s = mangle_exported_name(ccx, /*bad*/copy pt, mono_ty);
|
||||||
|
|
||||||
let mk_lldecl = || {
|
let mk_lldecl = || {
|
||||||
|
@ -45,7 +45,7 @@ pub impl Reflector {
|
|||||||
C_int(self.bcx.ccx(), i)
|
C_int(self.bcx.ccx(), i)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c_slice(&mut self, s: &str) -> ValueRef {
|
fn c_slice(&mut self, s: @~str) -> ValueRef {
|
||||||
// We're careful to not use first class aggregates here because that
|
// We're careful to not use first class aggregates here because that
|
||||||
// will kick us off fast isel. (Issue #4352.)
|
// will kick us off fast isel. (Issue #4352.)
|
||||||
let bcx = self.bcx;
|
let bcx = self.bcx;
|
||||||
|
@ -263,7 +263,7 @@ pub fn trans_lit_str(bcx: block,
|
|||||||
unsafe {
|
unsafe {
|
||||||
let bytes = str_lit.len() + 1; // count null-terminator too
|
let bytes = str_lit.len() + 1; // count null-terminator too
|
||||||
let llbytes = C_uint(bcx.ccx(), bytes);
|
let llbytes = C_uint(bcx.ccx(), bytes);
|
||||||
let llcstr = C_cstr(bcx.ccx(), /*bad*/copy *str_lit);
|
let llcstr = C_cstr(bcx.ccx(), str_lit);
|
||||||
let llcstr = llvm::LLVMConstPointerCast(llcstr,
|
let llcstr = llvm::LLVMConstPointerCast(llcstr,
|
||||||
T_ptr(T_i8()));
|
T_ptr(T_i8()));
|
||||||
Store(bcx,
|
Store(bcx,
|
||||||
@ -299,7 +299,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: block,
|
|||||||
ast::expr_lit(@codemap::spanned {
|
ast::expr_lit(@codemap::spanned {
|
||||||
node: ast::lit_str(s), _
|
node: ast::lit_str(s), _
|
||||||
}) => {
|
}) => {
|
||||||
let llptrval = C_cstr(bcx.ccx(), copy *s);
|
let llptrval = C_cstr(bcx.ccx(), s);
|
||||||
let llptrval = PointerCast(bcx, llptrval, T_ptr(T_i8()));
|
let llptrval = PointerCast(bcx, llptrval, T_ptr(T_i8()));
|
||||||
let llsizeval = C_uint(bcx.ccx(), s.len());
|
let llsizeval = C_uint(bcx.ccx(), s.len());
|
||||||
let typ = ty::mk_estr(bcx.tcx(), ty::vstore_uniq);
|
let typ = ty::mk_estr(bcx.tcx(), ty::vstore_uniq);
|
||||||
@ -362,7 +362,7 @@ pub fn write_content(bcx: block,
|
|||||||
SaveIn(lldest) => {
|
SaveIn(lldest) => {
|
||||||
let bytes = s.len() + 1; // copy null-terminator too
|
let bytes = s.len() + 1; // copy null-terminator too
|
||||||
let llbytes = C_uint(bcx.ccx(), bytes);
|
let llbytes = C_uint(bcx.ccx(), bytes);
|
||||||
let llcstr = C_cstr(bcx.ccx(), /*bad*/copy *s);
|
let llcstr = C_cstr(bcx.ccx(), s);
|
||||||
base::call_memcpy(bcx, lldest, llcstr, llbytes);
|
base::call_memcpy(bcx, lldest, llcstr, llbytes);
|
||||||
return bcx;
|
return bcx;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ pub fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
|
|||||||
_ },
|
_ },
|
||||||
abi, _) => {
|
abi, _) => {
|
||||||
if abi == foreign_abi_rust_intrinsic {
|
if abi == foreign_abi_rust_intrinsic {
|
||||||
let flags = match cx.ccx.sess.str_of(i.ident) {
|
let flags = match *cx.ccx.sess.str_of(i.ident) {
|
||||||
~"size_of" | ~"pref_align_of" | ~"min_align_of" |
|
~"size_of" | ~"pref_align_of" | ~"min_align_of" |
|
||||||
~"init" | ~"reinterpret_cast" |
|
~"init" | ~"reinterpret_cast" |
|
||||||
~"move_val" | ~"move_val_init" => use_repr,
|
~"move_val" | ~"move_val_init" => use_repr,
|
||||||
|
@ -3226,7 +3226,7 @@ pub fn field_idx_strict(tcx: ty::ctxt, id: ast::ident, fields: &[field])
|
|||||||
for fields.each |f| { if f.ident == id { return i; } i += 1u; }
|
for fields.each |f| { if f.ident == id { return i; } i += 1u; }
|
||||||
tcx.sess.bug(fmt!(
|
tcx.sess.bug(fmt!(
|
||||||
"No field named `%s` found in the list of fields `%?`",
|
"No field named `%s` found in the list of fields `%?`",
|
||||||
tcx.sess.str_of(id),
|
*tcx.sess.str_of(id),
|
||||||
fields.map(|f| tcx.sess.str_of(f.ident))));
|
fields.map(|f| tcx.sess.str_of(f.ident))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3235,7 +3235,7 @@ pub fn get_field(tcx: ctxt, rec_ty: t, id: ast::ident) -> field {
|
|||||||
Some(f) => f,
|
Some(f) => f,
|
||||||
// Do we only call this when we know the field is legit?
|
// Do we only call this when we know the field is legit?
|
||||||
None => fail!(fmt!("get_field: ty doesn't have a field %s",
|
None => fail!(fmt!("get_field: ty doesn't have a field %s",
|
||||||
tcx.sess.str_of(id)))
|
*tcx.sess.str_of(id)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3465,8 +3465,8 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
|
|||||||
terr_record_fields(values) => {
|
terr_record_fields(values) => {
|
||||||
fmt!("expected a record with field `%s` but found one with field \
|
fmt!("expected a record with field `%s` but found one with field \
|
||||||
`%s`",
|
`%s`",
|
||||||
cx.sess.str_of(values.expected),
|
*cx.sess.str_of(values.expected),
|
||||||
cx.sess.str_of(values.found))
|
*cx.sess.str_of(values.found))
|
||||||
}
|
}
|
||||||
terr_arg_count => ~"incorrect number of function parameters",
|
terr_arg_count => ~"incorrect number of function parameters",
|
||||||
terr_mode_mismatch(values) => {
|
terr_mode_mismatch(values) => {
|
||||||
@ -3500,7 +3500,7 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
|
|||||||
vstore_to_str(cx, (*values).found))
|
vstore_to_str(cx, (*values).found))
|
||||||
}
|
}
|
||||||
terr_in_field(err, fname) => {
|
terr_in_field(err, fname) => {
|
||||||
fmt!("in field `%s`, %s", cx.sess.str_of(fname),
|
fmt!("in field `%s`, %s", *cx.sess.str_of(fname),
|
||||||
type_err_to_str(cx, err))
|
type_err_to_str(cx, err))
|
||||||
}
|
}
|
||||||
terr_sorts(values) => {
|
terr_sorts(values) => {
|
||||||
|
@ -231,7 +231,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt,
|
|||||||
tcx.sess.span_err(span,
|
tcx.sess.span_err(span,
|
||||||
fmt!("struct `%s` does not have a field
|
fmt!("struct `%s` does not have a field
|
||||||
named `%s`", name,
|
named `%s`", name,
|
||||||
tcx.sess.str_of(field.ident)));
|
*tcx.sess.str_of(field.ident)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt,
|
|||||||
}
|
}
|
||||||
tcx.sess.span_err(span,
|
tcx.sess.span_err(span,
|
||||||
fmt!("pattern does not mention field `%s`",
|
fmt!("pattern does not mention field `%s`",
|
||||||
tcx.sess.str_of(field.ident)));
|
*tcx.sess.str_of(field.ident)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,7 +436,7 @@ pub fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
|||||||
tcx.sess.span_fatal(pat.span,
|
tcx.sess.span_fatal(pat.span,
|
||||||
fmt!("mismatched types: did not \
|
fmt!("mismatched types: did not \
|
||||||
expect a record with a field `%s`",
|
expect a record with a field `%s`",
|
||||||
tcx.sess.str_of(f.ident)));
|
*tcx.sess.str_of(f.ident)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
|
|||||||
if pat_util::pat_is_binding(fcx.ccx.tcx.def_map, p) => {
|
if pat_util::pat_is_binding(fcx.ccx.tcx.def_map, p) => {
|
||||||
assign(p.id, None);
|
assign(p.id, None);
|
||||||
debug!("Pattern binding %s is assigned to %s",
|
debug!("Pattern binding %s is assigned to %s",
|
||||||
tcx.sess.str_of(path.idents[0]),
|
*tcx.sess.str_of(path.idents[0]),
|
||||||
fcx.infcx().ty_to_str(
|
fcx.infcx().ty_to_str(
|
||||||
fcx.inh.locals.get(&p.id)));
|
fcx.inh.locals.get(&p.id)));
|
||||||
}
|
}
|
||||||
@ -508,7 +508,7 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt,
|
|||||||
Some(orig_sp) => {
|
Some(orig_sp) => {
|
||||||
tcx.sess.span_err(sp, fmt!("Duplicate field \
|
tcx.sess.span_err(sp, fmt!("Duplicate field \
|
||||||
name %s in record type declaration",
|
name %s in record type declaration",
|
||||||
tcx.sess.str_of(id)));
|
*tcx.sess.str_of(id)));
|
||||||
tcx.sess.span_note(orig_sp, ~"First declaration of \
|
tcx.sess.span_note(orig_sp, ~"First declaration of \
|
||||||
this field occurred here");
|
this field occurred here");
|
||||||
break;
|
break;
|
||||||
@ -565,7 +565,7 @@ pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) {
|
|||||||
ast::item_impl(_, _, ty, ms) => {
|
ast::item_impl(_, _, ty, ms) => {
|
||||||
let rp = ccx.tcx.region_paramd_items.find(&it.id);
|
let rp = ccx.tcx.region_paramd_items.find(&it.id);
|
||||||
debug!("item_impl %s with id %d rp %?",
|
debug!("item_impl %s with id %d rp %?",
|
||||||
ccx.tcx.sess.str_of(it.ident), it.id, rp);
|
*ccx.tcx.sess.str_of(it.ident), it.id, rp);
|
||||||
let self_ty = ccx.to_ty(rscope::type_rscope(rp), ty);
|
let self_ty = ccx.to_ty(rscope::type_rscope(rp), ty);
|
||||||
for ms.each |m| {
|
for ms.each |m| {
|
||||||
check_method(ccx, *m, self_ty, local_def(it.id));
|
check_method(ccx, *m, self_ty, local_def(it.id));
|
||||||
@ -1370,7 +1370,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
fmt!("type `%s` does not implement any method in scope \
|
fmt!("type `%s` does not implement any method in scope \
|
||||||
named `%s`",
|
named `%s`",
|
||||||
actual,
|
actual,
|
||||||
fcx.ccx.tcx.sess.str_of(method_name))
|
*fcx.ccx.tcx.sess.str_of(method_name))
|
||||||
},
|
},
|
||||||
expr_t,
|
expr_t,
|
||||||
None);
|
None);
|
||||||
@ -1752,7 +1752,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
|actual| {
|
|actual| {
|
||||||
fmt!("attempted access of field `%s` on type `%s`, but \
|
fmt!("attempted access of field `%s` on type `%s`, but \
|
||||||
no field or method with that name was found",
|
no field or method with that name was found",
|
||||||
tcx.sess.str_of(field), actual)
|
*tcx.sess.str_of(field), actual)
|
||||||
},
|
},
|
||||||
expr_t, None);
|
expr_t, None);
|
||||||
// Add error type for the result
|
// Add error type for the result
|
||||||
@ -1790,13 +1790,13 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
field.span,
|
field.span,
|
||||||
fmt!("structure has no field named `%s`",
|
fmt!("structure has no field named `%s`",
|
||||||
tcx.sess.str_of(field.node.ident)));
|
*tcx.sess.str_of(field.node.ident)));
|
||||||
}
|
}
|
||||||
Some((_, true)) => {
|
Some((_, true)) => {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
field.span,
|
field.span,
|
||||||
fmt!("field `%s` specified more than once",
|
fmt!("field `%s` specified more than once",
|
||||||
tcx.sess.str_of(field.node.ident)));
|
*tcx.sess.str_of(field.node.ident)));
|
||||||
}
|
}
|
||||||
Some((field_id, false)) => {
|
Some((field_id, false)) => {
|
||||||
let expected_field_type =
|
let expected_field_type =
|
||||||
@ -1824,7 +1824,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
let (_, seen) = class_field_map.get(&name);
|
let (_, seen) = class_field_map.get(&name);
|
||||||
if !seen {
|
if !seen {
|
||||||
missing_fields.push(
|
missing_fields.push(
|
||||||
~"`" + tcx.sess.str_of(name) + ~"`");
|
~"`" + *tcx.sess.str_of(name) + ~"`");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2543,7 +2543,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
if !found {
|
if !found {
|
||||||
tcx.sess.span_err(f.span,
|
tcx.sess.span_err(f.span,
|
||||||
~"unknown field in record update: " +
|
~"unknown field in record update: " +
|
||||||
tcx.sess.str_of(f.node.ident));
|
*tcx.sess.str_of(f.node.ident));
|
||||||
fcx.write_ty(id, ty::mk_err(tcx));
|
fcx.write_ty(id, ty::mk_err(tcx));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3151,7 +3151,7 @@ pub fn check_bounds_are_used(ccx: @mut CrateCtxt,
|
|||||||
if !*b {
|
if !*b {
|
||||||
ccx.tcx.sess.span_err(
|
ccx.tcx.sess.span_err(
|
||||||
span, fmt!("type parameter `%s` is unused",
|
span, fmt!("type parameter `%s` is unused",
|
||||||
ccx.tcx.sess.str_of(tps[i].ident)));
|
*ccx.tcx.sess.str_of(tps[i].ident)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3164,7 +3164,7 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
|
|||||||
arg {mode: ast::expl(m), ty: ty}
|
arg {mode: ast::expl(m), ty: ty}
|
||||||
}
|
}
|
||||||
let tcx = ccx.tcx;
|
let tcx = ccx.tcx;
|
||||||
let (n_tps, inputs, output) = match ccx.tcx.sess.str_of(it.ident) {
|
let (n_tps, inputs, output) = match *ccx.tcx.sess.str_of(it.ident) {
|
||||||
~"size_of" |
|
~"size_of" |
|
||||||
~"pref_align_of" | ~"min_align_of" => (1u, ~[], ty::mk_uint(ccx.tcx)),
|
~"pref_align_of" | ~"min_align_of" => (1u, ~[], ty::mk_uint(ccx.tcx)),
|
||||||
~"init" => (1u, ~[], param(ccx, 0u)),
|
~"init" => (1u, ~[], param(ccx, 0u)),
|
||||||
|
@ -204,7 +204,7 @@ pub impl CoherenceChecker {
|
|||||||
visit_crate(*crate, (), mk_simple_visitor(@SimpleVisitor {
|
visit_crate(*crate, (), mk_simple_visitor(@SimpleVisitor {
|
||||||
visit_item: |item| {
|
visit_item: |item| {
|
||||||
debug!("(checking coherence) item '%s'",
|
debug!("(checking coherence) item '%s'",
|
||||||
self.crate_context.tcx.sess.str_of(item.ident));
|
*self.crate_context.tcx.sess.str_of(item.ident));
|
||||||
|
|
||||||
match item.node {
|
match item.node {
|
||||||
item_impl(_, opt_trait, _, _) => {
|
item_impl(_, opt_trait, _, _) => {
|
||||||
@ -245,7 +245,7 @@ pub impl CoherenceChecker {
|
|||||||
if associated_traits.len() == 0 {
|
if associated_traits.len() == 0 {
|
||||||
debug!("(checking implementation) no associated traits for item \
|
debug!("(checking implementation) no associated traits for item \
|
||||||
'%s'",
|
'%s'",
|
||||||
self.crate_context.tcx.sess.str_of(item.ident));
|
*self.crate_context.tcx.sess.str_of(item.ident));
|
||||||
|
|
||||||
match get_base_type_def_id(self.inference_context,
|
match get_base_type_def_id(self.inference_context,
|
||||||
item.span,
|
item.span,
|
||||||
@ -274,7 +274,7 @@ pub impl CoherenceChecker {
|
|||||||
ast_map::node_id_to_str(
|
ast_map::node_id_to_str(
|
||||||
self.crate_context.tcx.items, trait_did.node,
|
self.crate_context.tcx.items, trait_did.node,
|
||||||
self.crate_context.tcx.sess.parse_sess.interner),
|
self.crate_context.tcx.sess.parse_sess.interner),
|
||||||
self.crate_context.tcx.sess.str_of(item.ident));
|
*self.crate_context.tcx.sess.str_of(item.ident));
|
||||||
|
|
||||||
self.instantiate_default_methods(item.id, trait_did);
|
self.instantiate_default_methods(item.id, trait_did);
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ pub impl CoherenceChecker {
|
|||||||
// method to that entry.
|
// method to that entry.
|
||||||
debug!("(checking implementation) adding method `%s` \
|
debug!("(checking implementation) adding method `%s` \
|
||||||
to entry for existing trait",
|
to entry for existing trait",
|
||||||
self.crate_context.tcx.sess.str_of(
|
*self.crate_context.tcx.sess.str_of(
|
||||||
provided_method_info.method_info.ident));
|
provided_method_info.method_info.ident));
|
||||||
mis.push(provided_method_info);
|
mis.push(provided_method_info);
|
||||||
}
|
}
|
||||||
@ -370,7 +370,7 @@ pub impl CoherenceChecker {
|
|||||||
// If the trait doesn't have an entry yet, create one.
|
// If the trait doesn't have an entry yet, create one.
|
||||||
debug!("(checking implementation) creating new entry \
|
debug!("(checking implementation) creating new entry \
|
||||||
for method `%s`",
|
for method `%s`",
|
||||||
self.crate_context.tcx.sess.str_of(
|
*self.crate_context.tcx.sess.str_of(
|
||||||
provided_method_info.method_info.ident));
|
provided_method_info.method_info.ident));
|
||||||
let method_infos = @DVec();
|
let method_infos = @DVec();
|
||||||
method_infos.push(provided_method_info);
|
method_infos.push(provided_method_info);
|
||||||
@ -730,7 +730,7 @@ pub impl CoherenceChecker {
|
|||||||
|
|
||||||
tcx.sess.span_err(trait_ref_span,
|
tcx.sess.span_err(trait_ref_span,
|
||||||
fmt!("missing method `%s`",
|
fmt!("missing method `%s`",
|
||||||
tcx.sess.str_of(method.ident)));
|
*tcx.sess.str_of(method.ident)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,7 +742,7 @@ pub impl CoherenceChecker {
|
|||||||
for all_provided_methods.each |provided_method| {
|
for all_provided_methods.each |provided_method| {
|
||||||
debug!(
|
debug!(
|
||||||
"(creating impl) adding provided method `%s` to impl",
|
"(creating impl) adding provided method `%s` to impl",
|
||||||
sess.str_of(provided_method.method_info.ident));
|
*sess.str_of(provided_method.method_info.ident));
|
||||||
vec::push(&mut *all_methods, provided_method.method_info);
|
vec::push(&mut *all_methods, provided_method.method_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -863,7 +863,7 @@ pub impl CoherenceChecker {
|
|||||||
session.bug(fmt!(
|
session.bug(fmt!(
|
||||||
"no base type for external impl \
|
"no base type for external impl \
|
||||||
with no trait: %s (type %s)!",
|
with no trait: %s (type %s)!",
|
||||||
session.str_of(implementation.ident),
|
*session.str_of(implementation.ident),
|
||||||
ty_to_str(self.crate_context.tcx,self_type.ty)));
|
ty_to_str(self.crate_context.tcx,self_type.ty)));
|
||||||
}
|
}
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
|
@ -357,20 +357,20 @@ pub fn compare_impl_method(tcx: ty::ctxt,
|
|||||||
tcx.sess.span_fatal(cm.span,
|
tcx.sess.span_fatal(cm.span,
|
||||||
fmt!("method `%s` is declared as \
|
fmt!("method `%s` is declared as \
|
||||||
static in its impl, but not in \
|
static in its impl, but not in \
|
||||||
its trait", tcx.sess.str_of(impl_m.ident)));
|
its trait", *tcx.sess.str_of(impl_m.ident)));
|
||||||
}
|
}
|
||||||
else if trait_m.self_ty == ast::sty_static {
|
else if trait_m.self_ty == ast::sty_static {
|
||||||
tcx.sess.span_fatal(cm.span,
|
tcx.sess.span_fatal(cm.span,
|
||||||
fmt!("method `%s` is declared as \
|
fmt!("method `%s` is declared as \
|
||||||
static in its trait, but not in \
|
static in its trait, but not in \
|
||||||
its impl", tcx.sess.str_of(impl_m.ident)));
|
its impl", *tcx.sess.str_of(impl_m.ident)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
cm.span,
|
cm.span,
|
||||||
fmt!("method `%s`'s self type does \
|
fmt!("method `%s`'s self type does \
|
||||||
not match the trait method's \
|
not match the trait method's \
|
||||||
self type", tcx.sess.str_of(impl_m.ident)));
|
self type", *tcx.sess.str_of(impl_m.ident)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ pub fn compare_impl_method(tcx: ty::ctxt,
|
|||||||
cm.span,
|
cm.span,
|
||||||
fmt!("method `%s` has %u type %s, but its trait \
|
fmt!("method `%s` has %u type %s, but its trait \
|
||||||
declaration has %u type %s",
|
declaration has %u type %s",
|
||||||
tcx.sess.str_of(trait_m.ident), impl_m.tps.len(),
|
*tcx.sess.str_of(trait_m.ident), impl_m.tps.len(),
|
||||||
pluralize(impl_m.tps.len(), ~"parameter"),
|
pluralize(impl_m.tps.len(), ~"parameter"),
|
||||||
trait_m.tps.len(),
|
trait_m.tps.len(),
|
||||||
pluralize(trait_m.tps.len(), ~"parameter")));
|
pluralize(trait_m.tps.len(), ~"parameter")));
|
||||||
@ -391,7 +391,7 @@ pub fn compare_impl_method(tcx: ty::ctxt,
|
|||||||
cm.span,
|
cm.span,
|
||||||
fmt!("method `%s` has %u parameters \
|
fmt!("method `%s` has %u parameters \
|
||||||
but the trait has %u",
|
but the trait has %u",
|
||||||
tcx.sess.str_of(trait_m.ident),
|
*tcx.sess.str_of(trait_m.ident),
|
||||||
vec::len(impl_m.fty.sig.inputs),
|
vec::len(impl_m.fty.sig.inputs),
|
||||||
vec::len(trait_m.fty.sig.inputs)));
|
vec::len(trait_m.fty.sig.inputs)));
|
||||||
return;
|
return;
|
||||||
@ -412,7 +412,7 @@ pub fn compare_impl_method(tcx: ty::ctxt,
|
|||||||
fmt!("in method `%s`, \
|
fmt!("in method `%s`, \
|
||||||
type parameter %u has %u %s, but the same type \
|
type parameter %u has %u %s, but the same type \
|
||||||
parameter in its trait declaration has %u %s",
|
parameter in its trait declaration has %u %s",
|
||||||
tcx.sess.str_of(trait_m.ident),
|
*tcx.sess.str_of(trait_m.ident),
|
||||||
i, impl_param_bounds.len(),
|
i, impl_param_bounds.len(),
|
||||||
pluralize(impl_param_bounds.len(), ~"bound"),
|
pluralize(impl_param_bounds.len(), ~"bound"),
|
||||||
trait_param_bounds.len(),
|
trait_param_bounds.len(),
|
||||||
@ -466,7 +466,7 @@ pub fn compare_impl_method(tcx: ty::ctxt,
|
|||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
cm.span,
|
cm.span,
|
||||||
fmt!("method `%s` has an incompatible type: %s",
|
fmt!("method `%s` has an incompatible type: %s",
|
||||||
tcx.sess.str_of(trait_m.ident),
|
*tcx.sess.str_of(trait_m.ident),
|
||||||
ty::type_err_to_str(tcx, terr)));
|
ty::type_err_to_str(tcx, terr)));
|
||||||
ty::note_and_explain_type_err(tcx, terr);
|
ty::note_and_explain_type_err(tcx, terr);
|
||||||
}
|
}
|
||||||
@ -526,7 +526,7 @@ pub fn check_methods_against_trait(ccx: @mut CrateCtxt,
|
|||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
impl_m.span,
|
impl_m.span,
|
||||||
fmt!("method `%s` is not a member of trait `%s`",
|
fmt!("method `%s` is not a member of trait `%s`",
|
||||||
tcx.sess.str_of(impl_m.mty.ident),
|
*tcx.sess.str_of(impl_m.mty.ident),
|
||||||
path_to_str(a_trait_ty.path, tcx.sess.intr())));
|
path_to_str(a_trait_ty.path, tcx.sess.intr())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ pub fn convert(ccx: @mut CrateCtxt, it: @ast::item) {
|
|||||||
let tcx = ccx.tcx;
|
let tcx = ccx.tcx;
|
||||||
let rp = tcx.region_paramd_items.find(&it.id);
|
let rp = tcx.region_paramd_items.find(&it.id);
|
||||||
debug!("convert: item %s with id %d rp %?",
|
debug!("convert: item %s with id %d rp %?",
|
||||||
tcx.sess.str_of(it.ident), it.id, rp);
|
*tcx.sess.str_of(it.ident), it.id, rp);
|
||||||
match /*bad*/copy it.node {
|
match /*bad*/copy it.node {
|
||||||
// These don't define types.
|
// These don't define types.
|
||||||
ast::item_foreign_mod(_) | ast::item_mod(_) => {}
|
ast::item_foreign_mod(_) | ast::item_mod(_) => {}
|
||||||
@ -809,7 +809,7 @@ pub fn ty_of_item(ccx: @mut CrateCtxt, it: @ast::item)
|
|||||||
region_param: None,
|
region_param: None,
|
||||||
ty: ty::mk_bare_fn(ccx.tcx, tofd)};
|
ty: ty::mk_bare_fn(ccx.tcx, tofd)};
|
||||||
debug!("type of %s (id %d) is %s",
|
debug!("type of %s (id %d) is %s",
|
||||||
tcx.sess.str_of(it.ident),
|
*tcx.sess.str_of(it.ident),
|
||||||
it.id,
|
it.id,
|
||||||
ppaux::ty_to_str(tcx, tpt.ty));
|
ppaux::ty_to_str(tcx, tpt.ty));
|
||||||
ccx.tcx.tcache.insert(local_def(it.id), tpt);
|
ccx.tcx.tcache.insert(local_def(it.id), tpt);
|
||||||
|
@ -145,7 +145,8 @@ pub fn bound_region_to_str_adorned(cx: ctxt, prefix: &str,
|
|||||||
if cx.sess.verbose() { return fmt!("%s%?%s", prefix, br, sep); }
|
if cx.sess.verbose() { return fmt!("%s%?%s", prefix, br, sep); }
|
||||||
|
|
||||||
match br {
|
match br {
|
||||||
br_named(id) => fmt!("%s%s%s", prefix, cx.sess.str_of(id), sep),
|
br_named(id) => fmt!("%s%s%s", prefix, *cx.sess.str_of(id),
|
||||||
|
sep),
|
||||||
br_self => fmt!("%sself%s", prefix, sep),
|
br_self => fmt!("%sself%s", prefix, sep),
|
||||||
br_anon(_) => prefix.to_str(),
|
br_anon(_) => prefix.to_str(),
|
||||||
br_fresh(_) => prefix.to_str(),
|
br_fresh(_) => prefix.to_str(),
|
||||||
@ -321,7 +322,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
|
|||||||
match ident {
|
match ident {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
s.push_char(' ');
|
s.push_char(' ');
|
||||||
s.push_str(cx.sess.str_of(i));
|
s.push_str(*cx.sess.str_of(i));
|
||||||
}
|
}
|
||||||
_ => { }
|
_ => { }
|
||||||
}
|
}
|
||||||
@ -387,7 +388,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
|
|||||||
&m.fty.sig) + ~";"
|
&m.fty.sig) + ~";"
|
||||||
}
|
}
|
||||||
fn field_to_str(cx: ctxt, f: field) -> ~str {
|
fn field_to_str(cx: ctxt, f: field) -> ~str {
|
||||||
return cx.sess.str_of(f.ident) + ~": " + mt_to_str(cx, f.mt);
|
return *cx.sess.str_of(f.ident) + ~": " + mt_to_str(cx, f.mt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there is an id, print that instead of the structural type:
|
// if there is an id, print that instead of the structural type:
|
||||||
|
Loading…
Reference in New Issue
Block a user