From 68746cd4fb93e95a393c539abc65b93ed5eecdb5 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Sun, 10 Feb 2013 16:33:16 -0800 Subject: [PATCH] librustc: change driver::session::Session::str_of to return @~str --- src/librustc/back/link.rs | 2 +- src/librustc/driver/session.rs | 4 +- src/librustc/metadata/encoder.rs | 24 ++-- src/librustc/metadata/tyencode.rs | 4 +- src/librustc/middle/astencode.rs | 8 +- src/librustc/middle/check_match.rs | 12 +- src/librustc/middle/liveness.rs | 24 ++-- src/librustc/middle/mem_categorization.rs | 16 +-- src/librustc/middle/resolve.rs | 125 +++++++++++---------- src/librustc/middle/trans/_match.rs | 4 +- src/librustc/middle/trans/base.rs | 22 ++-- src/librustc/middle/trans/common.rs | 12 +- src/librustc/middle/trans/consts.rs | 2 +- src/librustc/middle/trans/controlflow.rs | 16 +-- src/librustc/middle/trans/debuginfo.rs | 57 +++++----- src/librustc/middle/trans/foreign.rs | 6 +- src/librustc/middle/trans/machine.rs | 2 +- src/librustc/middle/trans/meth.rs | 12 +- src/librustc/middle/trans/monomorphize.rs | 2 +- src/librustc/middle/trans/reflect.rs | 2 +- src/librustc/middle/trans/tvec.rs | 6 +- src/librustc/middle/trans/type_use.rs | 2 +- src/librustc/middle/ty.rs | 10 +- src/librustc/middle/typeck/check/_match.rs | 6 +- src/librustc/middle/typeck/check/mod.rs | 22 ++-- src/librustc/middle/typeck/coherence.rs | 16 +-- src/librustc/middle/typeck/collect.rs | 20 ++-- src/librustc/util/ppaux.rs | 7 +- 28 files changed, 226 insertions(+), 219 deletions(-) diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 32c88bbbd2e5..0ed6a1c20b40 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -655,7 +655,7 @@ pub fn mangle(sess: Session, ss: path) -> ~str { for ss.each |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); } } } diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 49b9f8342758..5f9033063235 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -253,8 +253,8 @@ pub impl Session { self.debugging_opt(no_monomorphic_collapse) } - fn str_of(id: ast::ident) -> ~str { - /*bad*/copy *self.parse_sess.interner.get(id) + fn str_of(id: ast::ident) -> @~str { + self.parse_sess.interner.get(id) } fn ident_of(+st: ~str) -> ast::ident { self.parse_sess.interner.intern(@st) diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 582da12fe08a..25d60ba7f3da 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -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) { - 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, name: ident) { 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) { @@ -305,7 +305,7 @@ fn encode_path(ecx: @encode_ctxt, ebml_w: writer::Encoder, 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) { @@ -333,7 +333,7 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: writer::Encoder, let (ident, did) = (item.ident, item.id); debug!("(encoding info for module) ... encoding impl %s \ (%?/%?)", - ecx.tcx.sess.str_of(ident), + *ecx.tcx.sess.str_of(ident), did, ast_map::node_id_to_str(ecx.tcx.items, did, ecx.tcx .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) { Some(ref exports) => { 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", - exp.name, id); + *exp.name, id); ebml_w.start_tag(tag_items_data_item_reexport); ebml_w.start_tag(tag_items_data_item_reexport_def_id); ebml_w.wr_str(def_to_str(exp.def_id)); ebml_w.end_tag(); 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(); } @@ -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()}); ebml_w.start_tag(tag_items_data_item); 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_name(ecx, ebml_w, 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); let its_ty = node_id_to_type(ecx.tcx, id); 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); encode_type(ecx, ebml_w, its_ty); 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, +all_tps: ~[ty_param]) { 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); encode_def_id(ebml_w, local_def(m.id)); match m.self_ty.node { @@ -678,7 +678,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: writer::Encoder, ebml_w, dtor.node.id, ecx.tcx.sess.ident_of( - ecx.tcx.sess.str_of(item.ident) + + *ecx.tcx.sess.str_of(item.ident) + ~"_dtor"), path, if tps.len() > 0u { @@ -1186,7 +1186,7 @@ fn encode_crate_dep(ecx: @encode_ctxt, ebml_w: writer::Encoder, dep: decoder::crate_dep) { ebml_w.start_tag(tag_crate_dep); 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.start_tag(tag_crate_dep_vers); ebml_w.writer.write(str::to_bytes(*dep.vers)); diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index 252de54cb9bb..320a76332ead 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -175,7 +175,7 @@ fn enc_bound_region(w: io::Writer, cx: @ctxt, br: ty::bound_region) { } ty::br_named(s) => { w.write_char('['); - w.write_str(cx.tcx.sess.str_of(s)); + w.write_str(*cx.tcx.sess.str_of(s)); w.write_char(']') } 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) => { w.write_str(&"R["); 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('='); enc_mt(w, cx, field.mt); } diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index e992c2a3af74..427d4492897f 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -96,7 +96,7 @@ pub fn encode_inlined_item(ecx: @e::encode_ctxt, maps: Maps) { debug!("> Encoding inlined item: %s::%s (%u)", 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()); 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)", 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()); } @@ -132,10 +132,10 @@ pub fn decode_inlined_item(cdata: cstore::crate_metadata, to_id_range: to_id_range}); let raw_ii = decode_ast(ast_doc); 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", 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(), dcx.tcx.items, path, ii); decode_side_tables(xcx, ast_doc); diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 2ddb2749b94c..85ed4e74efb7 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -143,13 +143,13 @@ pub fn check_exhaustive(cx: @MatchCheckCtxt, sp: span, pats: ~[@pat]) { match ty::get(ty).sty { ty::ty_bool => { match (*ctor) { - val(const_bool(true)) => Some(~"true"), - val(const_bool(false)) => Some(~"false"), + val(const_bool(true)) => Some(@~"true"), + val(const_bool(false)) => Some(@~"false"), _ => None } } ty::ty_enum(id, _) => { - let vid = match (*ctor) { + let vid = match *ctor { variant(id) => id, _ => 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(*) => { - match (*ctor) { - vec(n) => Some(fmt!("vectors of length %u", n)), + match *ctor { + vec(n) => Some(@fmt!("vectors of length %u", n)), _ => None } } @@ -173,7 +173,7 @@ pub fn check_exhaustive(cx: @MatchCheckCtxt, sp: span, pats: ~[@pat]) { } }; let msg = ~"non-exhaustive patterns" + match ext { - Some(ref s) => ~": " + (*s) + ~" not covered", + Some(ref s) => ~": " + **s + ~" not covered", None => ~"" }; cx.tcx.sess.span_err(sp, msg); diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 70464d0084a3..a7cfde0e70fe 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -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] { Local(LocalInfo {ident: nm, _}) | Arg(_, nm, _) => self.tcx.sess.str_of(nm), - ImplicitRet => ~"" + ImplicitRet => @~"" } } @@ -1777,7 +1777,7 @@ impl @Liveness { self.tcx.sess.span_err( move_expr.span, 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; } Local(*) | ImplicitRet => { @@ -1798,7 +1798,7 @@ impl @Liveness { move_expr.span, fmt!("`%s` moved into closure environment here \ because its type is moved by default", - name)); + *name)); } expr_path(*) => { self.report_illegal_read( @@ -1838,7 +1838,7 @@ impl @Liveness { move_expr.span, fmt!("%s`%s` moved here because %s has type %s, \ 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))); } @@ -1858,12 +1858,12 @@ impl @Liveness { FreeVarNode(span) => { self.tcx.sess.span_err( span, - fmt!("capture of %s: `%s`", msg, name)); + fmt!("capture of %s: `%s`", msg, *name)); } ExprNode(span) => { self.tcx.sess.span_err( span, - fmt!("use of %s: `%s`", msg, name)); + fmt!("use of %s: `%s`", msg, *name)); } ExitNode | VarDefNode(_) => { 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); - 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) { @@ -1913,11 +1913,11 @@ impl @Liveness { // FIXME(#3266)--make liveness warnings lintable self.tcx.sess.span_warn( sp, fmt!("variable `%s` is assigned to, \ - but never used", *name)); + but never used", **name)); } else { // FIXME(#3266)--make liveness warnings lintable self.tcx.sess.span_warn( - sp, fmt!("unused variable: `%s`", *name)); + sp, fmt!("unused variable: `%s`", **name)); } } return true; @@ -1931,7 +1931,7 @@ impl @Liveness { // FIXME(#3266)--make liveness warnings lintable self.tcx.sess.span_warn( sp, - fmt!("value assigned to `%s` is never read", *name)); + fmt!("value assigned to `%s` is never read", **name)); } } } diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index da2c8965ba1c..1c48df115e54 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -629,7 +629,7 @@ pub impl mem_categorization_ctxt { self.tcx.sess.span_bug( node.span(), 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))); } }; @@ -995,7 +995,7 @@ pub impl mem_categorization_ctxt { self.ptr_sigil(ptr), derefs) } 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) } @@ -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 { comp_field(fld, _) => self.tcx.sess.str_of(fld), - comp_index(*) => ~"[]", - comp_tuple => ~"()", - comp_anon_field => ~"", - comp_variant(_) => ~"" + comp_index(*) => @~"[]", + comp_tuple => @~"()", + comp_anon_field => @~"", + comp_variant(_) => @~"" } } @@ -1043,7 +1043,7 @@ pub impl mem_categorization_ctxt { } lp_comp(lp, comp) => { fmt!("%s.%s", self.lp_to_str(lp), - self.comp_to_repr(comp)) + *self.comp_to_repr(comp)) } } } diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index f159d4228ecf..e436d73aa7a9 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -116,7 +116,7 @@ pub type TraitMap = @HashMap>; pub type ExportMap2 = HashMap; 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. reexport: bool, // Whether this is a reexport. } @@ -1006,12 +1006,12 @@ pub impl Resolver { self.session.span_err(sp, fmt!("duplicate definition of %s %s", namespace_to_str(ns), - self.session.str_of(name))); + *self.session.str_of(name))); do child.span_for_namespace(ns).iter() |sp| { self.session.span_note(*sp, fmt!("first definition of %s %s here:", namespace_to_str(ns), - self.session.str_of(name))); + *self.session.str_of(name))); } } return (child, new_parent); @@ -1549,7 +1549,7 @@ pub impl Resolver { fn handle_external_def(def: def, modules: HashMap, child_name_bindings: @mut NameBindings, - final_ident: ~str, + final_ident: &str, ident: ident, new_parent: ReducedGraphParent) { match def { @@ -1634,7 +1634,7 @@ pub impl Resolver { debug!("(building reduced graph for \ external crate) ... adding \ trait method '%s'", - self.session.str_of(method_name)); + *self.session.str_of(method_name)); // Add it to the trait info if not static. if self_ty != sty_static { @@ -1741,7 +1741,8 @@ pub impl Resolver { self.handle_external_def(def, modules, child_name_bindings, - self.session.str_of(final_ident), + *self.session.str_of( + final_ident), final_ident, new_parent); } @@ -1759,7 +1760,8 @@ pub impl Resolver { debug!("(building reduced graph for \ external crate) processing \ static methods for type name %s", - self.session.str_of(final_ident)); + *self.session.str_of( + final_ident)); let (child_name_bindings, new_parent) = self.add_child(final_ident, @@ -1805,7 +1807,7 @@ pub impl Resolver { debug!("(building reduced graph for \ external crate) creating \ static method '%s'", - self.session.str_of(ident)); + *self.session.str_of(ident)); let (method_name_bindings, _) = self.add_child( @@ -1855,7 +1857,7 @@ pub impl Resolver { directive: privacy %? %s::%s", privacy, self.idents_to_str(module_path.get()), - self.session.str_of(target)); + *self.session.str_of(target)); match module_.import_resolutions.find(&target) { Some(resolution) => { @@ -1971,8 +1973,8 @@ pub impl Resolver { // We presumably emitted an error. Continue. let idents = import_directive.module_path.get(); let msg = fmt!("failed to resolve import: %s", - self.import_path_to_str(idents, - *import_directive.subclass)); + *self.import_path_to_str(idents, + *import_directive.subclass)); self.session.span_err(import_directive.span, msg); } Indeterminate => { @@ -1989,26 +1991,28 @@ pub impl Resolver { } fn idents_to_str(idents: ~[ident]) -> ~str { - let ident_strs = idents.map(|&ident| self.session.str_of(ident)); - return str::connect(ident_strs, "::"); + let ident_strs = do idents.map |ident| { + /*bad*/ copy *self.session.str_of(*ident) + }; + str::connect(ident_strs, "::") } fn import_directive_subclass_to_str(subclass: ImportDirectiveSubclass) - -> ~str { + -> @~str { match subclass { SingleImport(_target, source, _ns) => self.session.str_of(source), - GlobImport => ~"*" + GlobImport => @~"*" } } fn import_path_to_str(idents: ~[ident], subclass: ImportDirectiveSubclass) - -> ~str { + -> @~str { if idents.is_empty() { self.import_directive_subclass_to_str(subclass) } else { - fmt!("%s::%s", + @fmt!("%s::%s", 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 \ `%s`", - self.session.str_of(target), + *self.session.str_of(target), self.module_to_str(containing_module), - self.session.str_of(source), + *self.session.str_of(source), self.module_to_str(module_)); // 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` \ from `%s`", - self.session.str_of(target), + *self.session.str_of(target), self.module_to_str(containing_module), - self.session.str_of(source), + *self.session.str_of(source), self.module_to_str(module_)); // 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` \ to `%s`, privacy=%?", - self.session.str_of(ident), + *self.session.str_of(ident), self.module_to_str(containing_module), self.module_to_str(module_), dest_import_resolution.privacy); @@ -2575,7 +2579,7 @@ pub impl Resolver { Indeterminate => { debug!("(resolving module path for import) module \ resolution is indeterminate: %s", - self.session.str_of(name)); + *self.session.str_of(name)); return Indeterminate; } Success(target) => { @@ -2589,7 +2593,7 @@ pub impl Resolver { self.session.span_err(span, fmt!("not a \ module: %s", - self.session. + *self.session. str_of( name))); return Failed; @@ -2603,7 +2607,7 @@ pub impl Resolver { // There are no type bindings at all. self.session.span_err(span, fmt!("not a module: %s", - self.session.str_of( + *self.session.str_of( name))); return Failed; } @@ -2709,7 +2713,7 @@ pub impl Resolver { debug!("(resolving item in lexical scope) resolving `%s` in \ namespace %? in `%s`", - self.session.str_of(name), + *self.session.str_of(name), namespace, self.module_to_str(module_)); @@ -2949,7 +2953,7 @@ pub impl Resolver { allow_globs: bool) -> ResolveResult { debug!("(resolving name in module) resolving `%s` in `%s`", - self.session.str_of(name), + *self.session.str_of(name), self.module_to_str(module_)); // First, check the direct children of the module. @@ -3003,7 +3007,7 @@ pub impl Resolver { // We're out of luck. debug!("(resolving name in module) failed to resolve %s", - self.session.str_of(name)); + *self.session.str_of(name)); return Failed; } @@ -3032,8 +3036,8 @@ pub impl Resolver { debug!("(resolving one-level naming result) resolving import `%s` = \ `%s` in `%s`", - self.session.str_of(target_name), - self.session.str_of(source_name), + *self.session.str_of(target_name), + *self.session.str_of(source_name), self.module_to_str(module_)); // 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 \ result %? for `%s` into `%s`", is_none(&module_result), - self.session.str_of(target_name), + *self.session.str_of(target_name), self.module_to_str(module_)); import_resolution.value_target = value_result; @@ -3275,7 +3279,7 @@ pub impl Resolver { (Some(d), Some(Public)) => { debug!("(computing exports) YES: %s '%s' => %?", if reexport { ~"reexport" } else { ~"export"}, - self.session.str_of(ident), + *self.session.str_of(ident), def_id_of_def(d)); exports2.push(Export2 { reexport: reexport, @@ -3295,7 +3299,7 @@ pub impl Resolver { fn add_exports_for_module(exports2: &mut ~[Export2], module_: @Module) { for module_.children.each |ident, namebindings| { debug!("(computing exports) maybe export '%s'", - self.session.str_of(*ident)); + *self.session.str_of(*ident)); self.add_exports_of_namebindings(&mut *exports2, *ident, *namebindings, @@ -3311,14 +3315,14 @@ pub impl Resolver { for module_.import_resolutions.each |ident, importresolution| { if importresolution.privacy != Public { debug!("(computing exports) not reexporting private `%s`", - self.session.str_of(*ident)); + *self.session.str_of(*ident)); loop; } for [ TypeNS, ValueNS ].each |ns| { match importresolution.target_for_namespace(*ns) { Some(target) => { debug!("(computing exports) maybe reexport '%s'", - self.session.str_of(*ident)); + *self.session.str_of(*ident)); self.add_exports_of_namebindings(&mut *exports2, *ident, target.bindings, @@ -3361,7 +3365,7 @@ pub impl Resolver { match orig_module.children.find(&name) { None => { 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)); } Some(name_bindings) => { @@ -3369,7 +3373,7 @@ pub impl Resolver { None => { debug!("!!! (with scope) didn't find module \ for `%s` in `%s`", - self.session.str_of(name), + *self.session.str_of(name), self.module_to_str(orig_module)); } Some(module_) => { @@ -3543,7 +3547,7 @@ pub impl Resolver { fn resolve_item(item: @item, visitor: ResolveVisitor) { 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. // This is used to allow the test runner to run unexported tests. @@ -4105,7 +4109,7 @@ pub impl Resolver { p.span, fmt!("variable `%s` from pattern #1 is \ not bound in pattern #%u", - self.session.str_of(key), i + 1)); + *self.session.str_of(key), i + 1)); } Some(binding_i) => { if binding_0.binding_mode != binding_i.binding_mode { @@ -4113,7 +4117,7 @@ pub impl Resolver { binding_i.span, fmt!("variable `%s` is bound with different \ 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, fmt!("variable `%s` from pattern #%u is \ 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) => { debug!("(resolving type) resolved `%s` to \ type %?", - self.session.str_of( + *self.session.str_of( path.idents.last()), def); result_def = Some(def); @@ -4278,7 +4282,7 @@ pub impl Resolver { if mode == RefutableMode => { debug!("(resolving pattern) resolving `%s` to \ struct or enum variant", - self.session.str_of(ident)); + *self.session.str_of(ident)); self.enforce_default_binding_mode( pattern, @@ -4292,13 +4296,13 @@ pub impl Resolver { shadows an enum \ variant or unit-like \ struct in scope", - self.session - .str_of(ident))); + *self.session + .str_of(ident))); } FoundConst(def) if mode == RefutableMode => { debug!("(resolving pattern) resolving `%s` to \ constant", - self.session.str_of(ident)); + *self.session.str_of(ident)); self.enforce_default_binding_mode( pattern, @@ -4313,7 +4317,7 @@ pub impl Resolver { } BareIdentifierPatternUnresolved => { debug!("(resolving pattern) binding `%s`", - self.session.str_of(ident)); + *self.session.str_of(ident)); let is_mutable = mutability == Mutable; @@ -4395,7 +4399,7 @@ pub impl Resolver { self.session.span_err( path.span, fmt!("not an enum variant: %s", - self.session.str_of( + *self.session.str_of( path.idents.last()))); } None => { @@ -4736,7 +4740,7 @@ pub impl Resolver { Some(dl_def(def)) => { debug!("(resolving path in local ribs) resolved `%s` to \ local: %?", - self.session.str_of(ident), + *self.session.str_of(ident), def); return Some(def); } @@ -4764,7 +4768,7 @@ pub impl Resolver { Some(def) => { debug!("(resolving item path in lexical scope) \ resolved `%s` to item", - self.session.str_of(ident)); + *self.session.str_of(ident)); return Some(def); } } @@ -4785,7 +4789,7 @@ pub impl Resolver { let rib = self.type_ribs.get_elt(i); match rib.kind { 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 { match item.node { item_struct(class_def, _) => { @@ -4793,7 +4797,7 @@ pub impl Resolver { match field.node.kind { unnamed_field => {}, named_field(ident, _, _) => { - if str::eq_slice(self.session.str_of(ident), + if str::eq_slice(*self.session.str_of(ident), name) { return true } @@ -4902,8 +4906,9 @@ pub impl Resolver { None => self.session.span_err(expr.span, fmt!("use of undeclared label \ - `%s`", self.session.str_of( - label))), + `%s`", + *self.session.str_of( + label))), Some(dl_def(def @ def_label(_))) => self.record_def(expr.id, def), Some(_) => @@ -4998,7 +5003,7 @@ pub impl Resolver { fn search_for_traits_containing_method(name: ident) -> @DVec { debug!("(searching for traits containing method) looking for '%s'", - self.session.str_of(name)); + *self.session.str_of(name)); let found_traits = @DVec(); let mut search_module = self.current_module; @@ -5094,7 +5099,7 @@ pub impl Resolver { for method '%s'", trait_def_id.crate, trait_def_id.node, - self.session.str_of(name)); + *self.session.str_of(name)); match self.trait_info.find(&trait_def_id) { Some(trait_info) if trait_info.contains_key(&name) => { @@ -5102,7 +5107,7 @@ pub impl Resolver { %d:%d for method '%s'", trait_def_id.crate, trait_def_id.node, - self.session.str_of(name)); + *self.session.str_of(name)); (*found_traits).push(trait_def_id); true } @@ -5289,7 +5294,7 @@ pub impl Resolver { debug!("Children:"); for module_.children.each_key |&name| { - debug!("* %s", self.session.str_of(name)); + debug!("* %s", *self.session.str_of(name)); } 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); } } diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 8864e2e0a082..a6813997ae83 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -1629,7 +1629,7 @@ pub fn trans_match_inner(scope_cx: block, // Special case for empty types let fail_cx = @mut None; 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) } else { None @@ -1661,7 +1661,7 @@ pub fn trans_match_inner(scope_cx: block, bcx = controlflow::join_blocks(scope_cx, dvec::unwrap(arm_cxs)); return bcx; - fn mk_fail(bcx: block, sp: span, +msg: ~str, + fn mk_fail(bcx: block, sp: span, msg: @~str, finished: @mut Option) -> BasicBlockRef { match *finished { Some(bb) => return bb, _ => () } let fail_cx = sub_block(bcx, ~"case_fallthrough"); diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 078f2a92365d..16fdebff5589 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -521,7 +521,7 @@ pub fn compare_scalar_types(cx: block, rslt( controlflow::trans_fail( cx, None, - ~"attempt to compare values of type type"), + @~"attempt to compare values of type type"), 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: \ %s (variant name = %s)", cx.ty_to_str(fn_ty), - cx.sess().str_of(variant.name))) + *cx.sess().str_of(variant.name))) } 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| { - 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; } -pub fn trans_trace(bcx: block, sp_opt: Option, +trace_str: ~str) { +pub fn trans_trace(bcx: block, sp_opt: Option, trace_str: ~str) { if !bcx.sess().trace() { return; } let _icx = bcx.insn_ctxt("trans_trace"); - add_comment(bcx, trace_str); - let V_trace_str = C_cstr(bcx.ccx(), trace_str); + add_comment(bcx, /*bad*/ copy trace_str); + let V_trace_str = C_cstr(bcx.ccx(), @/*bad*/ copy trace_str); let {V_filename, V_line} = match sp_opt { Some(sp) => { let sess = bcx.sess(); 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} } None => { - {V_filename: C_cstr(bcx.ccx(), ~""), + {V_filename: C_cstr(bcx.ccx(), @~""), V_line: 0} } }; @@ -1170,7 +1170,7 @@ pub fn new_block(cx: fn_ctxt, parent: Option, +kind: block_kind, special_idents::invalid }; 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) }); 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); if cx.sess().opts.debuginfo { 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 { llvm::LLVMSetValueName(val, buf) } @@ -2815,7 +2815,7 @@ pub fn create_module_map(ccx: @crate_ctxt) -> ValueRef { } let mut elts: ~[ValueRef] = ~[]; 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)]); elts.push(elt); } diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 03b059cbe4ea..fe9eea19c3ff 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -186,7 +186,7 @@ pub struct crate_ctxt { // Cache generated vtables vtables: HashMap, // Cache of constant strings, - const_cstr_cache: HashMap<~str, ValueRef>, + const_cstr_cache: HashMap<@~str, ValueRef>, // Reverse-direction for const ptrs cast from globals. // 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 // 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 { match cx.const_cstr_cache.find(&s) { Some(llval) => return llval, 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) }; 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 // 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 { - let len = str::len(s); + let len = s.len(); let cs = llvm::LLVMConstPointerCast(C_cstr(cx, s), T_ptr(T_i8())); 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) => { if first { first = false; } else { r += ~"::"; } - r += sess.str_of(s); + r += *sess.str_of(s); } } } diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs index d86d4c97c3be..2c5a93a2532f 100644 --- a/src/librustc/middle/trans/consts.rs +++ b/src/librustc/middle/trans/consts.rs @@ -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_nil => C_nil(), - ast::lit_str(s) => C_estr_slice(cx, /*bad*/copy *s) + ast::lit_str(s) => C_estr_slice(cx, s) } } diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs index 792c5958822e..0997df66b986 100644 --- a/src/librustc/middle/trans/controlflow.rs +++ b/src/librustc/middle/trans/controlflow.rs @@ -320,8 +320,8 @@ pub fn trans_check_expr(bcx: block, s: ~str) -> block { let _icx = bcx.insn_ctxt("trans_check_expr"); - let expr_str = s + ~" " + expr_to_str(pred_expr, bcx.ccx().sess.intr()) - + ~" failed"; + let expr_str = @(s + ~" " + expr_to_str(pred_expr, bcx.ccx().sess.intr()) + + ~" failed"); let Result {bcx, val} = { do with_scope_result(bcx, chk_expr.info(), ~"check") |bcx| { 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); 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)); } } - _ => return trans_fail(bcx, sp_opt, ~"explicit failure") + _ => trans_fail(bcx, sp_opt, @~"explicit failure") } } pub fn trans_fail(bcx: block, sp_opt: Option, - +fail_str: ~str) + fail_str: @~str) -> block { let _icx = bcx.insn_ctxt("trans_fail"); let V_fail_str = C_cstr(bcx.ccx(), fail_str); @@ -379,11 +379,11 @@ fn trans_fail_value(bcx: block, Some(sp) => { let sess = bcx.sess(); 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} } None => { - {V_filename: C_cstr(bcx.ccx(), ~""), + {V_filename: C_cstr(bcx.ccx(), @~""), 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 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 args = ~[filename, line, index, len]; diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index e2e5526eac08..838d764cc4d8 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -60,12 +60,12 @@ const DW_ATE_signed_char: int = 0x06; const DW_ATE_unsigned: int = 0x07; const DW_ATE_unsigned_char: int = 0x08; -fn llstr(s: ~str) -> ValueRef { - str::as_c_str(s, |sbuf| { +fn llstr(s: &str) -> ValueRef { + do str::as_c_str(s) |sbuf| { 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 { lli32(LLVMDebugVersion | lltag) @@ -79,10 +79,9 @@ fn lli64(val: int) -> ValueRef { fn lli1(bval: bool) -> ValueRef { C_i1(bval) } -fn llmdnode(elems: ~[ValueRef]) -> ValueRef { +fn llmdnode(elems: &[ValueRef]) -> ValueRef { unsafe { - llvm::LLVMMDNode(vec::raw::to_ptr(elems), - vec::len(elems) as libc::c_uint) + llvm::LLVMMDNode(vec::raw::to_ptr(elems), elems.len() as libc::c_uint) } } fn llunused() -> ValueRef { @@ -205,7 +204,7 @@ fn create_compile_unit(cx: @crate_ctxt) -> @metadata { let unit_metadata = ~[lltag(tg), llunused(), lli32(DW_LANG_RUST), - llstr(copy crate_name), + llstr(crate_name), llstr(work_dir), llstr(env!("CFG_VERSION")), lli1(true), // deprecated: main compile unit @@ -369,7 +368,7 @@ fn create_pointer_type(cx: @crate_ctxt, t: ty::t, span: span, struct StructCtxt { file: ValueRef, - name: ~str, + name: @~str, line: int, members: ~[ValueRef], total_size: int, @@ -378,17 +377,17 @@ struct StructCtxt { fn finish_structure(cx: @mut StructCtxt) -> ValueRef { return create_composite_type(StructureTypeTag, - /*bad*/copy cx.name, + *cx.name, cx.file, cx.line, cx.total_size, cx.align, 0, - option::None, - option::Some(/*bad*/copy cx.members)); + None, + Some(/*bad*/copy cx.members)); } -fn create_structure(file: @metadata, +name: ~str, line: int) +fn create_structure(file: @metadata, name: @~str, line: int) -> @mut StructCtxt { let cx = @mut StructCtxt { file: file.node, @@ -401,7 +400,7 @@ fn create_structure(file: @metadata, +name: ~str, line: int) 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) -> ValueRef { 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, - +name: ~str, + name: &str, line: int, size: int, align: int, ty: ValueRef) { cx.members.push(create_derived_type(MemberTag, cx.file, name, line, - size * 8, align * 8, cx.total_size, - ty)); + size * 8, align * 8, cx.total_size, + ty)); 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 ty_md = create_ty(cx, field_t, field.node.mt.ty); 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, 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 uint_t = ty::mk_uint(cx.tcx); 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::() as int, sys::min_align_of::() as int, refcount_type.node); 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; } -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, derived: Option, +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 file_node = create_file(cx, fname); 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); add_member(scx, ~"fill", 0, sys::size_of::() as int, sys::min_align_of::() 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 data_ptr = create_composite_type(ArrayTypeTag, ~"", file_node.node, 0, arr_size, arr_align, 0, - option::Some(elem_ty_md.node), - option::Some(~[subrange])); + Some(elem_ty_md.node), + Some(~[subrange])); add_member(scx, ~"data", 0, 0, // clang says the size should be 0 sys::min_align_of::() as int, data_ptr); 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 } -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 { let lldata = ~[lltag(type_tag), context, @@ -679,7 +680,7 @@ pub fn create_local_var(bcx: block, local: @ast::local) None => create_function(bcx.fcx).node, Some(_) => create_block(bcx).node }; - let mdnode = create_var(tg, context, cx.sess.str_of(name), + let mdnode = create_var(tg, context, *cx.sess.str_of(name), filemd.node, loc.line as int, tymd.node); let mdval = @{node: mdnode, data: {id: local.node.id}}; update_cache(cache, AutoVariableTag, local_var_metadata(mdval)); @@ -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. let mdnode = create_var(tg, context.node, - cx.sess.str_of(path.idents.last()), + *cx.sess.str_of(path.idents.last()), filemd.node, loc.line as int, tymd.node); @@ -839,9 +840,9 @@ pub fn create_function(fcx: fn_ctxt) -> @metadata { let fn_metadata = ~[lltag(SubprogramTag), llunused(), file_node, - llstr(cx.sess.str_of(ident)), + llstr(*cx.sess.str_of(ident)), //XXX fully-qualified C++ name: - llstr(cx.sess.str_of(ident)), + llstr(*cx.sess.str_of(ident)), llstr(~""), //XXX MIPS name????? file_node, lli32(loc.line as int), diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index 47566f81457b..49e47e35572e 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -49,7 +49,7 @@ fn abi_info(arch: session::arch) -> cabi::ABIInfo { pub fn link_name(ccx: @crate_ctxt, i: @ast::foreign_item) -> @~str { 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, } } @@ -334,13 +334,13 @@ pub fn trans_intrinsic(ccx: @crate_ctxt, +path: ast_map::path, substs: @param_substs, ref_id: Option) { - 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. let fcx = new_fn_ctxt_w_id(ccx, path, decl, item.id, None, Some(copy substs), Some(item.span)); 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" => { let old = AtomicCmpXchg(bcx, get_param(decl, first_real_arg), diff --git a/src/librustc/middle/trans/machine.rs b/src/librustc/middle/trans/machine.rs index 58a53cd878a7..cc31c9ace986 100644 --- a/src/librustc/middle/trans/machine.rs +++ b/src/librustc/middle/trans/machine.rs @@ -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", - cx.tcx.sess.str_of(variant.name), + *cx.tcx.sess.str_of(variant.name), ty_str(cx.tn, T_struct(lltypes))); let this_size = llsize_of_real(cx, T_struct(lltypes)); diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs index b28362dfbd61..b7732aa817f8 100644 --- a/src/librustc/middle/trans/meth.rs +++ b/src/librustc/middle/trans/meth.rs @@ -322,7 +322,7 @@ pub fn trans_static_method_callee(bcx: block, } }; 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( bcx.fcx, ccx.maps.vtable_map.get(&callee_id)); @@ -794,10 +794,10 @@ pub fn make_vtable(ccx: @crate_ctxt, ptrs: ~[ValueRef]) -> ValueRef { unsafe { let _icx = ccx.insn_ctxt("impl::make_vtable"); let tbl = C_struct(ptrs); - let vt_gvar = - str::as_c_str(ccx.sess.str_of((ccx.names)(~"vtable")), |buf| { + let vtable = ccx.sess.str_of((ccx.names)(~"vtable")); + let vt_gvar = do str::as_c_str(*vtable) |buf| { llvm::LLVMAddGlobal(ccx.llmod, val_ty(tbl), buf) - }); + }; llvm::LLVMSetInitializer(vt_gvar, tbl); llvm::LLVMSetGlobalConstant(vt_gvar, lib::llvm::True); 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)); if (*im.tps).len() > 0u || ty::type_has_self(fty) { 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())) } else { 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); if has_tps { // If the method is in another crate, need to make an inlined diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index bb289eec33ee..52b95c168b22 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -147,7 +147,7 @@ pub fn monomorphic_fn(ccx: @crate_ctxt, ccx.monomorphizing.insert(fn_id, depth + 1); 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 mk_lldecl = || { diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs index 325c28645884..1fa97325313b 100644 --- a/src/librustc/middle/trans/reflect.rs +++ b/src/librustc/middle/trans/reflect.rs @@ -45,7 +45,7 @@ pub impl Reflector { 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 // will kick us off fast isel. (Issue #4352.) let bcx = self.bcx; diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index e103ae155932..d0f0275c81ac 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -263,7 +263,7 @@ pub fn trans_lit_str(bcx: block, unsafe { let bytes = str_lit.len() + 1; // count null-terminator too 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, T_ptr(T_i8())); Store(bcx, @@ -299,7 +299,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: block, ast::expr_lit(@codemap::spanned { 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 llsizeval = C_uint(bcx.ccx(), s.len()); let typ = ty::mk_estr(bcx.tcx(), ty::vstore_uniq); @@ -362,7 +362,7 @@ pub fn write_content(bcx: block, SaveIn(lldest) => { let bytes = s.len() + 1; // copy null-terminator too 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); return bcx; } diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs index af570e1f2590..a1a32c62866d 100644 --- a/src/librustc/middle/trans/type_use.rs +++ b/src/librustc/middle/trans/type_use.rs @@ -112,7 +112,7 @@ pub fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint) _ }, abi, _) => { 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" | ~"init" | ~"reinterpret_cast" | ~"move_val" | ~"move_val_init" => use_repr, diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 3dfe12895194..d11b0a8f2eb0 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -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; } tcx.sess.bug(fmt!( "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)))); } @@ -3235,7 +3235,7 @@ pub fn get_field(tcx: ctxt, rec_ty: t, id: ast::ident) -> field { Some(f) => f, // Do we only call this when we know the field is legit? 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) => { fmt!("expected a record with field `%s` but found one with field \ `%s`", - cx.sess.str_of(values.expected), - cx.sess.str_of(values.found)) + *cx.sess.str_of(values.expected), + *cx.sess.str_of(values.found)) } terr_arg_count => ~"incorrect number of function parameters", 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)) } 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)) } terr_sorts(values) => { diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index bd099923f2bd..ee64b649d836 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -231,7 +231,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt, tcx.sess.span_err(span, fmt!("struct `%s` does not have a field 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, 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, fmt!("mismatched types: did not \ expect a record with a field `%s`", - tcx.sess.str_of(f.ident))); + *tcx.sess.str_of(f.ident))); } } } diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 1ad3bd9cae6e..480bee18db61 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -450,7 +450,7 @@ pub fn check_fn(ccx: @mut CrateCtxt, if pat_util::pat_is_binding(fcx.ccx.tcx.def_map, p) => { assign(p.id, None); 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.inh.locals.get(&p.id))); } @@ -508,7 +508,7 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt, Some(orig_sp) => { tcx.sess.span_err(sp, fmt!("Duplicate field \ 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 \ this field occurred here"); break; @@ -565,7 +565,7 @@ pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) { ast::item_impl(_, _, ty, ms) => { let rp = ccx.tcx.region_paramd_items.find(&it.id); 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); for ms.each |m| { 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 \ named `%s`", actual, - fcx.ccx.tcx.sess.str_of(method_name)) + *fcx.ccx.tcx.sess.str_of(method_name)) }, expr_t, None); @@ -1752,7 +1752,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, |actual| { fmt!("attempted access of field `%s` on type `%s`, but \ no field or method with that name was found", - tcx.sess.str_of(field), actual) + *tcx.sess.str_of(field), actual) }, expr_t, None); // Add error type for the result @@ -1790,13 +1790,13 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, tcx.sess.span_err( field.span, fmt!("structure has no field named `%s`", - tcx.sess.str_of(field.node.ident))); + *tcx.sess.str_of(field.node.ident))); } Some((_, true)) => { tcx.sess.span_err( field.span, 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)) => { let expected_field_type = @@ -1824,7 +1824,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, let (_, seen) = class_field_map.get(&name); if !seen { 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 { tcx.sess.span_err(f.span, ~"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)); return true; } @@ -3151,7 +3151,7 @@ pub fn check_bounds_are_used(ccx: @mut CrateCtxt, if !*b { ccx.tcx.sess.span_err( 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} } 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" | ~"pref_align_of" | ~"min_align_of" => (1u, ~[], ty::mk_uint(ccx.tcx)), ~"init" => (1u, ~[], param(ccx, 0u)), diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 7594b2690a4a..1dbdc4378b06 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -204,7 +204,7 @@ pub impl CoherenceChecker { visit_crate(*crate, (), mk_simple_visitor(@SimpleVisitor { visit_item: |item| { 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 { item_impl(_, opt_trait, _, _) => { @@ -245,7 +245,7 @@ pub impl CoherenceChecker { if associated_traits.len() == 0 { debug!("(checking implementation) no associated traits for item \ '%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, item.span, @@ -274,7 +274,7 @@ pub impl CoherenceChecker { ast_map::node_id_to_str( self.crate_context.tcx.items, trait_did.node, 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); @@ -362,7 +362,7 @@ pub impl CoherenceChecker { // method to that entry. debug!("(checking implementation) adding method `%s` \ 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)); mis.push(provided_method_info); } @@ -370,7 +370,7 @@ pub impl CoherenceChecker { // If the trait doesn't have an entry yet, create one. debug!("(checking implementation) creating new entry \ for method `%s`", - self.crate_context.tcx.sess.str_of( + *self.crate_context.tcx.sess.str_of( provided_method_info.method_info.ident)); let method_infos = @DVec(); method_infos.push(provided_method_info); @@ -730,7 +730,7 @@ pub impl CoherenceChecker { tcx.sess.span_err(trait_ref_span, 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| { debug!( "(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); } } @@ -863,7 +863,7 @@ pub impl CoherenceChecker { session.bug(fmt!( "no base type for external impl \ 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))); } Some(_) => { diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 972d1b609454..2edbb3ebf675 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -357,20 +357,20 @@ pub fn compare_impl_method(tcx: ty::ctxt, tcx.sess.span_fatal(cm.span, fmt!("method `%s` is declared as \ 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 { tcx.sess.span_fatal(cm.span, fmt!("method `%s` is declared as \ 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 { tcx.sess.span_err( cm.span, fmt!("method `%s`'s self type does \ 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, fmt!("method `%s` has %u type %s, but its trait \ 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"), trait_m.tps.len(), pluralize(trait_m.tps.len(), ~"parameter"))); @@ -391,7 +391,7 @@ pub fn compare_impl_method(tcx: ty::ctxt, cm.span, fmt!("method `%s` has %u parameters \ 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(trait_m.fty.sig.inputs))); return; @@ -412,7 +412,7 @@ pub fn compare_impl_method(tcx: ty::ctxt, fmt!("in method `%s`, \ type parameter %u has %u %s, but the same type \ 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(), pluralize(impl_param_bounds.len(), ~"bound"), trait_param_bounds.len(), @@ -466,7 +466,7 @@ pub fn compare_impl_method(tcx: ty::ctxt, tcx.sess.span_err( cm.span, 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::note_and_explain_type_err(tcx, terr); } @@ -526,7 +526,7 @@ pub fn check_methods_against_trait(ccx: @mut CrateCtxt, tcx.sess.span_err( impl_m.span, 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()))); } } @@ -596,7 +596,7 @@ pub fn convert(ccx: @mut CrateCtxt, it: @ast::item) { let tcx = ccx.tcx; let rp = tcx.region_paramd_items.find(&it.id); 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 { // These don't define types. 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, ty: ty::mk_bare_fn(ccx.tcx, tofd)}; debug!("type of %s (id %d) is %s", - tcx.sess.str_of(it.ident), + *tcx.sess.str_of(it.ident), it.id, ppaux::ty_to_str(tcx, tpt.ty)); ccx.tcx.tcache.insert(local_def(it.id), tpt); diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 43d12c95c4df..8b0c84cff834 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -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); } 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_anon(_) => prefix.to_str(), br_fresh(_) => prefix.to_str(), @@ -321,7 +322,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str { match ident { Some(i) => { 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) + ~";" } 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: