]> git.lizzy.rs Git - rust.git/commitdiff
libsyntax: rename functions from uint to usize
authorPaul Collier <paul@paulcollier.ca>
Sat, 17 Jan 2015 23:49:08 +0000 (23:49 +0000)
committerPaul Collier <paul@paulcollier.ca>
Sun, 18 Jan 2015 04:47:30 +0000 (20:47 -0800)
30 files changed:
src/librustc/lint/builtin.rs
src/librustc/util/ppaux.rs
src/librustc_resolve/lib.rs
src/librustc_trans/save/span_utils.rs
src/librustc_trans/trans/common.rs
src/librustc_trans/trans/debuginfo.rs
src/librustc_trans/trans/meth.rs
src/librustdoc/clean/mod.rs
src/libsyntax/ast.rs
src/libsyntax/codemap.rs
src/libsyntax/diagnostic.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/deriving/decodable.rs
src/libsyntax/ext/deriving/default.rs
src/libsyntax/ext/deriving/encodable.rs
src/libsyntax/ext/deriving/hash.rs
src/libsyntax/ext/deriving/rand.rs
src/libsyntax/ext/env.rs
src/libsyntax/ext/format.rs
src/libsyntax/ext/mtwt.rs
src/libsyntax/ext/quote.rs
src/libsyntax/ext/source_util.rs
src/libsyntax/fold.rs
src/libsyntax/parse/lexer/comments.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pprust.rs
src/libsyntax/util/interner.rs
src/test/auxiliary/roman_numerals.rs

index 59808b302f47dff362678a63eb41cf1b073fffbf..75897fe6d7ccb5edc861e1dd5901b82e0682b5ae 100644 (file)
@@ -1329,7 +1329,7 @@ fn check_unused_mut_pat(&self, cx: &Context, pats: &[P<ast::Pat>]) {
                 let ident = path1.node;
                 if let ast::BindByValue(ast::MutMutable) = mode {
                     if !token::get_ident(ident).get().starts_with("_") {
-                        match mutables.entry(ident.name.uint()) {
+                        match mutables.entry(ident.name.usize()) {
                             Vacant(entry) => { entry.insert(vec![id]); },
                             Occupied(mut entry) => { entry.get_mut().push(id); },
                         }
index fb44d0cadfa6c8f50ba5965078236e948fc5b331..8427c471eee322e2038903af0897df853b31ee3a 100644 (file)
@@ -164,7 +164,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
     fn explain_span(cx: &ctxt, heading: &str, span: Span)
                     -> (String, Option<Span>) {
         let lo = cx.sess.codemap().lookup_char_pos_adj(span.lo);
-        (format!("the {} at {}:{}", heading, lo.line, lo.col.to_uint()),
+        (format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize()),
          Some(span))
     }
 }
index 7743a437858d2e97d3b4a350b8d81dfc7a750d4a..19992164118e95c0bc43f079035ed3c4a974b3d6 100644 (file)
@@ -1962,7 +1962,7 @@ fn search_parent_externals(needle: Name, module: &Rc<Module>)
                     let module_name = self.module_to_string(&*search_module);
                     let mut span = span;
                     let msg = if "???" == &module_name[] {
-                        span.hi = span.lo + Pos::from_uint(segment_name.get().len());
+                        span.hi = span.lo + Pos::from_usize(segment_name.get().len());
 
                         match search_parent_externals(name,
                                                      &self.current_module) {
index 77343612ac88bd0010e3ee69eda2c8a0a536f517..97b3cda006bf7b36441b53b188ac58aacd105c8b 100644 (file)
@@ -40,8 +40,8 @@ pub fn extent_str(&self, span: Span) -> String {
         format!("file_name,{},file_line,{},file_col,{},extent_start,{},extent_start_bytes,{},\
                  file_line_end,{},file_col_end,{},extent_end,{},extent_end_bytes,{}",
                 lo_loc.file.name,
-                lo_loc.line, lo_loc.col.to_uint(), lo_pos.to_uint(), lo_pos_byte.to_uint(),
-                hi_loc.line, hi_loc.col.to_uint(), hi_pos.to_uint(), hi_pos_byte.to_uint())
+                lo_loc.line, lo_loc.col.to_usize(), lo_pos.to_usize(), lo_pos_byte.to_usize(),
+                hi_loc.line, hi_loc.col.to_usize(), hi_pos.to_usize(), hi_pos_byte.to_usize())
     }
 
     // sub_span starts at span.lo, so we need to adjust the positions etc.
index 3eee4637de1995322030c5224f7d65de8cf50946..519b4f628e23a416630e3beb281037f862ffd245 100644 (file)
@@ -275,7 +275,7 @@ pub fn return_type_is_void(ccx: &CrateContext, ty: Ty) -> bool {
 /// Generates a unique symbol based off the name given. This is used to create
 /// unique symbols for things like closures.
 pub fn gensym_name(name: &str) -> PathElem {
-    let num = token::gensym(name).uint();
+    let num = token::gensym(name).usize();
     // use one colon which will get translated to a period by the mangler, and
     // we're guaranteed that `num` is globally unique for this crate.
     PathName(token::gensym(&format!("{}:{}", name, num)[]))
@@ -848,7 +848,7 @@ pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> Va
                                                 !null_terminated as Bool);
 
         let gsym = token::gensym("str");
-        let buf = CString::from_vec(format!("str{}", gsym.uint()).into_bytes());
+        let buf = CString::from_vec(format!("str{}", gsym.usize()).into_bytes());
         let g = llvm::LLVMAddGlobal(cx.llmod(), val_ty(sc).to_ref(), buf.as_ptr());
         llvm::LLVMSetInitializer(g, sc);
         llvm::LLVMSetGlobalConstant(g, True);
@@ -873,7 +873,7 @@ pub fn C_binary_slice(cx: &CrateContext, data: &[u8]) -> ValueRef {
         let lldata = C_bytes(cx, data);
 
         let gsym = token::gensym("binary");
-        let name = format!("binary{}", gsym.uint());
+        let name = format!("binary{}", gsym.usize());
         let name = CString::from_vec(name.into_bytes());
         let g = llvm::LLVMAddGlobal(cx.llmod(), val_ty(lldata).to_ref(),
                                     name.as_ptr());
index a03a5090c050bc9f73b33618f523a8311c7c596e..4b52e5f989f6aea49288ca780b5cd4c77a103c7b 100644 (file)
@@ -1204,7 +1204,7 @@ pub fn set_source_location(fcx: &FunctionContext,
 
                 set_debug_location(cx, DebugLocation::new(scope,
                                                           loc.line,
-                                                          loc.col.to_uint()));
+                                                          loc.col.to_usize()));
             } else {
                 set_debug_location(cx, UnknownLocation);
             }
@@ -1719,7 +1719,7 @@ fn declare_local<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
     set_debug_location(cx, DebugLocation::new(scope_metadata,
                                               loc.line,
-                                              loc.col.to_uint()));
+                                              loc.col.to_usize()));
     unsafe {
         let instr = llvm::LLVMDIBuilderInsertDeclareAtEnd(
             DIB(cx),
@@ -3282,7 +3282,7 @@ fn with_new_scope<F>(cx: &CrateContext,
                 parent_scope,
                 file_metadata,
                 loc.line as c_uint,
-                loc.col.to_uint() as c_uint)
+                loc.col.to_usize() as c_uint)
         };
 
         scope_stack.push(ScopeStackEntry { scope_metadata: scope_metadata,
@@ -3404,7 +3404,7 @@ fn walk_pattern(cx: &CrateContext,
                                 parent_scope,
                                 file_metadata,
                                 loc.line as c_uint,
-                                loc.col.to_uint() as c_uint)
+                                loc.col.to_usize() as c_uint)
                         };
 
                         scope_stack.push(ScopeStackEntry {
index 0fb0dffe930fa958547c5cd2375f3b001d91c075..712f5fa53c958f30acf14d73deae6f1a2cee1e77 100644 (file)
@@ -785,7 +785,7 @@ pub fn make_vtable<I: Iterator<Item=ValueRef>>(ccx: &CrateContext,
     unsafe {
         let tbl = C_struct(ccx, &components[], false);
         let sym = token::gensym("vtable");
-        let buf = CString::from_vec(format!("vtable{}", sym.uint()).into_bytes());
+        let buf = CString::from_vec(format!("vtable{}", sym.usize()).into_bytes());
         let vt_gvar = llvm::LLVMAddGlobal(ccx.llmod(), val_ty(tbl).to_ref(),
                                           buf.as_ptr());
         llvm::LLVMSetInitializer(vt_gvar, tbl);
index 8dc3adad3b27a010feae9758f61c427960daaf76..c6ac616932d61d1471f17d9da19c91fa8baea0d1 100644 (file)
@@ -1870,9 +1870,9 @@ fn clean(&self, cx: &DocContext) -> Span {
         Span {
             filename: filename.to_string(),
             loline: lo.line,
-            locol: lo.col.to_uint(),
+            locol: lo.col.to_usize(),
             hiline: hi.line,
-            hicol: hi.col.to_uint(),
+            hicol: hi.col.to_usize(),
         }
     }
 }
index 81ce521f68c8f877c93a59ac9ae3ae9ac0c18478..47d55818f5ec80d726f9381414514ddc2e68d91a 100644 (file)
@@ -95,7 +95,7 @@ pub fn as_str<'a>(&'a self) -> &'a str {
 
     pub fn encode_with_hygiene(&self) -> String {
         format!("\x00name_{},ctxt_{}\x00",
-                self.name.uint(),
+                self.name.usize(),
                 self.ctxt)
     }
 }
@@ -181,7 +181,7 @@ pub fn as_str<'a>(&'a self) -> &'a str {
         }
     }
 
-    pub fn uint(&self) -> usize {
+    pub fn usize(&self) -> usize {
         let Name(nm) = *self;
         nm as usize
     }
index 6b9dda88a3697641a437374fe0181c06a18cd580..07544f35b19ca1e915ea7e99ec59e60d48bd88e8 100644 (file)
@@ -30,8 +30,8 @@
 use serialize::{Encodable, Decodable, Encoder, Decoder};
 
 pub trait Pos {
-    fn from_uint(n: usize) -> Self;
-    fn to_uint(&self) -> usize;
+    fn from_usize(n: usize) -> Self;
+    fn to_usize(&self) -> usize;
 }
 
 /// A byte offset. Keep this small (currently 32-bits), as AST contains
@@ -49,15 +49,15 @@ pub trait Pos {
 // have been unsuccessful
 
 impl Pos for BytePos {
-    fn from_uint(n: usize) -> BytePos { BytePos(n as u32) }
-    fn to_uint(&self) -> usize { let BytePos(n) = *self; n as usize }
+    fn from_usize(n: usize) -> BytePos { BytePos(n as u32) }
+    fn to_usize(&self) -> usize { let BytePos(n) = *self; n as usize }
 }
 
 impl Add for BytePos {
     type Output = BytePos;
 
     fn add(self, rhs: BytePos) -> BytePos {
-        BytePos((self.to_uint() + rhs.to_uint()) as u32)
+        BytePos((self.to_usize() + rhs.to_usize()) as u32)
     }
 }
 
@@ -65,20 +65,20 @@ impl Sub for BytePos {
     type Output = BytePos;
 
     fn sub(self, rhs: BytePos) -> BytePos {
-        BytePos((self.to_uint() - rhs.to_uint()) as u32)
+        BytePos((self.to_usize() - rhs.to_usize()) as u32)
     }
 }
 
 impl Pos for CharPos {
-    fn from_uint(n: usize) -> CharPos { CharPos(n) }
-    fn to_uint(&self) -> usize { let CharPos(n) = *self; n }
+    fn from_usize(n: usize) -> CharPos { CharPos(n) }
+    fn to_usize(&self) -> usize { let CharPos(n) = *self; n }
 }
 
 impl Add for CharPos {
     type Output = CharPos;
 
     fn add(self, rhs: CharPos) -> CharPos {
-        CharPos(self.to_uint() + rhs.to_uint())
+        CharPos(self.to_usize() + rhs.to_usize())
     }
 }
 
@@ -86,7 +86,7 @@ impl Sub for CharPos {
     type Output = CharPos;
 
     fn sub(self, rhs: CharPos) -> CharPos {
-        CharPos(self.to_uint() - rhs.to_uint())
+        CharPos(self.to_usize() - rhs.to_usize())
     }
 }
 
@@ -310,7 +310,7 @@ pub fn get_line(&self, line_number: usize) -> Option<String> {
         let lines = self.lines.borrow();
         lines.get(line_number).map(|&line| {
             let begin: BytePos = line - self.start_pos;
-            let begin = begin.to_uint();
+            let begin = begin.to_usize();
             let slice = &self.src[begin..];
             match slice.find('\n') {
                 Some(e) => &slice[..e],
@@ -351,7 +351,7 @@ pub fn new_filemap(&self, filename: FileName, src: String) -> Rc<FileMap> {
         let mut files = self.files.borrow_mut();
         let start_pos = match files.last() {
             None => 0,
-            Some(last) => last.start_pos.to_uint() + last.src.len(),
+            Some(last) => last.start_pos.to_usize() + last.src.len(),
         };
 
         // Remove utf-8 BOM if any.
@@ -374,7 +374,7 @@ pub fn new_filemap(&self, filename: FileName, src: String) -> Rc<FileMap> {
         let filemap = Rc::new(FileMap {
             name: filename,
             src: src.to_string(),
-            start_pos: Pos::from_uint(start_pos),
+            start_pos: Pos::from_usize(start_pos),
             lines: RefCell::new(Vec::new()),
             multibyte_chars: RefCell::new(Vec::new()),
         });
@@ -389,7 +389,7 @@ pub fn mk_substr_filename(&self, sp: Span) -> String {
         (format!("<{}:{}:{}>",
                  pos.file.name,
                  pos.line,
-                 pos.col.to_uint() + 1)).to_string()
+                 pos.col.to_usize() + 1)).to_string()
     }
 
     /// Lookup source information about a BytePos
@@ -417,9 +417,9 @@ pub fn span_to_string(&self, sp: Span) -> String {
         return (format!("{}:{}:{}: {}:{}",
                         lo.filename,
                         lo.line,
-                        lo.col.to_uint() + 1,
+                        lo.col.to_usize() + 1,
                         hi.line,
-                        hi.col.to_uint() + 1)).to_string()
+                        hi.col.to_usize() + 1)).to_string()
     }
 
     pub fn span_to_filename(&self, sp: Span) -> FileName {
@@ -447,7 +447,7 @@ pub fn span_to_snippet(&self, sp: Span) -> Option<String> {
         if begin.fm.start_pos != end.fm.start_pos {
             None
         } else {
-            Some((&begin.fm.src[begin.pos.to_uint()..end.pos.to_uint()]).to_string())
+            Some((&begin.fm.src[begin.pos.to_usize()..end.pos.to_usize()]).to_string())
         }
     }
 
@@ -484,14 +484,14 @@ pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos {
                 total_extra_bytes += mbc.bytes - 1;
                 // We should never see a byte position in the middle of a
                 // character
-                assert!(bpos.to_uint() >= mbc.pos.to_uint() + mbc.bytes);
+                assert!(bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes);
             } else {
                 break;
             }
         }
 
-        assert!(map.start_pos.to_uint() + total_extra_bytes <= bpos.to_uint());
-        CharPos(bpos.to_uint() - map.start_pos.to_uint() - total_extra_bytes)
+        assert!(map.start_pos.to_usize() + total_extra_bytes <= bpos.to_usize());
+        CharPos(bpos.to_usize() - map.start_pos.to_usize() - total_extra_bytes)
     }
 
     fn lookup_filemap_idx(&self, pos: BytePos) -> usize {
@@ -520,13 +520,13 @@ fn lookup_filemap_idx(&self, pos: BytePos) -> usize {
             }
             if a == 0 {
                 panic!("position {} does not resolve to a source location",
-                      pos.to_uint());
+                      pos.to_usize());
             }
             a -= 1;
         }
         if a >= len {
             panic!("position {} does not resolve to a source location",
-                  pos.to_uint())
+                  pos.to_usize())
         }
 
         return a;
index 9c8ea7d9d684376ea8bb4cc3789b6aa3ea5225a7..c86991b6e407b8d96900257cfb2369377ee5dc0c 100644 (file)
@@ -475,7 +475,7 @@ fn highlight_lines(err: &mut EmitterWriter,
         while num > 0u { num /= 10u; digits += 1u; }
 
         // indent past |name:## | and the 0-offset column location
-        let left = fm.name.len() + digits + lo.col.to_uint() + 3u;
+        let left = fm.name.len() + digits + lo.col.to_usize() + 3u;
         let mut s = String::new();
         // Skip is the number of characters we need to skip because they are
         // part of the 'filename:line ' part of the previous line.
@@ -502,7 +502,7 @@ fn highlight_lines(err: &mut EmitterWriter,
         let hi = cm.lookup_char_pos(sp.hi);
         if hi.col != lo.col {
             // the ^ already takes up one space
-            let num_squigglies = hi.col.to_uint() - lo.col.to_uint() - 1u;
+            let num_squigglies = hi.col.to_usize() - lo.col.to_usize() - 1us;
             for _ in range(0, num_squigglies) {
                 s.push('~');
             }
@@ -551,7 +551,7 @@ fn custom_highlight_lines(w: &mut EmitterWriter,
     let last_line_start = format!("{}:{} ", fm.name, lines[lines.len()-1]+1);
     let hi = cm.lookup_char_pos(sp.hi);
     // Span seems to use half-opened interval, so subtract 1
-    let skip = last_line_start.len() + hi.col.to_uint() - 1;
+    let skip = last_line_start.len() + hi.col.to_usize() - 1;
     let mut s = String::new();
     for _ in range(0, skip) {
         s.push(' ');
index d960186cdd88053789504050cddfd5d9693b0418..3bac972dbb50878c9822391d0e8170eaa19737f6 100644 (file)
@@ -134,7 +134,7 @@ fn expr_struct_ident(&self, span: Span, id: ast::Ident,
 
     fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr>;
 
-    fn expr_uint(&self, span: Span, i: usize) -> P<ast::Expr>;
+    fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr>;
     fn expr_int(&self, sp: Span, i: int) -> P<ast::Expr>;
     fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr>;
     fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr>;
@@ -579,7 +579,7 @@ fn expr_unary(&self, sp: Span, op: ast::UnOp, e: P<ast::Expr>) -> P<ast::Expr> {
     fn expr_field_access(&self, sp: Span, expr: P<ast::Expr>, ident: ast::Ident) -> P<ast::Expr> {
         let field_name = token::get_ident(ident);
         let field_span = Span {
-            lo: sp.lo - Pos::from_uint(field_name.get().len()),
+            lo: sp.lo - Pos::from_usize(field_name.get().len()),
             hi: sp.hi,
             expn_id: sp.expn_id,
         };
@@ -589,7 +589,7 @@ fn expr_field_access(&self, sp: Span, expr: P<ast::Expr>, ident: ast::Ident) ->
     }
     fn expr_tup_field_access(&self, sp: Span, expr: P<ast::Expr>, idx: usize) -> P<ast::Expr> {
         let field_span = Span {
-            lo: sp.lo - Pos::from_uint(idx.to_string().len()),
+            lo: sp.lo - Pos::from_usize(idx.to_string().len()),
             hi: sp.hi,
             expn_id: sp.expn_id,
         };
@@ -641,7 +641,7 @@ fn expr_struct_ident(&self, span: Span,
     fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr> {
         self.expr(sp, ast::ExprLit(P(respan(sp, lit))))
     }
-    fn expr_uint(&self, span: Span, i: usize) -> P<ast::Expr> {
+    fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> {
         self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs(false))))
     }
     fn expr_int(&self, sp: Span, i: int) -> P<ast::Expr> {
@@ -710,7 +710,7 @@ fn expr_fail(&self, span: Span, msg: InternedString) -> P<ast::Expr> {
         let loc = self.codemap().lookup_char_pos(span.lo);
         let expr_file = self.expr_str(span,
                                       token::intern_and_get_ident(&loc.file.name[]));
-        let expr_line = self.expr_uint(span, loc.line);
+        let expr_line = self.expr_usize(span, loc.line);
         let expr_file_line_tuple = self.expr_tuple(span, vec!(expr_file, expr_line));
         let expr_file_line_ptr = self.expr_addr_of(span, expr_file_line_tuple);
         self.expr_call_global(
index 6a41874b9350d65459d5636f4691b79f08906b63..62304265dfac63d47004f0a8a4ac47646ea6a11a 100644 (file)
@@ -114,7 +114,7 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                 cx.expr_try(span,
                     cx.expr_method_call(span, blkdecoder.clone(), read_struct_field,
                                         vec!(cx.expr_str(span, name),
-                                          cx.expr_uint(span, field),
+                                          cx.expr_usize(span, field),
                                           exprdecode.clone())))
             });
             let result = cx.expr_ok(trait_span, result);
@@ -123,7 +123,7 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                                 cx.ident_of("read_struct"),
                                 vec!(
                 cx.expr_str(trait_span, token::get_ident(substr.type_ident)),
-                cx.expr_uint(trait_span, nfields),
+                cx.expr_usize(trait_span, nfields),
                 cx.lambda_expr_1(trait_span, result, blkarg)
             ))
         }
@@ -143,14 +143,14 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                                                    path,
                                                    parts,
                                                    |cx, span, _, field| {
-                    let idx = cx.expr_uint(span, field);
+                    let idx = cx.expr_usize(span, field);
                     cx.expr_try(span,
                         cx.expr_method_call(span, blkdecoder.clone(), rvariant_arg,
                                             vec!(idx, exprdecode.clone())))
                 });
 
                 arms.push(cx.arm(v_span,
-                                 vec!(cx.pat_lit(v_span, cx.expr_uint(v_span, i))),
+                                 vec!(cx.pat_lit(v_span, cx.expr_usize(v_span, i))),
                                  decoded));
             }
 
index 047c4fef3c4f185e95973b7535c25ca0ff13c786..f22e02d7b8da16105ec8712a74d62b61daf30e8e 100644 (file)
@@ -79,7 +79,7 @@ fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructur
         StaticEnum(..) => {
             cx.span_err(trait_span, "`Default` cannot be derived for enums, only structs");
             // let compilation continue
-            cx.expr_uint(trait_span, 0)
+            cx.expr_usize(trait_span, 0)
         }
         _ => cx.span_bug(trait_span, "Non-static method in `deriving(Default)`")
     };
index 496aec556f1fd8b6f421238e7bfcb022d491347e..3189a39160ec45c0c87ee39ce891f3f8b7230e50 100644 (file)
@@ -27,7 +27,7 @@
 //!         s.emit_struct("Node", 1, |this| {
 //!             this.emit_struct_field("id", 0, |this| {
 //!                 Encodable::encode(&self.id, this)
-//!                 /* this.emit_uint(self.id) can also be used */
+//!                 /* this.emit_usize(self.id) can also be used */
 //!             })
 //!         })
 //!     }
@@ -192,7 +192,7 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                 let call = cx.expr_method_call(span, blkencoder.clone(),
                                                emit_struct_field,
                                                vec!(cx.expr_str(span, name),
-                                                 cx.expr_uint(span, i),
+                                                 cx.expr_usize(span, i),
                                                  lambda));
 
                 // last call doesn't need a try!
@@ -218,7 +218,7 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                                 cx.ident_of("emit_struct"),
                                 vec!(
                 cx.expr_str(trait_span, token::get_ident(substr.type_ident)),
-                cx.expr_uint(trait_span, fields.len()),
+                cx.expr_usize(trait_span, fields.len()),
                 blk
             ))
         }
@@ -239,7 +239,7 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                 let lambda = cx.lambda_expr_1(span, enc, blkarg);
                 let call = cx.expr_method_call(span, blkencoder.clone(),
                                                emit_variant_arg,
-                                               vec!(cx.expr_uint(span, i),
+                                               vec!(cx.expr_usize(span, i),
                                                  lambda));
                 let call = if i != last {
                     cx.expr_try(span, call)
@@ -262,8 +262,8 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
             let call = cx.expr_method_call(trait_span, blkencoder,
                                            cx.ident_of("emit_enum_variant"),
                                            vec!(name,
-                                             cx.expr_uint(trait_span, idx),
-                                             cx.expr_uint(trait_span, fields.len()),
+                                             cx.expr_usize(trait_span, idx),
+                                             cx.expr_usize(trait_span, fields.len()),
                                              blk));
             let blk = cx.lambda_expr_1(trait_span, call, blkarg);
             let ret = cx.expr_method_call(trait_span,
index 08336be87d107712c5c8f1f156d2784efcde8f0f..8dac864c2ae3b689b9a89e38b3faa13f57c44b4d 100644 (file)
@@ -89,7 +89,7 @@ fn hash_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
             // iteration function.
             let discriminant = match variant.node.disr_expr {
                 Some(ref d) => d.clone(),
-                None => cx.expr_uint(trait_span, index)
+                None => cx.expr_usize(trait_span, index)
             };
 
             stmts.push(call_hash(trait_span, discriminant));
index 1359cada67396fa1c57059051996216e41559017..be45a54e71026eafbdba30e6d2b15d067555e1ad 100644 (file)
@@ -80,10 +80,10 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
             if variants.is_empty() {
                 cx.span_err(trait_span, "`Rand` cannot be derived for enums with no variants");
                 // let compilation continue
-                return cx.expr_uint(trait_span, 0);
+                return cx.expr_usize(trait_span, 0);
             }
 
-            let variant_count = cx.expr_uint(trait_span, variants.len());
+            let variant_count = cx.expr_usize(trait_span, variants.len());
 
             let rand_name = cx.path_all(trait_span,
                                         true,
@@ -115,7 +115,7 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
                                               variant_count);
 
             let mut arms = variants.iter().enumerate().map(|(i, &(ident, v_span, ref summary))| {
-                let i_expr = cx.expr_uint(v_span, i);
+                let i_expr = cx.expr_usize(v_span, i);
                 let pat = cx.pat_lit(v_span, i_expr);
 
                 let path = cx.path(v_span, vec![substr.type_ident, ident]);
index 9b54e259761db82f42d35d24bd7c9fef6abf497f..9f6bf352b040443609c0c30943259b5f8b0656d7 100644 (file)
@@ -104,7 +104,7 @@ pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     let e = match os::getenv(var.get()) {
         None => {
             cx.span_err(sp, msg.get());
-            cx.expr_uint(sp, 0)
+            cx.expr_usize(sp, 0)
         }
         Some(s) => cx.expr_str(sp, token::intern_and_get_ident(&s[]))
     };
index 684ae84872be1d29f3ea8ea19d0dc5ae2cf46ab5..068c7ec08672ab10ed3dc6d5b007312c4910dad8 100644 (file)
@@ -326,11 +326,11 @@ fn trans_count(&self, c: parse::Count) -> P<ast::Expr> {
         match c {
             parse::CountIs(i) => {
                 self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "CountIs"),
-                                          vec!(self.ecx.expr_uint(sp, i)))
+                                          vec!(self.ecx.expr_usize(sp, i)))
             }
             parse::CountIsParam(i) => {
                 self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "CountIsParam"),
-                                          vec!(self.ecx.expr_uint(sp, i)))
+                                          vec!(self.ecx.expr_usize(sp, i)))
             }
             parse::CountImplied => {
                 let path = self.ecx.path_global(sp, Context::rtpath(self.ecx,
@@ -349,7 +349,7 @@ fn trans_count(&self, c: parse::Count) -> P<ast::Expr> {
                 };
                 let i = i + self.args.len();
                 self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "CountIsParam"),
-                                          vec!(self.ecx.expr_uint(sp, i)))
+                                          vec!(self.ecx.expr_usize(sp, i)))
             }
         }
     }
@@ -382,7 +382,7 @@ fn trans_piece(&mut self, piece: &parse::Piece) -> Option<P<ast::Expr>> {
                     }
                     parse::ArgumentIs(i) => {
                         self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "ArgumentIs"),
-                                                  vec!(self.ecx.expr_uint(sp, i)))
+                                                  vec!(self.ecx.expr_usize(sp, i)))
                     }
                     // Named arguments are converted to positional arguments at
                     // the end of the list of arguments
@@ -393,7 +393,7 @@ fn trans_piece(&mut self, piece: &parse::Piece) -> Option<P<ast::Expr>> {
                         };
                         let i = i + self.args.len();
                         self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "ArgumentIs"),
-                                                  vec!(self.ecx.expr_uint(sp, i)))
+                                                  vec!(self.ecx.expr_usize(sp, i)))
                     }
                 };
 
@@ -432,7 +432,7 @@ fn trans_piece(&mut self, piece: &parse::Piece) -> Option<P<ast::Expr>> {
                     }
                 };
                 let align = self.ecx.expr_path(align);
-                let flags = self.ecx.expr_uint(sp, arg.format.flags);
+                let flags = self.ecx.expr_usize(sp, arg.format.flags);
                 let prec = self.trans_count(arg.format.precision);
                 let width = self.trans_count(arg.format.width);
                 let path = self.ecx.path_global(sp, Context::rtpath(self.ecx, "FormatSpec"));
index 9bcb026a550fa228c8a961fde8b9ff7c3357af7d..7adc443759fe87624bd861e6a4ad1cab2af74ed5 100644 (file)
@@ -398,7 +398,7 @@ fn test_marksof () {
          assert_eq! (marksof_internal (ans, stopname,&t), vec!(16));}
         // rename where stop doesn't match:
         { let chain = vec!(M(9),
-                        R(id(name1.uint() as u32,
+                        R(id(name1.usize() as u32,
                              apply_mark_internal (4, EMPTY_CTXT,&mut t)),
                           Name(100101102)),
                         M(14));
@@ -407,7 +407,7 @@ fn test_marksof () {
         // rename where stop does match
         { let name1sc = apply_mark_internal(4, EMPTY_CTXT, &mut t);
          let chain = vec!(M(9),
-                       R(id(name1.uint() as u32, name1sc),
+                       R(id(name1.usize() as u32, name1sc),
                          stopname),
                        M(14));
          let ans = unfold_test_sc(chain,EMPTY_CTXT,&mut t);
index c42b188302cc3ab25c1001c80b183535604622e9..a5885ac6c5d3479f43c574ae8c60d0536b1fb080 100644 (file)
@@ -588,7 +588,7 @@ macro_rules! mk_lit {
         }
 
         token::Literal(token::StrRaw(ident, n), suf) => {
-            return mk_lit!("StrRaw", suf, mk_name(cx, sp, ident.ident()), cx.expr_uint(sp, n))
+            return mk_lit!("StrRaw", suf, mk_name(cx, sp, ident.ident()), cx.expr_usize(sp, n))
         }
 
         token::Ident(ident, style) => {
index 31a1a838b133db55bc1052022994cf86993efd5a..a74adbf40851565929b38512893cbc2fef3b5965 100644 (file)
@@ -35,7 +35,7 @@ pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     let topmost = cx.original_span_in_file();
     let loc = cx.codemap().lookup_char_pos(topmost.lo);
 
-    base::MacExpr::new(cx.expr_uint(topmost, loc.line))
+    base::MacExpr::new(cx.expr_usize(topmost, loc.line))
 }
 
 /* column!(): expands to the current column number */
@@ -45,7 +45,7 @@ pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
 
     let topmost = cx.original_span_in_file();
     let loc = cx.codemap().lookup_char_pos(topmost.lo);
-    base::MacExpr::new(cx.expr_uint(topmost, loc.col.to_uint()))
+    base::MacExpr::new(cx.expr_usize(topmost, loc.col.to_usize()))
 }
 
 /// file!(): expands to the current filename */
index cae0cf904f6774b9b3b38c47b667fb97e7b6c200..1649075fd71433c1efc425c902d5967ddfed3e88 100644 (file)
@@ -174,8 +174,8 @@ fn fold_ident(&mut self, i: Ident) -> Ident {
         noop_fold_ident(i, self)
     }
 
-    fn fold_uint(&mut self, i: usize) -> usize {
-        noop_fold_uint(i, self)
+    fn fold_usize(&mut self, i: usize) -> usize {
+        noop_fold_usize(i, self)
     }
 
     fn fold_path(&mut self, p: Path) -> Path {
@@ -505,7 +505,7 @@ pub fn noop_fold_ident<T: Folder>(i: Ident, _: &mut T) -> Ident {
     i
 }
 
-pub fn noop_fold_uint<T: Folder>(i: usize, _: &mut T) -> usize {
+pub fn noop_fold_usize<T: Folder>(i: usize, _: &mut T) -> usize {
     i
 }
 
@@ -1377,7 +1377,7 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span}: Expr, folder: &mut T) ->
             }
             ExprTupField(el, ident) => {
                 ExprTupField(folder.fold_expr(el),
-                             respan(ident.span, folder.fold_uint(ident.node)))
+                             respan(ident.span, folder.fold_usize(ident.node)))
             }
             ExprIndex(el, er) => {
                 ExprIndex(folder.fold_expr(el), folder.fold_expr(er))
index 59a3c3bcb3edc94d99b8bfc2dd130474d80cbaa4..d710c6d6c0f94ed4327b50f44081403720e36d28 100644 (file)
@@ -208,7 +208,7 @@ fn read_line_comments(rdr: &mut StringReader, code_to_the_left: bool,
 /// whitespace.  Note k may be outside bounds of s.
 fn all_whitespace(s: &str, col: CharPos) -> Option<usize> {
     let len = s.len();
-    let mut col = col.to_uint();
+    let mut col = col.to_usize();
     let mut cursor: usize = 0;
     while col > 0 && cursor < len {
         let r: str::CharRange = s.char_range_at(cursor);
index cd159f7c599bba64c654a0cf71a8fb6d8d388950..dfb0230cf3480a7bfb87355501afff7a294ecd82 100644 (file)
@@ -212,8 +212,8 @@ fn err_span_char(&self, from_pos: BytePos, to_pos: BytePos, m: &str, c: char) {
     /// offending string to the error message
     fn fatal_span_verbose(&self, from_pos: BytePos, to_pos: BytePos, mut m: String) -> ! {
         m.push_str(": ");
-        let from = self.byte_offset(from_pos).to_uint();
-        let to = self.byte_offset(to_pos).to_uint();
+        let from = self.byte_offset(from_pos).to_usize();
+        let to = self.byte_offset(to_pos).to_usize();
         m.push_str(&self.filemap.src[from..to]);
         self.fatal_span_(from_pos, to_pos, &m[]);
     }
@@ -272,8 +272,8 @@ fn with_str_from_to<T, F>(&self, start: BytePos, end: BytePos, f: F) -> T where
         F: FnOnce(&str) -> T,
     {
         f(self.filemap.src.slice(
-                self.byte_offset(start).to_uint(),
-                self.byte_offset(end).to_uint()))
+                self.byte_offset(start).to_usize(),
+                self.byte_offset(end).to_usize()))
     }
 
     /// Converts CRLF to LF in the given string, raising an error on bare CR.
@@ -321,7 +321,7 @@ fn translate_crlf_(rdr: &StringReader, start: BytePos,
     /// discovered, add it to the FileMap's list of line start offsets.
     pub fn bump(&mut self) {
         self.last_pos = self.pos;
-        let current_byte_offset = self.byte_offset(self.pos).to_uint();
+        let current_byte_offset = self.byte_offset(self.pos).to_usize();
         if current_byte_offset < self.filemap.src.len() {
             assert!(self.curr.is_some());
             let last_char = self.curr.unwrap();
@@ -329,7 +329,7 @@ pub fn bump(&mut self) {
                           .src
                           .char_range_at(current_byte_offset);
             let byte_offset_diff = next.next - current_byte_offset;
-            self.pos = self.pos + Pos::from_uint(byte_offset_diff);
+            self.pos = self.pos + Pos::from_usize(byte_offset_diff);
             self.curr = Some(next.ch);
             self.col = self.col + CharPos(1u);
             if last_char == '\n' {
@@ -346,7 +346,7 @@ pub fn bump(&mut self) {
     }
 
     pub fn nextch(&self) -> Option<char> {
-        let offset = self.byte_offset(self.pos).to_uint();
+        let offset = self.byte_offset(self.pos).to_usize();
         if offset < self.filemap.src.len() {
             Some(self.filemap.src.char_at(offset))
         } else {
@@ -359,7 +359,7 @@ pub fn nextch_is(&self, c: char) -> bool {
     }
 
     pub fn nextnextch(&self) -> Option<char> {
-        let offset = self.byte_offset(self.pos).to_uint();
+        let offset = self.byte_offset(self.pos).to_usize();
         let s = self.filemap.src.as_slice();
         if offset >= s.len() { return None }
         let str::CharRange { next, .. } = s.char_range_at(offset);
index 7bde32326fa8e59cfbf86b1a6d24e39ce2e4a113..1a29766cee63fa3149f721d4e818b7867b16013e 100644 (file)
@@ -1171,9 +1171,9 @@ fn visit_pat(&mut self, p: &'v ast::Pat) {
         for &src in srcs.iter() {
             let spans = get_spans_of_pat_idents(src);
             let Span{ lo, hi, .. } = spans[0];
-            assert!("self" == &src[lo.to_uint()..hi.to_uint()],
+            assert!("self" == &src[lo.to_usize()..hi.to_usize()],
                     "\"{}\" != \"self\". src=\"{}\"",
-                    &src[lo.to_uint()..hi.to_uint()], src)
+                    &src[lo.to_usize()..hi.to_usize()], src)
         }
     }
 
index aeb9599923e0e20a4bc4647ae92086735ddb7efb..08d0e5e997c8747adc099a5d288346df143746ff 100644 (file)
@@ -757,7 +757,7 @@ pub fn fresh_name(src: &ast::Ident) -> ast::Name {
 
 // create a fresh mark.
 pub fn fresh_mark() -> ast::Mrk {
-    gensym("mark").uint() as u32
+    gensym("mark").usize() as u32
 }
 
 #[cfg(test)]
index 2583c30229312cdacaf7f0017fa303c63c05637a..83ac8432f982ed614b87252d7b5fd8903b18c05c 100644 (file)
@@ -1789,7 +1789,7 @@ pub fn print_expr(&mut self, expr: &ast::Expr) -> IoResult<()> {
             ast::ExprTupField(ref expr, id) => {
                 try!(self.print_expr(&**expr));
                 try!(word(&mut self.s, "."));
-                try!(self.print_uint(id.node));
+                try!(self.print_usize(id.node));
             }
             ast::ExprIndex(ref expr, ref index) => {
                 try!(self.print_expr(&**expr));
@@ -1951,7 +1951,7 @@ pub fn print_ident(&mut self, ident: ast::Ident) -> IoResult<()> {
         self.ann.post(self, NodeIdent(&ident))
     }
 
-    pub fn print_uint(&mut self, i: usize) -> IoResult<()> {
+    pub fn print_usize(&mut self, i: usize) -> IoResult<()> {
         word(&mut self.s, &i.to_string()[])
     }
 
index 757bafaf5cb91f49f5314be074ecd07bc56df447..66b225f30dd8af39b374c9f1f317fb26affef038 100644 (file)
@@ -70,7 +70,7 @@ 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) -> usize {
@@ -190,13 +190,13 @@ 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) -> usize {
index 519f32fc248bd325bc7805edb1e86357f8fa359b..a4edc607279012f3d21a180f3a0bf7d816658e86 100644 (file)
@@ -20,7 +20,7 @@
 use syntax::parse::token;
 use syntax::ast::{TokenTree, TtToken};
 use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacExpr};
-use syntax::ext::build::AstBuilder;  // trait for expr_uint
+use syntax::ext::build::AstBuilder;  // trait for expr_usize
 use rustc::plugin::Registry;
 
 // WARNING WARNING WARNING WARNING WARNING
@@ -61,7 +61,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
         }
     }
 
-    MacExpr::new(cx.expr_uint(sp, total))
+    MacExpr::new(cx.expr_usize(sp, total))
 }
 
 #[plugin_registrar]