]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/util/interner.rs
rollup merge of #21457: alexcrichton/issue-21436
[rust.git] / src / libsyntax / util / interner.rs
index 5dca39f1aea063f57779bcb71015708f2c458576..1b35b1b04a313e872c72ecf0f868a6ea4d5f51ca 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! An "interner" is a data structure that associates values with uint tags and
+//! An "interner" is a data structure that associates values with usize tags and
 //! allows bidirectional lookup; i.e. given a value, one can easily find the
 //! type, and vice versa.
 
@@ -70,10 +70,10 @@ pub fn gensym(&self, val: T) -> Name {
 
     pub fn get(&self, idx: Name) -> T {
         let vect = self.vect.borrow();
-        (*vect)[idx.uint()].clone()
+        (*vect)[idx.usize()].clone()
     }
 
-    pub fn len(&self) -> uint {
+    pub fn len(&self) -> usize {
         let vect = self.vect.borrow();
         (*vect).len()
     }
@@ -114,9 +114,16 @@ fn cmp(&self, other: &RcStr) -> Ordering {
     }
 }
 
-impl fmt::Show for RcStr {
+impl fmt::Debug for RcStr {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        use std::fmt::Show;
+        use std::fmt::Debug;
+        self[].fmt(f)
+    }
+}
+
+impl fmt::Display for RcStr {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use std::fmt::Display;
         self[].fmt(f)
     }
 }
@@ -190,16 +197,16 @@ pub fn gensym_copy(&self, idx : Name) -> Name {
         let new_idx = Name(self.len() as u32);
         // leave out of map to avoid colliding
         let mut vect = self.vect.borrow_mut();
-        let existing = (*vect)[idx.uint()].clone();
+        let existing = (*vect)[idx.usize()].clone();
         vect.push(existing);
         new_idx
     }
 
     pub fn get(&self, idx: Name) -> RcStr {
-        (*self.vect.borrow())[idx.uint()].clone()
+        (*self.vect.borrow())[idx.usize()].clone()
     }
 
-    pub fn len(&self) -> uint {
+    pub fn len(&self) -> usize {
         self.vect.borrow().len()
     }