about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-01-31 15:17:42 -0800
committerHuon Wilson <dbau.pp+github@gmail.com>2014-02-02 01:44:49 +1100
commite534b565e6f101f6ec544f821dec116fed286f3b (patch)
tree4bfeb605e5ee41226a6b9f758bf3d89a3939dfc1 /src
parent344040d470262bef014f3db8d634f2cec4ddfed1 (diff)
downloadrust-e534b565e6f101f6ec544f821dec116fed286f3b.tar.gz
rust-e534b565e6f101f6ec544f821dec116fed286f3b.zip
librustc: Remove uses of `token::ident_to_str()` from librustc
Diffstat (limited to 'src')
-rw-r--r--src/librustc/front/feature_gate.rs3
-rw-r--r--src/librustc/metadata/decoder.rs9
-rw-r--r--src/librustc/metadata/encoder.rs7
-rw-r--r--src/librustc/middle/borrowck/mod.rs3
-rw-r--r--src/librustc/middle/dead.rs3
-rw-r--r--src/librustc/middle/privacy.rs34
-rw-r--r--src/librustc/util/ppaux.rs3
7 files changed, 42 insertions, 20 deletions
diff --git a/src/librustc/front/feature_gate.rs b/src/librustc/front/feature_gate.rs
index c6550ec7c6e..de5a7b7fd88 100644
--- a/src/librustc/front/feature_gate.rs
+++ b/src/librustc/front/feature_gate.rs
@@ -98,7 +98,8 @@ impl Context {
 
 impl Visitor<()> for Context {
     fn visit_ident(&mut self, sp: Span, id: ast::Ident, _: ()) {
-        let s = token::ident_to_str(&id);
+        let string = token::get_ident(id.name);
+        let s = string.get();
 
         if !s.is_ascii() {
             self.gate_feature("non_ascii_idents", sp,
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index edaa2208a1f..7e866b32631 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -1142,8 +1142,13 @@ fn list_crate_deps(data: &[u8], out: &mut io::Writer) {
 
     let r = get_crate_deps(data);
     for dep in r.iter() {
-        write!(out, "{} {}-{}-{}\n",
-                 dep.cnum, token::ident_to_str(&dep.name), dep.hash, dep.vers);
+        let string = token::get_ident(dep.name.name);
+        write!(out,
+               "{} {}-{}-{}\n",
+               dep.cnum,
+               string.get(),
+               dep.hash,
+               dep.vers);
     }
 
     write!(out, "\n");
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 261544adfd1..c7ba3ab01e9 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1350,11 +1350,10 @@ fn my_visit_foreign_item(ni: &ForeignItem,
                          index: @RefCell<~[entry<i64>]>) {
     match items.get(ni.id) {
         ast_map::NodeForeignItem(_, abi, _, pt) => {
+            let string = token::get_ident(ni.ident.name);
             debug!("writing foreign item {}::{}",
-                   ast_map::path_to_str(
-                       *pt,
-                       token::get_ident_interner()),
-                   token::ident_to_str(&ni.ident));
+                   ast_map::path_to_str(*pt, token::get_ident_interner()),
+                   string.get());
 
             let mut ebml_w = unsafe {
                 ebml_w.unsafe_clone()
diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs
index 90c9a61b18b..c34f5c2f56b 100644
--- a/src/librustc/middle/borrowck/mod.rs
+++ b/src/librustc/middle/borrowck/mod.rs
@@ -774,7 +774,8 @@ impl BorrowckCtxt {
                         match pat.node {
                             ast::PatIdent(_, ref path, _) => {
                                 let ident = ast_util::path_to_ident(path);
-                                out.push_str(token::ident_to_str(&ident));
+                                let string = token::get_ident(ident.name);
+                                out.push_str(string.get());
                             }
                             _ => {
                                 self.tcx.sess.bug(
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs
index c333bc58fee..08ab8edf750 100644
--- a/src/librustc/middle/dead.rs
+++ b/src/librustc/middle/dead.rs
@@ -360,9 +360,10 @@ impl DeadVisitor {
 
     fn warn_dead_code(&mut self, id: ast::NodeId,
                       span: codemap::Span, ident: &ast::Ident) {
+        let string = token::get_ident(ident.name);
         self.tcx.sess.add_lint(DeadCode, id, span,
                                format!("code is never used: `{}`",
-                                       token::ident_to_str(ident)));
+                                       string.get()));
     }
 }
 
diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs
index 2562c34b54b..ae1b71f5cca 100644
--- a/src/librustc/middle/privacy.rs
+++ b/src/librustc/middle/privacy.rs
@@ -530,8 +530,10 @@ impl<'a> PrivacyVisitor<'a> {
                             ast::ItemTrait(..) => "trait",
                             _ => return false,
                         };
-                        let msg = format!("{} `{}` is private", desc,
-                                          token::ident_to_str(&item.ident));
+                        let string = token::get_ident(item.ident.name);
+                        let msg = format!("{} `{}` is private",
+                                          desc,
+                                          string.get());
                         self.tcx.sess.span_note(span, msg);
                     }
                     Some(..) | None => {}
@@ -588,8 +590,10 @@ impl<'a> PrivacyVisitor<'a> {
             if struct_vis != ast::Public && field.vis == ast::Public { break }
             if !is_local(field.id) ||
                !self.private_accessible(field.id.node) {
-                self.tcx.sess.span_err(span, format!("field `{}` is private",
-                                             token::ident_to_str(&ident)));
+                let string = token::get_ident(ident.name);
+                self.tcx.sess.span_err(span,
+                                       format!("field `{}` is private",
+                                               string.get()))
             }
             break;
         }
@@ -603,8 +607,11 @@ impl<'a> PrivacyVisitor<'a> {
         let method_id = ty::method(self.tcx, method_id).provided_source
                                                        .unwrap_or(method_id);
 
-        self.ensure_public(span, method_id, None,
-                           format!("method `{}`", token::ident_to_str(name)));
+        let string = token::get_ident(name.name);
+        self.ensure_public(span,
+                           method_id,
+                           None,
+                           format!("method `{}`", string.get()));
     }
 
     // Checks that a path is in scope.
@@ -617,10 +624,17 @@ impl<'a> PrivacyVisitor<'a> {
             match *self.last_private_map.get(&path_id) {
                 resolve::AllPublic => {},
                 resolve::DependsOn(def) => {
-                    let name = token::ident_to_str(&path.segments.last().unwrap()
-                                                        .identifier);
-                    self.ensure_public(span, def, Some(origdid),
-                                       format!("{} `{}`", tyname, name));
+                    let name = token::get_ident(path.segments
+                                                    .last()
+                                                    .unwrap()
+                                                    .identifier
+                                                    .name);
+                    self.ensure_public(span,
+                                       def,
+                                       Some(origdid),
+                                       format!("{} `{}`",
+                                               tyname,
+                                               name.get()));
                 }
             }
         };
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index f391239df33..8b6cfe88f41 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -824,7 +824,8 @@ impl Repr for ty::Method {
 
 impl Repr for ast::Ident {
     fn repr(&self, _tcx: ctxt) -> ~str {
-        token::ident_to_str(self).to_owned()
+        let string = token::get_ident(self.name);
+        string.get().to_str()
     }
 }