]> git.lizzy.rs Git - rust.git/commitdiff
rustc: use the TLS type context in Repr and UserString.
authorEduard Burtescu <edy.burt@gmail.com>
Tue, 16 Jun 2015 22:39:06 +0000 (01:39 +0300)
committerEduard Burtescu <edy.burt@gmail.com>
Thu, 18 Jun 2015 22:32:44 +0000 (01:32 +0300)
104 files changed:
src/librustc/middle/astconv_util.rs
src/librustc/middle/astencode.rs
src/librustc/middle/check_const.rs
src/librustc/middle/check_match.rs
src/librustc/middle/check_rvalues.rs
src/librustc/middle/const_eval.rs
src/librustc/middle/effect.rs
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/free_region.rs
src/librustc/middle/implicator.rs
src/librustc/middle/infer/bivariate.rs
src/librustc/middle/infer/combine.rs
src/librustc/middle/infer/equate.rs
src/librustc/middle/infer/error_reporting.rs
src/librustc/middle/infer/glb.rs
src/librustc/middle/infer/higher_ranked/mod.rs
src/librustc/middle/infer/lattice.rs
src/librustc/middle/infer/lub.rs
src/librustc/middle/infer/mod.rs
src/librustc/middle/infer/region_inference/graphviz.rs
src/librustc/middle/infer/region_inference/mod.rs
src/librustc/middle/infer/resolve.rs
src/librustc/middle/infer/sub.rs
src/librustc/middle/intrinsicck.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/stability.rs
src/librustc/middle/subst.rs
src/librustc/middle/traits/coherence.rs
src/librustc/middle/traits/error_reporting.rs
src/librustc/middle/traits/fulfill.rs
src/librustc/middle/traits/mod.rs
src/librustc/middle/traits/object_safety.rs
src/librustc/middle/traits/project.rs
src/librustc/middle/traits/select.rs
src/librustc/middle/traits/util.rs
src/librustc/middle/ty.rs
src/librustc/middle/ty_fold.rs
src/librustc/middle/ty_match.rs
src/librustc/middle/ty_relate/mod.rs
src/librustc/util/ppaux.rs
src/librustc_borrowck/borrowck/check_loans.rs
src/librustc_borrowck/borrowck/fragments.rs
src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
src/librustc_borrowck/borrowck/gather_loans/lifetime.rs
src/librustc_borrowck/borrowck/gather_loans/mod.rs
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
src/librustc_borrowck/borrowck/gather_loans/restrictions.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_borrowck/borrowck/move_data.rs
src/librustc_driver/pretty.rs
src/librustc_driver/test.rs
src/librustc_lint/builtin.rs
src/librustc_trans/back/link.rs
src/librustc_trans/save/dump_csv.rs
src/librustc_trans/save/mod.rs
src/librustc_trans/trans/_match.rs
src/librustc_trans/trans/adt.rs
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/callee.rs
src/librustc_trans/trans/cleanup.rs
src/librustc_trans/trans/closure.rs
src/librustc_trans/trans/common.rs
src/librustc_trans/trans/consts.rs
src/librustc_trans/trans/context.rs
src/librustc_trans/trans/controlflow.rs
src/librustc_trans/trans/datum.rs
src/librustc_trans/trans/debuginfo/metadata.rs
src/librustc_trans/trans/debuginfo/type_names.rs
src/librustc_trans/trans/declare.rs
src/librustc_trans/trans/expr.rs
src/librustc_trans/trans/foreign.rs
src/librustc_trans/trans/glue.rs
src/librustc_trans/trans/intrinsic.rs
src/librustc_trans/trans/meth.rs
src/librustc_trans/trans/monomorphize.rs
src/librustc_trans/trans/tvec.rs
src/librustc_trans/trans/type_of.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/assoc.rs
src/librustc_typeck/check/callee.rs
src/librustc_typeck/check/cast.rs
src/librustc_typeck/check/closure.rs
src/librustc_typeck/check/coercion.rs
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/demand.rs
src/librustc_typeck/check/dropck.rs
src/librustc_typeck/check/method/confirm.rs
src/librustc_typeck/check/method/mod.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/method/suggest.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/op.rs
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/check/upvar.rs
src/librustc_typeck/check/wf.rs
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/coherence/orphan.rs
src/librustc_typeck/coherence/overlap.rs
src/librustc_typeck/coherence/unsafety.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/lib.rs
src/librustc_typeck/variance.rs

index 698cf105ae53c12d6b1a5d4dabec5175f1dc6c63..d955cda9b77b710f5a9f33084ea0047a6bba7f80 100644 (file)
@@ -63,7 +63,7 @@ pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
         let def = match tcx.def_map.borrow().get(&ast_ty.id) {
             None => {
                 tcx.sess.span_bug(ast_ty.span,
-                                  &format!("unbound path {}", path.repr(tcx)))
+                                  &format!("unbound path {}", path.repr()))
             }
             Some(d) => d.full_def()
         };
index 4aa73d871d162954f5173bddcc4dba1dac682f86..a6386d941f5fef9ed3da8463a3205ece6575fc0b 100644 (file)
@@ -1624,7 +1624,7 @@ fn decode_side_tables(dcx: &DecodeContext,
                     c::tag_table_node_type => {
                         let ty = val_dsr.read_ty(dcx);
                         debug!("inserting ty for node {}: {}",
-                               id,  ty.repr(dcx.tcx));
+                               id,  ty.repr());
                         dcx.tcx.node_type_insert(id, ty);
                     }
                     c::tag_table_item_subst => {
index d80eedf354a0e31218967480f6694421ec7bc999..9100f45a5de89b286f2363742e269b0d13cd1689 100644 (file)
@@ -300,7 +300,7 @@ fn check_static_type(&self, e: &ast::Expr) {
 
 impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
     fn visit_item(&mut self, i: &ast::Item) {
-        debug!("visit_item(item={})", i.repr(self.tcx));
+        debug!("visit_item(item={})", i.repr());
         match i.node {
             ast::ItemStatic(_, ast::MutImmutable, ref expr) => {
                 self.check_static_type(&**expr);
index 11a1a1582c835e1aec9ae9d61bc37ba904375aef..8982a45cee8f439969adbc3e1451857344d10738 100644 (file)
@@ -210,7 +210,7 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &ast::Expr) {
                     // We know the type is inhabited, so this must be wrong
                     span_err!(cx.tcx.sess, ex.span, E0002,
                               "non-exhaustive patterns: type {} is non-empty",
-                              pat_ty.user_string(cx.tcx));
+                              pat_ty.user_string());
                 }
                 // If the type *is* empty, it's vacuously exhaustive
                 return;
@@ -243,11 +243,11 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
                             span_warn!(cx.tcx.sess, p.span, E0170,
                                 "pattern binding `{}` is named the same as one \
                                  of the variants of the type `{}`",
-                                &token::get_ident(ident.node), pat_ty.user_string(cx.tcx));
+                                &token::get_ident(ident.node), pat_ty.user_string());
                             fileline_help!(cx.tcx.sess, p.span,
                                 "if you meant to match on a variant, \
                                  consider making the path in the pattern qualified: `{}::{}`",
-                                pat_ty.user_string(cx.tcx), &token::get_ident(ident.node));
+                                pat_ty.user_string(), &token::get_ident(ident.node));
                         }
                     }
                 }
index bd3829cc395e91b7f18ab56141a3b3c1b9f0e43f..a3881327b96ad2150b9b6242bf7993554d34bcd3 100644 (file)
@@ -59,11 +59,11 @@ fn consume(&mut self,
                span: Span,
                cmt: mc::cmt<'tcx>,
                _: euv::ConsumeMode) {
-        debug!("consume; cmt: {:?}; type: {}", *cmt, cmt.ty.repr(self.tcx));
+        debug!("consume; cmt: {:?}; type: {}", *cmt, cmt.ty.repr());
         if !ty::type_is_sized(Some(self.param_env), self.tcx, span, cmt.ty) {
             span_err!(self.tcx.sess, span, E0161,
                 "cannot move a value of type {0}: the size of {0} cannot be statically determined",
-                cmt.ty.user_string(self.tcx));
+                cmt.ty.user_string());
         }
     }
 
index f64765f909028051214d15e1406f3c5cf514a789..657115e781925b7250a15f640a1c2ececf57ad5c 100644 (file)
@@ -1031,7 +1031,7 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
                                                            Vec::new()));
     let trait_substs = tcx.mk_substs(trait_substs);
     debug!("resolve_trait_associated_const: trait_substs={}",
-           trait_substs.repr(tcx));
+           trait_substs.repr());
     let trait_ref = ty::Binder(ty::TraitRef { def_id: trait_id,
                                               substs: trait_substs });
 
@@ -1055,7 +1055,7 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
                               &format!("Encountered error `{}` when trying \
                                         to select an implementation for \
                                         constant trait item reference.",
-                                       e.repr(tcx)))
+                                       e.repr()))
         }
     };
 
index c1a33c3387cde5ca25b6f0d674df5bdbc478373e..7a593da3432c944388d9dbfd3ee27844758ec12c 100644 (file)
@@ -67,7 +67,7 @@ fn check_str_index(&mut self, e: &ast::Expr) {
             _ => return
         };
         debug!("effect: checking index with base type {}",
-                 base_type.repr(self.tcx));
+                 base_type.repr());
         match base_type.sty {
             ty::TyBox(ty) | ty::TyRef(_, ty::mt{ty, ..}) => if ty::TyStr == ty.sty {
                 span_err!(self.tcx.sess, e.span, E0134,
@@ -143,7 +143,7 @@ fn visit_expr(&mut self, expr: &ast::Expr) {
                 let method_call = MethodCall::expr(expr.id);
                 let base_type = self.tcx.method_map.borrow().get(&method_call).unwrap().ty;
                 debug!("effect: method call case, base type is {}",
-                        base_type.repr(self.tcx));
+                        base_type.repr());
                 if type_is_unsafe_function(base_type) {
                     self.require_unsafe(expr.span,
                                         "invocation of unsafe method")
@@ -152,7 +152,7 @@ fn visit_expr(&mut self, expr: &ast::Expr) {
             ast::ExprCall(ref base, _) => {
                 let base_type = ty::node_id_to_type(self.tcx, base.id);
                 debug!("effect: call case, base type is {}",
-                        base_type.repr(self.tcx));
+                        base_type.repr());
                 if type_is_unsafe_function(base_type) {
                     self.require_unsafe(expr.span, "call to unsafe function")
                 }
@@ -160,7 +160,7 @@ fn visit_expr(&mut self, expr: &ast::Expr) {
             ast::ExprUnary(ast::UnDeref, ref base) => {
                 let base_type = ty::node_id_to_type(self.tcx, base.id);
                 debug!("effect: unary case, base type is {}",
-                        base_type.repr(self.tcx));
+                        base_type.repr());
                 if let ty::TyRawPtr(_) = base_type.sty {
                     self.require_unsafe(expr.span, "dereference of raw pointer")
                 }
index 3c9a4def5c856ae9fcb6d4861c1796fe262e1d91..7d4f93fb1326f81e3023b9fc15c99e1df96ae209 100644 (file)
@@ -363,7 +363,7 @@ fn delegate_consume(&mut self,
                         consume_span: Span,
                         cmt: mc::cmt<'tcx>) {
         debug!("delegate_consume(consume_id={}, cmt={})",
-               consume_id, cmt.repr(self.tcx()));
+               consume_id, cmt.repr());
 
         let mode = copy_or_move(self.typer, &cmt, DirectRefMove);
         self.delegate.consume(consume_id, consume_span, cmt, mode);
@@ -376,7 +376,7 @@ fn consume_exprs(&mut self, exprs: &Vec<P<ast::Expr>>) {
     }
 
     pub fn consume_expr(&mut self, expr: &ast::Expr) {
-        debug!("consume_expr(expr={})", expr.repr(self.tcx()));
+        debug!("consume_expr(expr={})", expr.repr());
 
         let cmt = return_if_err!(self.mc.cat_expr(expr));
         self.delegate_consume(expr.id, expr.span, cmt);
@@ -398,7 +398,7 @@ fn borrow_expr(&mut self,
                    bk: ty::BorrowKind,
                    cause: LoanCause) {
         debug!("borrow_expr(expr={}, r={}, bk={})",
-               expr.repr(self.tcx()), r.repr(self.tcx()), bk.repr(self.tcx()));
+               expr.repr(), r.repr(), bk.repr());
 
         let cmt = return_if_err!(self.mc.cat_expr(expr));
         self.delegate.borrow(expr.id, expr.span, cmt, r, bk, cause);
@@ -414,7 +414,7 @@ fn select_from_expr(&mut self, expr: &ast::Expr) {
     }
 
     pub fn walk_expr(&mut self, expr: &ast::Expr) {
-        debug!("walk_expr(expr={})", expr.repr(self.tcx()));
+        debug!("walk_expr(expr={})", expr.repr());
 
         self.walk_adjustment(expr);
 
@@ -619,7 +619,7 @@ pub fn walk_expr(&mut self, expr: &ast::Expr) {
     fn walk_callee(&mut self, call: &ast::Expr, callee: &ast::Expr) {
         let callee_ty = return_if_err!(self.typer.expr_ty_adjusted(callee));
         debug!("walk_callee: callee={} callee_ty={}",
-               callee.repr(self.tcx()), callee_ty.repr(self.tcx()));
+               callee.repr(), callee_ty.repr());
         let call_scope = region::CodeExtent::from_node_id(call.id);
         match callee_ty.sty {
             ty::TyBareFn(..) => {
@@ -637,7 +637,7 @@ fn walk_callee(&mut self, call: &ast::Expr, callee: &ast::Expr) {
                         None => {
                             self.tcx().sess.span_bug(
                                 callee.span,
-                                &format!("unexpected callee type {}", callee_ty.repr(self.tcx())))
+                                &format!("unexpected callee type {}", callee_ty.repr()))
                         }
                     };
                 match overloaded_call_type {
@@ -811,7 +811,7 @@ fn walk_adjustment(&mut self, expr: &ast::Expr) {
     fn walk_autoderefs(&mut self,
                        expr: &ast::Expr,
                        autoderefs: usize) {
-        debug!("walk_autoderefs expr={} autoderefs={}", expr.repr(self.tcx()), autoderefs);
+        debug!("walk_autoderefs expr={} autoderefs={}", expr.repr(), autoderefs);
 
         for i in 0..autoderefs {
             let deref_id = ty::MethodCall::autoderef(expr.id, i as u32);
@@ -829,7 +829,7 @@ fn walk_autoderefs(&mut self,
                         ty::TyRef(r, ref m) => (m.mutbl, r),
                         _ => self.tcx().sess.span_bug(expr.span,
                                 &format!("bad overloaded deref type {}",
-                                    method_ty.repr(self.tcx())))
+                                    method_ty.repr()))
                     };
                     let bk = ty::BorrowKind::from_mutbl(m);
                     self.delegate.borrow(expr.id, expr.span, cmt,
@@ -843,8 +843,8 @@ fn walk_autoderefref(&mut self,
                          expr: &ast::Expr,
                          adj: &ty::AutoDerefRef<'tcx>) {
         debug!("walk_autoderefref expr={} adj={}",
-               expr.repr(self.tcx()),
-               adj.repr(self.tcx()));
+               expr.repr(),
+               adj.repr());
 
         self.walk_autoderefs(expr, adj.autoderefs);
 
@@ -877,7 +877,7 @@ fn walk_autoref(&mut self,
     {
         debug!("walk_autoref(expr.id={} cmt_derefd={} opt_autoref={:?})",
                expr.id,
-               cmt_base.repr(self.tcx()),
+               cmt_base.repr(),
                opt_autoref);
 
         let cmt_base_ty = cmt_base.ty;
@@ -903,7 +903,7 @@ fn walk_autoref(&mut self,
             ty::AutoUnsafe(m) => {
                 debug!("walk_autoref: expr.id={} cmt_base={}",
                        expr.id,
-                       cmt_base.repr(self.tcx()));
+                       cmt_base.repr());
 
                 // Converting from a &T to *T (or &mut T to *mut T) is
                 // treated as borrowing it for the enclosing temporary
@@ -1011,8 +1011,8 @@ fn determine_pat_move_mode(&mut self,
                                cmt_discr: mc::cmt<'tcx>,
                                pat: &ast::Pat,
                                mode: &mut TrackMatchMode) {
-        debug!("determine_pat_move_mode cmt_discr={} pat={}", cmt_discr.repr(self.tcx()),
-               pat.repr(self.tcx()));
+        debug!("determine_pat_move_mode cmt_discr={} pat={}", cmt_discr.repr(),
+               pat.repr());
         return_if_err!(self.mc.cat_pattern(cmt_discr, pat, |_mc, cmt_pat, pat| {
             let tcx = self.tcx();
             let def_map = &self.tcx().def_map;
@@ -1043,8 +1043,8 @@ fn walk_pat(&mut self,
                 cmt_discr: mc::cmt<'tcx>,
                 pat: &ast::Pat,
                 match_mode: MatchMode) {
-        debug!("walk_pat cmt_discr={} pat={}", cmt_discr.repr(self.tcx()),
-               pat.repr(self.tcx()));
+        debug!("walk_pat cmt_discr={} pat={}", cmt_discr.repr(),
+               pat.repr());
 
         let mc = &self.mc;
         let typer = self.typer;
@@ -1055,8 +1055,8 @@ fn walk_pat(&mut self,
                 let tcx = typer.tcx();
 
                 debug!("binding cmt_pat={} pat={} match_mode={:?}",
-                       cmt_pat.repr(tcx),
-                       pat.repr(tcx),
+                       cmt_pat.repr(),
+                       pat.repr(),
                        match_mode);
 
                 // pat_ty: the type of the binding being produced.
@@ -1161,8 +1161,8 @@ fn walk_pat(&mut self,
                                 };
 
                             debug!("variant downcast_cmt={} pat={}",
-                                   downcast_cmt.repr(tcx),
-                                   pat.repr(tcx));
+                                   downcast_cmt.repr(),
+                                   pat.repr());
 
                             delegate.matched_pat(pat, downcast_cmt, match_mode);
                         }
@@ -1173,8 +1173,8 @@ fn walk_pat(&mut self,
                             // e.g. patterns for unit structs).
 
                             debug!("struct cmt_pat={} pat={}",
-                                   cmt_pat.repr(tcx),
-                                   pat.repr(tcx));
+                                   cmt_pat.repr(),
+                                   pat.repr());
 
                             delegate.matched_pat(pat, cmt_pat, match_mode);
                         }
@@ -1194,7 +1194,7 @@ fn walk_pat(&mut self,
                             if !tcx.sess.has_errors() {
                                 let msg = format!("Pattern has unexpected type: {:?} and type {}",
                                                   def,
-                                                  cmt_pat.ty.repr(tcx));
+                                                  cmt_pat.ty.repr());
                                 tcx.sess.span_bug(pat.span, &msg)
                             }
                         }
@@ -1211,7 +1211,7 @@ fn walk_pat(&mut self,
                             if !tcx.sess.has_errors() {
                                 let msg = format!("Pattern has unexpected def: {:?} and type {}",
                                                   def,
-                                                  cmt_pat.ty.repr(tcx));
+                                                  cmt_pat.ty.repr());
                                 tcx.sess.span_bug(pat.span, &msg[..])
                             }
                         }
@@ -1237,7 +1237,7 @@ fn walk_pat(&mut self,
     }
 
     fn walk_captures(&mut self, closure_expr: &ast::Expr) {
-        debug!("walk_captures({})", closure_expr.repr(self.tcx()));
+        debug!("walk_captures({})", closure_expr.repr());
 
         ty::with_freevars(self.tcx(), closure_expr.id, |freevars| {
             for freevar in freevars {
index 0c8a956f686a215f536d2dba73f7716ab461bf05..a245de3deae38fa583b2c81b5084c0e25f8fc8c7 100644 (file)
@@ -33,7 +33,7 @@ pub fn relate_free_regions_from_implications<'tcx>(&mut self,
                                                        implications: &[Implication<'tcx>])
     {
         for implication in implications {
-            debug!("implication: {}", implication.repr(tcx));
+            debug!("implication: {}", implication.repr());
             match *implication {
                 Implication::RegionSubRegion(_, ty::ReFree(free_a), ty::ReFree(free_b)) => {
                     self.relate_free_regions(free_a, free_b);
@@ -50,7 +50,7 @@ pub fn relate_free_regions_from_implications<'tcx>(&mut self,
     pub fn relate_free_regions_from_predicates<'tcx>(&mut self,
                                                      tcx: &ty::ctxt<'tcx>,
                                                      predicates: &[ty::Predicate<'tcx>]) {
-        debug!("relate_free_regions_from_predicates(predicates={})", predicates.repr(tcx));
+        debug!("relate_free_regions_from_predicates(predicates={})", predicates.repr());
         for predicate in predicates {
             match *predicate {
                 ty::Predicate::Projection(..) |
@@ -69,8 +69,8 @@ pub fn relate_free_regions_from_predicates<'tcx>(&mut self,
                             // All named regions are instantiated with free regions.
                             tcx.sess.bug(
                                 &format!("record_region_bounds: non free region: {} / {}",
-                                         r_a.repr(tcx),
-                                         r_b.repr(tcx)));
+                                         r_a.repr(),
+                                         r_b.repr()));
                         }
                     }
                 }
index fc9636ae3665f6df12fa2a3efccf0fbdf6a97a87..599ecc6e7a97a9f020298315e22079730c31aae1 100644 (file)
@@ -55,8 +55,8 @@ pub fn implications<'a,'tcx>(
 {
     debug!("implications(body_id={}, ty={}, outer_region={})",
            body_id,
-           ty.repr(closure_typer.tcx()),
-           outer_region.repr(closure_typer.tcx()));
+           ty.repr(),
+           outer_region.repr());
 
     let mut stack = Vec::new();
     stack.push((outer_region, None));
@@ -68,7 +68,7 @@ pub fn implications<'a,'tcx>(
                               out: Vec::new(),
                               visited: FnvHashSet() };
     wf.accumulate_from_ty(ty);
-    debug!("implications: out={}", wf.out.repr(closure_typer.tcx()));
+    debug!("implications: out={}", wf.out.repr());
     wf.out
 }
 
@@ -79,7 +79,7 @@ fn tcx(&self) -> &'a ty::ctxt<'tcx> {
 
     fn accumulate_from_ty(&mut self, ty: Ty<'tcx>) {
         debug!("accumulate_from_ty(ty={})",
-               ty.repr(self.tcx()));
+               ty.repr());
 
         // When expanding out associated types, we can visit a cyclic
         // set of types. Issue #23003.
@@ -313,7 +313,7 @@ fn accumulate_from_assoc_types_transitive(&mut self,
                                               data: &ty::PolyTraitPredicate<'tcx>)
     {
         debug!("accumulate_from_assoc_types_transitive({})",
-               data.repr(self.tcx()));
+               data.repr());
 
         for poly_trait_ref in traits::supertraits(self.tcx(), data.to_poly_trait_ref()) {
             match ty::no_late_bound_regions(self.tcx(), &poly_trait_ref) {
@@ -327,7 +327,7 @@ fn accumulate_from_assoc_types(&mut self,
                                    trait_ref: ty::TraitRef<'tcx>)
     {
         debug!("accumulate_from_assoc_types({})",
-               trait_ref.repr(self.tcx()));
+               trait_ref.repr());
 
         let trait_def_id = trait_ref.def_id;
         let trait_def = ty::lookup_trait_def(self.tcx(), trait_def_id);
@@ -337,7 +337,7 @@ fn accumulate_from_assoc_types(&mut self,
                      .map(|&name| ty::mk_projection(self.tcx(), trait_ref.clone(), name))
                      .collect();
         debug!("accumulate_from_assoc_types: assoc_type_projections={}",
-               assoc_type_projections.repr(self.tcx()));
+               assoc_type_projections.repr());
         let tys = match self.fully_normalize(&assoc_type_projections) {
             Ok(tys) => { tys }
             Err(ErrorReported) => { return; }
@@ -400,7 +400,7 @@ fn accumulate_from_object_ty(&mut self,
     }
 
     fn fully_normalize<T>(&self, value: &T) -> Result<T,ErrorReported>
-        where T : TypeFoldable<'tcx> + ty::HasProjectionTypes + Clone + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + ty::HasProjectionTypes + Clone + Repr
     {
         let value =
             traits::fully_normalize(self.infcx,
@@ -455,32 +455,32 @@ pub fn object_region_bounds<'tcx>(
     ty::required_region_bounds(tcx, open_ty, predicates)
 }
 
-impl<'tcx> Repr<'tcx> for Implication<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for Implication<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             Implication::RegionSubRegion(_, ref r_a, ref r_b) => {
                 format!("RegionSubRegion({}, {})",
-                        r_a.repr(tcx),
-                        r_b.repr(tcx))
+                        r_a.repr(),
+                        r_b.repr())
             }
 
             Implication::RegionSubGeneric(_, ref r, ref p) => {
                 format!("RegionSubGeneric({}, {})",
-                        r.repr(tcx),
-                        p.repr(tcx))
+                        r.repr(),
+                        p.repr())
             }
 
             Implication::RegionSubClosure(_, ref a, ref b, ref c) => {
                 format!("RegionSubClosure({}, {}, {})",
-                        a.repr(tcx),
-                        b.repr(tcx),
-                        c.repr(tcx))
+                        a.repr(),
+                        b.repr(),
+                        c.repr())
             }
 
             Implication::Predicate(ref def_id, ref p) => {
                 format!("Predicate({}, {})",
-                        def_id.repr(tcx),
-                        p.repr(tcx))
+                        def_id.repr(),
+                        p.repr())
             }
         }
     }
index 1ab01453c0f1a68f6b12d2a359c5aa81d9a44d2a..87eb08955117f0111c9491a4ecf10209c2afe14b 100644 (file)
@@ -74,7 +74,7 @@ fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,
 
     fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
         debug!("{}.tys({}, {})", self.tag(),
-               a.repr(self.fields.infcx.tcx), b.repr(self.fields.infcx.tcx));
+               a.repr(), b.repr());
         if a == b { return Ok(a); }
 
         let infcx = self.fields.infcx;
index 864e9ed0b978f2b6f40874005f126af735210595..decd07b87c07a20534970d813f89cb5468385f70 100644 (file)
@@ -214,9 +214,9 @@ pub fn instantiate(&self,
             };
 
             debug!("instantiate(a_ty={} dir={:?} b_vid={})",
-                   a_ty.repr(tcx),
+                   a_ty.repr(),
                    dir,
-                   b_vid.repr(tcx));
+                   b_vid.repr());
 
             // Check whether `vid` has been instantiated yet.  If not,
             // make a generalized form of `ty` and instantiate with
@@ -232,8 +232,8 @@ pub fn instantiate(&self,
                     });
                     debug!("instantiate(a_ty={}, dir={:?}, \
                                         b_vid={}, generalized_ty={})",
-                           a_ty.repr(tcx), dir, b_vid.repr(tcx),
-                           generalized_ty.repr(tcx));
+                           a_ty.repr(), dir, b_vid.repr(),
+                           generalized_ty.repr());
                     self.infcx.type_variables
                         .borrow_mut()
                         .instantiate_and_push(
@@ -336,7 +336,7 @@ fn fold_region(&mut self, r: ty::Region) -> ty::Region {
                 self.tcx().sess.span_bug(
                     self.span,
                     &format!("Encountered early bound region when generalizing: {}",
-                            r.repr(self.tcx())));
+                            r.repr()));
             }
 
             // Always make a fresh region variable for skolemized regions;
index da0bca890422329ef76004ec331f4447b3c10498..0d97535ed3abeb834ce687db3d7823d8e7822fff 100644 (file)
@@ -46,7 +46,7 @@ fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,
 
     fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
         debug!("{}.tys({}, {})", self.tag(),
-               a.repr(self.fields.infcx.tcx), b.repr(self.fields.infcx.tcx));
+               a.repr(), b.repr());
         if a == b { return Ok(a); }
 
         let infcx = self.fields.infcx;
@@ -77,8 +77,8 @@ fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
     fn regions(&mut self, a: ty::Region, b: ty::Region) -> RelateResult<'tcx, ty::Region> {
         debug!("{}.regions({}, {})",
                self.tag(),
-               a.repr(self.fields.infcx.tcx),
-               b.repr(self.fields.infcx.tcx));
+               a.repr(),
+               b.repr());
         let origin = Subtype(self.fields.trace.clone());
         self.fields.infcx.region_vars.make_eqregion(origin, a, b);
         Ok(a)
index 515e8b82a78f9e5289aa35ef9df0ed2e8e86777f..fa324c57bcd064d6d30c9df2edbc30edc06a45e6 100644 (file)
@@ -170,7 +170,7 @@ fn explain_span(tcx: &ty::ctxt, heading: &str, span: Span)
                 ty::BrFresh(_) => "an anonymous lifetime defined on".to_owned(),
                 _ => {
                     format!("the lifetime {} as defined on",
-                            fr.bound_region.user_string(tcx))
+                            fr.bound_region.user_string())
                 }
             };
 
@@ -229,7 +229,7 @@ fn report_and_explain_type_error(&self,
 
     fn values_str(&self, values: &ValuePairs<'tcx>) -> Option<String>;
 
-    fn expected_found_str<T: UserString<'tcx> + Resolvable<'tcx>>(
+    fn expected_found_str<T: UserString + Resolvable<'tcx>>(
         &self,
         exp_found: &ty::expected_found<T>)
         -> Option<String>;
@@ -507,7 +507,7 @@ fn values_str(&self, values: &ValuePairs<'tcx>) -> Option<String> {
         }
     }
 
-    fn expected_found_str<T: UserString<'tcx> + Resolvable<'tcx>>(
+    fn expected_found_str<T: UserString + Resolvable<'tcx>>(
         &self,
         exp_found: &ty::expected_found<T>)
         -> Option<String>
@@ -523,8 +523,8 @@ fn expected_found_str<T: UserString<'tcx> + Resolvable<'tcx>>(
         }
 
         Some(format!("expected `{}`, found `{}`",
-                     expected.user_string(self.tcx),
-                     found.user_string(self.tcx)))
+                     expected.user_string(),
+                     found.user_string()))
     }
 
     fn report_generic_bound_failure(&self,
@@ -540,9 +540,9 @@ fn report_generic_bound_failure(&self,
 
         let labeled_user_string = match bound_kind {
             GenericKind::Param(ref p) =>
-                format!("the parameter type `{}`", p.user_string(self.tcx)),
+                format!("the parameter type `{}`", p.user_string()),
             GenericKind::Projection(ref p) =>
-                format!("the associated type `{}`", p.user_string(self.tcx)),
+                format!("the associated type `{}`", p.user_string()),
         };
 
         match sub {
@@ -554,8 +554,8 @@ fn report_generic_bound_failure(&self,
                     origin.span(),
                     &format!(
                         "consider adding an explicit lifetime bound `{}: {}`...",
-                        bound_kind.user_string(self.tcx),
-                        sub.user_string(self.tcx)));
+                        bound_kind.user_string(),
+                        sub.user_string()));
             }
 
             ty::ReStatic => {
@@ -566,7 +566,7 @@ fn report_generic_bound_failure(&self,
                     origin.span(),
                     &format!(
                         "consider adding an explicit lifetime bound `{}: 'static`...",
-                        bound_kind.user_string(self.tcx)));
+                        bound_kind.user_string()));
             }
 
             _ => {
@@ -578,7 +578,7 @@ fn report_generic_bound_failure(&self,
                     origin.span(),
                     &format!(
                         "consider adding an explicit lifetime bound for `{}`",
-                        bound_kind.user_string(self.tcx)));
+                        bound_kind.user_string()));
                 note_and_explain_region(
                     self.tcx,
                     &format!("{} must be valid for ", labeled_user_string),
@@ -1561,7 +1561,7 @@ fn give_expl_lifetime_param(&self,
     fn report_inference_failure(&self,
                                 var_origin: RegionVariableOrigin) {
         let br_string = |br: ty::BoundRegion| {
-            let mut s = br.user_string(self.tcx);
+            let mut s = br.user_string();
             if !s.is_empty() {
                 s.push_str(" ");
             }
index 5822fb0f2d432fba8d7c3fe10959268c158d3fc4..b611565c151ca0deb668de24210b833947292539 100644 (file)
@@ -57,8 +57,8 @@ fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
     fn regions(&mut self, a: ty::Region, b: ty::Region) -> RelateResult<'tcx, ty::Region> {
         debug!("{}.regions({}, {})",
                self.tag(),
-               a.repr(self.fields.infcx.tcx),
-               b.repr(self.fields.infcx.tcx));
+               a.repr(),
+               b.repr());
 
         let origin = Subtype(self.fields.trace.clone());
         Ok(self.fields.infcx.region_vars.glb_regions(origin, a, b))
index 3d946aa2fbc8bbb9ff36dfb7adf007544f86c129..d38de0f5a3f650a75555f3eb3937501e4b24acae 100644 (file)
@@ -49,7 +49,7 @@ fn higher_ranked_sub<T>(&self, a: &Binder<T>, b: &Binder<T>)
         let tcx = self.infcx.tcx;
 
         debug!("higher_ranked_sub(a={}, b={})",
-               a.repr(tcx), b.repr(tcx));
+               a.repr(), b.repr());
 
         // Rather than checking the subtype relationship between `a` and `b`
         // as-is, we need to do some extra work here in order to make sure
@@ -75,8 +75,8 @@ fn higher_ranked_sub<T>(&self, a: &Binder<T>, b: &Binder<T>)
             let (b_prime, skol_map) =
                 self.infcx.skolemize_late_bound_regions(b, snapshot);
 
-            debug!("a_prime={}", a_prime.repr(tcx));
-            debug!("b_prime={}", b_prime.repr(tcx));
+            debug!("a_prime={}", a_prime.repr());
+            debug!("b_prime={}", b_prime.repr());
 
             // Compare types now that bound regions have been replaced.
             let result = try!(self.sub().relate(&a_prime, &b_prime));
@@ -99,7 +99,7 @@ fn higher_ranked_sub<T>(&self, a: &Binder<T>, b: &Binder<T>)
             }
 
             debug!("higher_ranked_sub: OK result={}",
-                   result.repr(tcx));
+                   result.repr());
 
             Ok(ty::Binder(result))
         });
@@ -125,7 +125,7 @@ fn higher_ranked_lub<T>(&self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tc
                 try!(self.lub().relate(&a_with_fresh, &b_with_fresh));
             let result0 =
                 self.infcx.resolve_type_vars_if_possible(&result0);
-            debug!("lub result0 = {}", result0.repr(self.tcx()));
+            debug!("lub result0 = {}", result0.repr());
 
             // Generalize the regions appearing in result0 if possible
             let new_vars = self.infcx.region_vars_confined_to_snapshot(snapshot);
@@ -138,9 +138,9 @@ fn higher_ranked_lub<T>(&self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tc
                                                     &new_vars, &a_map, r));
 
             debug!("lub({},{}) = {}",
-                   a.repr(self.tcx()),
-                   b.repr(self.tcx()),
-                   result1.repr(self.tcx()));
+                   a.repr(),
+                   b.repr(),
+                   result1.repr());
 
             Ok(ty::Binder(result1))
         });
@@ -199,7 +199,7 @@ fn higher_ranked_glb<T>(&self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tc
         where T: Relate<'a,'tcx>
     {
         debug!("higher_ranked_glb({}, {})",
-               a.repr(self.tcx()), b.repr(self.tcx()));
+               a.repr(), b.repr());
 
         // Make a snapshot so we can examine "all bindings that were
         // created as part of this type comparison".
@@ -219,7 +219,7 @@ fn higher_ranked_glb<T>(&self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tc
                 try!(self.glb().relate(&a_with_fresh, &b_with_fresh));
             let result0 =
                 self.infcx.resolve_type_vars_if_possible(&result0);
-            debug!("glb result0 = {}", result0.repr(self.tcx()));
+            debug!("glb result0 = {}", result0.repr());
 
             // Generalize the regions appearing in result0 if possible
             let new_vars = self.infcx.region_vars_confined_to_snapshot(snapshot);
@@ -234,9 +234,9 @@ fn higher_ranked_glb<T>(&self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tc
                                                     r));
 
             debug!("glb({},{}) = {}",
-                   a.repr(self.tcx()),
-                   b.repr(self.tcx()),
-                   result1.repr(self.tcx()));
+                   a.repr(),
+                   b.repr(),
+                   result1.repr());
 
             Ok(ty::Binder(result1))
         });
@@ -452,8 +452,8 @@ fn region_vars_confined_to_snapshot(&self,
         });
 
         debug!("region_vars_confined_to_snapshot: region_vars={} escaping_types={}",
-               region_vars.repr(self.tcx),
-               escaping_types.repr(self.tcx));
+               region_vars.repr(),
+               escaping_types.repr());
 
         region_vars
     }
@@ -520,7 +520,7 @@ pub fn skolemize_late_bound_regions<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
                                                binder: &ty::Binder<T>,
                                                snapshot: &CombinedSnapshot)
                                                -> (T, SkolemizationMap)
-    where T : TypeFoldable<'tcx> + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + Repr
 {
     /*!
      * Replace all regions bound by `binder` with skolemized regions and
@@ -535,9 +535,9 @@ pub fn skolemize_late_bound_regions<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
     });
 
     debug!("skolemize_bound_regions(binder={}, result={}, map={})",
-           binder.repr(infcx.tcx),
-           result.repr(infcx.tcx),
-           map.repr(infcx.tcx));
+           binder.repr(),
+           result.repr(),
+           map.repr());
 
     (result, map)
 }
@@ -556,7 +556,7 @@ pub fn leak_check<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
      */
 
     debug!("leak_check: skol_map={}",
-           skol_map.repr(infcx.tcx));
+           skol_map.repr());
 
     let new_vars = infcx.region_vars_confined_to_snapshot(snapshot);
     for (&skol_br, &skol) in skol_map {
@@ -574,9 +574,9 @@ pub fn leak_check<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
             };
 
             debug!("{} (which replaced {}) is tainted by {}",
-                   skol.repr(infcx.tcx),
-                   skol_br.repr(infcx.tcx),
-                   tainted_region.repr(infcx.tcx));
+                   skol.repr(),
+                   skol_br.repr(),
+                   tainted_region.repr());
 
             // A is not as polymorphic as B:
             return Err((skol_br, tainted_region));
@@ -618,13 +618,13 @@ pub fn plug_leaks<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
                              snapshot: &CombinedSnapshot,
                              value: &T)
                              -> T
-    where T : TypeFoldable<'tcx> + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + Repr
 {
     debug_assert!(leak_check(infcx, &skol_map, snapshot).is_ok());
 
     debug!("plug_leaks(skol_map={}, value={})",
-           skol_map.repr(infcx.tcx),
-           value.repr(infcx.tcx));
+           skol_map.repr(),
+           value.repr());
 
     // Compute a mapping from the "taint set" of each skolemized
     // region back to the `ty::BoundRegion` that it originally
@@ -641,7 +641,7 @@ pub fn plug_leaks<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
         .collect();
 
     debug!("plug_leaks: inv_skol_map={}",
-           inv_skol_map.repr(infcx.tcx));
+           inv_skol_map.repr());
 
     // Remove any instantiated type variables from `value`; those can hide
     // references to regions from the `fold_regions` code below.
@@ -670,7 +670,7 @@ pub fn plug_leaks<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
     });
 
     debug!("plug_leaks: result={}",
-           result.repr(infcx.tcx));
+           result.repr());
 
     result
 }
index d634b8231ebb32a177e2d2450a595dc46af15e84..6257b6e6a257964337ecf4bebb256dacfe7382e0 100644 (file)
@@ -53,8 +53,8 @@ pub fn super_lattice_tys<'a,'tcx,L:LatticeDir<'a,'tcx>>(this: &mut L,
 {
     debug!("{}.lattice_tys({}, {})",
            this.tag(),
-           a.repr(this.tcx()),
-           b.repr(this.tcx()));
+           a.repr(),
+           b.repr());
 
     if a == b {
         return Ok(a);
index f456687be13ac49567537768bfdc0c72f4a4a6a5..f4ba639547bf1cfc8df723ccc14ad94c459f682d 100644 (file)
@@ -57,8 +57,8 @@ fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
     fn regions(&mut self, a: ty::Region, b: ty::Region) -> RelateResult<'tcx, ty::Region> {
         debug!("{}.regions({}, {})",
                self.tag(),
-               a.repr(self.tcx()),
-               b.repr(self.tcx()));
+               a.repr(),
+               b.repr());
 
         let origin = Subtype(self.fields.trace.clone());
         Ok(self.fields.infcx.region_vars.lub_regions(origin, a, b))
index aef2712105874854b4cf0eb36f0a0def0abb2260..02a73cfb770520a6934b0e0da7ab5903bfb2831c 100644 (file)
@@ -331,7 +331,7 @@ pub fn common_supertype<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
                                   -> Ty<'tcx>
 {
     debug!("common_supertype({}, {})",
-           a.repr(cx.tcx), b.repr(cx.tcx));
+           a.repr(), b.repr());
 
     let trace = TypeTrace {
         origin: origin,
@@ -355,7 +355,7 @@ pub fn mk_subty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
                           b: Ty<'tcx>)
                           -> UnitResult<'tcx>
 {
-    debug!("mk_subty({} <: {})", a.repr(cx.tcx), b.repr(cx.tcx));
+    debug!("mk_subty({} <: {})", a.repr(), b.repr());
     cx.sub_types(a_is_expected, origin, a, b)
 }
 
@@ -363,7 +363,7 @@ pub fn can_mk_subty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
                               a: Ty<'tcx>,
                               b: Ty<'tcx>)
                               -> UnitResult<'tcx> {
-    debug!("can_mk_subty({} <: {})", a.repr(cx.tcx), b.repr(cx.tcx));
+    debug!("can_mk_subty({} <: {})", a.repr(), b.repr());
     cx.probe(|_| {
         let trace = TypeTrace {
             origin: Misc(codemap::DUMMY_SP),
@@ -383,7 +383,7 @@ pub fn mk_subr<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
                          origin: SubregionOrigin<'tcx>,
                          a: ty::Region,
                          b: ty::Region) {
-    debug!("mk_subr({} <: {})", a.repr(cx.tcx), b.repr(cx.tcx));
+    debug!("mk_subr({} <: {})", a.repr(), b.repr());
     let snapshot = cx.region_vars.start_snapshot();
     cx.region_vars.make_subregion(origin, a, b);
     cx.region_vars.commit(snapshot);
@@ -396,7 +396,7 @@ pub fn mk_eqty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
                          b: Ty<'tcx>)
                          -> UnitResult<'tcx>
 {
-    debug!("mk_eqty({} <: {})", a.repr(cx.tcx), b.repr(cx.tcx));
+    debug!("mk_eqty({} <: {})", a.repr(), b.repr());
     cx.commit_if_ok(|_| cx.eq_types(a_is_expected, origin, a, b))
 }
 
@@ -408,7 +408,7 @@ pub fn mk_sub_poly_trait_refs<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
                                    -> UnitResult<'tcx>
 {
     debug!("mk_sub_trait_refs({} <: {})",
-           a.repr(cx.tcx), b.repr(cx.tcx));
+           a.repr(), b.repr());
     cx.commit_if_ok(|_| cx.sub_poly_trait_refs(a_is_expected, origin, a.clone(), b.clone()))
 }
 
@@ -637,7 +637,7 @@ pub fn sub_types(&self,
                      b: Ty<'tcx>)
                      -> UnitResult<'tcx>
     {
-        debug!("sub_types({} <: {})", a.repr(self.tcx), b.repr(self.tcx));
+        debug!("sub_types({} <: {})", a.repr(), b.repr());
         self.commit_if_ok(|_| {
             let trace = TypeTrace::types(origin, a_is_expected, a, b);
             self.sub(a_is_expected, trace).relate(&a, &b).map(|_| ())
@@ -665,8 +665,8 @@ pub fn sub_trait_refs(&self,
                           -> UnitResult<'tcx>
     {
         debug!("sub_trait_refs({} <: {})",
-               a.repr(self.tcx),
-               b.repr(self.tcx));
+               a.repr(),
+               b.repr());
         self.commit_if_ok(|_| {
             let trace = TypeTrace {
                 origin: origin,
@@ -684,8 +684,8 @@ pub fn sub_poly_trait_refs(&self,
                                -> UnitResult<'tcx>
     {
         debug!("sub_poly_trait_refs({} <: {})",
-               a.repr(self.tcx),
-               b.repr(self.tcx));
+               a.repr(),
+               b.repr());
         self.commit_if_ok(|_| {
             let trace = TypeTrace {
                 origin: origin,
@@ -708,7 +708,7 @@ pub fn skolemize_late_bound_regions<T>(&self,
                                            value: &ty::Binder<T>,
                                            snapshot: &CombinedSnapshot)
                                            -> (T, SkolemizationMap)
-        where T : TypeFoldable<'tcx> + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + Repr
     {
         /*! See `higher_ranked::skolemize_late_bound_regions` */
 
@@ -733,7 +733,7 @@ pub fn plug_leaks<T>(&self,
                          snapshot: &CombinedSnapshot,
                          value: &T)
                          -> T
-        where T : TypeFoldable<'tcx> + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + Repr
     {
         /*! See `higher_ranked::plug_leaks` */
 
@@ -861,7 +861,7 @@ pub fn resolve_regions_and_report_errors(&self,
     }
 
     pub fn ty_to_string(&self, t: Ty<'tcx>) -> String {
-        self.resolve_type_vars_if_possible(&t).user_string(self.tcx)
+        self.resolve_type_vars_if_possible(&t).user_string()
     }
 
     pub fn tys_to_string(&self, ts: &[Ty<'tcx>]) -> String {
@@ -871,7 +871,7 @@ pub fn tys_to_string(&self, ts: &[Ty<'tcx>]) -> String {
 
     pub fn trait_ref_to_string(&self, t: &ty::TraitRef<'tcx>) -> String {
         let t = self.resolve_type_vars_if_possible(t);
-        t.user_string(self.tcx)
+        t.user_string()
     }
 
     pub fn shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx> {
@@ -1033,7 +1033,7 @@ pub fn replace_late_bound_regions_with_fresh_var<T>(
         lbrct: LateBoundRegionConversionTime,
         value: &ty::Binder<T>)
         -> (T, FnvHashMap<ty::BoundRegion,ty::Region>)
-        where T : TypeFoldable<'tcx> + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + Repr
     {
         ty_fold::replace_late_bound_regions(
             self.tcx,
@@ -1048,17 +1048,17 @@ pub fn verify_generic_bound(&self,
                                 a: ty::Region,
                                 bs: Vec<ty::Region>) {
         debug!("verify_generic_bound({}, {} <: {})",
-               kind.repr(self.tcx),
-               a.repr(self.tcx),
-               bs.repr(self.tcx));
+               kind.repr(),
+               a.repr(),
+               bs.repr());
 
         self.region_vars.verify_generic_bound(origin, kind, a, bs);
     }
 
     pub fn can_equate<'b,T>(&'b self, a: &T, b: &T) -> UnitResult<'tcx>
-        where T: Relate<'b,'tcx> + Repr<'tcx>
+        where T: Relate<'b,'tcx> + Repr
     {
-        debug!("can_equate({}, {})", a.repr(self.tcx), b.repr(self.tcx));
+        debug!("can_equate({}, {})", a.repr(), b.repr());
         self.probe(|_| {
             // Gin up a dummy trace, since this won't be committed
             // anyhow. We should make this typetrace stuff more
@@ -1099,9 +1099,9 @@ pub fn dummy(tcx: &ty::ctxt<'tcx>) -> TypeTrace<'tcx> {
     }
 }
 
-impl<'tcx> Repr<'tcx> for TypeTrace<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt) -> String {
-        format!("TypeTrace({})", self.origin.repr(tcx))
+impl<'tcx> Repr for TypeTrace<'tcx> {
+    fn repr(&self) -> String {
+        format!("TypeTrace({})", self.origin.repr())
     }
 }
 
@@ -1123,39 +1123,39 @@ pub fn span(&self) -> Span {
     }
 }
 
-impl<'tcx> Repr<'tcx> for TypeOrigin {
-    fn repr(&self, tcx: &ty::ctxt) -> String {
+impl<'tcx> Repr for TypeOrigin {
+    fn repr(&self) -> String {
         match *self {
             MethodCompatCheck(a) => {
-                format!("MethodCompatCheck({})", a.repr(tcx))
+                format!("MethodCompatCheck({})", a.repr())
             }
             ExprAssignable(a) => {
-                format!("ExprAssignable({})", a.repr(tcx))
+                format!("ExprAssignable({})", a.repr())
             }
-            Misc(a) => format!("Misc({})", a.repr(tcx)),
+            Misc(a) => format!("Misc({})", a.repr()),
             RelateTraitRefs(a) => {
-                format!("RelateTraitRefs({})", a.repr(tcx))
+                format!("RelateTraitRefs({})", a.repr())
             }
             RelateSelfType(a) => {
-                format!("RelateSelfType({})", a.repr(tcx))
+                format!("RelateSelfType({})", a.repr())
             }
             RelateOutputImplTypes(a) => {
-                format!("RelateOutputImplTypes({})", a.repr(tcx))
+                format!("RelateOutputImplTypes({})", a.repr())
             }
             MatchExpressionArm(a, b) => {
-                format!("MatchExpressionArm({}, {})", a.repr(tcx), b.repr(tcx))
+                format!("MatchExpressionArm({}, {})", a.repr(), b.repr())
             }
             IfExpression(a) => {
-                format!("IfExpression({})", a.repr(tcx))
+                format!("IfExpression({})", a.repr())
             }
             IfExpressionWithNoElse(a) => {
-                format!("IfExpressionWithNoElse({})", a.repr(tcx))
+                format!("IfExpressionWithNoElse({})", a.repr())
             }
             RangeExpression(a) => {
-                format!("RangeExpression({})", a.repr(tcx))
+                format!("RangeExpression({})", a.repr())
             }
             EquatePredicate(a) => {
-                format!("EquatePredicate({})", a.repr(tcx))
+                format!("EquatePredicate({})", a.repr())
             }
         }
     }
@@ -1190,66 +1190,66 @@ pub fn span(&self) -> Span {
     }
 }
 
-impl<'tcx> Repr<'tcx> for SubregionOrigin<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for SubregionOrigin<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             Subtype(ref a) => {
-                format!("Subtype({})", a.repr(tcx))
+                format!("Subtype({})", a.repr())
             }
             InfStackClosure(a) => {
-                format!("InfStackClosure({})", a.repr(tcx))
+                format!("InfStackClosure({})", a.repr())
             }
             InvokeClosure(a) => {
-                format!("InvokeClosure({})", a.repr(tcx))
+                format!("InvokeClosure({})", a.repr())
             }
             DerefPointer(a) => {
-                format!("DerefPointer({})", a.repr(tcx))
+                format!("DerefPointer({})", a.repr())
             }
             FreeVariable(a, b) => {
-                format!("FreeVariable({}, {})", a.repr(tcx), b)
+                format!("FreeVariable({}, {})", a.repr(), b)
             }
             IndexSlice(a) => {
-                format!("IndexSlice({})", a.repr(tcx))
+                format!("IndexSlice({})", a.repr())
             }
             RelateObjectBound(a) => {
-                format!("RelateObjectBound({})", a.repr(tcx))
+                format!("RelateObjectBound({})", a.repr())
             }
             RelateParamBound(a, b) => {
                 format!("RelateParamBound({},{})",
-                        a.repr(tcx),
-                        b.repr(tcx))
+                        a.repr(),
+                        b.repr())
             }
             RelateRegionParamBound(a) => {
                 format!("RelateRegionParamBound({})",
-                        a.repr(tcx))
+                        a.repr())
             }
             RelateDefaultParamBound(a, b) => {
                 format!("RelateDefaultParamBound({},{})",
-                        a.repr(tcx),
-                        b.repr(tcx))
+                        a.repr(),
+                        b.repr())
             }
-            Reborrow(a) => format!("Reborrow({})", a.repr(tcx)),
+            Reborrow(a) => format!("Reborrow({})", a.repr()),
             ReborrowUpvar(a, b) => {
-                format!("ReborrowUpvar({},{:?})", a.repr(tcx), b)
+                format!("ReborrowUpvar({},{:?})", a.repr(), b)
             }
             ReferenceOutlivesReferent(_, a) => {
-                format!("ReferenceOutlivesReferent({})", a.repr(tcx))
+                format!("ReferenceOutlivesReferent({})", a.repr())
             }
             ExprTypeIsNotInScope(a, b) => {
                 format!("ExprTypeIsNotInScope({}, {})",
-                        a.repr(tcx),
-                        b.repr(tcx))
+                        a.repr(),
+                        b.repr())
             }
             BindingTypeIsNotValidAtDecl(a) => {
-                format!("BindingTypeIsNotValidAtDecl({})", a.repr(tcx))
+                format!("BindingTypeIsNotValidAtDecl({})", a.repr())
             }
-            CallRcvr(a) => format!("CallRcvr({})", a.repr(tcx)),
-            CallArg(a) => format!("CallArg({})", a.repr(tcx)),
-            CallReturn(a) => format!("CallReturn({})", a.repr(tcx)),
-            Operand(a) => format!("Operand({})", a.repr(tcx)),
-            AddrOf(a) => format!("AddrOf({})", a.repr(tcx)),
-            AutoBorrow(a) => format!("AutoBorrow({})", a.repr(tcx)),
-            SafeDestructor(a) => format!("SafeDestructor({})", a.repr(tcx)),
+            CallRcvr(a) => format!("CallRcvr({})", a.repr()),
+            CallArg(a) => format!("CallArg({})", a.repr()),
+            CallReturn(a) => format!("CallReturn({})", a.repr()),
+            Operand(a) => format!("Operand({})", a.repr()),
+            AddrOf(a) => format!("AddrOf({})", a.repr()),
+            AutoBorrow(a) => format!("AutoBorrow({})", a.repr()),
+            SafeDestructor(a) => format!("SafeDestructor({})", a.repr()),
         }
     }
 }
@@ -1270,31 +1270,31 @@ pub fn span(&self) -> Span {
     }
 }
 
-impl<'tcx> Repr<'tcx> for RegionVariableOrigin {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for RegionVariableOrigin {
+    fn repr(&self) -> String {
         match *self {
             MiscVariable(a) => {
-                format!("MiscVariable({})", a.repr(tcx))
+                format!("MiscVariable({})", a.repr())
             }
             PatternRegion(a) => {
-                format!("PatternRegion({})", a.repr(tcx))
+                format!("PatternRegion({})", a.repr())
             }
             AddrOfRegion(a) => {
-                format!("AddrOfRegion({})", a.repr(tcx))
+                format!("AddrOfRegion({})", a.repr())
             }
-            Autoref(a) => format!("Autoref({})", a.repr(tcx)),
-            Coercion(a) => format!("Coercion({})", a.repr(tcx)),
+            Autoref(a) => format!("Autoref({})", a.repr()),
+            Coercion(a) => format!("Coercion({})", a.repr()),
             EarlyBoundRegion(a, b) => {
-                format!("EarlyBoundRegion({},{})", a.repr(tcx), b.repr(tcx))
+                format!("EarlyBoundRegion({},{})", a.repr(), b.repr())
             }
             LateBoundRegion(a, b, c) => {
-                format!("LateBoundRegion({},{},{:?})", a.repr(tcx), b.repr(tcx), c)
+                format!("LateBoundRegion({},{},{:?})", a.repr(), b.repr(), c)
             }
             BoundRegionInCoherence(a) => {
-                format!("bound_regionInCoherence({})", a.repr(tcx))
+                format!("bound_regionInCoherence({})", a.repr())
             }
             UpvarRegion(a, b) => {
-                format!("UpvarRegion({}, {})", a.repr(tcx), b.repr(tcx))
+                format!("UpvarRegion({}, {})", a.repr(), b.repr())
             }
         }
     }
index 5a06a5193bf1c16c6fcd5a8ea6ef156730c19359..be606e6fa4afd072ef17d14b387e50261c6844e2 100644 (file)
@@ -191,13 +191,13 @@ fn node_label(&self, n: &Node) -> dot::LabelText {
             Node::RegionVid(n_vid) =>
                 dot::LabelText::label(format!("{:?}", n_vid)),
             Node::Region(n_rgn) =>
-                dot::LabelText::label(format!("{}", n_rgn.repr(self.tcx))),
+                dot::LabelText::label(format!("{}", n_rgn.repr())),
         }
     }
     fn edge_label(&self, e: &Edge) -> dot::LabelText {
         match *e {
             Edge::Constraint(ref c) =>
-                dot::LabelText::label(format!("{}", self.map.get(c).unwrap().repr(self.tcx))),
+                dot::LabelText::label(format!("{}", self.map.get(c).unwrap().repr())),
             Edge::EnclScope(..) =>
                 dot::LabelText::label(format!("(enclosed)")),
         }
index a6906e7b2d31370fd628f81c6a9ced65854eeb47..066083d27c73dfcea0637db8e5868aaf9075d524 100644 (file)
@@ -324,7 +324,7 @@ pub fn new_region_var(&self, origin: RegionVariableOrigin) -> RegionVid {
             self.undo_log.borrow_mut().push(AddVar(vid));
         }
         debug!("created new region variable {:?} with origin {}",
-               vid, origin.repr(self.tcx));
+               vid, origin.repr());
         return vid;
     }
 
@@ -392,7 +392,7 @@ fn add_constraint(&self,
         assert!(self.values_are_none());
 
         debug!("RegionVarBindings: add_constraint({})",
-               constraint.repr(self.tcx));
+               constraint.repr());
 
         if self.constraints.borrow_mut().insert(constraint, origin).is_none() {
             if self.in_snapshot() {
@@ -407,7 +407,7 @@ fn add_verify(&self,
         assert!(self.values_are_none());
 
         debug!("RegionVarBindings: add_verify({})",
-               verify.repr(self.tcx));
+               verify.repr());
 
         let mut verifys = self.verifys.borrow_mut();
         let index = verifys.len();
@@ -426,7 +426,7 @@ pub fn add_given(&self,
         let mut givens = self.givens.borrow_mut();
         if givens.insert((sub, sup)) {
             debug!("add_given({} <= {:?})",
-                   sub.repr(self.tcx),
+                   sub.repr(),
                    sup);
 
             self.undo_log.borrow_mut().push(AddGiven(sub, sup));
@@ -453,9 +453,9 @@ pub fn make_subregion(&self,
         assert!(self.values_are_none());
 
         debug!("RegionVarBindings: make_subregion({}, {}) due to {}",
-               sub.repr(self.tcx),
-               sup.repr(self.tcx),
-               origin.repr(self.tcx));
+               sub.repr(),
+               sup.repr(),
+               origin.repr());
 
         match (sub, sup) {
           (ReEarlyBound(..), ReEarlyBound(..)) => {
@@ -472,8 +472,8 @@ pub fn make_subregion(&self,
             self.tcx.sess.span_bug(
                 origin.span(),
                 &format!("cannot relate bound region: {} <= {}",
-                        sub.repr(self.tcx),
-                        sup.repr(self.tcx)));
+                        sub.repr(),
+                        sup.repr()));
           }
           (_, ReStatic) => {
             // all regions are subregions of static, so we can ignore this
@@ -511,8 +511,8 @@ pub fn lub_regions(&self,
         assert!(self.values_are_none());
 
         debug!("RegionVarBindings: lub_regions({}, {})",
-               a.repr(self.tcx),
-               b.repr(self.tcx));
+               a.repr(),
+               b.repr());
         match (a, b) {
             (ReStatic, _) | (_, ReStatic) => {
                 ReStatic // nothing lives longer than static
@@ -536,8 +536,8 @@ pub fn glb_regions(&self,
         assert!(self.values_are_none());
 
         debug!("RegionVarBindings: glb_regions({}, {})",
-               a.repr(self.tcx),
-               b.repr(self.tcx));
+               a.repr(),
+               b.repr());
         match (a, b) {
             (ReStatic, r) | (r, ReStatic) => {
                 // static lives longer than everything else
@@ -563,7 +563,7 @@ pub fn resolve_var(&self, rid: RegionVid) -> ty::Region {
             }
             Some(ref values) => {
                 let r = lookup(values, rid);
-                debug!("resolve_var({:?}) = {}", rid, r.repr(self.tcx));
+                debug!("resolve_var({:?}) = {}", rid, r.repr());
                 r
             }
         }
@@ -620,7 +620,7 @@ pub fn vars_created_since_snapshot(&self, mark: &RegionSnapshot)
     /// made---`r0` itself will be the first entry. This is used when checking whether skolemized
     /// regions are being improperly related to other regions.
     pub fn tainted(&self, mark: &RegionSnapshot, r0: Region) -> Vec<Region> {
-        debug!("tainted(mark={:?}, r0={})", mark, r0.repr(self.tcx));
+        debug!("tainted(mark={:?}, r0={})", mark, r0.repr());
         let _indenter = indenter();
 
         // `result_set` acts as a worklist: we explore all outgoing
@@ -732,8 +732,8 @@ fn lub_concrete_regions(&self, free_regions: &FreeRegionMap, a: Region, b: Regio
           (_, ReEarlyBound(..)) => {
             self.tcx.sess.bug(
                 &format!("cannot relate bound region: LUB({}, {})",
-                        a.repr(self.tcx),
-                        b.repr(self.tcx)));
+                        a.repr(),
+                        b.repr()));
           }
 
           (ReStatic, _) | (_, ReStatic) => {
@@ -837,8 +837,8 @@ fn glb_concrete_regions(&self,
             (_, ReEarlyBound(..)) => {
               self.tcx.sess.bug(
                   &format!("cannot relate bound region: GLB({}, {})",
-                          a.repr(self.tcx),
-                          b.repr(self.tcx)));
+                          a.repr(),
+                          b.repr()));
             }
 
             (ReStatic, r) | (r, ReStatic) => {
@@ -1013,18 +1013,18 @@ fn construct_var_data(&self) -> Vec<VarData> {
     fn dump_constraints(&self) {
         debug!("----() Start constraint listing ()----");
         for (idx, (constraint, _)) in self.constraints.borrow().iter().enumerate() {
-            debug!("Constraint {} => {}", idx, constraint.repr(self.tcx));
+            debug!("Constraint {} => {}", idx, constraint.repr());
         }
     }
 
     fn expansion(&self, free_regions: &FreeRegionMap, var_data: &mut [VarData]) {
         self.iterate_until_fixed_point("Expansion", |constraint| {
             debug!("expansion: constraint={} origin={}",
-                   constraint.repr(self.tcx),
+                   constraint.repr(),
                    self.constraints.borrow()
                                    .get(constraint)
                                    .unwrap()
-                                   .repr(self.tcx));
+                                   .repr());
             match *constraint {
               ConstrainRegSubVar(a_region, b_vid) => {
                 let b_data = &mut var_data[b_vid.index as usize];
@@ -1055,9 +1055,9 @@ fn expand_node(&self,
                    -> bool
     {
         debug!("expand_node({}, {:?} == {})",
-               a_region.repr(self.tcx),
+               a_region.repr(),
                b_vid,
-               b_data.value.repr(self.tcx));
+               b_data.value.repr());
 
         // Check if this relationship is implied by a given.
         match a_region {
@@ -1074,7 +1074,7 @@ fn expand_node(&self,
         match b_data.value {
           NoValue => {
             debug!("Setting initial value of {:?} to {}",
-                   b_vid, a_region.repr(self.tcx));
+                   b_vid, a_region.repr());
 
             b_data.value = Value(a_region);
             return true;
@@ -1088,8 +1088,8 @@ fn expand_node(&self,
 
             debug!("Expanding value of {:?} from {} to {}",
                    b_vid,
-                   cur_region.repr(self.tcx),
-                   lub.repr(self.tcx));
+                   cur_region.repr(),
+                   lub.repr());
 
             b_data.value = Value(lub);
             return true;
@@ -1106,11 +1106,11 @@ fn contraction(&self,
                    var_data: &mut [VarData]) {
         self.iterate_until_fixed_point("Contraction", |constraint| {
             debug!("contraction: constraint={} origin={}",
-                   constraint.repr(self.tcx),
+                   constraint.repr(),
                    self.constraints.borrow()
                                    .get(constraint)
                                    .unwrap()
-                                   .repr(self.tcx));
+                                   .repr());
             match *constraint {
               ConstrainRegSubVar(..) => {
                 // This is an expansion constraint.  Ignore.
@@ -1140,8 +1140,8 @@ fn contract_node(&self,
                      b_region: Region)
                      -> bool {
         debug!("contract_node({:?} == {}/{:?}, {})",
-               a_vid, a_data.value.repr(self.tcx),
-               a_data.classification, b_region.repr(self.tcx));
+               a_vid, a_data.value.repr(),
+               a_data.classification, b_region.repr());
 
         return match a_data.value {
             NoValue => {
@@ -1173,8 +1173,8 @@ fn check_node(this: &RegionVarBindings,
             if !free_regions.is_subregion_of(this.tcx, a_region, b_region) {
                 debug!("Setting {:?} to ErrorValue: {} not subregion of {}",
                        a_vid,
-                       a_region.repr(this.tcx),
-                       b_region.repr(this.tcx));
+                       a_region.repr(),
+                       b_region.repr());
                 a_data.value = ErrorValue;
             }
             false
@@ -1194,8 +1194,8 @@ fn adjust_node(this: &RegionVarBindings,
                     } else {
                         debug!("Contracting value of {:?} from {} to {}",
                                a_vid,
-                               a_region.repr(this.tcx),
-                               glb.repr(this.tcx));
+                               a_region.repr(),
+                               glb.repr());
                         a_data.value = Value(glb);
                         true
                     }
@@ -1203,8 +1203,8 @@ fn adjust_node(this: &RegionVarBindings,
                 Err(_) => {
                     debug!("Setting {:?} to ErrorValue: no glb of {}, {}",
                            a_vid,
-                           a_region.repr(this.tcx),
-                           b_region.repr(this.tcx));
+                           a_region.repr(),
+                           b_region.repr());
                     a_data.value = ErrorValue;
                     false
                 }
@@ -1230,8 +1230,8 @@ fn collect_concrete_region_errors(&self,
                     }
 
                     debug!("ConcreteFailure: !(sub <= sup): sub={}, sup={}",
-                           sub.repr(self.tcx),
-                           sup.repr(self.tcx));
+                           sub.repr(),
+                           sup.repr());
                     errors.push(ConcreteFailure((*origin).clone(), sub, sup));
                 }
 
@@ -1433,8 +1433,8 @@ fn free_regions_first(a: &RegionAndOrigin,
             &format!("collect_error_for_expanding_node() could not find error \
                     for var {:?}, lower_bounds={}, upper_bounds={}",
                     node_idx,
-                    lower_bounds.repr(self.tcx),
-                    upper_bounds.repr(self.tcx)));
+                    lower_bounds.repr(),
+                    upper_bounds.repr()));
     }
 
     fn collect_error_for_contracting_node(
@@ -1480,7 +1480,7 @@ fn collect_error_for_contracting_node(
             &format!("collect_error_for_contracting_node() could not find error \
                      for var {:?}, upper_bounds={}",
                     node_idx,
-                    upper_bounds.repr(self.tcx)));
+                    upper_bounds.repr()));
     }
 
     fn collect_concrete_regions(&self,
@@ -1579,7 +1579,7 @@ fn iterate_until_fixed_point<F>(&self, tag: &str, mut body: F) where
                 let edge_changed = body(constraint);
                 if edge_changed {
                     debug!("Updated due to constraint {}",
-                           constraint.repr(self.tcx));
+                           constraint.repr());
                     changed = true;
                 }
             }
@@ -1589,31 +1589,31 @@ fn iterate_until_fixed_point<F>(&self, tag: &str, mut body: F) where
 
 }
 
-impl<'tcx> Repr<'tcx> for Constraint {
-    fn repr(&self, tcx: &ty::ctxt) -> String {
+impl Repr for Constraint {
+    fn repr(&self) -> String {
         match *self {
             ConstrainVarSubVar(a, b) => {
-                format!("ConstrainVarSubVar({}, {})", a.repr(tcx), b.repr(tcx))
+                format!("ConstrainVarSubVar({}, {})", a.repr(), b.repr())
             }
             ConstrainRegSubVar(a, b) => {
-                format!("ConstrainRegSubVar({}, {})", a.repr(tcx), b.repr(tcx))
+                format!("ConstrainRegSubVar({}, {})", a.repr(), b.repr())
             }
             ConstrainVarSubReg(a, b) => {
-                format!("ConstrainVarSubReg({}, {})", a.repr(tcx), b.repr(tcx))
+                format!("ConstrainVarSubReg({}, {})", a.repr(), b.repr())
             }
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for Verify<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for Verify<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             VerifyRegSubReg(_, ref a, ref b) => {
-                format!("VerifyRegSubReg({}, {})", a.repr(tcx), b.repr(tcx))
+                format!("VerifyRegSubReg({}, {})", a.repr(), b.repr())
             }
             VerifyGenericBound(_, ref p, ref a, ref bs) => {
                 format!("VerifyGenericBound({}, {}, {})",
-                        p.repr(tcx), a.repr(tcx), bs.repr(tcx))
+                        p.repr(), a.repr(), bs.repr())
             }
         }
     }
@@ -1634,38 +1634,38 @@ fn lookup(values: &Vec<VarValue>, rid: ty::RegionVid) -> ty::Region {
     }
 }
 
-impl<'tcx> Repr<'tcx> for VarValue {
-    fn repr(&self, tcx: &ty::ctxt) -> String {
+impl Repr for VarValue {
+    fn repr(&self) -> String {
         match *self {
             NoValue => format!("NoValue"),
-            Value(r) => format!("Value({})", r.repr(tcx)),
+            Value(r) => format!("Value({})", r.repr()),
             ErrorValue => format!("ErrorValue"),
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for RegionAndOrigin<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for RegionAndOrigin<'tcx> {
+    fn repr(&self) -> String {
         format!("RegionAndOrigin({},{})",
-                self.region.repr(tcx),
-                self.origin.repr(tcx))
+                self.region.repr(),
+                self.origin.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for GenericKind<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for GenericKind<'tcx> {
+    fn repr(&self) -> String {
         match *self {
-            GenericKind::Param(ref p) => p.repr(tcx),
-            GenericKind::Projection(ref p) => p.repr(tcx),
+            GenericKind::Param(ref p) => p.repr(),
+            GenericKind::Projection(ref p) => p.repr(),
         }
     }
 }
 
-impl<'tcx> UserString<'tcx> for GenericKind<'tcx> {
-    fn user_string(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> UserString for GenericKind<'tcx> {
+    fn user_string(&self) -> String {
         match *self {
-            GenericKind::Param(ref p) => p.user_string(tcx),
-            GenericKind::Projection(ref p) => p.user_string(tcx),
+            GenericKind::Param(ref p) => p.user_string(),
+            GenericKind::Projection(ref p) => p.user_string(),
         }
     }
 }
index 62e56d2e2d7d362fba17aa91e1242386a35b8762..c22aa6a4f996e679d87503595743495474ba5fe5 100644 (file)
@@ -96,7 +96,7 @@ fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
                 ty::TyInfer(_) => {
                     self.infcx.tcx.sess.bug(
                         &format!("Unexpected type in full type resolver: {}",
-                                t.repr(self.infcx.tcx)));
+                                t.repr()));
                 }
                 _ => {
                     ty_fold::super_fold_ty(self, t)
index 9d6854eba4369d8254a5e29b4975616ec61bf5e6..24eae6307fafdfced0ebda4ee1066ac673506123 100644 (file)
@@ -49,7 +49,7 @@ fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,
     }
 
     fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
-        debug!("{}.tys({}, {})", self.tag(), a.repr(self.tcx()), b.repr(self.tcx()));
+        debug!("{}.tys({}, {})", self.tag(), a.repr(), b.repr());
 
         if a == b { return Ok(a); }
 
@@ -87,8 +87,8 @@ fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
     fn regions(&mut self, a: ty::Region, b: ty::Region) -> RelateResult<'tcx, ty::Region> {
         debug!("{}.regions({}, {})",
                self.tag(),
-               a.repr(self.tcx()),
-               b.repr(self.tcx()));
+               a.repr(),
+               b.repr());
         let origin = Subtype(self.fields.trace.clone());
         self.fields.infcx.region_vars.make_subregion(origin, a, b);
         Ok(a)
index f76cfebf7b997319427f9a1c622f2cab1572c675..a3ea726f0f2f949940f5354cebb268a194162da7 100644 (file)
@@ -203,14 +203,14 @@ fn with_each_combination(&self,
         match types_in_scope.next() {
             None => {
                 debug!("with_each_combination(substs={})",
-                       substs.repr(self.tcx));
+                       substs.repr());
 
                 callback(substs);
             }
 
             Some((space, index, &param_ty)) => {
                 debug!("with_each_combination: space={:?}, index={}, param_ty={}",
-                       space, index, param_ty.repr(self.tcx));
+                       space, index, param_ty.repr());
 
                 if !ty::type_is_sized(Some(param_env), self.tcx, span, param_ty) {
                     debug!("with_each_combination: param_ty is not known to be sized");
@@ -228,7 +228,7 @@ fn with_each_combination(&self,
     }
 
     fn push_transmute_restriction(&self, restriction: TransmuteRestriction<'tcx>) {
-        debug!("Pushing transmute restriction: {}", restriction.repr(self.tcx));
+        debug!("Pushing transmute restriction: {}", restriction.repr());
         self.tcx.transmute_restrictions.borrow_mut().push(restriction);
     }
 }
@@ -277,13 +277,13 @@ fn visit_expr(&mut self, expr: &ast::Expr) {
     }
 }
 
-impl<'tcx> Repr<'tcx> for TransmuteRestriction<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for TransmuteRestriction<'tcx> {
+    fn repr(&self) -> String {
         format!("TransmuteRestriction(id={}, original=({},{}), substituted=({},{}))",
                 self.id,
-                self.original_from.repr(tcx),
-                self.original_to.repr(tcx),
-                self.substituted_from.repr(tcx),
-                self.substituted_to.repr(tcx))
+                self.original_from.repr(),
+                self.original_to.repr(),
+                self.substituted_from.repr(),
+                self.substituted_to.repr())
     }
 }
index 9d0a1821debc12185f455785d6e29068ec290f97..a3e12db6644abf30d39f071b58b6da77716aea20 100644 (file)
@@ -437,7 +437,7 @@ fn pat_ty(&self, pat: &ast::Pat) -> McResult<Ty<'tcx>> {
             _ => base_ty,
         };
         debug!("pat_ty(pat={}) base_ty={} ret_ty={}",
-               pat.repr(tcx), base_ty.repr(tcx), ret_ty.repr(tcx));
+               pat.repr(), base_ty.repr(), ret_ty.repr());
         Ok(ret_ty)
     }
 
@@ -461,8 +461,8 @@ pub fn cat_expr(&self, expr: &ast::Expr) -> McResult<cmt<'tcx>> {
                     ty::AdjustUnsafeFnPointer |
                     ty::AdjustDerefRef(_) => {
                         debug!("cat_expr({}): {}",
-                               adjustment.repr(self.tcx()),
-                               expr.repr(self.tcx()));
+                               adjustment.repr(),
+                               expr.repr());
                         // Result is an rvalue.
                         let expr_ty = try!(self.expr_ty_adjusted(expr));
                         Ok(self.cat_rvalue_node(expr.id(), expr.span(), expr_ty))
@@ -479,7 +479,7 @@ pub fn cat_expr_autoderefd(&self,
         let mut cmt = try!(self.cat_expr_unadjusted(expr));
         debug!("cat_expr_autoderefd: autoderefs={}, cmt={}",
                autoderefs,
-               cmt.repr(self.tcx()));
+               cmt.repr());
         for deref in 1..autoderefs + 1 {
             cmt = try!(self.cat_deref(expr, cmt, deref, None));
         }
@@ -487,7 +487,7 @@ pub fn cat_expr_autoderefd(&self,
     }
 
     pub fn cat_expr_unadjusted(&self, expr: &ast::Expr) -> McResult<cmt<'tcx>> {
-        debug!("cat_expr: id={} expr={}", expr.id, expr.repr(self.tcx()));
+        debug!("cat_expr: id={} expr={}", expr.id, expr.repr());
 
         let expr_ty = try!(self.expr_ty(expr));
         match expr.node {
@@ -500,8 +500,8 @@ pub fn cat_expr_unadjusted(&self, expr: &ast::Expr) -> McResult<cmt<'tcx>> {
             let base_cmt = try!(self.cat_expr(&**base));
             debug!("cat_expr(cat_field): id={} expr={} base={}",
                    expr.id,
-                   expr.repr(self.tcx()),
-                   base_cmt.repr(self.tcx()));
+                   expr.repr(),
+                   base_cmt.repr());
             Ok(self.cat_field(expr, base_cmt, f_name.node.name, expr_ty))
           }
 
@@ -525,7 +525,7 @@ pub fn cat_expr_unadjusted(&self, expr: &ast::Expr) -> McResult<cmt<'tcx>> {
                         ty::TyRef(_, mt) => mt.ty,
                         _ => {
                             debug!("cat_expr_unadjusted: return type of overloaded index is {}?",
-                                   ret_ty.repr(self.tcx()));
+                                   ret_ty.repr());
                             return Err(());
                         }
                     };
@@ -584,7 +584,7 @@ pub fn cat_def(&self,
                    def: def::Def)
                    -> McResult<cmt<'tcx>> {
         debug!("cat_def: id={} expr={} def={:?}",
-               id, expr_ty.repr(self.tcx()), def);
+               id, expr_ty.repr(), def);
 
         match def {
           def::DefStruct(..) | def::DefVariant(..) | def::DefConst(..) |
@@ -637,7 +637,7 @@ pub fn cat_def(&self,
                           span,
                           &format!("Upvar of non-closure {} - {}",
                                   fn_node_id,
-                                  ty.repr(self.tcx())));
+                                  ty.repr()));
                   }
               }
           }
@@ -746,7 +746,7 @@ fn cat_upvar(&self,
         };
 
         let ret = Rc::new(cmt_result);
-        debug!("cat_upvar ret={}", ret.repr(self.tcx()));
+        debug!("cat_upvar ret={}", ret.repr());
         Ok(ret)
     }
 
@@ -817,7 +817,7 @@ fn env_deref(&self,
             note: NoteClosureEnv(upvar_id)
         };
 
-        debug!("env_deref ret {}", ret.repr(self.tcx()));
+        debug!("env_deref ret {}", ret.repr());
 
         ret
     }
@@ -855,7 +855,7 @@ pub fn cat_rvalue_node(&self,
             ty::ReStatic
         };
         let ret = self.cat_rvalue(id, span, re, expr_ty);
-        debug!("cat_rvalue_node ret {}", ret.repr(self.tcx()));
+        debug!("cat_rvalue_node ret {}", ret.repr());
         ret
     }
 
@@ -872,7 +872,7 @@ pub fn cat_rvalue(&self,
             ty:expr_ty,
             note: NoteNone
         });
-        debug!("cat_rvalue ret {}", ret.repr(self.tcx()));
+        debug!("cat_rvalue ret {}", ret.repr());
         ret
     }
 
@@ -890,7 +890,7 @@ pub fn cat_field<N:ast_node>(&self,
             ty: f_ty,
             note: NoteNone
         });
-        debug!("cat_field ret {}", ret.repr(self.tcx()));
+        debug!("cat_field ret {}", ret.repr());
         ret
     }
 
@@ -908,7 +908,7 @@ pub fn cat_tup_field<N:ast_node>(&self,
             ty: f_ty,
             note: NoteNone
         });
-        debug!("cat_tup_field ret {}", ret.repr(self.tcx()));
+        debug!("cat_tup_field ret {}", ret.repr());
         ret
     }
 
@@ -925,7 +925,7 @@ fn cat_deref<N:ast_node>(&self,
         let method_ty = self.typer.node_method_ty(method_call);
 
         debug!("cat_deref: method_call={:?} method_ty={:?}",
-               method_call, method_ty.map(|ty| ty.repr(self.tcx())));
+               method_call, method_ty.map(|ty| ty.repr()));
 
         let base_cmt = match method_ty {
             Some(method_ty) => {
@@ -943,12 +943,12 @@ fn cat_deref<N:ast_node>(&self,
                                               mt.ty,
                                               deref_context,
                                                 /* implicit: */ false);
-                debug!("cat_deref ret {}", ret.repr(self.tcx()));
+                debug!("cat_deref ret {}", ret.repr());
                 ret
             }
             None => {
                 debug!("Explicit deref of non-derefable type: {}",
-                       base_cmt_ty.repr(self.tcx()));
+                       base_cmt_ty.repr());
                 return Err(());
             }
         }
@@ -991,7 +991,7 @@ fn cat_deref_common<N:ast_node>(&self,
             ty: deref_ty,
             note: NoteNone
         });
-        debug!("cat_deref_common ret {}", ret.repr(self.tcx()));
+        debug!("cat_deref_common ret {}", ret.repr());
         Ok(ret)
     }
 
@@ -1042,7 +1042,7 @@ pub fn cat_index<N:ast_node>(&self,
         let m = base_cmt.mutbl.inherit();
         let ret = interior(elt, base_cmt.clone(), base_cmt.ty,
                            m, context, element_ty);
-        debug!("cat_index ret {}", ret.repr(self.tcx()));
+        debug!("cat_index ret {}", ret.repr());
         return Ok(ret);
 
         fn interior<'tcx, N: ast_node>(elt: &N,
@@ -1096,7 +1096,7 @@ fn deref_vec<N:ast_node>(&self,
                 base_cmt
             }
         };
-        debug!("deref_vec ret {}", ret.repr(self.tcx()));
+        debug!("deref_vec ret {}", ret.repr());
         Ok(ret)
     }
 
@@ -1155,7 +1155,7 @@ pub fn cat_imm_interior<N:ast_node>(&self,
             ty: interior_ty,
             note: NoteNone
         });
-        debug!("cat_imm_interior ret={}", ret.repr(self.tcx()));
+        debug!("cat_imm_interior ret={}", ret.repr());
         ret
     }
 
@@ -1173,7 +1173,7 @@ pub fn cat_downcast<N:ast_node>(&self,
             ty: downcast_ty,
             note: NoteNone
         });
-        debug!("cat_downcast ret={}", ret.repr(self.tcx()));
+        debug!("cat_downcast ret={}", ret.repr());
         ret
     }
 
@@ -1235,7 +1235,7 @@ fn cat_pattern_<F>(&self, cmt: cmt<'tcx>, pat: &ast::Pat, op: &mut F)
 
         debug!("cat_pattern: id={} pat={} cmt={}",
                pat.id, pprust::pat_to_string(pat),
-               cmt.repr(self.tcx()));
+               cmt.repr());
 
         (*op)(self, cmt.clone(), pat);
 
@@ -1521,7 +1521,7 @@ pub fn descriptive_string(&self, tcx: &ty::ctxt) -> String {
                 let upvar = self.upvar();
                 match upvar.as_ref().map(|i| &i.cat) {
                     Some(&cat_upvar(ref var)) => {
-                        var.user_string(tcx)
+                        var.user_string()
                     }
                     Some(_) => unreachable!(),
                     None => {
@@ -1561,7 +1561,7 @@ pub fn descriptive_string(&self, tcx: &ty::ctxt) -> String {
                 "pattern-bound indexed content".to_string()
             }
             cat_upvar(ref var) => {
-                var.user_string(tcx)
+                var.user_string()
             }
             cat_downcast(ref cmt, _) => {
                 cmt.descriptive_string(tcx)
@@ -1570,18 +1570,18 @@ pub fn descriptive_string(&self, tcx: &ty::ctxt) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for cmt_<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for cmt_<'tcx> {
+    fn repr(&self) -> String {
         format!("{{{} id:{} m:{:?} ty:{}}}",
-                self.cat.repr(tcx),
+                self.cat.repr(),
                 self.id,
                 self.mutbl,
-                self.ty.repr(tcx))
+                self.ty.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for categorization<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for categorization<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             cat_static_item |
             cat_rvalue(..) |
@@ -1590,13 +1590,13 @@ fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
                 format!("{:?}", *self)
             }
             cat_deref(ref cmt, derefs, ptr) => {
-                format!("{}-{}{}->", cmt.cat.repr(tcx), ptr.repr(tcx), derefs)
+                format!("{}-{}{}->", cmt.cat.repr(), ptr.repr(), derefs)
             }
             cat_interior(ref cmt, interior) => {
-                format!("{}.{}", cmt.cat.repr(tcx), interior.repr(tcx))
+                format!("{}.{}", cmt.cat.repr(), interior.repr())
             }
             cat_downcast(ref cmt, _) => {
-                format!("{}->(enum)", cmt.cat.repr(tcx))
+                format!("{}->(enum)", cmt.cat.repr())
             }
         }
     }
@@ -1615,23 +1615,23 @@ pub fn ptr_sigil(ptr: PointerKind) -> &'static str {
     }
 }
 
-impl<'tcx> Repr<'tcx> for PointerKind {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl Repr for PointerKind {
+    fn repr(&self) -> String {
         match *self {
             Unique => {
                 format!("Box")
             }
             BorrowedPtr(ty::ImmBorrow, ref r) |
             Implicit(ty::ImmBorrow, ref r) => {
-                format!("&{}", r.repr(tcx))
+                format!("&{}", r.repr())
             }
             BorrowedPtr(ty::MutBorrow, ref r) |
             Implicit(ty::MutBorrow, ref r) => {
-                format!("&{} mut", r.repr(tcx))
+                format!("&{} mut", r.repr())
             }
             BorrowedPtr(ty::UniqueImmBorrow, ref r) |
             Implicit(ty::UniqueImmBorrow, ref r) => {
-                format!("&{} uniq", r.repr(tcx))
+                format!("&{} uniq", r.repr())
             }
             UnsafePtr(_) => {
                 format!("*")
@@ -1640,8 +1640,8 @@ fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for InteriorKind {
-    fn repr(&self, _tcx: &ty::ctxt) -> String {
+impl Repr for InteriorKind {
+    fn repr(&self) -> String {
         match *self {
             InteriorField(NamedField(fld)) => {
                 token::get_name(fld).to_string()
@@ -1664,20 +1664,20 @@ fn element_kind(t: Ty) -> ElementKind {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::ClosureKind {
-    fn repr(&self, _: &ty::ctxt) -> String {
+impl Repr for ty::ClosureKind {
+    fn repr(&self) -> String {
         format!("Upvar({:?})", self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for Upvar {
-    fn repr(&self, tcx: &ty::ctxt) -> String {
-        format!("Upvar({})", self.kind.repr(tcx))
+impl Repr for Upvar {
+    fn repr(&self) -> String {
+        format!("Upvar({})", self.kind.repr())
     }
 }
 
-impl<'tcx> UserString<'tcx> for Upvar {
-    fn user_string(&self, _: &ty::ctxt) -> String {
+impl UserString for Upvar {
+    fn user_string(&self) -> String {
         let kind = match self.kind {
             ty::FnClosureKind => "Fn",
             ty::FnMutClosureKind => "FnMut",
index 861fa97d50bf2002946280d9a00d00ff58cc1328..3fec62cd8b481b8a8bf6669fe336bce81068f3c0 100644 (file)
@@ -450,7 +450,7 @@ pub fn check_expr(tcx: &ty::ctxt, e: &ast::Expr,
                     tcx.sess.span_bug(e.span,
                                       &format!("stability::check_expr: struct construction \
                                                 of non-struct, type {:?}",
-                                               type_.repr(tcx)));
+                                               type_.repr()));
                 }
             }
         }
@@ -551,7 +551,7 @@ pub fn lookup<'tcx>(tcx: &ty::ctxt<'tcx>, id: DefId) -> Option<&'tcx Stability>
 }
 
 fn lookup_uncached<'tcx>(tcx: &ty::ctxt<'tcx>, id: DefId) -> Option<&'tcx Stability> {
-    debug!("lookup(id={})", id.repr(tcx));
+    debug!("lookup(id={})", id.repr());
 
     // is this definition the implementation of a trait method?
     match ty::trait_item_of_item(tcx, id) {
index 75af3366397ddc10f1b8bd1814b9256e23b84847..8f6e85a17b128b361a56f52be4a27af86cc84ca7 100644 (file)
@@ -623,7 +623,7 @@ fn fold_region(&mut self, r: ty::Region) -> ty::Region {
                                               when substituting in region {} (root type={}) \
                                               (space={:?}, index={})",
                                              data.name.as_str(),
-                                             self.root_ty.repr(self.tcx()),
+                                             self.root_ty.repr(),
                                              data.space,
                                              data.index));
                             }
@@ -677,12 +677,12 @@ fn ty_for_param(&self, p: ty::ParamTy, source_ty: Ty<'tcx>) -> Ty<'tcx> {
                     span,
                     &format!("Type parameter `{}` ({}/{:?}/{}) out of range \
                                  when substituting (root type={}) substs={}",
-                            p.repr(self.tcx()),
-                            source_ty.repr(self.tcx()),
+                            p.repr(),
+                            source_ty.repr(),
                             p.space,
                             p.idx,
-                            self.root_ty.repr(self.tcx()),
-                            self.substs.repr(self.tcx())));
+                            self.root_ty.repr(),
+                            self.substs.repr()));
             }
         };
 
@@ -733,14 +733,14 @@ fn ty_for_param(&self, p: ty::ParamTy, source_ty: Ty<'tcx>) -> Ty<'tcx> {
     /// is that only in the second case have we passed through a fn binder.
     fn shift_regions_through_binders(&self, ty: Ty<'tcx>) -> Ty<'tcx> {
         debug!("shift_regions(ty={:?}, region_binders_passed={:?}, type_has_escaping_regions={:?})",
-               ty.repr(self.tcx()), self.region_binders_passed, ty::type_has_escaping_regions(ty));
+               ty.repr(), self.region_binders_passed, ty::type_has_escaping_regions(ty));
 
         if self.region_binders_passed == 0 || !ty::type_has_escaping_regions(ty) {
             return ty;
         }
 
         let result = ty_fold::shift_regions(self.tcx(), self.region_binders_passed, &ty);
-        debug!("shift_regions: shifted result = {:?}", result.repr(self.tcx()));
+        debug!("shift_regions: shifted result = {:?}", result.repr());
 
         result
     }
index dcf37e7d56a1b70421421cfdac7ac54b461a3506..b7568b565cec970d943de1557b66240d2dd4c6c3 100644 (file)
@@ -36,8 +36,8 @@ pub fn overlapping_impls(infcx: &InferCtxt,
     debug!("impl_can_satisfy(\
            impl1_def_id={}, \
            impl2_def_id={})",
-           impl1_def_id.repr(infcx.tcx),
-           impl2_def_id.repr(infcx.tcx));
+           impl1_def_id.repr(),
+           impl2_def_id.repr());
 
     let param_env = &ty::empty_parameter_environment(infcx.tcx);
     let selcx = &mut SelectionContext::intercrate(infcx, param_env);
@@ -54,8 +54,8 @@ fn overlap(selcx: &mut SelectionContext,
            -> bool
 {
     debug!("overlap(a_def_id={}, b_def_id={})",
-           a_def_id.repr(selcx.tcx()),
-           b_def_id.repr(selcx.tcx()));
+           a_def_id.repr(),
+           b_def_id.repr());
 
     let (a_trait_ref, a_obligations) = impl_trait_ref_and_oblig(selcx,
                                                                 a_def_id,
@@ -65,9 +65,9 @@ fn overlap(selcx: &mut SelectionContext,
                                                                 b_def_id,
                                                                 util::fresh_type_vars_for_impl);
 
-    debug!("overlap: a_trait_ref={}", a_trait_ref.repr(selcx.tcx()));
+    debug!("overlap: a_trait_ref={}", a_trait_ref.repr());
 
-    debug!("overlap: b_trait_ref={}", b_trait_ref.repr(selcx.tcx()));
+    debug!("overlap: b_trait_ref={}", b_trait_ref.repr());
 
     // Does `a <: b` hold? If not, no overlap.
     if let Err(_) = infer::mk_sub_poly_trait_refs(selcx.infcx(),
@@ -90,7 +90,7 @@ fn overlap(selcx: &mut SelectionContext,
                      .find(|o| !selcx.evaluate_obligation(o));
 
     if let Some(failing_obligation) = opt_failing_obligation {
-        debug!("overlap: obligation unsatisfiable {}", failing_obligation.repr(tcx));
+        debug!("overlap: obligation unsatisfiable {}", failing_obligation.repr());
         return false
     }
 
@@ -99,7 +99,7 @@ fn overlap(selcx: &mut SelectionContext,
 
 pub fn trait_ref_is_knowable<'tcx>(tcx: &ty::ctxt<'tcx>, trait_ref: &ty::TraitRef<'tcx>) -> bool
 {
-    debug!("trait_ref_is_knowable(trait_ref={})", trait_ref.repr(tcx));
+    debug!("trait_ref_is_knowable(trait_ref={})", trait_ref.repr());
 
     // if the orphan rules pass, that means that no ancestor crate can
     // impl this, so it's up to us.
@@ -181,17 +181,17 @@ pub fn orphan_check<'tcx>(tcx: &ty::ctxt<'tcx>,
                           impl_def_id: ast::DefId)
                           -> Result<(), OrphanCheckErr<'tcx>>
 {
-    debug!("orphan_check({})", impl_def_id.repr(tcx));
+    debug!("orphan_check({})", impl_def_id.repr());
 
     // We only except this routine to be invoked on implementations
     // of a trait, not inherent implementations.
     let trait_ref = ty::impl_trait_ref(tcx, impl_def_id).unwrap();
-    debug!("orphan_check: trait_ref={}", trait_ref.repr(tcx));
+    debug!("orphan_check: trait_ref={}", trait_ref.repr());
 
     // If the *trait* is local to the crate, ok.
     if trait_ref.def_id.krate == ast::LOCAL_CRATE {
         debug!("trait {} is local to current crate",
-               trait_ref.def_id.repr(tcx));
+               trait_ref.def_id.repr());
         return Ok(());
     }
 
@@ -204,7 +204,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: &ty::ctxt<'tcx>,
                                 -> Result<(), OrphanCheckErr<'tcx>>
 {
     debug!("orphan_check_trait_ref(trait_ref={}, infer_is_local={})",
-           trait_ref.repr(tcx), infer_is_local.0);
+           trait_ref.repr(), infer_is_local.0);
 
     // First, create an ordered iterator over all the type parameters to the trait, with the self
     // type appearing first.
@@ -215,14 +215,14 @@ fn orphan_check_trait_ref<'tcx>(tcx: &ty::ctxt<'tcx>,
     // some local type.
     for input_ty in input_tys {
         if ty_is_local(tcx, input_ty, infer_is_local) {
-            debug!("orphan_check_trait_ref: ty_is_local `{}`", input_ty.repr(tcx));
+            debug!("orphan_check_trait_ref: ty_is_local `{}`", input_ty.repr());
 
             // First local input type. Check that there are no
             // uncovered type parameters.
             let uncovered_tys = uncovered_tys(tcx, input_ty, infer_is_local);
             for uncovered_ty in uncovered_tys {
                 if let Some(param) = uncovered_ty.walk().find(|t| is_type_parameter(t)) {
-                    debug!("orphan_check_trait_ref: uncovered type `{}`", param.repr(tcx));
+                    debug!("orphan_check_trait_ref: uncovered type `{}`", param.repr());
                     return Err(OrphanCheckErr::UncoveredTy(param));
                 }
             }
@@ -235,7 +235,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: &ty::ctxt<'tcx>,
         // parameters reachable.
         if !infer_is_local.0 {
             if let Some(param) = input_ty.walk().find(|t| is_type_parameter(t)) {
-                debug!("orphan_check_trait_ref: uncovered type `{}`", param.repr(tcx));
+                debug!("orphan_check_trait_ref: uncovered type `{}`", param.repr());
                 return Err(OrphanCheckErr::UncoveredTy(param));
             }
         }
@@ -295,7 +295,7 @@ fn ty_is_local_constructor<'tcx>(tcx: &ty::ctxt<'tcx>,
                                  infer_is_local: InferIsLocal)
                                  -> bool
 {
-    debug!("ty_is_local_constructor({})", ty.repr(tcx));
+    debug!("ty_is_local_constructor({})", ty.repr());
 
     match ty.sty {
         ty::TyBool |
@@ -337,7 +337,7 @@ fn ty_is_local_constructor<'tcx>(tcx: &ty::ctxt<'tcx>,
         ty::TyError => {
             tcx.sess.bug(
                 &format!("ty_is_local invoked on unexpected type: {}",
-                        ty.repr(tcx)))
+                        ty.repr()))
         }
     }
 }
index 2d65c5dd626c9dfcfef98dab49d06f9757064b05..72f162638929fe91f39dd133fba01eaac83622b2 100644 (file)
@@ -68,7 +68,7 @@ pub fn report_projection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
     if !infcx.tcx.sess.has_errors() || !predicate.references_error() {
         span_err!(infcx.tcx.sess, obligation.cause.span, E0271,
                 "type mismatch resolving `{}`: {}",
-                predicate.user_string(infcx.tcx),
+                predicate.user_string(),
                 ty::type_err_to_str(infcx.tcx, &error.err));
         note_obligation_cause(infcx, obligation);
     }
@@ -87,16 +87,16 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                 item.meta().span
             };
             let def = ty::lookup_trait_def(infcx.tcx, def_id);
-            let trait_str = def.trait_ref.user_string(infcx.tcx);
+            let trait_str = def.trait_ref.user_string();
             if let Some(ref istring) = item.value_str() {
                 let mut generic_map = def.generics.types.iter_enumerated()
                                          .map(|(param, i, gen)| {
                                                (gen.name.as_str().to_string(),
                                                 trait_ref.substs.types.get(param, i)
-                                                         .user_string(infcx.tcx))
+                                                         .user_string())
                                               }).collect::<HashMap<String, String>>();
                 generic_map.insert("Self".to_string(),
-                                   trait_ref.self_ty().user_string(infcx.tcx));
+                                   trait_ref.self_ty().user_string());
                 let parser = Parser::new(&istring);
                 let mut errored = false;
                 let err: String = parser.filter_map(|p| {
@@ -157,13 +157,13 @@ trait definition for {} must have a value, \
 pub fn report_overflow_error<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
                                           obligation: &Obligation<'tcx, T>)
                                           -> !
-    where T: UserString<'tcx> + TypeFoldable<'tcx>
+    where T: UserString + TypeFoldable<'tcx>
 {
     let predicate =
         infcx.resolve_type_vars_if_possible(&obligation.predicate);
     span_err!(infcx.tcx.sess, obligation.cause.span, E0275,
               "overflow evaluating the requirement `{}`",
-              predicate.user_string(infcx.tcx));
+              predicate.user_string());
 
     suggest_new_overflow_limit(infcx.tcx, obligation.cause.span);
 
@@ -184,7 +184,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                     span_err!(infcx.tcx.sess, obligation.cause.span, E0276,
                             "the requirement `{}` appears on the impl \
                             method but not on the corresponding trait method",
-                            obligation.predicate.user_string(infcx.tcx));;
+                            obligation.predicate.user_string());;
                 }
                 _ => {
                     match obligation.predicate {
@@ -197,8 +197,8 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                                 let trait_ref = trait_predicate.to_poly_trait_ref();
                                 span_err!(infcx.tcx.sess, obligation.cause.span, E0277,
                                         "the trait `{}` is not implemented for the type `{}`",
-                                        trait_ref.user_string(infcx.tcx),
-                                        trait_ref.self_ty().user_string(infcx.tcx));
+                                        trait_ref.user_string(),
+                                        trait_ref.self_ty().user_string());
                                 // Check if it has a custom "#[rustc_on_unimplemented]"
                                 // error message, report with that message if it does
                                 let custom_note = report_on_unimplemented(infcx, &trait_ref.0,
@@ -216,7 +216,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                                                                &predicate).err().unwrap();
                             span_err!(infcx.tcx.sess, obligation.cause.span, E0278,
                                     "the requirement `{}` is not satisfied (`{}`)",
-                                    predicate.user_string(infcx.tcx),
+                                    predicate.user_string(),
                                     ty::type_err_to_str(infcx.tcx, &err));
                         }
 
@@ -226,7 +226,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                                                                       &predicate).err().unwrap();
                             span_err!(infcx.tcx.sess, obligation.cause.span, E0279,
                                     "the requirement `{}` is not satisfied (`{}`)",
-                                    predicate.user_string(infcx.tcx),
+                                    predicate.user_string(),
                                     ty::type_err_to_str(infcx.tcx, &err));
                         }
 
@@ -235,7 +235,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                                     infcx.resolve_type_vars_if_possible(&obligation.predicate);
                                 span_err!(infcx.tcx.sess, obligation.cause.span, E0280,
                                         "the requirement `{}` is not satisfied",
-                                        predicate.user_string(infcx.tcx));
+                                        predicate.user_string());
                         }
                     }
                 }
@@ -249,9 +249,9 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                 span_err!(infcx.tcx.sess, obligation.cause.span, E0281,
                         "type mismatch: the type `{}` implements the trait `{}`, \
                         but the trait `{}` is required ({})",
-                        expected_trait_ref.self_ty().user_string(infcx.tcx),
-                        expected_trait_ref.user_string(infcx.tcx),
-                        actual_trait_ref.user_string(infcx.tcx),
+                        expected_trait_ref.self_ty().user_string(),
+                        expected_trait_ref.user_string(),
+                        actual_trait_ref.user_string(),
                         ty::type_err_to_str(infcx.tcx, e));
                     note_obligation_cause(infcx, obligation);
             }
@@ -282,7 +282,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                         infcx.tcx.sess.span_note(
                             obligation.cause.span,
                             &format!("method `{}` has no receiver",
-                                    method.name.user_string(infcx.tcx)));
+                                    method.name.user_string()));
                     }
 
                     ObjectSafetyViolation::Method(method,
@@ -291,7 +291,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                             obligation.cause.span,
                             &format!("method `{}` references the `Self` type \
                                     in its arguments or return type",
-                                    method.name.user_string(infcx.tcx)));
+                                    method.name.user_string()));
                     }
 
                     ObjectSafetyViolation::Method(method,
@@ -299,7 +299,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                         infcx.tcx.sess.span_note(
                             obligation.cause.span,
                             &format!("method `{}` has generic type parameters",
-                                    method.name.user_string(infcx.tcx)));
+                                    method.name.user_string()));
                     }
                 }
             }
@@ -317,8 +317,8 @@ pub fn maybe_report_ambiguity<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
     let predicate = infcx.resolve_type_vars_if_possible(&obligation.predicate);
 
     debug!("maybe_report_ambiguity(predicate={}, obligation={})",
-           predicate.repr(infcx.tcx),
-           obligation.repr(infcx.tcx));
+           predicate.repr(),
+           obligation.repr());
 
     match predicate {
         ty::Predicate::Trait(ref data) => {
@@ -349,11 +349,11 @@ pub fn maybe_report_ambiguity<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                         span_err!(infcx.tcx.sess, obligation.cause.span, E0282,
                                 "unable to infer enough type information about `{}`; \
                                  type annotations or generic parameter binding required",
-                                self_ty.user_string(infcx.tcx));
+                                self_ty.user_string());
                     } else {
                         span_err!(infcx.tcx.sess, obligation.cause.span, E0283,
                                 "type annotations required: cannot resolve `{}`",
-                                predicate.user_string(infcx.tcx));;
+                                predicate.user_string());;
                         note_obligation_cause(infcx, obligation);
                     }
                 }
@@ -365,8 +365,8 @@ pub fn maybe_report_ambiguity<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                         "coherence failed to report ambiguity: \
                          cannot locate the impl of the trait `{}` for \
                          the type `{}`",
-                        trait_ref.user_string(infcx.tcx),
-                        self_ty.user_string(infcx.tcx)));
+                        trait_ref.user_string(),
+                        self_ty.user_string()));
             }
         }
 
@@ -374,7 +374,7 @@ pub fn maybe_report_ambiguity<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
             if !infcx.tcx.sess.has_errors() {
                 span_err!(infcx.tcx.sess, obligation.cause.span, E0284,
                         "type annotations required: cannot resolve `{}`",
-                        predicate.user_string(infcx.tcx));;
+                        predicate.user_string());;
                 note_obligation_cause(infcx, obligation);
             }
         }
@@ -383,7 +383,7 @@ pub fn maybe_report_ambiguity<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
 
 fn note_obligation_cause<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
                                       obligation: &Obligation<'tcx, T>)
-    where T: UserString<'tcx>
+    where T: UserString
 {
     note_obligation_cause_code(infcx,
                                &obligation.predicate,
@@ -395,7 +395,7 @@ fn note_obligation_cause_code<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
                                            predicate: &T,
                                            cause_span: Span,
                                            cause_code: &ObligationCauseCode<'tcx>)
-    where T: UserString<'tcx>
+    where T: UserString
 {
     let tcx = infcx.tcx;
     match *cause_code {
@@ -463,7 +463,7 @@ fn note_obligation_cause_code<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
             let parent_trait_ref = infcx.resolve_type_vars_if_possible(&data.parent_trait_ref);
             span_note!(tcx.sess, cause_span,
                        "required because it appears within the type `{}`",
-                       parent_trait_ref.0.self_ty().user_string(infcx.tcx));
+                       parent_trait_ref.0.self_ty().user_string());
             let parent_predicate = parent_trait_ref.as_predicate();
             note_obligation_cause_code(infcx, &parent_predicate, cause_span, &*data.parent_code);
         }
@@ -471,8 +471,8 @@ fn note_obligation_cause_code<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
             let parent_trait_ref = infcx.resolve_type_vars_if_possible(&data.parent_trait_ref);
             span_note!(tcx.sess, cause_span,
                        "required because of the requirements on the impl of `{}` for `{}`",
-                       parent_trait_ref.user_string(infcx.tcx),
-                       parent_trait_ref.0.self_ty().user_string(infcx.tcx));
+                       parent_trait_ref.user_string(),
+                       parent_trait_ref.0.self_ty().user_string());
             let parent_predicate = parent_trait_ref.as_predicate();
             note_obligation_cause_code(infcx, &parent_predicate, cause_span, &*data.parent_code);
         }
@@ -480,7 +480,7 @@ fn note_obligation_cause_code<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
             span_note!(tcx.sess, cause_span,
                       "the requirement `{}` appears on the impl method \
                       but not on the corresponding trait method",
-                      predicate.user_string(infcx.tcx));
+                      predicate.user_string());
         }
     }
 }
index b9117745db2e20aea3cc1f12289a6984a58a3739..8615a7822bea94d61e7d4518f61b5416bc9254c5 100644 (file)
@@ -138,7 +138,7 @@ pub fn normalize_projection_type<'a>(&mut self,
                                          -> Ty<'tcx>
     {
         debug!("normalize_associated_type(projection_ty={})",
-               projection_ty.repr(infcx.tcx));
+               projection_ty.repr());
 
         assert!(!projection_ty.has_escaping_regions());
 
@@ -151,7 +151,7 @@ pub fn normalize_projection_type<'a>(&mut self,
             self.register_predicate_obligation(infcx, obligation);
         }
 
-        debug!("normalize_associated_type: result={}", normalized.value.repr(infcx.tcx));
+        debug!("normalize_associated_type: result={}", normalized.value.repr());
 
         normalized.value
     }
@@ -190,11 +190,11 @@ pub fn register_predicate_obligation<'a>(&mut self,
         assert!(!obligation.has_escaping_regions());
 
         if self.is_duplicate_or_add(infcx.tcx, &obligation.predicate) {
-            debug!("register_predicate({}) -- already seen, skip", obligation.repr(infcx.tcx));
+            debug!("register_predicate({}) -- already seen, skip", obligation.repr());
             return;
         }
 
-        debug!("register_predicate({})", obligation.repr(infcx.tcx));
+        debug!("register_predicate({})", obligation.repr());
         self.predicates.push(obligation);
     }
 
@@ -380,8 +380,8 @@ fn process_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
                 }
                 Err(selection_err) => {
                     debug!("predicate: {} error: {}",
-                           obligation.repr(tcx),
-                           selection_err.repr(tcx));
+                           obligation.repr(),
+                           selection_err.repr());
                     errors.push(
                         FulfillmentError::new(
                             obligation.clone(),
@@ -441,8 +441,8 @@ fn process_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
             let project_obligation = obligation.with(data.clone());
             let result = project::poly_project_and_unify_type(selcx, &project_obligation);
             debug!("process_predicate: poly_project_and_unify_type({}) returned {}",
-                   project_obligation.repr(tcx),
-                   result.repr(tcx));
+                   project_obligation.repr(),
+                   result.repr());
             match result {
                 Ok(Some(obligations)) => {
                     new_obligations.extend(obligations);
@@ -463,11 +463,11 @@ fn process_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
     }
 }
 
-impl<'tcx> Repr<'tcx> for RegionObligation<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for RegionObligation<'tcx> {
+    fn repr(&self) -> String {
         format!("RegionObligation(sub_region={}, sup_type={})",
-                self.sub_region.repr(tcx),
-                self.sup_type.repr(tcx))
+                self.sub_region.repr(),
+                self.sup_type.repr())
     }
 }
 
@@ -482,7 +482,7 @@ fn register_region_obligation<'tcx>(tcx: &ty::ctxt<'tcx>,
                                                cause: cause };
 
     debug!("register_region_obligation({})",
-           region_obligation.repr(tcx));
+           region_obligation.repr());
 
     region_obligations.entry(region_obligation.cause.body_id).or_insert(vec![])
         .push(region_obligation);
index b4b53c003ea2f8fcadfd9dd32cf9e07e7836db19..036aaedb446decc643aabf348bd65f556af356d4 100644 (file)
@@ -321,7 +321,7 @@ pub fn type_known_to_meet_builtin_bound<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
                                                  -> bool
 {
     debug!("type_known_to_meet_builtin_bound(ty={}, bound={:?})",
-           ty.repr(infcx.tcx),
+           ty.repr(),
            bound);
 
     let mut fulfill_cx = FulfillmentContext::new(false);
@@ -339,15 +339,15 @@ pub fn type_known_to_meet_builtin_bound<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
     match fulfill_cx.select_all_or_error(infcx, typer) {
         Ok(()) => {
             debug!("type_known_to_meet_builtin_bound: ty={} bound={:?} success",
-                   ty.repr(infcx.tcx),
+                   ty.repr(),
                    bound);
             true
         }
         Err(e) => {
             debug!("type_known_to_meet_builtin_bound: ty={} bound={:?} errors={}",
-                   ty.repr(infcx.tcx),
+                   ty.repr(),
                    bound,
-                   e.repr(infcx.tcx));
+                   e.repr());
             false
         }
     }
@@ -378,7 +378,7 @@ pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvi
     let body_id = cause.body_id;
 
     debug!("normalize_param_env_or_error(unnormalized_env={})",
-           unnormalized_env.repr(tcx));
+           unnormalized_env.repr());
 
     let predicates: Vec<_> =
         util::elaborate_predicates(tcx, unnormalized_env.caller_bounds.clone())
@@ -394,7 +394,7 @@ pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvi
     // -nmatsakis
 
     debug!("normalize_param_env_or_error: elaborated-predicates={}",
-           predicates.repr(tcx));
+           predicates.repr());
 
     let elaborated_env = unnormalized_env.with_caller_bounds(predicates);
 
@@ -434,25 +434,25 @@ pub fn fully_normalize<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
                                   cause: ObligationCause<'tcx>,
                                   value: &T)
                                   -> Result<T, Vec<FulfillmentError<'tcx>>>
-    where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr
 {
     let tcx = closure_typer.tcx();
 
-    debug!("normalize_param_env(value={})", value.repr(tcx));
+    debug!("normalize_param_env(value={})", value.repr());
 
     let mut selcx = &mut SelectionContext::new(infcx, closure_typer);
     let mut fulfill_cx = FulfillmentContext::new(false);
     let Normalized { value: normalized_value, obligations } =
         project::normalize(selcx, cause, value);
     debug!("normalize_param_env: normalized_value={} obligations={}",
-           normalized_value.repr(tcx),
-           obligations.repr(tcx));
+           normalized_value.repr(),
+           obligations.repr());
     for obligation in obligations {
         fulfill_cx.register_predicate_obligation(selcx.infcx(), obligation);
     }
     try!(fulfill_cx.select_all_or_error(infcx, closure_typer));
     let resolved_value = infcx.resolve_type_vars_if_possible(&normalized_value);
-    debug!("normalize_param_env: resolved_value={}", resolved_value.repr(tcx));
+    debug!("normalize_param_env: resolved_value={}", resolved_value.repr());
     Ok(resolved_value)
 }
 
index cf8e391bf54566771180ee9bdf2c3d10a844f64b..9be973c7018939eeead8c20f37347ec2e6020cd5 100644 (file)
@@ -70,7 +70,7 @@ pub fn is_object_safe<'tcx>(tcx: &ty::ctxt<'tcx>,
         result
     });
 
-    debug!("is_object_safe({}) = {}", trait_def_id.repr(tcx), result);
+    debug!("is_object_safe({}) = {}", trait_def_id.repr(), result);
 
     result
 }
@@ -112,8 +112,8 @@ fn object_safety_violations_for_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
     }
 
     debug!("object_safety_violations_for_trait(trait_def_id={}) = {}",
-           trait_def_id.repr(tcx),
-           violations.repr(tcx));
+           trait_def_id.repr(),
+           violations.repr());
 
     violations
 }
@@ -352,15 +352,15 @@ fn contains_illegal_self_type_reference<'tcx>(tcx: &ty::ctxt<'tcx>,
     error
 }
 
-impl<'tcx> Repr<'tcx> for ObjectSafetyViolation<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ObjectSafetyViolation<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             ObjectSafetyViolation::SizedSelf =>
                 format!("SizedSelf"),
             ObjectSafetyViolation::SupertraitSelf =>
                 format!("SupertraitSelf"),
             ObjectSafetyViolation::Method(ref m, code) =>
-                format!("Method({},{:?})", m.repr(tcx), code),
+                format!("Method({},{:?})", m.repr(), code),
         }
     }
 }
index 71946aa79ce3aa5a2ba79cfb9d631feaada29e50..ef89dc384bbd951aec07e9dd4a00fbef85b90389 100644 (file)
@@ -77,7 +77,7 @@ pub fn poly_project_and_unify_type<'cx,'tcx>(
     -> Result<Option<Vec<PredicateObligation<'tcx>>>, MismatchedProjectionTypes<'tcx>>
 {
     debug!("poly_project_and_unify_type(obligation={})",
-           obligation.repr(selcx.tcx()));
+           obligation.repr());
 
     let infcx = selcx.infcx();
     infcx.commit_if_ok(|snapshot| {
@@ -110,7 +110,7 @@ fn project_and_unify_type<'cx,'tcx>(
     -> Result<Option<Vec<PredicateObligation<'tcx>>>, MismatchedProjectionTypes<'tcx>>
 {
     debug!("project_and_unify_type(obligation={})",
-           obligation.repr(selcx.tcx()));
+           obligation.repr());
 
     let Normalized { value: normalized_ty, obligations } =
         match opt_normalize_projection_type(selcx,
@@ -125,8 +125,8 @@ fn project_and_unify_type<'cx,'tcx>(
         };
 
     debug!("project_and_unify_type: normalized_ty={} obligations={}",
-           normalized_ty.repr(selcx.tcx()),
-           obligations.repr(selcx.tcx()));
+           normalized_ty.repr(),
+           obligations.repr());
 
     let infcx = selcx.infcx();
     let origin = infer::RelateOutputImplTypes(obligation.cause.span);
@@ -139,7 +139,7 @@ fn project_and_unify_type<'cx,'tcx>(
 fn consider_unification_despite_ambiguity<'cx,'tcx>(selcx: &mut SelectionContext<'cx,'tcx>,
                                                     obligation: &ProjectionObligation<'tcx>) {
     debug!("consider_unification_despite_ambiguity(obligation={})",
-           obligation.repr(selcx.tcx()));
+           obligation.repr());
 
     let def_id = obligation.predicate.projection_ty.trait_ref.def_id;
     match selcx.tcx().lang_items.fn_trait_kind(def_id) {
@@ -173,7 +173,7 @@ fn consider_unification_despite_ambiguity<'cx,'tcx>(selcx: &mut SelectionContext
                     &ty::Binder(ret_type));
 
             debug!("consider_unification_despite_ambiguity: ret_type={:?}",
-                   ret_type.repr(selcx.tcx()));
+                   ret_type.repr());
             let origin = infer::RelateOutputImplTypes(obligation.cause.span);
             let obligation_ty = obligation.predicate.ty;
             match infer::mk_eqty(infcx, true, origin, obligation_ty, ret_type) {
@@ -193,7 +193,7 @@ pub fn normalize<'a,'b,'tcx,T>(selcx: &'a mut SelectionContext<'b,'tcx>,
                                cause: ObligationCause<'tcx>,
                                value: &T)
                                -> Normalized<'tcx, T>
-    where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr
 {
     normalize_with_depth(selcx, cause, 0, value)
 }
@@ -204,7 +204,7 @@ pub fn normalize_with_depth<'a,'b,'tcx,T>(selcx: &'a mut SelectionContext<'b,'tc
                                           depth: usize,
                                           value: &T)
                                           -> Normalized<'tcx, T>
-    where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr
 {
     let mut normalizer = AssociatedTypeNormalizer::new(selcx, cause, depth);
     let result = normalizer.fold(value);
@@ -356,7 +356,7 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
     debug!("normalize_projection_type(\
            projection_ty={}, \
            depth={})",
-           projection_ty.repr(selcx.tcx()),
+           projection_ty.repr(),
            depth);
 
     let obligation = Obligation::with_depth(cause.clone(), depth, projection_ty.clone());
@@ -368,9 +368,9 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
             // re-normalize it
 
             debug!("normalize_projection_type: projected_ty={} depth={} obligations={}",
-                   projected_ty.repr(selcx.tcx()),
+                   projected_ty.repr(),
                    depth,
-                   obligations.repr(selcx.tcx()));
+                   obligations.repr());
 
             if ty::type_has_projection(projected_ty) {
                 let tcx = selcx.tcx();
@@ -378,7 +378,7 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
                 let normalized_ty = normalizer.fold(&projected_ty);
 
                 debug!("normalize_projection_type: normalized_ty={} depth={}",
-                       normalized_ty.repr(tcx),
+                       normalized_ty.repr(),
                        depth);
 
                 obligations.extend(normalizer.obligations);
@@ -395,7 +395,7 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
         }
         Ok(ProjectedTy::NoProgress(projected_ty)) => {
             debug!("normalize_projection_type: projected_ty={} no progress",
-                   projected_ty.repr(selcx.tcx()));
+                   projected_ty.repr());
             Some(Normalized {
                 value: projected_ty,
                 obligations: vec!()
@@ -450,7 +450,7 @@ fn project_type<'cx,'tcx>(
     -> Result<ProjectedTy<'tcx>, ProjectionTyError<'tcx>>
 {
     debug!("project(obligation={})",
-           obligation.repr(selcx.tcx()));
+           obligation.repr());
 
     let recursion_limit = selcx.tcx().sess.recursion_limit.get();
     if obligation.recursion_depth >= recursion_limit {
@@ -461,7 +461,7 @@ fn project_type<'cx,'tcx>(
     let obligation_trait_ref =
         selcx.infcx().resolve_type_vars_if_possible(&obligation.predicate.trait_ref);
 
-    debug!("project: obligation_trait_ref={}", obligation_trait_ref.repr(selcx.tcx()));
+    debug!("project: obligation_trait_ref={}", obligation_trait_ref.repr());
 
     if obligation_trait_ref.references_error() {
         return Ok(ProjectedTy::Progress(selcx.tcx().types.err, vec!()));
@@ -590,11 +590,11 @@ fn assemble_candidates_from_predicates<'cx,'tcx,I>(
     where I: Iterator<Item=ty::Predicate<'tcx>>
 {
     debug!("assemble_candidates_from_predicates(obligation={})",
-           obligation.repr(selcx.tcx()));
+           obligation.repr());
     let infcx = selcx.infcx();
     for predicate in env_predicates {
         debug!("assemble_candidates_from_predicates: predicate={}",
-               predicate.repr(selcx.tcx()));
+               predicate.repr());
         match predicate {
             ty::Predicate::Projection(ref data) => {
                 let same_name = data.item_name() == obligation.predicate.item_name;
@@ -612,7 +612,7 @@ fn assemble_candidates_from_predicates<'cx,'tcx,I>(
                 });
 
                 debug!("assemble_candidates_from_predicates: candidate {} is_match {} same_name {}",
-                       data.repr(selcx.tcx()),
+                       data.repr(),
                        is_match,
                        same_name);
 
@@ -635,14 +635,14 @@ fn assemble_candidates_from_object_type<'cx,'tcx>(
 {
     let infcx = selcx.infcx();
     debug!("assemble_candidates_from_object_type(object_ty={})",
-           object_ty.repr(infcx.tcx));
+           object_ty.repr());
     let data = match object_ty.sty {
         ty::TyTrait(ref data) => data,
         _ => {
             selcx.tcx().sess.span_bug(
                 obligation.cause.span,
                 &format!("assemble_candidates_from_object_type called with non-object: {}",
-                         object_ty.repr(selcx.tcx())));
+                         object_ty.repr()));
         }
     };
     let projection_bounds = data.projection_bounds_with_self_ty(selcx.tcx(), object_ty);
@@ -673,7 +673,7 @@ fn assemble_candidates_from_impls<'cx,'tcx>(
         }
         Err(e) => {
             debug!("assemble_candidates_from_impls: selection error {}",
-                   e.repr(selcx.tcx()));
+                   e.repr());
             return Err(e);
         }
     };
@@ -681,7 +681,7 @@ fn assemble_candidates_from_impls<'cx,'tcx>(
     match vtable {
         super::VtableImpl(data) => {
             debug!("assemble_candidates_from_impls: impl candidate {}",
-                   data.repr(selcx.tcx()));
+                   data.repr());
 
             candidate_set.vec.push(
                 ProjectionTyCandidate::Impl(data));
@@ -732,7 +732,7 @@ fn assemble_candidates_from_impls<'cx,'tcx>(
             selcx.tcx().sess.span_bug(
                 obligation.cause.span,
                 &format!("Cannot project an associated type from `{}`",
-                         vtable.repr(selcx.tcx())));
+                         vtable.repr()));
         }
     }
 
@@ -748,8 +748,8 @@ fn confirm_candidate<'cx,'tcx>(
     let infcx = selcx.infcx();
 
     debug!("confirm_candidate(candidate={}, obligation={})",
-           candidate.repr(infcx.tcx),
-           obligation.repr(infcx.tcx));
+           candidate.repr(),
+           obligation.repr());
 
     match candidate {
         ProjectionTyCandidate::ParamEnv(poly_projection) => {
@@ -814,8 +814,8 @@ fn confirm_callable_candidate<'cx,'tcx>(
     let tcx = selcx.tcx();
 
     debug!("confirm_callable_candidate({},{})",
-           obligation.repr(tcx),
-           fn_sig.repr(tcx));
+           obligation.repr(),
+           fn_sig.repr());
 
     // the `Output` associated type is declared on `FnOnce`
     let fn_once_def_id = tcx.lang_items.fn_once_trait().unwrap();
@@ -866,8 +866,8 @@ fn confirm_param_env_candidate<'cx,'tcx>(
             selcx.tcx().sess.span_bug(
                 obligation.cause.span,
                 &format!("Failed to unify `{}` and `{}` in projection: {}",
-                         obligation.repr(selcx.tcx()),
-                         projection.repr(selcx.tcx()),
+                         obligation.repr(),
+                         projection.repr(),
                          ty::type_err_to_str(selcx.tcx(), &e)));
         }
     }
@@ -916,31 +916,31 @@ fn confirm_impl_candidate<'cx,'tcx>(
 
     selcx.tcx().sess.span_bug(obligation.cause.span,
                               &format!("No associated type for {}",
-                                       trait_ref.repr(selcx.tcx())));
+                                       trait_ref.repr()));
 }
 
-impl<'tcx> Repr<'tcx> for ProjectionTyError<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ProjectionTyError<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             ProjectionTyError::TooManyCandidates =>
                 format!("NoCandidate"),
             ProjectionTyError::TraitSelectionError(ref e) =>
-                format!("TraitSelectionError({})", e.repr(tcx)),
+                format!("TraitSelectionError({})", e.repr()),
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for ProjectionTyCandidate<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ProjectionTyCandidate<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             ProjectionTyCandidate::ParamEnv(ref data) =>
-                format!("ParamEnv({})", data.repr(tcx)),
+                format!("ParamEnv({})", data.repr()),
             ProjectionTyCandidate::Impl(ref data) =>
-                format!("Impl({})", data.repr(tcx)),
+                format!("Impl({})", data.repr()),
             ProjectionTyCandidate::Closure(ref data) =>
-                format!("Closure({})", data.repr(tcx)),
+                format!("Closure({})", data.repr()),
             ProjectionTyCandidate::FnPointer(a) =>
-                format!("FnPointer(({}))", a.repr(tcx)),
+                format!("FnPointer(({}))", a.repr()),
         }
     }
 }
@@ -954,10 +954,10 @@ fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Normalized<'tcx, T>
     }
 }
 
-impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for Normalized<'tcx, T> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx, T:Repr> Repr for Normalized<'tcx, T> {
+    fn repr(&self) -> String {
         format!("Normalized({},{})",
-                self.value.repr(tcx),
-                self.obligations.repr(tcx))
+                self.value.repr(),
+                self.obligations.repr())
     }
 }
index 8e2a90aa808848fa4f00d77fe2dd1c5f6e9c1e87..ea5d789683f410a74330ed72447a52fadf3e1bae 100644 (file)
@@ -298,7 +298,7 @@ pub fn closure_typer(&self) -> &'cx (ty::ClosureTyper<'tcx>+'cx) {
     /// type environment by performing unification.
     pub fn select(&mut self, obligation: &TraitObligation<'tcx>)
                   -> SelectionResult<'tcx, Selection<'tcx>> {
-        debug!("select({})", obligation.repr(self.tcx()));
+        debug!("select({})", obligation.repr());
         assert!(!obligation.predicate.has_escaping_regions());
 
         let stack = self.push_stack(TraitObligationStackList::empty(), obligation);
@@ -388,7 +388,7 @@ pub fn evaluate_obligation(&mut self,
                                -> bool
     {
         debug!("evaluate_obligation({})",
-               obligation.repr(self.tcx()));
+               obligation.repr());
 
         self.evaluate_predicate_recursively(TraitObligationStackList::empty(), obligation)
             .may_apply()
@@ -441,7 +441,7 @@ fn evaluate_predicate_recursively<'o>(&mut self,
                                            -> EvaluationResult<'tcx>
     {
         debug!("evaluate_predicate_recursively({})",
-               obligation.repr(self.tcx()));
+               obligation.repr());
 
         // Check the cache from the tcx of predicates that we know
         // have been proven elsewhere. This cache only contains
@@ -500,7 +500,7 @@ fn evaluate_obligation_recursively<'o>(&mut self,
                                            -> EvaluationResult<'tcx>
     {
         debug!("evaluate_obligation_recursively({})",
-               obligation.repr(self.tcx()));
+               obligation.repr());
 
         let stack = self.push_stack(previous_stack, obligation);
 
@@ -548,7 +548,7 @@ fn evaluate_stack<'o>(&mut self,
                                                      &prev.fresh_trait_ref)))
         {
             debug!("evaluate_stack({}) --> unbound argument, recursion -->  ambiguous",
-                   stack.fresh_trait_ref.repr(self.tcx()));
+                   stack.fresh_trait_ref.repr());
             return EvaluatedToAmbig;
         }
 
@@ -577,7 +577,7 @@ fn evaluate_stack<'o>(&mut self,
             .any(|prev| stack.fresh_trait_ref == prev.fresh_trait_ref)
         {
             debug!("evaluate_stack({}) --> recursive",
-                   stack.fresh_trait_ref.repr(self.tcx()));
+                   stack.fresh_trait_ref.repr());
             return EvaluatedToOk;
         }
 
@@ -596,8 +596,8 @@ pub fn evaluate_impl(&mut self,
                          -> bool
     {
         debug!("evaluate_impl(impl_def_id={}, obligation={})",
-               impl_def_id.repr(self.tcx()),
-               obligation.repr(self.tcx()));
+               impl_def_id.repr(),
+               obligation.repr());
 
         self.infcx.probe(|snapshot| {
             match self.match_impl(impl_def_id, obligation, snapshot) {
@@ -644,15 +644,15 @@ fn candidate_from_obligation<'o>(&mut self,
         let cache_fresh_trait_pred =
             self.infcx.freshen(stack.obligation.predicate.clone());
         debug!("candidate_from_obligation(cache_fresh_trait_pred={}, obligation={})",
-               cache_fresh_trait_pred.repr(self.tcx()),
-               stack.repr(self.tcx()));
+               cache_fresh_trait_pred.repr(),
+               stack.repr());
         assert!(!stack.obligation.predicate.has_escaping_regions());
 
         match self.check_candidate_cache(&cache_fresh_trait_pred) {
             Some(c) => {
                 debug!("CACHE HIT: cache_fresh_trait_pred={}, candidate={}",
-                       cache_fresh_trait_pred.repr(self.tcx()),
-                       c.repr(self.tcx()));
+                       cache_fresh_trait_pred.repr(),
+                       c.repr());
                 return c;
             }
             None => { }
@@ -663,7 +663,7 @@ fn candidate_from_obligation<'o>(&mut self,
 
         if self.should_update_candidate_cache(&cache_fresh_trait_pred, &candidate) {
             debug!("CACHE MISS: cache_fresh_trait_pred={}, candidate={}",
-                   cache_fresh_trait_pred.repr(self.tcx()), candidate.repr(self.tcx()));
+                   cache_fresh_trait_pred.repr(), candidate.repr());
             self.insert_candidate_cache(cache_fresh_trait_pred, candidate.clone());
         }
 
@@ -694,8 +694,8 @@ fn candidate_from_obligation_no_cache<'o>(&mut self,
 
         debug!("assembled {} candidates for {}: {}",
                candidates.len(),
-               stack.repr(self.tcx()),
-               candidates.repr(self.tcx()));
+               stack.repr(),
+               candidates.repr());
 
         // At this point, we know that each of the entries in the
         // candidate set is *individually* applicable. Now we have to
@@ -736,11 +736,11 @@ fn candidate_from_obligation_no_cache<'o>(&mut self,
                                                                           &candidates[j]));
                 if is_dup {
                     debug!("Dropping candidate #{}/{}: {}",
-                           i, candidates.len(), candidates[i].repr(self.tcx()));
+                           i, candidates.len(), candidates[i].repr());
                     candidates.swap_remove(i);
                 } else {
                     debug!("Retaining candidate #{}/{}: {}",
-                           i, candidates.len(), candidates[i].repr(self.tcx()));
+                           i, candidates.len(), candidates[i].repr());
                     i += 1;
                 }
             }
@@ -907,7 +907,7 @@ fn assemble_candidates<'o>(&mut self,
         match self.tcx().lang_items.to_builtin_kind(obligation.predicate.def_id()) {
             Some(ty::BoundCopy) => {
                 debug!("obligation self ty is {}",
-                       obligation.predicate.0.self_ty().repr(self.tcx()));
+                       obligation.predicate.0.self_ty().repr());
 
                 // User-defined copy impls are permitted, but only for
                 // structs and enums.
@@ -958,8 +958,8 @@ fn assemble_candidates_from_projected_tys(&mut self,
             self.infcx().resolve_type_vars_if_possible(&obligation.predicate);
 
         debug!("assemble_candidates_for_projected_tys({},{})",
-               obligation.repr(self.tcx()),
-               poly_trait_predicate.repr(self.tcx()));
+               obligation.repr(),
+               poly_trait_predicate.repr());
 
         // FIXME(#20297) -- just examining the self-type is very simplistic
 
@@ -982,7 +982,7 @@ fn assemble_candidates_from_projected_tys(&mut self,
         };
 
         debug!("assemble_candidates_for_projected_tys: trait_def_id={}",
-               trait_def_id.repr(self.tcx()));
+               trait_def_id.repr());
 
         let result = self.infcx.probe(|snapshot| {
             self.match_projection_obligation_against_bounds_from_trait(obligation,
@@ -1006,8 +1006,8 @@ fn match_projection_obligation_against_bounds_from_trait(
             self.infcx().skolemize_late_bound_regions(&poly_trait_predicate, snapshot);
         debug!("match_projection_obligation_against_bounds_from_trait: \
                 skol_trait_predicate={} skol_map={}",
-               skol_trait_predicate.repr(self.tcx()),
-               skol_map.repr(self.tcx()));
+               skol_trait_predicate.repr(),
+               skol_map.repr());
 
         let projection_trait_ref = match skol_trait_predicate.trait_ref.self_ty().sty {
             ty::TyProjection(ref data) => &data.trait_ref,
@@ -1016,18 +1016,18 @@ fn match_projection_obligation_against_bounds_from_trait(
                     obligation.cause.span,
                     &format!("match_projection_obligation_against_bounds_from_trait() called \
                               but self-ty not a projection: {}",
-                             skol_trait_predicate.trait_ref.self_ty().repr(self.tcx())));
+                             skol_trait_predicate.trait_ref.self_ty().repr()));
             }
         };
         debug!("match_projection_obligation_against_bounds_from_trait: \
                 projection_trait_ref={}",
-               projection_trait_ref.repr(self.tcx()));
+               projection_trait_ref.repr());
 
         let trait_predicates = ty::lookup_predicates(self.tcx(), projection_trait_ref.def_id);
         let bounds = trait_predicates.instantiate(self.tcx(), projection_trait_ref.substs);
         debug!("match_projection_obligation_against_bounds_from_trait: \
                 bounds={}",
-               bounds.repr(self.tcx()));
+               bounds.repr());
 
         let matching_bound =
             util::elaborate_predicates(self.tcx(), bounds.predicates.into_vec())
@@ -1042,7 +1042,7 @@ fn match_projection_obligation_against_bounds_from_trait(
 
         debug!("match_projection_obligation_against_bounds_from_trait: \
                 matching_bound={}",
-               matching_bound.repr(self.tcx()));
+               matching_bound.repr());
         match matching_bound {
             None => false,
             Some(bound) => {
@@ -1089,7 +1089,7 @@ fn assemble_candidates_from_caller_bounds<'o>(&mut self,
                                                   -> Result<(),SelectionError<'tcx>>
     {
         debug!("assemble_candidates_from_caller_bounds({})",
-               stack.obligation.repr(self.tcx()));
+               stack.obligation.repr());
 
         let all_bounds =
             self.param_env().caller_bounds
@@ -1156,9 +1156,9 @@ fn assemble_closure_candidates(&mut self,
         };
 
         debug!("assemble_unboxed_candidates: self_ty={} kind={:?} obligation={}",
-               self_ty.repr(self.tcx()),
+               self_ty.repr(),
                kind,
-               obligation.repr(self.tcx()));
+               obligation.repr());
 
         match self.closure_typer.closure_kind(closure_def_id) {
             Some(closure_kind) => {
@@ -1221,7 +1221,7 @@ fn assemble_candidates_from_impls(&mut self,
                                       candidates: &mut SelectionCandidateSet<'tcx>)
                                       -> Result<(), SelectionError<'tcx>>
     {
-        debug!("assemble_candidates_from_impls(obligation={})", obligation.repr(self.tcx()));
+        debug!("assemble_candidates_from_impls(obligation={})", obligation.repr());
 
         let def = ty::lookup_trait_def(self.tcx(), obligation.predicate.def_id());
 
@@ -1247,7 +1247,7 @@ fn assemble_candidates_from_default_impls(&mut self,
     {
         // OK to skip binder here because the tests we do below do not involve bound regions
         let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
-        debug!("assemble_candidates_from_default_impls(self_ty={})", self_ty.repr(self.tcx()));
+        debug!("assemble_candidates_from_default_impls(self_ty={})", self_ty.repr());
 
         let def_id = obligation.predicate.def_id();
 
@@ -1317,7 +1317,7 @@ fn assemble_candidates_from_object_ty(&mut self,
                                           candidates: &mut SelectionCandidateSet<'tcx>)
     {
         debug!("assemble_candidates_from_object_ty(self_ty={})",
-               self.infcx.shallow_resolve(*obligation.self_ty().skip_binder()).repr(self.tcx()));
+               self.infcx.shallow_resolve(*obligation.self_ty().skip_binder()).repr());
 
         // Object-safety candidates are only applicable to object-safe
         // traits. Including this check is useful because it helps
@@ -1363,7 +1363,7 @@ fn assemble_candidates_from_object_ty(&mut self,
             };
 
             debug!("assemble_candidates_from_object_ty: poly_trait_ref={}",
-                   poly_trait_ref.repr(self.tcx()));
+                   poly_trait_ref.repr());
 
             // see whether the object trait can be upcast to the trait we are looking for
             let upcast_trait_refs = self.upcast(poly_trait_ref, obligation);
@@ -1407,7 +1407,7 @@ fn assemble_candidates_for_unsizing(&mut self,
         let target = self.infcx.shallow_resolve(obligation.predicate.0.input_types()[0]);
 
         debug!("assemble_candidates_for_unsizing(source={}, target={})",
-               source.repr(self.tcx()), target.repr(self.tcx()));
+               source.repr(), target.repr());
 
         let may_apply = match (&source.sty, &target.sty) {
             // Trait+Kx+'a -> Trait+Ky+'b (upcasts).
@@ -1473,7 +1473,7 @@ fn winnow_candidate<'o>(&mut self,
                             candidate: &SelectionCandidate<'tcx>)
                             -> EvaluationResult<'tcx>
     {
-        debug!("winnow_candidate: candidate={}", candidate.repr(self.tcx()));
+        debug!("winnow_candidate: candidate={}", candidate.repr());
         let result = self.infcx.probe(|_| {
             let candidate = (*candidate).clone();
             match self.confirm_candidate(stack.obligation, candidate) {
@@ -1566,7 +1566,7 @@ fn assemble_builtin_bound_candidates<'o>(&mut self,
         match self.builtin_bound(bound, stack.obligation) {
             Ok(If(..)) => {
                 debug!("builtin_bound: bound={}",
-                       bound.repr(self.tcx()));
+                       bound.repr());
                 candidates.vec.push(BuiltinCandidate(bound));
                 Ok(())
             }
@@ -1775,7 +1775,7 @@ fn builtin_bound(&mut self,
                 self.tcx().sess.bug(
                     &format!(
                         "asked to assemble builtin bounds of unexpected type: {}",
-                        self_ty.repr(self.tcx())));
+                        self_ty.repr()));
             }
         };
 
@@ -1838,7 +1838,7 @@ fn constituent_types_for_ty(&self, t: Ty<'tcx>) -> Option<Vec<Ty<'tcx>>> {
                 self.tcx().sess.bug(
                     &format!(
                         "asked to assemble constituent types of unexpected type: {}",
-                        t.repr(self.tcx())));
+                        t.repr()));
             }
 
             ty::TyBox(referent_ty) => {  // Box<T>
@@ -1973,8 +1973,8 @@ fn confirm_candidate(&mut self,
                          -> Result<Selection<'tcx>,SelectionError<'tcx>>
     {
         debug!("confirm_candidate({}, {})",
-               obligation.repr(self.tcx()),
-               candidate.repr(self.tcx()));
+               obligation.repr(),
+               candidate.repr());
 
         match candidate {
             BuiltinCandidate(builtin_bound) => {
@@ -2065,8 +2065,8 @@ fn confirm_param_candidate(&mut self,
                                -> Vec<PredicateObligation<'tcx>>
     {
         debug!("confirm_param_candidate({},{})",
-               obligation.repr(self.tcx()),
-               param.repr(self.tcx()));
+               obligation.repr(),
+               param.repr());
 
         // During evaluation, we already checked that this
         // where-clause trait-ref could be unified with the obligation
@@ -2077,8 +2077,8 @@ fn confirm_param_candidate(&mut self,
             Err(()) => {
                 self.tcx().sess.bug(
                     &format!("Where clause `{}` was applicable to `{}` but now is not",
-                             param.repr(self.tcx()),
-                             obligation.repr(self.tcx())));
+                             param.repr(),
+                             obligation.repr()));
             }
         }
     }
@@ -2090,7 +2090,7 @@ fn confirm_builtin_candidate(&mut self,
                                            SelectionError<'tcx>>
     {
         debug!("confirm_builtin_candidate({})",
-               obligation.repr(self.tcx()));
+               obligation.repr());
 
         match try!(self.builtin_bound(bound, obligation)) {
             If(nested) => Ok(self.vtable_builtin_data(obligation, bound, nested)),
@@ -2098,7 +2098,7 @@ fn confirm_builtin_candidate(&mut self,
                 self.tcx().sess.span_bug(
                     obligation.cause.span,
                     &format!("builtin bound for {} was ambig",
-                            obligation.repr(self.tcx())));
+                            obligation.repr()));
             }
         }
     }
@@ -2119,7 +2119,7 @@ fn vtable_builtin_data(&mut self,
         let obligations = self.collect_predicates_for_types(obligation, trait_def, nested);
 
         debug!("vtable_builtin_data: obligations={}",
-               obligations.repr(self.tcx()));
+               obligations.repr());
 
         VtableBuiltinData { nested: obligations }
     }
@@ -2135,8 +2135,8 @@ fn confirm_default_impl_candidate(&mut self,
                                       -> VtableDefaultImplData<PredicateObligation<'tcx>>
     {
         debug!("confirm_default_impl_candidate({}, {})",
-               obligation.repr(self.tcx()),
-               trait_def_id.repr(self.tcx()));
+               obligation.repr(),
+               trait_def_id.repr());
 
         // binder is moved below
         let self_ty = self.infcx.shallow_resolve(obligation.predicate.skip_binder().self_ty());
@@ -2146,7 +2146,7 @@ fn confirm_default_impl_candidate(&mut self,
                 self.tcx().sess.bug(
                     &format!(
                         "asked to confirm default implementation for ambiguous type: {}",
-                        self_ty.repr(self.tcx())));
+                        self_ty.repr()));
             }
         }
     }
@@ -2157,8 +2157,8 @@ fn confirm_default_impl_object_candidate(&mut self,
                                              -> VtableDefaultImplData<PredicateObligation<'tcx>>
     {
         debug!("confirm_default_impl_object_candidate({}, {})",
-               obligation.repr(self.tcx()),
-               trait_def_id.repr(self.tcx()));
+               obligation.repr(),
+               trait_def_id.repr());
 
         assert!(ty::has_attr(self.tcx(), trait_def_id, "rustc_reflect_like"));
 
@@ -2185,7 +2185,7 @@ fn confirm_default_impl_object_candidate(&mut self,
                 self.tcx().sess.bug(
                     &format!(
                         "asked to confirm default object implementation for non-object type: {}",
-                        self_ty.repr(self.tcx())));
+                        self_ty.repr()));
             }
         }
     }
@@ -2197,7 +2197,7 @@ fn vtable_default_impl(&mut self,
                            nested: ty::Binder<Vec<Ty<'tcx>>>)
                            -> VtableDefaultImplData<PredicateObligation<'tcx>>
     {
-        debug!("vtable_default_impl_data: nested={}", nested.repr(self.tcx()));
+        debug!("vtable_default_impl_data: nested={}", nested.repr());
 
         let mut obligations = self.collect_predicates_for_types(obligation,
                                                                 trait_def_id,
@@ -2218,7 +2218,7 @@ fn vtable_default_impl(&mut self,
         // no Errors in that code above
         obligations.append(&mut trait_obligations.unwrap());
 
-        debug!("vtable_default_impl_data: obligations={}", obligations.repr(self.tcx()));
+        debug!("vtable_default_impl_data: obligations={}", obligations.repr());
 
         VtableDefaultImplData {
             trait_def_id: trait_def_id,
@@ -2233,8 +2233,8 @@ fn confirm_impl_candidate(&mut self,
                                         SelectionError<'tcx>>
     {
         debug!("confirm_impl_candidate({},{})",
-               obligation.repr(self.tcx()),
-               impl_def_id.repr(self.tcx()));
+               obligation.repr(),
+               impl_def_id.repr());
 
         // First, create the substitutions by matching the impl again,
         // this time not in a probe.
@@ -2242,7 +2242,7 @@ fn confirm_impl_candidate(&mut self,
             let (substs, skol_map) =
                 self.rematch_impl(impl_def_id, obligation,
                                   snapshot);
-            debug!("confirm_impl_candidate substs={}", substs.repr(self.tcx()));
+            debug!("confirm_impl_candidate substs={}", substs.repr());
             Ok(self.vtable_impl(impl_def_id, substs, obligation.cause.clone(),
                                 obligation.recursion_depth + 1, skol_map, snapshot))
         })
@@ -2258,10 +2258,10 @@ fn vtable_impl(&mut self,
                    -> VtableImplData<'tcx, PredicateObligation<'tcx>>
     {
         debug!("vtable_impl(impl_def_id={}, substs={}, recursion_depth={}, skol_map={})",
-               impl_def_id.repr(self.tcx()),
-               substs.repr(self.tcx()),
+               impl_def_id.repr(),
+               substs.repr(),
                recursion_depth,
-               skol_map.repr(self.tcx()));
+               skol_map.repr());
 
         let mut impl_obligations =
             self.impl_or_trait_obligations(cause,
@@ -2272,8 +2272,8 @@ fn vtable_impl(&mut self,
                                            snapshot);
 
         debug!("vtable_impl: impl_def_id={} impl_obligations={}",
-               impl_def_id.repr(self.tcx()),
-               impl_obligations.repr(self.tcx()));
+               impl_def_id.repr(),
+               impl_obligations.repr());
 
         impl_obligations.append(&mut substs.obligations);
 
@@ -2287,7 +2287,7 @@ fn confirm_object_candidate(&mut self,
                                 -> VtableObjectData<'tcx>
     {
         debug!("confirm_object_candidate({})",
-               obligation.repr(self.tcx()));
+               obligation.repr());
 
         // FIXME skipping binder here seems wrong -- we should
         // probably flatten the binder from the obligation and the
@@ -2329,7 +2329,7 @@ fn confirm_fn_pointer_candidate(&mut self,
                                     -> Result<ty::Ty<'tcx>,SelectionError<'tcx>>
     {
         debug!("confirm_fn_pointer_candidate({})",
-               obligation.repr(self.tcx()));
+               obligation.repr());
 
         // ok to skip binder; it is reintroduced below
         let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
@@ -2356,9 +2356,9 @@ fn confirm_closure_candidate(&mut self,
                                            SelectionError<'tcx>>
     {
         debug!("confirm_closure_candidate({},{},{})",
-               obligation.repr(self.tcx()),
-               closure_def_id.repr(self.tcx()),
-               substs.repr(self.tcx()));
+               obligation.repr(),
+               closure_def_id.repr(),
+               substs.repr());
 
         let Normalized {
             value: trait_ref,
@@ -2366,9 +2366,9 @@ fn confirm_closure_candidate(&mut self,
         } = self.closure_trait_ref(obligation, closure_def_id, substs);
 
         debug!("confirm_closure_candidate(closure_def_id={}, trait_ref={}, obligations={})",
-               closure_def_id.repr(self.tcx()),
-               trait_ref.repr(self.tcx()),
-               obligations.repr(self.tcx()));
+               closure_def_id.repr(),
+               trait_ref.repr(),
+               obligations.repr());
 
         try!(self.confirm_poly_trait_refs(obligation.cause.clone(),
                                           obligation.predicate.to_poly_trait_ref(),
@@ -2437,7 +2437,7 @@ fn confirm_builtin_unsize_candidate(&mut self,
         let target = self.infcx.shallow_resolve(obligation.predicate.0.input_types()[0]);
 
         debug!("confirm_builtin_unsize_candidate(source={}, target={})",
-               source.repr(tcx), target.repr(tcx));
+               source.repr(), target.repr());
 
         let mut nested = vec![];
         match (&source.sty, &target.sty) {
@@ -2614,8 +2614,8 @@ fn rematch_impl(&mut self,
             Err(()) => {
                 self.tcx().sess.bug(
                     &format!("Impl {} was matchable against {} but now is not",
-                            impl_def_id.repr(self.tcx()),
-                            obligation.repr(self.tcx())));
+                            impl_def_id.repr(),
+                            obligation.repr()));
             }
         }
     }
@@ -2656,10 +2656,10 @@ fn match_impl(&mut self,
 
         debug!("match_impl(impl_def_id={}, obligation={}, \
                impl_trait_ref={}, skol_obligation_trait_ref={})",
-               impl_def_id.repr(self.tcx()),
-               obligation.repr(self.tcx()),
-               impl_trait_ref.repr(self.tcx()),
-               skol_obligation_trait_ref.repr(self.tcx()));
+               impl_def_id.repr(),
+               obligation.repr(),
+               impl_trait_ref.repr(),
+               skol_obligation_trait_ref.repr());
 
         let origin = infer::RelateOutputImplTypes(obligation.cause.span);
         if let Err(e) = self.infcx.sub_trait_refs(false,
@@ -2677,7 +2677,7 @@ fn match_impl(&mut self,
             return Err(());
         }
 
-        debug!("match_impl: success impl_substs={}", impl_substs.repr(self.tcx()));
+        debug!("match_impl: success impl_substs={}", impl_substs.repr());
         Ok((Normalized {
             value: impl_substs,
             obligations: impl_trait_ref.obligations
@@ -2729,8 +2729,8 @@ fn match_poly_trait_ref(&mut self,
                             -> Result<(),()>
     {
         debug!("match_poly_trait_ref: obligation={} poly_trait_ref={}",
-               obligation.repr(self.tcx()),
-               poly_trait_ref.repr(self.tcx()));
+               obligation.repr(),
+               poly_trait_ref.repr());
 
         let origin = infer::RelateOutputImplTypes(obligation.cause.span);
         match self.infcx.sub_poly_trait_refs(false,
@@ -2770,14 +2770,14 @@ fn match_inherent_impl(&mut self,
         let impl_self_ty = impl_self_ty.subst(self.tcx(), &impl_substs);
 
         debug!("match_impl_self_types(obligation_self_ty={}, impl_self_ty={})",
-               obligation_self_ty.repr(self.tcx()),
-               impl_self_ty.repr(self.tcx()));
+               obligation_self_ty.repr(),
+               impl_self_ty.repr());
 
         match self.match_self_types(obligation_cause,
                                     impl_self_ty,
                                     obligation_self_ty) {
             Ok(()) => {
-                debug!("Matched impl_substs={}", impl_substs.repr(self.tcx()));
+                debug!("Matched impl_substs={}", impl_substs.repr());
                 Ok(impl_substs)
             }
             Err(()) => {
@@ -2889,7 +2889,7 @@ fn impl_or_trait_obligations(&mut self,
                                  snapshot: &infer::CombinedSnapshot)
                                  -> Vec<PredicateObligation<'tcx>>
     {
-        debug!("impl_or_trait_obligations(def_id={})", def_id.repr(self.tcx()));
+        debug!("impl_or_trait_obligations(def_id={})", def_id.repr());
 
         let predicates = ty::lookup_predicates(self.tcx(), def_id);
         let predicates = predicates.instantiate(self.tcx(), substs);
@@ -2941,8 +2941,8 @@ fn upcast(&mut self, obj_trait_ref: ty::PolyTraitRef<'tcx>, obligation: &TraitOb
               -> Vec<ty::PolyTraitRef<'tcx>>
     {
         debug!("upcast(obj_trait_ref={}, obligation={})",
-               obj_trait_ref.repr(self.tcx()),
-               obligation.repr(self.tcx()));
+               obj_trait_ref.repr(),
+               obligation.repr());
 
         let obligation_def_id = obligation.predicate.def_id();
         let mut upcast_trait_refs = util::upcast(self.tcx(), obj_trait_ref, obligation_def_id);
@@ -2958,28 +2958,28 @@ fn upcast(&mut self, obj_trait_ref: ty::PolyTraitRef<'tcx>, obligation: &TraitOb
             self.infcx.probe(|_| self.match_poly_trait_ref(obligation, upcast_trait_ref)).is_ok()
         });
 
-        debug!("upcast: upcast_trait_refs={}", upcast_trait_refs.repr(self.tcx()));
+        debug!("upcast: upcast_trait_refs={}", upcast_trait_refs.repr());
         upcast_trait_refs
     }
 }
 
-impl<'tcx> Repr<'tcx> for SelectionCandidate<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for SelectionCandidate<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             PhantomFnCandidate => format!("PhantomFnCandidate"),
             ErrorCandidate => format!("ErrorCandidate"),
             BuiltinCandidate(b) => format!("BuiltinCandidate({:?})", b),
             BuiltinObjectCandidate => format!("BuiltinObjectCandidate"),
             BuiltinUnsizeCandidate => format!("BuiltinUnsizeCandidate"),
-            ParamCandidate(ref a) => format!("ParamCandidate({})", a.repr(tcx)),
-            ImplCandidate(a) => format!("ImplCandidate({})", a.repr(tcx)),
+            ParamCandidate(ref a) => format!("ParamCandidate({})", a.repr()),
+            ImplCandidate(a) => format!("ImplCandidate({})", a.repr()),
             DefaultImplCandidate(t) => format!("DefaultImplCandidate({:?})", t),
             DefaultImplObjectCandidate(t) => format!("DefaultImplObjectCandidate({:?})", t),
             ProjectionCandidate => format!("ProjectionCandidate"),
             FnPointerCandidate => format!("FnPointerCandidate"),
             ObjectCandidate => format!("ObjectCandidate"),
             ClosureCandidate(c, ref s) => {
-                format!("ClosureCandidate({:?},{})", c, s.repr(tcx))
+                format!("ClosureCandidate({:?},{})", c, s.repr())
             }
         }
     }
@@ -3032,10 +3032,10 @@ fn next(&mut self) -> Option<&'o TraitObligationStack<'o,'tcx>> {
     }
 }
 
-impl<'o,'tcx> Repr<'tcx> for TraitObligationStack<'o,'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'o,'tcx> Repr for TraitObligationStack<'o,'tcx> {
+    fn repr(&self) -> String {
         format!("TraitObligationStack({})",
-                self.obligation.repr(tcx))
+                self.obligation.repr())
     }
 }
 
index c1205d4a46d81055157289417be7482bfb9b77cd..a3ce5a90c2b04b38432bd353dab51611e2b40a9f 100644 (file)
@@ -126,7 +126,7 @@ fn push(&mut self, predicate: &ty::Predicate<'tcx>) {
                               .collect();
 
                 debug!("super_predicates: data={} predicates={}",
-                       data.repr(self.tcx), predicates.repr(self.tcx));
+                       data.repr(), predicates.repr());
 
                 // Only keep those bounds that we haven't already
                 // seen.  This is necessary to prevent infinite
@@ -328,7 +328,7 @@ pub fn predicates_for_generics<'tcx>(tcx: &ty::ctxt<'tcx>,
                                      -> Vec<PredicateObligation<'tcx>>
 {
     debug!("predicates_for_generics(generic_bounds={})",
-           generic_bounds.repr(tcx));
+           generic_bounds.repr());
 
     generic_bounds.predicates.iter().map(|predicate| {
         Obligation { cause: cause.clone(),
@@ -486,116 +486,116 @@ pub fn closure_trait_ref_and_return_type<'tcx>(
     ty::Binder((trait_ref, sig.0.output.unwrap_or(ty::mk_nil(tcx))))
 }
 
-impl<'tcx,O:Repr<'tcx>> Repr<'tcx> for super::Obligation<'tcx, O> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx,O:Repr> Repr for super::Obligation<'tcx, O> {
+    fn repr(&self) -> String {
         format!("Obligation(predicate={},depth={})",
-                self.predicate.repr(tcx),
+                self.predicate.repr(),
                 self.recursion_depth)
     }
 }
 
-impl<'tcx, N:Repr<'tcx>> Repr<'tcx> for super::Vtable<'tcx, N> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx, N:Repr> Repr for super::Vtable<'tcx, N> {
+    fn repr(&self) -> String {
         match *self {
             super::VtableImpl(ref v) =>
-                v.repr(tcx),
+                v.repr(),
 
             super::VtableDefaultImpl(ref t) =>
-                t.repr(tcx),
+                t.repr(),
 
             super::VtableClosure(ref d) =>
-                d.repr(tcx),
+                d.repr(),
 
             super::VtableFnPointer(ref d) =>
                 format!("VtableFnPointer({})",
-                        d.repr(tcx)),
+                        d.repr()),
 
             super::VtableObject(ref d) =>
                 format!("VtableObject({})",
-                        d.repr(tcx)),
+                        d.repr()),
 
             super::VtableParam(ref n) =>
                 format!("VtableParam({})",
-                        n.repr(tcx)),
+                        n.repr()),
 
             super::VtableBuiltin(ref d) =>
-                d.repr(tcx)
+                d.repr()
         }
     }
 }
 
-impl<'tcx, N:Repr<'tcx>> Repr<'tcx> for super::VtableImplData<'tcx, N> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx, N:Repr> Repr for super::VtableImplData<'tcx, N> {
+    fn repr(&self) -> String {
         format!("VtableImpl(impl_def_id={}, substs={}, nested={})",
-                self.impl_def_id.repr(tcx),
-                self.substs.repr(tcx),
-                self.nested.repr(tcx))
+                self.impl_def_id.repr(),
+                self.substs.repr(),
+                self.nested.repr())
     }
 }
 
-impl<'tcx, N:Repr<'tcx>> Repr<'tcx> for super::VtableClosureData<'tcx, N> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx, N:Repr> Repr for super::VtableClosureData<'tcx, N> {
+    fn repr(&self) -> String {
         format!("VtableClosure(closure_def_id={}, substs={}, nested={})",
-                self.closure_def_id.repr(tcx),
-                self.substs.repr(tcx),
-                self.nested.repr(tcx))
+                self.closure_def_id.repr(),
+                self.substs.repr(),
+                self.nested.repr())
     }
 }
 
-impl<'tcx, N:Repr<'tcx>> Repr<'tcx> for super::VtableBuiltinData<N> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx, N:Repr> Repr for super::VtableBuiltinData<N> {
+    fn repr(&self) -> String {
         format!("VtableBuiltin(nested={})",
-                self.nested.repr(tcx))
+                self.nested.repr())
     }
 }
 
-impl<'tcx, N:Repr<'tcx>> Repr<'tcx> for super::VtableDefaultImplData<N> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx, N:Repr> Repr for super::VtableDefaultImplData<N> {
+    fn repr(&self) -> String {
         format!("VtableDefaultImplData(trait_def_id={}, nested={})",
-                self.trait_def_id.repr(tcx),
-                self.nested.repr(tcx))
+                self.trait_def_id.repr(),
+                self.nested.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for super::VtableObjectData<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for super::VtableObjectData<'tcx> {
+    fn repr(&self) -> String {
         format!("VtableObject(object_ty={})",
-                self.object_ty.repr(tcx))
+                self.object_ty.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for super::SelectionError<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for super::SelectionError<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             super::Unimplemented =>
                 format!("Unimplemented"),
 
             super::OutputTypeParameterMismatch(ref a, ref b, ref c) =>
                 format!("OutputTypeParameterMismatch({},{},{})",
-                        a.repr(tcx),
-                        b.repr(tcx),
-                        c.repr(tcx)),
+                        a.repr(),
+                        b.repr(),
+                        c.repr()),
 
             super::TraitNotObjectSafe(ref tr) =>
                 format!("TraitNotObjectSafe({})",
-                        tr.repr(tcx))
+                        tr.repr())
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for super::FulfillmentError<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for super::FulfillmentError<'tcx> {
+    fn repr(&self) -> String {
         format!("FulfillmentError({},{})",
-                self.obligation.repr(tcx),
-                self.code.repr(tcx))
+                self.obligation.repr(),
+                self.code.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for super::FulfillmentErrorCode<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for super::FulfillmentErrorCode<'tcx> {
+    fn repr(&self) -> String {
         match *self {
-            super::CodeSelectionError(ref o) => o.repr(tcx),
-            super::CodeProjectionError(ref o) => o.repr(tcx),
+            super::CodeSelectionError(ref o) => o.repr(),
+            super::CodeProjectionError(ref o) => o.repr(),
             super::CodeAmbiguity => format!("Ambiguity")
         }
     }
@@ -611,9 +611,9 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-impl<'tcx> Repr<'tcx> for super::MismatchedProjectionTypes<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
-        self.err.repr(tcx)
+impl<'tcx> Repr for super::MismatchedProjectionTypes<'tcx> {
+    fn repr(&self) -> String {
+        self.err.repr()
     }
 }
 
index 2a0c224ad807a925ab3686bcc7346737fa66408a..e9f1fbeef90002ae5ae747c850954959bcff8ced 100644 (file)
@@ -2786,7 +2786,7 @@ pub fn record_impl(&self,
                        impl_def_id: DefId,
                        impl_trait_ref: TraitRef<'tcx>) {
         debug!("TraitDef::record_impl for {}, from {}",
-               self.repr(tcx), impl_trait_ref.repr(tcx));
+               self.repr(), impl_trait_ref.repr());
 
         // We don't want to borrow_mut after we already populated all impls,
         // so check if an impl is present with an immutable borrow first.
@@ -3710,7 +3710,7 @@ pub fn sequence_element_type<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
         TyArray(ty, _) | TySlice(ty) => ty,
         TyStr => mk_mach_uint(cx, ast::TyU8),
         _ => cx.sess.bug(&format!("sequence_element_type called on non-sequence value: {}",
-                                  ty.user_string(cx))),
+                                  ty.user_string())),
     }
 }
 
@@ -4180,7 +4180,7 @@ fn type_impls_bound<'a,'tcx>(param_env: Option<&ParameterEnvironment<'a,'tcx>>,
     let is_impld = traits::type_known_to_meet_builtin_bound(&infcx, param_env, ty, bound, span);
 
     debug!("type_impls_bound({}, {:?}) = {:?}",
-           ty.repr(tcx),
+           ty.repr(),
            bound,
            is_impld);
 
@@ -4282,19 +4282,19 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
     fn type_requires<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>,
                            r_ty: Ty<'tcx>, ty: Ty<'tcx>) -> bool {
         debug!("type_requires({}, {})?",
-               r_ty.repr(cx), ty.repr(cx));
+               r_ty.repr(), ty.repr());
 
         let r = r_ty == ty || subtypes_require(cx, seen, r_ty, ty);
 
         debug!("type_requires({}, {})? {:?}",
-               r_ty.repr(cx), ty.repr(cx), r);
+               r_ty.repr(), ty.repr(), r);
         return r;
     }
 
     fn subtypes_require<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>,
                               r_ty: Ty<'tcx>, ty: Ty<'tcx>) -> bool {
         debug!("subtypes_require({}, {})?",
-               r_ty.repr(cx), ty.repr(cx));
+               r_ty.repr(), ty.repr());
 
         let r = match ty.sty {
             // fixed length vectors need special treatment compared to
@@ -4373,7 +4373,7 @@ fn subtypes_require<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>,
         };
 
         debug!("subtypes_require({}, {})? {:?}",
-               r_ty.repr(cx), ty.repr(cx), r);
+               r_ty.repr(), ty.repr(), r);
 
         return r;
     }
@@ -4479,7 +4479,7 @@ fn same_type<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
     fn is_type_structurally_recursive<'tcx>(cx: &ctxt<'tcx>, sp: Span,
                                             seen: &mut Vec<Ty<'tcx>>,
                                             ty: Ty<'tcx>) -> Representability {
-        debug!("is_type_structurally_recursive: {}", ty.repr(cx));
+        debug!("is_type_structurally_recursive: {}", ty.repr());
 
         match ty.sty {
             TyStruct(did, _) | TyEnum(did, _) => {
@@ -4499,8 +4499,8 @@ fn is_type_structurally_recursive<'tcx>(cx: &ctxt<'tcx>, sp: Span,
                         Some(&seen_type) => {
                             if same_struct_or_enum_def_id(seen_type, did) {
                                 debug!("SelfRecursive: {} contains {}",
-                                       seen_type.repr(cx),
-                                       ty.repr(cx));
+                                       seen_type.repr(),
+                                       ty.repr());
                                 return SelfRecursive;
                             }
                         }
@@ -4519,8 +4519,8 @@ fn is_type_structurally_recursive<'tcx>(cx: &ctxt<'tcx>, sp: Span,
                     for &seen_type in iter {
                         if same_type(ty, seen_type) {
                             debug!("ContainsRecursive: {} contains {}",
-                                   seen_type.repr(cx),
-                                   ty.repr(cx));
+                                   seen_type.repr(),
+                                   ty.repr());
                             return ContainsRecursive;
                         }
                     }
@@ -4540,14 +4540,14 @@ fn is_type_structurally_recursive<'tcx>(cx: &ctxt<'tcx>, sp: Span,
         }
     }
 
-    debug!("is_type_representable: {}", ty.repr(cx));
+    debug!("is_type_representable: {}", ty.repr());
 
     // To avoid a stack overflow when checking an enum variant or struct that
     // contains a different, structurally recursive type, maintain a stack
     // of seen types and check recursion for each of them (issues #3008, #3779).
     let mut seen: Vec<Ty> = Vec::new();
     let r = is_type_structurally_recursive(cx, sp, &mut seen, ty);
-    debug!("is_type_representable: {} is {:?}", ty.repr(cx), r);
+    debug!("is_type_representable: {} is {:?}", ty.repr(), r);
     r
 }
 
@@ -4949,7 +4949,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
                         _ => {
                             cx.sess.bug(
                                 &format!("AdjustReifyFnPointer adjustment on non-fn-item: \
-                                          {}", unadjusted_ty.repr(cx)));
+                                          {}", unadjusted_ty.repr()));
                         }
                     }
                 }
@@ -4990,7 +4990,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
                                         span,
                                         &format!("the {}th autoderef failed: {}",
                                                 i,
-                                                 adjusted_ty.user_string(cx))
+                                                 adjusted_ty.user_string())
                                         );
                                 }
                             }
@@ -5232,11 +5232,11 @@ pub fn impl_or_trait_item_idx(id: ast::Name, trait_items: &[ImplOrTraitItem])
     trait_items.iter().position(|m| m.name() == id)
 }
 
-pub fn ty_sort_string<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> String {
+pub fn ty_sort_string(cx: &ctxt, ty: Ty) -> String {
     match ty.sty {
         TyBool | TyChar | TyInt(_) |
-        TyUint(_) | TyFloat(_) | TyStr => ty.user_string(cx),
-        TyTuple(ref tys) if tys.is_empty() => ty.user_string(cx),
+        TyUint(_) | TyFloat(_) | TyStr => ty.user_string(),
+        TyTuple(ref tys) if tys.is_empty() => ty.user_string(),
 
         TyEnum(id, _) => format!("enum `{}`", item_path_str(cx, id)),
         TyBox(_) => "box".to_string(),
@@ -5272,9 +5272,9 @@ pub fn ty_sort_string<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::type_err<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
-        ty::type_err_to_str(tcx, self)
+impl<'tcx> Repr for ty::type_err<'tcx> {
+    fn repr(&self) -> String {
+        tls::with(|tcx| ty::type_err_to_str(tcx, self))
     }
 }
 
@@ -5282,7 +5282,7 @@ fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
 /// in parentheses after some larger message. You should also invoke `note_and_explain_type_err()`
 /// afterwards to present additional details, particularly when it comes to lifetime-related
 /// errors.
-pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
+pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String {
     match *err {
         terr_cyclic_ty => "cyclic type of infinite size".to_string(),
         terr_mismatch => "types differ".to_string(),
@@ -5336,12 +5336,12 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
         terr_regions_insufficiently_polymorphic(br, _) => {
             format!("expected bound lifetime parameter {}, \
                      found concrete lifetime",
-                    br.user_string(cx))
+                    br.user_string())
         }
         terr_regions_overly_polymorphic(br, _) => {
             format!("expected concrete lifetime, \
                      found bound lifetime parameter {}",
-                    br.user_string(cx))
+                    br.user_string())
         }
         terr_sorts(values) => {
             // A naive approach to making sure that we're not reporting silly errors such as:
@@ -5362,14 +5362,14 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
         terr_builtin_bounds(values) => {
             if values.expected.is_empty() {
                 format!("expected no bounds, found `{}`",
-                        values.found.user_string(cx))
+                        values.found.user_string())
             } else if values.found.is_empty() {
                 format!("expected bounds `{}`, found no bounds",
-                        values.expected.user_string(cx))
+                        values.expected.user_string())
             } else {
                 format!("expected bounds `{}`, found bounds `{}`",
-                        values.expected.user_string(cx),
-                        values.found.user_string(cx))
+                        values.expected.user_string(),
+                        values.found.user_string())
             }
         }
         terr_integer_as_char => {
@@ -6010,7 +6010,7 @@ fn report_discrim_overflow(cx: &ctxt,
     let computed_value = repr_type.disr_wrap_incr(Some(prev_val));
     let computed_value = repr_type.disr_string(computed_value);
     let prev_val = repr_type.disr_string(prev_val);
-    let repr_type = repr_type.to_ty(cx).user_string(cx);
+    let repr_type = repr_type.to_ty(cx).user_string();
     span_err!(cx.sess, variant_span, E0370,
               "enum discriminant overflowed on value after {}: {}; \
                set explicitly via {} = {} if that is desired outcome",
@@ -6503,8 +6503,8 @@ pub fn required_region_bounds<'tcx>(tcx: &ctxt<'tcx>,
                                     -> Vec<ty::Region>
 {
     debug!("required_region_bounds(erased_self_ty={:?}, predicates={:?})",
-           erased_self_ty.repr(tcx),
-           predicates.repr(tcx));
+           erased_self_ty.repr(),
+           predicates.repr());
 
     assert!(!erased_self_ty.has_escaping_regions());
 
@@ -6622,7 +6622,7 @@ pub fn populate_implementations_for_trait_if_necessary(tcx: &ctxt, trait_id: ast
         return;
     }
 
-    debug!("populate_implementations_for_trait_if_necessary: searching for {}", def.repr(tcx));
+    debug!("populate_implementations_for_trait_if_necessary: searching for {}", def.repr());
 
     if csearch::is_defaulted_trait(&tcx.sess.cstore, trait_id) {
         record_trait_has_default_impl(tcx, trait_id);
@@ -6931,7 +6931,7 @@ fn push_types_from_defs<'tcx>(tcx: &ty::ctxt<'tcx>,
                                   defs: &[TypeParameterDef<'tcx>]) {
         for def in defs {
             debug!("construct_parameter_environment(): push_types_from_defs: def={:?}",
-                   def.repr(tcx));
+                   def.repr());
             let ty = ty::mk_param_from_def(tcx, def);
             types.push(def.space, ty);
        }
@@ -6964,8 +6964,8 @@ pub fn construct_parameter_environment<'a,'tcx>(
 
     debug!("construct_parameter_environment: free_id={:?} free_subst={:?} predicates={:?}",
            free_id,
-           free_substs.repr(tcx),
-           predicates.repr(tcx));
+           free_substs.repr(),
+           predicates.repr());
 
     //
     // Finally, we have to normalize the bounds in the environment, in
@@ -7221,7 +7221,7 @@ pub fn liberate_late_bound_regions<'tcx, T>(
     all_outlive_scope: region::DestructionScopeData,
     value: &Binder<T>)
     -> T
-    where T : TypeFoldable<'tcx> + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + Repr
 {
     ty_fold::replace_late_bound_regions(
         tcx, value,
@@ -7232,7 +7232,7 @@ pub fn count_late_bound_regions<'tcx, T>(
     tcx: &ty::ctxt<'tcx>,
     value: &Binder<T>)
     -> usize
-    where T : TypeFoldable<'tcx> + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + Repr
 {
     let (_, skol_map) = ty_fold::replace_late_bound_regions(tcx, value, |_| ty::ReStatic);
     skol_map.len()
@@ -7242,7 +7242,7 @@ pub fn binds_late_bound_regions<'tcx, T>(
     tcx: &ty::ctxt<'tcx>,
     value: &Binder<T>)
     -> bool
-    where T : TypeFoldable<'tcx> + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + Repr
 {
     count_late_bound_regions(tcx, value) > 0
 }
@@ -7253,7 +7253,7 @@ pub fn flatten_late_bound_regions<'tcx, T>(
     tcx: &ty::ctxt<'tcx>,
     bound2_value: &Binder<Binder<T>>)
     -> Binder<T>
-    where T: TypeFoldable<'tcx> + Repr<'tcx>
+    where T: TypeFoldable<'tcx> + Repr
 {
     let bound0_value = bound2_value.skip_binder().skip_binder();
     let value = ty_fold::fold_regions(tcx, bound0_value, |region, current_depth| {
@@ -7275,7 +7275,7 @@ pub fn no_late_bound_regions<'tcx, T>(
     tcx: &ty::ctxt<'tcx>,
     value: &Binder<T>)
     -> Option<T>
-    where T : TypeFoldable<'tcx> + Repr<'tcx> + Clone
+    where T : TypeFoldable<'tcx> + Repr + Clone
 {
     if binds_late_bound_regions(tcx, value) {
         None
@@ -7290,7 +7290,7 @@ pub fn erase_late_bound_regions<'tcx, T>(
     tcx: &ty::ctxt<'tcx>,
     value: &Binder<T>)
     -> T
-    where T : TypeFoldable<'tcx> + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + Repr
 {
     ty_fold::replace_late_bound_regions(tcx, value, |_| ty::ReStatic).0
 }
@@ -7307,7 +7307,7 @@ pub fn anonymize_late_bound_regions<'tcx, T>(
     tcx: &ctxt<'tcx>,
     sig: &Binder<T>)
     -> Binder<T>
-    where T : TypeFoldable<'tcx> + Repr<'tcx>,
+    where T : TypeFoldable<'tcx> + Repr,
 {
     let mut counter = 0;
     ty::Binder(ty_fold::replace_late_bound_regions(tcx, sig, |_| {
@@ -7327,8 +7327,8 @@ pub fn shifted(&self, amount: u32) -> DebruijnIndex {
     }
 }
 
-impl<'tcx> Repr<'tcx> for AutoAdjustment<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for AutoAdjustment<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             AdjustReifyFnPointer => {
                 format!("AdjustReifyFnPointer")
@@ -7337,24 +7337,24 @@ fn repr(&self, tcx: &ctxt<'tcx>) -> String {
                 format!("AdjustUnsafeFnPointer")
             }
             AdjustDerefRef(ref data) => {
-                data.repr(tcx)
+                data.repr()
             }
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for AutoDerefRef<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for AutoDerefRef<'tcx> {
+    fn repr(&self) -> String {
         format!("AutoDerefRef({}, unsize={}, {})",
-                self.autoderefs, self.unsize.repr(tcx), self.autoref.repr(tcx))
+                self.autoderefs, self.unsize.repr(), self.autoref.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for AutoRef<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for AutoRef<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             AutoPtr(a, b) => {
-                format!("AutoPtr({},{:?})", a.repr(tcx), b)
+                format!("AutoPtr({},{:?})", a.repr(), b)
             }
             AutoUnsafe(ref a) => {
                 format!("AutoUnsafe({:?})", a)
@@ -7363,22 +7363,22 @@ fn repr(&self, tcx: &ctxt<'tcx>) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for TraitTy<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for TraitTy<'tcx> {
+    fn repr(&self) -> String {
         format!("TraitTy({},{})",
-                self.principal.repr(tcx),
-                self.bounds.repr(tcx))
+                self.principal.repr(),
+                self.bounds.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::Predicate<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::Predicate<'tcx> {
+    fn repr(&self) -> String {
         match *self {
-            Predicate::Trait(ref a) => a.repr(tcx),
-            Predicate::Equate(ref pair) => pair.repr(tcx),
-            Predicate::RegionOutlives(ref pair) => pair.repr(tcx),
-            Predicate::TypeOutlives(ref pair) => pair.repr(tcx),
-            Predicate::Projection(ref pair) => pair.repr(tcx),
+            Predicate::Trait(ref a) => a.repr(),
+            Predicate::Equate(ref pair) => pair.repr(),
+            Predicate::RegionOutlives(ref pair) => pair.repr(),
+            Predicate::TypeOutlives(ref pair) => pair.repr(),
+            Predicate::Projection(ref pair) => pair.repr(),
         }
     }
 }
@@ -7584,11 +7584,11 @@ fn has_regions_escaping_depth(&self, depth: u32) -> bool {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::ProjectionPredicate<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::ProjectionPredicate<'tcx> {
+    fn repr(&self) -> String {
         format!("ProjectionPredicate({}, {})",
-                self.projection_ty.repr(tcx),
-                self.ty.repr(tcx))
+                self.projection_ty.repr(),
+                self.ty.repr())
     }
 }
 
@@ -7826,48 +7826,48 @@ fn references_error(&self) -> bool {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ClosureTy<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ClosureTy<'tcx> {
+    fn repr(&self) -> String {
         format!("ClosureTy({},{},{})",
                 self.unsafety,
-                self.sig.repr(tcx),
+                self.sig.repr(),
                 self.abi)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ClosureUpvar<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ClosureUpvar<'tcx> {
+    fn repr(&self) -> String {
         format!("ClosureUpvar({},{})",
-                self.def.repr(tcx),
-                self.ty.repr(tcx))
+                self.def.repr(),
+                self.ty.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for field<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for field<'tcx> {
+    fn repr(&self) -> String {
         format!("field({},{})",
-                self.name.repr(tcx),
-                self.mt.repr(tcx))
+                self.name.repr(),
+                self.mt.repr())
     }
 }
 
-impl<'a, 'tcx> Repr<'tcx> for ParameterEnvironment<'a, 'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'a, 'tcx> Repr for ParameterEnvironment<'a, 'tcx> {
+    fn repr(&self) -> String {
         format!("ParameterEnvironment(\
             free_substs={}, \
             implicit_region_bound={}, \
             caller_bounds={})",
-            self.free_substs.repr(tcx),
-            self.implicit_region_bound.repr(tcx),
-            self.caller_bounds.repr(tcx))
+            self.free_substs.repr(),
+            self.implicit_region_bound.repr(),
+            self.caller_bounds.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ObjectLifetimeDefault {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ObjectLifetimeDefault {
+    fn repr(&self) -> String {
         match *self {
             ObjectLifetimeDefault::Ambiguous => format!("Ambiguous"),
-            ObjectLifetimeDefault::Specific(ref r) => r.repr(tcx),
+            ObjectLifetimeDefault::Specific(ref r) => r.repr(),
         }
     }
 }
index cc91ccbfbd41e265ead805de2e15f94d6df80320..00905eda1498e16b079bf26d66d4f95737de31af 100644 (file)
@@ -50,7 +50,7 @@
 
 /// The TypeFoldable trait is implemented for every type that can be folded.
 /// Basically, every type that has a corresponding method in TypeFolder.
-pub trait TypeFoldable<'tcx>: Repr<'tcx> + Clone {
+pub trait TypeFoldable<'tcx>: Repr + Clone {
     fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self;
 }
 
@@ -74,7 +74,7 @@ fn enter_region_binder(&mut self) { }
     fn exit_region_binder(&mut self) { }
 
     fn fold_binder<T>(&mut self, t: &ty::Binder<T>) -> ty::Binder<T>
-        where T : TypeFoldable<'tcx> + Repr<'tcx> + Clone
+        where T : TypeFoldable<'tcx> + Repr + Clone
     {
         // FIXME(#20526) this should replace `enter_region_binder`/`exit_region_binder`.
         super_fold_binder(self, t)
@@ -197,7 +197,7 @@ fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Vec<T> {
     }
 }
 
-impl<'tcx, T:TypeFoldable<'tcx>+Repr<'tcx>+Clone> TypeFoldable<'tcx> for ty::Binder<T> {
+impl<'tcx, T:TypeFoldable<'tcx>+Repr+Clone> TypeFoldable<'tcx> for ty::Binder<T> {
     fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> ty::Binder<T> {
         folder.fold_binder(self)
     }
@@ -843,12 +843,12 @@ fn fold_region(&mut self, r: ty::Region) -> ty::Region {
         match r {
             ty::ReLateBound(debruijn, _) if debruijn.depth < self.current_depth => {
                 debug!("RegionFolder.fold_region({}) skipped bound region (current depth={})",
-                       r.repr(self.tcx()), self.current_depth);
+                       r.repr(), self.current_depth);
                 r
             }
             _ => {
                 debug!("RegionFolder.fold_region({}) folding free region (current_depth={})",
-                       r.repr(self.tcx()), self.current_depth);
+                       r.repr(), self.current_depth);
                 (self.fld_r)(r, self.current_depth)
             }
         }
@@ -885,9 +885,9 @@ pub fn replace_late_bound_regions<'tcx,T,F>(tcx: &ty::ctxt<'tcx>,
                                             mut f: F)
                                             -> (T, FnvHashMap<ty::BoundRegion, ty::Region>)
     where F : FnMut(ty::BoundRegion) -> ty::Region,
-          T : TypeFoldable<'tcx> + Repr<'tcx>,
+          T : TypeFoldable<'tcx> + Repr,
 {
-    debug!("replace_late_bound_regions({})", value.repr(tcx));
+    debug!("replace_late_bound_regions({})", value.repr());
     let mut replacer = RegionReplacer::new(tcx, &mut f);
     let result = value.skip_binder().fold_with(&mut replacer);
     (result, replacer.map)
@@ -917,7 +917,7 @@ fn fold_region(&mut self, r: ty::Region) -> ty::Region {
         match r {
             ty::ReLateBound(debruijn, br) if debruijn.depth == self.current_depth => {
                 debug!("RegionReplacer.fold_region({}) folding region (current_depth={})",
-                       r.repr(self.tcx()), self.current_depth);
+                       r.repr(), self.current_depth);
                 let fld_r = &mut self.fld_r;
                 let region = *self.map.entry(br).or_insert_with(|| fld_r(br));
                 if let ty::ReLateBound(debruijn1, br) = region {
@@ -994,10 +994,10 @@ pub fn shift_region(region: ty::Region, amount: u32) -> ty::Region {
     }
 }
 
-pub fn shift_regions<'tcx, T:TypeFoldable<'tcx>+Repr<'tcx>>(tcx: &ty::ctxt<'tcx>,
+pub fn shift_regions<'tcx, T:TypeFoldable<'tcx>+Repr>(tcx: &ty::ctxt<'tcx>,
                                                             amount: u32, value: &T) -> T {
     debug!("shift_regions(value={}, amount={})",
-           value.repr(tcx), amount);
+           value.repr(), amount);
 
     value.fold_with(&mut RegionFolder::new(tcx, &mut |region, _current_depth| {
         shift_region(region, amount)
index 241a27aa0cd79533f57c6f763362c656aaba820e..3c9777935706f75714410bd8b922391aa1c02b33 100644 (file)
@@ -55,14 +55,14 @@ fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,
     fn regions(&mut self, a: ty::Region, b: ty::Region) -> RelateResult<'tcx, ty::Region> {
         debug!("{}.regions({}, {})",
                self.tag(),
-               a.repr(self.tcx()),
-               b.repr(self.tcx()));
+               a.repr(),
+               b.repr());
         Ok(a)
     }
 
     fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
         debug!("{}.tys({}, {})", self.tag(),
-               a.repr(self.tcx()), b.repr(self.tcx()));
+               a.repr(), b.repr());
         if a == b { return Ok(a); }
 
         match (&a.sty, &b.sty) {
index 91169af4adbe309da6b83a96d72f079732eb8557..a97f9d0b9f8a17ef21348c9e4693a36679b49496 100644 (file)
@@ -81,8 +81,8 @@ fn relate<R>(relation: &mut R,
     {
         debug!("{}.mts({}, {})",
                relation.tag(),
-               a.repr(relation.tcx()),
-               b.repr(relation.tcx()));
+               a.repr(),
+               b.repr());
         if a.mutbl != b.mutbl {
             Err(ty::terr_mutability)
         } else {
@@ -108,9 +108,9 @@ fn relate_item_substs<'a,'tcx:'a,R>(relation: &mut R,
     where R: TypeRelation<'a,'tcx>
 {
     debug!("substs: item_def_id={} a_subst={} b_subst={}",
-           item_def_id.repr(relation.tcx()),
-           a_subst.repr(relation.tcx()),
-           b_subst.repr(relation.tcx()));
+           item_def_id.repr(),
+           a_subst.repr(),
+           b_subst.repr());
 
     let variances;
     let opt_variances = if relation.tcx().variance_computed.get() {
@@ -196,9 +196,9 @@ fn relate_region_params<'a,'tcx:'a,R>(relation: &mut R,
 
     debug!("relate_region_params(a_rs={}, \
             b_rs={}, variances={})",
-           a_rs.repr(tcx),
-           b_rs.repr(tcx),
-           variances.repr(tcx));
+           a_rs.repr(),
+           b_rs.repr(),
+           variances.repr());
 
     assert_eq!(num_region_params,
                variances.map_or(num_region_params,
index c4f69a7f5fe93d70ccdaf65438d3292ce9ba8276..079741b0f2815aac40fc045c316202c2d0d59228 100644 (file)
 use syntax::owned_slice::OwnedSlice;
 
 /// Produces a string suitable for debugging output.
-pub trait Repr<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String;
+pub trait Repr {
+    fn repr(&self) -> String;
 }
 
 /// Produces a string suitable for showing to the user.
-pub trait UserString<'tcx> : Repr<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String;
+pub trait UserString: Repr {
+    fn user_string(&self) -> String;
 }
 
-fn parameterized<'tcx, GG>(cx: &ctxt<'tcx>,
-                           substs: &subst::Substs<'tcx>,
-                           did: ast::DefId,
-                           projections: &[ty::ProjectionPredicate<'tcx>],
-                           get_generics: GG)
-                           -> String
-    where GG : FnOnce() -> ty::Generics<'tcx>
+pub fn verbose() -> bool {
+    ty::tls::with(|tcx| tcx.sess.verbose())
+}
+
+fn parameterized<GG>(substs: &subst::Substs,
+                     did: ast::DefId,
+                     projections: &[ty::ProjectionPredicate],
+                     get_generics: GG)
+                     -> String
+    where GG: for<'tcx> FnOnce(&ty::ctxt<'tcx>) -> ty::Generics<'tcx>
 {
-    let base = ty::item_path_str(cx, did);
-    if cx.sess.verbose() {
+    let base = ty::tls::with(|tcx| ty::item_path_str(tcx, did));
+    if verbose() {
         let mut strings = vec![];
         match substs.regions {
             subst::ErasedRegions => {
@@ -66,17 +69,17 @@ fn parameterized<'tcx, GG>(cx: &ctxt<'tcx>,
             }
             subst::NonerasedRegions(ref regions) => {
                 for region in regions {
-                    strings.push(region.repr(cx));
+                    strings.push(region.repr());
                 }
             }
         }
         for ty in &substs.types {
-            strings.push(ty.repr(cx));
+            strings.push(ty.repr());
         }
         for projection in projections {
             strings.push(format!("{}={}",
-                                 projection.projection_ty.item_name.user_string(cx),
-                                 projection.ty.user_string(cx)));
+                                 projection.projection_ty.item_name.user_string(),
+                                 projection.ty.user_string()));
         }
         return if strings.is_empty() {
             format!("{}", base)
@@ -91,7 +94,7 @@ fn parameterized<'tcx, GG>(cx: &ctxt<'tcx>,
         subst::ErasedRegions => { }
         subst::NonerasedRegions(ref regions) => {
             for &r in regions {
-                let s = r.user_string(cx);
+                let s = r.user_string();
                 if s.is_empty() {
                     // This happens when the value of the region
                     // parameter is not easily serialized. This may be
@@ -111,52 +114,57 @@ fn parameterized<'tcx, GG>(cx: &ctxt<'tcx>,
     // ICEs trying to fetch the generics early in the pipeline. This
     // is kind of a hacky workaround in that -Z verbose is required to
     // avoid those ICEs.
-    let generics = get_generics();
-
-    let has_self = substs.self_ty().is_some();
-    let tps = substs.types.get_slice(subst::TypeSpace);
-    let ty_params = generics.types.get_slice(subst::TypeSpace);
-    let has_defaults = ty_params.last().map_or(false, |def| def.default.is_some());
-    let num_defaults = if has_defaults {
-        ty_params.iter().zip(tps).rev().take_while(|&(def, &actual)| {
-            match def.default {
-                Some(default) => {
-                    if !has_self && ty::type_has_self(default) {
-                        // In an object type, there is no `Self`, and
-                        // thus if the default value references Self,
-                        // the user will be required to give an
-                        // explicit value. We can't even do the
-                        // substitution below to check without causing
-                        // an ICE. (#18956).
-                        false
-                    } else {
-                        default.subst(cx, substs) == actual
+    ty::tls::with(|tcx| {
+        let generics = get_generics(tcx);
+
+        let has_self = substs.self_ty().is_some();
+        let tps = substs.types.get_slice(subst::TypeSpace);
+        let ty_params = generics.types.get_slice(subst::TypeSpace);
+        let has_defaults = ty_params.last().map_or(false, |def| def.default.is_some());
+        let num_defaults = if has_defaults {
+            let substs = tcx.lift(&substs);
+            ty_params.iter().zip(tps).rev().take_while(|&(def, &actual)| {
+                match def.default {
+                    Some(default) => {
+                        if !has_self && ty::type_has_self(default) {
+                            // In an object type, there is no `Self`, and
+                            // thus if the default value references Self,
+                            // the user will be required to give an
+                            // explicit value. We can't even do the
+                            // substitution below to check without causing
+                            // an ICE. (#18956).
+                            false
+                        } else {
+                            let default = tcx.lift(&default);
+                            substs.and_then(|substs| default.subst(tcx, substs)) == Some(actual)
+                        }
                     }
+                    None => false
                 }
-                None => false
-            }
-        }).count()
-    } else {
-        0
-    };
+            }).count()
+        } else {
+            0
+        };
 
-    for t in &tps[..tps.len() - num_defaults] {
-        strs.push(t.user_string(cx))
-    }
+        for t in &tps[..tps.len() - num_defaults] {
+            strs.push(t.user_string())
+        }
+    });
 
     for projection in projections {
         strs.push(format!("{}={}",
-                          projection.projection_ty.item_name.user_string(cx),
-                          projection.ty.user_string(cx)));
+                          projection.projection_ty.item_name.user_string(),
+                          projection.ty.user_string()));
     }
 
-    if cx.lang_items.fn_trait_kind(did).is_some() && projections.len() == 1 {
+    let fn_trait_kind = ty::tls::with(|tcx| tcx.lang_items.fn_trait_kind(did));
+    if fn_trait_kind.is_some() && projections.len() == 1 {
         let projection_ty = projections[0].ty;
         let tail =
             if ty::type_is_nil(projection_ty) {
                 format!("")
             } else {
-                format!(" -> {}", projection_ty.user_string(cx))
+                format!(" -> {}", projection_ty.user_string())
             };
         format!("{}({}){}",
                 base,
@@ -175,90 +183,129 @@ fn parameterized<'tcx, GG>(cx: &ctxt<'tcx>,
     }
 }
 
-impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for Option<T> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+fn in_binder<'tcx, T, U>(tcx: &ty::ctxt<'tcx>,
+                         original: &ty::Binder<T>,
+                         lifted: Option<ty::Binder<U>>) -> String
+    where T: UserString, U: UserString + TypeFoldable<'tcx>
+{
+    // Replace any anonymous late-bound regions with named
+    // variants, using gensym'd identifiers, so that we can
+    // clearly differentiate between named and unnamed regions in
+    // the output. We'll probably want to tweak this over time to
+    // decide just how much information to give.
+    let value = if let Some(v) = lifted {
+        v
+    } else {
+        return original.0.user_string();
+    };
+    let mut names = Vec::new();
+    let value_str = ty_fold::replace_late_bound_regions(tcx, &value, |br| {
+        ty::ReLateBound(ty::DebruijnIndex::new(1), match br {
+            ty::BrNamed(_, name) => {
+                names.push(token::get_name(name).to_string());
+                br
+            }
+            ty::BrAnon(_) |
+            ty::BrFresh(_) |
+            ty::BrEnv => {
+                let name = token::gensym("'r");
+                names.push(token::get_name(name).to_string());
+                ty::BrNamed(ast_util::local_def(ast::DUMMY_NODE_ID), name)
+            }
+        })
+    }).0.user_string();
+
+    if names.is_empty() {
+        value_str
+    } else {
+        format!("for<{}> {}", names.connect(","), value_str)
+    }
+}
+
+impl<T:Repr> Repr for Option<T> {
+    fn repr(&self) -> String {
         match self {
             &None => "None".to_string(),
-            &Some(ref t) => t.repr(tcx),
+            &Some(ref t) => t.repr(),
         }
     }
 }
 
-impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for P<T> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        (**self).repr(tcx)
+impl<T:Repr> Repr for P<T> {
+    fn repr(&self) -> String {
+        (**self).repr()
     }
 }
 
-impl<'tcx,T:Repr<'tcx>,U:Repr<'tcx>> Repr<'tcx> for Result<T,U> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<T:Repr,U:Repr> Repr for Result<T,U> {
+    fn repr(&self) -> String {
         match self {
-            &Ok(ref t) => t.repr(tcx),
-            &Err(ref u) => format!("Err({})", u.repr(tcx))
+            &Ok(ref t) => t.repr(),
+            &Err(ref u) => format!("Err({})", u.repr())
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for () {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for () {
+    fn repr(&self) -> String {
         "()".to_string()
     }
 }
 
-impl<'a, 'tcx, T: ?Sized +Repr<'tcx>> Repr<'tcx> for &'a T {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        Repr::repr(*self, tcx)
+impl<'a, T: ?Sized +Repr> Repr for &'a T {
+    fn repr(&self) -> String {
+        (**self).repr()
     }
 }
 
-impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for Rc<T> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        (&**self).repr(tcx)
+impl<T:Repr> Repr for Rc<T> {
+    fn repr(&self) -> String {
+        (&**self).repr()
     }
 }
 
-impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for Box<T> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        (&**self).repr(tcx)
+impl<T:Repr> Repr for Box<T> {
+    fn repr(&self) -> String {
+        (&**self).repr()
     }
 }
 
-impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for [T] {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        format!("[{}]", self.iter().map(|t| t.repr(tcx)).collect::<Vec<_>>().connect(", "))
+impl<T:Repr> Repr for [T] {
+    fn repr(&self) -> String {
+        format!("[{}]", self.iter().map(|t| t.repr()).collect::<Vec<_>>().connect(", "))
     }
 }
 
-impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for OwnedSlice<T> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        self[..].repr(tcx)
+impl<T:Repr> Repr for OwnedSlice<T> {
+    fn repr(&self) -> String {
+        self[..].repr()
     }
 }
 
 // This is necessary to handle types like Option<Vec<T>>, for which
 // autoderef cannot convert the &[T] handler
-impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for Vec<T> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        self[..].repr(tcx)
+impl<T:Repr> Repr for Vec<T> {
+    fn repr(&self) -> String {
+        self[..].repr()
     }
 }
 
-impl<'a, 'tcx, T: ?Sized +UserString<'tcx>> UserString<'tcx> for &'a T {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
-        UserString::user_string(*self, tcx)
+impl<'a, T: ?Sized +UserString> UserString for &'a T {
+    fn user_string(&self) -> String {
+        (**self).user_string()
     }
 }
 
-impl<'tcx, T:UserString<'tcx>> UserString<'tcx> for Vec<T> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+impl<T:UserString> UserString for Vec<T> {
+    fn user_string(&self) -> String {
         let strs: Vec<String> =
-            self.iter().map(|t| t.user_string(tcx)).collect();
+            self.iter().map(|t| t.user_string()).collect();
         strs.connect(", ")
     }
 }
 
-impl<'tcx> Repr<'tcx> for def::Def {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for def::Def {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
@@ -277,19 +324,18 @@ fn repr(&self, _tcx: &ctxt) -> String {
 type TraitAndProjections<'tcx> =
     (ty::TraitRef<'tcx>, Vec<ty::ProjectionPredicate<'tcx>>);
 
-impl<'tcx> UserString<'tcx> for TraitAndProjections<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> UserString for TraitAndProjections<'tcx> {
+    fn user_string(&self) -> String {
         let &(ref trait_ref, ref projection_bounds) = self;
-        parameterized(tcx,
-                      trait_ref.substs,
+        parameterized(trait_ref.substs,
                       trait_ref.def_id,
                       &projection_bounds[..],
-                      || ty::lookup_trait_def(tcx, trait_ref.def_id).generics.clone())
+                      |tcx| ty::lookup_trait_def(tcx, trait_ref.def_id).generics.clone())
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::TraitTy<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> UserString for ty::TraitTy<'tcx> {
+    fn user_string(&self) -> String {
         let &ty::TraitTy { ref principal, ref bounds } = self;
 
         let mut components = vec![];
@@ -299,17 +345,17 @@ fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
                         bounds.projection_bounds.iter().map(|x| x.0.clone()).collect()));
 
         // Generate the main trait ref, including associated types.
-        components.push(tap.user_string(tcx));
+        components.push(tap.user_string());
 
         // Builtin bounds.
         for bound in &bounds.builtin_bounds {
-            components.push(bound.user_string(tcx));
+            components.push(bound.user_string());
         }
 
         // Region, if not obviously implied by builtin bounds.
         if bounds.region_bound != ty::ReStatic {
             // Region bound is implied by builtin bounds:
-            components.push(bounds.region_bound.user_string(tcx));
+            components.push(bounds.region_bound.user_string());
         }
 
         components.retain(|s| !s.is_empty());
@@ -318,8 +364,8 @@ fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::TypeParameterDef<'tcx> {
-    fn repr(&self, _tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::TypeParameterDef<'tcx> {
+    fn repr(&self) -> String {
         format!("TypeParameterDef({:?}, {:?}/{})",
                 self.def_id,
                 self.space,
@@ -327,63 +373,63 @@ fn repr(&self, _tcx: &ctxt<'tcx>) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::RegionParameterDef {
-    fn repr(&self, tcx: &ctxt) -> String {
+impl Repr for ty::RegionParameterDef {
+    fn repr(&self) -> String {
         format!("RegionParameterDef(name={}, def_id={}, bounds={})",
                 token::get_name(self.name),
-                self.def_id.repr(tcx),
-                self.bounds.repr(tcx))
+                self.def_id.repr(),
+                self.bounds.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::TyS<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        self.user_string(tcx)
+impl<'tcx> Repr for ty::TyS<'tcx> {
+    fn repr(&self) -> String {
+        self.user_string()
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::mt<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::mt<'tcx> {
+    fn repr(&self) -> String {
         format!("{}{}",
             if self.mutbl == ast::MutMutable { "mut " } else { "" },
-            self.ty.user_string(tcx))
+            self.ty.user_string())
     }
 }
 
-impl<'tcx> Repr<'tcx> for subst::Substs<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for subst::Substs<'tcx> {
+    fn repr(&self) -> String {
         format!("Substs[types={}, regions={}]",
-                       self.types.repr(tcx),
-                       self.regions.repr(tcx))
+                       self.types.repr(),
+                       self.regions.repr())
     }
 }
 
-impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for subst::VecPerParamSpace<T> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<T:Repr> Repr for subst::VecPerParamSpace<T> {
+    fn repr(&self) -> String {
         format!("[{};{};{}]",
-                self.get_slice(subst::TypeSpace).repr(tcx),
-                self.get_slice(subst::SelfSpace).repr(tcx),
-                self.get_slice(subst::FnSpace).repr(tcx))
+                self.get_slice(subst::TypeSpace).repr(),
+                self.get_slice(subst::SelfSpace).repr(),
+                self.get_slice(subst::FnSpace).repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::ItemSubsts<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        format!("ItemSubsts({})", self.substs.repr(tcx))
+impl<'tcx> Repr for ty::ItemSubsts<'tcx> {
+    fn repr(&self) -> String {
+        format!("ItemSubsts({})", self.substs.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for subst::RegionSubsts {
-    fn repr(&self, tcx: &ctxt) -> String {
+impl Repr for subst::RegionSubsts {
+    fn repr(&self) -> String {
         match *self {
             subst::ErasedRegions => "erased".to_string(),
-            subst::NonerasedRegions(ref regions) => regions.repr(tcx)
+            subst::NonerasedRegions(ref regions) => regions.repr()
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::BuiltinBounds {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ty::BuiltinBounds {
+    fn repr(&self) -> String {
         let mut res = Vec::new();
         for b in self {
             res.push(match b {
@@ -397,40 +443,40 @@ fn repr(&self, _tcx: &ctxt) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::ParamBounds<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::ParamBounds<'tcx> {
+    fn repr(&self) -> String {
         let mut res = Vec::new();
-        res.push(self.builtin_bounds.repr(tcx));
+        res.push(self.builtin_bounds.repr());
         for t in &self.trait_bounds {
-            res.push(t.repr(tcx));
+            res.push(t.repr());
         }
         res.connect("+")
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::TraitRef<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::TraitRef<'tcx> {
+    fn repr(&self) -> String {
         // when printing out the debug representation, we don't need
         // to enumerate the `for<...>` etc because the debruijn index
         // tells you everything you need to know.
-        let result = self.user_string(tcx);
+        let result = self.user_string();
         match self.substs.self_ty() {
             None => result,
-            Some(sty) => format!("<{} as {}>", sty.repr(tcx), result)
+            Some(sty) => format!("<{} as {}>", sty.repr(), result)
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::TraitDef<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::TraitDef<'tcx> {
+    fn repr(&self) -> String {
         format!("TraitDef(generics={}, trait_ref={})",
-                self.generics.repr(tcx),
-                self.trait_ref.repr(tcx))
+                self.generics.repr(),
+                self.trait_ref.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::TraitItem {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::TraitItem {
+    fn repr(&self) -> String {
         let kind = match self.node {
             ast::ConstTraitItem(..) => "ConstTraitItem",
             ast::MethodTraitItem(..) => "MethodTraitItem",
@@ -440,62 +486,62 @@ fn repr(&self, _tcx: &ctxt) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Expr {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::Expr {
+    fn repr(&self) -> String {
         format!("expr({}: {})", self.id, pprust::expr_to_string(self))
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Path {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::Path {
+    fn repr(&self) -> String {
         format!("path({})", pprust::path_to_string(self))
     }
 }
 
-impl<'tcx> UserString<'tcx> for ast::Path {
-    fn user_string(&self, _tcx: &ctxt) -> String {
+impl UserString for ast::Path {
+    fn user_string(&self) -> String {
         pprust::path_to_string(self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Ty {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::Ty {
+    fn repr(&self) -> String {
         format!("type({})", pprust::ty_to_string(self))
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Item {
-    fn repr(&self, tcx: &ctxt) -> String {
-        format!("item({})", tcx.map.node_to_string(self.id))
+impl Repr for ast::Item {
+    fn repr(&self) -> String {
+        format!("item({})", ty::tls::with(|tcx| tcx.map.node_to_string(self.id)))
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Lifetime {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::Lifetime {
+    fn repr(&self) -> String {
         format!("lifetime({}: {})", self.id, pprust::lifetime_to_string(self))
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Stmt {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::Stmt {
+    fn repr(&self) -> String {
         format!("stmt({}: {})",
                 ast_util::stmt_id(self),
                 pprust::stmt_to_string(self))
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Pat {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::Pat {
+    fn repr(&self) -> String {
         format!("pat({}: {})", self.id, pprust::pat_to_string(self))
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::BoundRegion {
-    fn repr(&self, tcx: &ctxt) -> String {
+impl Repr for ty::BoundRegion {
+    fn repr(&self) -> String {
         match *self {
             ty::BrAnon(id) => format!("BrAnon({})", id),
             ty::BrNamed(id, name) => {
-                format!("BrNamed({}, {})", id.repr(tcx), token::get_name(name))
+                format!("BrNamed({}, {})", id.repr(), token::get_name(name))
             }
             ty::BrFresh(id) => format!("BrFresh({})", id),
             ty::BrEnv => "BrEnv".to_string()
@@ -503,10 +549,10 @@ fn repr(&self, tcx: &ctxt) -> String {
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::BoundRegion {
-    fn user_string(&self, tcx: &ctxt) -> String {
-        if tcx.sess.verbose() {
-            return self.repr(tcx);
+impl UserString for ty::BoundRegion {
+    fn user_string(&self) -> String {
+        if verbose() {
+            return self.repr();
         }
 
         match *self {
@@ -516,8 +562,8 @@ fn user_string(&self, tcx: &ctxt) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::Region {
-    fn repr(&self, tcx: &ctxt) -> String {
+impl Repr for ty::Region {
+    fn repr(&self) -> String {
         match *self {
             ty::ReEarlyBound(ref data) => {
                 format!("ReEarlyBound({}, {:?}, {}, {})",
@@ -530,10 +576,10 @@ fn repr(&self, tcx: &ctxt) -> String {
             ty::ReLateBound(binder_id, ref bound_region) => {
                 format!("ReLateBound({:?}, {})",
                         binder_id,
-                        bound_region.repr(tcx))
+                        bound_region.repr())
             }
 
-            ty::ReFree(ref fr) => fr.repr(tcx),
+            ty::ReFree(ref fr) => fr.repr(),
 
             ty::ReScope(id) => {
                 format!("ReScope({:?})", id)
@@ -548,7 +594,7 @@ fn repr(&self, tcx: &ctxt) -> String {
             }
 
             ty::ReInfer(ReSkolemized(id, ref bound_region)) => {
-                format!("re_skolemized({}, {})", id, bound_region.repr(tcx))
+                format!("re_skolemized({}, {})", id, bound_region.repr())
             }
 
             ty::ReEmpty => {
@@ -558,10 +604,10 @@ fn repr(&self, tcx: &ctxt) -> String {
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::Region {
-    fn user_string(&self, tcx: &ctxt) -> String {
-        if tcx.sess.verbose() {
-            return self.repr(tcx);
+impl UserString for ty::Region {
+    fn user_string(&self) -> String {
+        if verbose() {
+            return self.repr();
         }
 
         // These printouts are concise.  They do not contain all the information
@@ -575,7 +621,7 @@ fn user_string(&self, tcx: &ctxt) -> String {
             ty::ReLateBound(_, br) |
             ty::ReFree(ty::FreeRegion { bound_region: br, .. }) |
             ty::ReInfer(ReSkolemized(_, br)) => {
-                br.user_string(tcx)
+                br.user_string()
             }
             ty::ReScope(_) |
             ty::ReInfer(ReVar(_)) => String::new(),
@@ -585,16 +631,16 @@ fn user_string(&self, tcx: &ctxt) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::FreeRegion {
-    fn repr(&self, tcx: &ctxt) -> String {
+impl Repr for ty::FreeRegion {
+    fn repr(&self) -> String {
         format!("ReFree({}, {})",
-                self.scope.repr(tcx),
-                self.bound_region.repr(tcx))
+                self.scope.repr(),
+                self.bound_region.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for region::CodeExtent {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for region::CodeExtent {
+    fn repr(&self) -> String {
         match *self {
             region::CodeExtent::ParameterScope { fn_id, body_id } =>
                 format!("ParameterScope({}, {})", fn_id, body_id),
@@ -608,8 +654,8 @@ fn repr(&self, _tcx: &ctxt) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for region::DestructionScopeData {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for region::DestructionScopeData {
+    fn repr(&self) -> String {
         match *self {
             region::DestructionScopeData{ node_id } =>
                 format!("DestructionScopeData {{ node_id: {} }}", node_id),
@@ -617,72 +663,73 @@ fn repr(&self, _tcx: &ctxt) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::DefId {
-    fn repr(&self, tcx: &ctxt) -> String {
+impl Repr for ast::DefId {
+    fn repr(&self) -> String {
         // Unfortunately, there seems to be no way to attempt to print
         // a path for a def-id, so I'll just make a best effort for now
         // and otherwise fallback to just printing the crate/node pair
-        if self.krate == ast::LOCAL_CRATE {
-            match tcx.map.find(self.node) {
-                Some(ast_map::NodeItem(..)) |
-                Some(ast_map::NodeForeignItem(..)) |
-                Some(ast_map::NodeImplItem(..)) |
-                Some(ast_map::NodeTraitItem(..)) |
-                Some(ast_map::NodeVariant(..)) |
-                Some(ast_map::NodeStructCtor(..)) => {
-                    return format!(
-                                "{:?}:{}",
-                                *self,
-                                ty::item_path_str(tcx, *self))
+        ty::tls::with(|tcx| {
+            if self.krate == ast::LOCAL_CRATE {
+                match tcx.map.find(self.node) {
+                    Some(ast_map::NodeItem(..)) |
+                    Some(ast_map::NodeForeignItem(..)) |
+                    Some(ast_map::NodeImplItem(..)) |
+                    Some(ast_map::NodeTraitItem(..)) |
+                    Some(ast_map::NodeVariant(..)) |
+                    Some(ast_map::NodeStructCtor(..)) => {
+                        return format!("{:?}:{}",
+                                       *self,
+                                       ty::item_path_str(tcx, *self));
+                    }
+                    _ => {}
                 }
-                _ => {}
             }
-        }
-        return format!("{:?}", *self)
+            format!("{:?}", *self)
+        })
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::TypeScheme<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::TypeScheme<'tcx> {
+    fn repr(&self) -> String {
         format!("TypeScheme {{generics: {}, ty: {}}}",
-                self.generics.repr(tcx),
-                self.ty.repr(tcx))
+                self.generics.repr(),
+                self.ty.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::Generics<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::Generics<'tcx> {
+    fn repr(&self) -> String {
         format!("Generics(types: {}, regions: {})",
-                self.types.repr(tcx),
-                self.regions.repr(tcx))
+                self.types.repr(),
+                self.regions.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::GenericPredicates<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::GenericPredicates<'tcx> {
+    fn repr(&self) -> String {
         format!("GenericPredicates(predicates: {})",
-                self.predicates.repr(tcx))
+                self.predicates.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::InstantiatedPredicates<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::InstantiatedPredicates<'tcx> {
+    fn repr(&self) -> String {
         format!("InstantiatedPredicates({})",
-                self.predicates.repr(tcx))
+                self.predicates.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::ItemVariances {
-    fn repr(&self, tcx: &ctxt) -> String {
+impl Repr for ty::ItemVariances {
+    fn repr(&self) -> String {
         format!("ItemVariances(types={}, \
                 regions={})",
-                self.types.repr(tcx),
-                self.regions.repr(tcx))
+                self.types.repr(),
+                self.regions.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::Variance {
-    fn repr(&self, _: &ctxt) -> String {
+impl Repr for ty::Variance {
+    fn repr(&self) -> String {
         // The first `.to_string()` returns a &'static str (it is not an implementation
         // of the ToString trait). Because of that, we need to call `.to_string()` again
         // if we want to have a `String`.
@@ -691,160 +738,160 @@ fn repr(&self, _: &ctxt) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::ImplOrTraitItem<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::ImplOrTraitItem<'tcx> {
+    fn repr(&self) -> String {
         format!("ImplOrTraitItem({})",
                 match *self {
-                    ty::ImplOrTraitItem::MethodTraitItem(ref i) => i.repr(tcx),
-                    ty::ImplOrTraitItem::ConstTraitItem(ref i) => i.repr(tcx),
-                    ty::ImplOrTraitItem::TypeTraitItem(ref i) => i.repr(tcx),
+                    ty::ImplOrTraitItem::MethodTraitItem(ref i) => i.repr(),
+                    ty::ImplOrTraitItem::ConstTraitItem(ref i) => i.repr(),
+                    ty::ImplOrTraitItem::TypeTraitItem(ref i) => i.repr(),
                 })
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::AssociatedConst<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::AssociatedConst<'tcx> {
+    fn repr(&self) -> String {
         format!("AssociatedConst(name: {}, ty: {}, vis: {}, def_id: {})",
-                self.name.repr(tcx),
-                self.ty.repr(tcx),
-                self.vis.repr(tcx),
-                self.def_id.repr(tcx))
+                self.name.repr(),
+                self.ty.repr(),
+                self.vis.repr(),
+                self.def_id.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::AssociatedType<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::AssociatedType<'tcx> {
+    fn repr(&self) -> String {
         format!("AssociatedType(name: {}, vis: {}, def_id: {})",
-                self.name.repr(tcx),
-                self.vis.repr(tcx),
-                self.def_id.repr(tcx))
+                self.name.repr(),
+                self.vis.repr(),
+                self.def_id.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::Method<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::Method<'tcx> {
+    fn repr(&self) -> String {
         format!("Method(name: {}, generics: {}, predicates: {}, fty: {}, \
                  explicit_self: {}, vis: {}, def_id: {})",
-                self.name.repr(tcx),
-                self.generics.repr(tcx),
-                self.predicates.repr(tcx),
-                self.fty.repr(tcx),
-                self.explicit_self.repr(tcx),
-                self.vis.repr(tcx),
-                self.def_id.repr(tcx))
+                self.name.repr(),
+                self.generics.repr(),
+                self.predicates.repr(),
+                self.fty.repr(),
+                self.explicit_self.repr(),
+                self.vis.repr(),
+                self.def_id.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Name {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::Name {
+    fn repr(&self) -> String {
         token::get_name(*self).to_string()
     }
 }
 
-impl<'tcx> UserString<'tcx> for ast::Name {
-    fn user_string(&self, _tcx: &ctxt) -> String {
+impl UserString for ast::Name {
+    fn user_string(&self) -> String {
         token::get_name(*self).to_string()
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Ident {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::Ident {
+    fn repr(&self) -> String {
         token::get_ident(*self).to_string()
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::ExplicitSelf_ {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::ExplicitSelf_ {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Visibility {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::Visibility {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::BareFnTy<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::BareFnTy<'tcx> {
+    fn repr(&self) -> String {
         format!("BareFnTy {{unsafety: {}, abi: {}, sig: {}}}",
                 self.unsafety,
                 self.abi.to_string(),
-                self.sig.repr(tcx))
+                self.sig.repr())
     }
 }
 
 
-impl<'tcx> Repr<'tcx> for ty::FnSig<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        format!("fn{} -> {}", self.inputs.repr(tcx), self.output.repr(tcx))
+impl<'tcx> Repr for ty::FnSig<'tcx> {
+    fn repr(&self) -> String {
+        format!("fn{} -> {}", self.inputs.repr(), self.output.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::FnOutput<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::FnOutput<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             ty::FnConverging(ty) =>
-                format!("FnConverging({0})", ty.repr(tcx)),
+                format!("FnConverging({0})", ty.repr()),
             ty::FnDiverging =>
                 "FnDiverging".to_string()
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::MethodCallee<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::MethodCallee<'tcx> {
+    fn repr(&self) -> String {
         format!("MethodCallee {{origin: {}, ty: {}, {}}}",
-                self.origin.repr(tcx),
-                self.ty.repr(tcx),
-                self.substs.repr(tcx))
+                self.origin.repr(),
+                self.ty.repr(),
+                self.substs.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::MethodOrigin<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::MethodOrigin<'tcx> {
+    fn repr(&self) -> String {
         match self {
             &ty::MethodStatic(def_id) => {
-                format!("MethodStatic({})", def_id.repr(tcx))
+                format!("MethodStatic({})", def_id.repr())
             }
             &ty::MethodStaticClosure(def_id) => {
-                format!("MethodStaticClosure({})", def_id.repr(tcx))
+                format!("MethodStaticClosure({})", def_id.repr())
             }
             &ty::MethodTypeParam(ref p) => {
-                p.repr(tcx)
+                p.repr()
             }
             &ty::MethodTraitObject(ref p) => {
-                p.repr(tcx)
+                p.repr()
             }
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::MethodParam<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::MethodParam<'tcx> {
+    fn repr(&self) -> String {
         format!("MethodParam({},{})",
-                self.trait_ref.repr(tcx),
+                self.trait_ref.repr(),
                 self.method_num)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::MethodObject<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::MethodObject<'tcx> {
+    fn repr(&self) -> String {
         format!("MethodObject({},{},{})",
-                self.trait_ref.repr(tcx),
+                self.trait_ref.repr(),
                 self.method_num,
                 self.vtable_index)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::BuiltinBound {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ty::BuiltinBound {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::BuiltinBound {
-    fn user_string(&self, _tcx: &ctxt) -> String {
+impl UserString for ty::BuiltinBound {
+    fn user_string(&self) -> String {
         match *self {
             ty::BoundSend => "Send".to_string(),
             ty::BoundSized => "Sized".to_string(),
@@ -854,116 +901,132 @@ fn user_string(&self, _tcx: &ctxt) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for Span {
-    fn repr(&self, tcx: &ctxt) -> String {
-        tcx.sess.codemap().span_to_string(*self).to_string()
+impl Repr for Span {
+    fn repr(&self) -> String {
+        ty::tls::with(|tcx| tcx.sess.codemap().span_to_string(*self).to_string())
     }
 }
 
-impl<'tcx, A:UserString<'tcx>> UserString<'tcx> for Rc<A> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+impl<A:UserString> UserString for Rc<A> {
+    fn user_string(&self) -> String {
         let this: &A = &**self;
-        this.user_string(tcx)
+        this.user_string()
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::ParamBounds<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> UserString for ty::ParamBounds<'tcx> {
+    fn user_string(&self) -> String {
         let mut result = Vec::new();
-        let s = self.builtin_bounds.user_string(tcx);
+        let s = self.builtin_bounds.user_string();
         if !s.is_empty() {
             result.push(s);
         }
         for n in &self.trait_bounds {
-            result.push(n.user_string(tcx));
+            result.push(n.user_string());
         }
         result.connect(" + ")
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::ExistentialBounds<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::ExistentialBounds<'tcx> {
+    fn repr(&self) -> String {
         let mut res = Vec::new();
 
-        let region_str = self.region_bound.repr(tcx);
+        let region_str = self.region_bound.repr();
         if !region_str.is_empty() {
             res.push(region_str);
         }
 
         for bound in &self.builtin_bounds {
-            res.push(bound.repr(tcx));
+            res.push(bound.repr());
         }
 
         for projection_bound in &self.projection_bounds {
-            res.push(projection_bound.repr(tcx));
+            res.push(projection_bound.repr());
         }
 
         res.connect("+")
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::BuiltinBounds {
-    fn user_string(&self, tcx: &ctxt) -> String {
+impl UserString for ty::BuiltinBounds {
+    fn user_string(&self) -> String {
         self.iter()
-            .map(|bb| bb.user_string(tcx))
+            .map(|bb| bb.user_string())
             .collect::<Vec<String>>()
             .connect("+")
             .to_string()
     }
 }
 
-impl<'tcx, T> UserString<'tcx> for ty::Binder<T>
-    where T : UserString<'tcx> + TypeFoldable<'tcx>
+// The generic impl doesn't work yet because projections are not
+// normalized under HRTB.
+/*impl<T> UserString for ty::Binder<T>
+    where T: UserString + for<'a> ty::Lift<'a>,
+          for<'a> <T as ty::Lift<'a>>::Lifted: UserString + TypeFoldable<'a>
 {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
-        // Replace any anonymous late-bound regions with named
-        // variants, using gensym'd identifiers, so that we can
-        // clearly differentiate between named and unnamed regions in
-        // the output. We'll probably want to tweak this over time to
-        // decide just how much information to give.
-        let mut names = Vec::new();
-        let (unbound_value, _) = ty_fold::replace_late_bound_regions(tcx, self, |br| {
-            ty::ReLateBound(ty::DebruijnIndex::new(1), match br {
-                ty::BrNamed(_, name) => {
-                    names.push(token::get_name(name));
-                    br
-                }
-                ty::BrAnon(_) |
-                ty::BrFresh(_) |
-                ty::BrEnv => {
-                    let name = token::gensym("'r");
-                    names.push(token::get_name(name));
-                    ty::BrNamed(ast_util::local_def(ast::DUMMY_NODE_ID), name)
-                }
-            })
-        });
-        let names: Vec<_> = names.iter().map(|s| &s[..]).collect();
+    fn user_string(&self) -> String {
+        ty::tls::with(|tcx| in_binder(tcx, self, tcx.lift(self)))
+    }
+}*/
 
-        let value_str = unbound_value.user_string(tcx);
-        if names.is_empty() {
-            value_str
-        } else {
-            format!("for<{}> {}", names.connect(","), value_str)
-        }
+impl<'tcx> UserString for ty::Binder<ty::TraitRef<'tcx>> {
+    fn user_string(&self) -> String {
+        ty::tls::with(|tcx| in_binder(tcx, self, tcx.lift(self)))
+    }
+}
+
+impl<'tcx> UserString for ty::Binder<ty::TraitPredicate<'tcx>> {
+    fn user_string(&self) -> String {
+        ty::tls::with(|tcx| in_binder(tcx, self, tcx.lift(self)))
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::TraitRef<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
-        parameterized(tcx, self.substs, self.def_id, &[],
-                      || ty::lookup_trait_def(tcx, self.def_id).generics.clone())
+impl<'tcx> UserString for ty::Binder<ty::EquatePredicate<'tcx>> {
+    fn user_string(&self) -> String {
+        ty::tls::with(|tcx| in_binder(tcx, self, tcx.lift(self)))
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::TyS<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
-        fn bare_fn_to_string<'tcx>(cx: &ctxt<'tcx>,
-                                   opt_def_id: Option<ast::DefId>,
-                                   unsafety: ast::Unsafety,
-                                   abi: abi::Abi,
-                                   ident: Option<ast::Ident>,
-                                   sig: &ty::PolyFnSig<'tcx>)
-                                   -> String {
+impl<'tcx> UserString for ty::Binder<ty::ProjectionPredicate<'tcx>> {
+    fn user_string(&self) -> String {
+        ty::tls::with(|tcx| in_binder(tcx, self, tcx.lift(self)))
+    }
+}
+
+impl<'tcx> UserString for ty::Binder<TraitAndProjections<'tcx>> {
+    fn user_string(&self) -> String {
+        ty::tls::with(|tcx| in_binder(tcx, self, tcx.lift(self)))
+    }
+}
+
+impl<'tcx> UserString for ty::Binder<ty::OutlivesPredicate<Ty<'tcx>, ty::Region>> {
+    fn user_string(&self) -> String {
+        ty::tls::with(|tcx| in_binder(tcx, self, tcx.lift(self)))
+    }
+}
+
+impl UserString for ty::Binder<ty::OutlivesPredicate<ty::Region, ty::Region>> {
+    fn user_string(&self) -> String {
+        ty::tls::with(|tcx| in_binder(tcx, self, tcx.lift(self)))
+    }
+}
+
+impl<'tcx> UserString for ty::TraitRef<'tcx> {
+    fn user_string(&self) -> String {
+        parameterized(self.substs, self.def_id, &[],
+                      |tcx| ty::lookup_trait_def(tcx, self.def_id).generics.clone())
+    }
+}
+
+impl<'tcx> UserString for ty::TyS<'tcx> {
+    fn user_string(&self) -> String {
+        fn bare_fn_to_string(opt_def_id: Option<ast::DefId>,
+                             unsafety: ast::Unsafety,
+                             abi: abi::Abi,
+                             ident: Option<ast::Ident>,
+                             sig: &ty::PolyFnSig)
+                             -> String {
             let mut s = String::new();
 
             match unsafety {
@@ -988,12 +1051,12 @@ fn bare_fn_to_string<'tcx>(cx: &ctxt<'tcx>,
                 _ => { }
             }
 
-            push_sig_to_string(cx, &mut s, '(', ')', sig);
+            push_sig_to_string(&mut s, '(', ')', sig);
 
             match opt_def_id {
                 Some(def_id) => {
                     s.push_str(" {");
-                    let path_str = ty::item_path_str(cx, def_id);
+                    let path_str = ty::tls::with(|tcx| ty::item_path_str(tcx, def_id));
                     s.push_str(&path_str[..]);
                     s.push_str("}");
                 }
@@ -1003,30 +1066,14 @@ fn bare_fn_to_string<'tcx>(cx: &ctxt<'tcx>,
             s
         }
 
-        fn closure_to_string<'tcx>(cx: &ctxt<'tcx>,
-                                   cty: &ty::ClosureTy<'tcx>,
-                                   did: &ast::DefId)
-                                   -> String {
-            let mut s = String::new();
-            s.push_str("[closure");
-            push_sig_to_string(cx, &mut s, '(', ')', &cty.sig);
-            if cx.sess.verbose() {
-                s.push_str(&format!(" id={:?}]", did));
-            } else {
-                s.push(']');
-            }
-            s
-        }
-
-        fn push_sig_to_string<'tcx>(cx: &ctxt<'tcx>,
-                                    s: &mut String,
-                                    bra: char,
-                                    ket: char,
-                                    sig: &ty::PolyFnSig<'tcx>) {
+        fn push_sig_to_string(s: &mut String,
+                              bra: char,
+                              ket: char,
+                              sig: &ty::PolyFnSig) {
             s.push(bra);
             let strs = sig.0.inputs
                 .iter()
-                .map(|a| a.user_string(cx))
+                .map(|a| a.user_string())
                 .collect::<Vec<_>>();
             s.push_str(&strs.connect(", "));
             if sig.0.variadic {
@@ -1038,7 +1085,7 @@ fn push_sig_to_string<'tcx>(cx: &ctxt<'tcx>,
                 ty::FnConverging(t) => {
                     if !ty::type_is_nil(t) {
                         s.push_str(" -> ");
-                        s.push_str(& t.user_string(cx));
+                        s.push_str(&t.user_string());
                     }
                 }
                 ty::FnDiverging => {
@@ -1047,19 +1094,6 @@ fn push_sig_to_string<'tcx>(cx: &ctxt<'tcx>,
             }
         }
 
-        fn infer_ty_to_string(cx: &ctxt, ty: ty::InferTy) -> String {
-            let print_var_ids = cx.sess.verbose();
-            match ty {
-                ty::TyVar(ref vid) if print_var_ids => vid.repr(cx),
-                ty::IntVar(ref vid) if print_var_ids => vid.repr(cx),
-                ty::FloatVar(ref vid) if print_var_ids => vid.repr(cx),
-                ty::TyVar(_) | ty::IntVar(_) | ty::FloatVar(_) => format!("_"),
-                ty::FreshTy(v) => format!("FreshTy({})", v),
-                ty::FreshIntTy(v) => format!("FreshIntTy({})", v),
-                ty::FreshFloatTy(v) => format!("FreshFloatTy({})", v)
-            }
-        }
-
         // pretty print the structural type representation:
         match self.sty {
             TyBool => "bool".to_string(),
@@ -1067,26 +1101,26 @@ fn infer_ty_to_string(cx: &ctxt, ty: ty::InferTy) -> String {
             TyInt(t) => ast_util::int_ty_to_string(t, None).to_string(),
             TyUint(t) => ast_util::uint_ty_to_string(t, None).to_string(),
             TyFloat(t) => ast_util::float_ty_to_string(t).to_string(),
-            TyBox(typ) => format!("Box<{}>",  typ.user_string(tcx)),
+            TyBox(typ) => format!("Box<{}>",  typ.user_string()),
             TyRawPtr(ref tm) => {
                 format!("*{} {}", match tm.mutbl {
                     ast::MutMutable => "mut",
                     ast::MutImmutable => "const",
-                },  tm.ty.user_string(tcx))
+                },  tm.ty.user_string())
             }
             TyRef(r, ref tm) => {
                 let mut buf = "&".to_owned();
-                buf.push_str(&r.user_string(tcx));
-                if !buf.is_empty() {
+                buf.push_str(&r.user_string());
+                if buf.len() > 1 {
                     buf.push_str(" ");
                 }
-                buf.push_str(&tm.repr(tcx));
+                buf.push_str(&tm.repr());
                 buf
             }
             TyTuple(ref elems) => {
                 let strs = elems
                     .iter()
-                    .map(|elem| elem.user_string(tcx))
+                    .map(|elem| elem.user_string())
                     .collect::<Vec<_>>();
                 match &strs[..] {
                     [ref string] => format!("({},)", string),
@@ -1094,161 +1128,185 @@ fn infer_ty_to_string(cx: &ctxt, ty: ty::InferTy) -> String {
                 }
             }
             TyBareFn(opt_def_id, ref f) => {
-                bare_fn_to_string(tcx, opt_def_id, f.unsafety, f.abi, None, &f.sig)
+                bare_fn_to_string(opt_def_id, f.unsafety, f.abi, None, &f.sig)
             }
-            TyInfer(infer_ty) => infer_ty_to_string(tcx, infer_ty),
+            TyInfer(infer_ty) => infer_ty.repr(),
             TyError => "[type error]".to_string(),
-            TyParam(ref param_ty) => param_ty.user_string(tcx),
+            TyParam(ref param_ty) => param_ty.user_string(),
             TyEnum(did, substs) | TyStruct(did, substs) => {
-                parameterized(tcx, substs, did, &[],
-                              || ty::lookup_item_type(tcx, did).generics)
+                parameterized(substs, did, &[],
+                              |tcx| ty::lookup_item_type(tcx, did).generics)
             }
             TyTrait(ref data) => {
-                data.user_string(tcx)
+                data.user_string()
             }
             ty::TyProjection(ref data) => {
                 format!("<{} as {}>::{}",
-                        data.trait_ref.self_ty().user_string(tcx),
-                        data.trait_ref.user_string(tcx),
-                        data.item_name.user_string(tcx))
+                        data.trait_ref.self_ty().user_string(),
+                        data.trait_ref.user_string(),
+                        data.item_name.user_string())
             }
             TyStr => "str".to_string(),
-            TyClosure(ref did, substs) => {
+            TyClosure(ref did, substs) => ty::tls::with(|tcx| {
                 let closure_tys = tcx.closure_tys.borrow();
-                closure_tys.get(did).map(|closure_type| {
-                    closure_to_string(tcx, &closure_type.subst(tcx, substs), did)
+                closure_tys.get(did).map(|cty| &cty.sig).and_then(|sig| {
+                    tcx.lift(&substs).map(|substs| sig.subst(tcx, substs))
+                }).map(|sig| {
+                    let mut s = String::new();
+                    s.push_str("[closure");
+                    push_sig_to_string(&mut s, '(', ')', &sig);
+                    if verbose() {
+                        s.push_str(&format!(" id={:?}]", did));
+                    } else {
+                        s.push(']');
+                    }
+                    s
                 }).unwrap_or_else(|| {
-                    let id_str = if tcx.sess.verbose() {
+                    let id_str = if verbose() {
                         format!(" id={:?}", did)
                     } else {
                         "".to_owned()
                     };
 
-
                     if did.krate == ast::LOCAL_CRATE {
-                        let span = tcx.map.span(did.node);
-                        format!("[closure {}{}]", span.repr(tcx), id_str)
+                        let span = ty::tls::with(|tcx| tcx.map.span(did.node));
+                        format!("[closure {}{}]", span.repr(), id_str)
                     } else {
                         format!("[closure{}]", id_str)
                     }
                 })
-            }
+            }),
             TyArray(t, sz) => {
-                format!("[{}; {}]",  t.user_string(tcx), sz)
+                format!("[{}; {}]",  t.user_string(), sz)
             }
             TySlice(t) => {
-                format!("[{}]",  t.user_string(tcx))
+                format!("[{}]",  t.user_string())
             }
         }
     }
 }
 
-impl<'tcx> UserString<'tcx> for ast::Ident {
-    fn user_string(&self, _tcx: &ctxt) -> String {
+impl UserString for ast::Ident {
+    fn user_string(&self) -> String {
         token::get_name(self.name).to_string()
     }
 }
 
-impl<'tcx> Repr<'tcx> for abi::Abi {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for abi::Abi {
+    fn repr(&self) -> String {
         self.to_string()
     }
 }
 
-impl<'tcx> UserString<'tcx> for abi::Abi {
-    fn user_string(&self, _tcx: &ctxt) -> String {
+impl UserString for abi::Abi {
+    fn user_string(&self) -> String {
         self.to_string()
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::UpvarId {
-    fn repr(&self, tcx: &ctxt) -> String {
+impl Repr for ty::UpvarId {
+    fn repr(&self) -> String {
         format!("UpvarId({};`{}`;{})",
                 self.var_id,
-                ty::local_var_name_str(tcx, self.var_id),
+                ty::tls::with(|tcx| ty::local_var_name_str(tcx, self.var_id)),
                 self.closure_expr_id)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Mutability {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::Mutability {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::BorrowKind {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ty::BorrowKind {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::UpvarBorrow {
-    fn repr(&self, tcx: &ctxt) -> String {
+impl Repr for ty::UpvarBorrow {
+    fn repr(&self) -> String {
         format!("UpvarBorrow({}, {})",
-                self.kind.repr(tcx),
-                self.region.repr(tcx))
+                self.kind.repr(),
+                self.region.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::UpvarCapture {
-    fn repr(&self, tcx: &ctxt) -> String {
+impl Repr for ty::UpvarCapture {
+    fn repr(&self) -> String {
         match *self {
             ty::UpvarCapture::ByValue => format!("ByValue"),
-            ty::UpvarCapture::ByRef(ref data) => format!("ByRef({})", data.repr(tcx)),
+            ty::UpvarCapture::ByRef(ref data) => format!("ByRef({})", data.repr()),
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::IntVid {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ty::IntVid {
+    fn repr(&self) -> String {
         format!("{:?}", self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::FloatVid {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ty::FloatVid {
+    fn repr(&self) -> String {
         format!("{:?}", self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::RegionVid {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ty::RegionVid {
+    fn repr(&self) -> String {
         format!("{:?}", self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::TyVid {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ty::TyVid {
+    fn repr(&self) -> String {
         format!("{:?}", self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::IntVarValue {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ty::IntVarValue {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::IntTy {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ty::InferTy {
+    fn repr(&self) -> String {
+        let print_var_ids = verbose();
+        match *self {
+            ty::TyVar(ref vid) if print_var_ids => vid.repr(),
+            ty::IntVar(ref vid) if print_var_ids => vid.repr(),
+            ty::FloatVar(ref vid) if print_var_ids => vid.repr(),
+            ty::TyVar(_) | ty::IntVar(_) | ty::FloatVar(_) => format!("_"),
+            ty::FreshTy(v) => format!("FreshTy({})", v),
+            ty::FreshIntTy(v) => format!("FreshIntTy({})", v),
+            ty::FreshFloatTy(v) => format!("FreshFloatTy({})", v)
+        }
+    }
+}
+
+impl Repr for ast::IntTy {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::UintTy {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::UintTy {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::FloatTy {
-    fn repr(&self, _tcx: &ctxt) -> String {
+impl Repr for ast::FloatTy {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::ExplicitSelfCategory {
-    fn repr(&self, _: &ctxt) -> String {
+impl Repr for ty::ExplicitSelfCategory {
+    fn repr(&self) -> String {
         match *self {
             ty::StaticExplicitSelfCategory => "static",
             ty::ByValueExplicitSelfCategory => "self",
@@ -1261,138 +1319,138 @@ fn repr(&self, _: &ctxt) -> String {
     }
 }
 
-impl<'tcx> UserString<'tcx> for ParamTy {
-    fn user_string(&self, _tcx: &ctxt) -> String {
+impl UserString for ParamTy {
+    fn user_string(&self) -> String {
         format!("{}", token::get_name(self.name))
     }
 }
 
-impl<'tcx> Repr<'tcx> for ParamTy {
-    fn repr(&self, tcx: &ctxt) -> String {
-        let ident = self.user_string(tcx);
+impl Repr for ParamTy {
+    fn repr(&self) -> String {
+        let ident = self.user_string();
         format!("{}/{:?}.{}", ident, self.space, self.idx)
     }
 }
 
-impl<'tcx, A:Repr<'tcx>, B:Repr<'tcx>> Repr<'tcx> for (A,B) {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<A:Repr, B:Repr> Repr for (A,B) {
+    fn repr(&self) -> String {
         let &(ref a, ref b) = self;
-        format!("({},{})", a.repr(tcx), b.repr(tcx))
+        format!("({},{})", a.repr(), b.repr())
     }
 }
 
-impl<'tcx, T:Repr<'tcx>> Repr<'tcx> for ty::Binder<T> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
-        format!("Binder({})", self.0.repr(tcx))
+impl<T:Repr> Repr for ty::Binder<T> {
+    fn repr(&self) -> String {
+        format!("Binder({})", self.0.repr())
     }
 }
 
-impl<'tcx, S, K, V> Repr<'tcx> for HashMap<K, V, S>
-    where K: Hash + Eq + Repr<'tcx>,
-          V: Repr<'tcx>,
+impl<S, K, V> Repr for HashMap<K, V, S>
+    where K: Hash + Eq + Repr,
+          V: Repr,
           S: HashState,
 {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+    fn repr(&self) -> String {
         format!("HashMap({})",
                 self.iter()
-                    .map(|(k,v)| format!("{} => {}", k.repr(tcx), v.repr(tcx)))
+                    .map(|(k,v)| format!("{} => {}", k.repr(), v.repr()))
                     .collect::<Vec<String>>()
                     .connect(", "))
     }
 }
 
-impl<'tcx, T, U> Repr<'tcx> for ty::OutlivesPredicate<T,U>
-    where T : Repr<'tcx> + TypeFoldable<'tcx>,
-          U : Repr<'tcx> + TypeFoldable<'tcx>,
+impl<'tcx, T, U> Repr for ty::OutlivesPredicate<T,U>
+    where T : Repr + TypeFoldable<'tcx>,
+          U : Repr + TypeFoldable<'tcx>,
 {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+    fn repr(&self) -> String {
         format!("OutlivesPredicate({}, {})",
-                self.0.repr(tcx),
-                self.1.repr(tcx))
+                self.0.repr(),
+                self.1.repr())
     }
 }
 
-impl<'tcx, T, U> UserString<'tcx> for ty::OutlivesPredicate<T,U>
-    where T : UserString<'tcx> + TypeFoldable<'tcx>,
-          U : UserString<'tcx> + TypeFoldable<'tcx>,
+impl<'tcx, T, U> UserString for ty::OutlivesPredicate<T,U>
+    where T : UserString + TypeFoldable<'tcx>,
+          U : UserString + TypeFoldable<'tcx>,
 {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+    fn user_string(&self) -> String {
         format!("{} : {}",
-                self.0.user_string(tcx),
-                self.1.user_string(tcx))
+                self.0.user_string(),
+                self.1.user_string())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::EquatePredicate<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::EquatePredicate<'tcx> {
+    fn repr(&self) -> String {
         format!("EquatePredicate({}, {})",
-                self.0.repr(tcx),
-                self.1.repr(tcx))
+                self.0.repr(),
+                self.1.repr())
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::EquatePredicate<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> UserString for ty::EquatePredicate<'tcx> {
+    fn user_string(&self) -> String {
         format!("{} == {}",
-                self.0.user_string(tcx),
-                self.1.user_string(tcx))
+                self.0.user_string(),
+                self.1.user_string())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::TraitPredicate<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::TraitPredicate<'tcx> {
+    fn repr(&self) -> String {
         format!("TraitPredicate({})",
-                self.trait_ref.repr(tcx))
+                self.trait_ref.repr())
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::TraitPredicate<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> UserString for ty::TraitPredicate<'tcx> {
+    fn user_string(&self) -> String {
         format!("{} : {}",
-                self.trait_ref.self_ty().user_string(tcx),
-                self.trait_ref.user_string(tcx))
+                self.trait_ref.self_ty().user_string(),
+                self.trait_ref.user_string())
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::ProjectionPredicate<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> UserString for ty::ProjectionPredicate<'tcx> {
+    fn user_string(&self) -> String {
         format!("{} == {}",
-                self.projection_ty.user_string(tcx),
-                self.ty.user_string(tcx))
+                self.projection_ty.user_string(),
+                self.ty.user_string())
     }
 }
 
-impl<'tcx> Repr<'tcx> for ty::ProjectionTy<'tcx> {
-    fn repr(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> Repr for ty::ProjectionTy<'tcx> {
+    fn repr(&self) -> String {
         format!("{}::{}",
-                self.trait_ref.repr(tcx),
-                self.item_name.repr(tcx))
+                self.trait_ref.repr(),
+                self.item_name.repr())
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::ProjectionTy<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> UserString for ty::ProjectionTy<'tcx> {
+    fn user_string(&self) -> String {
         format!("<{} as {}>::{}",
-                self.trait_ref.self_ty().user_string(tcx),
-                self.trait_ref.user_string(tcx),
-                self.item_name.user_string(tcx))
+                self.trait_ref.self_ty().user_string(),
+                self.trait_ref.user_string(),
+                self.item_name.user_string())
     }
 }
 
-impl<'tcx> UserString<'tcx> for ty::Predicate<'tcx> {
-    fn user_string(&self, tcx: &ctxt<'tcx>) -> String {
+impl<'tcx> UserString for ty::Predicate<'tcx> {
+    fn user_string(&self) -> String {
         match *self {
-            ty::Predicate::Trait(ref data) => data.user_string(tcx),
-            ty::Predicate::Equate(ref predicate) => predicate.user_string(tcx),
-            ty::Predicate::RegionOutlives(ref predicate) => predicate.user_string(tcx),
-            ty::Predicate::TypeOutlives(ref predicate) => predicate.user_string(tcx),
-            ty::Predicate::Projection(ref predicate) => predicate.user_string(tcx),
+            ty::Predicate::Trait(ref data) => data.user_string(),
+            ty::Predicate::Equate(ref predicate) => predicate.user_string(),
+            ty::Predicate::RegionOutlives(ref predicate) => predicate.user_string(),
+            ty::Predicate::TypeOutlives(ref predicate) => predicate.user_string(),
+            ty::Predicate::Projection(ref predicate) => predicate.user_string(),
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for ast::Unsafety {
-    fn repr(&self, _: &ctxt<'tcx>) -> String {
+impl Repr for ast::Unsafety {
+    fn repr(&self) -> String {
         format!("{:?}", *self)
     }
 }
index 90bc918c4b197704b4b12e14b47ec1d866695c4f..b15586cc2b455f5f196b1b4c6230f7fca68ed2b9 100644 (file)
@@ -98,7 +98,7 @@ fn consume(&mut self,
                cmt: mc::cmt<'tcx>,
                mode: euv::ConsumeMode) {
         debug!("consume(consume_id={}, cmt={}, mode={:?})",
-               consume_id, cmt.repr(self.tcx()), mode);
+               consume_id, cmt.repr(), mode);
 
         self.consume_common(consume_id, consume_span, cmt, mode);
     }
@@ -113,8 +113,8 @@ fn consume_pat(&mut self,
                    cmt: mc::cmt<'tcx>,
                    mode: euv::ConsumeMode) {
         debug!("consume_pat(consume_pat={}, cmt={}, mode={:?})",
-               consume_pat.repr(self.tcx()),
-               cmt.repr(self.tcx()),
+               consume_pat.repr(),
+               cmt.repr(),
                mode);
 
         self.consume_common(consume_pat.id, consume_pat.span, cmt, mode);
@@ -130,7 +130,7 @@ fn borrow(&mut self,
     {
         debug!("borrow(borrow_id={}, cmt={}, loan_region={:?}, \
                bk={:?}, loan_cause={:?})",
-               borrow_id, cmt.repr(self.tcx()), loan_region,
+               borrow_id, cmt.repr(), loan_region,
                bk, loan_cause);
 
         match opt_loan_path(&cmt) {
@@ -154,7 +154,7 @@ fn mutate(&mut self,
               mode: euv::MutateMode)
     {
         debug!("mutate(assignment_id={}, assignee_cmt={})",
-               assignment_id, assignee_cmt.repr(self.tcx()));
+               assignment_id, assignee_cmt.repr());
 
         match opt_loan_path(&assignee_cmt) {
             Some(lp) => {
@@ -385,8 +385,8 @@ pub fn report_error_if_loans_conflict(&self,
         //! simultaneously.
 
         debug!("report_error_if_loans_conflict(old_loan={}, new_loan={})",
-               old_loan.repr(self.tcx()),
-               new_loan.repr(self.tcx()));
+               old_loan.repr(),
+               new_loan.repr());
 
         // Should only be called for loans that are in scope at the same time.
         assert!(self.tcx().region_maps.scopes_intersect(old_loan.kill_scope,
@@ -409,8 +409,8 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
 
         debug!("report_error_if_loan_conflicts_with_restriction(\
                 loan1={}, loan2={})",
-               loan1.repr(self.tcx()),
-               loan2.repr(self.tcx()));
+               loan1.repr(),
+               loan2.repr());
 
         if compatible_borrow_kinds(loan1.kind, loan2.kind) {
             return true;
@@ -674,7 +674,7 @@ pub fn analyze_restrictions_on_use(&self,
                                        -> UseError<'tcx> {
         debug!("analyze_restrictions_on_use(expr_id={}, use_path={})",
                self.tcx().map.node_to_string(expr_id),
-               use_path.repr(self.tcx()));
+               use_path.repr());
 
         let mut ret = UseOk;
 
@@ -699,7 +699,7 @@ fn check_if_path_is_moved(&self,
                               use_kind: MovedValueUseKind,
                               lp: &Rc<LoanPath<'tcx>>) {
         debug!("check_if_path_is_moved(id={}, use_kind={:?}, lp={})",
-               id, use_kind, lp.repr(self.bccx.tcx));
+               id, use_kind, lp.repr());
 
         // FIXME (22079): if you find yourself tempted to cut and paste
         // the body below and then specializing the error reporting,
@@ -792,7 +792,7 @@ fn check_assignment(&self,
                         assignment_span: Span,
                         assignee_cmt: mc::cmt<'tcx>,
                         mode: euv::MutateMode) {
-        debug!("check_assignment(assignee_cmt={})", assignee_cmt.repr(self.tcx()));
+        debug!("check_assignment(assignee_cmt={})", assignee_cmt.repr());
 
         // Mutable values can be assigned, as long as they obey loans
         // and aliasing restrictions:
@@ -884,7 +884,7 @@ fn mark_variable_as_used_mut<'a, 'tcx>(this: &CheckLoanCtxt<'a, 'tcx>,
             //! `used_mut_nodes` table here.
 
             loop {
-                debug!("mark_variable_as_used_mut(cmt={})", cmt.repr(this.tcx()));
+                debug!("mark_variable_as_used_mut(cmt={})", cmt.repr());
                 match cmt.cat.clone() {
                     mc::cat_upvar(mc::Upvar { id: ty::UpvarId { var_id: id, .. }, .. }) |
                     mc::cat_local(id) => {
@@ -930,7 +930,7 @@ fn check_for_aliasable_mutable_writes<'a, 'tcx>(this: &CheckLoanCtxt<'a, 'tcx>,
 
             let guarantor = cmt.guarantor();
             debug!("check_for_aliasable_mutable_writes(cmt={}, guarantor={})",
-                   cmt.repr(this.tcx()), guarantor.repr(this.tcx()));
+                   cmt.repr(), guarantor.repr());
             if let mc::cat_deref(ref b, _, mc::BorrowedPtr(ty::MutBorrow, _)) = guarantor.cat {
                 // Statically prohibit writes to `&mut` when aliasable
                 check_for_aliasability_violation(this, span, b.clone());
index a70b1dfe187e41e7aced65c34d449f501f6cd8dc..75e9c09fb3da4394f40344fc9c0c7e36a7420eca 100644 (file)
@@ -43,7 +43,7 @@ enum Fragment {
 
 impl Fragment {
     fn loan_path_repr<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String {
-        let repr = |mpi| move_data.path_loan_path(mpi).repr(tcx);
+        let repr = |mpi| move_data.path_loan_path(mpi).repr();
         match *self {
             Just(mpi) => repr(mpi),
             AllButOneFrom(mpi) => format!("$(allbutone {})", repr(mpi)),
@@ -53,7 +53,7 @@ fn loan_path_repr<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>)
     fn loan_path_user_string<'tcx>(&self,
                                    move_data: &MoveData<'tcx>,
                                    tcx: &ty::ctxt<'tcx>) -> String {
-        let user_string = |mpi| move_data.path_loan_path(mpi).user_string(tcx);
+        let user_string = |mpi| move_data.path_loan_path(mpi).user_string();
         match *self {
             Just(mpi) => user_string(mpi),
             AllButOneFrom(mpi) => format!("$(allbutone {})", user_string(mpi)),
@@ -126,7 +126,7 @@ pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>,
 
     let instrument_all_paths = |kind, vec_rc: &Vec<MovePathIndex>| {
         for (i, mpi) in vec_rc.iter().enumerate() {
-            let render = || this.path_loan_path(*mpi).user_string(tcx);
+            let render = || this.path_loan_path(*mpi).user_string();
             if span_err {
                 tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render()));
             }
@@ -172,7 +172,7 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
     let mut assigned = mem::replace(&mut fragments.assigned_leaf_paths, vec![]);
 
     let path_lps = |mpis: &[MovePathIndex]| -> Vec<String> {
-        mpis.iter().map(|mpi| this.path_loan_path(*mpi).repr(tcx)).collect()
+        mpis.iter().map(|mpi| this.path_loan_path(*mpi).repr()).collect()
     };
 
     let frag_lps = |fs: &[Fragment]| -> Vec<String> {
@@ -344,7 +344,7 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>,
                 mc::PositionalField(tuple_idx) => tuple_idx,
                 mc::NamedField(_) =>
                     panic!("tuple type {} should not have named fields.",
-                           parent_ty.repr(tcx)),
+                           parent_ty.repr()),
             };
             let tuple_len = v.len();
             for i in 0..tuple_len {
@@ -419,7 +419,7 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>,
 
         ref sty_and_variant_info => {
             let msg = format!("type {} ({:?}) is not fragmentable",
-                              parent_ty.repr(tcx), sty_and_variant_info);
+                              parent_ty.repr(), sty_and_variant_info);
             let opt_span = origin_id.and_then(|id|tcx.map.opt_span(id));
             tcx.sess.opt_span_bug(opt_span, &msg[..])
         }
@@ -451,7 +451,7 @@ fn add_fragment_sibling_core<'tcx>(this: &MoveData<'tcx>,
     let new_lp_variant = LpExtend(parent, mc, loan_path_elem);
     let new_lp = LoanPath::new(new_lp_variant, new_lp_type.unwrap());
     debug!("add_fragment_sibling_core(new_lp={}, origin_lp={})",
-           new_lp.repr(tcx), origin_lp.repr(tcx));
+           new_lp.repr(), origin_lp.repr());
     let mp = this.move_path(tcx, Rc::new(new_lp));
 
     // Do not worry about checking for duplicates here; we will sort
index 43877d592ae15ab9805d1466307be65139575ef7..e1410daf279fe3210d3cce724c8be8c224ffc07e 100644 (file)
@@ -67,7 +67,7 @@ pub fn gather_match_variant<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                       mode: euv::MatchMode) {
     let tcx = bccx.tcx;
     debug!("gather_match_variant(move_pat={}, cmt={}, mode={:?})",
-           move_pat.id, cmt.repr(tcx), mode);
+           move_pat.id, cmt.repr(), mode);
 
     let opt_lp = opt_loan_path(&cmt);
     match opt_lp {
@@ -116,13 +116,13 @@ fn gather_move<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                          move_error_collector: &MoveErrorCollector<'tcx>,
                          move_info: GatherMoveInfo<'tcx>) {
     debug!("gather_move(move_id={}, cmt={})",
-           move_info.id, move_info.cmt.repr(bccx.tcx));
+           move_info.id, move_info.cmt.repr());
 
     let potentially_illegal_move =
                 check_and_get_illegal_move_origin(bccx, &move_info.cmt);
     match potentially_illegal_move {
         Some(illegal_move_origin) => {
-            debug!("illegal_move_origin={}", illegal_move_origin.repr(bccx.tcx));
+            debug!("illegal_move_origin={}", illegal_move_origin.repr());
             let error = MoveError::with_move_info(illegal_move_origin,
                                                   move_info.span_path_opt);
             move_error_collector.add_error(error);
index 9f7b4cf26e1c47fa60dabc40b6bdc37abb10c293..e4911543e6b54b19fda6153815a50bac5e0cece2 100644 (file)
@@ -34,7 +34,7 @@ pub fn guarantee_lifetime<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
     //! where S is `item_scope` if `cmt` is an upvar,
     //! and is scope of `cmt` otherwise.
     debug!("guarantee_lifetime(cmt={}, loan_region={})",
-           cmt.repr(bccx.tcx), loan_region.repr(bccx.tcx));
+           cmt.repr(), loan_region.repr());
     let ctxt = GuaranteeLifetimeContext {bccx: bccx,
                                          item_scope: item_scope,
                                          span: span,
@@ -66,8 +66,8 @@ fn check(&self, cmt: &mc::cmt<'tcx>, discr_scope: Option<ast::NodeId>) -> R {
         //! "guarantor".  Reports an error if `self.loan_region` is
         //! larger than scope of `cmt`.
         debug!("guarantee_lifetime.check(cmt={}, loan_region={})",
-               cmt.repr(self.bccx.tcx),
-               self.loan_region.repr(self.bccx.tcx));
+               cmt.repr(),
+               self.loan_region.repr());
 
         match cmt.cat {
             mc::cat_rvalue(..) |
index 012e01507de72ba10a8de9f761b5be5770025c1e..a33104bff70531374fa02d41e2926e114281a760 100644 (file)
@@ -77,7 +77,7 @@ fn consume(&mut self,
                cmt: mc::cmt<'tcx>,
                mode: euv::ConsumeMode) {
         debug!("consume(consume_id={}, cmt={}, mode={:?})",
-               consume_id, cmt.repr(self.tcx()), mode);
+               consume_id, cmt.repr(), mode);
 
         match mode {
             euv::Move(move_reason) => {
@@ -94,8 +94,8 @@ fn matched_pat(&mut self,
                    cmt: mc::cmt<'tcx>,
                    mode: euv::MatchMode) {
         debug!("matched_pat(matched_pat={}, cmt={}, mode={:?})",
-               matched_pat.repr(self.tcx()),
-               cmt.repr(self.tcx()),
+               matched_pat.repr(),
+               cmt.repr(),
                mode);
 
         if let mc::cat_downcast(..) = cmt.cat {
@@ -110,8 +110,8 @@ fn consume_pat(&mut self,
                    cmt: mc::cmt<'tcx>,
                    mode: euv::ConsumeMode) {
         debug!("consume_pat(consume_pat={}, cmt={}, mode={:?})",
-               consume_pat.repr(self.tcx()),
-               cmt.repr(self.tcx()),
+               consume_pat.repr(),
+               cmt.repr(),
                mode);
 
         match mode {
@@ -134,7 +134,7 @@ fn borrow(&mut self,
     {
         debug!("borrow(borrow_id={}, cmt={}, loan_region={:?}, \
                bk={:?}, loan_cause={:?})",
-               borrow_id, cmt.repr(self.tcx()), loan_region,
+               borrow_id, cmt.repr(), loan_region,
                bk, loan_cause);
 
         self.guarantee_valid(borrow_id,
@@ -153,7 +153,7 @@ fn mutate(&mut self,
     {
         let opt_lp = opt_loan_path(&assignee_cmt);
         debug!("mutate(assignment_id={}, assignee_cmt={}) opt_lp={:?}",
-               assignment_id, assignee_cmt.repr(self.tcx()), opt_lp);
+               assignment_id, assignee_cmt.repr(), opt_lp);
 
         match opt_lp {
             Some(lp) => {
@@ -237,7 +237,7 @@ fn guarantee_valid(&mut self,
         debug!("guarantee_valid(borrow_id={}, cmt={}, \
                 req_mutbl={:?}, loan_region={:?})",
                borrow_id,
-               cmt.repr(self.tcx()),
+               cmt.repr(),
                req_kind,
                loan_region);
 
@@ -337,7 +337,7 @@ fn guarantee_valid(&mut self,
         };
 
         debug!("guarantee_valid(borrow_id={}), loan={}",
-               borrow_id, loan.repr(self.tcx()));
+               borrow_id, loan.repr());
 
         // let loan_path = loan.loan_path;
         // let loan_gen_scope = loan.gen_scope;
@@ -377,7 +377,7 @@ fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                       -> Result<(),()> {
             //! Implements the M-* rules in README.md.
             debug!("check_mutability(cause={:?} cmt={} req_kind={:?}",
-                   cause, cmt.repr(bccx.tcx), req_kind);
+                   cause, cmt.repr(), req_kind);
             match req_kind {
                 ty::UniqueImmBorrow | ty::ImmBorrow => {
                     match cmt.mutbl {
@@ -507,7 +507,7 @@ fn visit_expr(&mut self, ex: &Expr) {
 
 pub fn gather_loans_in_static_initializer(bccx: &mut BorrowckCtxt, expr: &ast::Expr) {
 
-    debug!("gather_loans_in_static_initializer(expr={})", expr.repr(bccx.tcx));
+    debug!("gather_loans_in_static_initializer(expr={})", expr.repr());
 
     let mut sicx = StaticInitializerCtxt {
         bccx: bccx
index d16e0fdc19fead5d855a2268824be4b98ee8ae35..bc52fc7622cf1a127f5cd1ef71cea7f203beabea 100644 (file)
@@ -130,7 +130,7 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                 bccx.span_err(move_from.span,
                               &format!("cannot move out of type `{}`, \
                                         a non-copy fixed-size array",
-                                       b.ty.user_string(bccx.tcx)));
+                                       b.ty.user_string()));
             }
         }
 
@@ -143,7 +143,7 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                         move_from.span,
                         &format!("cannot move out of type `{}`, \
                                  which defines the `Drop` trait",
-                                b.ty.user_string(bccx.tcx)));
+                                b.ty.user_string()));
                 },
                 _ => {
                     bccx.span_bug(move_from.span, "this path should not cause illegal move")
index 56f49a3047bf5eab48d7b64210ffc7242421ec49..274a08dfe1108535a13edee10fa1988f801db0d6 100644 (file)
@@ -58,7 +58,7 @@ struct RestrictionsContext<'a, 'tcx: 'a> {
 impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
     fn restrict(&self,
                 cmt: mc::cmt<'tcx>) -> RestrictionResult<'tcx> {
-        debug!("restrict(cmt={})", cmt.repr(self.bccx.tcx));
+        debug!("restrict(cmt={})", cmt.repr());
 
         let new_lp = |v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty));
 
index 5833386dd1f022e2ad4f5344809c490f8ba18bf7..93b16795fe8d0f06cbeed85f18926160bd6be23e 100644 (file)
@@ -682,7 +682,7 @@ pub fn report_use_of_moved_value<'b>(&self,
                                   which is {}",
                                  ol,
                                  moved_lp_msg,
-                                 expr_ty.user_string(self.tcx),
+                                 expr_ty.user_string(),
                                  suggestion));
                 } else {
                     self.tcx.sess.span_note(
@@ -690,7 +690,7 @@ pub fn report_use_of_moved_value<'b>(&self,
                         &format!("`{}` moved here{} because it has type `{}`, which is {}",
                                  ol,
                                  moved_lp_msg,
-                                 expr_ty.user_string(self.tcx),
+                                 expr_ty.user_string(),
                                  suggestion));
                 }
             }
@@ -703,7 +703,7 @@ pub fn report_use_of_moved_value<'b>(&self,
                              which is moved by default",
                             ol,
                             moved_lp_msg,
-                            pat_ty.user_string(self.tcx)));
+                            pat_ty.user_string()));
                 self.tcx.sess.fileline_help(span,
                     "use `ref` to override");
             }
@@ -734,7 +734,7 @@ pub fn report_use_of_moved_value<'b>(&self,
                             has type `{}`, which is {}",
                             ol,
                             moved_lp_msg,
-                            expr_ty.user_string(self.tcx),
+                            expr_ty.user_string(),
                             suggestion));
                 self.tcx.sess.fileline_help(expr_span, help);
             }
@@ -1148,8 +1148,8 @@ fn initial_value(&self) -> bool {
     }
 }
 
-impl<'tcx> Repr<'tcx> for InteriorKind {
-    fn repr(&self, _tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for InteriorKind {
+    fn repr(&self) -> String {
         match *self {
             InteriorField(mc::NamedField(fld)) =>
                 format!("{}", token::get_name(fld)),
@@ -1159,77 +1159,77 @@ fn repr(&self, _tcx: &ty::ctxt<'tcx>) -> String {
     }
 }
 
-impl<'tcx> Repr<'tcx> for Loan<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for Loan<'tcx> {
+    fn repr(&self) -> String {
         format!("Loan_{}({}, {:?}, {:?}-{:?}, {})",
                  self.index,
-                 self.loan_path.repr(tcx),
+                 self.loan_path.repr(),
                  self.kind,
                  self.gen_scope,
                  self.kill_scope,
-                 self.restricted_paths.repr(tcx))
+                 self.restricted_paths.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for LoanPath<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for LoanPath<'tcx> {
+    fn repr(&self) -> String {
         match self.kind {
             LpVar(id) => {
-                format!("$({})", tcx.map.node_to_string(id))
+                format!("$({})", ty::tls::with(|tcx| tcx.map.node_to_string(id)))
             }
 
             LpUpvar(ty::UpvarId{ var_id, closure_expr_id }) => {
-                let s = tcx.map.node_to_string(var_id);
+                let s = ty::tls::with(|tcx| tcx.map.node_to_string(var_id));
                 format!("$({} captured by id={})", s, closure_expr_id)
             }
 
             LpDowncast(ref lp, variant_def_id) => {
                 let variant_str = if variant_def_id.krate == ast::LOCAL_CRATE {
-                    ty::item_path_str(tcx, variant_def_id)
+                    ty::tls::with(|tcx| ty::item_path_str(tcx, variant_def_id))
                 } else {
-                    variant_def_id.repr(tcx)
+                    variant_def_id.repr()
                 };
-                format!("({}{}{})", lp.repr(tcx), DOWNCAST_PRINTED_OPERATOR, variant_str)
+                format!("({}{}{})", lp.repr(), DOWNCAST_PRINTED_OPERATOR, variant_str)
             }
 
             LpExtend(ref lp, _, LpDeref(_)) => {
-                format!("{}.*", lp.repr(tcx))
+                format!("{}.*", lp.repr())
             }
 
             LpExtend(ref lp, _, LpInterior(ref interior)) => {
-                format!("{}.{}", lp.repr(tcx), interior.repr(tcx))
+                format!("{}.{}", lp.repr(), interior.repr())
             }
         }
     }
 }
 
-impl<'tcx> UserString<'tcx> for LoanPath<'tcx> {
-    fn user_string(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> UserString for LoanPath<'tcx> {
+    fn user_string(&self) -> String {
         match self.kind {
             LpVar(id) => {
-                format!("$({})", tcx.map.node_to_user_string(id))
+                format!("$({})", ty::tls::with(|tcx| tcx.map.node_to_user_string(id)))
             }
 
             LpUpvar(ty::UpvarId{ var_id, closure_expr_id: _ }) => {
-                let s = tcx.map.node_to_user_string(var_id);
+                let s = ty::tls::with(|tcx| tcx.map.node_to_user_string(var_id));
                 format!("$({} captured by closure)", s)
             }
 
             LpDowncast(ref lp, variant_def_id) => {
                 let variant_str = if variant_def_id.krate == ast::LOCAL_CRATE {
-                    ty::item_path_str(tcx, variant_def_id)
+                    ty::tls::with(|tcx| ty::item_path_str(tcx, variant_def_id))
                 } else {
-                    variant_def_id.repr(tcx)
+                    variant_def_id.repr()
                 };
-                format!("({}{}{})", lp.user_string(tcx), DOWNCAST_PRINTED_OPERATOR, variant_str)
+                format!("({}{}{})", lp.user_string(), DOWNCAST_PRINTED_OPERATOR, variant_str)
             }
 
             LpExtend(ref lp, _, LpDeref(_)) => {
-                format!("{}.*", lp.user_string(tcx))
+                format!("{}.*", lp.user_string())
             }
 
             LpExtend(ref lp, _, LpInterior(ref interior)) => {
-                format!("{}.{}", lp.user_string(tcx), interior.repr(tcx))
+                format!("{}.{}", lp.user_string(), interior.repr())
             }
         }
     }
index 0f56aa9fb1f65e3fd0f3dbe6a49cd985d535bca4..1b9b15a673aea6464d69dd2c2b8e85e1221dda58 100644 (file)
@@ -314,7 +314,7 @@ pub fn move_path(&self,
         };
 
         debug!("move_path(lp={}, index={:?})",
-               lp.repr(tcx),
+               lp.repr(),
                index);
 
         assert_eq!(index.get(), self.paths.borrow().len() - 1);
@@ -365,7 +365,7 @@ pub fn add_move(&self,
                     id: ast::NodeId,
                     kind: MoveKind) {
         debug!("add_move(lp={}, id={}, kind={:?})",
-               lp.repr(tcx),
+               lp.repr(),
                id,
                kind);
 
@@ -395,7 +395,7 @@ pub fn add_assignment(&self,
                           assignee_id: ast::NodeId,
                           mode: euv::MutateMode) {
         debug!("add_assignment(lp={}, assign_id={}, assignee_id={}",
-               lp.repr(tcx), assign_id, assignee_id);
+               lp.repr(), assign_id, assignee_id);
 
         let path_index = self.move_path(tcx, lp.clone());
 
@@ -416,12 +416,12 @@ pub fn add_assignment(&self,
 
         if self.is_var_path(path_index) {
             debug!("add_assignment[var](lp={}, assignment={}, path_index={:?})",
-                   lp.repr(tcx), self.var_assignments.borrow().len(), path_index);
+                   lp.repr(), self.var_assignments.borrow().len(), path_index);
 
             self.var_assignments.borrow_mut().push(assignment);
         } else {
             debug!("add_assignment[path](lp={}, path_index={:?})",
-                   lp.repr(tcx), path_index);
+                   lp.repr(), path_index);
 
             self.path_assignments.borrow_mut().push(assignment);
         }
@@ -438,7 +438,7 @@ pub fn add_variant_match(&self,
                              base_lp: Rc<LoanPath<'tcx>>,
                              mode: euv::MatchMode) {
         debug!("add_variant_match(lp={}, pattern_id={})",
-               lp.repr(tcx), pattern_id);
+               lp.repr(), pattern_id);
 
         let path_index = self.move_path(tcx, lp.clone());
         let base_path_index = self.move_path(tcx, base_lp.clone());
index 597682c89eee821b009d6bc614428c4bbc78ccc1..7f079669911053a550f3eef60c46dff5e33f2c7c 100644 (file)
@@ -318,7 +318,7 @@ fn post(&self,
                 try!(pp::word(&mut s.s, "as"));
                 try!(pp::space(&mut s.s));
                 try!(pp::word(&mut s.s,
-                              &ty::expr_ty(self.tcx, expr).user_string(self.tcx)));
+                              &ty::expr_ty(self.tcx, expr).user_string()));
                 s.pclose()
             }
             _ => Ok(())
index c3f5dc084fd8344546eac979e887f094f3267085..16f35a8c10a8b4ddc27dd8b5d9ce9fc88e026197 100644 (file)
@@ -188,7 +188,7 @@ fn search_mod(this: &Env,
                       -> Option<ast::NodeId> {
             assert!(idx < names.len());
             for item in &m.items {
-                if item.ident.user_string(this.infcx.tcx) == names[idx] {
+                if item.ident.user_string() == names[idx] {
                     return search(this, &**item, idx+1, names);
                 }
             }
@@ -253,7 +253,7 @@ pub fn assert_eq(&self, a: Ty<'tcx>, b: Ty<'tcx>) {
     }
 
     pub fn ty_to_string(&self, a: Ty<'tcx>) -> String {
-         a.user_string(self.infcx.tcx)
+         a.user_string()
     }
 
     pub fn t_fn(&self,
@@ -388,8 +388,8 @@ pub fn check_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
             Ok(_) => { }
             Err(ref e) => {
                 panic!("unexpected error computing sub({},{}): {}",
-                       t1.repr(self.infcx.tcx),
-                       t2.repr(self.infcx.tcx),
+                       t1.repr(),
+                       t2.repr(),
                        ty::type_err_to_str(self.infcx.tcx, e));
             }
         }
@@ -402,8 +402,8 @@ pub fn check_not_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
             Err(_) => { }
             Ok(_) => {
                 panic!("unexpected success computing sub({},{})",
-                       t1.repr(self.infcx.tcx),
-                       t2.repr(self.infcx.tcx));
+                       t1.repr(),
+                       t2.repr());
             }
         }
     }
@@ -659,7 +659,7 @@ fn glb_bound_free_infer() {
         let t_resolve1 = env.infcx.shallow_resolve(t_infer1);
         match t_resolve1.sty {
             ty::TyRef(..) => { }
-            _ => { panic!("t_resolve1={}", t_resolve1.repr(env.infcx.tcx)); }
+            _ => { panic!("t_resolve1={}", t_resolve1.repr()); }
         }
     })
 }
@@ -702,10 +702,10 @@ fn subst_ty_renumber_bound() {
         };
 
         debug!("subst_bound: t_source={} substs={} t_substituted={} t_expected={}",
-               t_source.repr(env.infcx.tcx),
-               substs.repr(env.infcx.tcx),
-               t_substituted.repr(env.infcx.tcx),
-               t_expected.repr(env.infcx.tcx));
+               t_source.repr(),
+               substs.repr(),
+               t_substituted.repr(),
+               t_expected.repr());
 
         assert_eq!(t_substituted, t_expected);
     })
@@ -739,10 +739,10 @@ fn subst_ty_renumber_some_bounds() {
         };
 
         debug!("subst_bound: t_source={} substs={} t_substituted={} t_expected={}",
-               t_source.repr(env.infcx.tcx),
-               substs.repr(env.infcx.tcx),
-               t_substituted.repr(env.infcx.tcx),
-               t_expected.repr(env.infcx.tcx));
+               t_source.repr(),
+               substs.repr(),
+               t_substituted.repr(),
+               t_expected.repr());
 
         assert_eq!(t_substituted, t_expected);
     })
@@ -800,10 +800,10 @@ fn subst_region_renumber_region() {
         };
 
         debug!("subst_bound: t_source={} substs={} t_substituted={} t_expected={}",
-               t_source.repr(env.infcx.tcx),
-               substs.repr(env.infcx.tcx),
-               t_substituted.repr(env.infcx.tcx),
-               t_expected.repr(env.infcx.tcx));
+               t_source.repr(),
+               substs.repr(),
+               t_substituted.repr(),
+               t_expected.repr());
 
         assert_eq!(t_substituted, t_expected);
     })
index 755d7af9d4f63602d4edc0936e77f0942e6d9995..ed8f7372b660c20fc42d4e4d409785977e68d733 100644 (file)
@@ -495,7 +495,7 @@ fn check_heap_type<'a, 'tcx>(&self, cx: &Context<'a, 'tcx>,
         });
 
         if n_uniq > 0 {
-            let s =  ty.user_string(cx.tcx);
+            let s =  ty.user_string();
             let m = format!("type uses owned (Box type) pointers: {}", s);
             cx.span_lint(BOX_POINTERS, span, &m[..]);
         }
index a5bca132e02d0431d0fa8e47f781a626aeb5891b..eeebe03c21ba10af634e94d9688919e3d5b37e88 100644 (file)
@@ -347,7 +347,7 @@ pub fn mangle_exported_name<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, path: PathEl
 pub fn mangle_internal_name_by_type_and_seq<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                                       t: Ty<'tcx>,
                                                       name: &str) -> String {
-    let path = [PathName(token::intern(&t.user_string(ccx.tcx()))),
+    let path = [PathName(token::intern(&t.user_string())),
                 gensym_name(name)];
     let hash = get_symbol_hash(ccx, t);
     mangle(path.iter().cloned(), Some(&hash[..]))
index 6ec58337e723e28fddfb258be92de4243217802d..fb174d8ff276ea9193e5838f31ee6f94e0fb3f00 100644 (file)
@@ -287,7 +287,7 @@ fn process_formals(&mut self, formals: &Vec<ast::Arg>, qualname: &str) {
             collector.visit_pat(&arg.pat);
             let span_utils = self.span.clone();
             for &(id, ref p, _, _) in &collector.collected_paths {
-                let typ = self.tcx.node_types().get(&id).unwrap().user_string(self.tcx);
+                let typ = self.tcx.node_types().get(&id).unwrap().user_string();
                 // get the span only for the name of the variable (I hope the path is only ever a
                 // variable name, but who knows?)
                 self.fmt.formal_str(p.span,
@@ -1392,7 +1392,7 @@ fn visit_local(&mut self, l: &ast::Local) {
                 "<mutable>".to_string()
             };
             let types = self.tcx.node_types();
-            let typ = types.get(&id).unwrap().user_string(self.tcx);
+            let typ = types.get(&id).unwrap().user_string();
             // Get the span only for the name of the variable (I hope the path
             // is only ever a variable name, but who knows?).
             let sub_span = self.span.span_for_last_ident(p.span);
index 4116e6637aea69bc72e2a0086cd4ba01b7e8956c..efdc1195a952893dd47090a8f812941fc62e8437 100644 (file)
@@ -293,7 +293,7 @@ pub fn get_field_data(&self, field: &ast::StructField, parent: NodeId) -> Option
                                        self.tcx.map.path_to_string(parent),
                                        name);
                 let typ = self.tcx.node_types().get(&field.node.id).unwrap()
-                                               .user_string(self.tcx);
+                                               .user_string();
                 let sub_span = self.span_utils.sub_span_before_token(field.span, token::Colon);
                 Some(Data::VariableData(VariableData {
                     id: field.node.id,
index 898b9b9662db42def54da5954f3f1a50401d00df..065aad96f7943b5700498a0579b05a4fdf44154e 100644 (file)
 use session::config::{NoDebugInfo, FullDebugInfo};
 use util::common::indenter;
 use util::nodemap::FnvHashMap;
-use util::ppaux::Repr;
+use util::ppaux::{self, Repr};
 
 use std;
 use std::cmp::Ordering;
@@ -371,11 +371,11 @@ struct Match<'a, 'p: 'a, 'blk: 'a, 'tcx: 'blk> {
     pat_renaming_map: Option<&'a FnvHashMap<(NodeId, Span), NodeId>>
 }
 
-impl<'a, 'p, 'blk, 'tcx> Repr<'tcx> for Match<'a, 'p, 'blk, 'tcx> {
-    fn repr(&self, tcx: &ty::ctxt) -> String {
-        if tcx.sess.verbose() {
+impl<'a, 'p, 'blk, 'tcx> Repr for Match<'a, 'p, 'blk, 'tcx> {
+    fn repr(&self) -> String {
+        if ppaux::verbose() {
             // for many programs, this just take too long to serialize
-            self.pats.repr(tcx)
+            self.pats.repr()
         } else {
             format!("{} pats", self.pats.len())
         }
@@ -399,7 +399,7 @@ fn expand_nested_bindings<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                               -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
     debug!("expand_nested_bindings(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
-           m.repr(bcx.tcx()),
+           m.repr(),
            col,
            bcx.val_to_string(val));
     let _indenter = indenter();
@@ -439,7 +439,7 @@ fn enter_match<'a, 'b, 'p, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
 {
     debug!("enter_match(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
-           m.repr(bcx.tcx()),
+           m.repr(),
            col,
            bcx.val_to_string(val));
     let _indenter = indenter();
@@ -482,7 +482,7 @@ fn enter_default<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                      -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
     debug!("enter_default(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
-           m.repr(bcx.tcx()),
+           m.repr(),
            col,
            bcx.val_to_string(val));
     let _indenter = indenter();
@@ -539,7 +539,7 @@ fn enter_opt<'a, 'p, 'blk, 'tcx>(
              -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
     debug!("enter_opt(bcx={}, m={}, opt={:?}, col={}, val={})",
            bcx.to_str(),
-           m.repr(bcx.tcx()),
+           m.repr(),
            *opt,
            col,
            bcx.val_to_string(val));
@@ -940,7 +940,7 @@ fn compile_guard<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     debug!("compile_guard(bcx={}, guard_expr={}, m={}, vals=[{}])",
            bcx.to_str(),
            bcx.expr_to_string(guard_expr),
-           m.repr(bcx.tcx()),
+           m.repr(),
            vals.iter().map(|v| bcx.val_to_string(*v)).collect::<Vec<_>>().connect(", "));
     let _indenter = indenter();
 
@@ -985,7 +985,7 @@ fn compile_submatch<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                         has_genuine_default: bool) {
     debug!("compile_submatch(bcx={}, m={}, vals=[{}])",
            bcx.to_str(),
-           m.repr(bcx.tcx()),
+           m.repr(),
            vals.iter().map(|v| bcx.val_to_string(*v)).collect::<Vec<_>>().connect(", "));
     let _indenter = indenter();
     let _icx = push_ctxt("match::compile_submatch");
@@ -1698,11 +1698,11 @@ fn bind_irrefutable_pat<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                     -> Block<'blk, 'tcx> {
     debug!("bind_irrefutable_pat(bcx={}, pat={})",
            bcx.to_str(),
-           pat.repr(bcx.tcx()));
+           pat.repr());
 
     if bcx.sess().asm_comments() {
         add_comment(bcx, &format!("bind_irrefutable_pat(pat={})",
-                                 pat.repr(bcx.tcx())));
+                                 pat.repr()));
     }
 
     let _indenter = indenter();
index 5b8986878c7abca4bd69b974e0933d2c6a6b2718..dc5d3ea2f624890b90548302f9021f97ddc603b9 100644 (file)
@@ -143,7 +143,7 @@ pub fn represent_node<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 pub fn represent_type<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                 t: Ty<'tcx>)
                                 -> Rc<Repr<'tcx>> {
-    debug!("Representing: {}", t.repr(cx.tcx()));
+    debug!("Representing: {}", t.repr());
     match cx.adt_reprs().borrow().get(&t) {
         Some(repr) => return repr.clone(),
         None => {}
@@ -382,7 +382,7 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             General(ity, fields, dtor_to_init_u8(dtor))
         }
         _ => cx.sess().bug(&format!("adt::represent_type called on non-ADT type: {}",
-                           t.repr(cx.tcx())))
+                           t.repr()))
     }
 }
 
index f66188dcfb0c82bbcd4a37743972264afee493cb..291541aa98ff88376d99050a006ae2ff71e7542a 100644 (file)
@@ -531,7 +531,7 @@ fn iter_variant<'blk, 'tcx, F>(cx: Block<'blk, 'tcx>,
       }
       _ => {
           cx.sess().unimpl(&format!("type in iter_structural_ty: {}",
-                                    t.repr(cx.tcx())))
+                                    t.repr()))
       }
     }
     return cx;
@@ -641,7 +641,7 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>(
         }
         _ => {
             cx.sess().bug(&format!("fail-if-zero on unexpected type: {}",
-                                   rhs_t.repr(cx.tcx())));
+                                   rhs_t.repr()));
         }
     };
     let bcx = with_cond(cx, is_zero, |bcx| {
@@ -1193,7 +1193,7 @@ pub fn new_fn_ctxt<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>,
            } else {
                ccx.tcx().map.path_to_string(id).to_string()
            },
-           id, param_substs.repr(ccx.tcx()));
+           id, param_substs.repr());
 
     let uses_outptr = match output_type {
         ty::FnConverging(output_type) => {
@@ -1511,7 +1511,7 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     attributes::emit_uwtable(llfndecl, true);
 
     debug!("trans_closure(..., param_substs={})",
-           param_substs.repr(ccx.tcx()));
+           param_substs.repr());
 
     let has_env = match closure_env {
         closure::ClosureEnv::Closure(_) => true,
@@ -1554,7 +1554,7 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     };
     for monomorphized_arg_type in &monomorphized_arg_types {
         debug!("trans_closure: monomorphized_arg_type: {}",
-               monomorphized_arg_type.repr(ccx.tcx()));
+               monomorphized_arg_type.repr());
     }
     debug!("trans_closure: function lltype: {}",
            bcx.fcx.ccx.tn().val_to_string(bcx.fcx.llfn));
@@ -1636,7 +1636,7 @@ pub fn trans_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                           id: ast::NodeId,
                           attrs: &[ast::Attribute]) {
     let _s = StatRecorder::new(ccx, ccx.tcx().map.path_to_string(id).to_string());
-    debug!("trans_fn(param_substs={})", param_substs.repr(ccx.tcx()));
+    debug!("trans_fn(param_substs={})", param_substs.repr());
     let _icx = push_ctxt("trans_fn");
     let fn_ty = ty::node_id_to_type(ccx.tcx(), id);
     let output_type = ty::erase_late_bound_regions(ccx.tcx(), &ty::ty_fn_ret(fn_ty));
@@ -1680,7 +1680,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
         _ => ccx.sess().bug(
             &format!("trans_enum_variant_constructor: \
                      unexpected ctor return type {}",
-                     ctor_ty.repr(tcx)))
+                     ctor_ty.repr()))
     };
 
     // Get location to store the result. If the user does not care about
@@ -1758,7 +1758,7 @@ fn trans_enum_variant_or_tuple_like_struct<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx
         _ => ccx.sess().bug(
             &format!("trans_enum_variant_or_tuple_like_struct: \
                      unexpected ctor return type {}",
-                    ctor_ty.repr(ccx.tcx())))
+                    ctor_ty.repr()))
     };
 
     let (arena, fcx): (TypedArena<_>, FunctionContext);
index 610ac6a113bd66c2d6de1f72626ce596296c10eb..a06598a7cbe3318ff708f4c0eb260aa5e3ff91e3 100644 (file)
@@ -89,7 +89,7 @@ pub struct Callee<'blk, 'tcx: 'blk> {
 fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr)
                      -> Callee<'blk, 'tcx> {
     let _icx = push_ctxt("trans_callee");
-    debug!("callee::trans(expr={})", expr.repr(bcx.tcx()));
+    debug!("callee::trans(expr={})", expr.repr());
 
     // pick out special kinds of expressions that can be called:
     match expr.node {
@@ -134,7 +134,7 @@ fn trans_def<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                              def: def::Def,
                              ref_expr: &ast::Expr)
                              -> Callee<'blk, 'tcx> {
-        debug!("trans_def(def={}, ref_expr={})", def.repr(bcx.tcx()), ref_expr.repr(bcx.tcx()));
+        debug!("trans_def(def={}, ref_expr={})", def.repr(), ref_expr.repr());
         let expr_ty = common::node_id_type(bcx, ref_expr.id);
         match def {
             def::DefFn(did, _) if {
@@ -229,9 +229,9 @@ pub fn trans_fn_ref<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 
     let substs = common::node_id_substs(ccx, node, param_substs);
     debug!("trans_fn_ref(def_id={}, node={:?}, substs={})",
-           def_id.repr(ccx.tcx()),
+           def_id.repr(),
            node,
-           substs.repr(ccx.tcx()));
+           substs.repr());
     trans_fn_ref_with_substs(ccx, def_id, node, param_substs, substs)
 }
 
@@ -292,7 +292,7 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
     }
 
     debug!("trans_fn_pointer_shim(bare_fn_ty={})",
-           bare_fn_ty.repr(tcx));
+           bare_fn_ty.repr());
 
     // Construct the "tuply" version of `bare_fn_ty`. It takes two arguments: `self`,
     // which is the fn pointer, and `args`, which is the arguments tuple.
@@ -307,7 +307,7 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
 
             _ => {
                 tcx.sess.bug(&format!("trans_fn_pointer_shim invoked on invalid type: {}",
-                                           bare_fn_ty.repr(tcx)));
+                                           bare_fn_ty.repr()));
             }
         };
     let sig = ty::erase_late_bound_regions(tcx, sig);
@@ -323,7 +323,7 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
                                              output: sig.output,
                                              variadic: false
                                          })}));
-    debug!("tuple_fn_ty: {}", tuple_fn_ty.repr(tcx));
+    debug!("tuple_fn_ty: {}", tuple_fn_ty.repr());
 
     //
     let function_name = link::mangle_internal_name_by_type_and_seq(ccx, bare_fn_ty,
@@ -403,10 +403,10 @@ pub fn trans_fn_ref_with_substs<'a, 'tcx>(
 
     debug!("trans_fn_ref_with_substs(def_id={}, node={:?}, \
             param_substs={}, substs={})",
-           def_id.repr(tcx),
+           def_id.repr(),
            node,
-           param_substs.repr(tcx),
-           substs.repr(tcx));
+           param_substs.repr(),
+           substs.repr());
 
     assert!(substs.types.all(|t| !ty::type_needs_infer(*t)));
     assert!(substs.types.all(|t| !ty::type_has_escaping_regions(*t)));
@@ -459,8 +459,8 @@ pub fn trans_fn_ref_with_substs<'a, 'tcx>(
                     debug!("trans_fn_with_vtables - default method: \
                             substs = {}, trait_subst = {}, \
                             first_subst = {}, new_subst = {}",
-                           substs.repr(tcx), trait_ref.substs.repr(tcx),
-                           first_subst.repr(tcx), new_substs.repr(tcx));
+                           substs.repr(), trait_ref.substs.repr(),
+                           first_subst.repr(), new_substs.repr());
 
                     (true, source_id, new_substs)
                 }
@@ -505,7 +505,7 @@ pub fn trans_fn_ref_with_substs<'a, 'tcx>(
     };
 
     debug!("trans_fn_ref_with_substs({}) must_monomorphise: {}",
-           def_id.repr(tcx), must_monomorphise);
+           def_id.repr(), must_monomorphise);
 
     // Create a monomorphic version of generic functions
     if must_monomorphise {
@@ -615,7 +615,7 @@ pub fn trans_method_call<'a, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                          dest: expr::Dest)
                                          -> Block<'blk, 'tcx> {
     let _icx = push_ctxt("trans_method_call");
-    debug!("trans_method_call(call_expr={})", call_expr.repr(bcx.tcx()));
+    debug!("trans_method_call(call_expr={})", call_expr.repr());
     let method_call = MethodCall::expr(call_expr.id);
     let method_ty = match bcx.tcx().method_map.borrow().get(&method_call) {
         Some(method) => match method.origin {
@@ -1126,7 +1126,7 @@ pub fn trans_arg_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let ccx = bcx.ccx();
 
     debug!("trans_arg_datum({})",
-           formal_arg_ty.repr(bcx.tcx()));
+           formal_arg_ty.repr());
 
     let arg_datum_ty = arg_datum.ty;
 
@@ -1165,8 +1165,8 @@ pub fn trans_arg_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         let llformal_arg_ty = type_of::type_of_explicit_arg(ccx, formal_arg_ty);
         debug!("casting actual type ({}) to match formal ({})",
                bcx.val_to_string(val), bcx.llty_str(llformal_arg_ty));
-        debug!("Rust types: {}; {}", arg_datum_ty.repr(bcx.tcx()),
-                                     formal_arg_ty.repr(bcx.tcx()));
+        debug!("Rust types: {}; {}", arg_datum_ty.repr(),
+                                     formal_arg_ty.repr());
         val = PointerCast(bcx, val, llformal_arg_ty);
     }
 
index 9133004dfeff1f0ef78b84e80e268f519be52ee0..97fe4dfb2a7a6d38448066e67b73461b1c3d6012 100644 (file)
@@ -400,7 +400,7 @@ fn schedule_drop_mem(&self,
         debug!("schedule_drop_mem({:?}, val={}, ty={}) fill_on_drop={} skip_dtor={}",
                cleanup_scope,
                self.ccx.tn().val_to_string(val),
-               ty.repr(self.ccx.tcx()),
+               ty.repr(),
                drop.fill_on_drop,
                drop.skip_dtor);
 
@@ -426,7 +426,7 @@ fn schedule_drop_and_fill_mem(&self,
         debug!("schedule_drop_and_fill_mem({:?}, val={}, ty={}, fill_on_drop={}, skip_dtor={})",
                cleanup_scope,
                self.ccx.tn().val_to_string(val),
-               ty.repr(self.ccx.tcx()),
+               ty.repr(),
                drop.fill_on_drop,
                drop.skip_dtor);
 
@@ -458,7 +458,7 @@ fn schedule_drop_adt_contents(&self,
         debug!("schedule_drop_adt_contents({:?}, val={}, ty={}) fill_on_drop={} skip_dtor={}",
                cleanup_scope,
                self.ccx.tn().val_to_string(val),
-               ty.repr(self.ccx.tcx()),
+               ty.repr(),
                drop.fill_on_drop,
                drop.skip_dtor);
 
@@ -484,7 +484,7 @@ fn schedule_drop_immediate(&self,
         debug!("schedule_drop_immediate({:?}, val={}, ty={:?}) fill_on_drop={} skip_dtor={}",
                cleanup_scope,
                self.ccx.tn().val_to_string(val),
-               ty.repr(self.ccx.tcx()),
+               ty.repr(),
                drop.fill_on_drop,
                drop.skip_dtor);
 
index 27080966fcb45377c6435bfd96cdd3f84a79315b..ef8839c6d5d142d40a5fb6a0d20440f6cbbc3b36 100644 (file)
@@ -354,8 +354,8 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
     -> ValueRef
 {
     debug!("trans_fn_once_adapter_shim(closure_def_id={}, substs={}, llreffn={})",
-           closure_def_id.repr(ccx.tcx()),
-           substs.repr(ccx.tcx()),
+           closure_def_id.repr(),
+           substs.repr(),
            ccx.tn().val_to_string(llreffn));
 
     let tcx = ccx.tcx();
@@ -375,7 +375,7 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
                                                                sig: sig.clone() });
     let llref_fn_ty = ty::mk_bare_fn(tcx, None, llref_bare_fn_ty);
     debug!("trans_fn_once_adapter_shim: llref_fn_ty={}",
-           llref_fn_ty.repr(tcx));
+           llref_fn_ty.repr());
 
     // Make a version of the closure type with the same arguments, but
     // with argument #0 being by value.
@@ -424,7 +424,7 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
         ty::TyTuple(ref tys) => &**tys,
         _ => bcx.sess().bug(&format!("trans_fn_once_adapter_shim: not rust-call! \
                                       closure_def_id={}",
-                                     closure_def_id.repr(tcx)))
+                                     closure_def_id.repr()))
     };
     let llargs: Vec<_> =
         input_tys.iter()
index 1cabeb268562daf2770f736090feacd1747e42af..1f8e7e07568ebd19f47360932ad765f8b56b788f 100644 (file)
 /// subtyping, but they are anonymized and normalized as well). This
 /// is a stronger, caching version of `ty_fold::erase_regions`.
 pub fn erase_regions<'tcx,T>(cx: &ty::ctxt<'tcx>, value: &T) -> T
-    where T : TypeFoldable<'tcx> + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + Repr
 {
     let value1 = value.fold_with(&mut RegionEraser(cx));
     debug!("erase_regions({}) = {}",
-           value.repr(cx), value1.repr(cx));
+           value.repr(), value1.repr());
     return value1;
 
     struct RegionEraser<'a, 'tcx: 'a>(&'a ty::ctxt<'tcx>);
@@ -88,7 +88,7 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
         }
 
         fn fold_binder<T>(&mut self, t: &ty::Binder<T>) -> ty::Binder<T>
-            where T : TypeFoldable<'tcx> + Repr<'tcx>
+            where T : TypeFoldable<'tcx> + Repr
         {
             let u = ty::anonymize_late_bound_regions(self.tcx(), t);
             ty_fold::super_fold_binder(self, &u)
@@ -212,7 +212,7 @@ fn type_needs_drop_given_env<'a,'tcx>(cx: &ty::ctxt<'tcx>,
     // destructor (e.g. zero its memory on move).
 
     let contents = ty::type_contents(cx, ty);
-    debug!("type_needs_drop ty={} contents={:?}", ty.repr(cx), contents);
+    debug!("type_needs_drop ty={} contents={:?}", ty.repr(), contents);
     contents.needs_drop(cx)
 }
 
@@ -518,7 +518,7 @@ pub fn join_blocks(&'a self,
     }
 
     pub fn monomorphize<T>(&self, value: &T) -> T
-        where T : TypeFoldable<'tcx> + Repr<'tcx> + HasProjectionTypes + Clone
+        where T : TypeFoldable<'tcx> + Repr + HasProjectionTypes + Clone
     {
         monomorphize::apply_param_substs(self.ccx.tcx(),
                                          self.param_substs,
@@ -594,7 +594,7 @@ pub fn node_id_to_string(&self, id: ast::NodeId) -> String {
     }
 
     pub fn expr_to_string(&self, e: &ast::Expr) -> String {
-        e.repr(self.tcx())
+        e.repr()
     }
 
     pub fn def(&self, nid: ast::NodeId) -> def::Def {
@@ -616,7 +616,7 @@ pub fn llty_str(&self, ty: Type) -> String {
     }
 
     pub fn ty_to_string(&self, t: Ty<'tcx>) -> String {
-        t.repr(self.tcx())
+        t.repr()
     }
 
     pub fn to_str(&self) -> String {
@@ -624,7 +624,7 @@ pub fn to_str(&self) -> String {
     }
 
     pub fn monomorphize<T>(&self, value: &T) -> T
-        where T : TypeFoldable<'tcx> + Repr<'tcx> + HasProjectionTypes + Clone
+        where T : TypeFoldable<'tcx> + Repr + HasProjectionTypes + Clone
     {
         monomorphize::apply_param_substs(self.tcx(),
                                          self.fcx.param_substs,
@@ -994,14 +994,14 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     // First check the cache.
     match ccx.trait_cache().borrow().get(&trait_ref) {
         Some(vtable) => {
-            info!("Cache hit: {}", trait_ref.repr(ccx.tcx()));
+            info!("Cache hit: {}", trait_ref.repr());
             return (*vtable).clone();
         }
         None => { }
     }
 
     debug!("trans fulfill_obligation: trait_ref={} def_id={:?}",
-           trait_ref.repr(ccx.tcx()), trait_ref.def_id());
+           trait_ref.repr(), trait_ref.def_id());
 
     ty::populate_implementations_for_trait_if_necessary(tcx, trait_ref.def_id());
     let infcx = infer::new_infer_ctxt(tcx);
@@ -1024,7 +1024,7 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             // where ambiguity can result.
             debug!("Encountered ambiguity selecting `{}` during trans, \
                     presuming due to overflow",
-                   trait_ref.repr(tcx));
+                   trait_ref.repr());
             ccx.sess().span_fatal(
                 span,
                 "reached the recursion limit during monomorphization");
@@ -1033,8 +1033,8 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             tcx.sess.span_bug(
                 span,
                 &format!("Encountered error `{}` selecting `{}` during trans",
-                        e.repr(tcx),
-                        trait_ref.repr(tcx)))
+                        e.repr(),
+                        trait_ref.repr()))
         }
     };
 
@@ -1047,7 +1047,7 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     });
     let vtable = drain_fulfillment_cx_or_panic(span, &infcx, &mut fulfill_cx, &vtable);
 
-    info!("Cache miss: {}", trait_ref.repr(ccx.tcx()));
+    info!("Cache miss: {}", trait_ref.repr());
     ccx.trait_cache().borrow_mut().insert(trait_ref,
                                           vtable.clone());
 
@@ -1063,7 +1063,7 @@ pub fn normalize_and_test_predicates<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                                -> bool
 {
     debug!("normalize_and_test_predicates(predicates={})",
-           predicates.repr(ccx.tcx()));
+           predicates.repr());
 
     let tcx = ccx.tcx();
     let infcx = infer::new_infer_ctxt(tcx);
@@ -1135,7 +1135,7 @@ pub fn drain_fulfillment_cx_or_panic<'a,'tcx,T>(span: Span,
                                                 fulfill_cx: &mut traits::FulfillmentContext<'tcx>,
                                                 result: &T)
                                                 -> T
-    where T : TypeFoldable<'tcx> + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + Repr
 {
     match drain_fulfillment_cx(infcx, fulfill_cx, result) {
         Ok(v) => v,
@@ -1143,7 +1143,7 @@ pub fn drain_fulfillment_cx_or_panic<'a,'tcx,T>(span: Span,
             infcx.tcx.sess.span_bug(
                 span,
                 &format!("Encountered errors `{}` fulfilling during trans",
-                         errors.repr(infcx.tcx)));
+                         errors.repr()));
         }
     }
 }
@@ -1159,10 +1159,10 @@ pub fn drain_fulfillment_cx<'a,'tcx,T>(infcx: &infer::InferCtxt<'a,'tcx>,
                                        fulfill_cx: &mut traits::FulfillmentContext<'tcx>,
                                        result: &T)
                                        -> StdResult<T,Vec<traits::FulfillmentError<'tcx>>>
-    where T : TypeFoldable<'tcx> + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + Repr
 {
     debug!("drain_fulfillment_cx(result={})",
-           result.repr(infcx.tcx));
+           result.repr());
 
     // In principle, we only need to do this so long as `result`
     // contains unbound type parameters. It could be a slight
@@ -1210,7 +1210,7 @@ pub fn node_id_substs<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 
     if substs.types.any(|t| ty::type_needs_infer(*t)) {
             tcx.sess.bug(&format!("type parameters for node {:?} include inference types: {:?}",
-                                 node, substs.repr(tcx)));
+                                 node, substs.repr()));
         }
 
         monomorphize::apply_param_substs(tcx,
index 54f7e381f5e5cf19bf60486b2912b6e6f1571016..09f5509c5ac903262efe027c6bee0e6af53d0623 100644 (file)
@@ -68,7 +68,7 @@ pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: &ast::Lit)
                 _ => cx.sess().span_bug(lit.span,
                         &format!("integer literal has type {} (expected int \
                                  or usize)",
-                                lit_int_ty.repr(cx.tcx())))
+                                lit_int_ty.repr()))
             }
         }
         ast::LitFloat(ref fs, t) => {
@@ -161,7 +161,7 @@ fn const_deref<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         }
         None => {
             cx.sess().bug(&format!("unexpected dereferenceable type {}",
-                                   ty.repr(cx.tcx())))
+                                   ty.repr()))
         }
     }
 }
@@ -369,7 +369,7 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             llvm::LLVMDumpValue(C_undef(llty));
         }
         cx.sess().bug(&format!("const {} of type {} has size {} instead of {}",
-                         e.repr(cx.tcx()), ety_adjusted.repr(cx.tcx()),
+                         e.repr(), ety_adjusted.repr(),
                          csize, tsize));
     }
     (llconst, ety_adjusted)
@@ -477,9 +477,9 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                    -> ValueRef
 {
     debug!("const_expr_unadjusted(e={}, ety={}, param_substs={})",
-           e.repr(cx.tcx()),
-           ety.repr(cx.tcx()),
-           param_substs.repr(cx.tcx()));
+           e.repr(),
+           ety.repr(),
+           param_substs.repr());
 
     let map_list = |exprs: &[P<ast::Expr>]| -> Vec<ValueRef> {
         exprs.iter()
@@ -498,7 +498,7 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             let (te1, ty) = const_expr(cx, &**e1, param_substs, fn_args);
             debug!("const_expr_unadjusted: te1={}, ty={}",
                    cx.tn().val_to_string(te1),
-                   ty.repr(cx.tcx()));
+                   ty.repr());
             let is_simd = ty::type_is_simd(cx.tcx(), ty);
             let intype = if is_simd {
                 ty::simd_type(cx.tcx(), ty)
@@ -621,12 +621,12 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                       _ => cx.sess().span_bug(base.span,
                                               &format!("index-expr base must be a vector \
                                                        or string type, found {}",
-                                                      bt.repr(cx.tcx())))
+                                                      bt.repr()))
                   },
                   _ => cx.sess().span_bug(base.span,
                                           &format!("index-expr base must be a vector \
                                                    or string type, found {}",
-                                                  bt.repr(cx.tcx())))
+                                                  bt.repr()))
               };
 
               let len = llvm::LLVMConstIntGetZExtValue(len) as u64;
@@ -654,7 +654,7 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             let t_cast = ety;
             let llty = type_of::type_of(cx, t_cast);
             let (v, t_expr) = const_expr(cx, &**base, param_substs, fn_args);
-            debug!("trans_const_cast({} as {})", t_expr.repr(cx.tcx()), t_cast.repr(cx.tcx()));
+            debug!("trans_const_cast({} as {})", t_expr.repr(), t_cast.repr());
             if expr::cast_is_noop(cx.tcx(), base, t_expr, t_cast) {
                 return v;
             }
index 6bb6916176deb4a1e764e9516ae741e71084c797..ab76942ceee4b4e30db67de0d9ccdd10725ae99b 100644 (file)
@@ -767,7 +767,7 @@ pub fn obj_size_bound(&self) -> u64 {
     pub fn report_overbig_object(&self, obj: Ty<'tcx>) -> ! {
         self.sess().fatal(
             &format!("the type `{}` is too big for the current architecture",
-                    obj.repr(self.tcx())))
+                    obj.repr()))
     }
 
     pub fn check_overflow(&self) -> bool {
index d203aeca0a757929bd270edcd65ce5bf063d3f46..b2cd99fc3ca89321202bb5598113d90a471cff90 100644 (file)
@@ -36,14 +36,14 @@ pub fn trans_stmt<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
                               -> Block<'blk, 'tcx> {
     let _icx = push_ctxt("trans_stmt");
     let fcx = cx.fcx;
-    debug!("trans_stmt({})", s.repr(cx.tcx()));
+    debug!("trans_stmt({})", s.repr());
 
     if cx.unreachable.get() {
         return cx;
     }
 
     if cx.sess().asm_comments() {
-        add_span_comment(cx, s.span, &s.repr(cx.tcx()));
+        add_span_comment(cx, s.span, &s.repr());
     }
 
     let mut bcx = cx;
index d73bc28ba196776ad53d94230c3e4177caed3c45..e6b47fdee7eec16a3246d6015f401bda79e8bdaf 100644 (file)
@@ -616,7 +616,7 @@ pub fn shallow_copy<'blk>(&self,
     pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
         format!("Datum({}, {}, {:?})",
                 ccx.tn().val_to_string(self.val),
-                self.ty.repr(ccx.tcx()),
+                self.ty.repr(),
                 self.kind)
     }
 
index 842631ed94031e11376c6317dff779f051a4ea1e..5ced8452b5f7060cf583738763f2c89e07fdde10 100644 (file)
@@ -105,7 +105,7 @@ fn register_type_with_metadata<'a>(&mut self,
                                        metadata: DIType) {
         if self.type_to_metadata.insert(type_, metadata).is_some() {
             cx.sess().bug(&format!("Type metadata for Ty '{}' is already in the TypeMap!",
-                                   type_.repr(cx.tcx())));
+                                   type_.repr()));
         }
     }
 
@@ -298,7 +298,7 @@ fn get_unique_type_id_of_type<'a>(&mut self, cx: &CrateContext<'a, 'tcx>,
             },
             _ => {
                 cx.sess().bug(&format!("get_unique_type_id_of_type() - unexpected type: {}, {:?}",
-                                       type_.repr(cx.tcx()), type_.sty))
+                                       type_.repr(), type_.sty))
             }
         };
 
@@ -489,7 +489,7 @@ fn finalize<'a>(&self, cx: &CrateContext<'a, 'tcx>) -> MetadataCreationResult {
                        type_map.find_metadata_for_type(unfinished_type).is_none() {
                         cx.sess().bug(&format!("Forward declaration of potentially recursive type \
                                               '{}' was not found in TypeMap!",
-                                              unfinished_type.repr(cx.tcx()))
+                                              unfinished_type.repr())
                                       );
                     }
                 }
@@ -677,7 +677,7 @@ fn trait_pointer_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         _ => {
             cx.sess().bug(&format!("debuginfo: Unexpected trait-object type in \
                                    trait_pointer_metadata(): {}",
-                                   trait_type.repr(cx.tcx())));
+                                   trait_type.repr()));
         }
     };
 
@@ -839,7 +839,7 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                                  the debuginfo::TypeMap but it \
                                                  was not. (Ty = {})",
                                                 &unique_type_id_str[..],
-                                                t.user_string(cx.tcx()));
+                                                t.user_string());
                     cx.sess().span_bug(usage_site_span, &error_message[..]);
                 }
             };
@@ -854,7 +854,7 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                                      debuginfo::TypeMap. \
                                                      UniqueTypeId={}, Ty={}",
                             &unique_type_id_str[..],
-                            t.user_string(cx.tcx()));
+                            t.user_string());
                         cx.sess().span_bug(usage_site_span, &error_message[..]);
                     }
                 }
index c5dd2c17822d38ed6a11fc6daf0686907e6ddfc4..e33f059a94554458d806369dcee53657e319d058 100644 (file)
@@ -163,7 +163,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         ty::TyProjection(..) |
         ty::TyParam(_) => {
             cx.sess().bug(&format!("debuginfo: Trying to create type name for \
-                unexpected type: {}", t.repr(cx.tcx())));
+                unexpected type: {}", t.repr()));
         }
     }
 
index 935925e5a8fc6f3fd12c1bbf47ab6fb552072bbb..56daf7d570f21df677486c2a2379e4e71b8af61b 100644 (file)
@@ -107,10 +107,10 @@ pub fn declare_cfn(ccx: &CrateContext, name: &str, fn_type: Type,
 pub fn declare_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, name: &str,
                                  fn_type: ty::Ty<'tcx>) -> ValueRef {
     debug!("declare_rust_fn(name={:?}, fn_type={})", name,
-           fn_type.repr(ccx.tcx()));
+           fn_type.repr());
     let fn_type = monomorphize::normalize_associated_type(ccx.tcx(), &fn_type);
     debug!("declare_rust_fn (after normalised associated types) fn_type={}",
-           fn_type.repr(ccx.tcx()));
+           fn_type.repr());
 
     let function_type; // placeholder so that the memory ownership works out ok
     let (sig, abi, env) = match fn_type.sty {
@@ -123,14 +123,14 @@ pub fn declare_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, name: &str,
             let self_type = base::self_type_for_closure(ccx, closure_did, fn_type);
             let llenvironment_type = type_of::type_of_explicit_arg(ccx, self_type);
             debug!("declare_rust_fn function_type={} self_type={}",
-                   function_type.repr(ccx.tcx()), self_type.repr(ccx.tcx()));
+                   function_type.repr(), self_type.repr());
             (&function_type.sig, abi::RustCall, Some(llenvironment_type))
         }
         _ => ccx.sess().bug("expected closure or fn")
     };
 
     let sig = ty::Binder(ty::erase_late_bound_regions(ccx.tcx(), sig));
-    debug!("declare_rust_fn (after region erasure) sig={}", sig.repr(ccx.tcx()));
+    debug!("declare_rust_fn (after region erasure) sig={}", sig.repr());
     let llfty = type_of::type_of_rust_fn(ccx, env, &sig, abi);
     debug!("declare_rust_fn llfty={}", ccx.tn().type_to_string(llfty));
 
index 07a8cbc38d5755908199b9adb8308c8ee7a44cb7..5a75a595b5c2114d5d6d36b3bfd266aed01bdb66 100644 (file)
@@ -181,7 +181,7 @@ pub fn trans_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         }
     }
 
-    debug!("trans_into() expr={}", expr.repr(bcx.tcx()));
+    debug!("trans_into() expr={}", expr.repr());
 
     let cleanup_debug_loc = debuginfo::get_cleanup_debug_loc_for_ast_node(bcx.ccx(),
                                                                           expr.id,
@@ -330,8 +330,8 @@ pub fn unsized_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
                             Type::vtable_ptr(ccx))
         }
         _ => ccx.sess().bug(&format!("unsized_info: invalid unsizing {} -> {}",
-                                     source.repr(ccx.tcx()),
-                                     target.repr(ccx.tcx())))
+                                     source.repr(),
+                                     target.repr()))
     }
 }
 
@@ -351,7 +351,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         Some(adj) => { adj }
     };
     debug!("unadjusted datum for expr {}: {} adjustment={:?}",
-           expr.repr(bcx.tcx()),
+           expr.repr(),
            datum.to_string(bcx.ccx()),
            adjustment);
     match adjustment {
@@ -502,7 +502,7 @@ fn coerce_unsized<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                 }
                 vtable => {
                     bcx.sess().span_bug(span, &format!("invalid CoerceUnsized vtable: {}",
-                                                       vtable.repr(bcx.tcx())));
+                                                       vtable.repr()));
                 }
             };
 
@@ -546,8 +546,8 @@ fn coerce_unsized<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             }
         }
         _ => bcx.sess().bug(&format!("coerce_unsized: invalid coercion {} -> {}",
-                                     source.ty.repr(bcx.tcx()),
-                                     target.ty.repr(bcx.tcx())))
+                                     source.ty.repr(),
+                                     target.ty.repr()))
     }
     bcx
 }
@@ -1283,7 +1283,7 @@ pub fn trans_def_fn_unadjusted<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             ccx.tcx().sess.span_bug(ref_expr.span, &format!(
                     "trans_def_fn_unadjusted invoked on: {:?} for {}",
                     def,
-                    ref_expr.repr(ccx.tcx())));
+                    ref_expr.repr()));
         }
     }
 }
@@ -1356,7 +1356,7 @@ pub fn with_field_tys<'tcx, R, F>(tcx: &ty::ctxt<'tcx>,
                     tcx.sess.bug(&format!(
                         "cannot get field types from the enum type {} \
                          without a node ID",
-                        ty.repr(tcx)));
+                        ty.repr()));
                 }
                 Some(node_id) => {
                     let def = tcx.def_map.borrow().get(&node_id).unwrap().full_def();
@@ -1379,7 +1379,7 @@ pub fn with_field_tys<'tcx, R, F>(tcx: &ty::ctxt<'tcx>,
         _ => {
             tcx.sess.bug(&format!(
                 "cannot get field types from the type {}",
-                ty.repr(tcx)));
+                ty.repr()));
         }
     }
 }
@@ -2060,7 +2060,7 @@ fn float_cast(bcx: Block,
     let t_in = expr_ty_adjusted(bcx, expr);
     let t_out = node_id_type(bcx, id);
 
-    debug!("trans_cast({} as {})", t_in.repr(bcx.tcx()), t_out.repr(bcx.tcx()));
+    debug!("trans_cast({} as {})", t_in.repr(), t_out.repr());
     let mut ll_t_in = type_of::arg_type_of(ccx, t_in);
     let ll_t_out = type_of::arg_type_of(ccx, t_out);
     // Convert the value to be cast into a ValueRef, either by-ref or
@@ -2124,8 +2124,8 @@ fn float_cast(bcx: Block,
         _ => ccx.sess().span_bug(expr.span,
                                   &format!("translating unsupported cast: \
                                             {} -> {}",
-                                           t_in.repr(bcx.tcx()),
-                                           t_out.repr(bcx.tcx()))
+                                           t_in.repr(),
+                                           t_out.repr())
                                  )
     };
     return immediate_rvalue_bcx(bcx, newval, t_out).to_expr_datumblock();
@@ -2211,7 +2211,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let ccx = bcx.ccx();
 
     debug!("deref_once(expr={}, datum={}, method_call={:?})",
-           expr.repr(bcx.tcx()),
+           expr.repr(),
            datum.to_string(ccx),
            method_call);
 
@@ -2296,7 +2296,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             bcx.tcx().sess.span_bug(
                 expr.span,
                 &format!("deref invoked on expr of illegal type {}",
-                        datum.ty.repr(bcx.tcx())));
+                        datum.ty.repr()));
         }
     };
 
index 9ad6df5a6aba12e65ab9cba01c0bdba21b399673..bfbcbd92734e5e668f53783ba3a5cee2d2c7e409 100644 (file)
@@ -186,8 +186,8 @@ pub fn register_foreign_item_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     debug!("register_foreign_item_fn(abi={}, \
             ty={}, \
             name={})",
-           abi.repr(ccx.tcx()),
-           fty.repr(ccx.tcx()),
+           abi.repr(),
+           fty.repr(),
            name);
 
     let cc = llvm_calling_convention(ccx, abi);
@@ -238,7 +238,7 @@ pub fn trans_native_call<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     debug!("trans_native_call(callee_ty={}, \
             llfn={}, \
             llretptr={})",
-           callee_ty.repr(tcx),
+           callee_ty.repr(),
            ccx.tn().val_to_string(llfn),
            ccx.tn().val_to_string(llretptr));
 
@@ -613,13 +613,13 @@ fn build_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                 ccx.sess().bug(&format!("build_rust_fn: extern fn {} has ty {}, \
                                         expected a bare fn ty",
                                        ccx.tcx().map.path_to_string(id),
-                                       t.repr(tcx)));
+                                       t.repr()));
             }
         };
 
         debug!("build_rust_fn: path={} id={} t={}",
                ccx.tcx().map.path_to_string(id),
-               id, t.repr(tcx));
+               id, t.repr());
 
         let llfn = declare::define_internal_rust_fn(ccx, &ps[..], t).unwrap_or_else(||{
             ccx.sess().bug(&format!("symbol `{}` already defined", ps));
@@ -641,7 +641,7 @@ unsafe fn build_wrap_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         debug!("build_wrap_fn(llrustfn={}, llwrapfn={}, t={})",
                ccx.tn().val_to_string(llrustfn),
                ccx.tn().val_to_string(llwrapfn),
-               t.repr(ccx.tcx()));
+               t.repr());
 
         // Avoid all the Rust generation stuff and just generate raw
         // LLVM here.
@@ -726,7 +726,7 @@ unsafe fn build_wrap_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                             return_ty={}",
                            ccx.tn().val_to_string(slot),
                            ccx.tn().type_to_string(llrust_ret_ty),
-                           tys.fn_sig.output.repr(tcx));
+                           tys.fn_sig.output.repr());
                     llrust_args.push(slot);
                     return_alloca = Some(slot);
                 }
@@ -818,7 +818,7 @@ unsafe fn build_wrap_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 
         // Perform the call itself
         debug!("calling llrustfn = {}, t = {}",
-               ccx.tn().val_to_string(llrustfn), t.repr(ccx.tcx()));
+               ccx.tn().val_to_string(llrustfn), t.repr());
         let attributes = attributes::from_fn_type(ccx, t);
         let llrust_ret_val = builder.call(llrustfn, &llrust_args, Some(attributes));
 
@@ -940,7 +940,7 @@ fn foreign_types_for_fn_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
            llsig={} -> {}, \
            fn_ty={} -> {}, \
            ret_def={}",
-           ty.repr(ccx.tcx()),
+           ty.repr(),
            ccx.tn().types_to_str(&llsig.llarg_tys),
            ccx.tn().type_to_string(llsig.llret_ty),
            ccx.tn().types_to_str(&fn_ty.arg_tys.iter().map(|t| t.ty).collect::<Vec<_>>()),
index a8e4783fbdd291d30233a2a1cefafa2dd12e5e4d..05cc16c9b8887f173810c8ed365310501601a3b7 100644 (file)
@@ -140,7 +140,7 @@ pub fn drop_ty_core<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                 debug_loc: DebugLoc,
                                 skip_dtor: bool) -> Block<'blk, 'tcx> {
     // NB: v is an *alias* of type t here, not a direct value.
-    debug!("drop_ty_core(t={}, skip_dtor={})", t.repr(bcx.tcx()), skip_dtor);
+    debug!("drop_ty_core(t={}, skip_dtor={})", t.repr(), skip_dtor);
     let _icx = push_ctxt("drop_ty");
     if bcx.fcx.type_needs_drop(t) {
         let ccx = bcx.ccx();
@@ -207,10 +207,10 @@ fn map_ty<F>(&self, mut f: F) -> DropGlueKind<'tcx> where F: FnMut(Ty<'tcx>) ->
     fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
         match *self {
             DropGlueKind::Ty(ty) => {
-                format!("DropGlueKind::Ty({})", ty.repr(ccx.tcx()))
+                format!("DropGlueKind::Ty({})", ty.repr())
             }
             DropGlueKind::TyContents(ty) => {
-                format!("DropGlueKind::TyContents({})", ty.repr(ccx.tcx()))
+                format!("DropGlueKind::TyContents({})", ty.repr())
             }
         }
     }
@@ -249,7 +249,7 @@ fn get_drop_glue_core<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     });
     ccx.available_drop_glues().borrow_mut().insert(g, fn_nm);
 
-    let _s = StatRecorder::new(ccx, format!("drop {}", t.repr(ccx.tcx())));
+    let _s = StatRecorder::new(ccx, format!("drop {}", t.repr()));
 
     let empty_substs = ccx.tcx().mk_substs(Substs::trans_empty());
     let (arena, fcx): (TypedArena<_>, FunctionContext);
index 41780e08b909a4697ecd8b5bcd27c751be4a55e7..c2b0d78ce1f88c588922d1e7dd4c136fd333770b 100644 (file)
@@ -102,7 +102,7 @@ pub fn check_intrinsics(ccx: &CrateContext) {
             continue;
         }
 
-        debug!("transmute_restriction: {}", transmute_restriction.repr(ccx.tcx()));
+        debug!("transmute_restriction: {}", transmute_restriction.repr());
 
         assert!(!ty::type_has_params(transmute_restriction.substituted_from));
         assert!(!ty::type_has_params(transmute_restriction.substituted_to));
@@ -121,10 +121,10 @@ pub fn check_intrinsics(ccx: &CrateContext) {
                     transmute_restriction.span,
                     &format!("transmute called on types with potentially different sizes: \
                               {} (could be {} bit{}) to {} (could be {} bit{})",
-                             transmute_restriction.original_from.user_string(ccx.tcx()),
+                             transmute_restriction.original_from.user_string(),
                              from_type_size as usize,
                              if from_type_size == 1 {""} else {"s"},
-                             transmute_restriction.original_to.user_string(ccx.tcx()),
+                             transmute_restriction.original_to.user_string(),
                              to_type_size as usize,
                              if to_type_size == 1 {""} else {"s"}));
             } else {
@@ -132,10 +132,10 @@ pub fn check_intrinsics(ccx: &CrateContext) {
                     transmute_restriction.span,
                     &format!("transmute called on types with different sizes: \
                               {} ({} bit{}) to {} ({} bit{})",
-                             transmute_restriction.original_from.user_string(ccx.tcx()),
+                             transmute_restriction.original_from.user_string(),
                              from_type_size as usize,
                              if from_type_size == 1 {""} else {"s"},
-                             transmute_restriction.original_to.user_string(ccx.tcx()),
+                             transmute_restriction.original_to.user_string(),
                              to_type_size as usize,
                              if to_type_size == 1 {""} else {"s"}));
             }
@@ -405,7 +405,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
         }
         (_, "type_name") => {
             let tp_ty = *substs.types.get(FnSpace, 0);
-            let ty_name = token::intern_and_get_ident(&tp_ty.user_string(ccx.tcx()));
+            let ty_name = token::intern_and_get_ident(&tp_ty.user_string());
             C_str_slice(ccx, ty_name)
         }
         (_, "type_id") => {
index 7827771994f9809b6a28487ae828f45e40a1d9f3..7229995048aa2f7c3e76a30862b6ec7c9ceb4171 100644 (file)
@@ -62,7 +62,7 @@ pub fn trans_impl(ccx: &CrateContext,
     let _icx = push_ctxt("meth::trans_impl");
     let tcx = ccx.tcx();
 
-    debug!("trans_impl(name={}, id={})", name.repr(tcx), id);
+    debug!("trans_impl(name={}, id={})", name.repr(), id);
 
     let mut v = TransItemVisitor { ccx: ccx };
 
@@ -138,13 +138,13 @@ pub fn trans_method_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             let span = bcx.tcx().map.span(method_call.expr_id);
             debug!("method_call={:?} trait_ref={} trait_ref id={:?} substs={:?}",
                    method_call,
-                   trait_ref.repr(bcx.tcx()),
+                   trait_ref.repr(),
                    trait_ref.0.def_id,
                    trait_ref.0.substs);
             let origin = fulfill_obligation(bcx.ccx(),
                                             span,
                                             trait_ref.clone());
-            debug!("origin = {}", origin.repr(bcx.tcx()));
+            debug!("origin = {}", origin.repr());
             trans_monomorphized_callee(bcx,
                                        method_call,
                                        trait_ref.def_id(),
@@ -234,7 +234,7 @@ pub fn trans_static_method_callee<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                              rcvr_self,
                                              Vec::new()));
     let trait_substs = tcx.mk_substs(trait_substs);
-    debug!("trait_substs={}", trait_substs.repr(tcx));
+    debug!("trait_substs={}", trait_substs.repr());
     let trait_ref = ty::Binder(ty::TraitRef { def_id: trait_id,
                                               substs: trait_substs });
     let vtbl = fulfill_obligation(ccx,
@@ -297,7 +297,7 @@ pub fn trans_static_method_callee<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         }
         _ => {
             tcx.sess.bug(&format!("static call to invalid vtable: {}",
-                                 vtbl.repr(tcx)));
+                                 vtbl.repr()));
         }
     }
 }
@@ -391,7 +391,7 @@ fn trans_monomorphized_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         traits::VtableParam(..) => {
             bcx.sess().bug(
                 &format!("resolved vtable bad vtable {} in trans",
-                        vtable.repr(bcx.tcx())));
+                        vtable.repr()));
         }
     }
 }
@@ -415,8 +415,8 @@ fn combine_impl_and_methods_tps<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
     let node_substs = node_id_substs(ccx, node, bcx.fcx.param_substs);
 
-    debug!("rcvr_substs={}", rcvr_substs.repr(ccx.tcx()));
-    debug!("node_substs={}", node_substs.repr(ccx.tcx()));
+    debug!("rcvr_substs={}", rcvr_substs.repr());
+    debug!("node_substs={}", node_substs.repr());
 
     // Break apart the type parameters from the node and type
     // parameters from the receiver.
@@ -484,7 +484,7 @@ pub fn trans_trait_callee_from_llval<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
     // Load the data pointer from the object.
     debug!("trans_trait_callee_from_llval(callee_ty={}, vtable_index={}, llpair={})",
-           callee_ty.repr(ccx.tcx()),
+           callee_ty.repr(),
            vtable_index,
            bcx.val_to_string(llpair));
     let llboxptr = GEPi(bcx, llpair, &[0, abi::FAT_PTR_ADDR]);
@@ -557,8 +557,8 @@ pub fn trans_object_shim<'a, 'tcx>(
     let trait_id = upcast_trait_ref.def_id();
 
     debug!("trans_object_shim(object_ty={}, upcast_trait_ref={}, method_offset_in_trait={})",
-           object_ty.repr(tcx),
-           upcast_trait_ref.repr(tcx),
+           object_ty.repr(),
+           upcast_trait_ref.repr(),
            method_offset_in_trait);
 
     let object_trait_ref =
@@ -568,14 +568,14 @@ pub fn trans_object_shim<'a, 'tcx>(
             }
             _ => {
                 tcx.sess.bug(&format!("trans_object_shim() called on non-object: {}",
-                                      object_ty.repr(tcx)));
+                                      object_ty.repr()));
             }
         };
 
     // Upcast to the trait in question and extract out the substitutions.
     let upcast_trait_ref = ty::erase_late_bound_regions(tcx, &upcast_trait_ref);
     let object_substs = upcast_trait_ref.substs.clone().erase_regions();
-    debug!("trans_object_shim: object_substs={}", object_substs.repr(tcx));
+    debug!("trans_object_shim: object_substs={}", object_substs.repr());
 
     // Lookup the type of this method as declared in the trait and apply substitutions.
     let method_ty = match ty::trait_item(tcx, trait_id, method_offset_in_trait) {
@@ -587,7 +587,7 @@ pub fn trans_object_shim<'a, 'tcx>(
     let fty = monomorphize::apply_param_substs(tcx, &object_substs, &method_ty.fty);
     let fty = tcx.mk_bare_fn(fty);
     let method_ty = opaque_method_ty(tcx, fty);
-    debug!("trans_object_shim: fty={} method_ty={}", fty.repr(tcx), method_ty.repr(tcx));
+    debug!("trans_object_shim: fty={} method_ty={}", fty.repr(), method_ty.repr());
 
     //
     let shim_fn_ty = ty::mk_bare_fn(tcx, None, fty);
@@ -628,7 +628,7 @@ pub fn trans_object_shim<'a, 'tcx>(
                     _ => {
                         bcx.sess().bug(
                             &format!("rust-call expects a tuple not {}",
-                                     sig.inputs[1].repr(tcx)));
+                                     sig.inputs[1].repr()));
                     }
                 }
             }
@@ -692,7 +692,7 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     let tcx = ccx.tcx();
     let _icx = push_ctxt("meth::get_vtable");
 
-    debug!("get_vtable(trait_ref={})", trait_ref.repr(tcx));
+    debug!("get_vtable(trait_ref={})", trait_ref.repr());
 
     // Check the cache.
     match ccx.vtables().borrow().get(&trait_ref) {
@@ -740,13 +740,13 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                 // cannot cast an unsized type into a trait object
                 tcx.sess.bug(
                     &format!("cannot get vtable for an object type: {}",
-                            data.repr(tcx)));
+                            data.repr()));
             }
             traits::VtableParam(..) => {
                 tcx.sess.bug(
                     &format!("resolved vtable for {} to bad vtable {} in trans",
-                            trait_ref.repr(tcx),
-                            vtable.repr(tcx)));
+                            trait_ref.repr(),
+                            vtable.repr()));
             }
         }
     });
@@ -777,9 +777,9 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     let tcx = ccx.tcx();
 
     debug!("emit_vtable_methods(impl_id={}, substs={}, param_substs={})",
-           impl_id.repr(tcx),
-           substs.repr(tcx),
-           param_substs.repr(tcx));
+           impl_id.repr(),
+           substs.repr(),
+           param_substs.repr());
 
     let trt_id = match ty::impl_trait_ref(tcx, impl_id) {
         Some(t_id) => t_id.def_id,
@@ -807,7 +807,7 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         // null.
         .map(|trait_method_def_id| {
             debug!("emit_vtable_methods: trait_method_def_id={}",
-                   trait_method_def_id.repr(tcx));
+                   trait_method_def_id.repr());
 
             let trait_method_type = match ty::impl_or_trait_item(tcx, trait_method_def_id) {
                 ty::MethodTraitItem(m) => m,
@@ -822,7 +822,7 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             }
 
             debug!("emit_vtable_methods: trait_method_type={}",
-                   trait_method_type.repr(tcx));
+                   trait_method_type.repr());
 
             // The substitutions we have are on the impl, so we grab
             // the method type from the impl to substitute into.
@@ -833,7 +833,7 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             };
 
             debug!("emit_vtable_methods: impl_method_type={}",
-                   impl_method_type.repr(tcx));
+                   impl_method_type.repr());
 
             // If this is a default method, it's possible that it
             // relies on where clauses that do not hold for this
index e28dd77d5e58e008ddf2c52dd8ccafe8667e0789..37447169600096b6993a1595256f12d9de67e749 100644 (file)
@@ -44,8 +44,8 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             fn_id={}, \
             real_substs={}, \
             ref_id={:?})",
-           fn_id.repr(ccx.tcx()),
-           psubsts.repr(ccx.tcx()),
+           fn_id.repr(),
+           psubsts.repr(),
            ref_id);
 
     assert!(psubsts.types.all(|t| {
@@ -61,7 +61,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 
     let item_ty = ty::lookup_item_type(ccx.tcx(), fn_id).ty;
 
-    debug!("monomorphic_fn about to subst into {}", item_ty.repr(ccx.tcx()));
+    debug!("monomorphic_fn about to subst into {}", item_ty.repr());
     let mono_ty = item_ty.subst(ccx.tcx(), psubsts);
 
     match ccx.monomorphized().borrow().get(&hash_id) {
@@ -77,8 +77,8 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             fn_id={}, \
             psubsts={}, \
             hash_id={:?})",
-           fn_id.repr(ccx.tcx()),
-           psubsts.repr(ccx.tcx()),
+           fn_id.repr(),
+           psubsts.repr(),
            hash_id);
 
 
@@ -99,10 +99,10 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         }
     }
 
-    debug!("mono_ty = {} (post-substitution)", mono_ty.repr(ccx.tcx()));
+    debug!("mono_ty = {} (post-substitution)", mono_ty.repr());
 
     let mono_ty = normalize_associated_type(ccx.tcx(), &mono_ty);
-    debug!("mono_ty = {} (post-normalization)", mono_ty.repr(ccx.tcx()));
+    debug!("mono_ty = {} (post-normalization)", mono_ty.repr());
 
     ccx.stats().n_monos.set(ccx.stats().n_monos.get() + 1);
 
@@ -303,7 +303,7 @@ pub fn apply_param_substs<'tcx,T>(tcx: &ty::ctxt<'tcx>,
                                   param_substs: &Substs<'tcx>,
                                   value: &T)
                                   -> T
-    where T : TypeFoldable<'tcx> + Repr<'tcx> + HasProjectionTypes + Clone
+    where T : TypeFoldable<'tcx> + Repr + HasProjectionTypes + Clone
 {
     let substituted = value.subst(tcx, param_substs);
     normalize_associated_type(tcx, &substituted)
@@ -314,9 +314,9 @@ pub fn apply_param_substs<'tcx,T>(tcx: &ty::ctxt<'tcx>,
 /// and hence we can be sure that all associated types will be
 /// completely normalized away.
 pub fn normalize_associated_type<'tcx,T>(tcx: &ty::ctxt<'tcx>, value: &T) -> T
-    where T : TypeFoldable<'tcx> + Repr<'tcx> + HasProjectionTypes + Clone
+    where T : TypeFoldable<'tcx> + Repr + HasProjectionTypes + Clone
 {
-    debug!("normalize_associated_type(t={})", value.repr(tcx));
+    debug!("normalize_associated_type(t={})", value.repr());
 
     let value = erase_regions(tcx, value);
 
@@ -334,8 +334,8 @@ pub fn normalize_associated_type<'tcx,T>(tcx: &ty::ctxt<'tcx>, value: &T) -> T
         traits::normalize(&mut selcx, cause, &value);
 
     debug!("normalize_associated_type: result={} obligations={}",
-           result.repr(tcx),
-           obligations.repr(tcx));
+           result.repr(),
+           obligations.repr());
 
     let mut fulfill_cx = traits::FulfillmentContext::new(true);
     for obligation in obligations {
index df3fd72cc462390bd8a1e85f61af88b4ad43e3f2..f2168d38c9e57c631f0c9c82bb33d5bd752f35d3 100644 (file)
@@ -42,7 +42,7 @@ struct VecTypes<'tcx> {
 impl<'tcx> VecTypes<'tcx> {
     pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
         format!("VecTypes {{unit_ty={}, llunit_ty={}}}",
-                self.unit_ty.user_string(ccx.tcx()),
+                self.unit_ty.user_string(),
                 ccx.tn().type_to_string(self.llunit_ty))
     }
 }
index ecbeb714b4a9446f69e48484895ac49d0aeeb45c..4ec6edcea714db5dcd9dab86c44f0930c18a25ff 100644 (file)
@@ -100,7 +100,7 @@ pub fn type_of_rust_fn<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                  -> Type
 {
     debug!("type_of_rust_fn(sig={},abi={:?})",
-           sig.repr(cx.tcx()),
+           sig.repr(),
            abi);
 
     let sig = ty::erase_late_bound_regions(cx.tcx(), sig);
@@ -229,7 +229,7 @@ pub fn sizing_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Typ
 
         ty::TyProjection(..) | ty::TyInfer(..) | ty::TyParam(..) | ty::TyError(..) => {
             cx.sess().bug(&format!("fictitious type {} in sizing_type_of()",
-                                   t.repr(cx.tcx())))
+                                   t.repr()))
         }
         ty::TySlice(_) | ty::TyTrait(..) | ty::TyStr => unreachable!()
     };
@@ -298,7 +298,7 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
         None => ()
     }
 
-    debug!("type_of {} {:?}", t.repr(cx.tcx()), t.sty);
+    debug!("type_of {} {:?}", t.repr(), t.sty);
 
     assert!(!t.has_escaping_regions());
 
@@ -312,9 +312,9 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
     if t != t_norm {
         let llty = in_memory_type_of(cx, t_norm);
         debug!("--> normalized {} {:?} to {} {:?} llty={}",
-                t.repr(cx.tcx()),
+                t.repr(),
                 t,
-                t_norm.repr(cx.tcx()),
+                t_norm.repr(),
                 t_norm,
                 cx.tn().type_to_string(llty));
         cx.lltypes().borrow_mut().insert(t, llty);
@@ -364,7 +364,7 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
                       ty::TyTrait(_) => Type::vtable_ptr(cx),
                       _ => panic!("Unexpected type returned from \
                                    struct_tail: {} for ty={}",
-                                  unsized_part.repr(cx.tcx()), ty.repr(cx.tcx()))
+                                  unsized_part.repr(), ty.repr())
                   };
                   Type::struct_(cx, &[ptr_ty, info_ty], false)
               }
@@ -419,7 +419,7 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
     };
 
     debug!("--> mapped t={} {:?} to llty={}",
-            t.repr(cx.tcx()),
+            t.repr(),
             t,
             cx.tn().type_to_string(llty));
 
@@ -449,7 +449,7 @@ fn llvm_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                             tps: &[Ty<'tcx>])
                             -> String {
     let base = ty::item_path_str(cx.tcx(), did);
-    let strings: Vec<String> = tps.iter().map(|t| t.repr(cx.tcx())).collect();
+    let strings: Vec<String> = tps.iter().map(|t| t.repr()).collect();
     let tstr = if strings.is_empty() {
         base
     } else {
index cec267b8f7658312fbde6e32944bb8092365e569..b7516530e6f1885d94a52208599b56be71e97595 100644 (file)
@@ -179,9 +179,9 @@ pub fn ast_region_to_region(tcx: &ty::ctxt, lifetime: &ast::Lifetime)
     };
 
     debug!("ast_region_to_region(lifetime={} id={}) yields {}",
-           lifetime.repr(tcx),
+           lifetime.repr(),
            lifetime.id,
-           r.repr(tcx));
+           r.repr());
 
     r
 }
@@ -257,8 +257,8 @@ pub fn opt_ast_region_to_region<'tcx>(
     };
 
     debug!("opt_ast_region_to_region(opt_lifetime={}) yields {}",
-            opt_lifetime.repr(this.tcx()),
-            r.repr(this.tcx()));
+            opt_lifetime.repr(),
+            r.repr());
 
     r
 }
@@ -375,8 +375,8 @@ fn create_substs_for_ast_path<'tcx>(
 
     debug!("create_substs_for_ast_path(decl_generics={}, self_ty={}, \
            types_provided={}, region_substs={}",
-           decl_generics.repr(tcx), self_ty.repr(tcx), types_provided.repr(tcx),
-           region_substs.repr(tcx));
+           decl_generics.repr(), self_ty.repr(), types_provided.repr(),
+           region_substs.repr());
 
     assert_eq!(region_substs.regions().len(TypeSpace), decl_generics.regions.len(TypeSpace));
     assert!(region_substs.types.is_empty());
@@ -441,8 +441,8 @@ fn create_substs_for_ast_path<'tcx>(
                           "the type parameter `{}` must be explicitly specified \
                            in an object type because its default value `{}` references \
                            the type `Self`",
-                          param.name.user_string(tcx),
-                          default.user_string(tcx));
+                          param.name.user_string(),
+                          default.user_string());
                 substs.types.push(TypeSpace, tcx.types.err);
             } else {
                 // This is a default type parameter.
@@ -649,7 +649,7 @@ fn trait_def_id<'tcx>(this: &AstConv<'tcx>, trait_ref: &ast::TraitRef) -> ast::D
         def::DefTrait(trait_def_id) => trait_def_id,
         _ => {
             span_fatal!(this.tcx().sess, path.span, E0245, "`{}` is not a trait",
-                        path.user_string(this.tcx()));
+                        path.user_string());
         }
     }
 }
@@ -879,7 +879,7 @@ fn ast_type_binding_to_poly_projection_predicate<'tcx>(
 
     let candidate = try!(one_bound_for_assoc_type(tcx,
                                                   candidates,
-                                                  &trait_ref.user_string(tcx),
+                                                  &trait_ref.user_string(),
                                                   &token::get_name(binding.item_name),
                                                   binding.span));
 
@@ -1031,7 +1031,7 @@ fn trait_ref_to_object_type<'tcx>(this: &AstConv<'tcx>,
 
     let result = make_object_type(this, span, trait_ref, existential_bounds);
     debug!("trait_ref_to_object_type: result={}",
-           result.repr(this.tcx()));
+           result.repr());
 
     result
 }
@@ -1074,7 +1074,7 @@ fn make_object_type<'tcx>(this: &AstConv<'tcx>,
     for (trait_def_id, name) in associated_types {
         span_err!(tcx.sess, span, E0191,
             "the value of the associated type `{}` (from the trait `{}`) must be specified",
-                    name.user_string(tcx),
+                    name.user_string(),
                     ty::item_path_str(tcx, trait_def_id));
     }
 
@@ -1160,7 +1160,7 @@ fn one_bound_for_assoc_type<'tcx>(tcx: &ty::ctxt<'tcx>,
             span_note!(tcx.sess, span,
                        "associated type `{}` could derive from `{}`",
                        ty_param_name,
-                       bound.user_string(tcx));
+                       bound.user_string());
         }
     }
 
@@ -1183,7 +1183,7 @@ fn associated_path_def_to_ty<'tcx>(this: &AstConv<'tcx>,
     let tcx = this.tcx();
     let assoc_name = item_segment.identifier.name;
 
-    debug!("associated_path_def_to_ty: {}::{}", ty.repr(tcx), token::get_name(assoc_name));
+    debug!("associated_path_def_to_ty: {}::{}", ty.repr(), token::get_name(assoc_name));
 
     check_path_args(tcx, slice::ref_slice(item_segment), NO_TPS | NO_REGIONS);
 
@@ -1239,7 +1239,7 @@ fn associated_path_def_to_ty<'tcx>(this: &AstConv<'tcx>,
         _ => {
             report_ambiguous_associated_type(tcx,
                                              span,
-                                             &ty.user_string(tcx),
+                                             &ty.user_string(),
                                              "Trait",
                                              &token::get_name(assoc_name));
             return (tcx.types.err, ty_path_def);
@@ -1296,7 +1296,7 @@ fn qpath_to_ty<'tcx>(this: &AstConv<'tcx>,
         return tcx.types.err;
     };
 
-    debug!("qpath_to_ty: self_type={}", self_ty.repr(tcx));
+    debug!("qpath_to_ty: self_type={}", self_ty.repr());
 
     let trait_ref = ast_path_to_mono_trait_ref(this,
                                                rscope,
@@ -1306,7 +1306,7 @@ fn qpath_to_ty<'tcx>(this: &AstConv<'tcx>,
                                                Some(self_ty),
                                                trait_segment);
 
-    debug!("qpath_to_ty: trait_ref={}", trait_ref.repr(tcx));
+    debug!("qpath_to_ty: trait_ref={}", trait_ref.repr());
 
     this.projected_ty(span, trait_ref, item_segment.identifier.name)
 }
@@ -1496,7 +1496,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
                           -> Ty<'tcx>
 {
     debug!("ast_ty_to_ty(ast_ty={})",
-           ast_ty.repr(this.tcx()));
+           ast_ty.repr());
 
     let tcx = this.tcx();
 
@@ -1531,7 +1531,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
         }
         ast::TyRptr(ref region, ref mt) => {
             let r = opt_ast_region_to_region(this, rscope, ast_ty.span, region);
-            debug!("TyRef r={}", r.repr(this.tcx()));
+            debug!("TyRef r={}", r.repr());
             let rscope1 =
                 &ObjectLifetimeDefaultRscope::new(
                     rscope,
@@ -1569,7 +1569,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
                 }
             } else {
                 tcx.sess.span_bug(ast_ty.span,
-                                  &format!("unbound path {}", ast_ty.repr(tcx)))
+                                  &format!("unbound path {}", ast_ty.repr()))
             };
             let def = path_res.base_def;
             let base_ty_end = path.segments.len() - path_res.depth;
@@ -1846,8 +1846,8 @@ fn determine_explicit_self_category<'a, 'tcx>(this: &AstConv<'tcx>,
             debug!("determine_explicit_self_category(self_info.untransformed_self_ty={} \
                    explicit_type={} \
                    modifiers=({},{})",
-                   self_info.untransformed_self_ty.repr(this.tcx()),
-                   explicit_type.repr(this.tcx()),
+                   self_info.untransformed_self_ty.repr(),
+                   explicit_type.repr(),
                    impl_modifiers,
                    method_modifiers);
 
@@ -1881,7 +1881,7 @@ pub fn ty_of_closure<'tcx>(
     -> ty::ClosureTy<'tcx>
 {
     debug!("ty_of_closure(expected_sig={})",
-           expected_sig.repr(this.tcx()));
+           expected_sig.repr());
 
     // new region names that appear inside of the fn decl are bound to
     // that function type
@@ -1919,8 +1919,8 @@ pub fn ty_of_closure<'tcx>(
         ast::NoReturn(..) => ty::FnDiverging
     };
 
-    debug!("ty_of_closure: input_tys={}", input_tys.repr(this.tcx()));
-    debug!("ty_of_closure: output_ty={}", output_ty.repr(this.tcx()));
+    debug!("ty_of_closure: input_tys={}", input_tys.repr());
+    debug!("ty_of_closure: output_ty={}", output_ty.repr());
 
     ty::ClosureTy {
         unsafety: unsafety,
@@ -2039,8 +2039,8 @@ fn compute_object_lifetime_bound<'tcx>(
     debug!("compute_opt_region_bound(explicit_region_bounds={:?}, \
            principal_trait_ref={}, builtin_bounds={})",
            explicit_region_bounds,
-           principal_trait_ref.repr(tcx),
-           builtin_bounds.repr(tcx));
+           principal_trait_ref.repr(),
+           builtin_bounds.repr());
 
     if explicit_region_bounds.len() > 1 {
         span_err!(tcx.sess, explicit_region_bounds[1].span, E0226,
index 2f1447e0714685d68811c5da78a71e2959317236..0f1498e2be7e2ea8bcb226cc1846a66ab8eca7d7 100644 (file)
@@ -41,8 +41,8 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
     let tcx = pcx.fcx.ccx.tcx;
 
     debug!("check_pat(pat={},expected={})",
-           pat.repr(tcx),
-           expected.repr(tcx));
+           pat.repr(),
+           expected.repr());
 
     match pat.node {
         ast::PatWild(_) => {
@@ -222,7 +222,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
                 }
             } else {
                 tcx.sess.span_bug(pat.span,
-                                  &format!("unbound path {}", pat.repr(tcx)))
+                                  &format!("unbound path {}", pat.repr()))
             };
             if let Some((opt_ty, segments, def)) =
                     resolve_ty_and_def_ufcs(fcx, path_res, Some(self_ty),
index 377af080526b7084a961c372de6535587d5cb511..334fe2f54c03c24275bbf9f2663f6905098c52f7 100644 (file)
@@ -24,15 +24,15 @@ pub fn normalize_associated_types_in<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
                                                 body_id: ast::NodeId,
                                                 value: &T)
                                                 -> T
-    where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr<'tcx>
+    where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr
 {
-    debug!("normalize_associated_types_in(value={})", value.repr(infcx.tcx));
+    debug!("normalize_associated_types_in(value={})", value.repr());
     let mut selcx = SelectionContext::new(infcx, typer);
     let cause = ObligationCause::new(span, body_id, MiscObligation);
     let Normalized { value: result, obligations } = traits::normalize(&mut selcx, cause, value);
     debug!("normalize_associated_types_in: result={} predicates={}",
-           result.repr(infcx.tcx),
-           obligations.repr(infcx.tcx));
+           result.repr(),
+           obligations.repr());
     for obligation in obligations {
         fulfillment_cx.register_predicate_obligation(infcx, obligation);
     }
index aa2433a362a704098ac2000e786edb4f17d90127..a5422e1e58e57c7e83e3fa5c6735c625999873f0 100644 (file)
@@ -121,8 +121,8 @@ fn try_overloaded_call_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                       -> Option<CallStep<'tcx>>
 {
     debug!("try_overloaded_call_step(call_expr={}, adjusted_ty={}, autoderefs={})",
-           call_expr.repr(fcx.tcx()),
-           adjusted_ty.repr(fcx.tcx()),
+           call_expr.repr(),
+           adjusted_ty.repr(),
            autoderefs);
 
     // If the callee is a bare function or a closure, then we're all set.
@@ -337,23 +337,23 @@ struct CallResolution<'tcx> {
     closure_def_id: ast::DefId,
 }
 
-impl<'tcx> Repr<'tcx> for CallResolution<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for CallResolution<'tcx> {
+    fn repr(&self) -> String {
         format!("CallResolution(call_expr={}, callee_expr={}, adjusted_ty={}, \
                 autoderefs={}, fn_sig={}, closure_def_id={})",
-                self.call_expr.repr(tcx),
-                self.callee_expr.repr(tcx),
-                self.adjusted_ty.repr(tcx),
+                self.call_expr.repr(),
+                self.callee_expr.repr(),
+                self.adjusted_ty.repr(),
                 self.autoderefs,
-                self.fn_sig.repr(tcx),
-                self.closure_def_id.repr(tcx))
+                self.fn_sig.repr(),
+                self.closure_def_id.repr())
     }
 }
 
 impl<'tcx> DeferredCallResolution<'tcx> for CallResolution<'tcx> {
     fn resolve<'a>(&mut self, fcx: &FnCtxt<'a,'tcx>) {
         debug!("DeferredCallResolution::resolve() {}",
-               self.repr(fcx.tcx()));
+               self.repr());
 
         // we should not be invoked until the closure kind has been
         // determined by upvar inference
@@ -376,7 +376,7 @@ fn resolve<'a>(&mut self, fcx: &FnCtxt<'a,'tcx>) {
                                               ty::ty_fn_sig(method_callee.ty)).unwrap();
 
                 debug!("attempt_resolution: method_callee={}",
-                       method_callee.repr(fcx.tcx()));
+                       method_callee.repr());
 
                 for (&method_arg_ty, &self_arg_ty) in
                     method_sig.inputs[1..].iter().zip(&self.fn_sig.inputs)
index 9fefd7ac03690722ebf4de957b47d7cbc22bf03e..14976bf95593fd6b4ea1e1fac00bb070a77e4f70 100644 (file)
@@ -192,8 +192,8 @@ pub fn check<'a>(mut self, fcx: &FnCtxt<'a, 'tcx>) {
         self.expr_ty = structurally_resolved_type(fcx, self.span, self.expr_ty);
         self.cast_ty = structurally_resolved_type(fcx, self.span, self.cast_ty);
 
-        debug!("check_cast({}, {} as {})", self.expr.id, self.expr_ty.repr(fcx.tcx()),
-               self.cast_ty.repr(fcx.tcx()));
+        debug!("check_cast({}, {} as {})", self.expr.id, self.expr_ty.repr(),
+               self.cast_ty.repr());
 
         if ty::type_is_error(self.expr_ty) || ty::type_is_error(self.cast_ty) {
             // No sense in giving duplicate error messages
@@ -274,7 +274,7 @@ fn check_ptr_ptr_cast<'a>(&self,
                               -> Result<CastKind, CastError>
     {
         debug!("check_ptr_ptr_cast m_expr={} m_cast={}",
-               m_expr.repr(fcx.tcx()), m_cast.repr(fcx.tcx()));
+               m_expr.repr(), m_cast.repr());
         // ptr-ptr cast. vtables must match.
 
         // Cast to sized is OK
index cac0a86124ee330a8ac5972bfd48b7cdecb5a537..16d4c0f997ae16c67919d6acd78350108a897fe1 100644 (file)
@@ -29,8 +29,8 @@ pub fn check_expr_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                                    body: &'tcx ast::Block,
                                    expected: Expectation<'tcx>) {
     debug!("check_expr_closure(expr={},expected={})",
-           expr.repr(fcx.tcx()),
-           expected.repr(fcx.tcx()));
+           expr.repr(),
+           expected.repr());
 
     // It's always helpful for inference if we know the kind of
     // closure sooner rather than later, so first examine the expected
@@ -52,7 +52,7 @@ fn check_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
 
     debug!("check_closure opt_kind={:?} expected_sig={}",
            opt_kind,
-           expected_sig.repr(fcx.tcx()));
+           expected_sig.repr());
 
     let mut fn_ty = astconv::ty_of_closure(
         fcx,
@@ -87,8 +87,8 @@ fn check_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
     fn_ty.sig.0.inputs = vec![ty::mk_tup(fcx.tcx(), fn_ty.sig.0.inputs)];
 
     debug!("closure for {} --> sig={} opt_kind={:?}",
-           expr_def_id.repr(fcx.tcx()),
-           fn_ty.sig.repr(fcx.tcx()),
+           expr_def_id.repr(),
+           fn_ty.sig.repr(),
            opt_kind);
 
     fcx.inh.closure_tys.borrow_mut().insert(expr_def_id, fn_ty);
@@ -104,7 +104,7 @@ fn deduce_expectations_from_expected_type<'a,'tcx>(
     -> (Option<ty::FnSig<'tcx>>,Option<ty::ClosureKind>)
 {
     debug!("deduce_expectations_from_expected_type(expected_ty={})",
-           expected_ty.repr(fcx.tcx()));
+           expected_ty.repr());
 
     match expected_ty.sty {
         ty::TyTrait(ref object_type) => {
@@ -139,7 +139,7 @@ fn deduce_expectations_from_obligations<'a,'tcx>(
         .iter()
         .filter_map(|obligation| {
             debug!("deduce_expectations_from_obligations: obligation.predicate={}",
-                   obligation.predicate.repr(fcx.tcx()));
+                   obligation.predicate.repr());
 
             match obligation.predicate {
                 // Given a Projection predicate, we can potentially infer
@@ -201,7 +201,7 @@ fn deduce_sig_from_projection<'a,'tcx>(
     let tcx = fcx.tcx();
 
     debug!("deduce_sig_from_projection({})",
-           projection.repr(tcx));
+           projection.repr());
 
     let trait_ref = projection.to_poly_trait_ref();
 
@@ -211,24 +211,24 @@ fn deduce_sig_from_projection<'a,'tcx>(
 
     let arg_param_ty = *trait_ref.substs().types.get(subst::TypeSpace, 0);
     let arg_param_ty = fcx.infcx().resolve_type_vars_if_possible(&arg_param_ty);
-    debug!("deduce_sig_from_projection: arg_param_ty {}", arg_param_ty.repr(tcx));
+    debug!("deduce_sig_from_projection: arg_param_ty {}", arg_param_ty.repr());
 
     let input_tys = match arg_param_ty.sty {
         ty::TyTuple(ref tys) => { (*tys).clone() }
         _ => { return None; }
     };
-    debug!("deduce_sig_from_projection: input_tys {}", input_tys.repr(tcx));
+    debug!("deduce_sig_from_projection: input_tys {}", input_tys.repr());
 
     let ret_param_ty = projection.0.ty;
     let ret_param_ty = fcx.infcx().resolve_type_vars_if_possible(&ret_param_ty);
-    debug!("deduce_sig_from_projection: ret_param_ty {}", ret_param_ty.repr(tcx));
+    debug!("deduce_sig_from_projection: ret_param_ty {}", ret_param_ty.repr());
 
     let fn_sig = ty::FnSig {
         inputs: input_tys,
         output: ty::FnConverging(ret_param_ty),
         variadic: false
     };
-    debug!("deduce_sig_from_projection: fn_sig {}", fn_sig.repr(tcx));
+    debug!("deduce_sig_from_projection: fn_sig {}", fn_sig.repr());
 
     Some(fn_sig)
 }
@@ -241,8 +241,8 @@ fn self_type_matches_expected_vid<'a,'tcx>(
 {
     let self_ty = fcx.infcx().shallow_resolve(trait_ref.self_ty());
     debug!("self_type_matches_expected_vid(trait_ref={}, self_ty={})",
-           trait_ref.repr(fcx.tcx()),
-           self_ty.repr(fcx.tcx()));
+           trait_ref.repr(),
+           self_ty.repr());
     match self_ty.sty {
         ty::TyInfer(ty::TyVar(v)) if expected_vid == v => Some(trait_ref),
         _ => None,
index 2c332b65a48d4015c3c144e1ee675d89e392e523..d10a605adb4270d8ddc02b3fba7e871f96ec6cb9 100644 (file)
@@ -105,8 +105,8 @@ fn coerce(&self,
               b: Ty<'tcx>)
               -> CoerceResult<'tcx> {
         debug!("Coerce.tys({} => {})",
-               a.repr(self.tcx()),
-               b.repr(self.tcx()));
+               a.repr(),
+               b.repr());
 
         // Consider coercing the subtype to a DST
         let unsize = self.unpack_actual_value(a, |a| {
@@ -167,8 +167,8 @@ fn coerce_borrowed_pointer(&self,
                                mutbl_b: ast::Mutability)
                                -> CoerceResult<'tcx> {
         debug!("coerce_borrowed_pointer(a={}, b={})",
-               a.repr(self.tcx()),
-               b.repr(self.tcx()));
+               a.repr(),
+               b.repr());
 
         // If we have a parameter of type `&M T_a` and the value
         // provided is `expr`, we will be adding an implicit borrow,
@@ -239,8 +239,8 @@ fn coerce_unsized(&self,
                       target: Ty<'tcx>)
                       -> CoerceResult<'tcx> {
         debug!("coerce_unsized(source={}, target={})",
-               source.repr(self.tcx()),
-               target.repr(self.tcx()));
+               source.repr(),
+               target.repr());
 
         let traits = (self.tcx().lang_items.unsize_trait(),
                       self.tcx().lang_items.coerce_unsized_trait());
@@ -294,7 +294,7 @@ fn coerce_unsized(&self,
         // inference might unify those two inner type variables later.
         let traits = [coerce_unsized_did, unsize_did];
         while let Some(obligation) = queue.pop_front() {
-            debug!("coerce_unsized resolve step: {}", obligation.repr(self.tcx()));
+            debug!("coerce_unsized resolve step: {}", obligation.repr());
             let trait_ref =  match obligation.predicate {
                 ty::Predicate::Trait(ref tr) if traits.contains(&tr.def_id()) => {
                     tr.clone()
@@ -336,7 +336,7 @@ fn coerce_unsized(&self,
             autoref: reborrow,
             unsize: Some(target)
         };
-        debug!("Success, coerced with {}", adjustment.repr(self.tcx()));
+        debug!("Success, coerced with {}", adjustment.repr());
         Ok(Some(AdjustDerefRef(adjustment)))
     }
 
@@ -353,7 +353,7 @@ fn coerce_from_fn_pointer(&self,
 
         self.unpack_actual_value(b, |b| {
             debug!("coerce_from_fn_pointer(a={}, b={})",
-                   a.repr(self.tcx()), b.repr(self.tcx()));
+                   a.repr(), b.repr());
 
             if let ty::TyBareFn(None, fn_ty_b) = b.sty {
                 match (fn_ty_a.unsafety, fn_ty_b.unsafety) {
@@ -381,7 +381,7 @@ fn coerce_from_fn_item(&self,
 
         self.unpack_actual_value(b, |b| {
             debug!("coerce_from_fn_item(a={}, b={})",
-                   a.repr(self.tcx()), b.repr(self.tcx()));
+                   a.repr(), b.repr());
 
             match b.sty {
                 ty::TyBareFn(None, _) => {
@@ -400,8 +400,8 @@ fn coerce_unsafe_ptr(&self,
                          mutbl_b: ast::Mutability)
                          -> CoerceResult<'tcx> {
         debug!("coerce_unsafe_ptr(a={}, b={})",
-               a.repr(self.tcx()),
-               b.repr(self.tcx()));
+               a.repr(),
+               b.repr());
 
         let (is_ref, mt_a) = match a.sty {
             ty::TyRef(_, mt) => (true, mt),
@@ -436,7 +436,7 @@ pub fn mk_assignty<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                              a: Ty<'tcx>,
                              b: Ty<'tcx>)
                              -> RelateResult<'tcx, ()> {
-    debug!("mk_assignty({} -> {})", a.repr(fcx.tcx()), b.repr(fcx.tcx()));
+    debug!("mk_assignty({} -> {})", a.repr(), b.repr());
     let mut unsizing_obligations = vec![];
     let adjustment = try!(indent(|| {
         fcx.infcx().commit_if_ok(|_| {
@@ -460,7 +460,7 @@ pub fn mk_assignty<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     }
 
     if let Some(adjustment) = adjustment {
-        debug!("Success, coerced with {}", adjustment.repr(fcx.tcx()));
+        debug!("Success, coerced with {}", adjustment.repr());
         fcx.write_adjustment(expr.id, adjustment);
     }
     Ok(())
index 11069fdfd698d8eb4a1ad994431753d542a964b9..eb50b231155bbc1de3cabfe087fa2eb5de1afd5a 100644 (file)
@@ -39,10 +39,10 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                                  trait_m: &ty::Method<'tcx>,
                                  impl_trait_ref: &ty::TraitRef<'tcx>) {
     debug!("compare_impl_method(impl_trait_ref={})",
-           impl_trait_ref.repr(tcx));
+           impl_trait_ref.repr());
 
     debug!("compare_impl_method: impl_trait_ref (liberated) = {}",
-           impl_trait_ref.repr(tcx));
+           impl_trait_ref.repr());
 
     let infcx = infer::new_infer_ctxt(tcx);
     let mut fulfillment_cx = traits::FulfillmentContext::new(true);
@@ -64,7 +64,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                 "method `{}` has a `{}` declaration in the impl, \
                         but not in the trait",
                         token::get_name(trait_m.name),
-                        impl_m.explicit_self.repr(tcx));
+                        impl_m.explicit_self.repr());
             return;
         }
         (_, &ty::StaticExplicitSelfCategory) => {
@@ -72,7 +72,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                 "method `{}` has a `{}` declaration in the trait, \
                         but not in the impl",
                         token::get_name(trait_m.name),
-                        trait_m.explicit_self.repr(tcx));
+                        trait_m.explicit_self.repr());
             return;
         }
         _ => {
@@ -184,7 +184,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
         .with_method(impl_to_skol_substs.types.get_slice(subst::FnSpace).to_vec(),
                      impl_to_skol_substs.regions().get_slice(subst::FnSpace).to_vec());
     debug!("compare_impl_method: trait_to_skol_substs={}",
-           trait_to_skol_substs.repr(tcx));
+           trait_to_skol_substs.repr());
 
     // Check region bounds. FIXME(@jroesch) refactor this away when removing
     // ParamBounds.
@@ -212,7 +212,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
             infer::HigherRankedType,
             &ty::Binder(impl_bounds));
     debug!("compare_impl_method: impl_bounds={}",
-           impl_bounds.repr(tcx));
+           impl_bounds.repr());
 
     // Normalize the associated types in the trait_bounds.
     let trait_bounds = trait_m.predicates.instantiate(tcx, &trait_to_skol_substs);
@@ -243,7 +243,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                                                                normalize_cause.clone());
 
     debug!("compare_impl_method: trait_bounds={}",
-        trait_param_env.caller_bounds.repr(tcx));
+        trait_param_env.caller_bounds.repr());
 
     let mut selcx = traits::SelectionContext::new(&infcx, &trait_param_env);
 
@@ -304,7 +304,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                                                          abi: impl_m.fty.abi,
                                                          sig: ty::Binder(impl_sig) }));
         debug!("compare_impl_method: impl_fty={}",
-               impl_fty.repr(tcx));
+               impl_fty.repr());
 
         let (trait_sig, skol_map) =
             infcx.skolemize_late_bound_regions(&trait_m.fty.sig, snapshot);
@@ -325,7 +325,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                                                          sig: ty::Binder(trait_sig) }));
 
         debug!("compare_impl_method: trait_fty={}",
-               trait_fty.repr(tcx));
+               trait_fty.repr());
 
         try!(infer::mk_subty(&infcx, false, origin, impl_fty, trait_fty));
 
@@ -336,8 +336,8 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
         Ok(()) => { }
         Err(terr) => {
             debug!("checking trait method for compatibility: impl ty {}, trait ty {}",
-                   impl_fty.repr(tcx),
-                   trait_fty.repr(tcx));
+                   impl_fty.repr(),
+                   trait_fty.repr());
             span_err!(tcx.sess, impl_m_span, E0053,
                       "method `{}` has an incompatible type for trait: {}",
                       token::get_name(trait_m.name),
@@ -385,10 +385,10 @@ fn check_region_bounds_on_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                impl_generics={} \
                trait_to_skol_substs={} \
                impl_to_skol_substs={}",
-               trait_generics.repr(tcx),
-               impl_generics.repr(tcx),
-               trait_to_skol_substs.repr(tcx),
-               impl_to_skol_substs.repr(tcx));
+               trait_generics.repr(),
+               impl_generics.repr(),
+               trait_to_skol_substs.repr(),
+               impl_to_skol_substs.repr());
 
         // Must have same number of early-bound lifetime parameters.
         // Unfortunately, if the user screws up the bounds, then this
@@ -417,7 +417,7 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
                                 trait_c: &ty::AssociatedConst<'tcx>,
                                 impl_trait_ref: &ty::TraitRef<'tcx>) {
     debug!("compare_const_impl(impl_trait_ref={})",
-           impl_trait_ref.repr(tcx));
+           impl_trait_ref.repr());
 
     let infcx = infer::new_infer_ctxt(tcx);
     let mut fulfillment_cx = traits::FulfillmentContext::new(true);
@@ -444,7 +444,7 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
         .with_method(impl_to_skol_substs.types.get_slice(subst::FnSpace).to_vec(),
                      impl_to_skol_substs.regions().get_slice(subst::FnSpace).to_vec());
     debug!("compare_const_impl: trait_to_skol_substs={}",
-           trait_to_skol_substs.repr(tcx));
+           trait_to_skol_substs.repr());
 
     // Compute skolemized form of impl and trait const tys.
     let impl_ty = impl_c.ty.subst(tcx, impl_to_skol_substs);
@@ -462,7 +462,7 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
                                                  0,
                                                  &impl_ty);
         debug!("compare_const_impl: impl_ty={}",
-               impl_ty.repr(tcx));
+               impl_ty.repr());
 
         let trait_ty =
             assoc::normalize_associated_types_in(&infcx,
@@ -472,7 +472,7 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
                                                  0,
                                                  &trait_ty);
         debug!("compare_const_impl: trait_ty={}",
-               trait_ty.repr(tcx));
+               trait_ty.repr());
 
         infer::mk_subty(&infcx, false, origin, impl_ty, trait_ty)
     });
@@ -481,8 +481,8 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
         Ok(()) => { }
         Err(terr) => {
             debug!("checking associated const for compatibility: impl ty {}, trait ty {}",
-                   impl_ty.repr(tcx),
-                   trait_ty.repr(tcx));
+                   impl_ty.repr(),
+                   trait_ty.repr());
             span_err!(tcx.sess, impl_c_span, E0326,
                       "implemented const `{}` has an incompatible type for \
                       trait: {}",
index cd6a1226e00c9d639d8c83d38891caaf13122e85..3fc833034d221f2cf17542c5601519655d955901 100644 (file)
@@ -60,8 +60,8 @@ pub fn coerce<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                         expr: &ast::Expr) {
     let expr_ty = fcx.expr_ty(expr);
     debug!("demand::coerce(expected = {}, expr_ty = {})",
-           expected.repr(fcx.ccx.tcx),
-           expr_ty.repr(fcx.ccx.tcx));
+           expected.repr(),
+           expr_ty.repr());
     let expr_ty = fcx.resolve_type_vars_if_possible(expr_ty);
     let expected = fcx.resolve_type_vars_if_possible(expected);
     match coercion::mk_assignty(fcx, expr, expr_ty, expected) {
index 6e6231dec324be395ae4cd7ea2f04f38b9e421c6..14238179f87c29d931c12d1a1468bd565e77a980 100644 (file)
@@ -62,7 +62,7 @@ pub fn check_drop_impl(tcx: &ty::ctxt, drop_impl_did: ast::DefId) -> Result<(),
             let span = tcx.map.def_id_span(drop_impl_did, codemap::DUMMY_SP);
             tcx.sess.span_bug(
                 span, &format!("should have been rejected by coherence check: {}",
-                               dtor_self_type.repr(tcx)));
+                               dtor_self_type.repr()));
         }
     }
 }
@@ -212,7 +212,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
 
         if !assumptions_in_impl_context.contains(&predicate) {
             let item_span = tcx.map.span(self_type_did.node);
-            let req = predicate.user_string(tcx);
+            let req = predicate.user_string();
             span_err!(tcx.sess, drop_impl_span, E0367,
                       "The requirement `{}` is added only by the Drop impl.", req);
             tcx.sess.span_note(item_span,
@@ -258,7 +258,7 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>
                                                      span: Span,
                                                      scope: region::CodeExtent) {
     debug!("check_safety_of_destructor_if_necessary typ: {} scope: {:?}",
-           typ.repr(rcx.tcx()), scope);
+           typ.repr(), scope);
 
     // types that have been traversed so far by `traverse_type_if_unseen`
     let mut breadcrumbs: Vec<Ty<'tcx>> = Vec::new();
@@ -278,7 +278,7 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>
             let tcx = rcx.tcx();
             span_err!(tcx.sess, span, E0320,
                       "overflow while adding drop-check rules for {}",
-                      typ.user_string(rcx.tcx()));
+                      typ.user_string());
             match *ctxt {
                 TypeContext::Root => {
                     // no need for an additional note if the overflow
@@ -294,7 +294,7 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>
                         ty::item_path_str(tcx, def_id),
                         variant,
                         arg_index,
-                        detected_on_typ.user_string(rcx.tcx()));
+                        detected_on_typ.user_string());
                 }
                 TypeContext::Struct { def_id, field } => {
                     span_note!(
@@ -303,7 +303,7 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>
                         "overflowed on struct {} field {} type: {}",
                         ty::item_path_str(tcx, def_id),
                         field,
-                        detected_on_typ.user_string(rcx.tcx()));
+                        detected_on_typ.user_string());
                 }
             }
         }
@@ -373,7 +373,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
                         .opt_get(subst::TypeSpace, 0).unwrap();
                     let new_typ = substs.type_for_def(tp_def);
                     debug!("replacing phantom {} with {}",
-                           typ.repr(rcx.tcx()), new_typ.repr(rcx.tcx()));
+                           typ.repr(), new_typ.repr());
                     (new_typ, xref_depth_orig + 1)
                 } else {
                     (typ, xref_depth_orig)
@@ -385,7 +385,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
             // puts us into the previous case.
             ty::TyBox(new_typ) => {
                 debug!("replacing TyBox {} with {}",
-                       typ.repr(rcx.tcx()), new_typ.repr(rcx.tcx()));
+                       typ.repr(), new_typ.repr());
                 (new_typ, xref_depth_orig + 1)
             }
 
@@ -411,7 +411,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
         debug!("iterate_over_potentially_unsafe_regions_in_type \
                 {}typ: {} scope: {:?} xref: {}",
                (0..depth).map(|_| ' ').collect::<String>(),
-               typ.repr(rcx.tcx()), scope, xref_depth);
+               typ.repr(), scope, xref_depth);
 
         // If `typ` has a destructor, then we must ensure that all
         // borrowed data reachable via `typ` must outlive the parent
@@ -468,7 +468,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
             match typ.sty {
                 ty::TyStruct(struct_did, substs) => {
                     debug!("typ: {} is struct; traverse structure and not type-expression",
-                           typ.repr(rcx.tcx()));
+                           typ.repr());
                     // Don't recurse; we extract type's substructure,
                     // so do not process subparts of type expression.
                     walker.skip_current_subtree();
@@ -498,7 +498,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
 
                 ty::TyEnum(enum_did, substs) => {
                     debug!("typ: {} is enum; traverse structure and not type-expression",
-                           typ.repr(rcx.tcx()));
+                           typ.repr());
                     // Don't recurse; we extract type's substructure,
                     // so do not process subparts of type expression.
                     walker.skip_current_subtree();
@@ -572,23 +572,23 @@ fn has_dtor_of_interest<'tcx>(tcx: &ty::ctxt<'tcx>,
         DtorKind::PureRecur => {
             has_dtor_of_interest = false;
             debug!("typ: {} has no dtor, and thus is uninteresting",
-                   typ.repr(tcx));
+                   typ.repr());
         }
         DtorKind::Unknown(bounds) => {
             match bounds.region_bound {
                 ty::ReStatic => {
                     debug!("trait: {} has 'static bound, and thus is uninteresting",
-                           typ.repr(tcx));
+                           typ.repr());
                     has_dtor_of_interest = false;
                 }
                 ty::ReEmpty => {
                     debug!("trait: {} has empty region bound, and thus is uninteresting",
-                           typ.repr(tcx));
+                           typ.repr());
                     has_dtor_of_interest = false;
                 }
                 r => {
                     debug!("trait: {} has non-static bound: {}; assumed interesting",
-                           typ.repr(tcx), r.repr(tcx));
+                           typ.repr(), r.repr());
                     has_dtor_of_interest = true;
                 }
             }
@@ -646,7 +646,7 @@ fn has_dtor_of_interest<'tcx>(tcx: &ty::ctxt<'tcx>,
                     if result {
                         has_pred_of_interest = true;
                         debug!("typ: {} has interesting dtor due to generic preds, e.g. {}",
-                               typ.repr(tcx), pred.repr(tcx));
+                               typ.repr(), pred.repr());
                         break 'items;
                     }
                 }
@@ -672,12 +672,12 @@ fn has_dtor_of_interest<'tcx>(tcx: &ty::ctxt<'tcx>,
             if has_dtor_of_interest {
                 debug!("typ: {} has interesting dtor, due to \
                         region params: {} or pred: {}",
-                       typ.repr(tcx),
+                       typ.repr(),
                        has_region_param_of_interest,
                        has_pred_of_interest);
             } else {
                 debug!("typ: {} has dtor, but it is uninteresting",
-                       typ.repr(tcx));
+                       typ.repr());
             }
         }
     }
index bd482a4c787f1216a2978c1d5f3ef87fb2ebfa2e..2b8394f2e1659abaeaa98a9b09da1ea0e3f99cc6 100644 (file)
@@ -57,9 +57,9 @@ pub fn confirm<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                          -> MethodCallee<'tcx>
 {
     debug!("confirm(unadjusted_self_ty={}, pick={}, supplied_method_types={})",
-           unadjusted_self_ty.repr(fcx.tcx()),
-           pick.repr(fcx.tcx()),
-           supplied_method_types.repr(fcx.tcx()));
+           unadjusted_self_ty.repr(),
+           pick.repr(),
+           supplied_method_types.repr());
 
     let mut confirm_cx = ConfirmContext::new(fcx, span, self_expr, call_expr);
     confirm_cx.confirm(unadjusted_self_ty, pick, supplied_method_types)
@@ -93,7 +93,7 @@ fn confirm(&mut self,
         let (method_types, method_regions) =
             self.instantiate_method_substs(&pick, supplied_method_types);
         let all_substs = rcvr_substs.with_method(method_types, method_regions);
-        debug!("all_substs={}", all_substs.repr(self.tcx()));
+        debug!("all_substs={}", all_substs.repr());
 
         // Create the final signature for the method, replacing late-bound regions.
         let InstantiatedMethodSig {
@@ -226,9 +226,9 @@ fn fresh_receiver_substs(&mut self,
                     let upcast_trait_ref =
                         this.replace_late_bound_regions_with_fresh_var(&upcast_poly_trait_ref);
                     debug!("original_poly_trait_ref={} upcast_trait_ref={} target_trait={}",
-                           original_poly_trait_ref.repr(this.tcx()),
-                           upcast_trait_ref.repr(this.tcx()),
-                           trait_def_id.repr(this.tcx()));
+                           original_poly_trait_ref.repr(),
+                           upcast_trait_ref.repr(),
+                           trait_def_id.repr());
                     let substs = upcast_trait_ref.substs.clone();
                     let origin = MethodTraitObject(MethodObject {
                         trait_ref: upcast_trait_ref,
@@ -322,7 +322,7 @@ fn extract_trait_ref<R, F>(&mut self, self_ty: Ty<'tcx>, mut closure: F) -> R wh
                 self.tcx().sess.span_bug(
                     self.span,
                     &format!("self-type `{}` for ObjectPick never dereferenced to an object",
-                            self_ty.repr(self.tcx())))
+                            self_ty.repr()))
             }
         }
     }
@@ -378,8 +378,8 @@ fn unify_receivers(&mut self,
                     self.span,
                     &format!(
                         "{} was a subtype of {} but now is not?",
-                        self_ty.repr(self.tcx()),
-                        method_self_ty.repr(self.tcx())));
+                        self_ty.repr(),
+                        method_self_ty.repr()));
             }
         }
     }
@@ -393,8 +393,8 @@ fn instantiate_method_sig(&mut self,
                               -> InstantiatedMethodSig<'tcx>
     {
         debug!("instantiate_method_sig(pick={}, all_substs={})",
-               pick.repr(self.tcx()),
-               all_substs.repr(self.tcx()));
+               pick.repr(),
+               all_substs.repr());
 
         // Instantiate the bounds on the method with the
         // type/early-bound-regions substitutions performed. There can
@@ -405,7 +405,7 @@ fn instantiate_method_sig(&mut self,
                                                                        &method_predicates);
 
         debug!("method_predicates after subst = {}",
-               method_predicates.repr(self.tcx()));
+               method_predicates.repr());
 
         // Instantiate late-bound regions and substitute the trait
         // parameters into the method type to get the actual method type.
@@ -416,11 +416,11 @@ fn instantiate_method_sig(&mut self,
         let method_sig = self.replace_late_bound_regions_with_fresh_var(
             &pick.item.as_opt_method().unwrap().fty.sig);
         debug!("late-bound lifetimes from method instantiated, method_sig={}",
-               method_sig.repr(self.tcx()));
+               method_sig.repr());
 
         let method_sig = self.fcx.instantiate_type_scheme(self.span, &all_substs, &method_sig);
         debug!("type scheme substituted, method_sig={}",
-               method_sig.repr(self.tcx()));
+               method_sig.repr());
 
         InstantiatedMethodSig {
             method_sig: method_sig,
@@ -434,9 +434,9 @@ fn add_obligations(&mut self,
                        all_substs: &subst::Substs<'tcx>,
                        method_predicates: &ty::InstantiatedPredicates<'tcx>) {
         debug!("add_obligations: pick={} all_substs={} method_predicates={}",
-               pick.repr(self.tcx()),
-               all_substs.repr(self.tcx()),
-               method_predicates.repr(self.tcx()));
+               pick.repr(),
+               all_substs.repr(),
+               method_predicates.repr());
 
         self.fcx.add_obligations_for_parameters(
             traits::ObligationCause::misc(self.span, self.fcx.body_id),
@@ -484,7 +484,7 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
         }
 
         debug!("fixup_derefs_on_method_receiver_if_necessary: exprs={}",
-               exprs.repr(self.tcx()));
+               exprs.repr());
 
         // Fix up autoderefs and derefs.
         for (i, &expr) in exprs.iter().rev().enumerate() {
@@ -499,7 +499,7 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
             };
 
             debug!("fixup_derefs_on_method_receiver_if_necessary: i={} expr={} autoderef_count={}",
-                   i, expr.repr(self.tcx()), autoderef_count);
+                   i, expr.repr(), autoderef_count);
 
             if autoderef_count > 0 {
                 check::autoderef(self.fcx,
@@ -546,7 +546,7 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
                                     self.tcx().sess.span_bug(
                                         base_expr.span,
                                         &format!("unexpected adjustment autoref {}",
-                                                adr.repr(self.tcx())));
+                                                adr.repr()));
                                 }
                             },
                             None => (0, None),
@@ -648,16 +648,16 @@ fn upcast(&mut self,
             self.tcx().sess.span_bug(
                 self.span,
                 &format!("cannot uniquely upcast `{}` to `{}`: `{}`",
-                         source_trait_ref.repr(self.tcx()),
-                         target_trait_def_id.repr(self.tcx()),
-                         upcast_trait_refs.repr(self.tcx())));
+                         source_trait_ref.repr(),
+                         target_trait_def_id.repr(),
+                         upcast_trait_refs.repr()));
         }
 
         upcast_trait_refs.into_iter().next().unwrap()
     }
 
     fn replace_late_bound_regions_with_fresh_var<T>(&self, value: &ty::Binder<T>) -> T
-        where T : TypeFoldable<'tcx> + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + Repr
     {
         self.infcx().replace_late_bound_regions_with_fresh_var(
             self.span, infer::FnCall, value).0
index bb620c6ecd895334be44a675b72c52df4fea9b10..fd7695b1f0934cdcd0bf9cdaf861018d4c772f56 100644 (file)
@@ -97,10 +97,10 @@ pub fn lookup<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                         -> Result<ty::MethodCallee<'tcx>, MethodError>
 {
     debug!("lookup(method_name={}, self_ty={}, call_expr={}, self_expr={})",
-           method_name.repr(fcx.tcx()),
-           self_ty.repr(fcx.tcx()),
-           call_expr.repr(fcx.tcx()),
-           self_expr.repr(fcx.tcx()));
+           method_name.repr(),
+           self_ty.repr(),
+           call_expr.repr(),
+           self_expr.repr());
 
     let mode = probe::Mode::MethodCall;
     let self_ty = fcx.infcx().resolve_type_vars_if_possible(&self_ty);
@@ -142,10 +142,10 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                           -> Option<ty::MethodCallee<'tcx>>
 {
     debug!("lookup_in_trait_adjusted(self_ty={}, self_expr={}, m_name={}, trait_def_id={})",
-           self_ty.repr(fcx.tcx()),
-           self_expr.repr(fcx.tcx()),
-           m_name.repr(fcx.tcx()),
-           trait_def_id.repr(fcx.tcx()));
+           self_ty.repr(),
+           self_expr.repr(),
+           m_name.repr(),
+           trait_def_id.repr());
 
     let trait_def = ty::lookup_trait_def(fcx.tcx(), trait_def_id);
 
@@ -191,7 +191,7 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     assert_eq!(method_ty.generics.regions.len(subst::FnSpace), 0);
 
     debug!("lookup_in_trait_adjusted: method_num={} method_ty={}",
-           method_num, method_ty.repr(fcx.tcx()));
+           method_num, method_ty.repr());
 
     // Instantiate late-bound regions and substitute the trait
     // parameters into the method type to get the actual method type.
@@ -211,8 +211,8 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     }));
 
     debug!("lookup_in_trait_adjusted: matched method fty={} obligation={}",
-           fty.repr(fcx.tcx()),
-           obligation.repr(fcx.tcx()));
+           fty.repr(),
+           obligation.repr());
 
     // Register obligations for the parameters.  This will include the
     // `Self` parameter, which in turn has a bound of the main trait,
@@ -272,7 +272,7 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                 span,
                                 &format!(
                                     "trait method is &self but first arg is: {}",
-                                    transformed_self_ty.repr(fcx.tcx())));
+                                    transformed_self_ty.repr()));
                         }
                     }
                 }
@@ -296,7 +296,7 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         substs: trait_ref.substs.clone()
     };
 
-    debug!("callee = {}", callee.repr(fcx.tcx()));
+    debug!("callee = {}", callee.repr());
 
     Some(callee)
 }
index 915aadd722b2ce89ee4d86ac16c046354da98ffe..daa2b95e07e80e7be709402e4f34011730dbff17 100644 (file)
@@ -124,7 +124,7 @@ pub fn probe<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                        -> PickResult<'tcx>
 {
     debug!("probe(self_ty={}, item_name={}, scope_expr_id={})",
-           self_ty.repr(fcx.tcx()),
+           self_ty.repr(),
            item_name,
            scope_expr_id);
 
@@ -164,8 +164,8 @@ pub fn probe<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         };
 
     debug!("ProbeContext: steps for self_ty={} are {}",
-           self_ty.repr(fcx.tcx()),
-           steps.repr(fcx.tcx()));
+           self_ty.repr(),
+           steps.repr());
 
     // this creates one big transaction so that all type variables etc
     // that we create during the probe process are removed later
@@ -269,7 +269,7 @@ fn assemble_inherent_candidates(&mut self) {
 
     fn assemble_probe(&mut self, self_ty: Ty<'tcx>) {
         debug!("assemble_probe: self_ty={}",
-               self_ty.repr(self.tcx()));
+               self_ty.repr());
 
         match self_ty.sty {
             ty::TyTrait(box ref data) => {
@@ -412,7 +412,7 @@ fn assemble_inherent_impl_probe(&mut self, impl_def_id: ast::DefId) {
         let traits::Normalized { value: xform_self_ty, obligations } =
             traits::normalize(selcx, cause, &xform_self_ty);
         debug!("assemble_inherent_impl_probe: xform_self_ty = {:?}",
-               xform_self_ty.repr(self.tcx()));
+               xform_self_ty.repr());
 
         self.inherent_candidates.push(Candidate {
             xform_self_ty: xform_self_ty,
@@ -425,7 +425,7 @@ fn assemble_inherent_candidates_from_object(&mut self,
                                                 self_ty: Ty<'tcx>,
                                                 data: &ty::TraitTy<'tcx>) {
         debug!("assemble_inherent_candidates_from_object(self_ty={})",
-               self_ty.repr(self.tcx()));
+               self_ty.repr());
 
         let tcx = self.tcx();
 
@@ -497,9 +497,9 @@ fn assemble_inherent_candidates_from_param(&mut self,
 
             if let Some(ref m) = item.as_opt_method() {
                 debug!("found match: trait_ref={} substs={} m={}",
-                       trait_ref.repr(this.tcx()),
-                       trait_ref.substs.repr(this.tcx()),
-                       m.repr(this.tcx()));
+                       trait_ref.repr(),
+                       trait_ref.substs.repr(),
+                       m.repr());
                 assert_eq!(m.generics.types.get_slice(subst::TypeSpace).len(),
                            trait_ref.substs.types.get_slice(subst::TypeSpace).len());
                 assert_eq!(m.generics.regions.get_slice(subst::TypeSpace).len(),
@@ -539,7 +539,7 @@ fn elaborate_bounds<F>(
             usize,
         ),
     {
-        debug!("elaborate_bounds(bounds={})", bounds.repr(self.tcx()));
+        debug!("elaborate_bounds(bounds={})", bounds.repr());
 
         let tcx = self.tcx();
         for bound_trait_ref in traits::transitive_bounds(tcx, bounds) {
@@ -589,7 +589,7 @@ fn assemble_extension_candidates_for_trait(&mut self,
                                                -> Result<(),MethodError>
     {
         debug!("assemble_extension_candidates_for_trait(trait_def_id={})",
-               trait_def_id.repr(self.tcx()));
+               trait_def_id.repr());
 
         // Check whether `trait_def_id` defines a method with suitable name:
         let trait_items =
@@ -639,8 +639,8 @@ fn assemble_extension_candidates_for_trait_impls(&mut self,
         // FIXME(arielb1): can we use for_each_relevant_impl here?
         trait_def.for_each_impl(self.tcx(), |impl_def_id| {
             debug!("assemble_extension_candidates_for_trait_impl: trait_def_id={} impl_def_id={}",
-                   trait_def_id.repr(self.tcx()),
-                   impl_def_id.repr(self.tcx()));
+                   trait_def_id.repr(),
+                   impl_def_id.repr());
 
             if !self.impl_can_possibly_match(impl_def_id) {
                 return;
@@ -648,14 +648,14 @@ fn assemble_extension_candidates_for_trait_impls(&mut self,
 
             let (_, impl_substs) = self.impl_ty_and_substs(impl_def_id);
 
-            debug!("impl_substs={}", impl_substs.repr(self.tcx()));
+            debug!("impl_substs={}", impl_substs.repr());
 
             let impl_trait_ref =
                 ty::impl_trait_ref(self.tcx(), impl_def_id)
                 .unwrap() // we know this is a trait impl
                 .subst(self.tcx(), &impl_substs);
 
-            debug!("impl_trait_ref={}", impl_trait_ref.repr(self.tcx()));
+            debug!("impl_trait_ref={}", impl_trait_ref.repr());
 
             // Determine the receiver type that the method itself expects.
             let xform_self_ty =
@@ -671,7 +671,7 @@ fn assemble_extension_candidates_for_trait_impls(&mut self,
             let traits::Normalized { value: xform_self_ty, obligations } =
                 traits::normalize(selcx, cause, &xform_self_ty);
 
-            debug!("xform_self_ty={}", xform_self_ty.repr(self.tcx()));
+            debug!("xform_self_ty={}", xform_self_ty.repr());
 
             self.extension_candidates.push(Candidate {
                 xform_self_ty: xform_self_ty,
@@ -772,13 +772,13 @@ fn assemble_projection_candidates(&mut self,
                trait_def_id={}, \
                item={}, \
                item_index={})",
-               trait_def_id.repr(self.tcx()),
-               item.repr(self.tcx()),
+               trait_def_id.repr(),
+               item.repr(),
                item_index);
 
         for step in self.steps.iter() {
             debug!("assemble_projection_candidates: step={}",
-                   step.repr(self.tcx()));
+                   step.repr());
 
             let projection_trait_ref = match step.self_ty.sty {
                 ty::TyProjection(ref data) => &data.trait_ref,
@@ -786,14 +786,14 @@ fn assemble_projection_candidates(&mut self,
             };
 
             debug!("assemble_projection_candidates: projection_trait_ref={}",
-                   projection_trait_ref.repr(self.tcx()));
+                   projection_trait_ref.repr());
 
             let trait_predicates = ty::lookup_predicates(self.tcx(),
                                                          projection_trait_ref.def_id);
             let bounds = trait_predicates.instantiate(self.tcx(), projection_trait_ref.substs);
             let predicates = bounds.predicates.into_vec();
             debug!("assemble_projection_candidates: predicates={}",
-                   predicates.repr(self.tcx()));
+                   predicates.repr());
             for poly_bound in
                 traits::elaborate_predicates(self.tcx(), predicates)
                 .filter_map(|p| p.to_opt_poly_trait_ref())
@@ -802,8 +802,8 @@ fn assemble_projection_candidates(&mut self,
                 let bound = self.erase_late_bound_regions(&poly_bound);
 
                 debug!("assemble_projection_candidates: projection_trait_ref={} bound={}",
-                       projection_trait_ref.repr(self.tcx()),
-                       bound.repr(self.tcx()));
+                       projection_trait_ref.repr(),
+                       bound.repr());
 
                 if self.infcx().can_equate(&step.self_ty, &bound.self_ty()).is_ok() {
                     let xform_self_ty = self.xform_self_ty(&item,
@@ -811,8 +811,8 @@ fn assemble_projection_candidates(&mut self,
                                                            bound.substs);
 
                     debug!("assemble_projection_candidates: bound={} xform_self_ty={}",
-                           bound.repr(self.tcx()),
-                           xform_self_ty.repr(self.tcx()));
+                           bound.repr(),
+                           xform_self_ty.repr());
 
                     self.extension_candidates.push(Candidate {
                         xform_self_ty: xform_self_ty,
@@ -830,7 +830,7 @@ fn assemble_where_clause_candidates(&mut self,
                                         item_index: usize)
     {
         debug!("assemble_where_clause_candidates(trait_def_id={})",
-               trait_def_id.repr(self.tcx()));
+               trait_def_id.repr());
 
         let caller_predicates = self.fcx.inh.param_env.caller_bounds.clone();
         for poly_bound in traits::elaborate_predicates(self.tcx(), caller_predicates)
@@ -843,8 +843,8 @@ fn assemble_where_clause_candidates(&mut self,
                                                    bound.substs);
 
             debug!("assemble_where_clause_candidates: bound={} xform_self_ty={}",
-                   bound.repr(self.tcx()),
-                   xform_self_ty.repr(self.tcx()));
+                   bound.repr(),
+                   xform_self_ty.repr());
 
             self.extension_candidates.push(Candidate {
                 xform_self_ty: xform_self_ty,
@@ -910,7 +910,7 @@ fn pick_core(&mut self) -> Option<PickResult<'tcx>> {
     }
 
     fn pick_step(&mut self, step: &CandidateStep<'tcx>) -> Option<PickResult<'tcx>> {
-        debug!("pick_step: step={}", step.repr(self.tcx()));
+        debug!("pick_step: step={}", step.repr());
 
         if ty::type_is_error(step.self_ty) {
             return None;
@@ -1008,7 +1008,7 @@ fn consider_candidates(&self,
                   .filter(|&probe| self.consider_probe(self_ty, probe))
                   .collect();
 
-        debug!("applicable_candidates: {}", applicable_candidates.repr(self.tcx()));
+        debug!("applicable_candidates: {}", applicable_candidates.repr());
 
         if applicable_candidates.len() > 1 {
             match self.collapse_candidates_to_trait_pick(&applicable_candidates[..]) {
@@ -1030,8 +1030,8 @@ fn consider_candidates(&self,
 
     fn consider_probe(&self, self_ty: Ty<'tcx>, probe: &Candidate<'tcx>) -> bool {
         debug!("consider_probe: self_ty={} probe={}",
-               self_ty.repr(self.tcx()),
-               probe.repr(self.tcx()));
+               self_ty.repr(),
+               probe.repr());
 
         self.infcx().probe(|_| {
             // First check that the self type can be related.
@@ -1065,7 +1065,7 @@ fn consider_probe(&self, self_ty: Ty<'tcx>, probe: &Candidate<'tcx>) -> bool {
                         traits::predicates_for_generics(self.tcx(),
                                                         cause.clone(),
                                                         &impl_bounds);
-                    debug!("impl_obligations={}", obligations.repr(self.tcx()));
+                    debug!("impl_obligations={}", obligations.repr());
 
                     // Evaluate those obligations to see if they might possibly hold.
                     obligations.iter()
@@ -1178,9 +1178,9 @@ fn xform_method_self_ty(&self,
                             -> Ty<'tcx>
     {
         debug!("xform_self_ty(impl_ty={}, self_ty={}, substs={})",
-               impl_ty.repr(self.tcx()),
-               method.fty.sig.0.inputs.get(0).repr(self.tcx()),
-               substs.repr(self.tcx()));
+               impl_ty.repr(),
+               method.fty.sig.0.inputs.get(0).repr(),
+               substs.repr());
 
         assert!(!substs.has_escaping_regions());
 
@@ -1265,7 +1265,7 @@ fn impl_ty_and_substs(&self,
     ///    and/or tracking the substitution and
     ///    so forth.
     fn erase_late_bound_regions<T>(&self, value: &ty::Binder<T>) -> T
-        where T : TypeFoldable<'tcx> + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + Repr
     {
         ty::erase_late_bound_regions(self.tcx(), value)
     }
@@ -1372,58 +1372,58 @@ fn to_trait_data(&self) -> Option<(ast::DefId, ItemIndex)> {
     }
 }
 
-impl<'tcx> Repr<'tcx> for Candidate<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for Candidate<'tcx> {
+    fn repr(&self) -> String {
         format!("Candidate(xform_self_ty={}, kind={})",
-                self.xform_self_ty.repr(tcx),
-                self.kind.repr(tcx))
+                self.xform_self_ty.repr(),
+                self.kind.repr())
     }
 }
 
-impl<'tcx> Repr<'tcx> for CandidateKind<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for CandidateKind<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             InherentImplCandidate(ref a, ref b, ref c) =>
-                format!("InherentImplCandidate({},{},{})", a.repr(tcx), b.repr(tcx),
-                        c.repr(tcx)),
+                format!("InherentImplCandidate({},{},{})", a.repr(), b.repr(),
+                        c.repr()),
             ObjectCandidate(a, b, c) =>
-                format!("ObjectCandidate({},{},{})", a.repr(tcx), b, c),
+                format!("ObjectCandidate({},{},{})", a.repr(), b, c),
             ExtensionImplCandidate(ref a, ref b, ref c, ref d, ref e) =>
-                format!("ExtensionImplCandidate({},{},{},{},{})", a.repr(tcx), b.repr(tcx),
-                        c.repr(tcx), d, e.repr(tcx)),
+                format!("ExtensionImplCandidate({},{},{},{},{})", a.repr(), b.repr(),
+                        c.repr(), d, e.repr()),
             ClosureCandidate(ref a, ref b) =>
-                format!("ClosureCandidate({},{})", a.repr(tcx), b),
+                format!("ClosureCandidate({},{})", a.repr(), b),
             WhereClauseCandidate(ref a, ref b) =>
-                format!("WhereClauseCandidate({},{})", a.repr(tcx), b),
+                format!("WhereClauseCandidate({},{})", a.repr(), b),
             ProjectionCandidate(ref a, ref b) =>
-                format!("ProjectionCandidate({},{})", a.repr(tcx), b),
+                format!("ProjectionCandidate({},{})", a.repr(), b),
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for CandidateStep<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for CandidateStep<'tcx> {
+    fn repr(&self) -> String {
         format!("CandidateStep({}, autoderefs={}, unsize={})",
-                self.self_ty.repr(tcx),
+                self.self_ty.repr(),
                 self.autoderefs,
                 self.unsize)
     }
 }
 
-impl<'tcx> Repr<'tcx> for PickKind<'tcx> {
-    fn repr(&self, _tcx: &ty::ctxt) -> String {
+impl<'tcx> Repr for PickKind<'tcx> {
+    fn repr(&self) -> String {
         format!("{:?}", self)
     }
 }
 
-impl<'tcx> Repr<'tcx> for Pick<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for Pick<'tcx> {
+    fn repr(&self) -> String {
         format!("Pick(item={}, autoderefs={},
                  autoref={}, unsize={}, kind={:?})",
-                self.item.repr(tcx),
+                self.item.repr(),
                 self.autoderefs,
-                self.autoref.repr(tcx),
-                self.unsize.repr(tcx),
+                self.autoref.repr(),
+                self.unsize.repr(),
                 self.kind)
     }
 }
index 8a48ef543ccc13c639fd791775dd47a52df13753..52fdf52c35da7393101993f1284269440d60c372 100644 (file)
@@ -45,7 +45,7 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     match error {
         MethodError::NoMatch(static_sources, out_of_scope_traits, mode) => {
             let cx = fcx.tcx();
-            let item_ustring = item_name.user_string(cx);
+            let item_ustring = item_name.user_string();
 
             fcx.type_error_message(
                 span,
@@ -93,7 +93,7 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
             let msg = format!("the `{}` method from the `{}` trait cannot be explicitly \
                                invoked on this closure as we have not yet inferred what \
                                kind of closure it is",
-                               item_name.user_string(fcx.tcx()),
+                               item_name.user_string(),
                                ty::item_path_str(fcx.tcx(), trait_def_id));
             let msg = if let Some(callee) = rcvr_expr {
                 format!("{}; use overloaded call notation instead (e.g., `{}()`)",
@@ -134,7 +134,7 @@ fn report_candidates(fcx: &FnCtxt,
                                "candidate #{} is defined in an impl{} for the type `{}`",
                                idx + 1,
                                insertion,
-                               impl_ty.user_string(fcx.tcx()));
+                               impl_ty.user_string());
                 }
                 CandidateSource::TraitSource(trait_did) => {
                     let (_, item) = trait_item(fcx.tcx(), trait_did, item_name).unwrap();
@@ -160,7 +160,7 @@ fn suggest_traits_to_import<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                       valid_out_of_scope_traits: Vec<ast::DefId>)
 {
     let tcx = fcx.tcx();
-    let item_ustring = item_name.user_string(tcx);
+    let item_ustring = item_name.user_string();
 
     if !valid_out_of_scope_traits.is_empty() {
         let mut candidates = valid_out_of_scope_traits;
index 41dcb123952591889a859e63d51e9d5ba2793a2b..34403b53fc6f0dbd8583c4e71d39e1289d398936 100644 (file)
@@ -398,7 +398,7 @@ fn normalize_associated_types_in<T>(&self,
                                         body_id: ast::NodeId,
                                         value: &T)
                                         -> T
-        where T : TypeFoldable<'tcx> + Clone + HasProjectionTypes + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + Clone + HasProjectionTypes + Repr
     {
         let mut fulfillment_cx = self.fulfillment_cx.borrow_mut();
         assoc::normalize_associated_types_in(&self.infcx,
@@ -587,7 +587,7 @@ fn visit_pat(&mut self, p: &'tcx ast::Pat) {
                        token::get_ident(path1.node),
                        self.fcx.infcx().ty_to_string(
                            self.fcx.inh.locals.borrow().get(&p.id).unwrap().clone()),
-                       var_ty.repr(self.fcx.tcx()));
+                       var_ty.repr());
             }
         }
         visit::walk_pat(self, p);
@@ -642,8 +642,8 @@ fn check_fn<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
     let ret_ty = fn_sig.output;
 
     debug!("check_fn(arg_tys={}, ret_ty={}, fn_id={})",
-           arg_tys.repr(tcx),
-           ret_ty.repr(tcx),
+           arg_tys.repr(),
+           ret_ty.repr(),
            fn_id);
 
     // Create the function context.  This is either derived from scratch or,
@@ -671,7 +671,7 @@ fn check_fn<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
 
     debug!("fn-sig-map: fn_id={} fn_sig_tys={}",
            fn_id,
-           fn_sig_tys.repr(tcx));
+           fn_sig_tys.repr());
 
     inherited.fn_sig_map.borrow_mut().insert(fn_id, fn_sig_tys);
 
@@ -919,11 +919,11 @@ fn check_method_body<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                body: &'tcx ast::Block,
                                id: ast::NodeId, span: Span) {
     debug!("check_method_body(item_generics={}, id={})",
-            item_generics.repr(ccx.tcx), id);
+            item_generics.repr(), id);
     let param_env = ParameterEnvironment::for_item(ccx.tcx, id);
 
     let fty = ty::node_id_to_type(ccx.tcx, id);
-    debug!("check_method_body: fty={}", fty.repr(ccx.tcx));
+    debug!("check_method_body: fty={}", fty.repr());
 
     check_bare_fn(ccx, &sig.decl, body, id, span, fty, param_env);
 }
@@ -965,7 +965,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                           "item `{}` is an associated const, \
                                           which doesn't match its trait `{}`",
                                           token::get_name(impl_const_ty.name()),
-                                          impl_trait_ref.repr(tcx))
+                                          impl_trait_ref.repr())
                             }
                         }
                     }
@@ -978,7 +978,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                 "associated const `{}` is not a member of \
                                  trait `{}`",
                                 token::get_name(impl_const_ty.name()),
-                                impl_trait_ref.repr(tcx)));
+                                impl_trait_ref.repr()));
                     }
                 }
             }
@@ -1011,7 +1011,7 @@ trait `{}`",
                                           "item `{}` is an associated method, \
                                           which doesn't match its trait `{}`",
                                           token::get_name(impl_item_ty.name()),
-                                          impl_trait_ref.repr(tcx))
+                                          impl_trait_ref.repr())
                             }
                         }
                     }
@@ -1022,7 +1022,7 @@ trait `{}`",
                             impl_item.span,
                             &format!("method `{}` is not a member of trait `{}`",
                                      token::get_name(impl_item_ty.name()),
-                                     impl_trait_ref.repr(tcx)));
+                                     impl_trait_ref.repr()));
                     }
                 }
             }
@@ -1045,7 +1045,7 @@ trait `{}`",
                                           "item `{}` is an associated type, \
                                           which doesn't match its trait `{}`",
                                           token::get_name(typedef_ty.name()),
-                                          impl_trait_ref.repr(tcx))
+                                          impl_trait_ref.repr())
                             }
                         }
                     }
@@ -1058,7 +1058,7 @@ trait `{}`",
                                 "associated type `{}` is not a member of \
                                  trait `{}`",
                                 token::get_name(typedef_ty.name()),
-                                impl_trait_ref.repr(tcx)));
+                                impl_trait_ref.repr()));
                     }
                 }
             }
@@ -1295,18 +1295,18 @@ pub fn err_count_since_creation(&self) -> usize {
     /// version, this version will also select obligations if it seems
     /// useful, in an effort to get more type information.
     fn resolve_type_vars_if_possible(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
-        debug!("resolve_type_vars_if_possible(ty={})", ty.repr(self.tcx()));
+        debug!("resolve_type_vars_if_possible(ty={})", ty.repr());
 
         // No ty::infer()? Nothing needs doing.
         if !ty::type_has_ty_infer(ty) {
-            debug!("resolve_type_vars_if_possible: ty={}", ty.repr(self.tcx()));
+            debug!("resolve_type_vars_if_possible: ty={}", ty.repr());
             return ty;
         }
 
         // If `ty` is a type variable, see whether we already know what it is.
         ty = self.infcx().resolve_type_vars_if_possible(&ty);
         if !ty::type_has_ty_infer(ty) {
-            debug!("resolve_type_vars_if_possible: ty={}", ty.repr(self.tcx()));
+            debug!("resolve_type_vars_if_possible: ty={}", ty.repr());
             return ty;
         }
 
@@ -1314,7 +1314,7 @@ fn resolve_type_vars_if_possible(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
         self.select_new_obligations();
         ty = self.infcx().resolve_type_vars_if_possible(&ty);
         if !ty::type_has_ty_infer(ty) {
-            debug!("resolve_type_vars_if_possible: ty={}", ty.repr(self.tcx()));
+            debug!("resolve_type_vars_if_possible: ty={}", ty.repr());
             return ty;
         }
 
@@ -1325,7 +1325,7 @@ fn resolve_type_vars_if_possible(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
         self.select_obligations_where_possible();
         ty = self.infcx().resolve_type_vars_if_possible(&ty);
 
-        debug!("resolve_type_vars_if_possible: ty={}", ty.repr(self.tcx()));
+        debug!("resolve_type_vars_if_possible: ty={}", ty.repr());
         ty
     }
 
@@ -1396,7 +1396,7 @@ pub fn default_type_parameters(&self) {
     #[inline]
     pub fn write_ty(&self, node_id: ast::NodeId, ty: Ty<'tcx>) {
         debug!("write_ty({}, {}) in fcx {}",
-               node_id, ty.repr(self.tcx()), self.tag());
+               node_id, ty.repr(), self.tag());
         self.inh.node_types.borrow_mut().insert(node_id, ty);
     }
 
@@ -1404,7 +1404,7 @@ pub fn write_substs(&self, node_id: ast::NodeId, substs: ty::ItemSubsts<'tcx>) {
         if !substs.substs.is_noop() {
             debug!("write_substs({}, {}) in fcx {}",
                    node_id,
-                   substs.repr(self.tcx()),
+                   substs.repr(),
                    self.tag());
 
             self.inh.item_substs.borrow_mut().insert(node_id, substs);
@@ -1427,7 +1427,7 @@ pub fn write_autoderef_adjustment(&self,
     pub fn write_adjustment(&self,
                             node_id: ast::NodeId,
                             adj: ty::AutoAdjustment<'tcx>) {
-        debug!("write_adjustment(node_id={}, adj={})", node_id, adj.repr(self.tcx()));
+        debug!("write_adjustment(node_id={}, adj={})", node_id, adj.repr());
 
         if adj.is_identity() {
             return;
@@ -1444,14 +1444,14 @@ fn instantiate_type_scheme<T>(&self,
                                   substs: &Substs<'tcx>,
                                   value: &T)
                                   -> T
-        where T : TypeFoldable<'tcx> + Clone + HasProjectionTypes + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + Clone + HasProjectionTypes + Repr
     {
         let value = value.subst(self.tcx(), substs);
         let result = self.normalize_associated_types_in(span, &value);
         debug!("instantiate_type_scheme(value={}, substs={}) = {}",
-               value.repr(self.tcx()),
-               substs.repr(self.tcx()),
-               result.repr(self.tcx()));
+               value.repr(),
+               substs.repr(),
+               result.repr());
         result
     }
 
@@ -1470,7 +1470,7 @@ fn instantiate_bounds(&self,
 
 
     fn normalize_associated_types_in<T>(&self, span: Span, value: &T) -> T
-        where T : TypeFoldable<'tcx> + Clone + HasProjectionTypes + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + Clone + HasProjectionTypes + Repr
     {
         self.inh.normalize_associated_types_in(self, span, self.body_id, value)
     }
@@ -1616,7 +1616,7 @@ pub fn register_predicate(&self,
                               obligation: traits::PredicateObligation<'tcx>)
     {
         debug!("register_predicate({})",
-               obligation.repr(self.tcx()));
+               obligation.repr());
         self.inh.fulfillment_cx
             .borrow_mut()
             .register_predicate_obligation(self.infcx(), obligation);
@@ -1634,7 +1634,7 @@ pub fn to_ty(&self, ast_t: &ast::Ty) -> Ty<'tcx> {
     }
 
     pub fn pat_to_string(&self, pat: &ast::Pat) -> String {
-        pat.repr(self.tcx())
+        pat.repr()
     }
 
     pub fn expr_ty(&self, ex: &ast::Expr) -> Ty<'tcx> {
@@ -1785,7 +1785,7 @@ pub fn add_obligations_for_parameters(&self,
         assert!(!predicates.has_escaping_regions());
 
         debug!("add_obligations_for_parameters(predicates={})",
-               predicates.repr(self.tcx()));
+               predicates.repr());
 
         for obligation in traits::predicates_for_generics(self.tcx(),
                                                           cause,
@@ -1943,8 +1943,8 @@ pub fn autoderef<'a, 'tcx, T, F>(fcx: &FnCtxt<'a, 'tcx>,
     where F: FnMut(Ty<'tcx>, usize) -> Option<T>,
 {
     debug!("autoderef(base_ty={}, opt_expr={}, lvalue_pref={:?})",
-           base_ty.repr(fcx.tcx()),
-           opt_expr.repr(fcx.tcx()),
+           base_ty.repr(),
+           opt_expr.repr(),
            lvalue_pref);
 
     let mut t = base_ty;
@@ -2005,7 +2005,7 @@ pub fn autoderef<'a, 'tcx, T, F>(fcx: &FnCtxt<'a, 'tcx>,
     // We've reached the recursion limit, error gracefully.
     span_err!(fcx.tcx().sess, sp, E0055,
         "reached the recursion limit while auto-dereferencing {}",
-        base_ty.repr(fcx.tcx()));
+        base_ty.repr());
     (fcx.tcx().types.err, 0, None)
 }
 
@@ -2122,12 +2122,12 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     let tcx = fcx.tcx();
     debug!("try_index_step(expr={}, base_expr.id={}, adjusted_ty={}, \
                            autoderefs={}, unsize={}, index_ty={})",
-           expr.repr(tcx),
-           base_expr.repr(tcx),
-           adjusted_ty.repr(tcx),
+           expr.repr(),
+           base_expr.repr(),
+           adjusted_ty.repr(),
            autoderefs,
            unsize,
-           index_ty.repr(tcx));
+           index_ty.repr());
 
     let input_ty = fcx.infcx().next_ty_var();
 
@@ -2607,8 +2607,8 @@ fn expected_types_for_fn_args<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         }
     }).unwrap_or(vec![]);
     debug!("expected_types_for_fn_args(formal={} -> {}, expected={} -> {})",
-           formal_args.repr(fcx.tcx()), formal_ret.repr(fcx.tcx()),
-           expected_args.repr(fcx.tcx()), expected_ret.repr(fcx.tcx()));
+           formal_args.repr(), formal_ret.repr(),
+           expected_args.repr(), expected_ret.repr());
     expected_args
 }
 
@@ -2630,7 +2630,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
     F: FnOnce(),
 {
     debug!(">> typechecking: expr={} expected={}",
-           expr.repr(fcx.tcx()), expected.repr(fcx.tcx()));
+           expr.repr(), expected.repr());
 
     // Checks a method call.
     fn check_method_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
@@ -2746,7 +2746,7 @@ fn check_field<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                                                   |base_t, _| {
                 match base_t.sty {
                     ty::TyStruct(base_id, substs) => {
-                        debug!("struct named {}",  base_t.repr(tcx));
+                        debug!("struct named {}",  base_t.repr());
                         let fields = ty::lookup_struct_fields(tcx, base_id);
                         fcx.lookup_field_ty(expr.span, base_id, &fields[..],
                                             field.node.name, &(*substs))
@@ -2850,7 +2850,7 @@ fn check_tup_field<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                     ty::TyStruct(base_id, substs) => {
                         tuple_like = ty::is_tuple_struct(tcx, base_id);
                         if tuple_like {
-                            debug!("tuple struct named {}",  base_t.repr(tcx));
+                            debug!("tuple struct named {}",  base_t.repr());
                             let fields = ty::lookup_struct_fields(tcx, base_id);
                             fcx.lookup_tup_field_ty(expr.span, base_id, &fields[..],
                                                     idx.node, &(*substs))
@@ -3276,7 +3276,7 @@ fn check_struct_fields_on_error<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                 }
             } else {
               tcx.sess.span_bug(expr.span,
-                                &format!("unbound path {}", expr.repr(tcx)))
+                                &format!("unbound path {}", expr.repr()))
           };
 
           if let Some((opt_ty, segments, def)) =
@@ -3749,8 +3749,8 @@ fn check_struct_fields_on_error<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
     debug!("type of expr({}) {} is...", expr.id,
            syntax::print::pprust::expr_to_string(expr));
     debug!("... {}, expected is {}",
-           fcx.expr_ty(expr).repr(tcx),
-           expected.repr(tcx));
+           fcx.expr_ty(expr).repr(),
+           expected.repr());
 
     unifier();
 }
@@ -3909,16 +3909,16 @@ fn only_has_type<'a>(self, fcx: &FnCtxt<'a, 'tcx>) -> Option<Ty<'tcx>> {
     }
 }
 
-impl<'tcx> Repr<'tcx> for Expectation<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+impl<'tcx> Repr for Expectation<'tcx> {
+    fn repr(&self) -> String {
         match *self {
             NoExpectation => format!("NoExpectation"),
             ExpectHasType(t) => format!("ExpectHasType({})",
-                                        t.repr(tcx)),
+                                        t.repr()),
             ExpectCastableToType(t) => format!("ExpectCastableToType({})",
-                                               t.repr(tcx)),
+                                               t.repr()),
             ExpectRvalueLikeUnsized(t) => format!("ExpectRvalueLikeUnsized({})",
-                                                  t.repr(tcx)),
+                                                  t.repr()),
         }
     }
 }
@@ -4198,7 +4198,7 @@ pub fn check_instantiable(tcx: &ty::ctxt,
             "this type cannot be instantiated without an \
              instance of itself");
         fileline_help!(tcx.sess, sp, "consider using `Option<{}>`",
-             item_ty.repr(tcx));
+             item_ty.repr());
         false
     } else {
         true
@@ -4391,9 +4391,9 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                   node_id: ast::NodeId) {
     debug!("instantiate_path(path={:?}, def={}, node_id={}, type_scheme={})",
            segments,
-           def.repr(fcx.tcx()),
+           def.repr(),
            node_id,
-           type_scheme.repr(fcx.tcx()));
+           type_scheme.repr());
 
     // We need to extract the type parameters supplied by the user in
     // the path `path`. Due to the current setup, this is a bit of a
@@ -4634,8 +4634,8 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
             fcx.tcx().sess.span_bug(span,
             &format!(
                 "instantiate_path: (UFCS) {} was a subtype of {} but now is not?",
-                self_ty.repr(fcx.tcx()),
-                impl_ty.repr(fcx.tcx())));
+                self_ty.repr(),
+                impl_ty.repr()));
         }
     }
 
@@ -4840,7 +4840,7 @@ fn adjust_type_parameters<'a, 'tcx>(
         }
         assert_eq!(substs.types.len(space), desired.len());
 
-        debug!("Final substs: {}", substs.repr(fcx.tcx()));
+        debug!("Final substs: {}", substs.repr());
     }
 
     fn adjust_region_parameters(
@@ -4950,7 +4950,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                        tps: &OwnedSlice<ast::TyParam>,
                                        ty: Ty<'tcx>) {
     debug!("check_bounds_are_used(n_tps={}, ty={})",
-           tps.len(),  ty.repr(ccx.tcx));
+           tps.len(),  ty.repr());
 
     // make a vector of booleans initially false, set to true when used
     if tps.is_empty() { return; }
@@ -5273,7 +5273,7 @@ fn param<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, n: u32) -> Ty<'tcx> {
                            fty,
                            || {
                 format!("intrinsic has wrong type: expected `{}`",
-                         fty.user_string(ccx.tcx))
+                         fty.user_string())
             });
     }
 }
index b4000788d1998db97ce0b5c197782efca7f6529e..fbff7afb3e59c51c10e534043ff5ecab893118fb 100644 (file)
@@ -51,8 +51,8 @@ pub fn check_binop_assign<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
         span_err!(tcx.sess, lhs_expr.span, E0368,
                   "binary assignment operation `{}=` cannot be applied to types `{}` and `{}`",
                   ast_util::binop_to_string(op.node),
-                  lhs_ty.user_string(fcx.tcx()),
-                  rhs_ty.user_string(fcx.tcx()));
+                  lhs_ty.user_string(),
+                  rhs_ty.user_string());
         fcx.write_error(expr.id);
     }
 
@@ -75,10 +75,10 @@ pub fn check_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
     debug!("check_binop(expr.id={}, expr={}, op={:?}, lhs_expr={}, rhs_expr={})",
            expr.id,
-           expr.repr(tcx),
+           expr.repr(),
            op,
-           lhs_expr.repr(tcx),
-           rhs_expr.repr(tcx));
+           lhs_expr.repr(),
+           rhs_expr.repr());
 
     check_expr(fcx, lhs_expr);
     let lhs_ty = fcx.resolve_type_vars_if_possible(fcx.expr_ty(lhs_expr));
@@ -181,15 +181,15 @@ fn enforce_builtin_binop_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
             if ty::type_is_simd(tcx, lhs_ty) {
                 let unit_ty = ty::simd_type(tcx, lhs_ty);
                 debug!("enforce_builtin_binop_types: lhs_ty={} unit_ty={}",
-                       lhs_ty.repr(tcx),
-                       unit_ty.repr(tcx));
+                       lhs_ty.repr(),
+                       unit_ty.repr());
                 if !ty::type_is_integral(unit_ty) {
                     tcx.sess.span_err(
                         lhs_expr.span,
                         &format!("binary comparison operation `{}` not supported \
                                   for floating point SIMD vector `{}`",
                                  ast_util::binop_to_string(op.node),
-                                 lhs_ty.user_string(tcx)));
+                                 lhs_ty.user_string()));
                     tcx.types.err
                 } else {
                     lhs_ty
@@ -211,7 +211,7 @@ fn check_overloaded_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 {
     debug!("check_overloaded_binop(expr.id={}, lhs_ty={})",
            expr.id,
-           lhs_ty.repr(fcx.tcx()));
+           lhs_ty.repr());
 
     let (name, trait_def_id) = name_and_trait_def_id(fcx, op);
 
@@ -233,7 +233,7 @@ fn check_overloaded_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 span_err!(fcx.tcx().sess, lhs_expr.span, E0369,
                           "binary operation `{}` cannot be applied to type `{}`",
                           ast_util::binop_to_string(op.node),
-                          lhs_ty.user_string(fcx.tcx()));
+                          lhs_ty.user_string());
             }
             fcx.tcx().types.err
         }
@@ -305,11 +305,11 @@ fn lookup_op_method<'a, 'tcx>(fcx: &'a FnCtxt<'a, 'tcx>,
                               -> Result<Ty<'tcx>,()>
 {
     debug!("lookup_op_method(expr={}, lhs_ty={}, opname={:?}, trait_did={}, lhs_expr={})",
-           expr.repr(fcx.tcx()),
-           lhs_ty.repr(fcx.tcx()),
+           expr.repr(),
+           lhs_ty.repr(),
            opname,
-           trait_did.repr(fcx.tcx()),
-           lhs_expr.repr(fcx.tcx()));
+           trait_did.repr(),
+           lhs_expr.repr());
 
     let method = match trait_did {
         Some(trait_did) => {
index 04dd7f46b834b0abc4a88363927c4996e5b04e58..057b4de3f0d96ed9e922869101704fd92b0228a3 100644 (file)
@@ -322,7 +322,7 @@ fn visit_region_obligations(&mut self, node_id: ast::NodeId)
 
         for r_o in &region_obligations {
             debug!("visit_region_obligations: r_o={}",
-                   r_o.repr(self.tcx()));
+                   r_o.repr());
             let sup_type = self.resolve_type(r_o.sup_type);
             let origin = infer::RelateParamBound(r_o.cause.span, sup_type);
             type_must_outlive(self, origin, sup_type, r_o.sub_region);
@@ -352,7 +352,7 @@ fn relate_free_regions(&mut self,
 
         for &ty in fn_sig_tys {
             let ty = self.resolve_type(ty);
-            debug!("relate_free_regions(t={})", ty.repr(tcx));
+            debug!("relate_free_regions(t={})", ty.repr());
             let body_scope = CodeExtent::from_node_id(body_id);
             let body_scope = ty::ReScope(body_scope);
             let implications = implicator::implications(self.fcx.infcx(), self.fcx, body_id,
@@ -365,7 +365,7 @@ fn relate_free_regions(&mut self,
             // that don't go into the free-region-map but which we use
             // here.
             for implication in implications {
-                debug!("implication: {}", implication.repr(tcx));
+                debug!("implication: {}", implication.repr());
                 match implication {
                     implicator::Implication::RegionSubRegion(_,
                                                              ty::ReFree(free_a),
@@ -374,7 +374,7 @@ fn relate_free_regions(&mut self,
                     }
                     implicator::Implication::RegionSubGeneric(_, r_a, ref generic_b) => {
                         debug!("RegionSubGeneric: {} <= {}",
-                               r_a.repr(tcx), generic_b.repr(tcx));
+                               r_a.repr(), generic_b.repr());
 
                         self.region_bound_pairs.push((r_a, generic_b.clone()));
                     }
@@ -465,7 +465,7 @@ fn visit_local(rcx: &mut Rcx, l: &ast::Local) {
 
 fn constrain_bindings_in_pat(pat: &ast::Pat, rcx: &mut Rcx) {
     let tcx = rcx.fcx.tcx();
-    debug!("regionck::visit_pat(pat={})", pat.repr(tcx));
+    debug!("regionck::visit_pat(pat={})", pat.repr());
     pat_util::pat_bindings(&tcx.def_map, pat, |_, id, span, _| {
         // If we have a variable that contains region'd data, that
         // data will be accessible from anywhere that the variable is
@@ -503,7 +503,7 @@ fn constrain_bindings_in_pat(pat: &ast::Pat, rcx: &mut Rcx) {
 
 fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
     debug!("regionck::visit_expr(e={}, repeating_scope={})",
-           expr.repr(rcx.fcx.tcx()), rcx.repeating_scope);
+           expr.repr(), rcx.repeating_scope);
 
     // No matter what, the type of each expression must outlive the
     // scope of that expression. This also guarantees basic WF.
@@ -746,8 +746,8 @@ fn constrain_cast(rcx: &mut Rcx,
                   source_expr: &ast::Expr)
 {
     debug!("constrain_cast(cast_expr={}, source_expr={})",
-           cast_expr.repr(rcx.tcx()),
-           source_expr.repr(rcx.tcx()));
+           cast_expr.repr(),
+           source_expr.repr());
 
     let source_ty = rcx.resolve_node_type(source_expr.id);
     let target_ty = rcx.resolve_node_type(cast_expr.id);
@@ -759,8 +759,8 @@ fn walk_cast<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                            from_ty: Ty<'tcx>,
                            to_ty: Ty<'tcx>) {
         debug!("walk_cast(from_ty={}, to_ty={})",
-               from_ty.repr(rcx.tcx()),
-               to_ty.repr(rcx.tcx()));
+               from_ty.repr(),
+               to_ty.repr());
         match (&from_ty.sty, &to_ty.sty) {
             /*From:*/ (&ty::TyRef(from_r, ref from_mt),
             /*To:  */  &ty::TyRef(to_r, ref to_mt)) => {
@@ -808,7 +808,7 @@ fn constrain_callee(rcx: &mut Rcx,
             //
             // tcx.sess.span_bug(
             //     callee_expr.span,
-            //     format!("Calling non-function: {}", callee_ty.repr(tcx)));
+            //     format!("Calling non-function: {}", callee_ty.repr()));
         }
     }
 }
@@ -827,8 +827,8 @@ fn constrain_call<'a, I: Iterator<Item=&'a ast::Expr>>(rcx: &mut Rcx,
     debug!("constrain_call(call_expr={}, \
             receiver={}, \
             implicitly_ref_args={})",
-            call_expr.repr(tcx),
-            receiver.repr(tcx),
+            call_expr.repr(),
+            receiver.repr(),
             implicitly_ref_args);
 
     // `callee_region` is the scope representing the time in which the
@@ -838,10 +838,10 @@ fn constrain_call<'a, I: Iterator<Item=&'a ast::Expr>>(rcx: &mut Rcx,
     let callee_scope = CodeExtent::from_node_id(call_expr.id);
     let callee_region = ty::ReScope(callee_scope);
 
-    debug!("callee_region={}", callee_region.repr(tcx));
+    debug!("callee_region={}", callee_region.repr());
 
     for arg_expr in arg_exprs {
-        debug!("Argument: {}", arg_expr.repr(tcx));
+        debug!("Argument: {}", arg_expr.repr());
 
         // ensure that any regions appearing in the argument type are
         // valid for at least the lifetime of the function:
@@ -860,7 +860,7 @@ fn constrain_call<'a, I: Iterator<Item=&'a ast::Expr>>(rcx: &mut Rcx,
 
     // as loop above, but for receiver
     if let Some(r) = receiver {
-        debug!("receiver: {}", r.repr(tcx));
+        debug!("receiver: {}", r.repr());
         type_of_node_must_outlive(
             rcx, infer::CallRcvr(r.span),
             r.id, callee_region);
@@ -878,9 +878,9 @@ fn constrain_autoderefs<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                                   mut derefd_ty: Ty<'tcx>)
 {
     debug!("constrain_autoderefs(deref_expr={}, derefs={}, derefd_ty={})",
-           deref_expr.repr(rcx.tcx()),
+           deref_expr.repr(),
            derefs,
-           derefd_ty.repr(rcx.tcx()));
+           derefd_ty.repr());
 
     let r_deref_expr = ty::ReScope(CodeExtent::from_node_id(deref_expr.id));
     for i in 0..derefs {
@@ -890,7 +890,7 @@ fn constrain_autoderefs<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
         derefd_ty = match rcx.fcx.inh.method_map.borrow().get(&method_call) {
             Some(method) => {
                 debug!("constrain_autoderefs: #{} is overloaded, method={}",
-                       i, method.repr(rcx.tcx()));
+                       i, method.repr());
 
                 // Treat overloaded autoderefs as if an AutoRef adjustment
                 // was applied on the base type, as that is always the case.
@@ -904,18 +904,18 @@ fn constrain_autoderefs<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                         rcx.tcx().sess.span_bug(
                             deref_expr.span,
                             &format!("bad overloaded deref type {}",
-                                     method.ty.repr(rcx.tcx())))
+                                     method.ty.repr()))
                     }
                 };
 
                 debug!("constrain_autoderefs: receiver r={:?} m={:?}",
-                       r.repr(rcx.tcx()), m);
+                       r.repr(), m);
 
                 {
                     let mc = mc::MemCategorizationContext::new(rcx.fcx);
                     let self_cmt = ignore_err!(mc.cat_expr_autoderefd(deref_expr, i));
                     debug!("constrain_autoderefs: self_cmt={:?}",
-                           self_cmt.repr(rcx.tcx()));
+                           self_cmt.repr());
                     link_region(rcx, deref_expr.span, r,
                                 ty::BorrowKind::from_mutbl(m), self_cmt);
                 }
@@ -977,7 +977,7 @@ fn check_safety_of_rvalue_destructor_if_necessary<'a, 'tcx>(rcx: &mut Rcx<'a, 't
                        .span_bug(span,
                                  &format!("unexpected rvalue region in rvalue \
                                            destructor safety checking: `{}`",
-                                          region.repr(rcx.tcx())));
+                                          region.repr()));
                 }
             }
         }
@@ -1025,7 +1025,7 @@ fn type_of_node_must_outlive<'a, 'tcx>(
                            |method_call| rcx.resolve_method_type(method_call));
     debug!("constrain_regions_in_type_of_node(\
             ty={}, ty0={}, id={}, minimum_lifetime={:?})",
-            ty.user_string(tcx),  ty0.user_string(tcx),
+            ty.user_string(),  ty0.user_string(),
            id, minimum_lifetime);
     type_must_outlive(rcx, origin, ty, minimum_lifetime);
 }
@@ -1034,14 +1034,14 @@ fn type_of_node_must_outlive<'a, 'tcx>(
 /// resulting pointer is linked to the lifetime of its guarantor (if any).
 fn link_addr_of(rcx: &mut Rcx, expr: &ast::Expr,
                 mutability: ast::Mutability, base: &ast::Expr) {
-    debug!("link_addr_of(expr={}, base={})", expr.repr(rcx.tcx()), base.repr(rcx.tcx()));
+    debug!("link_addr_of(expr={}, base={})", expr.repr(), base.repr());
 
     let cmt = {
         let mc = mc::MemCategorizationContext::new(rcx.fcx);
         ignore_err!(mc.cat_expr(base))
     };
 
-    debug!("link_addr_of: cmt={}", cmt.repr(rcx.tcx()));
+    debug!("link_addr_of: cmt={}", cmt.repr());
 
     link_region_from_node_type(rcx, expr.span, expr.id, mutability, cmt);
 }
@@ -1067,7 +1067,7 @@ fn link_match(rcx: &Rcx, discr: &ast::Expr, arms: &[ast::Arm]) {
     debug!("regionck::for_match()");
     let mc = mc::MemCategorizationContext::new(rcx.fcx);
     let discr_cmt = ignore_err!(mc.cat_expr(discr));
-    debug!("discr_cmt={}", discr_cmt.repr(rcx.tcx()));
+    debug!("discr_cmt={}", discr_cmt.repr());
     for arm in arms {
         for root_pat in &arm.pats {
             link_pattern(rcx, mc, discr_cmt.clone(), &**root_pat);
@@ -1086,8 +1086,8 @@ fn link_fn_args(rcx: &Rcx, body_scope: CodeExtent, args: &[ast::Arg]) {
         let re_scope = ty::ReScope(body_scope);
         let arg_cmt = mc.cat_rvalue(arg.id, arg.ty.span, re_scope, arg_ty);
         debug!("arg_ty={} arg_cmt={}",
-               arg_ty.repr(rcx.tcx()),
-               arg_cmt.repr(rcx.tcx()));
+               arg_ty.repr(),
+               arg_cmt.repr());
         link_pattern(rcx, mc, arg_cmt, &*arg.pat);
     }
 }
@@ -1099,8 +1099,8 @@ fn link_pattern<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
                           discr_cmt: mc::cmt<'tcx>,
                           root_pat: &ast::Pat) {
     debug!("link_pattern(discr_cmt={}, root_pat={})",
-           discr_cmt.repr(rcx.tcx()),
-           root_pat.repr(rcx.tcx()));
+           discr_cmt.repr(),
+           root_pat.repr());
     let _ = mc.cat_pattern(discr_cmt, root_pat, |mc, sub_cmt, sub_pat| {
             match sub_pat.node {
                 // `ref x` pattern
@@ -1136,7 +1136,7 @@ fn link_autoref(rcx: &Rcx,
     debug!("link_autoref(autoref={:?})", autoref);
     let mc = mc::MemCategorizationContext::new(rcx.fcx);
     let expr_cmt = ignore_err!(mc.cat_expr_autoderefd(expr, autoderefs));
-    debug!("expr_cmt={}", expr_cmt.repr(rcx.tcx()));
+    debug!("expr_cmt={}", expr_cmt.repr());
 
     match *autoref {
         ty::AutoPtr(r, m) => {
@@ -1158,7 +1158,7 @@ fn link_by_ref(rcx: &Rcx,
                callee_scope: CodeExtent) {
     let tcx = rcx.tcx();
     debug!("link_by_ref(expr={}, callee_scope={:?})",
-           expr.repr(tcx), callee_scope);
+           expr.repr(), callee_scope);
     let mc = mc::MemCategorizationContext::new(rcx.fcx);
     let expr_cmt = ignore_err!(mc.cat_expr(expr));
     let borrow_region = ty::ReScope(callee_scope);
@@ -1173,12 +1173,12 @@ fn link_region_from_node_type<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
                                         mutbl: ast::Mutability,
                                         cmt_borrowed: mc::cmt<'tcx>) {
     debug!("link_region_from_node_type(id={:?}, mutbl={:?}, cmt_borrowed={})",
-           id, mutbl, cmt_borrowed.repr(rcx.tcx()));
+           id, mutbl, cmt_borrowed.repr());
 
     let rptr_ty = rcx.resolve_node_type(id);
     if !ty::type_is_error(rptr_ty) {
         let tcx = rcx.fcx.ccx.tcx;
-        debug!("rptr_ty={}",  rptr_ty.user_string(tcx));
+        debug!("rptr_ty={}",  rptr_ty.user_string());
         let r = ty::ty_region(tcx, span, rptr_ty);
         link_region(rcx, span, &r, ty::BorrowKind::from_mutbl(mutbl),
                     cmt_borrowed);
@@ -1198,9 +1198,9 @@ fn link_region<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
 
     loop {
         debug!("link_region(borrow_region={}, borrow_kind={}, borrow_cmt={})",
-               borrow_region.repr(rcx.tcx()),
-               borrow_kind.repr(rcx.tcx()),
-               borrow_cmt.repr(rcx.tcx()));
+               borrow_region.repr(),
+               borrow_kind.repr(),
+               borrow_cmt.repr());
         match borrow_cmt.cat.clone() {
             mc::cat_deref(ref_cmt, _,
                           mc::Implicit(ref_kind, ref_region)) |
@@ -1311,7 +1311,7 @@ fn link_reborrowed_region<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
                     rcx.tcx().sess.span_bug(
                         span,
                         &format!("Illegal upvar id: {}",
-                                upvar_id.repr(rcx.tcx())));
+                                upvar_id.repr()));
                 }
             }
         }
@@ -1327,8 +1327,8 @@ fn link_reborrowed_region<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
     };
 
     debug!("link_reborrowed_region: {} <= {}",
-           borrow_region.repr(rcx.tcx()),
-           ref_region.repr(rcx.tcx()));
+           borrow_region.repr(),
+           ref_region.repr());
     rcx.fcx.mk_subr(cause, *borrow_region, ref_region);
 
     // If we end up needing to recurse and establish a region link
@@ -1402,13 +1402,13 @@ pub fn type_must_outlive<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                                region: ty::Region)
 {
     debug!("type_must_outlive(ty={}, region={})",
-           ty.repr(rcx.tcx()),
-           region.repr(rcx.tcx()));
+           ty.repr(),
+           region.repr());
 
     let implications = implicator::implications(rcx.fcx.infcx(), rcx.fcx, rcx.body_id,
                                                 ty, region, origin.span());
     for implication in implications {
-        debug!("implication: {}", implication.repr(rcx.tcx()));
+        debug!("implication: {}", implication.repr());
         match implication {
             implicator::Implication::RegionSubRegion(None, r_a, r_b) => {
                 rcx.fcx.mk_subr(origin.clone(), r_a, r_b);
@@ -1444,7 +1444,7 @@ fn closure_must_outlive<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                                   def_id: ast::DefId,
                                   substs: &'tcx Substs<'tcx>) {
     debug!("closure_must_outlive(region={}, def_id={}, substs={})",
-           region.repr(rcx.tcx()), def_id.repr(rcx.tcx()), substs.repr(rcx.tcx()));
+           region.repr(), def_id.repr(), substs.repr());
 
     let upvars = rcx.fcx.closure_upvars(def_id, substs).unwrap();
     for upvar in upvars {
@@ -1462,8 +1462,8 @@ fn generic_must_outlive<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
     let param_env = &rcx.fcx.inh.param_env;
 
     debug!("param_must_outlive(region={}, generic={})",
-           region.repr(rcx.tcx()),
-           generic.repr(rcx.tcx()));
+           region.repr(),
+           generic.repr());
 
     // To start, collect bounds from user:
     let mut param_bounds =
@@ -1497,8 +1497,8 @@ fn generic_must_outlive<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
     // don't know that this holds from first principles.
     for &(ref r, ref p) in &rcx.region_bound_pairs {
         debug!("generic={} p={}",
-               generic.repr(rcx.tcx()),
-               p.repr(rcx.tcx()));
+               generic.repr(),
+               p.repr());
         if generic == p {
             param_bounds.push(*r);
         }
@@ -1522,7 +1522,7 @@ fn projection_bounds<'a,'tcx>(rcx: &Rcx<'a, 'tcx>,
     let infcx = fcx.infcx();
 
     debug!("projection_bounds(projection_ty={})",
-           projection_ty.repr(tcx));
+           projection_ty.repr());
 
     let ty = ty::mk_projection(tcx, projection_ty.trait_ref.clone(), projection_ty.item_name);
 
@@ -1547,7 +1547,7 @@ fn projection_bounds<'a,'tcx>(rcx: &Rcx<'a, 'tcx>,
             };
 
             debug!("projection_bounds: outlives={} (1)",
-                   outlives.repr(tcx));
+                   outlives.repr());
 
             // apply the substitutions (and normalize any projected types)
             let outlives = fcx.instantiate_type_scheme(span,
@@ -1555,7 +1555,7 @@ fn projection_bounds<'a,'tcx>(rcx: &Rcx<'a, 'tcx>,
                                                        &outlives);
 
             debug!("projection_bounds: outlives={} (2)",
-                   outlives.repr(tcx));
+                   outlives.repr());
 
             let region_result = infcx.commit_if_ok(|_| {
                 let (outlives, _) =
@@ -1565,7 +1565,7 @@ fn projection_bounds<'a,'tcx>(rcx: &Rcx<'a, 'tcx>,
                         &outlives);
 
                 debug!("projection_bounds: outlives={} (3)",
-                       outlives.repr(tcx));
+                       outlives.repr());
 
                 // check whether this predicate applies to our current projection
                 match infer::mk_eqty(infcx, false, infer::Misc(span), ty, outlives.0) {
@@ -1575,7 +1575,7 @@ fn projection_bounds<'a,'tcx>(rcx: &Rcx<'a, 'tcx>,
             });
 
             debug!("projection_bounds: region_result={}",
-                   region_result.repr(tcx));
+                   region_result.repr());
 
             region_result.ok()
         })
index 10ec2225555e9614a462048bfe9a5bb91d770281..f27985d741aeeeb05c9c3188a9b76d5ddd7742fd 100644 (file)
@@ -134,7 +134,7 @@ fn check_closure(&mut self,
             self.closures_with_inferred_kinds.insert(expr.id);
             self.fcx.inh.closure_kinds.borrow_mut().insert(closure_def_id, ty::FnClosureKind);
             debug!("check_closure: adding closure_id={} to closures_with_inferred_kinds",
-                   closure_def_id.repr(self.tcx()));
+                   closure_def_id.repr());
         }
 
         ty::with_freevars(self.tcx(), expr.id, |freevars| {
@@ -246,7 +246,7 @@ fn adjust_upvar_borrow_kind_for_consume(&self,
                                             mode: euv::ConsumeMode)
     {
         debug!("adjust_upvar_borrow_kind_for_consume(cmt={}, mode={:?})",
-               cmt.repr(self.tcx()), mode);
+               cmt.repr(), mode);
 
         // we only care about moves
         match mode {
@@ -259,7 +259,7 @@ fn adjust_upvar_borrow_kind_for_consume(&self,
         // by value instead
         let guarantor = cmt.guarantor();
         debug!("adjust_upvar_borrow_kind_for_consume: guarantor={}",
-               guarantor.repr(self.tcx()));
+               guarantor.repr());
         match guarantor.cat {
             mc::cat_deref(_, _, mc::BorrowedPtr(..)) |
             mc::cat_deref(_, _, mc::Implicit(..)) => {
@@ -297,7 +297,7 @@ fn adjust_upvar_borrow_kind_for_consume(&self,
     /// those upvars must be borrowed using an `&mut` borrow.
     fn adjust_upvar_borrow_kind_for_mut(&mut self, cmt: mc::cmt<'tcx>) {
         debug!("adjust_upvar_borrow_kind_for_mut(cmt={})",
-               cmt.repr(self.tcx()));
+               cmt.repr());
 
         match cmt.cat.clone() {
             mc::cat_deref(base, _, mc::Unique) |
@@ -331,7 +331,7 @@ fn adjust_upvar_borrow_kind_for_mut(&mut self, cmt: mc::cmt<'tcx>) {
 
     fn adjust_upvar_borrow_kind_for_unique(&self, cmt: mc::cmt<'tcx>) {
         debug!("adjust_upvar_borrow_kind_for_unique(cmt={})",
-               cmt.repr(self.tcx()));
+               cmt.repr());
 
         match cmt.cat.clone() {
             mc::cat_deref(base, _, mc::Unique) |
@@ -498,7 +498,7 @@ fn consume(&mut self,
                cmt: mc::cmt<'tcx>,
                mode: euv::ConsumeMode)
     {
-        debug!("consume(cmt={},mode={:?})", cmt.repr(self.tcx()), mode);
+        debug!("consume(cmt={},mode={:?})", cmt.repr(), mode);
         self.adjust_upvar_borrow_kind_for_consume(cmt, mode);
     }
 
@@ -513,7 +513,7 @@ fn consume_pat(&mut self,
                    cmt: mc::cmt<'tcx>,
                    mode: euv::ConsumeMode)
     {
-        debug!("consume_pat(cmt={},mode={:?})", cmt.repr(self.tcx()), mode);
+        debug!("consume_pat(cmt={},mode={:?})", cmt.repr(), mode);
         self.adjust_upvar_borrow_kind_for_consume(cmt, mode);
     }
 
@@ -526,7 +526,7 @@ fn borrow(&mut self,
               _loan_cause: euv::LoanCause)
     {
         debug!("borrow(borrow_id={}, cmt={}, bk={:?})",
-               borrow_id, cmt.repr(self.tcx()), bk);
+               borrow_id, cmt.repr(), bk);
 
         match bk {
             ty::ImmBorrow => { }
@@ -551,7 +551,7 @@ fn mutate(&mut self,
               _mode: euv::MutateMode)
     {
         debug!("mutate(assignee_cmt={})",
-               assignee_cmt.repr(self.tcx()));
+               assignee_cmt.repr());
 
         self.adjust_upvar_borrow_kind_for_mut(assignee_cmt);
     }
index 779f48d1e1b9e0109ed627fd4e67ee4053f5884b..bd7b212d3206365f3aa57ed324241c120da94aa2 100644 (file)
@@ -350,7 +350,7 @@ fn report_bivariance(&self,
                          param_name: ast::Name)
     {
         span_err!(self.tcx().sess, span, E0392,
-            "parameter `{}` is never used", param_name.user_string(self.tcx()));
+            "parameter `{}` is never used", param_name.user_string());
 
         let suggested_marker_id = self.tcx().lang_items.phantom_data();
         match suggested_marker_id {
@@ -358,7 +358,7 @@ fn report_bivariance(&self,
                 self.tcx().sess.fileline_help(
                     span,
                     &format!("consider removing `{}` or using a marker such as `{}`",
-                             param_name.user_string(self.tcx()),
+                             param_name.user_string(),
                              ty::item_path_str(self.tcx(), def_id)));
             }
             None => {
@@ -395,7 +395,7 @@ fn report_bound_error<'t>(tcx: &ty::ctxt<'t>,
             "cannot bound type `{}`, where clause \
                 bounds may only be attached to types involving \
                 type parameters",
-                bounded_ty.repr(tcx))
+                bounded_ty.repr())
     }
 
     fn is_ty_param(ty: ty::Ty) -> bool {
@@ -536,7 +536,7 @@ fn tcx(&self) -> &ty::ctxt<'tcx> {
     }
 
     fn fold_binder<T>(&mut self, binder: &ty::Binder<T>) -> ty::Binder<T>
-        where T : TypeFoldable<'tcx> + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + Repr
     {
         self.binding_count += 1;
         let value = liberate_late_bound_regions(
@@ -544,7 +544,7 @@ fn fold_binder<T>(&mut self, binder: &ty::Binder<T>) -> ty::Binder<T>
             region::DestructionScopeData::new(self.scope),
             binder);
         debug!("BoundsChecker::fold_binder: late-bound regions replaced: {} at scope: {:?}",
-               value.repr(self.tcx()), self.scope);
+               value.repr(), self.scope);
         let value = value.fold_with(self);
         self.binding_count -= 1;
         ty::Binder(value)
@@ -552,7 +552,7 @@ fn fold_binder<T>(&mut self, binder: &ty::Binder<T>) -> ty::Binder<T>
 
     fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
         debug!("BoundsChecker t={}",
-               t.repr(self.tcx()));
+               t.repr());
 
         match self.cache {
             Some(ref mut cache) => {
index 3ecef67ed9895ee20882b7939af6cff3a73eea6e..1be7e42b7170dc90d567611568cd1f1f6a47e8b5 100644 (file)
@@ -172,7 +172,7 @@ fn visit_pat(&mut self, p: &ast::Pat) {
         debug!("Type for pattern binding {} (id {}) resolved to {}",
                pat_to_string(p),
                p.id,
-               ty::node_id_to_type(self.tcx(), p.id).repr(self.tcx()));
+               ty::node_id_to_type(self.tcx(), p.id).repr());
 
         visit::walk_pat(self, p);
     }
@@ -216,8 +216,8 @@ fn visit_upvar_borrow_map(&self) {
                 }
             };
             debug!("Upvar capture for {} resolved to {}",
-                   upvar_id.repr(self.tcx()),
-                   new_upvar_capture.repr(self.tcx()));
+                   upvar_id.repr(),
+                   new_upvar_capture.repr());
             self.fcx.tcx().upvar_capture_map.borrow_mut().insert(*upvar_id, new_upvar_capture);
         }
     }
@@ -245,7 +245,7 @@ fn visit_node_id(&self, reason: ResolveReason, id: ast::NodeId) {
         let n_ty = self.fcx.node_ty(id);
         let n_ty = self.resolve(&n_ty, reason);
         write_ty_to_tcx(self.tcx(), id, n_ty);
-        debug!("Node {} has type {}", id, n_ty.repr(self.tcx()));
+        debug!("Node {} has type {}", id, n_ty.repr());
 
         // Resolve any substitutions
         self.fcx.opt_node_ty_substs(id, |item_substs| {
@@ -296,7 +296,7 @@ fn visit_method_map_entry(&self,
             Some(method) => {
                 debug!("writeback::resolve_method_map_entry(call={:?}, entry={})",
                        method_call,
-                       method.repr(self.tcx()));
+                       method.repr());
                 let new_method = MethodCallee {
                     origin: self.resolve(&method.origin, reason),
                     ty: self.resolve(&method.ty, reason),
@@ -428,7 +428,7 @@ fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
             Ok(t) => t,
             Err(e) => {
                 debug!("Resolver::fold_ty: input type `{}` not fully resolvable",
-                       t.repr(self.tcx));
+                       t.repr());
                 self.report_error(e);
                 self.tcx().types.err
             }
index cd7be46f9e01210ede09af8d4dddc9285bf73927..59b57a492649196c9c45de761d174719a6303e42 100644 (file)
@@ -82,7 +82,7 @@ fn get_base_type_def_id<'a, 'tcx>(inference_context: &InferCtxt<'a, 'tcx>,
             inference_context.tcx.sess.span_bug(
                 span,
                 &format!("coherence encountered unexpected type searching for base type: {}",
-                        ty.repr(inference_context.tcx)));
+                        ty.repr()));
         }
     }
 }
@@ -150,7 +150,7 @@ fn check_implementation(&self, item: &Item) {
         if let Some(trait_ref) = ty::impl_trait_ref(self.crate_context.tcx,
                                                     impl_did) {
             debug!("(checking implementation) adding impl for trait '{}', item '{}'",
-                   trait_ref.repr(self.crate_context.tcx),
+                   trait_ref.repr(),
                    token::get_ident(item.ident));
 
             enforce_trait_manually_implementable(self.crate_context.tcx,
@@ -180,7 +180,7 @@ fn instantiate_default_methods(
             all_impl_items: &mut Vec<ImplOrTraitItemId>) {
         let tcx = self.crate_context.tcx;
         debug!("instantiate_default_methods(impl_id={:?}, trait_ref={})",
-               impl_id, trait_ref.repr(tcx));
+               impl_id, trait_ref.repr());
 
         let impl_type_scheme = ty::lookup_item_type(tcx, impl_id);
 
@@ -190,7 +190,7 @@ fn instantiate_default_methods(
             let new_id = tcx.sess.next_node_id();
             let new_did = local_def(new_id);
 
-            debug!("new_did={:?} trait_method={}", new_did, trait_method.repr(tcx));
+            debug!("new_did={:?} trait_method={}", new_did, trait_method.repr());
 
             // Create substitutions for the various trait parameters.
             let new_method_ty =
@@ -203,7 +203,7 @@ fn instantiate_default_methods(
                     &**trait_method,
                     Some(trait_method.def_id)));
 
-            debug!("new_method_ty={}", new_method_ty.repr(tcx));
+            debug!("new_method_ty={}", new_method_ty.repr());
             all_impl_items.push(MethodTraitItemId(new_did));
 
             // construct the polytype for the method based on the
@@ -214,7 +214,7 @@ fn instantiate_default_methods(
                 ty: ty::mk_bare_fn(tcx, Some(new_did),
                                    tcx.mk_bare_fn(new_method_ty.fty.clone()))
             };
-            debug!("new_polytype={}", new_polytype.repr(tcx));
+            debug!("new_polytype={}", new_polytype.repr());
 
             tcx.tcache.borrow_mut().insert(new_did, new_polytype);
             tcx.predicates.borrow_mut().insert(new_did, new_method_ty.predicates.clone());
@@ -361,7 +361,7 @@ fn check_implementations_of_copy(&self) {
 
         copy_trait.for_each_impl(tcx, |impl_did| {
             debug!("check_implementations_of_copy: impl_did={}",
-                   impl_did.repr(tcx));
+                   impl_did.repr());
 
             if impl_did.krate != ast::LOCAL_CRATE {
                 debug!("check_implementations_of_copy(): impl not in this \
@@ -371,7 +371,7 @@ fn check_implementations_of_copy(&self) {
 
             let self_type = ty::lookup_item_type(tcx, impl_did);
             debug!("check_implementations_of_copy: self_type={} (bound)",
-                   self_type.repr(tcx));
+                   self_type.repr());
 
             let span = tcx.map.span(impl_did.node);
             let param_env = ParameterEnvironment::for_item(tcx, impl_did.node);
@@ -379,7 +379,7 @@ fn check_implementations_of_copy(&self) {
             assert!(!self_type.has_escaping_regions());
 
             debug!("check_implementations_of_copy: self_type={} (free)",
-                   self_type.repr(tcx));
+                   self_type.repr());
 
             match ty::can_type_implement_copy(&param_env, span, self_type) {
                 Ok(()) => {}
@@ -430,7 +430,7 @@ fn check_implementations_of_coerce_unsized(&self) {
 
         trait_def.for_each_impl(tcx, |impl_did| {
             debug!("check_implementations_of_coerce_unsized: impl_did={}",
-                   impl_did.repr(tcx));
+                   impl_did.repr());
 
             if impl_did.krate != ast::LOCAL_CRATE {
                 debug!("check_implementations_of_coerce_unsized(): impl not \
@@ -443,7 +443,7 @@ fn check_implementations_of_coerce_unsized(&self) {
                                                impl_did).unwrap();
             let target = *trait_ref.substs.types.get(subst::TypeSpace, 0);
             debug!("check_implementations_of_coerce_unsized: {} -> {} (bound)",
-                   source.repr(tcx), target.repr(tcx));
+                   source.repr(), target.repr());
 
             let span = tcx.map.span(impl_did.node);
             let param_env = ParameterEnvironment::for_item(tcx, impl_did.node);
@@ -452,7 +452,7 @@ fn check_implementations_of_coerce_unsized(&self) {
             assert!(!source.has_escaping_regions());
 
             debug!("check_implementations_of_coerce_unsized: {} -> {} (free)",
-                   source.repr(tcx), target.repr(tcx));
+                   source.repr(), target.repr());
 
             let infcx = new_infer_ctxt(tcx);
 
@@ -520,8 +520,8 @@ fn check_implementations_of_coerce_unsized(&self) {
                                                 } else {
                                                     token::get_name(name).to_string()
                                                 },
-                                                a.repr(tcx),
-                                                b.repr(tcx))
+                                                a.repr(),
+                                                b.repr())
                                    }).collect::<Vec<_>>().connect(", "));
                         return;
                     }
@@ -598,7 +598,7 @@ fn subst_receiver_types_in_method_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
     let combined_substs = ty::make_substs_for_receiver_types(tcx, trait_ref, method);
 
     debug!("subst_receiver_types_in_method_ty: combined_substs={}",
-           combined_substs.repr(tcx));
+           combined_substs.repr());
 
     let method_predicates = method.predicates.subst(tcx, &combined_substs);
     let mut method_generics = method.generics.subst(tcx, &combined_substs);
@@ -615,12 +615,12 @@ fn subst_receiver_types_in_method_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
     }
 
     debug!("subst_receiver_types_in_method_ty: method_generics={}",
-           method_generics.repr(tcx));
+           method_generics.repr());
 
     let method_fty = method.fty.subst(tcx, &combined_substs);
 
     debug!("subst_receiver_types_in_method_ty: method_ty={}",
-           method.fty.repr(tcx));
+           method.fty.repr());
 
     ty::Method::new(
         method.name,
index d815893524ff3b1f79c69f2dbbe28f7edbd11a6f..5c99998b95325256206f179bef6a3ed46fe5156b 100644 (file)
@@ -66,7 +66,7 @@ fn check_item(&self, item: &ast::Item) {
             ast::ItemImpl(_, _, _, None, _, _) => {
                 // For inherent impls, self type must be a nominal type
                 // defined in this crate.
-                debug!("coherence2::orphan check: inherent impl {}", item.repr(self.tcx));
+                debug!("coherence2::orphan check: inherent impl {}", item.repr());
                 let self_ty = ty::lookup_item_type(self.tcx, def_id).ty;
                 match self_ty.sty {
                     ty::TyEnum(def_id, _) |
@@ -208,7 +208,7 @@ fn check_item(&self, item: &ast::Item) {
             }
             ast::ItemImpl(_, _, _, Some(_), _, _) => {
                 // "Trait" impl
-                debug!("coherence2::orphan check: trait impl {}", item.repr(self.tcx));
+                debug!("coherence2::orphan check: trait impl {}", item.repr());
                 let trait_ref = ty::impl_trait_ref(self.tcx, def_id).unwrap();
                 let trait_def_id = trait_ref.def_id;
                 match traits::orphan_check(self.tcx, def_id) {
@@ -227,7 +227,7 @@ fn check_item(&self, item: &ast::Item) {
                                 "type parameter `{}` must be used as the type parameter for \
                                  some local type (e.g. `MyStruct<T>`); only traits defined in \
                                  the current crate can be implemented for a type parameter",
-                                param_ty.user_string(self.tcx));
+                                param_ty.user_string());
                         return;
                     }
                 }
@@ -266,8 +266,8 @@ fn check_item(&self, item: &ast::Item) {
                 // rules, but it invalidates the reasoning from
                 // `two_foos` above.
                 debug!("trait_ref={} trait_def_id={} trait_has_default_impl={}",
-                       trait_ref.repr(self.tcx),
-                       trait_def_id.repr(self.tcx),
+                       trait_ref.repr(),
+                       trait_def_id.repr(),
                        ty::trait_has_default_impl(self.tcx, trait_def_id));
                 if
                     ty::trait_has_default_impl(self.tcx, trait_def_id) &&
@@ -305,7 +305,7 @@ fn check_item(&self, item: &ast::Item) {
                                  can only be implemented for a struct/enum type, \
                                  not `{}`",
                                 ty::item_path_str(self.tcx, trait_def_id),
-                                self_ty.user_string(self.tcx)))
+                                self_ty.user_string()))
                         }
                     };
 
@@ -329,7 +329,7 @@ fn check_item(&self, item: &ast::Item) {
             }
             ast::ItemDefaultImpl(..) => {
                 // "Trait" impl
-                debug!("coherence2::orphan check: default trait impl {}", item.repr(self.tcx));
+                debug!("coherence2::orphan check: default trait impl {}", item.repr());
                 let trait_ref = ty::impl_trait_ref(self.tcx, def_id).unwrap();
                 if trait_ref.def_id.krate != ast::LOCAL_CRATE {
                     span_err!(self.tcx.sess, item.span, E0318,
index 7564f7862fcd952c3ac9e34d59a28835b78f6686..74ce9ed540ecbabae4e8a323486fda6d64d22dff 100644 (file)
@@ -62,7 +62,7 @@ fn check_for_overlapping_impls_of_trait(&self,
                                             trait_def: &'tcx ty::TraitDef<'tcx>)
     {
         debug!("check_for_overlapping_impls_of_trait(trait_def={})",
-               trait_def.repr(self.tcx));
+               trait_def.repr());
 
         // We should already know all impls of this trait, so these
         // borrows are safe.
@@ -132,9 +132,9 @@ fn check_if_impls_overlap(&self,
             impl1_def_id, impl2_def_id)
         {
             debug!("check_if_impls_overlap({}, {}, {})",
-                   trait_def_id.repr(self.tcx),
-                   impl1_def_id.repr(self.tcx),
-                   impl2_def_id.repr(self.tcx));
+                   trait_def_id.repr(),
+                   impl1_def_id.repr(),
+                   impl2_def_id.repr());
 
             let infcx = infer::new_infer_ctxt(self.tcx);
             if traits::overlapping_impls(&infcx, impl1_def_id, impl2_def_id) {
@@ -217,7 +217,7 @@ fn visit_item(&mut self, item: &'v ast::Item) {
                                 span_err!(self.tcx.sess, item.span, E0371,
                                           "the object type `{}` automatically \
                                            implements the trait `{}`",
-                                          trait_ref.self_ty().user_string(self.tcx),
+                                          trait_ref.self_ty().user_string(),
                                           ty::item_path_str(self.tcx, trait_def_id));
                             }
                         }
index e4926b119d5dbe551808b3e8bb2db99d0afd7d12..fe276b3d1bdedc1be15a519c942fc3ca6fdc8582 100644 (file)
@@ -55,14 +55,14 @@ fn check_unsafety_coherence(&mut self, item: &'v ast::Item,
                     (ast::Unsafety::Normal, ast::Unsafety::Unsafe, _) => {
                         span_err!(self.tcx.sess, item.span, E0199,
                                   "implementing the trait `{}` is not unsafe",
-                                  trait_ref.user_string(self.tcx));
+                                  trait_ref.user_string());
                     }
 
                     (ast::Unsafety::Unsafe,
                      ast::Unsafety::Normal, ast::ImplPolarity::Positive) => {
                         span_err!(self.tcx.sess, item.span, E0200,
                                   "the trait `{}` requires an `unsafe impl` declaration",
-                                  trait_ref.user_string(self.tcx));
+                                  trait_ref.user_string());
                     }
 
                     (ast::Unsafety::Unsafe,
index 03a0c2f5b62e5884a83975a76f79b714ff9eda01..ff7c8e69a6b452becfb101194868050919c8eeff 100644 (file)
@@ -255,7 +255,7 @@ fn report_cycle(&self,
                 tcx.sess.note(
                     &format!("the cycle begins when computing the bounds \
                               for type parameter `{}`...",
-                             def.name.user_string(tcx)));
+                             def.name.user_string()));
             }
         }
 
@@ -277,7 +277,7 @@ fn report_cycle(&self,
                     tcx.sess.note(
                         &format!("...which then requires computing the bounds \
                                   for type parameter `{}`...",
-                                 def.name.user_string(tcx)));
+                                 def.name.user_string()));
                 }
             }
         }
@@ -300,7 +300,7 @@ fn report_cycle(&self,
                 tcx.sess.note(
                     &format!("...which then again requires computing the bounds \
                               for type parameter `{}`, completing the cycle.",
-                             def.name.user_string(tcx)));
+                             def.name.user_string()));
             }
         }
     }
@@ -317,7 +317,7 @@ fn get_trait_def(&self, trait_id: ast::DefId)
 
         let item = match tcx.map.get(trait_id.node) {
             ast_map::NodeItem(item) => item,
-            _ => tcx.sess.bug(&format!("get_trait_def({}): not an item", trait_id.repr(tcx)))
+            _ => tcx.sess.bug(&format!("get_trait_def({}): not an item", trait_id.repr()))
         };
 
         trait_def_of_item(self, &*item)
@@ -372,7 +372,7 @@ fn ensure_super_predicates(&self,
                                -> Result<(), ErrorReported>
     {
         debug!("ensure_super_predicates(trait_def_id={})",
-               trait_def_id.repr(self.tcx()));
+               trait_def_id.repr());
 
         self.ccx.ensure_super_predicates(span, trait_def_id)
     }
@@ -635,7 +635,7 @@ fn convert_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     let fty = ty::mk_bare_fn(ccx.tcx, Some(def_id),
                              ccx.tcx.mk_bare_fn(ty_method.fty.clone()));
     debug!("method {} (id {}) has type {}",
-            ident.repr(ccx.tcx), id, fty.repr(ccx.tcx));
+            ident.repr(), id, fty.repr());
     ccx.tcx.tcache.borrow_mut().insert(def_id,TypeScheme {
         generics: ty_method.generics.clone(),
         ty: fty
@@ -645,7 +645,7 @@ fn convert_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     write_ty_to_tcx(ccx.tcx, id, fty);
 
     debug!("writing method type: def_id={:?} mty={}",
-            def_id, ty_method.repr(ccx.tcx));
+            def_id, ty_method.repr());
 
     ccx.tcx.impl_or_trait_items.borrow_mut().insert(def_id,
         ty::MethodTraitItem(Rc::new(ty_method)));
@@ -743,9 +743,9 @@ fn convert_methods<'a,'tcx,'i,I>(ccx: &CrateCtxt<'a, 'tcx>,
     where I: Iterator<Item=(&'i ast::MethodSig, ast::NodeId, ast::Ident, ast::Visibility, Span)>
 {
     debug!("convert_methods(untransformed_rcvr_ty={}, rcvr_ty_generics={}, rcvr_ty_predicates={})",
-           untransformed_rcvr_ty.repr(ccx.tcx),
-           rcvr_ty_generics.repr(ccx.tcx),
-           rcvr_ty_predicates.repr(ccx.tcx));
+           untransformed_rcvr_ty.repr(),
+           rcvr_ty_generics.repr(),
+           rcvr_ty_predicates.repr());
 
     let tcx = ccx.tcx;
     let mut seen_methods = FnvHashSet();
@@ -1139,7 +1139,7 @@ fn ensure_super_predicates_step(ccx: &CrateCtxt,
 {
     let tcx = ccx.tcx;
 
-    debug!("ensure_super_predicates_step(trait_def_id={})", trait_def_id.repr(tcx));
+    debug!("ensure_super_predicates_step(trait_def_id={})", trait_def_id.repr());
 
     if trait_def_id.krate != ast::LOCAL_CRATE {
         // If this trait comes from an external crate, then all of the
@@ -1192,8 +1192,8 @@ fn ensure_super_predicates_step(ccx: &CrateCtxt,
             predicates: VecPerParamSpace::new(superbounds, vec![], vec![])
         };
         debug!("superpredicates for trait {} = {}",
-               local_def(item.id).repr(ccx.tcx),
-               superpredicates.repr(ccx.tcx));
+               local_def(item.id).repr(),
+               superpredicates.repr());
 
         tcx.super_predicates.borrow_mut().insert(trait_def_id, superpredicates.clone());
 
@@ -1206,7 +1206,7 @@ fn ensure_super_predicates_step(ccx: &CrateCtxt,
                                          .map(|tr| tr.def_id())
                                          .collect();
 
-    debug!("ensure_super_predicates_step: def_ids={}", def_ids.repr(tcx));
+    debug!("ensure_super_predicates_step: def_ids={}", def_ids.repr());
 
     def_ids
 }
@@ -1532,9 +1532,9 @@ fn convert_typed_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
             scheme.generics.types.iter()
                                  .map(|t| match t.object_lifetime_default {
                                      Some(ty::ObjectLifetimeDefault::Specific(r)) =>
-                                         r.user_string(tcx),
+                                         r.user_string(),
                                      d =>
-                                         d.repr(ccx.tcx),
+                                         d.repr(),
                                  })
                                  .collect::<Vec<String>>()
                                  .connect(",");
@@ -1621,7 +1621,7 @@ fn ty_generics_for_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                    -> ty::Generics<'tcx>
 {
     debug!("ty_generics_for_trait(trait_id={}, substs={})",
-           local_def(trait_id).repr(ccx.tcx), substs.repr(ccx.tcx));
+           local_def(trait_id).repr(), substs.repr());
 
     let mut generics = ty_generics_for_type_or_impl(ccx, ast_generics);
 
@@ -2202,10 +2202,10 @@ fn check_method_self_type<'a, 'tcx, RS:RegionScope>(
 
         debug!("required_type={} required_type_free={} \
                 base_type={} base_type_free={}",
-               required_type.repr(tcx),
-               required_type_free.repr(tcx),
-               base_type.repr(tcx),
-               base_type_free.repr(tcx));
+               required_type.repr(),
+               required_type_free.repr(),
+               base_type.repr(),
+               base_type_free.repr());
 
         let infcx = infer::new_infer_ctxt(tcx);
         drop(::require_same_types(tcx,
@@ -2216,7 +2216,7 @@ fn check_method_self_type<'a, 'tcx, RS:RegionScope>(
                                   required_type_free,
                                   || {
                 format!("mismatched self type: expected `{}`",
-                         required_type.user_string(tcx))
+                         required_type.user_string())
         }));
 
         // We could conceviably add more free-region relations here,
@@ -2235,7 +2235,7 @@ fn liberate_early_bound_regions<'tcx,T>(
         scope: region::DestructionScopeData,
         value: &T)
         -> T
-        where T : TypeFoldable<'tcx> + Repr<'tcx>
+        where T : TypeFoldable<'tcx> + Repr
     {
         /*!
          * Convert early-bound regions into free regions; normally this is done by
@@ -2286,7 +2286,7 @@ fn enforce_impl_params_are_constrained<'tcx>(tcx: &ty::ctxt<'tcx>,
                                      idx: index as u32,
                                      name: ty_param.ident.name };
         if !input_parameters.contains(&ctp::Parameter::Type(param_ty)) {
-            report_unused_parameter(tcx, ty_param.span, "type", &param_ty.user_string(tcx));
+            report_unused_parameter(tcx, ty_param.span, "type", &param_ty.user_string());
         }
     }
 
@@ -2316,7 +2316,7 @@ fn enforce_impl_params_are_constrained<'tcx>(tcx: &ty::ctxt<'tcx>,
             !input_parameters.contains(&ctp::Parameter::Region(region))
         {
             report_unused_parameter(tcx, lifetime_def.lifetime.span,
-                                    "lifetime", &region.name.user_string(tcx));
+                                    "lifetime", &region.name.user_string());
         }
     }
 
index 0ea5073bb2490a7a3c56e743e1376ca5215ad5ca..3f779d679448295f1e2467fbf375e45159c96017 100644 (file)
@@ -148,7 +148,7 @@ pub struct CrateCtxt<'a, 'tcx: 'a> {
 
 // Functions that write types into the node type table
 fn write_ty_to_tcx<'tcx>(tcx: &ty::ctxt<'tcx>, node_id: ast::NodeId, ty: Ty<'tcx>) {
-    debug!("write_ty_to_tcx({}, {})", node_id,  ty.repr(tcx));
+    debug!("write_ty_to_tcx({}, {})", node_id,  ty.repr());
     assert!(!ty::type_needs_infer(ty));
     tcx.node_type_insert(node_id, ty);
 }
@@ -159,7 +159,7 @@ fn write_substs_to_tcx<'tcx>(tcx: &ty::ctxt<'tcx>,
     if !item_substs.is_noop() {
         debug!("write_substs_to_tcx({}, {})",
                node_id,
-               item_substs.repr(tcx));
+               item_substs.repr());
 
         assert!(item_substs.substs.types.all(|t| !ty::type_needs_infer(*t)));
 
@@ -244,14 +244,14 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
             require_same_types(tcx, None, false, main_span, main_t, se_ty,
                 || {
                     format!("main function expects type: `{}`",
-                             se_ty.user_string(ccx.tcx))
+                             se_ty.user_string())
                 });
         }
         _ => {
             tcx.sess.span_bug(main_span,
                               &format!("main has a non-function type: found \
                                        `{}`",
-                                      main_t.repr(tcx)));
+                                      main_t.repr()));
         }
     }
 }
@@ -294,7 +294,7 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
             require_same_types(tcx, None, false, start_span, start_t, se_ty,
                 || {
                     format!("start function expects type: `{}`",
-                             se_ty.user_string(ccx.tcx))
+                             se_ty.user_string())
                 });
 
         }
@@ -302,7 +302,7 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
             tcx.sess.span_bug(start_span,
                               &format!("start has a non-function type: found \
                                        `{}`",
-                                       start_t.repr(tcx)));
+                                       start_t.repr()));
         }
     }
 }
index 37088701adcd6ff7ca06fea6727fda6c59e9f1d8..3085598e4a3ae9a4ede23990dcd12cbb1834a939 100644 (file)
@@ -518,7 +518,7 @@ fn num_inferred(&self) -> usize {
 
 impl<'a, 'tcx, 'v> Visitor<'v> for TermsContext<'a, 'tcx> {
     fn visit_item(&mut self, item: &ast::Item) {
-        debug!("add_inferreds for item {}", item.repr(self.tcx));
+        debug!("add_inferreds for item {}", item.repr());
 
         match item.node {
             ast::ItemEnum(_, ref generics) |
@@ -601,7 +601,7 @@ fn visit_item(&mut self, item: &ast::Item) {
         let tcx = self.terms_cx.tcx;
 
         debug!("visit_item item={}",
-               item.repr(tcx));
+               item.repr());
 
         match item.node {
             ast::ItemEnum(ref enum_definition, _) => {
@@ -847,7 +847,7 @@ fn add_constraints_from_trait_ref(&mut self,
                                       trait_ref: ty::TraitRef<'tcx>,
                                       variance: VarianceTermPtr<'a>) {
         debug!("add_constraints_from_trait_ref: trait_ref={} variance={:?}",
-               trait_ref.repr(self.tcx()),
+               trait_ref.repr(),
                variance);
 
         let trait_def = ty::lookup_trait_def(self.tcx(), trait_ref.def_id);
@@ -869,7 +869,7 @@ fn add_constraints_from_ty(&mut self,
                                ty: Ty<'tcx>,
                                variance: VarianceTermPtr<'a>) {
         debug!("add_constraints_from_ty(ty={}, variance={:?})",
-               ty.repr(self.tcx()),
+               ty.repr(),
                variance);
 
         match ty.sty {
@@ -983,7 +983,7 @@ fn add_constraints_from_ty(&mut self,
                 self.tcx().sess.bug(
                     &format!("unexpected type encountered in \
                             variance inference: {}",
-                            ty.repr(self.tcx())));
+                            ty.repr()));
             }
         }
     }
@@ -999,8 +999,8 @@ fn add_constraints_from_substs(&mut self,
                                    substs: &subst::Substs<'tcx>,
                                    variance: VarianceTermPtr<'a>) {
         debug!("add_constraints_from_substs(def_id={}, substs={}, variance={:?})",
-               def_id.repr(self.tcx()),
-               substs.repr(self.tcx()),
+               def_id.repr(),
+               substs.repr(),
                variance);
 
         for p in type_param_defs {
@@ -1068,7 +1068,7 @@ fn add_constraints_from_region(&mut self,
                     .sess
                     .bug(&format!("unexpected region encountered in variance \
                                   inference: {}",
-                                 region.repr(self.tcx())));
+                                 region.repr()));
             }
         }
     }
@@ -1197,14 +1197,14 @@ fn write(&self) {
             };
             debug!("item_id={} item_variances={}",
                     item_id,
-                    item_variances.repr(tcx));
+                    item_variances.repr());
 
             let item_def_id = ast_util::local_def(item_id);
 
             // For unit testing: check for a special "rustc_variance"
             // attribute and report an error with various results if found.
             if ty::has_attr(tcx, item_def_id, "rustc_variance") {
-                let found = item_variances.repr(tcx);
+                let found = item_variances.repr();
                 span_err!(tcx.sess, tcx.map.span(item_id), E0208, "{}", &found[..]);
             }