]> git.proxmox.com Git - rustc.git/blobdiff - src/librustc_driver/test.rs
Imported Upstream version 1.0.0~beta.3
[rustc.git] / src / librustc_driver / test.rs
index f68c76f4c44243dc455c912538db7f0e8486716c..12b16e95a71a43601b7448d4a1abdf7541c650c8 100644 (file)
 use diagnostic;
 use diagnostic::Emitter;
 use driver;
+use rustc_lint;
 use rustc_resolve as resolve;
 use rustc_typeck::middle::lang_items;
-use rustc_typeck::middle::region::{self, CodeExtent};
+use rustc_typeck::middle::region::{self, CodeExtent, DestructionScopeData};
 use rustc_typeck::middle::resolve_lifetime;
 use rustc_typeck::middle::stability;
 use rustc_typeck::middle::subst;
 use rustc_typeck::middle::subst::Subst;
 use rustc_typeck::middle::ty::{self, Ty};
-use rustc_typeck::middle::infer::combine::Combine;
+use rustc_typeck::middle::ty_relate::TypeRelation;
 use rustc_typeck::middle::infer;
 use rustc_typeck::middle::infer::lub::Lub;
 use rustc_typeck::middle::infer::glb::Glb;
@@ -43,7 +44,7 @@ struct RH<'a> {
     sub: &'a [RH<'a>]
 }
 
-static EMPTY_SOURCE_STR: &'static str = "#![no_std]";
+const EMPTY_SOURCE_STR: &'static str = "#![feature(no_std)] #![no_std]";
 
 struct ExpectErrorEmitter {
     messages: Vec<String>
@@ -56,7 +57,7 @@ fn remove_message(e: &mut ExpectErrorEmitter, msg: &str, lvl: Level) {
     }
 
     debug!("Error: {}", msg);
-    match e.messages.iter().position(|m| msg.contains(m.as_slice())) {
+    match e.messages.iter().position(|m| msg.contains(m)) {
         Some(i) => {
             e.messages.remove(i);
         }
@@ -87,13 +88,13 @@ impl Emitter for ExpectErrorEmitter {
     }
 }
 
-fn errors(msgs: &[&str]) -> (Box<Emitter+Send>, uint) {
+fn errors(msgs: &[&str]) -> (Box<Emitter+Send>, usize) {
     let v = msgs.iter().map(|m| m.to_string()).collect();
     (box ExpectErrorEmitter { messages: v } as Box<Emitter+Send>, msgs.len())
 }
 
 fn test_env<F>(source_string: &str,
-               (emitter, expected_err_count): (Box<Emitter+Send>, uint),
+               (emitter, expected_err_count): (Box<Emitter+Send>, usize),
                body: F) where
     F: FnOnce(Env),
 {
@@ -103,11 +104,12 @@ fn test_env<F>(source_string: &str,
     let codemap =
         CodeMap::new();
     let diagnostic_handler =
-        diagnostic::mk_handler(emitter);
+        diagnostic::mk_handler(true, emitter);
     let span_diagnostic_handler =
         diagnostic::mk_span_handler(diagnostic_handler, codemap);
 
     let sess = session::build_session_(options, None, span_diagnostic_handler);
+    rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
     let krate_config = Vec::new();
     let input = config::Input::Str(source_string.to_string());
     let krate = driver::phase_1_parse_input(&sess, krate_config, &input);
@@ -115,27 +117,25 @@ fn test_env<F>(source_string: &str,
                     .expect("phase 2 aborted");
 
     let mut forest = ast_map::Forest::new(krate);
+    let arenas = ty::CtxtArenas::new();
     let ast_map = driver::assign_node_ids_and_map(&sess, &mut forest);
     let krate = ast_map.krate();
 
     // run just enough stuff to build a tcx:
     let lang_items = lang_items::collect_language_items(krate, &sess);
-    let resolve::CrateMap { def_map, freevars, capture_mode_map, .. } =
+    let resolve::CrateMap { def_map, freevars, .. } =
         resolve::resolve_crate(&sess, &ast_map, &lang_items, krate, resolve::MakeGlobMap::No);
     let named_region_map = resolve_lifetime::krate(&sess, krate, &def_map);
     let region_map = region::resolve_crate(&sess, krate);
-    let stability_index = stability::Index::build(krate);
-    let arenas = ty::CtxtArenas::new();
     let tcx = ty::mk_ctxt(sess,
                           &arenas,
                           def_map,
                           named_region_map,
                           ast_map,
                           freevars,
-                          capture_mode_map,
                           region_map,
                           lang_items,
-                          stability_index);
+                          stability::Index::new(krate));
     let infcx = infer::new_infer_ctxt(&tcx);
     body(Env { infcx: &infcx });
     infcx.resolve_regions_and_report_errors(ast::CRATE_NODE_ID);
@@ -148,7 +148,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
     }
 
     pub fn create_region_hierarchy(&self, rh: &RH) {
-        for child_rh in rh.sub.iter() {
+        for child_rh in rh.sub {
             self.create_region_hierarchy(child_rh);
             self.infcx.tcx.region_maps.record_encl_scope(
                 CodeExtent::from_node_id(child_rh.id),
@@ -178,11 +178,11 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
 
         fn search_mod(this: &Env,
                       m: &ast::Mod,
-                      idx: uint,
+                      idx: usize,
                       names: &[String])
                       -> Option<ast::NodeId> {
             assert!(idx < names.len());
-            for item in m.items.iter() {
+            for item in &m.items {
                 if item.ident.user_string(this.infcx.tcx) == names[idx] {
                     return search(this, &**item, idx+1, names);
                 }
@@ -192,7 +192,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
 
         fn search(this: &Env,
                   it: &ast::Item,
-                  idx: uint,
+                  idx: usize,
                   names: &[String])
                   -> Option<ast::NodeId> {
             if idx == names.len() {
@@ -200,6 +200,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
             }
 
             return match it.node {
+                ast::ItemUse(..) | ast::ItemExternCrate(..) |
                 ast::ItemConst(..) | ast::ItemStatic(..) | ast::ItemFn(..) |
                 ast::ItemForeignMod(..) | ast::ItemTy(..) => {
                     None
@@ -207,7 +208,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
 
                 ast::ItemEnum(..) | ast::ItemStruct(..) |
                 ast::ItemTrait(..) | ast::ItemImpl(..) |
-                ast::ItemMac(..) => {
+                ast::ItemMac(..) | ast::ItemDefaultImpl(..) => {
                     None
                 }
 
@@ -255,7 +256,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
                 output_ty: Ty<'tcx>)
                 -> Ty<'tcx>
     {
-        let input_args = input_tys.iter().map(|ty| *ty).collect();
+        let input_args = input_tys.iter().cloned().collect();
         ty::mk_bare_fn(self.infcx.tcx,
                        None,
                        self.infcx.tcx.mk_bare_fn(ty::BareFnTy {
@@ -279,7 +280,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
 
     pub fn t_param(&self, space: subst::ParamSpace, index: u32) -> Ty<'tcx> {
         let name = format!("T{}", index);
-        ty::mk_param(self.infcx.tcx, space, index, token::intern(&name[]))
+        ty::mk_param(self.infcx.tcx, space, index, token::intern(&name[..]))
     }
 
     pub fn re_early_bound(&self,
@@ -289,7 +290,12 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
                           -> ty::Region
     {
         let name = token::intern(name);
-        ty::ReEarlyBound(ast::DUMMY_NODE_ID, space, index, name)
+        ty::ReEarlyBound(ty::EarlyBoundRegion {
+            param_id: ast::DUMMY_NODE_ID,
+            space: space,
+            index: index,
+            name: name
+        })
     }
 
     pub fn re_late_bound_with_debruijn(&self, id: u32, debruijn: ty::DebruijnIndex) -> ty::Region {
@@ -299,14 +305,14 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
     pub fn t_rptr(&self, r: ty::Region) -> Ty<'tcx> {
         ty::mk_imm_rptr(self.infcx.tcx,
                         self.infcx.tcx.mk_region(r),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn t_rptr_late_bound(&self, id: u32) -> Ty<'tcx> {
         let r = self.re_late_bound_with_debruijn(id, ty::DebruijnIndex::new(1));
         ty::mk_imm_rptr(self.infcx.tcx,
                         self.infcx.tcx.mk_region(r),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn t_rptr_late_bound_with_debruijn(&self,
@@ -316,17 +322,17 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
         let r = self.re_late_bound_with_debruijn(id, debruijn);
         ty::mk_imm_rptr(self.infcx.tcx,
                         self.infcx.tcx.mk_region(r),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn t_rptr_scope(&self, id: ast::NodeId) -> Ty<'tcx> {
         let r = ty::ReScope(CodeExtent::from_node_id(id));
         ty::mk_imm_rptr(self.infcx.tcx, self.infcx.tcx.mk_region(r),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn re_free(&self, nid: ast::NodeId, id: u32) -> ty::Region {
-        ty::ReFree(ty::FreeRegion { scope: CodeExtent::from_node_id(nid),
+        ty::ReFree(ty::FreeRegion { scope: DestructionScopeData::new(nid),
                                     bound_region: ty::BrAnon(id)})
     }
 
@@ -334,13 +340,13 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
         let r = self.re_free(nid, id);
         ty::mk_imm_rptr(self.infcx.tcx,
                         self.infcx.tcx.mk_region(r),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn t_rptr_static(&self) -> Ty<'tcx> {
         ty::mk_imm_rptr(self.infcx.tcx,
                         self.infcx.tcx.mk_region(ty::ReStatic),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn dummy_type_trace(&self) -> infer::TypeTrace<'tcx> {
@@ -349,21 +355,21 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
 
     pub fn sub(&self) -> Sub<'a, 'tcx> {
         let trace = self.dummy_type_trace();
-        Sub(self.infcx.combine_fields(true, trace))
+        self.infcx.sub(true, trace)
     }
 
     pub fn lub(&self) -> Lub<'a, 'tcx> {
         let trace = self.dummy_type_trace();
-        Lub(self.infcx.combine_fields(true, trace))
+        self.infcx.lub(true, trace)
     }
 
     pub fn glb(&self) -> Glb<'a, 'tcx> {
         let trace = self.dummy_type_trace();
-        Glb(self.infcx.combine_fields(true, trace))
+        self.infcx.glb(true, trace)
     }
 
     pub fn make_lub_ty(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> Ty<'tcx> {
-        match self.lub().tys(t1, t2) {
+        match self.lub().relate(&t1, &t2) {
             Ok(t) => t,
             Err(ref e) => panic!("unexpected error computing LUB: {}",
                                 ty::type_err_to_str(self.infcx.tcx, e))
@@ -373,7 +379,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
     /// Checks that `t1 <: t2` is true (this may register additional
     /// region checks).
     pub fn check_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
-        match self.sub().tys(t1, t2) {
+        match self.sub().relate(&t1, &t2) {
             Ok(_) => { }
             Err(ref e) => {
                 panic!("unexpected error computing sub({},{}): {}",
@@ -387,7 +393,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
     /// Checks that `t1 <: t2` is false (this may register additional
     /// region checks).
     pub fn check_not_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
-        match self.sub().tys(t1, t2) {
+        match self.sub().relate(&t1, &t2) {
             Err(_) => { }
             Ok(_) => {
                 panic!("unexpected success computing sub({},{})",
@@ -399,7 +405,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
 
     /// Checks that `LUB(t1,t2) == t_lub`
     pub fn check_lub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>, t_lub: Ty<'tcx>) {
-        match self.lub().tys(t1, t2) {
+        match self.lub().relate(&t1, &t2) {
             Ok(t) => {
                 self.assert_eq(t, t_lub);
             }
@@ -416,7 +422,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
                self.ty_to_string(t1),
                self.ty_to_string(t2),
                self.ty_to_string(t_glb));
-        match self.glb().tys(t1, t2) {
+        match self.glb().relate(&t1, &t2) {
             Err(e) => {
                 panic!("unexpected error computing LUB: {:?}", e)
             }
@@ -463,15 +469,15 @@ fn contravariant_region_ptr_err() {
 fn sub_free_bound_false() {
     //! Test that:
     //!
-    //!     fn(&'a int) <: for<'b> fn(&'b int)
+    //!     fn(&'a isize) <: for<'b> fn(&'b isize)
     //!
     //! does NOT hold.
 
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_free1 = env.t_rptr_free(0, 1);
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
-        env.check_not_sub(env.t_fn(&[t_rptr_free1], env.tcx().types.int),
-                          env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_not_sub(env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
+                          env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -479,15 +485,15 @@ fn sub_free_bound_false() {
 fn sub_bound_free_true() {
     //! Test that:
     //!
-    //!     for<'a> fn(&'a int) <: fn(&'b int)
+    //!     for<'a> fn(&'a isize) <: fn(&'b isize)
     //!
     //! DOES hold.
 
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_free1 = env.t_rptr_free(0, 1);
-        env.check_sub(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free1], env.tcx().types.int));
+        env.check_sub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free1], env.tcx().types.isize));
     })
 }
 
@@ -495,15 +501,15 @@ fn sub_bound_free_true() {
 fn sub_free_bound_false_infer() {
     //! Test that:
     //!
-    //!     fn(_#1) <: for<'b> fn(&'b int)
+    //!     fn(_#1) <: for<'b> fn(&'b isize)
     //!
     //! does NOT hold for any instantiation of `_#1`.
 
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_infer1 = env.infcx.next_ty_var();
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
-        env.check_not_sub(env.t_fn(&[t_infer1], env.tcx().types.int),
-                          env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_not_sub(env.t_fn(&[t_infer1], env.tcx().types.isize),
+                          env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -511,19 +517,19 @@ fn sub_free_bound_false_infer() {
 fn lub_free_bound_infer() {
     //! Test result of:
     //!
-    //!     LUB(fn(_#1), for<'b> fn(&'b int))
+    //!     LUB(fn(_#1), for<'b> fn(&'b isize))
     //!
-    //! This should yield `fn(&'_ int)`. We check
-    //! that it yields `fn(&'x int)` for some free `'x`,
+    //! This should yield `fn(&'_ isize)`. We check
+    //! that it yields `fn(&'x isize)` for some free `'x`,
     //! anyhow.
 
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_infer1 = env.infcx.next_ty_var();
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_free1 = env.t_rptr_free(0, 1);
-        env.check_lub(env.t_fn(&[t_infer1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free1], env.tcx().types.int));
+        env.check_lub(env.t_fn(&[t_infer1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free1], env.tcx().types.isize));
     });
 }
 
@@ -532,9 +538,9 @@ fn lub_bound_bound() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_bound2 = env.t_rptr_late_bound(2);
-        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound2], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound2], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -543,9 +549,9 @@ fn lub_bound_free() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_free1 = env.t_rptr_free(0, 1);
-        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free1], env.tcx().types.int));
+        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free1], env.tcx().types.isize));
     })
 }
 
@@ -554,9 +560,9 @@ fn lub_bound_static() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_static = env.t_rptr_static();
-        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_static], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_static], env.tcx().types.int));
+        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_static], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_static], env.tcx().types.isize));
     })
 }
 
@@ -577,9 +583,9 @@ fn lub_free_free() {
         let t_rptr_free1 = env.t_rptr_free(0, 1);
         let t_rptr_free2 = env.t_rptr_free(0, 2);
         let t_rptr_static = env.t_rptr_static();
-        env.check_lub(env.t_fn(&[t_rptr_free1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free2], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_static], env.tcx().types.int));
+        env.check_lub(env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free2], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_static], env.tcx().types.isize));
     })
 }
 
@@ -587,6 +593,7 @@ fn lub_free_free() {
 fn lub_returning_scope() {
     test_env(EMPTY_SOURCE_STR,
              errors(&["cannot infer an appropriate lifetime"]), |env| {
+                 env.create_simple_region_hierarchy();
                  let t_rptr_scope10 = env.t_rptr_scope(10);
                  let t_rptr_scope11 = env.t_rptr_scope(11);
 
@@ -602,9 +609,9 @@ fn glb_free_free_with_common_scope() {
         let t_rptr_free1 = env.t_rptr_free(0, 1);
         let t_rptr_free2 = env.t_rptr_free(0, 2);
         let t_rptr_scope = env.t_rptr_scope(0);
-        env.check_glb(env.t_fn(&[t_rptr_free1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free2], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_scope], env.tcx().types.int));
+        env.check_glb(env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free2], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_scope], env.tcx().types.isize));
     })
 }
 
@@ -613,9 +620,9 @@ fn glb_bound_bound() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_bound2 = env.t_rptr_late_bound(2);
-        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound2], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound2], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -624,9 +631,9 @@ fn glb_bound_free() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_free1 = env.t_rptr_free(0, 1);
-        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -636,14 +643,14 @@ fn glb_bound_free_infer() {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_infer1 = env.infcx.next_ty_var();
 
-        // compute GLB(fn(_) -> int, for<'b> fn(&'b int) -> int),
-        // which should yield for<'b> fn(&'b int) -> int
-        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_infer1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        // compute GLB(fn(_) -> isize, for<'b> fn(&'b isize) -> isize),
+        // which should yield for<'b> fn(&'b isize) -> isize
+        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_infer1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
 
         // as a side-effect, computing GLB should unify `_` with
-        // `&'_ int`
+        // `&'_ isize`
         let t_resolve1 = env.infcx.shallow_resolve(t_infer1);
         match t_resolve1.sty {
             ty::ty_rptr(..) => { }
@@ -657,9 +664,9 @@ fn glb_bound_static() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_static = env.t_rptr_static();
-        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_static], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_static], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -683,7 +690,7 @@ fn subst_ty_renumber_bound() {
         let substs = subst::Substs::new_type(vec![t_rptr_bound1], vec![]);
         let t_substituted = t_source.subst(env.infcx.tcx, &substs);
 
-        // t_expected = fn(&'a int)
+        // t_expected = fn(&'a isize)
         let t_expected = {
             let t_ptr_bound2 = env.t_rptr_late_bound_with_debruijn(1, ty::DebruijnIndex::new(2));
             env.t_fn(&[t_ptr_bound2], env.t_nil())
@@ -718,7 +725,7 @@ fn subst_ty_renumber_some_bounds() {
         let substs = subst::Substs::new_type(vec![t_rptr_bound1], vec![]);
         let t_substituted = t_source.subst(env.infcx.tcx, &substs);
 
-        // t_expected = (&'a int, fn(&'a int))
+        // t_expected = (&'a isize, fn(&'a isize))
         //
         // but not that the Debruijn index is different in the different cases.
         let t_expected = {
@@ -770,7 +777,7 @@ fn subst_region_renumber_region() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let re_bound1 = env.re_late_bound_with_debruijn(1, ty::DebruijnIndex::new(1));
 
-        // type t_source<'a> = fn(&'a int)
+        // type t_source<'a> = fn(&'a isize)
         let t_source = {
             let re_early = env.re_early_bound(subst::TypeSpace, 0, "'a");
             env.t_fn(&[env.t_rptr(re_early)], env.t_nil())
@@ -779,7 +786,7 @@ fn subst_region_renumber_region() {
         let substs = subst::Substs::new_type(vec![], vec![re_bound1]);
         let t_substituted = t_source.subst(env.infcx.tcx, &substs);
 
-        // t_expected = fn(&'a int)
+        // t_expected = fn(&'a isize)
         //
         // but not that the Debruijn index is different in the different cases.
         let t_expected = {
@@ -801,18 +808,17 @@ fn subst_region_renumber_region() {
 fn walk_ty() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let tcx = env.infcx.tcx;
-        let int_ty = tcx.types.int;
-        let uint_ty = tcx.types.uint;
+        let int_ty = tcx.types.isize;
+        let uint_ty = tcx.types.usize;
         let tup1_ty = ty::mk_tup(tcx, vec!(int_ty, uint_ty, int_ty, uint_ty));
         let tup2_ty = ty::mk_tup(tcx, vec!(tup1_ty, tup1_ty, uint_ty));
         let uniq_ty = ty::mk_uniq(tcx, tup2_ty);
         let walked: Vec<_> = uniq_ty.walk().collect();
-        assert_eq!(vec!(uniq_ty,
-                        tup2_ty,
-                        tup1_ty, int_ty, uint_ty, int_ty, uint_ty,
-                        tup1_ty, int_ty, uint_ty, int_ty, uint_ty,
-                        uint_ty),
-                   walked);
+        assert_eq!(walked, [uniq_ty,
+                            tup2_ty,
+                            tup1_ty, int_ty, uint_ty, int_ty, uint_ty,
+                            tup1_ty, int_ty, uint_ty, int_ty, uint_ty,
+                            uint_ty]);
     })
 }
 
@@ -820,8 +826,8 @@ fn walk_ty() {
 fn walk_ty_skip_subtree() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let tcx = env.infcx.tcx;
-        let int_ty = tcx.types.int;
-        let uint_ty = tcx.types.uint;
+        let int_ty = tcx.types.isize;
+        let uint_ty = tcx.types.usize;
         let tup1_ty = ty::mk_tup(tcx, vec!(int_ty, uint_ty, int_ty, uint_ty));
         let tup2_ty = ty::mk_tup(tcx, vec!(tup1_ty, tup1_ty, uint_ty));
         let uniq_ty = ty::mk_uniq(tcx, tup2_ty);
@@ -835,7 +841,7 @@ fn walk_ty_skip_subtree() {
                                 (uint_ty, false),
                                 (int_ty, false),
                                 (uint_ty, false),
-                                (tup1_ty, true), // skip the int/uint/int/uint
+                                (tup1_ty, true), // skip the isize/usize/isize/usize
                                 (uint_ty, false));
         expected.reverse();